diff --git a/dist/libarchive.wasm b/dist/libarchive.wasm index 9b9e93b..31fd233 100644 Binary files a/dist/libarchive.wasm and b/dist/libarchive.wasm differ diff --git a/dist/worker-bundle-node.mjs b/dist/worker-bundle-node.mjs index 03b3735..bdf8de5 100644 --- a/dist/worker-bundle-node.mjs +++ b/dist/worker-bundle-node.mjs @@ -3,7 +3,7 @@ import{parentPort as e}from"worker_threads"; * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 - */const r=Symbol("Comlink.proxy"),t=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),o=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),s=e=>"object"==typeof e&&null!==e||"function"==typeof e,i=new Map([["proxy",{canHandle:e=>s(e)&&e[r],serialize(e){const{port1:r,port2:t}=new MessageChannel;return u(e,r),[t,[t]]},deserialize(e){return e.start(),m(e,[],r);var r}}],["throw",{canHandle:e=>s(e)&&a in e,serialize({value:e}){let r;return r=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[r,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function u(e,t=globalThis,n=["*"]){t.addEventListener("message",(function s(i){if(!i||!i.data)return;if(!function(e,r){for(const t of e){if(r===t||"*"===t)return!0;if(t instanceof RegExp&&t.test(r))return!0}return!1}(n,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:c,type:d,path:h}=Object.assign({path:[]},i.data),f=(i.data.argumentList||[]).map(g);let m;try{const t=h.slice(0,-1).reduce(((e,r)=>e[r]),e),n=h.reduce(((e,r)=>e[r]),e);switch(d){case"GET":m=n;break;case"SET":t[h.slice(-1)[0]]=g(i.data.value),m=!0;break;case"APPLY":m=n.apply(t,f);break;case"CONSTRUCT":m=function(e){return Object.assign(e,{[r]:!0})}(new n(...f));break;case"ENDPOINT":{const{port1:r,port2:t}=new MessageChannel;u(e,t),m=function(e,r){return v.set(e,r),e}(r,[r])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[a]:0}}Promise.resolve(m).catch((e=>({value:e,[a]:0}))).then((r=>{const[n,a]=w(r);t.postMessage(Object.assign(Object.assign({},n),{id:c}),a),"RELEASE"===d&&(t.removeEventListener("message",s),l(t),o in e&&"function"==typeof e[o]&&e[o]())})).catch((e=>{const[r,n]=w({value:new TypeError("Unserializable return value"),[a]:0});t.postMessage(Object.assign(Object.assign({},r),{id:c}),n)}))})),t.start&&t.start()}function l(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function c(e){if(e)throw new Error("Proxy has been released and is not useable")}function d(e){return _(e,{type:"RELEASE"}).then((()=>{l(e)}))}const h=new WeakMap,f="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const r=(h.get(e)||0)-1;h.set(e,r),0===r&&d(e)}));function m(e,r=[],o=function(){}){let a=!1;const s=new Proxy(o,{get(t,o){if(c(a),o===n)return()=>{!function(e){f&&f.unregister(e)}(s),d(e),a=!0};if("then"===o){if(0===r.length)return{then:()=>s};const t=_(e,{type:"GET",path:r.map((e=>e.toString()))}).then(g);return t.then.bind(t)}return m(e,[...r,o])},set(t,n,o){c(a);const[s,i]=w(o);return _(e,{type:"SET",path:[...r,n].map((e=>e.toString())),value:s},i).then(g)},apply(n,o,s){c(a);const i=r[r.length-1];if(i===t)return _(e,{type:"ENDPOINT"}).then(g);if("bind"===i)return m(e,r.slice(0,-1));const[u,l]=p(s);return _(e,{type:"APPLY",path:r.map((e=>e.toString())),argumentList:u},l).then(g)},construct(t,n){c(a);const[o,s]=p(n);return _(e,{type:"CONSTRUCT",path:r.map((e=>e.toString())),argumentList:o},s).then(g)}});return function(e,r){const t=(h.get(r)||0)+1;h.set(r,t),f&&f.register(e,r,e)}(s,e),s}function p(e){const r=e.map(w);return[r.map((e=>e[0])),(t=r.map((e=>e[1])),Array.prototype.concat.apply([],t))];var t}const v=new WeakMap;function w(e){for(const[r,t]of i)if(t.canHandle(e)){const[n,o]=t.serialize(e);return[{type:"HANDLER",name:r,value:n},o]}return[{type:"RAW",value:e},v.get(e)||[]]}function g(e){switch(e.type){case"HANDLER":return i.get(e.name).deserialize(e.value);case"RAW":return e.value}}function _(e,r,t){return new Promise((n=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function r(t){t.data&&t.data.id&&t.data.id===o&&(e.removeEventListener("message",r),n(t.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},r),t)}))}const y={32768:"FILE",16384:"DIR",40960:"SYMBOLIC_LINK",49152:"SOCKET",8192:"CHARACTER_DEVICE",24576:"BLOCK_DEVICE",4096:"NAMED_PIPE"};class E{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._file=null,this._passphrase=null,this._locale="en_US.UTF-8"}async open(e){null!==this._file&&(console.warn("Closing previous file"),this.close());const r=await this._loadFile(e);this._fileLength=r.length,this._filePtr=r.ptr}close(){this._runCode.closeArchive(this._archive),this._wasmModule._free(this._filePtr),this._file=null,this._filePtr=null,this._archive=null}hasEncryptedData(){this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale),this._runCode.getNextEntry(this._archive);const e=this._runCode.hasEncryptedEntries(this._archive);return 0!==e&&(e>0||null)}setPassphrase(e){this._passphrase=e}setLocale(e){this._locale=e}*entries(e=!1,r=null){let t;for(this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale);t=this._runCode.getNextEntry(this._archive),0!==t;){const n={size:this._runCode.getEntrySize(t),path:this._runCode.getEntryName(t),type:y[this._runCode.getEntryType(t)],lastModified:this._runCode.getEntryLastModified(t),ref:t};if("FILE"===n.type){let e=n.path.split("/");n.fileName=e[e.length-1]}if(e&&r!==n.path)this._runCode.skipEntry(this._archive);else{const e=this._runCode.getFileData(this._archive,n.size);if(e<0)throw new Error(this._runCode.getError(this._archive));n.fileData=this._wasmModule.HEAPU8.slice(e,e+n.size),this._wasmModule._free(e)}yield n}}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}}class b{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._passphrase=null,this._locale="en_US.UTF-8"}async write(e,r,t,n=null){let o=e.reduce(((e,{file:r})=>e+r.size+128),0)+128;const a=this._runCode.malloc(o),s=this._runCode.malloc(this._runCode.sizeOfSizeT()),i=this._runCode.startArchiveWrite(r,t,a,o,s,n);for(const{file:r,pathname:t}of e){const e=await this._loadFile(r);this._runCode.writeArchiveFile(i,t||r.name,e.length,e.ptr),this._runCode.free(e.ptr)}const u=this._runCode.closeArchiveWrite(i),l=this._runCode.freeArchiveWrite(i);if(0!==u||0!==l)throw new Error(this._runCode.getError(i));const c=this.readNumberFromPointer(s);return this._wasmModule.HEAPU8.slice(a,a+c)}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}readNumberFromPointer(e){const r=this._runCode.sizeOfSizeT(),t=this._wasmModule.HEAPU8.slice(e,e+r);let n=null;if(4==r)n=new Uint32Array(t)[0];else{if(8!=r)throw Error("Unexpected size of size_t: "+r);n=new BigUint64Array(t)[0]}return n}}var k,S=(k=import.meta.url,async function(e={}){var r,t,n=e;n.ready=new Promise(((e,n)=>{r=e,t=n}));var o,a,s,i=Object.assign({},n),u="./this.program",l=(e,r)=>{throw r},c="object"==typeof window,d="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";if(h){const{createRequire:e}=await import("module");var m=e(import.meta.url),p=m("fs"),v=m("path");f=d?v.dirname(f)+"/":m("url").fileURLToPath(new URL("./",import.meta.url)),o=(e,r)=>(e=Y(e)?new URL(e):v.normalize(e),p.readFileSync(e,r?void 0:"utf8")),s=e=>{var r=o(e,!0);return r.buffer||(r=new Uint8Array(r)),r},a=(e,r,t,n=!0)=>{e=Y(e)?new URL(e):v.normalize(e),p.readFile(e,n?void 0:"utf8",((e,o)=>{e?t(e):r(n?o.buffer:o)}))},!n.thisProgram&&process.argv.length>1&&(u=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),l=(e,r)=>{throw process.exitCode=e,r},n.inspect=()=>"[Emscripten Module object]"}else(c||d)&&(d?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),k&&(f=k),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},d&&(s=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),a=(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 w,g,_=n.print||console.log.bind(console),y=n.printErr||console.error.bind(console);Object.assign(n,i),i=null,n.arguments&&n.arguments,n.thisProgram&&(u=n.thisProgram),n.quit&&(l=n.quit),n.wasmBinary&&(w=n.wasmBinary),"object"!=typeof WebAssembly&&O("no native wasm support detected");var E,b,S,F,D,M=!1;function A(e,r){e||O(r)}function C(){var e=g.buffer;n.HEAP8=E=new Int8Array(e),n.HEAP16=S=new Int16Array(e),n.HEAPU8=b=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAP32=F=new Int32Array(e),n.HEAPU32=D=new Uint32Array(e),n.HEAPF32=new Float32Array(e),n.HEAPF64=new Float64Array(e)}var P=[],T=[],R=[],U=0,z=null;function L(e){U++,n.monitorRunDependencies?.(U)}function x(e){if(U--,n.monitorRunDependencies?.(U),0==U&&z){var r=z;z=null,r()}}function O(e){n.onAbort?.(e),y(e="Aborted("+e+")"),M=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw t(r),r}var N,B,j,I,H=e=>e.startsWith("data:application/octet-stream;base64,"),Y=e=>e.startsWith("file://");function W(e){if(e==N&&w)return new Uint8Array(w);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}function K(e,r,t){return function(e){if(!w&&(c||d)){if("function"==typeof fetch&&!Y(e))return fetch(e,{credentials:"same-origin"}).then((r=>{if(!r.ok)throw"failed to load wasm binary file at '"+e+"'";return r.arrayBuffer()})).catch((()=>W(e)));if(a)return new Promise(((r,t)=>{a(e,(e=>r(new Uint8Array(e))),t)}))}return Promise.resolve().then((()=>W(e)))}(e).then((e=>WebAssembly.instantiate(e,r))).then((e=>e)).then(t,(e=>{y(`failed to asynchronously prepare wasm: ${e}`),O(e)}))}function $(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}n.locateFile?H(N="libarchive.wasm")||(B=N,N=n.locateFile?n.locateFile(B,f):f+B):N=new URL("libarchive.wasm",import.meta.url).href;var q=e=>{for(;e.length>0;)e.shift()(n)},X=n.noExitRuntime||!0,Z={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=Z.isAbs(e),t="/"===e.substr(-1);return(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=Z.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=Z.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===r?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments);return Z.normalize(e.join("/"))},join2:(e,r)=>Z.normalize(e+"/"+r)},G=e=>(G=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return r=>e.randomFillSync(r);var r=e.randomBytes;return e=>(e.set(r(e.byteLength)),e)}catch(e){}O("initRandomDevice")})())(e),V={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:le.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=Z.isAbs(n)}return(r?"/":"")+(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||"."},relative:(e,r)=>{function t(e){for(var r=0;r=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=V.resolve(e).substr(1),r=V.resolve(r).substr(1);for(var n=t(e.split("/")),o=t(r.split("/")),a=Math.min(n.length,o.length),s=a,i=0;i{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&J)return J.decode(e.subarray(r,o));for(var a="";r>10,56320|1023&l)}}else a+=String.fromCharCode((31&s)<<6|i)}else a+=String.fromCharCode(s)}return a},ee=[],re=e=>{for(var r=0,t=0;t=55296&&n<=57343?(r+=4,++t):r+=3}return r},te=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,s=0;s=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++s)),i<=127){if(t>=a)break;r[t++]=i}else if(i<=2047){if(t+1>=a)break;r[t++]=192|i>>6,r[t++]=128|63&i}else if(i<=65535){if(t+2>=a)break;r[t++]=224|i>>12,r[t++]=128|i>>6&63,r[t++]=128|63&i}else{if(t+3>=a)break;r[t++]=240|i>>18,r[t++]=128|i>>12&63,r[t++]=128|i>>6&63,r[t++]=128|63&i}}return r[t]=0,t-o};function ne(e,r,t){var n=t>0?t:re(e)+1,o=new Array(n),a=te(e,o,0,o.length);return r&&(o.length=a),o}var oe={ttys:[],init(){},shutdown(){},register(e,r){oe.ttys[e]={input:[],output:[],ops:r},le.registerDevice(e,oe.stream_ops)},stream_ops:{open(e){var r=oe.ttys[e.node.rdev];if(!r)throw new le.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new le.ErrnoError(60);for(var a=0,s=0;s(()=>{if(!ee.length){var e=null;if(h){var r=Buffer.alloc(256),t=0,n=process.stdin.fd;try{t=p.readSync(n,r)}catch(e){if(!e.toString().includes("EOF"))throw e;t=0}e=t>0?r.slice(0,t).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;ee=ne(e,!0)}return ee.shift()})(),put_char(e,r){null===r||10===r?(_(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(_(Q(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,r,t)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,r){null===r||10===r?(y(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(y(Q(e.output,0)),e.output=[])}}},ae=e=>{O()},se={ops_table:null,mount:e=>se.createNode(null,"/",16895,0),createNode(e,r,t,n){if(le.isBlkdev(t)||le.isFIFO(t))throw new le.ErrnoError(63);se.ops_table||={dir:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr,lookup:se.node_ops.lookup,mknod:se.node_ops.mknod,rename:se.node_ops.rename,unlink:se.node_ops.unlink,rmdir:se.node_ops.rmdir,readdir:se.node_ops.readdir,symlink:se.node_ops.symlink},stream:{llseek:se.stream_ops.llseek}},file:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr},stream:{llseek:se.stream_ops.llseek,read:se.stream_ops.read,write:se.stream_ops.write,allocate:se.stream_ops.allocate,mmap:se.stream_ops.mmap,msync:se.stream_ops.msync}},link:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr,readlink:se.node_ops.readlink},stream:{}},chrdev:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr},stream:le.chrdev_stream_ops}};var o=le.createNode(e,r,t,n);return le.isDir(o.mode)?(o.node_ops=se.ops_table.dir.node,o.stream_ops=se.ops_table.dir.stream,o.contents={}):le.isFile(o.mode)?(o.node_ops=se.ops_table.file.node,o.stream_ops=se.ops_table.file.stream,o.usedBytes=0,o.contents=null):le.isLink(o.mode)?(o.node_ops=se.ops_table.link.node,o.stream_ops=se.ops_table.link.stream):le.isChrdev(o.mode)&&(o.node_ops=se.ops_table.chrdev.node,o.stream_ops=se.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){r=Math.max(r,t*(t<1048576?2:1.125)>>>0),0!=t&&(r=Math.max(r,256));var n=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(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(e){var r={};return r.dev=le.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,le.isDir(e.mode)?r.size=4096:le.isFile(e.mode)?r.size=e.usedBytes:le.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(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp),void 0!==r.size&&se.resizeFileStorage(e,r.size)},lookup(e,r){throw le.genericErrors[44]},mknod:(e,r,t,n)=>se.createNode(e,r,t,n),rename(e,r,t){if(le.isDir(e.mode)){var n;try{n=le.lookupNode(r,t)}catch(e){}if(n)for(var o in n.contents)throw new le.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(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=le.lookupNode(e,r);for(var n in t.contents)throw new le.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){var n=se.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!le.isLink(e.mode))throw new le.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var a=e.node.contents;if(o>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-o,n);if(s>8&&a.subarray)r.set(a.subarray(o,o+s),t);else for(var i=0;i0||t+r(se.stream_ops.write(e,r,0,n,t,!1),0)}},ie=n.preloadPlugins||[],ue=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},le={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=V.resolve(e)))return{path:"",node:null};if((r=Object.assign({follow_mount:!0,recurse_count:0},r)).recurse_count>8)throw new le.ErrnoError(32);for(var t=e.split("/").filter((e=>!!e)),n=le.root,o="/",a=0;a40)throw new le.ErrnoError(32)}}return{path:o,node:n}},getPath(e){for(var r;;){if(le.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>>0)%le.nameTable.length},hashAddNode(e){var r=le.hashName(e.parent.id,e.name);e.name_next=le.nameTable[r],le.nameTable[r]=e},hashRemoveNode(e){var r=le.hashName(e.parent.id,e.name);if(le.nameTable[r]===e)le.nameTable[r]=e.name_next;else for(var t=le.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=le.mayLookup(e);if(t)throw new le.ErrnoError(t,e);for(var n=le.hashName(e.id,r),o=le.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===r)return o}return le.lookup(e,r)},createNode(e,r,t,n){var o=new le.FSNode(e,r,t,n);return le.hashAddNode(o),o},destroyNode(e){le.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),flagsToPermissionString(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>le.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=le.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){try{return le.lookupNode(e,r),20}catch(e){}return le.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=le.lookupNode(e,r)}catch(e){return e.errno}var o=le.nodePermissions(e,"wx");if(o)return o;if(t){if(!le.isDir(n.mode))return 54;if(le.isRoot(n)||le.getPath(n)===le.cwd())return 10}else if(le.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?le.isLink(e.mode)?32:le.isDir(e.mode)&&("r"!==le.flagsToPermissionString(r)||512&r)?31:le.nodePermissions(e,le.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=le.MAX_OPEN_FDS;e++)if(!le.streams[e])return e;throw new le.ErrnoError(33)},getStreamChecked(e){var r=le.getStream(e);if(!r)throw new le.ErrnoError(8);return r},getStream:e=>le.streams[e],createStream:(e,r=-1)=>(le.FSStream||(le.FSStream=function(){this.shared={}},le.FSStream.prototype={},Object.defineProperties(le.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new le.FSStream,e),-1==r&&(r=le.nextfd()),e.fd=r,le.streams[r]=e,e),closeStream(e){le.streams[e]=null},chrdev_stream_ops:{open(e){var r=le.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new le.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice(e,r){le.devices[e]={stream_ops:r}},getDevice:e=>le.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),le.syncFSRequests++,le.syncFSRequests>1&&y(`warning: ${le.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=le.getMounts(le.root.mount),n=0;function o(e){return le.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&&le.root)throw new le.ErrnoError(10);if(!o&&!a){var s=le.lookupPath(t,{follow_mount:!1});if(t=s.path,n=s.node,le.isMountpoint(n))throw new le.ErrnoError(10);if(!le.isDir(n.mode))throw new le.ErrnoError(54)}var i={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(i);return u.mount=i,i.root=u,o?le.root=u:n&&(n.mounted=i,n.mount&&n.mount.mounts.push(i)),u},unmount(e){var r=le.lookupPath(e,{follow_mount:!1});if(!le.isMountpoint(r.node))throw new le.ErrnoError(28);var t=r.node,n=t.mounted,o=le.getMounts(n);Object.keys(le.nameTable).forEach((e=>{for(var r=le.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&le.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=le.lookupPath(e,{parent:!0}).node,o=Z.basename(e);if(!o||"."===o||".."===o)throw new le.ErrnoError(28);var a=le.mayCreate(n,o);if(a)throw new le.ErrnoError(a);if(!n.node_ops.mknod)throw new le.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},create:(e,r)=>(r=void 0!==r?r:438,r&=4095,r|=32768,le.mknod(e,r,0)),mkdir:(e,r)=>(r=void 0!==r?r:511,r&=1023,r|=16384,le.mknod(e,r,0)),mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o(void 0===t&&(t=r,r=438),r|=8192,le.mknod(e,r,t)),symlink(e,r){if(!V.resolve(e))throw new le.ErrnoError(44);var t=le.lookupPath(r,{parent:!0}).node;if(!t)throw new le.ErrnoError(44);var n=Z.basename(r),o=le.mayCreate(t,n);if(o)throw new le.ErrnoError(o);if(!t.node_ops.symlink)throw new le.ErrnoError(63);return t.node_ops.symlink(t,n,e)},rename(e,r){var t,n,o=Z.dirname(e),a=Z.dirname(r),s=Z.basename(e),i=Z.basename(r);if(t=le.lookupPath(e,{parent:!0}).node,n=le.lookupPath(r,{parent:!0}).node,!t||!n)throw new le.ErrnoError(44);if(t.mount!==n.mount)throw new le.ErrnoError(75);var u,l=le.lookupNode(t,s),c=V.relative(e,a);if("."!==c.charAt(0))throw new le.ErrnoError(28);if("."!==(c=V.relative(r,o)).charAt(0))throw new le.ErrnoError(55);try{u=le.lookupNode(n,i)}catch(e){}if(l!==u){var d=le.isDir(l.mode),h=le.mayDelete(t,s,d);if(h)throw new le.ErrnoError(h);if(h=u?le.mayDelete(n,i,d):le.mayCreate(n,i))throw new le.ErrnoError(h);if(!t.node_ops.rename)throw new le.ErrnoError(63);if(le.isMountpoint(l)||u&&le.isMountpoint(u))throw new le.ErrnoError(10);if(n!==t&&(h=le.nodePermissions(t,"w")))throw new le.ErrnoError(h);le.hashRemoveNode(l);try{t.node_ops.rename(l,n,i)}catch(e){throw e}finally{le.hashAddNode(l)}}},rmdir(e){var r=le.lookupPath(e,{parent:!0}).node,t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!0);if(o)throw new le.ErrnoError(o);if(!r.node_ops.rmdir)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.rmdir(r,t),le.destroyNode(n)},readdir(e){var r=le.lookupPath(e,{follow:!0}).node;if(!r.node_ops.readdir)throw new le.ErrnoError(54);return r.node_ops.readdir(r)},unlink(e){var r=le.lookupPath(e,{parent:!0}).node;if(!r)throw new le.ErrnoError(44);var t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!1);if(o)throw new le.ErrnoError(o);if(!r.node_ops.unlink)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.unlink(r,t),le.destroyNode(n)},readlink(e){var r=le.lookupPath(e).node;if(!r)throw new le.ErrnoError(44);if(!r.node_ops.readlink)throw new le.ErrnoError(28);return V.resolve(le.getPath(r.parent),r.node_ops.readlink(r))},stat(e,r){var t=le.lookupPath(e,{follow:!r}).node;if(!t)throw new le.ErrnoError(44);if(!t.node_ops.getattr)throw new le.ErrnoError(63);return t.node_ops.getattr(t)},lstat:e=>le.stat(e,!0),chmod(e,r,t){var n;if(!(n="string"==typeof e?le.lookupPath(e,{follow:!t}).node:e).node_ops.setattr)throw new le.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&r|-4096&n.mode,timestamp:Date.now()})},lchmod(e,r){le.chmod(e,r,!0)},fchmod(e,r){var t=le.getStreamChecked(e);le.chmod(t.node,r)},chown(e,r,t,n){var o;if(!(o="string"==typeof e?le.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new le.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){le.chown(e,r,t,!0)},fchown(e,r,t){var n=le.getStreamChecked(e);le.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new le.ErrnoError(28);var t;if(!(t="string"==typeof e?le.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new le.ErrnoError(63);if(le.isDir(t.mode))throw new le.ErrnoError(31);if(!le.isFile(t.mode))throw new le.ErrnoError(28);var n=le.nodePermissions(t,"w");if(n)throw new le.ErrnoError(n);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=le.getStreamChecked(e);if(0==(2097155&t.flags))throw new le.ErrnoError(28);le.truncate(t.node,r)},utime(e,r,t){var n=le.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(r,t)})},open(e,r,t){if(""===e)throw new le.ErrnoError(44);var o;if(t=void 0===t?438:t,t=64&(r="string"==typeof r?(e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===r)throw new Error(`Unknown file open mode: ${e}`);return r})(r):r)?4095&t|32768:0,"object"==typeof e)o=e;else{e=Z.normalize(e);try{o=le.lookupPath(e,{follow:!(131072&r)}).node}catch(e){}}var a=!1;if(64&r)if(o){if(128&r)throw new le.ErrnoError(20)}else o=le.mknod(e,t,0),a=!0;if(!o)throw new le.ErrnoError(44);if(le.isChrdev(o.mode)&&(r&=-513),65536&r&&!le.isDir(o.mode))throw new le.ErrnoError(54);if(!a){var s=le.mayOpen(o,r);if(s)throw new le.ErrnoError(s)}512&r&&!a&&le.truncate(o,0),r&=-131713;var i=le.createStream({node:o,path:le.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return i.stream_ops.open&&i.stream_ops.open(i),!n.logReadFiles||1&r||(le.readFiles||(le.readFiles={}),e in le.readFiles||(le.readFiles[e]=1)),i},close(e){if(le.isClosed(e))throw new le.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{le.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new le.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new le.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 le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(1==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.read)throw new le.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new le.ErrnoError(70)}else o=e.position;var s=e.stream_ops.read(e,r,t,n,o);return a||(e.position+=s),s},write(e,r,t,n,o,a){if(n<0||o<0)throw new le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.write)throw new le.ErrnoError(28);e.seekable&&1024&e.flags&&le.llseek(e,0,2);var s=void 0!==o;if(s){if(!e.seekable)throw new le.ErrnoError(70)}else o=e.position;var i=e.stream_ops.write(e,r,t,n,o,a);return s||(e.position+=i),i},allocate(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(r<0||t<=0)throw new le.ErrnoError(28);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(!le.isFile(e.node.mode)&&!le.isDir(e.node.mode))throw new le.ErrnoError(43);if(!e.stream_ops.allocate)throw new le.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 le.ErrnoError(2);if(1==(2097155&e.flags))throw new le.ErrnoError(2);if(!e.stream_ops.mmap)throw new le.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync:(e,r,t,n,o)=>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 le.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=le.open(e,r.flags),o=le.stat(e).size,a=new Uint8Array(o);return le.read(n,a,0,o,0),"utf8"===r.encoding?t=Q(a,0):"binary"===r.encoding&&(t=a),le.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=le.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(re(r)+1),a=te(r,o,0,o.length);le.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(r))throw new Error("Unsupported data type");le.write(n,r,0,r.byteLength,void 0,t.canOwn)}le.close(n)},cwd:()=>le.currentPath,chdir(e){var r=le.lookupPath(e,{follow:!0});if(null===r.node)throw new le.ErrnoError(44);if(!le.isDir(r.node.mode))throw new le.ErrnoError(54);var t=le.nodePermissions(r.node,"x");if(t)throw new le.ErrnoError(t);le.currentPath=r.path},createDefaultDirectories(){le.mkdir("/tmp"),le.mkdir("/home"),le.mkdir("/home/web_user")},createDefaultDevices(){le.mkdir("/dev"),le.registerDevice(le.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n}),le.mkdev("/dev/null",le.makedev(1,3)),oe.register(le.makedev(5,0),oe.default_tty_ops),oe.register(le.makedev(6,0),oe.default_tty1_ops),le.mkdev("/dev/tty",le.makedev(5,0)),le.mkdev("/dev/tty1",le.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(0===r&&(r=G(e).byteLength),e[--r]);le.createDevice("/dev","random",t),le.createDevice("/dev","urandom",t),le.mkdir("/dev/shm"),le.mkdir("/dev/shm/tmp")},createSpecialDirectories(){le.mkdir("/proc");var e=le.mkdir("/proc/self");le.mkdir("/proc/self/fd"),le.mount({mount(){var r=le.createNode(e,"fd",16895,73);return r.node_ops={lookup(e,r){var t=+r,n=le.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},r}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?le.createDevice("/dev","stdin",n.stdin):le.symlink("/dev/tty","/dev/stdin"),n.stdout?le.createDevice("/dev","stdout",null,n.stdout):le.symlink("/dev/tty","/dev/stdout"),n.stderr?le.createDevice("/dev","stderr",null,n.stderr):le.symlink("/dev/tty1","/dev/stderr"),le.open("/dev/stdin",0),le.open("/dev/stdout",1),le.open("/dev/stderr",1)},ensureErrnoError(){le.ErrnoError||(le.ErrnoError=function(e,r){this.name="ErrnoError",this.node=r,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},le.ErrnoError.prototype=new Error,le.ErrnoError.prototype.constructor=le.ErrnoError,[44].forEach((e=>{le.genericErrors[e]=new le.ErrnoError(e),le.genericErrors[e].stack=""})))},staticInit(){le.ensureErrnoError(),le.nameTable=new Array(4096),le.mount(se,{},"/"),le.createDefaultDirectories(),le.createDefaultDevices(),le.createSpecialDirectories(),le.filesystems={MEMFS:se}},init(e,r,t){le.init.initialized=!0,le.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=r||n.stdout,n.stderr=t||n.stderr,le.createStandardStreams()},quit(){le.init.initialized=!1;for(var e=0;ethis.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,s=1048576;o||(s=n);var i=this;i.setDataGetter((e=>{var r=e*s,o=(e+1)*s-1;if(o=Math.min(o,n-1),void 0===i.chunks[e]&&(i.chunks[e]=((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!==s&&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||[]):ne(o.responseText||"",!0)})(r,o)),void 0===i.chunks[e])throw new Error("doXHR failed!");return i.chunks[e]})),!a&&n||(s=n=1,n=this.getter(0).length,s=n,_("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=s,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!d)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new a;Object.defineProperties(s,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var i={isDevice:!1,contents:s}}else i={isDevice:!1,url:t};var u=le.createFile(e,r,i,n,o);i.contents?u.contents=i.contents:i.url&&(u.contents=null,u.url=i.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,r,t,n,o){var a=e.node.contents;if(o>=a.length)return 0;var s=Math.min(a.length-o,n);if(a.slice)for(var i=0;i{var r=u.stream_ops[e];l[e]=function(){return le.forceLoadFile(u),r.apply(null,arguments)}})),l.read=(e,r,t,n,o)=>(le.forceLoadFile(u),c(e,r,t,n,o)),l.mmap=(e,r,t,n,o)=>{le.forceLoadFile(u);var a=ae();if(!a)throw new le.ErrnoError(48);return c(e,E,a,r,t),{ptr:a,allocated:!0}},u.stream_ops=l,u}},ce=(e,r)=>e?Q(b,e,r):"",de={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(Z.isAbs(r))return r;var n;if(n=-100===e?le.cwd():de.getStreamFromFD(e).path,0==r.length){if(!t)throw new le.ErrnoError(44);return n}return Z.join2(n,r)},doStat(e,r,t){try{var n=e(r)}catch(e){if(e&&e.node&&Z.normalize(r)!==Z.normalize(le.getPath(e.node)))return-54;throw e}F[t>>2]=n.dev,F[t+4>>2]=n.mode,D[t+8>>2]=n.nlink,F[t+12>>2]=n.uid,F[t+16>>2]=n.gid,F[t+20>>2]=n.rdev,I=[n.size>>>0,(j=n.size,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+24>>2]=I[0],F[t+28>>2]=I[1],F[t+32>>2]=4096,F[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),s=n.ctime.getTime();return I=[Math.floor(o/1e3)>>>0,(j=Math.floor(o/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+40>>2]=I[0],F[t+44>>2]=I[1],D[t+48>>2]=o%1e3*1e3,I=[Math.floor(a/1e3)>>>0,(j=Math.floor(a/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+56>>2]=I[0],F[t+60>>2]=I[1],D[t+64>>2]=a%1e3*1e3,I=[Math.floor(s/1e3)>>>0,(j=Math.floor(s/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+72>>2]=I[0],F[t+76>>2]=I[1],D[t+80>>2]=s%1e3*1e3,I=[n.ino>>>0,(j=n.ino,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+88>>2]=I[0],F[t+92>>2]=I[1],0},doMsync(e,r,t,n,o){if(!le.isFile(r.node.mode))throw new le.ErrnoError(43);if(2&n)return 0;var a=b.slice(e,e+t);le.msync(r,a,o,t,n)},varargs:void 0,get(){var e=F[+de.varargs>>2];return de.varargs+=4,e},getp:()=>de.get(),getStr:e=>ce(e),getStreamFromFD:e=>le.getStreamChecked(e)},he=e=>(F[Oe()>>2]=e,e),fe={BUCKET_BUFFER_SIZE:8192,mount:e=>le.createNode(null,"/",16895,0),createPipe(){var e={buckets:[],refcnt:2};e.buckets.push({buffer:new Uint8Array(fe.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var r=fe.nextname(),t=fe.nextname(),n=le.createNode(fe.root,r,4096,0),o=le.createNode(fe.root,t,4096,0);n.pipe=e,o.pipe=e;var a=le.createStream({path:r,node:n,flags:0,seekable:!1,stream_ops:fe.stream_ops});n.stream=a;var s=le.createStream({path:t,node:o,flags:1,seekable:!1,stream_ops:fe.stream_ops});return o.stream=s,{readable_fd:a.fd,writable_fd:s.fd}},stream_ops:{poll(e){var r=e.node.pipe;if(1==(2097155&e.flags))return 260;if(r.buckets.length>0)for(var t=0;t0)return 65}return 0},ioctl:(e,r,t)=>28,fsync:e=>28,read(e,r,t,n,o){for(var a=e.node.pipe,s=0,i=0;i=i)return u.buffer.set(s,u.offset),u.offset+=i,i;l>0&&(u.buffer.set(s.subarray(0,l),u.offset),u.offset+=l,s=s.subarray(l,s.byteLength));for(var c=s.byteLength/fe.BUCKET_BUFFER_SIZE|0,d=s.byteLength%fe.BUCKET_BUFFER_SIZE,h=0;h0&&(f={buffer:new Uint8Array(fe.BUCKET_BUFFER_SIZE),offset:s.byteLength,roffset:0},a.buckets.push(f),f.buffer.set(s)),i},close(e){var r=e.node.pipe;r.refcnt--,0===r.refcnt&&(r.buckets=null)}},nextname:()=>(fe.nextname.current||(fe.nextname.current=0),"pipe["+fe.nextname.current+++"]")},me=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*r:NaN,pe=e=>e%4==0&&(e%100!=0||e%400==0),ve=[0,31,60,91,121,152,182,213,244,274,305,335],we=[0,31,59,90,120,151,181,212,243,273,304,334],ge=e=>(pe(e.getFullYear())?ve:we)[e.getMonth()]+e.getDate()-1,_e=(e,r,t)=>te(e,b,r,t),ye=e=>{var r=re(e)+1,t=xe(r);return t&&_e(e,t,r),t},Ee=e=>{var r=(e-g.buffer.byteLength+65535)/65536;try{return g.grow(r),C(),1}catch(e){}},be={},ke=()=>{if(!ke.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var r in be)void 0===be[r]?delete e[r]:e[r]=be[r];var t=[];for(var r in e)t.push(`${r}=${e[r]}`);ke.strings=t}return ke.strings},Se=e=>{X||(n.onExit?.(e),M=!0),l(e,new $(e))},Fe=(e,r)=>{Se(e)},De=[31,29,31,30,31,30,31,31,30,31,30,31],Me=[31,28,31,30,31,30,31,31,30,31,30,31],Ae=(e,r)=>{E.set(e,r)},Ce=e=>n["_"+e],Pe=(e,r,t,n,o)=>{var a={string:e=>{var r=0;return null!=e&&0!==e&&(r=(e=>{var r=re(e)+1,t=He(r);return _e(e,t,r),t})(e)),r},array:e=>{var r=He(e.length);return Ae(e,r),r}},s=Ce(e),i=[],u=0;if(n)for(var l=0;l{var d=r?V.resolve(Z.join2(e,r)):e;function h(t){function a(t){c?.(),u||((e,r,t,n,o,a)=>{le.createDataFile(e,r,t,n,o,a)})(e,r,t,n,o,l),s?.(),x()}((e,r,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return ie.forEach((a=>{o||a.canHandle(r)&&(a.handle(e,r,t,n),o=!0)})),o})(t,d,a,(()=>{i?.(),x()}))||a(t)}L(),"string"==typeof t?((e,r,t,n)=>{var o=n?"":`al ${e}`;a(e,(t=>{A(t,`Loading data file "${e}" failed (no arrayBuffer).`),r(new Uint8Array(t)),o&&x()}),(r=>{if(!t)throw`Loading data file "${e}" failed.`;t()})),o&&L()})(t,(e=>h(e)),i):h(t)},le.staticInit();var ze={i:function(e){try{var r=de.getStreamFromFD(e);return le.createStream(r).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},a:function(e,r,t){de.varargs=t;try{var n=de.getStreamFromFD(e);switch(r){case 0:if((o=de.get())<0)return-28;for(;le.streams[o];)o++;return le.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=de.get();return n.flags|=o,0;case 5:return o=de.getp(),S[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return he(28),-1}}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},x:function(e,r){try{var t=de.getStreamFromFD(e);return de.doStat(le.stat,t.path,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},u:function(e,r){try{return e=de.getStr(e),de.doStat(le.lstat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},v:function(e,r,t,n){try{r=de.getStr(r);var o=256&n,a=4096&n;return n&=-6401,r=de.calculateAt(e,r,a),de.doStat(o?le.lstat:le.stat,r,t)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},y:function(e,r,t,n){de.varargs=n;try{r=de.getStr(r),r=de.calculateAt(e,r);var o=n?de.get():0;return le.open(r,t,o).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},t:function(e){try{if(0==e)throw new le.ErrnoError(21);var r=fe.createPipe();return F[e>>2]=r.readable_fd,F[e+4>>2]=r.writable_fd,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},s:function(e,r,t){try{for(var n=0,o=0;o>2],i=S[a+4>>1],u=32,l=le.getStream(s);l&&(u=de.DEFAULT_POLLMASK,l.stream_ops.poll&&(u=l.stream_ops.poll(l,-1))),(u&=24|i)&&n++,S[a+6>>1]=u}return n}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},w:function(e,r){try{return e=de.getStr(e),de.doStat(le.stat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},q:function(e,r,t){try{return r=de.getStr(r),r=de.calculateAt(e,r),0===t?le.unlink(r):512===t?le.rmdir(r):O("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},B:()=>1,k:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);F[t>>2]=o.getUTCSeconds(),F[t+4>>2]=o.getUTCMinutes(),F[t+8>>2]=o.getUTCHours(),F[t+12>>2]=o.getUTCDate(),F[t+16>>2]=o.getUTCMonth(),F[t+20>>2]=o.getUTCFullYear()-1900,F[t+24>>2]=o.getUTCDay();var a=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),s=(o.getTime()-a)/864e5|0;F[t+28>>2]=s},l:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);F[t>>2]=o.getSeconds(),F[t+4>>2]=o.getMinutes(),F[t+8>>2]=o.getHours(),F[t+12>>2]=o.getDate(),F[t+16>>2]=o.getMonth(),F[t+20>>2]=o.getFullYear()-1900,F[t+24>>2]=o.getDay();var a=0|ge(o);F[t+28>>2]=a,F[t+36>>2]=-60*o.getTimezoneOffset();var s=new Date(o.getFullYear(),0,1),i=new Date(o.getFullYear(),6,1).getTimezoneOffset(),u=s.getTimezoneOffset(),l=0|(i!=u&&o.getTimezoneOffset()==Math.min(u,i));F[t+32>>2]=l},m:function(e){var r=(()=>{var r=new Date(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),t=F[e+32>>2],n=r.getTimezoneOffset(),o=new Date(r.getFullYear(),0,1),a=new Date(r.getFullYear(),6,1).getTimezoneOffset(),s=o.getTimezoneOffset(),i=Math.min(s,a);if(t<0)F[e+32>>2]=Number(a!=s&&i==n);else if(t>0!=(i==n)){var u=Math.max(s,a),l=t>0?i:u;r.setTime(r.getTime()+6e4*(l-n))}F[e+24>>2]=r.getDay();var c=0|ge(r);F[e+28>>2]=c,F[e>>2]=r.getSeconds(),F[e+4>>2]=r.getMinutes(),F[e+8>>2]=r.getHours(),F[e+12>>2]=r.getDate(),F[e+16>>2]=r.getMonth(),F[e+20>>2]=r.getYear();var d=r.getTime();return isNaN(d)?(he(61),-1):d/1e3})();return Be((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},n:function(e){var r=(()=>{var r=Date.UTC(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),t=new Date(r);F[e+24>>2]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),o=(t.getTime()-n)/864e5|0;return F[e+28>>2]=o,t.getTime()/1e3})();return Be((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},r:(e,r,t)=>{var n=(new Date).getFullYear(),o=new Date(n,0,1),a=new Date(n,6,1),s=o.getTimezoneOffset(),i=a.getTimezoneOffset(),u=Math.max(s,i);function l(e){var r=e.toTimeString().match(/\(([A-Za-z ]+)\)$/);return r?r[1]:"GMT"}D[e>>2]=60*u,F[r>>2]=Number(s!=i);var c=l(o),d=l(a),h=ye(c),f=ye(d);i>2]=h,D[t+4>>2]=f):(D[t>>2]=f,D[t+4>>2]=h)},b:()=>{O("")},c:()=>Date.now(),h:(e,r,t)=>b.copyWithin(e,r,r+t),p:e=>{var r=b.length,t=2147483648;if((e>>>=0)>t)return!1;for(var n,o,a=1;a<=4;a*=2){var s=r*(1+.2/a);s=Math.min(s,e+100663296);var i=Math.min(t,(n=Math.max(e,s))+((o=65536)-n%o)%o);if(Ee(i))return!0}return!1},z:(e,r)=>{var t=0;return ke().forEach(((n,o)=>{var a=r+t;D[e+4*o>>2]=a,((e,r)=>{for(var t=0;t>0]=e.charCodeAt(t);E[r>>0]=0})(n,a),t+=n.length+1})),0},A:(e,r)=>{var t=ke();D[e>>2]=t.length;var n=0;return t.forEach((e=>n+=e.length+1)),D[r>>2]=n,0},g:Fe,e:function(e){try{var r=de.getStreamFromFD(e);return le.close(r),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},j:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],i=D[r+4>>2];r+=8;var u=le.read(e,E,s,i,n);if(u<0)return-1;if(o+=u,u>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},o:function(e,r,t,n,o){var a=me(r,t);try{if(isNaN(a))return 61;var s=de.getStreamFromFD(e);return le.llseek(s,a,n),I=[s.position>>>0,(j=s.position,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[o>>2]=I[0],F[o+4>>2]=I[1],s.getdents&&0===a&&0===n&&(s.getdents=null),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},d:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],i=D[r+4>>2];r+=8;var u=le.write(e,E,s,i,n);if(u<0)return-1;o+=u,void 0!==n&&(n+=u)}return o})(de.getStreamFromFD(e),r,t);return D[n>>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},f:(e,r,t,n)=>{var o=D[n+40>>2],a={tm_sec:F[n>>2],tm_min:F[n+4>>2],tm_hour:F[n+8>>2],tm_mday:F[n+12>>2],tm_mon:F[n+16>>2],tm_year:F[n+20>>2],tm_wday:F[n+24>>2],tm_yday:F[n+28>>2],tm_isdst:F[n+32>>2],tm_gmtoff:F[n+36>>2],tm_zone:o?ce(o):""},s=ce(t),i={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in i)s=s.replace(new RegExp(u,"g"),i[u]);var l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,r,t){for(var n="number"==typeof e?e.toString():e||"";n.length0?1:0}var n;return 0===(n=t(e.getFullYear()-r.getFullYear()))&&0===(n=t(e.getMonth()-r.getMonth()))&&(n=t(e.getDate()-r.getDate())),n}function m(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function p(e){var r=((e,r)=>{for(var t=new Date(e.getTime());r>0;){var n=pe(t.getFullYear()),o=t.getMonth(),a=(n?De:Me)[o];if(!(r>a-t.getDate()))return t.setDate(t.getDate()+r),t;r-=a-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return t})(new Date(e.tm_year+1900,0,1),e.tm_yday),t=new Date(r.getFullYear(),0,4),n=new Date(r.getFullYear()+1,0,4),o=m(t),a=m(n);return f(o,r)<=0?f(a,r)<=0?r.getFullYear()+1:r.getFullYear():r.getFullYear()-1}var v={"%a":e=>l[e.tm_wday].substring(0,3),"%A":e=>l[e.tm_wday],"%b":e=>c[e.tm_mon].substring(0,3),"%B":e=>c[e.tm_mon],"%C":e=>h((e.tm_year+1900)/100|0,2),"%d":e=>h(e.tm_mday,2),"%e":e=>d(e.tm_mday,2," "),"%g":e=>p(e).toString().substring(2),"%G":e=>p(e),"%H":e=>h(e.tm_hour,2),"%I":e=>{var r=e.tm_hour;return 0==r?r=12:r>12&&(r-=12),h(r,2)},"%j":e=>h(e.tm_mday+((e,r)=>{for(var t=0,n=0;n<=r;t+=e[n++]);return t})(pe(e.tm_year+1900)?De:Me,e.tm_mon-1),3),"%m":e=>h(e.tm_mon+1,2),"%M":e=>h(e.tm_min,2),"%n":()=>"\n","%p":e=>e.tm_hour>=0&&e.tm_hour<12?"AM":"PM","%S":e=>h(e.tm_sec,2),"%t":()=>"\t","%u":e=>e.tm_wday||7,"%U":e=>{var r=e.tm_yday+7-e.tm_wday;return h(Math.floor(r/7),2)},"%V":e=>{var r=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&r++,r){if(53==r){var t=(e.tm_wday+371-e.tm_yday)%7;4==t||3==t&&pe(e.tm_year)||(r=1)}}else{r=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&pe(e.tm_year%400-1))&&r++}return h(r,2)},"%w":e=>e.tm_wday,"%W":e=>{var r=e.tm_yday+7-(e.tm_wday+6)%7;return h(Math.floor(r/7),2)},"%y":e=>(e.tm_year+1900).toString().substring(2),"%Y":e=>e.tm_year+1900,"%z":e=>{var r=e.tm_gmtoff,t=r>=0;return r=(r=Math.abs(r)/60)/60*100+r%60,(t?"+":"-")+String("0000"+r).slice(-4)},"%Z":e=>e.tm_zone,"%%":()=>"%"};for(var u in s=s.replace(/%%/g,"\0\0"),v)s.includes(u)&&(s=s.replace(new RegExp(u,"g"),v[u](a)));var w=ne(s=s.replace(/\0\0/g,"%"),!1);return w.length>r?0:(Ae(w,e),w.length-1)}},Le=function(){var e,r,o,a,s={a:ze};function i(e,r){var t;return Le=e.exports,g=Le.C,C(),t=Le.D,T.unshift(t),x(),Le}if(L(),n.instantiateWasm)try{return n.instantiateWasm(s,i)}catch(e){y(`Module.instantiateWasm callback failed with error: ${e}`),t(e)}return(e=w,r=N,o=s,a=function(e){i(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||H(r)||Y(r)||h||"function"!=typeof fetch?K(r,o,a):fetch(r,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,o).then(a,(function(e){return y(`wasm streaming compile failed: ${e}`),y("falling back to ArrayBuffer instantiation"),K(r,o,a)}))))).catch(t),{}}();n._get_version=()=>(n._get_version=Le.E)(),n._archive_open=(e,r,t,o)=>(n._archive_open=Le.F)(e,r,t,o),n._archive_read_add_passphrase=(e,r)=>(n._archive_read_add_passphrase=Le.G)(e,r),n._archive_error_string=e=>(n._archive_error_string=Le.H)(e),n._get_next_entry=e=>(n._get_next_entry=Le.I)(e),n._get_filedata=(e,r)=>(n._get_filedata=Le.J)(e,r);var xe=n._malloc=e=>(xe=n._malloc=Le.K)(e);n._archive_close=e=>(n._archive_close=Le.L)(e),n._start_archive_write=(e,r,t,o,a,s)=>(n._start_archive_write=Le.M)(e,r,t,o,a,s),n._write_archive_file=(e,r,t,o)=>(n._write_archive_file=Le.N)(e,r,t,o),n._size_of_size_t=()=>(n._size_of_size_t=Le.O)(),n._free=e=>(n._free=Le.P)(e);var Oe=()=>(Oe=Le.Q)();n._archive_entry_birthtime_nsec=e=>(n._archive_entry_birthtime_nsec=Le.R)(e),n._archive_entry_filetype=e=>(n._archive_entry_filetype=Le.S)(e),n._archive_entry_mtime_nsec=e=>(n._archive_entry_mtime_nsec=Le.T)(e),n._archive_entry_pathname=e=>(n._archive_entry_pathname=Le.U)(e),n._archive_entry_pathname_utf8=e=>(n._archive_entry_pathname_utf8=Le.V)(e),n._archive_entry_size=e=>(n._archive_entry_size=Le.W)(e),n._archive_entry_is_encrypted=e=>(n._archive_entry_is_encrypted=Le.X)(e),n._archive_read_has_encrypted_entries=e=>(n._archive_read_has_encrypted_entries=Le.Y)(e),n._archive_read_data_skip=e=>(n._archive_read_data_skip=Le.Z)(e),n._archive_write_close=e=>(n._archive_write_close=Le.$)(e),n._archive_write_free=e=>(n._archive_write_free=Le.aa)(e);var Ne,Be=e=>(Be=Le.ba)(e),je=()=>(je=Le.ca)(),Ie=e=>(Ie=Le.da)(e),He=e=>(He=Le.ea)(e);function Ye(){function e(){Ne||(Ne=!0,n.calledRun=!0,M||(n.noFSInit||le.init.initialized||le.init(),le.ignorePermissions=!1,fe.root=le.mount(fe,{},null),q(T),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)e=n.postRun.shift(),R.unshift(e);var e;q(R)}()))}U>0||(function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)e=n.preRun.shift(),P.unshift(e);var e;q(P)}(),U>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.cwrap=(e,r,t,n)=>{var o=!t||t.every((e=>"number"===e||"boolean"===e));return"string"!==r&&o&&!n?Ce(e):function(){return Pe(e,r,t,arguments)}},n.UTF8ToString=ce,n.intArrayFromString=ne,n.allocate=(e,r)=>{var t;return t=1==r?He(e.length):xe(e.length),e.subarray||e.slice||(e=new Uint8Array(e)),b.set(e,t),t},z=function e(){Ne||Ye(),Ne||(z=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return Ye(),e.ready});class F{constructor(){this.preRun=[],this.postRun=[],this.totalDependencies=0}print(...e){console.log(e)}printErr(...e){console.error(e)}initFunctions(){this.runCode={getVersion:this.cwrap("get_version","string",[]),openArchive:this.cwrap("archive_open","number",["number","number","string","string"]),getNextEntry:this.cwrap("get_next_entry","number",["number"]),getFileData:this.cwrap("get_filedata","number",["number","number"]),skipEntry:this.cwrap("archive_read_data_skip","number",["number"]),closeArchive:this.cwrap("archive_close",null,["number"]),getEntrySize:this.cwrap("archive_entry_size","number",["number"]),getEntryName:this.cwrap("archive_entry_pathname","string",["number"]),getEntryType:this.cwrap("archive_entry_filetype","number",["number"]),getEntryLastModified:this.cwrap("archive_entry_mtime_nsec","number",["number"]),getError:this.cwrap("archive_error_string","string",["number"]),startArchiveWrite:this.cwrap("start_archive_write","number",["string","string","number","number","number","string"]),writeArchiveFile:this.cwrap("write_archive_file",null,["number","string","number","number"]),closeArchiveWrite:this.cwrap("archive_write_close","number",["number"]),freeArchiveWrite:this.cwrap("archive_write_free","number",["number"]),entryIsEncrypted:this.cwrap("archive_entry_is_encrypted","number",["number"]),hasEncryptedEntries:this.cwrap("archive_read_has_encrypted_entries","number",["number"]),addPassphrase:this.cwrap("archive_read_add_passphrase","number",["number","string"]),string:e=>this.allocate(this.intArrayFromString(e),"i8",0),malloc:this.cwrap("malloc","number",["number"]),free:this.cwrap("free",null,["number"]),sizeOfSizeT:this.cwrap("size_of_size_t","number",[])}}monitorRunDependencies(){}}let D=null,M=null,A=!1;class C{constructor(e){C.readyCallback=e,A&&setTimeout((()=>e()),0)}open(e,r){D.open(e).then((()=>r()))}listFiles(){let e=[];for(const r of D.entries(!0))e.push(r);return e}extractFiles(){let e=[];for(const r of D.entries(!1))e.push(r);return e}extractSingleFile(e){for(const r of D.entries(!0,e))if(r.fileData)return r}hasEncryptedData(){return D.hasEncryptedData()}usePassword(e){D.setPassphrase(e)}setLocale(e){D.setLocale(e)}writeArchive(e,r,t,n){return M.write(e,r,t,n)}close(){D.close()}}var P;P=e=>{D=new E(e),M=new b(e),C?.readyCallback?.(),A=!0},S(new F).then((e=>{e.initFunctions(),P(e)})),u(C, + */const r=Symbol("Comlink.proxy"),t=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),o=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),s=e=>"object"==typeof e&&null!==e||"function"==typeof e,i=new Map([["proxy",{canHandle:e=>s(e)&&e[r],serialize(e){const{port1:r,port2:t}=new MessageChannel;return u(e,r),[t,[t]]},deserialize(e){return e.start(),m(e,[],r);var r}}],["throw",{canHandle:e=>s(e)&&a in e,serialize({value:e}){let r;return r=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[r,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function u(e,t=globalThis,n=["*"]){t.addEventListener("message",(function s(i){if(!i||!i.data)return;if(!function(e,r){for(const t of e){if(r===t||"*"===t)return!0;if(t instanceof RegExp&&t.test(r))return!0}return!1}(n,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:c,type:d,path:f}=Object.assign({path:[]},i.data),h=(i.data.argumentList||[]).map(g);let m;try{const t=f.slice(0,-1).reduce(((e,r)=>e[r]),e),n=f.reduce(((e,r)=>e[r]),e);switch(d){case"GET":m=n;break;case"SET":t[f.slice(-1)[0]]=g(i.data.value),m=!0;break;case"APPLY":m=n.apply(t,h);break;case"CONSTRUCT":m=function(e){return Object.assign(e,{[r]:!0})}(new n(...h));break;case"ENDPOINT":{const{port1:r,port2:t}=new MessageChannel;u(e,t),m=function(e,r){return v.set(e,r),e}(r,[r])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[a]:0}}Promise.resolve(m).catch((e=>({value:e,[a]:0}))).then((r=>{const[n,a]=w(r);t.postMessage(Object.assign(Object.assign({},n),{id:c}),a),"RELEASE"===d&&(t.removeEventListener("message",s),l(t),o in e&&"function"==typeof e[o]&&e[o]())})).catch((e=>{const[r,n]=w({value:new TypeError("Unserializable return value"),[a]:0});t.postMessage(Object.assign(Object.assign({},r),{id:c}),n)}))})),t.start&&t.start()}function l(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function c(e){if(e)throw new Error("Proxy has been released and is not useable")}function d(e){return _(e,{type:"RELEASE"}).then((()=>{l(e)}))}const f=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const r=(f.get(e)||0)-1;f.set(e,r),0===r&&d(e)}));function m(e,r=[],o=function(){}){let a=!1;const s=new Proxy(o,{get(t,o){if(c(a),o===n)return()=>{!function(e){h&&h.unregister(e)}(s),d(e),a=!0};if("then"===o){if(0===r.length)return{then:()=>s};const t=_(e,{type:"GET",path:r.map((e=>e.toString()))}).then(g);return t.then.bind(t)}return m(e,[...r,o])},set(t,n,o){c(a);const[s,i]=w(o);return _(e,{type:"SET",path:[...r,n].map((e=>e.toString())),value:s},i).then(g)},apply(n,o,s){c(a);const i=r[r.length-1];if(i===t)return _(e,{type:"ENDPOINT"}).then(g);if("bind"===i)return m(e,r.slice(0,-1));const[u,l]=p(s);return _(e,{type:"APPLY",path:r.map((e=>e.toString())),argumentList:u},l).then(g)},construct(t,n){c(a);const[o,s]=p(n);return _(e,{type:"CONSTRUCT",path:r.map((e=>e.toString())),argumentList:o},s).then(g)}});return function(e,r){const t=(f.get(r)||0)+1;f.set(r,t),h&&h.register(e,r,e)}(s,e),s}function p(e){const r=e.map(w);return[r.map((e=>e[0])),(t=r.map((e=>e[1])),Array.prototype.concat.apply([],t))];var t}const v=new WeakMap;function w(e){for(const[r,t]of i)if(t.canHandle(e)){const[n,o]=t.serialize(e);return[{type:"HANDLER",name:r,value:n},o]}return[{type:"RAW",value:e},v.get(e)||[]]}function g(e){switch(e.type){case"HANDLER":return i.get(e.name).deserialize(e.value);case"RAW":return e.value}}function _(e,r,t){return new Promise((n=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function r(t){t.data&&t.data.id&&t.data.id===o&&(e.removeEventListener("message",r),n(t.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},r),t)}))}const y={32768:"FILE",16384:"DIR",40960:"SYMBOLIC_LINK",49152:"SOCKET",8192:"CHARACTER_DEVICE",24576:"BLOCK_DEVICE",4096:"NAMED_PIPE"};class E{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._file=null,this._passphrase=null,this._locale="en_US.UTF-8"}async open(e){null!==this._file&&(console.warn("Closing previous file"),this.close());const r=await this._loadFile(e);this._fileLength=r.length,this._filePtr=r.ptr}close(){this._runCode.closeArchive(this._archive),this._wasmModule._free(this._filePtr),this._file=null,this._filePtr=null,this._archive=null}hasEncryptedData(){this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale),this._runCode.getNextEntry(this._archive);const e=this._runCode.hasEncryptedEntries(this._archive);return 0!==e&&(e>0||null)}setPassphrase(e){this._passphrase=e}setLocale(e){this._locale=e}*entries(e=!1,r=null){let t;for(this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale);t=this._runCode.getNextEntry(this._archive),0!==t;){const n={size:this._runCode.getEntrySize(t),path:this._runCode.getEntryName(t),type:y[this._runCode.getEntryType(t)],lastModified:this._runCode.getEntryLastModified(t),ref:t};if("FILE"===n.type){let e=n.path.split("/");n.fileName=e[e.length-1]}if(e&&r!==n.path)this._runCode.skipEntry(this._archive);else{const e=this._runCode.getFileData(this._archive,n.size);if(e<0)throw new Error(this._runCode.getError(this._archive));n.fileData=this._wasmModule.HEAPU8.slice(e,e+n.size),this._wasmModule._free(e)}yield n}}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}}class b{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._passphrase=null,this._locale="en_US.UTF-8"}async write(e,r,t,n=null){let o=e.reduce(((e,{file:r})=>e+r.size+128),0)+128;const a=this._runCode.malloc(o),s=this._runCode.malloc(this._runCode.sizeOfSizeT()),i=this._runCode.startArchiveWrite(r,t,a,o,s,n);for(const{file:r,pathname:t}of e){const e=await this._loadFile(r);this._runCode.writeArchiveFile(i,t||r.name,e.length,e.ptr),this._runCode.free(e.ptr)}const u=this._runCode.finishArchiveWrite(i,s);if(u<0)throw new Error(this._runCode.getError(i));return this._wasmModule.HEAPU8.slice(a,a+u)}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}}var k,S=(k=import.meta.url,async function(e={}){var r,t,n=e;n.ready=new Promise(((e,n)=>{r=e,t=n}));var o,a,s,i=Object.assign({},n),u="./this.program",l=(e,r)=>{throw r},c="object"==typeof window,d="function"==typeof importScripts,f="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,h="";if(f){const{createRequire:e}=await import("module");var m=e(import.meta.url),p=m("fs"),v=m("path");h=d?v.dirname(h)+"/":m("url").fileURLToPath(new URL("./",import.meta.url)),o=(e,r)=>(e=Y(e)?new URL(e):v.normalize(e),p.readFileSync(e,r?void 0:"utf8")),s=e=>{var r=o(e,!0);return r.buffer||(r=new Uint8Array(r)),r},a=(e,r,t,n=!0)=>{e=Y(e)?new URL(e):v.normalize(e),p.readFile(e,n?void 0:"utf8",((e,o)=>{e?t(e):r(n?o.buffer:o)}))},!n.thisProgram&&process.argv.length>1&&(u=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),l=(e,r)=>{throw process.exitCode=e,r},n.inspect=()=>"[Emscripten Module object]"}else(c||d)&&(d?h=self.location.href:"undefined"!=typeof document&&document.currentScript&&(h=document.currentScript.src),k&&(h=k),h=0!==h.indexOf("blob:")?h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},d&&(s=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),a=(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 w,g,_=n.print||console.log.bind(console),y=n.printErr||console.error.bind(console);Object.assign(n,i),i=null,n.arguments&&n.arguments,n.thisProgram&&(u=n.thisProgram),n.quit&&(l=n.quit),n.wasmBinary&&(w=n.wasmBinary),"object"!=typeof WebAssembly&&O("no native wasm support detected");var E,b,S,F,D,M=!1;function A(e,r){e||O(r)}function C(){var e=g.buffer;n.HEAP8=E=new Int8Array(e),n.HEAP16=S=new Int16Array(e),n.HEAPU8=b=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAP32=F=new Int32Array(e),n.HEAPU32=D=new Uint32Array(e),n.HEAPF32=new Float32Array(e),n.HEAPF64=new Float64Array(e)}var P=[],T=[],R=[],z=0,U=null;function L(e){z++,n.monitorRunDependencies?.(z)}function x(e){if(z--,n.monitorRunDependencies?.(z),0==z&&U){var r=U;U=null,r()}}function O(e){n.onAbort?.(e),y(e="Aborted("+e+")"),M=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw t(r),r}var N,B,j,I,H=e=>e.startsWith("data:application/octet-stream;base64,"),Y=e=>e.startsWith("file://");function W(e){if(e==N&&w)return new Uint8Array(w);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}function K(e,r,t){return function(e){if(!w&&(c||d)){if("function"==typeof fetch&&!Y(e))return fetch(e,{credentials:"same-origin"}).then((r=>{if(!r.ok)throw"failed to load wasm binary file at '"+e+"'";return r.arrayBuffer()})).catch((()=>W(e)));if(a)return new Promise(((r,t)=>{a(e,(e=>r(new Uint8Array(e))),t)}))}return Promise.resolve().then((()=>W(e)))}(e).then((e=>WebAssembly.instantiate(e,r))).then((e=>e)).then(t,(e=>{y(`failed to asynchronously prepare wasm: ${e}`),O(e)}))}function q(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}n.locateFile?H(N="libarchive.wasm")||(B=N,N=n.locateFile?n.locateFile(B,h):h+B):N=new URL("libarchive.wasm",import.meta.url).href;var $=e=>{for(;e.length>0;)e.shift()(n)},X=n.noExitRuntime||!0,Z={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=Z.isAbs(e),t="/"===e.substr(-1);return(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=Z.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=Z.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===r?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments);return Z.normalize(e.join("/"))},join2:(e,r)=>Z.normalize(e+"/"+r)},G=e=>(G=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(f)try{var e=m("crypto");if(e.randomFillSync)return r=>e.randomFillSync(r);var r=e.randomBytes;return e=>(e.set(r(e.byteLength)),e)}catch(e){}O("initRandomDevice")})())(e),V={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:le.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=Z.isAbs(n)}return(r?"/":"")+(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||"."},relative:(e,r)=>{function t(e){for(var r=0;r=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=V.resolve(e).substr(1),r=V.resolve(r).substr(1);for(var n=t(e.split("/")),o=t(r.split("/")),a=Math.min(n.length,o.length),s=a,i=0;i{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&J)return J.decode(e.subarray(r,o));for(var a="";r>10,56320|1023&l)}}else a+=String.fromCharCode((31&s)<<6|i)}else a+=String.fromCharCode(s)}return a},ee=[],re=e=>{for(var r=0,t=0;t=55296&&n<=57343?(r+=4,++t):r+=3}return r},te=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,s=0;s=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++s)),i<=127){if(t>=a)break;r[t++]=i}else if(i<=2047){if(t+1>=a)break;r[t++]=192|i>>6,r[t++]=128|63&i}else if(i<=65535){if(t+2>=a)break;r[t++]=224|i>>12,r[t++]=128|i>>6&63,r[t++]=128|63&i}else{if(t+3>=a)break;r[t++]=240|i>>18,r[t++]=128|i>>12&63,r[t++]=128|i>>6&63,r[t++]=128|63&i}}return r[t]=0,t-o};function ne(e,r,t){var n=t>0?t:re(e)+1,o=new Array(n),a=te(e,o,0,o.length);return r&&(o.length=a),o}var oe={ttys:[],init(){},shutdown(){},register(e,r){oe.ttys[e]={input:[],output:[],ops:r},le.registerDevice(e,oe.stream_ops)},stream_ops:{open(e){var r=oe.ttys[e.node.rdev];if(!r)throw new le.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new le.ErrnoError(60);for(var a=0,s=0;s(()=>{if(!ee.length){var e=null;if(f){var r=Buffer.alloc(256),t=0,n=process.stdin.fd;try{t=p.readSync(n,r)}catch(e){if(!e.toString().includes("EOF"))throw e;t=0}e=t>0?r.slice(0,t).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;ee=ne(e,!0)}return ee.shift()})(),put_char(e,r){null===r||10===r?(_(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(_(Q(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,r,t)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,r){null===r||10===r?(y(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(y(Q(e.output,0)),e.output=[])}}},ae=e=>{O()},se={ops_table:null,mount:e=>se.createNode(null,"/",16895,0),createNode(e,r,t,n){if(le.isBlkdev(t)||le.isFIFO(t))throw new le.ErrnoError(63);se.ops_table||={dir:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr,lookup:se.node_ops.lookup,mknod:se.node_ops.mknod,rename:se.node_ops.rename,unlink:se.node_ops.unlink,rmdir:se.node_ops.rmdir,readdir:se.node_ops.readdir,symlink:se.node_ops.symlink},stream:{llseek:se.stream_ops.llseek}},file:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr},stream:{llseek:se.stream_ops.llseek,read:se.stream_ops.read,write:se.stream_ops.write,allocate:se.stream_ops.allocate,mmap:se.stream_ops.mmap,msync:se.stream_ops.msync}},link:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr,readlink:se.node_ops.readlink},stream:{}},chrdev:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr},stream:le.chrdev_stream_ops}};var o=le.createNode(e,r,t,n);return le.isDir(o.mode)?(o.node_ops=se.ops_table.dir.node,o.stream_ops=se.ops_table.dir.stream,o.contents={}):le.isFile(o.mode)?(o.node_ops=se.ops_table.file.node,o.stream_ops=se.ops_table.file.stream,o.usedBytes=0,o.contents=null):le.isLink(o.mode)?(o.node_ops=se.ops_table.link.node,o.stream_ops=se.ops_table.link.stream):le.isChrdev(o.mode)&&(o.node_ops=se.ops_table.chrdev.node,o.stream_ops=se.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){r=Math.max(r,t*(t<1048576?2:1.125)>>>0),0!=t&&(r=Math.max(r,256));var n=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(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(e){var r={};return r.dev=le.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,le.isDir(e.mode)?r.size=4096:le.isFile(e.mode)?r.size=e.usedBytes:le.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(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp),void 0!==r.size&&se.resizeFileStorage(e,r.size)},lookup(e,r){throw le.genericErrors[44]},mknod:(e,r,t,n)=>se.createNode(e,r,t,n),rename(e,r,t){if(le.isDir(e.mode)){var n;try{n=le.lookupNode(r,t)}catch(e){}if(n)for(var o in n.contents)throw new le.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(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=le.lookupNode(e,r);for(var n in t.contents)throw new le.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){var n=se.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!le.isLink(e.mode))throw new le.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var a=e.node.contents;if(o>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-o,n);if(s>8&&a.subarray)r.set(a.subarray(o,o+s),t);else for(var i=0;i0||t+r(se.stream_ops.write(e,r,0,n,t,!1),0)}},ie=n.preloadPlugins||[],ue=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},le={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=V.resolve(e)))return{path:"",node:null};if((r=Object.assign({follow_mount:!0,recurse_count:0},r)).recurse_count>8)throw new le.ErrnoError(32);for(var t=e.split("/").filter((e=>!!e)),n=le.root,o="/",a=0;a40)throw new le.ErrnoError(32)}}return{path:o,node:n}},getPath(e){for(var r;;){if(le.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>>0)%le.nameTable.length},hashAddNode(e){var r=le.hashName(e.parent.id,e.name);e.name_next=le.nameTable[r],le.nameTable[r]=e},hashRemoveNode(e){var r=le.hashName(e.parent.id,e.name);if(le.nameTable[r]===e)le.nameTable[r]=e.name_next;else for(var t=le.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=le.mayLookup(e);if(t)throw new le.ErrnoError(t,e);for(var n=le.hashName(e.id,r),o=le.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===r)return o}return le.lookup(e,r)},createNode(e,r,t,n){var o=new le.FSNode(e,r,t,n);return le.hashAddNode(o),o},destroyNode(e){le.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),flagsToPermissionString(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>le.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=le.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){try{return le.lookupNode(e,r),20}catch(e){}return le.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=le.lookupNode(e,r)}catch(e){return e.errno}var o=le.nodePermissions(e,"wx");if(o)return o;if(t){if(!le.isDir(n.mode))return 54;if(le.isRoot(n)||le.getPath(n)===le.cwd())return 10}else if(le.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?le.isLink(e.mode)?32:le.isDir(e.mode)&&("r"!==le.flagsToPermissionString(r)||512&r)?31:le.nodePermissions(e,le.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=le.MAX_OPEN_FDS;e++)if(!le.streams[e])return e;throw new le.ErrnoError(33)},getStreamChecked(e){var r=le.getStream(e);if(!r)throw new le.ErrnoError(8);return r},getStream:e=>le.streams[e],createStream:(e,r=-1)=>(le.FSStream||(le.FSStream=function(){this.shared={}},le.FSStream.prototype={},Object.defineProperties(le.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new le.FSStream,e),-1==r&&(r=le.nextfd()),e.fd=r,le.streams[r]=e,e),closeStream(e){le.streams[e]=null},chrdev_stream_ops:{open(e){var r=le.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new le.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice(e,r){le.devices[e]={stream_ops:r}},getDevice:e=>le.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),le.syncFSRequests++,le.syncFSRequests>1&&y(`warning: ${le.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=le.getMounts(le.root.mount),n=0;function o(e){return le.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&&le.root)throw new le.ErrnoError(10);if(!o&&!a){var s=le.lookupPath(t,{follow_mount:!1});if(t=s.path,n=s.node,le.isMountpoint(n))throw new le.ErrnoError(10);if(!le.isDir(n.mode))throw new le.ErrnoError(54)}var i={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(i);return u.mount=i,i.root=u,o?le.root=u:n&&(n.mounted=i,n.mount&&n.mount.mounts.push(i)),u},unmount(e){var r=le.lookupPath(e,{follow_mount:!1});if(!le.isMountpoint(r.node))throw new le.ErrnoError(28);var t=r.node,n=t.mounted,o=le.getMounts(n);Object.keys(le.nameTable).forEach((e=>{for(var r=le.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&le.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=le.lookupPath(e,{parent:!0}).node,o=Z.basename(e);if(!o||"."===o||".."===o)throw new le.ErrnoError(28);var a=le.mayCreate(n,o);if(a)throw new le.ErrnoError(a);if(!n.node_ops.mknod)throw new le.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},create:(e,r)=>(r=void 0!==r?r:438,r&=4095,r|=32768,le.mknod(e,r,0)),mkdir:(e,r)=>(r=void 0!==r?r:511,r&=1023,r|=16384,le.mknod(e,r,0)),mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o(void 0===t&&(t=r,r=438),r|=8192,le.mknod(e,r,t)),symlink(e,r){if(!V.resolve(e))throw new le.ErrnoError(44);var t=le.lookupPath(r,{parent:!0}).node;if(!t)throw new le.ErrnoError(44);var n=Z.basename(r),o=le.mayCreate(t,n);if(o)throw new le.ErrnoError(o);if(!t.node_ops.symlink)throw new le.ErrnoError(63);return t.node_ops.symlink(t,n,e)},rename(e,r){var t,n,o=Z.dirname(e),a=Z.dirname(r),s=Z.basename(e),i=Z.basename(r);if(t=le.lookupPath(e,{parent:!0}).node,n=le.lookupPath(r,{parent:!0}).node,!t||!n)throw new le.ErrnoError(44);if(t.mount!==n.mount)throw new le.ErrnoError(75);var u,l=le.lookupNode(t,s),c=V.relative(e,a);if("."!==c.charAt(0))throw new le.ErrnoError(28);if("."!==(c=V.relative(r,o)).charAt(0))throw new le.ErrnoError(55);try{u=le.lookupNode(n,i)}catch(e){}if(l!==u){var d=le.isDir(l.mode),f=le.mayDelete(t,s,d);if(f)throw new le.ErrnoError(f);if(f=u?le.mayDelete(n,i,d):le.mayCreate(n,i))throw new le.ErrnoError(f);if(!t.node_ops.rename)throw new le.ErrnoError(63);if(le.isMountpoint(l)||u&&le.isMountpoint(u))throw new le.ErrnoError(10);if(n!==t&&(f=le.nodePermissions(t,"w")))throw new le.ErrnoError(f);le.hashRemoveNode(l);try{t.node_ops.rename(l,n,i)}catch(e){throw e}finally{le.hashAddNode(l)}}},rmdir(e){var r=le.lookupPath(e,{parent:!0}).node,t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!0);if(o)throw new le.ErrnoError(o);if(!r.node_ops.rmdir)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.rmdir(r,t),le.destroyNode(n)},readdir(e){var r=le.lookupPath(e,{follow:!0}).node;if(!r.node_ops.readdir)throw new le.ErrnoError(54);return r.node_ops.readdir(r)},unlink(e){var r=le.lookupPath(e,{parent:!0}).node;if(!r)throw new le.ErrnoError(44);var t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!1);if(o)throw new le.ErrnoError(o);if(!r.node_ops.unlink)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.unlink(r,t),le.destroyNode(n)},readlink(e){var r=le.lookupPath(e).node;if(!r)throw new le.ErrnoError(44);if(!r.node_ops.readlink)throw new le.ErrnoError(28);return V.resolve(le.getPath(r.parent),r.node_ops.readlink(r))},stat(e,r){var t=le.lookupPath(e,{follow:!r}).node;if(!t)throw new le.ErrnoError(44);if(!t.node_ops.getattr)throw new le.ErrnoError(63);return t.node_ops.getattr(t)},lstat:e=>le.stat(e,!0),chmod(e,r,t){var n;if(!(n="string"==typeof e?le.lookupPath(e,{follow:!t}).node:e).node_ops.setattr)throw new le.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&r|-4096&n.mode,timestamp:Date.now()})},lchmod(e,r){le.chmod(e,r,!0)},fchmod(e,r){var t=le.getStreamChecked(e);le.chmod(t.node,r)},chown(e,r,t,n){var o;if(!(o="string"==typeof e?le.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new le.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){le.chown(e,r,t,!0)},fchown(e,r,t){var n=le.getStreamChecked(e);le.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new le.ErrnoError(28);var t;if(!(t="string"==typeof e?le.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new le.ErrnoError(63);if(le.isDir(t.mode))throw new le.ErrnoError(31);if(!le.isFile(t.mode))throw new le.ErrnoError(28);var n=le.nodePermissions(t,"w");if(n)throw new le.ErrnoError(n);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=le.getStreamChecked(e);if(0==(2097155&t.flags))throw new le.ErrnoError(28);le.truncate(t.node,r)},utime(e,r,t){var n=le.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(r,t)})},open(e,r,t){if(""===e)throw new le.ErrnoError(44);var o;if(t=void 0===t?438:t,t=64&(r="string"==typeof r?(e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===r)throw new Error(`Unknown file open mode: ${e}`);return r})(r):r)?4095&t|32768:0,"object"==typeof e)o=e;else{e=Z.normalize(e);try{o=le.lookupPath(e,{follow:!(131072&r)}).node}catch(e){}}var a=!1;if(64&r)if(o){if(128&r)throw new le.ErrnoError(20)}else o=le.mknod(e,t,0),a=!0;if(!o)throw new le.ErrnoError(44);if(le.isChrdev(o.mode)&&(r&=-513),65536&r&&!le.isDir(o.mode))throw new le.ErrnoError(54);if(!a){var s=le.mayOpen(o,r);if(s)throw new le.ErrnoError(s)}512&r&&!a&&le.truncate(o,0),r&=-131713;var i=le.createStream({node:o,path:le.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return i.stream_ops.open&&i.stream_ops.open(i),!n.logReadFiles||1&r||(le.readFiles||(le.readFiles={}),e in le.readFiles||(le.readFiles[e]=1)),i},close(e){if(le.isClosed(e))throw new le.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{le.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new le.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new le.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 le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(1==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.read)throw new le.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new le.ErrnoError(70)}else o=e.position;var s=e.stream_ops.read(e,r,t,n,o);return a||(e.position+=s),s},write(e,r,t,n,o,a){if(n<0||o<0)throw new le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.write)throw new le.ErrnoError(28);e.seekable&&1024&e.flags&&le.llseek(e,0,2);var s=void 0!==o;if(s){if(!e.seekable)throw new le.ErrnoError(70)}else o=e.position;var i=e.stream_ops.write(e,r,t,n,o,a);return s||(e.position+=i),i},allocate(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(r<0||t<=0)throw new le.ErrnoError(28);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(!le.isFile(e.node.mode)&&!le.isDir(e.node.mode))throw new le.ErrnoError(43);if(!e.stream_ops.allocate)throw new le.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 le.ErrnoError(2);if(1==(2097155&e.flags))throw new le.ErrnoError(2);if(!e.stream_ops.mmap)throw new le.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync:(e,r,t,n,o)=>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 le.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=le.open(e,r.flags),o=le.stat(e).size,a=new Uint8Array(o);return le.read(n,a,0,o,0),"utf8"===r.encoding?t=Q(a,0):"binary"===r.encoding&&(t=a),le.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=le.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(re(r)+1),a=te(r,o,0,o.length);le.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(r))throw new Error("Unsupported data type");le.write(n,r,0,r.byteLength,void 0,t.canOwn)}le.close(n)},cwd:()=>le.currentPath,chdir(e){var r=le.lookupPath(e,{follow:!0});if(null===r.node)throw new le.ErrnoError(44);if(!le.isDir(r.node.mode))throw new le.ErrnoError(54);var t=le.nodePermissions(r.node,"x");if(t)throw new le.ErrnoError(t);le.currentPath=r.path},createDefaultDirectories(){le.mkdir("/tmp"),le.mkdir("/home"),le.mkdir("/home/web_user")},createDefaultDevices(){le.mkdir("/dev"),le.registerDevice(le.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n}),le.mkdev("/dev/null",le.makedev(1,3)),oe.register(le.makedev(5,0),oe.default_tty_ops),oe.register(le.makedev(6,0),oe.default_tty1_ops),le.mkdev("/dev/tty",le.makedev(5,0)),le.mkdev("/dev/tty1",le.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(0===r&&(r=G(e).byteLength),e[--r]);le.createDevice("/dev","random",t),le.createDevice("/dev","urandom",t),le.mkdir("/dev/shm"),le.mkdir("/dev/shm/tmp")},createSpecialDirectories(){le.mkdir("/proc");var e=le.mkdir("/proc/self");le.mkdir("/proc/self/fd"),le.mount({mount(){var r=le.createNode(e,"fd",16895,73);return r.node_ops={lookup(e,r){var t=+r,n=le.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},r}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?le.createDevice("/dev","stdin",n.stdin):le.symlink("/dev/tty","/dev/stdin"),n.stdout?le.createDevice("/dev","stdout",null,n.stdout):le.symlink("/dev/tty","/dev/stdout"),n.stderr?le.createDevice("/dev","stderr",null,n.stderr):le.symlink("/dev/tty1","/dev/stderr"),le.open("/dev/stdin",0),le.open("/dev/stdout",1),le.open("/dev/stderr",1)},ensureErrnoError(){le.ErrnoError||(le.ErrnoError=function(e,r){this.name="ErrnoError",this.node=r,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},le.ErrnoError.prototype=new Error,le.ErrnoError.prototype.constructor=le.ErrnoError,[44].forEach((e=>{le.genericErrors[e]=new le.ErrnoError(e),le.genericErrors[e].stack=""})))},staticInit(){le.ensureErrnoError(),le.nameTable=new Array(4096),le.mount(se,{},"/"),le.createDefaultDirectories(),le.createDefaultDevices(),le.createSpecialDirectories(),le.filesystems={MEMFS:se}},init(e,r,t){le.init.initialized=!0,le.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=r||n.stdout,n.stderr=t||n.stderr,le.createStandardStreams()},quit(){le.init.initialized=!1;for(var e=0;ethis.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,s=1048576;o||(s=n);var i=this;i.setDataGetter((e=>{var r=e*s,o=(e+1)*s-1;if(o=Math.min(o,n-1),void 0===i.chunks[e]&&(i.chunks[e]=((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!==s&&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||[]):ne(o.responseText||"",!0)})(r,o)),void 0===i.chunks[e])throw new Error("doXHR failed!");return i.chunks[e]})),!a&&n||(s=n=1,n=this.getter(0).length,s=n,_("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=s,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!d)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new a;Object.defineProperties(s,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var i={isDevice:!1,contents:s}}else i={isDevice:!1,url:t};var u=le.createFile(e,r,i,n,o);i.contents?u.contents=i.contents:i.url&&(u.contents=null,u.url=i.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,r,t,n,o){var a=e.node.contents;if(o>=a.length)return 0;var s=Math.min(a.length-o,n);if(a.slice)for(var i=0;i{var r=u.stream_ops[e];l[e]=function(){return le.forceLoadFile(u),r.apply(null,arguments)}})),l.read=(e,r,t,n,o)=>(le.forceLoadFile(u),c(e,r,t,n,o)),l.mmap=(e,r,t,n,o)=>{le.forceLoadFile(u);var a=ae();if(!a)throw new le.ErrnoError(48);return c(e,E,a,r,t),{ptr:a,allocated:!0}},u.stream_ops=l,u}},ce=(e,r)=>e?Q(b,e,r):"",de={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(Z.isAbs(r))return r;var n;if(n=-100===e?le.cwd():de.getStreamFromFD(e).path,0==r.length){if(!t)throw new le.ErrnoError(44);return n}return Z.join2(n,r)},doStat(e,r,t){try{var n=e(r)}catch(e){if(e&&e.node&&Z.normalize(r)!==Z.normalize(le.getPath(e.node)))return-54;throw e}F[t>>2]=n.dev,F[t+4>>2]=n.mode,D[t+8>>2]=n.nlink,F[t+12>>2]=n.uid,F[t+16>>2]=n.gid,F[t+20>>2]=n.rdev,I=[n.size>>>0,(j=n.size,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+24>>2]=I[0],F[t+28>>2]=I[1],F[t+32>>2]=4096,F[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),s=n.ctime.getTime();return I=[Math.floor(o/1e3)>>>0,(j=Math.floor(o/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+40>>2]=I[0],F[t+44>>2]=I[1],D[t+48>>2]=o%1e3*1e3,I=[Math.floor(a/1e3)>>>0,(j=Math.floor(a/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+56>>2]=I[0],F[t+60>>2]=I[1],D[t+64>>2]=a%1e3*1e3,I=[Math.floor(s/1e3)>>>0,(j=Math.floor(s/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+72>>2]=I[0],F[t+76>>2]=I[1],D[t+80>>2]=s%1e3*1e3,I=[n.ino>>>0,(j=n.ino,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+88>>2]=I[0],F[t+92>>2]=I[1],0},doMsync(e,r,t,n,o){if(!le.isFile(r.node.mode))throw new le.ErrnoError(43);if(2&n)return 0;var a=b.slice(e,e+t);le.msync(r,a,o,t,n)},varargs:void 0,get(){var e=F[+de.varargs>>2];return de.varargs+=4,e},getp:()=>de.get(),getStr:e=>ce(e),getStreamFromFD:e=>le.getStreamChecked(e)},fe=e=>(F[Oe()>>2]=e,e),he={BUCKET_BUFFER_SIZE:8192,mount:e=>le.createNode(null,"/",16895,0),createPipe(){var e={buckets:[],refcnt:2};e.buckets.push({buffer:new Uint8Array(he.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var r=he.nextname(),t=he.nextname(),n=le.createNode(he.root,r,4096,0),o=le.createNode(he.root,t,4096,0);n.pipe=e,o.pipe=e;var a=le.createStream({path:r,node:n,flags:0,seekable:!1,stream_ops:he.stream_ops});n.stream=a;var s=le.createStream({path:t,node:o,flags:1,seekable:!1,stream_ops:he.stream_ops});return o.stream=s,{readable_fd:a.fd,writable_fd:s.fd}},stream_ops:{poll(e){var r=e.node.pipe;if(1==(2097155&e.flags))return 260;if(r.buckets.length>0)for(var t=0;t0)return 65}return 0},ioctl:(e,r,t)=>28,fsync:e=>28,read(e,r,t,n,o){for(var a=e.node.pipe,s=0,i=0;i=i)return u.buffer.set(s,u.offset),u.offset+=i,i;l>0&&(u.buffer.set(s.subarray(0,l),u.offset),u.offset+=l,s=s.subarray(l,s.byteLength));for(var c=s.byteLength/he.BUCKET_BUFFER_SIZE|0,d=s.byteLength%he.BUCKET_BUFFER_SIZE,f=0;f0&&(h={buffer:new Uint8Array(he.BUCKET_BUFFER_SIZE),offset:s.byteLength,roffset:0},a.buckets.push(h),h.buffer.set(s)),i},close(e){var r=e.node.pipe;r.refcnt--,0===r.refcnt&&(r.buckets=null)}},nextname:()=>(he.nextname.current||(he.nextname.current=0),"pipe["+he.nextname.current+++"]")},me=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*r:NaN,pe=e=>e%4==0&&(e%100!=0||e%400==0),ve=[0,31,60,91,121,152,182,213,244,274,305,335],we=[0,31,59,90,120,151,181,212,243,273,304,334],ge=e=>(pe(e.getFullYear())?ve:we)[e.getMonth()]+e.getDate()-1,_e=(e,r,t)=>te(e,b,r,t),ye=e=>{var r=re(e)+1,t=xe(r);return t&&_e(e,t,r),t},Ee=e=>{var r=(e-g.buffer.byteLength+65535)/65536;try{return g.grow(r),C(),1}catch(e){}},be={},ke=()=>{if(!ke.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var r in be)void 0===be[r]?delete e[r]:e[r]=be[r];var t=[];for(var r in e)t.push(`${r}=${e[r]}`);ke.strings=t}return ke.strings},Se=e=>{X||(n.onExit?.(e),M=!0),l(e,new q(e))},Fe=(e,r)=>{Se(e)},De=[31,29,31,30,31,30,31,31,30,31,30,31],Me=[31,28,31,30,31,30,31,31,30,31,30,31],Ae=(e,r)=>{E.set(e,r)},Ce=e=>n["_"+e],Pe=(e,r,t,n,o)=>{var a={string:e=>{var r=0;return null!=e&&0!==e&&(r=(e=>{var r=re(e)+1,t=He(r);return _e(e,t,r),t})(e)),r},array:e=>{var r=He(e.length);return Ae(e,r),r}},s=Ce(e),i=[],u=0;if(n)for(var l=0;l{var d=r?V.resolve(Z.join2(e,r)):e;function f(t){function a(t){c?.(),u||((e,r,t,n,o,a)=>{le.createDataFile(e,r,t,n,o,a)})(e,r,t,n,o,l),s?.(),x()}((e,r,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return ie.forEach((a=>{o||a.canHandle(r)&&(a.handle(e,r,t,n),o=!0)})),o})(t,d,a,(()=>{i?.(),x()}))||a(t)}L(),"string"==typeof t?((e,r,t,n)=>{var o=n?"":`al ${e}`;a(e,(t=>{A(t,`Loading data file "${e}" failed (no arrayBuffer).`),r(new Uint8Array(t)),o&&x()}),(r=>{if(!t)throw`Loading data file "${e}" failed.`;t()})),o&&L()})(t,(e=>f(e)),i):f(t)},le.staticInit();var Ue={i:function(e){try{var r=de.getStreamFromFD(e);return le.createStream(r).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},a:function(e,r,t){de.varargs=t;try{var n=de.getStreamFromFD(e);switch(r){case 0:if((o=de.get())<0)return-28;for(;le.streams[o];)o++;return le.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=de.get();return n.flags|=o,0;case 5:return o=de.getp(),S[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return fe(28),-1}}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},x:function(e,r){try{var t=de.getStreamFromFD(e);return de.doStat(le.stat,t.path,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},u:function(e,r){try{return e=de.getStr(e),de.doStat(le.lstat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},v:function(e,r,t,n){try{r=de.getStr(r);var o=256&n,a=4096&n;return n&=-6401,r=de.calculateAt(e,r,a),de.doStat(o?le.lstat:le.stat,r,t)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},y:function(e,r,t,n){de.varargs=n;try{r=de.getStr(r),r=de.calculateAt(e,r);var o=n?de.get():0;return le.open(r,t,o).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},t:function(e){try{if(0==e)throw new le.ErrnoError(21);var r=he.createPipe();return F[e>>2]=r.readable_fd,F[e+4>>2]=r.writable_fd,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},s:function(e,r,t){try{for(var n=0,o=0;o>2],i=S[a+4>>1],u=32,l=le.getStream(s);l&&(u=de.DEFAULT_POLLMASK,l.stream_ops.poll&&(u=l.stream_ops.poll(l,-1))),(u&=24|i)&&n++,S[a+6>>1]=u}return n}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},w:function(e,r){try{return e=de.getStr(e),de.doStat(le.stat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},q:function(e,r,t){try{return r=de.getStr(r),r=de.calculateAt(e,r),0===t?le.unlink(r):512===t?le.rmdir(r):O("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},B:()=>1,k:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);F[t>>2]=o.getUTCSeconds(),F[t+4>>2]=o.getUTCMinutes(),F[t+8>>2]=o.getUTCHours(),F[t+12>>2]=o.getUTCDate(),F[t+16>>2]=o.getUTCMonth(),F[t+20>>2]=o.getUTCFullYear()-1900,F[t+24>>2]=o.getUTCDay();var a=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),s=(o.getTime()-a)/864e5|0;F[t+28>>2]=s},l:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);F[t>>2]=o.getSeconds(),F[t+4>>2]=o.getMinutes(),F[t+8>>2]=o.getHours(),F[t+12>>2]=o.getDate(),F[t+16>>2]=o.getMonth(),F[t+20>>2]=o.getFullYear()-1900,F[t+24>>2]=o.getDay();var a=0|ge(o);F[t+28>>2]=a,F[t+36>>2]=-60*o.getTimezoneOffset();var s=new Date(o.getFullYear(),0,1),i=new Date(o.getFullYear(),6,1).getTimezoneOffset(),u=s.getTimezoneOffset(),l=0|(i!=u&&o.getTimezoneOffset()==Math.min(u,i));F[t+32>>2]=l},m:function(e){var r=(()=>{var r=new Date(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),t=F[e+32>>2],n=r.getTimezoneOffset(),o=new Date(r.getFullYear(),0,1),a=new Date(r.getFullYear(),6,1).getTimezoneOffset(),s=o.getTimezoneOffset(),i=Math.min(s,a);if(t<0)F[e+32>>2]=Number(a!=s&&i==n);else if(t>0!=(i==n)){var u=Math.max(s,a),l=t>0?i:u;r.setTime(r.getTime()+6e4*(l-n))}F[e+24>>2]=r.getDay();var c=0|ge(r);F[e+28>>2]=c,F[e>>2]=r.getSeconds(),F[e+4>>2]=r.getMinutes(),F[e+8>>2]=r.getHours(),F[e+12>>2]=r.getDate(),F[e+16>>2]=r.getMonth(),F[e+20>>2]=r.getYear();var d=r.getTime();return isNaN(d)?(fe(61),-1):d/1e3})();return Be((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},n:function(e){var r=(()=>{var r=Date.UTC(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),t=new Date(r);F[e+24>>2]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),o=(t.getTime()-n)/864e5|0;return F[e+28>>2]=o,t.getTime()/1e3})();return Be((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},r:(e,r,t)=>{var n=(new Date).getFullYear(),o=new Date(n,0,1),a=new Date(n,6,1),s=o.getTimezoneOffset(),i=a.getTimezoneOffset(),u=Math.max(s,i);function l(e){var r=e.toTimeString().match(/\(([A-Za-z ]+)\)$/);return r?r[1]:"GMT"}D[e>>2]=60*u,F[r>>2]=Number(s!=i);var c=l(o),d=l(a),f=ye(c),h=ye(d);i>2]=f,D[t+4>>2]=h):(D[t>>2]=h,D[t+4>>2]=f)},b:()=>{O("")},c:()=>Date.now(),h:(e,r,t)=>b.copyWithin(e,r,r+t),p:e=>{var r=b.length,t=2147483648;if((e>>>=0)>t)return!1;for(var n,o,a=1;a<=4;a*=2){var s=r*(1+.2/a);s=Math.min(s,e+100663296);var i=Math.min(t,(n=Math.max(e,s))+((o=65536)-n%o)%o);if(Ee(i))return!0}return!1},z:(e,r)=>{var t=0;return ke().forEach(((n,o)=>{var a=r+t;D[e+4*o>>2]=a,((e,r)=>{for(var t=0;t>0]=e.charCodeAt(t);E[r>>0]=0})(n,a),t+=n.length+1})),0},A:(e,r)=>{var t=ke();D[e>>2]=t.length;var n=0;return t.forEach((e=>n+=e.length+1)),D[r>>2]=n,0},g:Fe,e:function(e){try{var r=de.getStreamFromFD(e);return le.close(r),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},j:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],i=D[r+4>>2];r+=8;var u=le.read(e,E,s,i,n);if(u<0)return-1;if(o+=u,u>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},o:function(e,r,t,n,o){var a=me(r,t);try{if(isNaN(a))return 61;var s=de.getStreamFromFD(e);return le.llseek(s,a,n),I=[s.position>>>0,(j=s.position,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[o>>2]=I[0],F[o+4>>2]=I[1],s.getdents&&0===a&&0===n&&(s.getdents=null),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},d:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],i=D[r+4>>2];r+=8;var u=le.write(e,E,s,i,n);if(u<0)return-1;o+=u,void 0!==n&&(n+=u)}return o})(de.getStreamFromFD(e),r,t);return D[n>>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},f:(e,r,t,n)=>{var o=D[n+40>>2],a={tm_sec:F[n>>2],tm_min:F[n+4>>2],tm_hour:F[n+8>>2],tm_mday:F[n+12>>2],tm_mon:F[n+16>>2],tm_year:F[n+20>>2],tm_wday:F[n+24>>2],tm_yday:F[n+28>>2],tm_isdst:F[n+32>>2],tm_gmtoff:F[n+36>>2],tm_zone:o?ce(o):""},s=ce(t),i={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in i)s=s.replace(new RegExp(u,"g"),i[u]);var l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,r,t){for(var n="number"==typeof e?e.toString():e||"";n.length0?1:0}var n;return 0===(n=t(e.getFullYear()-r.getFullYear()))&&0===(n=t(e.getMonth()-r.getMonth()))&&(n=t(e.getDate()-r.getDate())),n}function m(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function p(e){var r=((e,r)=>{for(var t=new Date(e.getTime());r>0;){var n=pe(t.getFullYear()),o=t.getMonth(),a=(n?De:Me)[o];if(!(r>a-t.getDate()))return t.setDate(t.getDate()+r),t;r-=a-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return t})(new Date(e.tm_year+1900,0,1),e.tm_yday),t=new Date(r.getFullYear(),0,4),n=new Date(r.getFullYear()+1,0,4),o=m(t),a=m(n);return h(o,r)<=0?h(a,r)<=0?r.getFullYear()+1:r.getFullYear():r.getFullYear()-1}var v={"%a":e=>l[e.tm_wday].substring(0,3),"%A":e=>l[e.tm_wday],"%b":e=>c[e.tm_mon].substring(0,3),"%B":e=>c[e.tm_mon],"%C":e=>f((e.tm_year+1900)/100|0,2),"%d":e=>f(e.tm_mday,2),"%e":e=>d(e.tm_mday,2," "),"%g":e=>p(e).toString().substring(2),"%G":e=>p(e),"%H":e=>f(e.tm_hour,2),"%I":e=>{var r=e.tm_hour;return 0==r?r=12:r>12&&(r-=12),f(r,2)},"%j":e=>f(e.tm_mday+((e,r)=>{for(var t=0,n=0;n<=r;t+=e[n++]);return t})(pe(e.tm_year+1900)?De:Me,e.tm_mon-1),3),"%m":e=>f(e.tm_mon+1,2),"%M":e=>f(e.tm_min,2),"%n":()=>"\n","%p":e=>e.tm_hour>=0&&e.tm_hour<12?"AM":"PM","%S":e=>f(e.tm_sec,2),"%t":()=>"\t","%u":e=>e.tm_wday||7,"%U":e=>{var r=e.tm_yday+7-e.tm_wday;return f(Math.floor(r/7),2)},"%V":e=>{var r=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&r++,r){if(53==r){var t=(e.tm_wday+371-e.tm_yday)%7;4==t||3==t&&pe(e.tm_year)||(r=1)}}else{r=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&pe(e.tm_year%400-1))&&r++}return f(r,2)},"%w":e=>e.tm_wday,"%W":e=>{var r=e.tm_yday+7-(e.tm_wday+6)%7;return f(Math.floor(r/7),2)},"%y":e=>(e.tm_year+1900).toString().substring(2),"%Y":e=>e.tm_year+1900,"%z":e=>{var r=e.tm_gmtoff,t=r>=0;return r=(r=Math.abs(r)/60)/60*100+r%60,(t?"+":"-")+String("0000"+r).slice(-4)},"%Z":e=>e.tm_zone,"%%":()=>"%"};for(var u in s=s.replace(/%%/g,"\0\0"),v)s.includes(u)&&(s=s.replace(new RegExp(u,"g"),v[u](a)));var w=ne(s=s.replace(/\0\0/g,"%"),!1);return w.length>r?0:(Ae(w,e),w.length-1)}},Le=function(){var e,r,o,a,s={a:Ue};function i(e,r){var t;return Le=e.exports,g=Le.C,C(),t=Le.D,T.unshift(t),x(),Le}if(L(),n.instantiateWasm)try{return n.instantiateWasm(s,i)}catch(e){y(`Module.instantiateWasm callback failed with error: ${e}`),t(e)}return(e=w,r=N,o=s,a=function(e){i(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||H(r)||Y(r)||f||"function"!=typeof fetch?K(r,o,a):fetch(r,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,o).then(a,(function(e){return y(`wasm streaming compile failed: ${e}`),y("falling back to ArrayBuffer instantiation"),K(r,o,a)}))))).catch(t),{}}();n._get_version=()=>(n._get_version=Le.E)(),n._archive_open=(e,r,t,o)=>(n._archive_open=Le.F)(e,r,t,o),n._archive_read_add_passphrase=(e,r)=>(n._archive_read_add_passphrase=Le.G)(e,r),n._archive_error_string=e=>(n._archive_error_string=Le.H)(e),n._get_next_entry=e=>(n._get_next_entry=Le.I)(e),n._get_filedata=(e,r)=>(n._get_filedata=Le.J)(e,r);var xe=n._malloc=e=>(xe=n._malloc=Le.K)(e);n._archive_close=e=>(n._archive_close=Le.L)(e),n._start_archive_write=(e,r,t,o,a,s)=>(n._start_archive_write=Le.M)(e,r,t,o,a,s),n._write_archive_file=(e,r,t,o)=>(n._write_archive_file=Le.N)(e,r,t,o),n._size_of_size_t=()=>(n._size_of_size_t=Le.O)(),n._finish_archive_write=(e,r)=>(n._finish_archive_write=Le.P)(e,r),n._free=e=>(n._free=Le.Q)(e);var Oe=()=>(Oe=Le.R)();n._archive_entry_birthtime_nsec=e=>(n._archive_entry_birthtime_nsec=Le.S)(e),n._archive_entry_filetype=e=>(n._archive_entry_filetype=Le.T)(e),n._archive_entry_mtime_nsec=e=>(n._archive_entry_mtime_nsec=Le.U)(e),n._archive_entry_pathname=e=>(n._archive_entry_pathname=Le.V)(e),n._archive_entry_pathname_utf8=e=>(n._archive_entry_pathname_utf8=Le.W)(e),n._archive_entry_size=e=>(n._archive_entry_size=Le.X)(e),n._archive_entry_is_encrypted=e=>(n._archive_entry_is_encrypted=Le.Y)(e),n._archive_read_has_encrypted_entries=e=>(n._archive_read_has_encrypted_entries=Le.Z)(e),n._archive_read_data_skip=e=>(n._archive_read_data_skip=Le._)(e);var Ne,Be=e=>(Be=Le.aa)(e),je=()=>(je=Le.ba)(),Ie=e=>(Ie=Le.ca)(e),He=e=>(He=Le.da)(e);function Ye(){function e(){Ne||(Ne=!0,n.calledRun=!0,M||(n.noFSInit||le.init.initialized||le.init(),le.ignorePermissions=!1,he.root=le.mount(he,{},null),$(T),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)e=n.postRun.shift(),R.unshift(e);var e;$(R)}()))}z>0||(function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)e=n.preRun.shift(),P.unshift(e);var e;$(P)}(),z>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.cwrap=(e,r,t,n)=>{var o=!t||t.every((e=>"number"===e||"boolean"===e));return"string"!==r&&o&&!n?Ce(e):function(){return Pe(e,r,t,arguments)}},n.allocate=(e,r)=>{var t;return t=1==r?He(e.length):xe(e.length),e.subarray||e.slice||(e=new Uint8Array(e)),b.set(e,t),t},U=function e(){Ne||Ye(),Ne||(U=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return Ye(),e.ready});class F{constructor(){this.preRun=[],this.postRun=[],this.totalDependencies=0}print(...e){console.log(e)}printErr(...e){console.error(e)}initFunctions(){this.runCode={getVersion:this.cwrap("get_version","string",[]),openArchive:this.cwrap("archive_open","number",["number","number","string","string"]),getNextEntry:this.cwrap("get_next_entry","number",["number"]),getFileData:this.cwrap("get_filedata","number",["number","number"]),skipEntry:this.cwrap("archive_read_data_skip","number",["number"]),closeArchive:this.cwrap("archive_close",null,["number"]),getEntrySize:this.cwrap("archive_entry_size","number",["number"]),getEntryName:this.cwrap("archive_entry_pathname","string",["number"]),getEntryType:this.cwrap("archive_entry_filetype","number",["number"]),getEntryLastModified:this.cwrap("archive_entry_mtime_nsec","number",["number"]),getError:this.cwrap("archive_error_string","string",["number"]),startArchiveWrite:this.cwrap("start_archive_write","number",["string","string","number","number","number","string"]),writeArchiveFile:this.cwrap("write_archive_file",null,["number","string","number","number"]),finishArchiveWrite:this.cwrap("finish_archive_write","number",["number","number"]),entryIsEncrypted:this.cwrap("archive_entry_is_encrypted","number",["number"]),hasEncryptedEntries:this.cwrap("archive_read_has_encrypted_entries","number",["number"]),addPassphrase:this.cwrap("archive_read_add_passphrase","number",["number","string"]),string:e=>this.allocate(this.intArrayFromString(e),"i8",0),malloc:this.cwrap("malloc","number",["number"]),free:this.cwrap("free",null,["number"]),sizeOfSizeT:this.cwrap("size_of_size_t","number",[])}}monitorRunDependencies(){}}let D=null,M=null,A=!1;class C{constructor(e){C.readyCallback=e,A&&setTimeout((()=>e()),0)}open(e,r){D.open(e).then((()=>r()))}listFiles(){let e=[];for(const r of D.entries(!0))e.push(r);return e}extractFiles(){let e=[];for(const r of D.entries(!1))e.push(r);return e}extractSingleFile(e){for(const r of D.entries(!0,e))if(r.fileData)return r}hasEncryptedData(){return D.hasEncryptedData()}usePassword(e){D.setPassphrase(e)}setLocale(e){D.setLocale(e)}writeArchive(e,r,t,n){return M.write(e,r,t,n)}close(){D.close()}}var P;P=e=>{D=new E(e),M=new b(e),C?.readyCallback?.(),A=!0},S(new F).then((e=>{e.initFunctions(),P(e)})),u(C, /** * @license * Copyright 2019 Google LLC diff --git a/dist/worker-bundle.js b/dist/worker-bundle.js index 94780d6..a13a800 100644 --- a/dist/worker-bundle.js +++ b/dist/worker-bundle.js @@ -3,4 +3,4 @@ * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */ -const e=Symbol("Comlink.proxy"),r=Symbol("Comlink.endpoint"),t=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),o=Symbol("Comlink.thrown"),a=e=>"object"==typeof e&&null!==e||"function"==typeof e,i=new Map([["proxy",{canHandle:r=>a(r)&&r[e],serialize(e){const{port1:r,port2:t}=new MessageChannel;return s(e,r),[t,[t]]},deserialize(e){return e.start(),f(e,[],r);var r}}],["throw",{canHandle:e=>a(e)&&o in e,serialize({value:e}){let r;return r=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[r,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function s(r,t=globalThis,a=["*"]){t.addEventListener("message",(function i(l){if(!l||!l.data)return;if(!function(e,r){for(const t of e){if(r===t||"*"===t)return!0;if(t instanceof RegExp&&t.test(r))return!0}return!1}(a,l.origin))return void console.warn(`Invalid origin '${l.origin}' for comlink proxy`);const{id:c,type:d,path:h}=Object.assign({path:[]},l.data),f=(l.data.argumentList||[]).map(w);let m;try{const t=h.slice(0,-1).reduce(((e,r)=>e[r]),r),n=h.reduce(((e,r)=>e[r]),r);switch(d){case"GET":m=n;break;case"SET":t[h.slice(-1)[0]]=w(l.data.value),m=!0;break;case"APPLY":m=n.apply(t,f);break;case"CONSTRUCT":m=function(r){return Object.assign(r,{[e]:!0})}(new n(...f));break;case"ENDPOINT":{const{port1:e,port2:t}=new MessageChannel;s(r,t),m=function(e,r){return p.set(e,r),e}(e,[e])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[o]:0}}Promise.resolve(m).catch((e=>({value:e,[o]:0}))).then((e=>{const[o,a]=v(e);t.postMessage(Object.assign(Object.assign({},o),{id:c}),a),"RELEASE"===d&&(t.removeEventListener("message",i),u(t),n in r&&"function"==typeof r[n]&&r[n]())})).catch((e=>{const[r,n]=v({value:new TypeError("Unserializable return value"),[o]:0});t.postMessage(Object.assign(Object.assign({},r),{id:c}),n)}))})),t.start&&t.start()}function u(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function l(e){if(e)throw new Error("Proxy has been released and is not useable")}function c(e){return g(e,{type:"RELEASE"}).then((()=>{u(e)}))}const d=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const r=(d.get(e)||0)-1;d.set(e,r),0===r&&c(e)}));function f(e,n=[],o=function(){}){let a=!1;const i=new Proxy(o,{get(r,o){if(l(a),o===t)return()=>{!function(e){h&&h.unregister(e)}(i),c(e),a=!0};if("then"===o){if(0===n.length)return{then:()=>i};const r=g(e,{type:"GET",path:n.map((e=>e.toString()))}).then(w);return r.then.bind(r)}return f(e,[...n,o])},set(r,t,o){l(a);const[i,s]=v(o);return g(e,{type:"SET",path:[...n,t].map((e=>e.toString())),value:i},s).then(w)},apply(t,o,i){l(a);const s=n[n.length-1];if(s===r)return g(e,{type:"ENDPOINT"}).then(w);if("bind"===s)return f(e,n.slice(0,-1));const[u,c]=m(i);return g(e,{type:"APPLY",path:n.map((e=>e.toString())),argumentList:u},c).then(w)},construct(r,t){l(a);const[o,i]=m(t);return g(e,{type:"CONSTRUCT",path:n.map((e=>e.toString())),argumentList:o},i).then(w)}});return function(e,r){const t=(d.get(r)||0)+1;d.set(r,t),h&&h.register(e,r,e)}(i,e),i}function m(e){const r=e.map(v);return[r.map((e=>e[0])),(t=r.map((e=>e[1])),Array.prototype.concat.apply([],t))];var t}const p=new WeakMap;function v(e){for(const[r,t]of i)if(t.canHandle(e)){const[n,o]=t.serialize(e);return[{type:"HANDLER",name:r,value:n},o]}return[{type:"RAW",value:e},p.get(e)||[]]}function w(e){switch(e.type){case"HANDLER":return i.get(e.name).deserialize(e.value);case"RAW":return e.value}}function g(e,r,t){return new Promise((n=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function r(t){t.data&&t.data.id&&t.data.id===o&&(e.removeEventListener("message",r),n(t.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},r),t)}))}const _={32768:"FILE",16384:"DIR",40960:"SYMBOLIC_LINK",49152:"SOCKET",8192:"CHARACTER_DEVICE",24576:"BLOCK_DEVICE",4096:"NAMED_PIPE"};class y{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._file=null,this._passphrase=null,this._locale="en_US.UTF-8"}async open(e){null!==this._file&&(console.warn("Closing previous file"),this.close());const r=await this._loadFile(e);this._fileLength=r.length,this._filePtr=r.ptr}close(){this._runCode.closeArchive(this._archive),this._wasmModule._free(this._filePtr),this._file=null,this._filePtr=null,this._archive=null}hasEncryptedData(){this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale),this._runCode.getNextEntry(this._archive);const e=this._runCode.hasEncryptedEntries(this._archive);return 0!==e&&(e>0||null)}setPassphrase(e){this._passphrase=e}setLocale(e){this._locale=e}*entries(e=!1,r=null){let t;for(this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale);t=this._runCode.getNextEntry(this._archive),0!==t;){const n={size:this._runCode.getEntrySize(t),path:this._runCode.getEntryName(t),type:_[this._runCode.getEntryType(t)],lastModified:this._runCode.getEntryLastModified(t),ref:t};if("FILE"===n.type){let e=n.path.split("/");n.fileName=e[e.length-1]}if(e&&r!==n.path)this._runCode.skipEntry(this._archive);else{const e=this._runCode.getFileData(this._archive,n.size);if(e<0)throw new Error(this._runCode.getError(this._archive));n.fileData=this._wasmModule.HEAPU8.slice(e,e+n.size),this._wasmModule._free(e)}yield n}}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}}class E{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._passphrase=null,this._locale="en_US.UTF-8"}async write(e,r,t,n=null){let o=e.reduce(((e,{file:r})=>e+r.size+128),0)+128;const a=this._runCode.malloc(o),i=this._runCode.malloc(this._runCode.sizeOfSizeT()),s=this._runCode.startArchiveWrite(r,t,a,o,i,n);for(const{file:r,pathname:t}of e){const e=await this._loadFile(r);this._runCode.writeArchiveFile(s,t||r.name,e.length,e.ptr),this._runCode.free(e.ptr)}const u=this._runCode.closeArchiveWrite(s),l=this._runCode.freeArchiveWrite(s);if(0!==u||0!==l)throw new Error(this._runCode.getError(s));const c=this.readNumberFromPointer(i);return this._wasmModule.HEAPU8.slice(a,a+c)}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}readNumberFromPointer(e){const r=this._runCode.sizeOfSizeT(),t=this._wasmModule.HEAPU8.slice(e,e+r);let n=null;if(4==r)n=new Uint32Array(t)[0];else{if(8!=r)throw Error("Unexpected size of size_t: "+r);n=new BigUint64Array(t)[0]}return n}}var b,k=(b=import.meta.url,async function(e={}){var r,t,n=e;n.ready=new Promise(((e,n)=>{r=e,t=n}));var o,a,i,s=Object.assign({},n),u="./this.program",l=(e,r)=>{throw r},c="object"==typeof window,d="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";if(h){const{createRequire:e}=await import("module");var m=e(import.meta.url),p=m("fs"),v=m("path");f=d?v.dirname(f)+"/":m("url").fileURLToPath(new URL("./",import.meta.url)),o=(e,r)=>(e=Y(e)?new URL(e):v.normalize(e),p.readFileSync(e,r?void 0:"utf8")),i=e=>{var r=o(e,!0);return r.buffer||(r=new Uint8Array(r)),r},a=(e,r,t,n=!0)=>{e=Y(e)?new URL(e):v.normalize(e),p.readFile(e,n?void 0:"utf8",((e,o)=>{e?t(e):r(n?o.buffer:o)}))},!n.thisProgram&&process.argv.length>1&&(u=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),l=(e,r)=>{throw process.exitCode=e,r},n.inspect=()=>"[Emscripten Module object]"}else(c||d)&&(d?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),b&&(f=b),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},d&&(i=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),a=(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 w,g,_=n.print||console.log.bind(console),y=n.printErr||console.error.bind(console);Object.assign(n,s),s=null,n.arguments&&n.arguments,n.thisProgram&&(u=n.thisProgram),n.quit&&(l=n.quit),n.wasmBinary&&(w=n.wasmBinary),"object"!=typeof WebAssembly&&O("no native wasm support detected");var E,k,S,F,D,M=!1;function A(e,r){e||O(r)}function C(){var e=g.buffer;n.HEAP8=E=new Int8Array(e),n.HEAP16=S=new Int16Array(e),n.HEAPU8=k=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAP32=F=new Int32Array(e),n.HEAPU32=D=new Uint32Array(e),n.HEAPF32=new Float32Array(e),n.HEAPF64=new Float64Array(e)}var P=[],T=[],R=[],U=0,z=null;function L(e){U++,n.monitorRunDependencies?.(U)}function x(e){if(U--,n.monitorRunDependencies?.(U),0==U&&z){var r=z;z=null,r()}}function O(e){n.onAbort?.(e),y(e="Aborted("+e+")"),M=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw t(r),r}var N,B,j,I,H=e=>e.startsWith("data:application/octet-stream;base64,"),Y=e=>e.startsWith("file://");function W(e){if(e==N&&w)return new Uint8Array(w);if(i)return i(e);throw"both async and sync fetching of the wasm failed"}function K(e,r,t){return function(e){if(!w&&(c||d)){if("function"==typeof fetch&&!Y(e))return fetch(e,{credentials:"same-origin"}).then((r=>{if(!r.ok)throw"failed to load wasm binary file at '"+e+"'";return r.arrayBuffer()})).catch((()=>W(e)));if(a)return new Promise(((r,t)=>{a(e,(e=>r(new Uint8Array(e))),t)}))}return Promise.resolve().then((()=>W(e)))}(e).then((e=>WebAssembly.instantiate(e,r))).then((e=>e)).then(t,(e=>{y(`failed to asynchronously prepare wasm: ${e}`),O(e)}))}function $(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}n.locateFile?H(N="libarchive.wasm")||(B=N,N=n.locateFile?n.locateFile(B,f):f+B):N=new URL("libarchive.wasm",import.meta.url).href;var q=e=>{for(;e.length>0;)e.shift()(n)},X=n.noExitRuntime||!0,Z={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=Z.isAbs(e),t="/"===e.substr(-1);return(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=Z.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=Z.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===r?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments);return Z.normalize(e.join("/"))},join2:(e,r)=>Z.normalize(e+"/"+r)},G=e=>(G=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return r=>e.randomFillSync(r);var r=e.randomBytes;return e=>(e.set(r(e.byteLength)),e)}catch(e){}O("initRandomDevice")})())(e),V={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:le.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=Z.isAbs(n)}return(r?"/":"")+(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||"."},relative:(e,r)=>{function t(e){for(var r=0;r=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=V.resolve(e).substr(1),r=V.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{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&J)return J.decode(e.subarray(r,o));for(var a="";r>10,56320|1023&l)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},ee=[],re=e=>{for(var r=0,t=0;t=55296&&n<=57343?(r+=4,++t):r+=3}return r},te=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,i=0;i=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 ne(e,r,t){var n=t>0?t:re(e)+1,o=new Array(n),a=te(e,o,0,o.length);return r&&(o.length=a),o}var oe={ttys:[],init(){},shutdown(){},register(e,r){oe.ttys[e]={input:[],output:[],ops:r},le.registerDevice(e,oe.stream_ops)},stream_ops:{open(e){var r=oe.ttys[e.node.rdev];if(!r)throw new le.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new le.ErrnoError(60);for(var a=0,i=0;i(()=>{if(!ee.length){var e=null;if(h){var r=Buffer.alloc(256),t=0,n=process.stdin.fd;try{t=p.readSync(n,r)}catch(e){if(!e.toString().includes("EOF"))throw e;t=0}e=t>0?r.slice(0,t).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;ee=ne(e,!0)}return ee.shift()})(),put_char(e,r){null===r||10===r?(_(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(_(Q(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,r,t)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,r){null===r||10===r?(y(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(y(Q(e.output,0)),e.output=[])}}},ae=e=>{O()},ie={ops_table:null,mount:e=>ie.createNode(null,"/",16895,0),createNode(e,r,t,n){if(le.isBlkdev(t)||le.isFIFO(t))throw new le.ErrnoError(63);ie.ops_table||={dir:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr,lookup:ie.node_ops.lookup,mknod:ie.node_ops.mknod,rename:ie.node_ops.rename,unlink:ie.node_ops.unlink,rmdir:ie.node_ops.rmdir,readdir:ie.node_ops.readdir,symlink:ie.node_ops.symlink},stream:{llseek:ie.stream_ops.llseek}},file:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr},stream:{llseek:ie.stream_ops.llseek,read:ie.stream_ops.read,write:ie.stream_ops.write,allocate:ie.stream_ops.allocate,mmap:ie.stream_ops.mmap,msync:ie.stream_ops.msync}},link:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr,readlink:ie.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr},stream:le.chrdev_stream_ops}};var o=le.createNode(e,r,t,n);return le.isDir(o.mode)?(o.node_ops=ie.ops_table.dir.node,o.stream_ops=ie.ops_table.dir.stream,o.contents={}):le.isFile(o.mode)?(o.node_ops=ie.ops_table.file.node,o.stream_ops=ie.ops_table.file.stream,o.usedBytes=0,o.contents=null):le.isLink(o.mode)?(o.node_ops=ie.ops_table.link.node,o.stream_ops=ie.ops_table.link.stream):le.isChrdev(o.mode)&&(o.node_ops=ie.ops_table.chrdev.node,o.stream_ops=ie.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){r=Math.max(r,t*(t<1048576?2:1.125)>>>0),0!=t&&(r=Math.max(r,256));var n=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(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(e){var r={};return r.dev=le.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,le.isDir(e.mode)?r.size=4096:le.isFile(e.mode)?r.size=e.usedBytes:le.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(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp),void 0!==r.size&&ie.resizeFileStorage(e,r.size)},lookup(e,r){throw le.genericErrors[44]},mknod:(e,r,t,n)=>ie.createNode(e,r,t,n),rename(e,r,t){if(le.isDir(e.mode)){var n;try{n=le.lookupNode(r,t)}catch(e){}if(n)for(var o in n.contents)throw new le.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(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=le.lookupNode(e,r);for(var n in t.contents)throw new le.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){var n=ie.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!le.isLink(e.mode))throw new le.ErrnoError(28);return e.link}},stream_ops:{read(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;s0||t+r(ie.stream_ops.write(e,r,0,n,t,!1),0)}},se=n.preloadPlugins||[],ue=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},le={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=V.resolve(e)))return{path:"",node:null};if((r=Object.assign({follow_mount:!0,recurse_count:0},r)).recurse_count>8)throw new le.ErrnoError(32);for(var t=e.split("/").filter((e=>!!e)),n=le.root,o="/",a=0;a40)throw new le.ErrnoError(32)}}return{path:o,node:n}},getPath(e){for(var r;;){if(le.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>>0)%le.nameTable.length},hashAddNode(e){var r=le.hashName(e.parent.id,e.name);e.name_next=le.nameTable[r],le.nameTable[r]=e},hashRemoveNode(e){var r=le.hashName(e.parent.id,e.name);if(le.nameTable[r]===e)le.nameTable[r]=e.name_next;else for(var t=le.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=le.mayLookup(e);if(t)throw new le.ErrnoError(t,e);for(var n=le.hashName(e.id,r),o=le.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===r)return o}return le.lookup(e,r)},createNode(e,r,t,n){var o=new le.FSNode(e,r,t,n);return le.hashAddNode(o),o},destroyNode(e){le.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),flagsToPermissionString(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>le.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=le.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){try{return le.lookupNode(e,r),20}catch(e){}return le.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=le.lookupNode(e,r)}catch(e){return e.errno}var o=le.nodePermissions(e,"wx");if(o)return o;if(t){if(!le.isDir(n.mode))return 54;if(le.isRoot(n)||le.getPath(n)===le.cwd())return 10}else if(le.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?le.isLink(e.mode)?32:le.isDir(e.mode)&&("r"!==le.flagsToPermissionString(r)||512&r)?31:le.nodePermissions(e,le.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=le.MAX_OPEN_FDS;e++)if(!le.streams[e])return e;throw new le.ErrnoError(33)},getStreamChecked(e){var r=le.getStream(e);if(!r)throw new le.ErrnoError(8);return r},getStream:e=>le.streams[e],createStream:(e,r=-1)=>(le.FSStream||(le.FSStream=function(){this.shared={}},le.FSStream.prototype={},Object.defineProperties(le.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new le.FSStream,e),-1==r&&(r=le.nextfd()),e.fd=r,le.streams[r]=e,e),closeStream(e){le.streams[e]=null},chrdev_stream_ops:{open(e){var r=le.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new le.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice(e,r){le.devices[e]={stream_ops:r}},getDevice:e=>le.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),le.syncFSRequests++,le.syncFSRequests>1&&y(`warning: ${le.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=le.getMounts(le.root.mount),n=0;function o(e){return le.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&&le.root)throw new le.ErrnoError(10);if(!o&&!a){var i=le.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,le.isMountpoint(n))throw new le.ErrnoError(10);if(!le.isDir(n.mode))throw new le.ErrnoError(54)}var s={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?le.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(e){var r=le.lookupPath(e,{follow_mount:!1});if(!le.isMountpoint(r.node))throw new le.ErrnoError(28);var t=r.node,n=t.mounted,o=le.getMounts(n);Object.keys(le.nameTable).forEach((e=>{for(var r=le.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&le.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=le.lookupPath(e,{parent:!0}).node,o=Z.basename(e);if(!o||"."===o||".."===o)throw new le.ErrnoError(28);var a=le.mayCreate(n,o);if(a)throw new le.ErrnoError(a);if(!n.node_ops.mknod)throw new le.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},create:(e,r)=>(r=void 0!==r?r:438,r&=4095,r|=32768,le.mknod(e,r,0)),mkdir:(e,r)=>(r=void 0!==r?r:511,r&=1023,r|=16384,le.mknod(e,r,0)),mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o(void 0===t&&(t=r,r=438),r|=8192,le.mknod(e,r,t)),symlink(e,r){if(!V.resolve(e))throw new le.ErrnoError(44);var t=le.lookupPath(r,{parent:!0}).node;if(!t)throw new le.ErrnoError(44);var n=Z.basename(r),o=le.mayCreate(t,n);if(o)throw new le.ErrnoError(o);if(!t.node_ops.symlink)throw new le.ErrnoError(63);return t.node_ops.symlink(t,n,e)},rename(e,r){var t,n,o=Z.dirname(e),a=Z.dirname(r),i=Z.basename(e),s=Z.basename(r);if(t=le.lookupPath(e,{parent:!0}).node,n=le.lookupPath(r,{parent:!0}).node,!t||!n)throw new le.ErrnoError(44);if(t.mount!==n.mount)throw new le.ErrnoError(75);var u,l=le.lookupNode(t,i),c=V.relative(e,a);if("."!==c.charAt(0))throw new le.ErrnoError(28);if("."!==(c=V.relative(r,o)).charAt(0))throw new le.ErrnoError(55);try{u=le.lookupNode(n,s)}catch(e){}if(l!==u){var d=le.isDir(l.mode),h=le.mayDelete(t,i,d);if(h)throw new le.ErrnoError(h);if(h=u?le.mayDelete(n,s,d):le.mayCreate(n,s))throw new le.ErrnoError(h);if(!t.node_ops.rename)throw new le.ErrnoError(63);if(le.isMountpoint(l)||u&&le.isMountpoint(u))throw new le.ErrnoError(10);if(n!==t&&(h=le.nodePermissions(t,"w")))throw new le.ErrnoError(h);le.hashRemoveNode(l);try{t.node_ops.rename(l,n,s)}catch(e){throw e}finally{le.hashAddNode(l)}}},rmdir(e){var r=le.lookupPath(e,{parent:!0}).node,t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!0);if(o)throw new le.ErrnoError(o);if(!r.node_ops.rmdir)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.rmdir(r,t),le.destroyNode(n)},readdir(e){var r=le.lookupPath(e,{follow:!0}).node;if(!r.node_ops.readdir)throw new le.ErrnoError(54);return r.node_ops.readdir(r)},unlink(e){var r=le.lookupPath(e,{parent:!0}).node;if(!r)throw new le.ErrnoError(44);var t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!1);if(o)throw new le.ErrnoError(o);if(!r.node_ops.unlink)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.unlink(r,t),le.destroyNode(n)},readlink(e){var r=le.lookupPath(e).node;if(!r)throw new le.ErrnoError(44);if(!r.node_ops.readlink)throw new le.ErrnoError(28);return V.resolve(le.getPath(r.parent),r.node_ops.readlink(r))},stat(e,r){var t=le.lookupPath(e,{follow:!r}).node;if(!t)throw new le.ErrnoError(44);if(!t.node_ops.getattr)throw new le.ErrnoError(63);return t.node_ops.getattr(t)},lstat:e=>le.stat(e,!0),chmod(e,r,t){var n;if(!(n="string"==typeof e?le.lookupPath(e,{follow:!t}).node:e).node_ops.setattr)throw new le.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&r|-4096&n.mode,timestamp:Date.now()})},lchmod(e,r){le.chmod(e,r,!0)},fchmod(e,r){var t=le.getStreamChecked(e);le.chmod(t.node,r)},chown(e,r,t,n){var o;if(!(o="string"==typeof e?le.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new le.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){le.chown(e,r,t,!0)},fchown(e,r,t){var n=le.getStreamChecked(e);le.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new le.ErrnoError(28);var t;if(!(t="string"==typeof e?le.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new le.ErrnoError(63);if(le.isDir(t.mode))throw new le.ErrnoError(31);if(!le.isFile(t.mode))throw new le.ErrnoError(28);var n=le.nodePermissions(t,"w");if(n)throw new le.ErrnoError(n);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=le.getStreamChecked(e);if(0==(2097155&t.flags))throw new le.ErrnoError(28);le.truncate(t.node,r)},utime(e,r,t){var n=le.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(r,t)})},open(e,r,t){if(""===e)throw new le.ErrnoError(44);var o;if(t=void 0===t?438:t,t=64&(r="string"==typeof r?(e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===r)throw new Error(`Unknown file open mode: ${e}`);return r})(r):r)?4095&t|32768:0,"object"==typeof e)o=e;else{e=Z.normalize(e);try{o=le.lookupPath(e,{follow:!(131072&r)}).node}catch(e){}}var a=!1;if(64&r)if(o){if(128&r)throw new le.ErrnoError(20)}else o=le.mknod(e,t,0),a=!0;if(!o)throw new le.ErrnoError(44);if(le.isChrdev(o.mode)&&(r&=-513),65536&r&&!le.isDir(o.mode))throw new le.ErrnoError(54);if(!a){var i=le.mayOpen(o,r);if(i)throw new le.ErrnoError(i)}512&r&&!a&&le.truncate(o,0),r&=-131713;var s=le.createStream({node:o,path:le.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!n.logReadFiles||1&r||(le.readFiles||(le.readFiles={}),e in le.readFiles||(le.readFiles[e]=1)),s},close(e){if(le.isClosed(e))throw new le.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{le.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new le.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new le.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 le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(1==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.read)throw new le.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new le.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 le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.write)throw new le.ErrnoError(28);e.seekable&&1024&e.flags&&le.llseek(e,0,2);var i=void 0!==o;if(i){if(!e.seekable)throw new le.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(le.isClosed(e))throw new le.ErrnoError(8);if(r<0||t<=0)throw new le.ErrnoError(28);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(!le.isFile(e.node.mode)&&!le.isDir(e.node.mode))throw new le.ErrnoError(43);if(!e.stream_ops.allocate)throw new le.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 le.ErrnoError(2);if(1==(2097155&e.flags))throw new le.ErrnoError(2);if(!e.stream_ops.mmap)throw new le.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync:(e,r,t,n,o)=>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 le.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=le.open(e,r.flags),o=le.stat(e).size,a=new Uint8Array(o);return le.read(n,a,0,o,0),"utf8"===r.encoding?t=Q(a,0):"binary"===r.encoding&&(t=a),le.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=le.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(re(r)+1),a=te(r,o,0,o.length);le.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(r))throw new Error("Unsupported data type");le.write(n,r,0,r.byteLength,void 0,t.canOwn)}le.close(n)},cwd:()=>le.currentPath,chdir(e){var r=le.lookupPath(e,{follow:!0});if(null===r.node)throw new le.ErrnoError(44);if(!le.isDir(r.node.mode))throw new le.ErrnoError(54);var t=le.nodePermissions(r.node,"x");if(t)throw new le.ErrnoError(t);le.currentPath=r.path},createDefaultDirectories(){le.mkdir("/tmp"),le.mkdir("/home"),le.mkdir("/home/web_user")},createDefaultDevices(){le.mkdir("/dev"),le.registerDevice(le.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n}),le.mkdev("/dev/null",le.makedev(1,3)),oe.register(le.makedev(5,0),oe.default_tty_ops),oe.register(le.makedev(6,0),oe.default_tty1_ops),le.mkdev("/dev/tty",le.makedev(5,0)),le.mkdev("/dev/tty1",le.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(0===r&&(r=G(e).byteLength),e[--r]);le.createDevice("/dev","random",t),le.createDevice("/dev","urandom",t),le.mkdir("/dev/shm"),le.mkdir("/dev/shm/tmp")},createSpecialDirectories(){le.mkdir("/proc");var e=le.mkdir("/proc/self");le.mkdir("/proc/self/fd"),le.mount({mount(){var r=le.createNode(e,"fd",16895,73);return r.node_ops={lookup(e,r){var t=+r,n=le.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},r}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?le.createDevice("/dev","stdin",n.stdin):le.symlink("/dev/tty","/dev/stdin"),n.stdout?le.createDevice("/dev","stdout",null,n.stdout):le.symlink("/dev/tty","/dev/stdout"),n.stderr?le.createDevice("/dev","stderr",null,n.stderr):le.symlink("/dev/tty1","/dev/stderr"),le.open("/dev/stdin",0),le.open("/dev/stdout",1),le.open("/dev/stderr",1)},ensureErrnoError(){le.ErrnoError||(le.ErrnoError=function(e,r){this.name="ErrnoError",this.node=r,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},le.ErrnoError.prototype=new Error,le.ErrnoError.prototype.constructor=le.ErrnoError,[44].forEach((e=>{le.genericErrors[e]=new le.ErrnoError(e),le.genericErrors[e].stack=""})))},staticInit(){le.ensureErrnoError(),le.nameTable=new Array(4096),le.mount(ie,{},"/"),le.createDefaultDirectories(),le.createDefaultDevices(),le.createSpecialDirectories(),le.filesystems={MEMFS:ie}},init(e,r,t){le.init.initialized=!0,le.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=r||n.stdout,n.stderr=t||n.stderr,le.createStandardStreams()},quit(){le.init.initialized=!1;for(var e=0;ethis.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=this;s.setDataGetter((e=>{var r=e*i,o=(e+1)*i-1;if(o=Math.min(o,n-1),void 0===s.chunks[e]&&(s.chunks[e]=((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||[]):ne(o.responseText||"",!0)})(r,o)),void 0===s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]})),!a&&n||(i=n=1,n=this.getter(0).length,i=n,_("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){if(!d)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i=new a;Object.defineProperties(i,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:i}}else s={isDevice:!1,url:t};var u=le.createFile(e,r,s,n,o);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var l={};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{var r=u.stream_ops[e];l[e]=function(){return le.forceLoadFile(u),r.apply(null,arguments)}})),l.read=(e,r,t,n,o)=>(le.forceLoadFile(u),c(e,r,t,n,o)),l.mmap=(e,r,t,n,o)=>{le.forceLoadFile(u);var a=ae();if(!a)throw new le.ErrnoError(48);return c(e,E,a,r,t),{ptr:a,allocated:!0}},u.stream_ops=l,u}},ce=(e,r)=>e?Q(k,e,r):"",de={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(Z.isAbs(r))return r;var n;if(n=-100===e?le.cwd():de.getStreamFromFD(e).path,0==r.length){if(!t)throw new le.ErrnoError(44);return n}return Z.join2(n,r)},doStat(e,r,t){try{var n=e(r)}catch(e){if(e&&e.node&&Z.normalize(r)!==Z.normalize(le.getPath(e.node)))return-54;throw e}F[t>>2]=n.dev,F[t+4>>2]=n.mode,D[t+8>>2]=n.nlink,F[t+12>>2]=n.uid,F[t+16>>2]=n.gid,F[t+20>>2]=n.rdev,I=[n.size>>>0,(j=n.size,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+24>>2]=I[0],F[t+28>>2]=I[1],F[t+32>>2]=4096,F[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),i=n.ctime.getTime();return I=[Math.floor(o/1e3)>>>0,(j=Math.floor(o/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+40>>2]=I[0],F[t+44>>2]=I[1],D[t+48>>2]=o%1e3*1e3,I=[Math.floor(a/1e3)>>>0,(j=Math.floor(a/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+56>>2]=I[0],F[t+60>>2]=I[1],D[t+64>>2]=a%1e3*1e3,I=[Math.floor(i/1e3)>>>0,(j=Math.floor(i/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+72>>2]=I[0],F[t+76>>2]=I[1],D[t+80>>2]=i%1e3*1e3,I=[n.ino>>>0,(j=n.ino,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+88>>2]=I[0],F[t+92>>2]=I[1],0},doMsync(e,r,t,n,o){if(!le.isFile(r.node.mode))throw new le.ErrnoError(43);if(2&n)return 0;var a=k.slice(e,e+t);le.msync(r,a,o,t,n)},varargs:void 0,get(){var e=F[+de.varargs>>2];return de.varargs+=4,e},getp:()=>de.get(),getStr:e=>ce(e),getStreamFromFD:e=>le.getStreamChecked(e)},he=e=>(F[Oe()>>2]=e,e),fe={BUCKET_BUFFER_SIZE:8192,mount:e=>le.createNode(null,"/",16895,0),createPipe(){var e={buckets:[],refcnt:2};e.buckets.push({buffer:new Uint8Array(fe.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var r=fe.nextname(),t=fe.nextname(),n=le.createNode(fe.root,r,4096,0),o=le.createNode(fe.root,t,4096,0);n.pipe=e,o.pipe=e;var a=le.createStream({path:r,node:n,flags:0,seekable:!1,stream_ops:fe.stream_ops});n.stream=a;var i=le.createStream({path:t,node:o,flags:1,seekable:!1,stream_ops:fe.stream_ops});return o.stream=i,{readable_fd:a.fd,writable_fd:i.fd}},stream_ops:{poll(e){var r=e.node.pipe;if(1==(2097155&e.flags))return 260;if(r.buckets.length>0)for(var t=0;t0)return 65}return 0},ioctl:(e,r,t)=>28,fsync:e=>28,read(e,r,t,n,o){for(var a=e.node.pipe,i=0,s=0;s=s)return u.buffer.set(i,u.offset),u.offset+=s,s;l>0&&(u.buffer.set(i.subarray(0,l),u.offset),u.offset+=l,i=i.subarray(l,i.byteLength));for(var c=i.byteLength/fe.BUCKET_BUFFER_SIZE|0,d=i.byteLength%fe.BUCKET_BUFFER_SIZE,h=0;h0&&(f={buffer:new Uint8Array(fe.BUCKET_BUFFER_SIZE),offset:i.byteLength,roffset:0},a.buckets.push(f),f.buffer.set(i)),s},close(e){var r=e.node.pipe;r.refcnt--,0===r.refcnt&&(r.buckets=null)}},nextname:()=>(fe.nextname.current||(fe.nextname.current=0),"pipe["+fe.nextname.current+++"]")},me=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*r:NaN,pe=e=>e%4==0&&(e%100!=0||e%400==0),ve=[0,31,60,91,121,152,182,213,244,274,305,335],we=[0,31,59,90,120,151,181,212,243,273,304,334],ge=e=>(pe(e.getFullYear())?ve:we)[e.getMonth()]+e.getDate()-1,_e=(e,r,t)=>te(e,k,r,t),ye=e=>{var r=re(e)+1,t=xe(r);return t&&_e(e,t,r),t},Ee=e=>{var r=(e-g.buffer.byteLength+65535)/65536;try{return g.grow(r),C(),1}catch(e){}},be={},ke=()=>{if(!ke.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var r in be)void 0===be[r]?delete e[r]:e[r]=be[r];var t=[];for(var r in e)t.push(`${r}=${e[r]}`);ke.strings=t}return ke.strings},Se=e=>{X||(n.onExit?.(e),M=!0),l(e,new $(e))},Fe=(e,r)=>{Se(e)},De=[31,29,31,30,31,30,31,31,30,31,30,31],Me=[31,28,31,30,31,30,31,31,30,31,30,31],Ae=(e,r)=>{E.set(e,r)},Ce=e=>n["_"+e],Pe=(e,r,t,n,o)=>{var a={string:e=>{var r=0;return null!=e&&0!==e&&(r=(e=>{var r=re(e)+1,t=He(r);return _e(e,t,r),t})(e)),r},array:e=>{var r=He(e.length);return Ae(e,r),r}},i=Ce(e),s=[],u=0;if(n)for(var l=0;l{var d=r?V.resolve(Z.join2(e,r)):e;function h(t){function a(t){c?.(),u||((e,r,t,n,o,a)=>{le.createDataFile(e,r,t,n,o,a)})(e,r,t,n,o,l),i?.(),x()}((e,r,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return se.forEach((a=>{o||a.canHandle(r)&&(a.handle(e,r,t,n),o=!0)})),o})(t,d,a,(()=>{s?.(),x()}))||a(t)}L(),"string"==typeof t?((e,r,t,n)=>{var o=n?"":`al ${e}`;a(e,(t=>{A(t,`Loading data file "${e}" failed (no arrayBuffer).`),r(new Uint8Array(t)),o&&x()}),(r=>{if(!t)throw`Loading data file "${e}" failed.`;t()})),o&&L()})(t,(e=>h(e)),s):h(t)},le.staticInit();var ze={i:function(e){try{var r=de.getStreamFromFD(e);return le.createStream(r).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},a:function(e,r,t){de.varargs=t;try{var n=de.getStreamFromFD(e);switch(r){case 0:if((o=de.get())<0)return-28;for(;le.streams[o];)o++;return le.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=de.get();return n.flags|=o,0;case 5:return o=de.getp(),S[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return he(28),-1}}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},x:function(e,r){try{var t=de.getStreamFromFD(e);return de.doStat(le.stat,t.path,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},u:function(e,r){try{return e=de.getStr(e),de.doStat(le.lstat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},v:function(e,r,t,n){try{r=de.getStr(r);var o=256&n,a=4096&n;return n&=-6401,r=de.calculateAt(e,r,a),de.doStat(o?le.lstat:le.stat,r,t)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},y:function(e,r,t,n){de.varargs=n;try{r=de.getStr(r),r=de.calculateAt(e,r);var o=n?de.get():0;return le.open(r,t,o).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},t:function(e){try{if(0==e)throw new le.ErrnoError(21);var r=fe.createPipe();return F[e>>2]=r.readable_fd,F[e+4>>2]=r.writable_fd,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},s:function(e,r,t){try{for(var n=0,o=0;o>2],s=S[a+4>>1],u=32,l=le.getStream(i);l&&(u=de.DEFAULT_POLLMASK,l.stream_ops.poll&&(u=l.stream_ops.poll(l,-1))),(u&=24|s)&&n++,S[a+6>>1]=u}return n}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},w:function(e,r){try{return e=de.getStr(e),de.doStat(le.stat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},q:function(e,r,t){try{return r=de.getStr(r),r=de.calculateAt(e,r),0===t?le.unlink(r):512===t?le.rmdir(r):O("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},B:()=>1,k:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);F[t>>2]=o.getUTCSeconds(),F[t+4>>2]=o.getUTCMinutes(),F[t+8>>2]=o.getUTCHours(),F[t+12>>2]=o.getUTCDate(),F[t+16>>2]=o.getUTCMonth(),F[t+20>>2]=o.getUTCFullYear()-1900,F[t+24>>2]=o.getUTCDay();var a=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),i=(o.getTime()-a)/864e5|0;F[t+28>>2]=i},l:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);F[t>>2]=o.getSeconds(),F[t+4>>2]=o.getMinutes(),F[t+8>>2]=o.getHours(),F[t+12>>2]=o.getDate(),F[t+16>>2]=o.getMonth(),F[t+20>>2]=o.getFullYear()-1900,F[t+24>>2]=o.getDay();var a=0|ge(o);F[t+28>>2]=a,F[t+36>>2]=-60*o.getTimezoneOffset();var i=new Date(o.getFullYear(),0,1),s=new Date(o.getFullYear(),6,1).getTimezoneOffset(),u=i.getTimezoneOffset(),l=0|(s!=u&&o.getTimezoneOffset()==Math.min(u,s));F[t+32>>2]=l},m:function(e){var r=(()=>{var r=new Date(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),t=F[e+32>>2],n=r.getTimezoneOffset(),o=new Date(r.getFullYear(),0,1),a=new Date(r.getFullYear(),6,1).getTimezoneOffset(),i=o.getTimezoneOffset(),s=Math.min(i,a);if(t<0)F[e+32>>2]=Number(a!=i&&s==n);else if(t>0!=(s==n)){var u=Math.max(i,a),l=t>0?s:u;r.setTime(r.getTime()+6e4*(l-n))}F[e+24>>2]=r.getDay();var c=0|ge(r);F[e+28>>2]=c,F[e>>2]=r.getSeconds(),F[e+4>>2]=r.getMinutes(),F[e+8>>2]=r.getHours(),F[e+12>>2]=r.getDate(),F[e+16>>2]=r.getMonth(),F[e+20>>2]=r.getYear();var d=r.getTime();return isNaN(d)?(he(61),-1):d/1e3})();return Be((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},n:function(e){var r=(()=>{var r=Date.UTC(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),t=new Date(r);F[e+24>>2]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),o=(t.getTime()-n)/864e5|0;return F[e+28>>2]=o,t.getTime()/1e3})();return Be((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},r:(e,r,t)=>{var n=(new Date).getFullYear(),o=new Date(n,0,1),a=new Date(n,6,1),i=o.getTimezoneOffset(),s=a.getTimezoneOffset(),u=Math.max(i,s);function l(e){var r=e.toTimeString().match(/\(([A-Za-z ]+)\)$/);return r?r[1]:"GMT"}D[e>>2]=60*u,F[r>>2]=Number(i!=s);var c=l(o),d=l(a),h=ye(c),f=ye(d);s>2]=h,D[t+4>>2]=f):(D[t>>2]=f,D[t+4>>2]=h)},b:()=>{O("")},c:()=>Date.now(),h:(e,r,t)=>k.copyWithin(e,r,r+t),p:e=>{var r=k.length,t=2147483648;if((e>>>=0)>t)return!1;for(var n,o,a=1;a<=4;a*=2){var i=r*(1+.2/a);i=Math.min(i,e+100663296);var s=Math.min(t,(n=Math.max(e,i))+((o=65536)-n%o)%o);if(Ee(s))return!0}return!1},z:(e,r)=>{var t=0;return ke().forEach(((n,o)=>{var a=r+t;D[e+4*o>>2]=a,((e,r)=>{for(var t=0;t>0]=e.charCodeAt(t);E[r>>0]=0})(n,a),t+=n.length+1})),0},A:(e,r)=>{var t=ke();D[e>>2]=t.length;var n=0;return t.forEach((e=>n+=e.length+1)),D[r>>2]=n,0},g:Fe,e:function(e){try{var r=de.getStreamFromFD(e);return le.close(r),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},j:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],s=D[r+4>>2];r+=8;var u=le.read(e,E,i,s,n);if(u<0)return-1;if(o+=u,u>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},o:function(e,r,t,n,o){var a=me(r,t);try{if(isNaN(a))return 61;var i=de.getStreamFromFD(e);return le.llseek(i,a,n),I=[i.position>>>0,(j=i.position,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[o>>2]=I[0],F[o+4>>2]=I[1],i.getdents&&0===a&&0===n&&(i.getdents=null),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},d:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],s=D[r+4>>2];r+=8;var u=le.write(e,E,i,s,n);if(u<0)return-1;o+=u,void 0!==n&&(n+=u)}return o})(de.getStreamFromFD(e),r,t);return D[n>>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},f:(e,r,t,n)=>{var o=D[n+40>>2],a={tm_sec:F[n>>2],tm_min:F[n+4>>2],tm_hour:F[n+8>>2],tm_mday:F[n+12>>2],tm_mon:F[n+16>>2],tm_year:F[n+20>>2],tm_wday:F[n+24>>2],tm_yday:F[n+28>>2],tm_isdst:F[n+32>>2],tm_gmtoff:F[n+36>>2],tm_zone:o?ce(o):""},i=ce(t),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in s)i=i.replace(new RegExp(u,"g"),s[u]);var l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,r,t){for(var n="number"==typeof e?e.toString():e||"";n.length0?1:0}var n;return 0===(n=t(e.getFullYear()-r.getFullYear()))&&0===(n=t(e.getMonth()-r.getMonth()))&&(n=t(e.getDate()-r.getDate())),n}function m(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function p(e){var r=((e,r)=>{for(var t=new Date(e.getTime());r>0;){var n=pe(t.getFullYear()),o=t.getMonth(),a=(n?De:Me)[o];if(!(r>a-t.getDate()))return t.setDate(t.getDate()+r),t;r-=a-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return t})(new Date(e.tm_year+1900,0,1),e.tm_yday),t=new Date(r.getFullYear(),0,4),n=new Date(r.getFullYear()+1,0,4),o=m(t),a=m(n);return f(o,r)<=0?f(a,r)<=0?r.getFullYear()+1:r.getFullYear():r.getFullYear()-1}var v={"%a":e=>l[e.tm_wday].substring(0,3),"%A":e=>l[e.tm_wday],"%b":e=>c[e.tm_mon].substring(0,3),"%B":e=>c[e.tm_mon],"%C":e=>h((e.tm_year+1900)/100|0,2),"%d":e=>h(e.tm_mday,2),"%e":e=>d(e.tm_mday,2," "),"%g":e=>p(e).toString().substring(2),"%G":e=>p(e),"%H":e=>h(e.tm_hour,2),"%I":e=>{var r=e.tm_hour;return 0==r?r=12:r>12&&(r-=12),h(r,2)},"%j":e=>h(e.tm_mday+((e,r)=>{for(var t=0,n=0;n<=r;t+=e[n++]);return t})(pe(e.tm_year+1900)?De:Me,e.tm_mon-1),3),"%m":e=>h(e.tm_mon+1,2),"%M":e=>h(e.tm_min,2),"%n":()=>"\n","%p":e=>e.tm_hour>=0&&e.tm_hour<12?"AM":"PM","%S":e=>h(e.tm_sec,2),"%t":()=>"\t","%u":e=>e.tm_wday||7,"%U":e=>{var r=e.tm_yday+7-e.tm_wday;return h(Math.floor(r/7),2)},"%V":e=>{var r=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&r++,r){if(53==r){var t=(e.tm_wday+371-e.tm_yday)%7;4==t||3==t&&pe(e.tm_year)||(r=1)}}else{r=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&pe(e.tm_year%400-1))&&r++}return h(r,2)},"%w":e=>e.tm_wday,"%W":e=>{var r=e.tm_yday+7-(e.tm_wday+6)%7;return h(Math.floor(r/7),2)},"%y":e=>(e.tm_year+1900).toString().substring(2),"%Y":e=>e.tm_year+1900,"%z":e=>{var r=e.tm_gmtoff,t=r>=0;return r=(r=Math.abs(r)/60)/60*100+r%60,(t?"+":"-")+String("0000"+r).slice(-4)},"%Z":e=>e.tm_zone,"%%":()=>"%"};for(var u in i=i.replace(/%%/g,"\0\0"),v)i.includes(u)&&(i=i.replace(new RegExp(u,"g"),v[u](a)));var w=ne(i=i.replace(/\0\0/g,"%"),!1);return w.length>r?0:(Ae(w,e),w.length-1)}},Le=function(){var e,r,o,a,i={a:ze};function s(e,r){var t;return Le=e.exports,g=Le.C,C(),t=Le.D,T.unshift(t),x(),Le}if(L(),n.instantiateWasm)try{return n.instantiateWasm(i,s)}catch(e){y(`Module.instantiateWasm callback failed with error: ${e}`),t(e)}return(e=w,r=N,o=i,a=function(e){s(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||H(r)||Y(r)||h||"function"!=typeof fetch?K(r,o,a):fetch(r,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,o).then(a,(function(e){return y(`wasm streaming compile failed: ${e}`),y("falling back to ArrayBuffer instantiation"),K(r,o,a)}))))).catch(t),{}}();n._get_version=()=>(n._get_version=Le.E)(),n._archive_open=(e,r,t,o)=>(n._archive_open=Le.F)(e,r,t,o),n._archive_read_add_passphrase=(e,r)=>(n._archive_read_add_passphrase=Le.G)(e,r),n._archive_error_string=e=>(n._archive_error_string=Le.H)(e),n._get_next_entry=e=>(n._get_next_entry=Le.I)(e),n._get_filedata=(e,r)=>(n._get_filedata=Le.J)(e,r);var xe=n._malloc=e=>(xe=n._malloc=Le.K)(e);n._archive_close=e=>(n._archive_close=Le.L)(e),n._start_archive_write=(e,r,t,o,a,i)=>(n._start_archive_write=Le.M)(e,r,t,o,a,i),n._write_archive_file=(e,r,t,o)=>(n._write_archive_file=Le.N)(e,r,t,o),n._size_of_size_t=()=>(n._size_of_size_t=Le.O)(),n._free=e=>(n._free=Le.P)(e);var Oe=()=>(Oe=Le.Q)();n._archive_entry_birthtime_nsec=e=>(n._archive_entry_birthtime_nsec=Le.R)(e),n._archive_entry_filetype=e=>(n._archive_entry_filetype=Le.S)(e),n._archive_entry_mtime_nsec=e=>(n._archive_entry_mtime_nsec=Le.T)(e),n._archive_entry_pathname=e=>(n._archive_entry_pathname=Le.U)(e),n._archive_entry_pathname_utf8=e=>(n._archive_entry_pathname_utf8=Le.V)(e),n._archive_entry_size=e=>(n._archive_entry_size=Le.W)(e),n._archive_entry_is_encrypted=e=>(n._archive_entry_is_encrypted=Le.X)(e),n._archive_read_has_encrypted_entries=e=>(n._archive_read_has_encrypted_entries=Le.Y)(e),n._archive_read_data_skip=e=>(n._archive_read_data_skip=Le.Z)(e),n._archive_write_close=e=>(n._archive_write_close=Le.$)(e),n._archive_write_free=e=>(n._archive_write_free=Le.aa)(e);var Ne,Be=e=>(Be=Le.ba)(e),je=()=>(je=Le.ca)(),Ie=e=>(Ie=Le.da)(e),He=e=>(He=Le.ea)(e);function Ye(){function e(){Ne||(Ne=!0,n.calledRun=!0,M||(n.noFSInit||le.init.initialized||le.init(),le.ignorePermissions=!1,fe.root=le.mount(fe,{},null),q(T),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)e=n.postRun.shift(),R.unshift(e);var e;q(R)}()))}U>0||(function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)e=n.preRun.shift(),P.unshift(e);var e;q(P)}(),U>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.cwrap=(e,r,t,n)=>{var o=!t||t.every((e=>"number"===e||"boolean"===e));return"string"!==r&&o&&!n?Ce(e):function(){return Pe(e,r,t,arguments)}},n.UTF8ToString=ce,n.intArrayFromString=ne,n.allocate=(e,r)=>{var t;return t=1==r?He(e.length):xe(e.length),e.subarray||e.slice||(e=new Uint8Array(e)),k.set(e,t),t},z=function e(){Ne||Ye(),Ne||(z=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return Ye(),e.ready});class S{constructor(){this.preRun=[],this.postRun=[],this.totalDependencies=0}print(...e){console.log(e)}printErr(...e){console.error(e)}initFunctions(){this.runCode={getVersion:this.cwrap("get_version","string",[]),openArchive:this.cwrap("archive_open","number",["number","number","string","string"]),getNextEntry:this.cwrap("get_next_entry","number",["number"]),getFileData:this.cwrap("get_filedata","number",["number","number"]),skipEntry:this.cwrap("archive_read_data_skip","number",["number"]),closeArchive:this.cwrap("archive_close",null,["number"]),getEntrySize:this.cwrap("archive_entry_size","number",["number"]),getEntryName:this.cwrap("archive_entry_pathname","string",["number"]),getEntryType:this.cwrap("archive_entry_filetype","number",["number"]),getEntryLastModified:this.cwrap("archive_entry_mtime_nsec","number",["number"]),getError:this.cwrap("archive_error_string","string",["number"]),startArchiveWrite:this.cwrap("start_archive_write","number",["string","string","number","number","number","string"]),writeArchiveFile:this.cwrap("write_archive_file",null,["number","string","number","number"]),closeArchiveWrite:this.cwrap("archive_write_close","number",["number"]),freeArchiveWrite:this.cwrap("archive_write_free","number",["number"]),entryIsEncrypted:this.cwrap("archive_entry_is_encrypted","number",["number"]),hasEncryptedEntries:this.cwrap("archive_read_has_encrypted_entries","number",["number"]),addPassphrase:this.cwrap("archive_read_add_passphrase","number",["number","string"]),string:e=>this.allocate(this.intArrayFromString(e),"i8",0),malloc:this.cwrap("malloc","number",["number"]),free:this.cwrap("free",null,["number"]),sizeOfSizeT:this.cwrap("size_of_size_t","number",[])}}monitorRunDependencies(){}}let F=null,D=null,M=!1;class A{constructor(e){A.readyCallback=e,M&&setTimeout((()=>e()),0)}open(e,r){F.open(e).then((()=>r()))}listFiles(){let e=[];for(const r of F.entries(!0))e.push(r);return e}extractFiles(){let e=[];for(const r of F.entries(!1))e.push(r);return e}extractSingleFile(e){for(const r of F.entries(!0,e))if(r.fileData)return r}hasEncryptedData(){return F.hasEncryptedData()}usePassword(e){F.setPassphrase(e)}setLocale(e){F.setLocale(e)}writeArchive(e,r,t,n){return D.write(e,r,t,n)}close(){F.close()}}var C;C=e=>{F=new y(e),D=new E(e),A?.readyCallback?.(),M=!0},k(new S).then((e=>{e.initFunctions(),C(e)})),s(A); +const e=Symbol("Comlink.proxy"),r=Symbol("Comlink.endpoint"),t=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),o=Symbol("Comlink.thrown"),a=e=>"object"==typeof e&&null!==e||"function"==typeof e,s=new Map([["proxy",{canHandle:r=>a(r)&&r[e],serialize(e){const{port1:r,port2:t}=new MessageChannel;return i(e,r),[t,[t]]},deserialize(e){return e.start(),f(e,[],r);var r}}],["throw",{canHandle:e=>a(e)&&o in e,serialize({value:e}){let r;return r=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[r,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function i(r,t=globalThis,a=["*"]){t.addEventListener("message",(function s(l){if(!l||!l.data)return;if(!function(e,r){for(const t of e){if(r===t||"*"===t)return!0;if(t instanceof RegExp&&t.test(r))return!0}return!1}(a,l.origin))return void console.warn(`Invalid origin '${l.origin}' for comlink proxy`);const{id:c,type:d,path:h}=Object.assign({path:[]},l.data),f=(l.data.argumentList||[]).map(w);let m;try{const t=h.slice(0,-1).reduce(((e,r)=>e[r]),r),n=h.reduce(((e,r)=>e[r]),r);switch(d){case"GET":m=n;break;case"SET":t[h.slice(-1)[0]]=w(l.data.value),m=!0;break;case"APPLY":m=n.apply(t,f);break;case"CONSTRUCT":m=function(r){return Object.assign(r,{[e]:!0})}(new n(...f));break;case"ENDPOINT":{const{port1:e,port2:t}=new MessageChannel;i(r,t),m=function(e,r){return p.set(e,r),e}(e,[e])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[o]:0}}Promise.resolve(m).catch((e=>({value:e,[o]:0}))).then((e=>{const[o,a]=v(e);t.postMessage(Object.assign(Object.assign({},o),{id:c}),a),"RELEASE"===d&&(t.removeEventListener("message",s),u(t),n in r&&"function"==typeof r[n]&&r[n]())})).catch((e=>{const[r,n]=v({value:new TypeError("Unserializable return value"),[o]:0});t.postMessage(Object.assign(Object.assign({},r),{id:c}),n)}))})),t.start&&t.start()}function u(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function l(e){if(e)throw new Error("Proxy has been released and is not useable")}function c(e){return g(e,{type:"RELEASE"}).then((()=>{u(e)}))}const d=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const r=(d.get(e)||0)-1;d.set(e,r),0===r&&c(e)}));function f(e,n=[],o=function(){}){let a=!1;const s=new Proxy(o,{get(r,o){if(l(a),o===t)return()=>{!function(e){h&&h.unregister(e)}(s),c(e),a=!0};if("then"===o){if(0===n.length)return{then:()=>s};const r=g(e,{type:"GET",path:n.map((e=>e.toString()))}).then(w);return r.then.bind(r)}return f(e,[...n,o])},set(r,t,o){l(a);const[s,i]=v(o);return g(e,{type:"SET",path:[...n,t].map((e=>e.toString())),value:s},i).then(w)},apply(t,o,s){l(a);const i=n[n.length-1];if(i===r)return g(e,{type:"ENDPOINT"}).then(w);if("bind"===i)return f(e,n.slice(0,-1));const[u,c]=m(s);return g(e,{type:"APPLY",path:n.map((e=>e.toString())),argumentList:u},c).then(w)},construct(r,t){l(a);const[o,s]=m(t);return g(e,{type:"CONSTRUCT",path:n.map((e=>e.toString())),argumentList:o},s).then(w)}});return function(e,r){const t=(d.get(r)||0)+1;d.set(r,t),h&&h.register(e,r,e)}(s,e),s}function m(e){const r=e.map(v);return[r.map((e=>e[0])),(t=r.map((e=>e[1])),Array.prototype.concat.apply([],t))];var t}const p=new WeakMap;function v(e){for(const[r,t]of s)if(t.canHandle(e)){const[n,o]=t.serialize(e);return[{type:"HANDLER",name:r,value:n},o]}return[{type:"RAW",value:e},p.get(e)||[]]}function w(e){switch(e.type){case"HANDLER":return s.get(e.name).deserialize(e.value);case"RAW":return e.value}}function g(e,r,t){return new Promise((n=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function r(t){t.data&&t.data.id&&t.data.id===o&&(e.removeEventListener("message",r),n(t.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},r),t)}))}const _={32768:"FILE",16384:"DIR",40960:"SYMBOLIC_LINK",49152:"SOCKET",8192:"CHARACTER_DEVICE",24576:"BLOCK_DEVICE",4096:"NAMED_PIPE"};class y{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._file=null,this._passphrase=null,this._locale="en_US.UTF-8"}async open(e){null!==this._file&&(console.warn("Closing previous file"),this.close());const r=await this._loadFile(e);this._fileLength=r.length,this._filePtr=r.ptr}close(){this._runCode.closeArchive(this._archive),this._wasmModule._free(this._filePtr),this._file=null,this._filePtr=null,this._archive=null}hasEncryptedData(){this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale),this._runCode.getNextEntry(this._archive);const e=this._runCode.hasEncryptedEntries(this._archive);return 0!==e&&(e>0||null)}setPassphrase(e){this._passphrase=e}setLocale(e){this._locale=e}*entries(e=!1,r=null){let t;for(this._archive=this._runCode.openArchive(this._filePtr,this._fileLength,this._passphrase,this._locale);t=this._runCode.getNextEntry(this._archive),0!==t;){const n={size:this._runCode.getEntrySize(t),path:this._runCode.getEntryName(t),type:_[this._runCode.getEntryType(t)],lastModified:this._runCode.getEntryLastModified(t),ref:t};if("FILE"===n.type){let e=n.path.split("/");n.fileName=e[e.length-1]}if(e&&r!==n.path)this._runCode.skipEntry(this._archive);else{const e=this._runCode.getFileData(this._archive,n.size);if(e<0)throw new Error(this._runCode.getError(this._archive));n.fileData=this._wasmModule.HEAPU8.slice(e,e+n.size),this._wasmModule._free(e)}yield n}}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}}class E{constructor(e){this._wasmModule=e,this._runCode=e.runCode,this._passphrase=null,this._locale="en_US.UTF-8"}async write(e,r,t,n=null){let o=e.reduce(((e,{file:r})=>e+r.size+128),0)+128;const a=this._runCode.malloc(o),s=this._runCode.malloc(this._runCode.sizeOfSizeT()),i=this._runCode.startArchiveWrite(r,t,a,o,s,n);for(const{file:r,pathname:t}of e){const e=await this._loadFile(r);this._runCode.writeArchiveFile(i,t||r.name,e.length,e.ptr),this._runCode.free(e.ptr)}const u=this._runCode.finishArchiveWrite(i,s);if(u<0)throw new Error(this._runCode.getError(i));return this._wasmModule.HEAPU8.slice(a,a+u)}async _loadFile(e){const r=await e.arrayBuffer(),t=new Uint8Array(r),n=this._runCode.malloc(t.length);return this._wasmModule.HEAPU8.set(t,n),{ptr:n,length:t.length}}}var b,k=(b=import.meta.url,async function(e={}){var r,t,n=e;n.ready=new Promise(((e,n)=>{r=e,t=n}));var o,a,s,i=Object.assign({},n),u="./this.program",l=(e,r)=>{throw r},c="object"==typeof window,d="function"==typeof importScripts,h="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,f="";if(h){const{createRequire:e}=await import("module");var m=e(import.meta.url),p=m("fs"),v=m("path");f=d?v.dirname(f)+"/":m("url").fileURLToPath(new URL("./",import.meta.url)),o=(e,r)=>(e=Y(e)?new URL(e):v.normalize(e),p.readFileSync(e,r?void 0:"utf8")),s=e=>{var r=o(e,!0);return r.buffer||(r=new Uint8Array(r)),r},a=(e,r,t,n=!0)=>{e=Y(e)?new URL(e):v.normalize(e),p.readFile(e,n?void 0:"utf8",((e,o)=>{e?t(e):r(n?o.buffer:o)}))},!n.thisProgram&&process.argv.length>1&&(u=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),l=(e,r)=>{throw process.exitCode=e,r},n.inspect=()=>"[Emscripten Module object]"}else(c||d)&&(d?f=self.location.href:"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),b&&(f=b),f=0!==f.indexOf("blob:")?f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},d&&(s=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),a=(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 w,g,_=n.print||console.log.bind(console),y=n.printErr||console.error.bind(console);Object.assign(n,i),i=null,n.arguments&&n.arguments,n.thisProgram&&(u=n.thisProgram),n.quit&&(l=n.quit),n.wasmBinary&&(w=n.wasmBinary),"object"!=typeof WebAssembly&&O("no native wasm support detected");var E,k,S,F,D,M=!1;function A(e,r){e||O(r)}function C(){var e=g.buffer;n.HEAP8=E=new Int8Array(e),n.HEAP16=S=new Int16Array(e),n.HEAPU8=k=new Uint8Array(e),n.HEAPU16=new Uint16Array(e),n.HEAP32=F=new Int32Array(e),n.HEAPU32=D=new Uint32Array(e),n.HEAPF32=new Float32Array(e),n.HEAPF64=new Float64Array(e)}var P=[],T=[],R=[],z=0,U=null;function L(e){z++,n.monitorRunDependencies?.(z)}function x(e){if(z--,n.monitorRunDependencies?.(z),0==z&&U){var r=U;U=null,r()}}function O(e){n.onAbort?.(e),y(e="Aborted("+e+")"),M=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw t(r),r}var N,B,j,I,H=e=>e.startsWith("data:application/octet-stream;base64,"),Y=e=>e.startsWith("file://");function W(e){if(e==N&&w)return new Uint8Array(w);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}function K(e,r,t){return function(e){if(!w&&(c||d)){if("function"==typeof fetch&&!Y(e))return fetch(e,{credentials:"same-origin"}).then((r=>{if(!r.ok)throw"failed to load wasm binary file at '"+e+"'";return r.arrayBuffer()})).catch((()=>W(e)));if(a)return new Promise(((r,t)=>{a(e,(e=>r(new Uint8Array(e))),t)}))}return Promise.resolve().then((()=>W(e)))}(e).then((e=>WebAssembly.instantiate(e,r))).then((e=>e)).then(t,(e=>{y(`failed to asynchronously prepare wasm: ${e}`),O(e)}))}function q(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}n.locateFile?H(N="libarchive.wasm")||(B=N,N=n.locateFile?n.locateFile(B,f):f+B):N=new URL("libarchive.wasm",import.meta.url).href;var $=e=>{for(;e.length>0;)e.shift()(n)},X=n.noExitRuntime||!0,Z={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=Z.isAbs(e),t="/"===e.substr(-1);return(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=Z.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=Z.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===r?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments);return Z.normalize(e.join("/"))},join2:(e,r)=>Z.normalize(e+"/"+r)},G=e=>(G=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(h)try{var e=m("crypto");if(e.randomFillSync)return r=>e.randomFillSync(r);var r=e.randomBytes;return e=>(e.set(r(e.byteLength)),e)}catch(e){}O("initRandomDevice")})())(e),V={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:le.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=Z.isAbs(n)}return(r?"/":"")+(e=Z.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"))||"."},relative:(e,r)=>{function t(e){for(var r=0;r=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=V.resolve(e).substr(1),r=V.resolve(r).substr(1);for(var n=t(e.split("/")),o=t(r.split("/")),a=Math.min(n.length,o.length),s=a,i=0;i{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&J)return J.decode(e.subarray(r,o));for(var a="";r>10,56320|1023&l)}}else a+=String.fromCharCode((31&s)<<6|i)}else a+=String.fromCharCode(s)}return a},ee=[],re=e=>{for(var r=0,t=0;t=55296&&n<=57343?(r+=4,++t):r+=3}return r},te=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,s=0;s=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++s)),i<=127){if(t>=a)break;r[t++]=i}else if(i<=2047){if(t+1>=a)break;r[t++]=192|i>>6,r[t++]=128|63&i}else if(i<=65535){if(t+2>=a)break;r[t++]=224|i>>12,r[t++]=128|i>>6&63,r[t++]=128|63&i}else{if(t+3>=a)break;r[t++]=240|i>>18,r[t++]=128|i>>12&63,r[t++]=128|i>>6&63,r[t++]=128|63&i}}return r[t]=0,t-o};function ne(e,r,t){var n=t>0?t:re(e)+1,o=new Array(n),a=te(e,o,0,o.length);return r&&(o.length=a),o}var oe={ttys:[],init(){},shutdown(){},register(e,r){oe.ttys[e]={input:[],output:[],ops:r},le.registerDevice(e,oe.stream_ops)},stream_ops:{open(e){var r=oe.ttys[e.node.rdev];if(!r)throw new le.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new le.ErrnoError(60);for(var a=0,s=0;s(()=>{if(!ee.length){var e=null;if(h){var r=Buffer.alloc(256),t=0,n=process.stdin.fd;try{t=p.readSync(n,r)}catch(e){if(!e.toString().includes("EOF"))throw e;t=0}e=t>0?r.slice(0,t).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n");if(!e)return null;ee=ne(e,!0)}return ee.shift()})(),put_char(e,r){null===r||10===r?(_(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(_(Q(e.output,0)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,r,t)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,r){null===r||10===r?(y(Q(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(y(Q(e.output,0)),e.output=[])}}},ae=e=>{O()},se={ops_table:null,mount:e=>se.createNode(null,"/",16895,0),createNode(e,r,t,n){if(le.isBlkdev(t)||le.isFIFO(t))throw new le.ErrnoError(63);se.ops_table||={dir:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr,lookup:se.node_ops.lookup,mknod:se.node_ops.mknod,rename:se.node_ops.rename,unlink:se.node_ops.unlink,rmdir:se.node_ops.rmdir,readdir:se.node_ops.readdir,symlink:se.node_ops.symlink},stream:{llseek:se.stream_ops.llseek}},file:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr},stream:{llseek:se.stream_ops.llseek,read:se.stream_ops.read,write:se.stream_ops.write,allocate:se.stream_ops.allocate,mmap:se.stream_ops.mmap,msync:se.stream_ops.msync}},link:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr,readlink:se.node_ops.readlink},stream:{}},chrdev:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr},stream:le.chrdev_stream_ops}};var o=le.createNode(e,r,t,n);return le.isDir(o.mode)?(o.node_ops=se.ops_table.dir.node,o.stream_ops=se.ops_table.dir.stream,o.contents={}):le.isFile(o.mode)?(o.node_ops=se.ops_table.file.node,o.stream_ops=se.ops_table.file.stream,o.usedBytes=0,o.contents=null):le.isLink(o.mode)?(o.node_ops=se.ops_table.link.node,o.stream_ops=se.ops_table.link.stream):le.isChrdev(o.mode)&&(o.node_ops=se.ops_table.chrdev.node,o.stream_ops=se.ops_table.chrdev.stream),o.timestamp=Date.now(),e&&(e.contents[r]=o,e.timestamp=o.timestamp),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){r=Math.max(r,t*(t<1048576?2:1.125)>>>0),0!=t&&(r=Math.max(r,256));var n=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(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(e){var r={};return r.dev=le.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,le.isDir(e.mode)?r.size=4096:le.isFile(e.mode)?r.size=e.usedBytes:le.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(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp),void 0!==r.size&&se.resizeFileStorage(e,r.size)},lookup(e,r){throw le.genericErrors[44]},mknod:(e,r,t,n)=>se.createNode(e,r,t,n),rename(e,r,t){if(le.isDir(e.mode)){var n;try{n=le.lookupNode(r,t)}catch(e){}if(n)for(var o in n.contents)throw new le.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(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=le.lookupNode(e,r);for(var n in t.contents)throw new le.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){var n=se.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!le.isLink(e.mode))throw new le.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var a=e.node.contents;if(o>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-o,n);if(s>8&&a.subarray)r.set(a.subarray(o,o+s),t);else for(var i=0;i0||t+r(se.stream_ops.write(e,r,0,n,t,!1),0)}},ie=n.preloadPlugins||[],ue=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},le={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=V.resolve(e)))return{path:"",node:null};if((r=Object.assign({follow_mount:!0,recurse_count:0},r)).recurse_count>8)throw new le.ErrnoError(32);for(var t=e.split("/").filter((e=>!!e)),n=le.root,o="/",a=0;a40)throw new le.ErrnoError(32)}}return{path:o,node:n}},getPath(e){for(var r;;){if(le.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>>0)%le.nameTable.length},hashAddNode(e){var r=le.hashName(e.parent.id,e.name);e.name_next=le.nameTable[r],le.nameTable[r]=e},hashRemoveNode(e){var r=le.hashName(e.parent.id,e.name);if(le.nameTable[r]===e)le.nameTable[r]=e.name_next;else for(var t=le.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=le.mayLookup(e);if(t)throw new le.ErrnoError(t,e);for(var n=le.hashName(e.id,r),o=le.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===r)return o}return le.lookup(e,r)},createNode(e,r,t,n){var o=new le.FSNode(e,r,t,n);return le.hashAddNode(o),o},destroyNode(e){le.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),flagsToPermissionString(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>le.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=le.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){try{return le.lookupNode(e,r),20}catch(e){}return le.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=le.lookupNode(e,r)}catch(e){return e.errno}var o=le.nodePermissions(e,"wx");if(o)return o;if(t){if(!le.isDir(n.mode))return 54;if(le.isRoot(n)||le.getPath(n)===le.cwd())return 10}else if(le.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?le.isLink(e.mode)?32:le.isDir(e.mode)&&("r"!==le.flagsToPermissionString(r)||512&r)?31:le.nodePermissions(e,le.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=le.MAX_OPEN_FDS;e++)if(!le.streams[e])return e;throw new le.ErrnoError(33)},getStreamChecked(e){var r=le.getStream(e);if(!r)throw new le.ErrnoError(8);return r},getStream:e=>le.streams[e],createStream:(e,r=-1)=>(le.FSStream||(le.FSStream=function(){this.shared={}},le.FSStream.prototype={},Object.defineProperties(le.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new le.FSStream,e),-1==r&&(r=le.nextfd()),e.fd=r,le.streams[r]=e,e),closeStream(e){le.streams[e]=null},chrdev_stream_ops:{open(e){var r=le.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new le.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice(e,r){le.devices[e]={stream_ops:r}},getDevice:e=>le.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),le.syncFSRequests++,le.syncFSRequests>1&&y(`warning: ${le.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=le.getMounts(le.root.mount),n=0;function o(e){return le.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&&le.root)throw new le.ErrnoError(10);if(!o&&!a){var s=le.lookupPath(t,{follow_mount:!1});if(t=s.path,n=s.node,le.isMountpoint(n))throw new le.ErrnoError(10);if(!le.isDir(n.mode))throw new le.ErrnoError(54)}var i={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(i);return u.mount=i,i.root=u,o?le.root=u:n&&(n.mounted=i,n.mount&&n.mount.mounts.push(i)),u},unmount(e){var r=le.lookupPath(e,{follow_mount:!1});if(!le.isMountpoint(r.node))throw new le.ErrnoError(28);var t=r.node,n=t.mounted,o=le.getMounts(n);Object.keys(le.nameTable).forEach((e=>{for(var r=le.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&le.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=le.lookupPath(e,{parent:!0}).node,o=Z.basename(e);if(!o||"."===o||".."===o)throw new le.ErrnoError(28);var a=le.mayCreate(n,o);if(a)throw new le.ErrnoError(a);if(!n.node_ops.mknod)throw new le.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},create:(e,r)=>(r=void 0!==r?r:438,r&=4095,r|=32768,le.mknod(e,r,0)),mkdir:(e,r)=>(r=void 0!==r?r:511,r&=1023,r|=16384,le.mknod(e,r,0)),mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o(void 0===t&&(t=r,r=438),r|=8192,le.mknod(e,r,t)),symlink(e,r){if(!V.resolve(e))throw new le.ErrnoError(44);var t=le.lookupPath(r,{parent:!0}).node;if(!t)throw new le.ErrnoError(44);var n=Z.basename(r),o=le.mayCreate(t,n);if(o)throw new le.ErrnoError(o);if(!t.node_ops.symlink)throw new le.ErrnoError(63);return t.node_ops.symlink(t,n,e)},rename(e,r){var t,n,o=Z.dirname(e),a=Z.dirname(r),s=Z.basename(e),i=Z.basename(r);if(t=le.lookupPath(e,{parent:!0}).node,n=le.lookupPath(r,{parent:!0}).node,!t||!n)throw new le.ErrnoError(44);if(t.mount!==n.mount)throw new le.ErrnoError(75);var u,l=le.lookupNode(t,s),c=V.relative(e,a);if("."!==c.charAt(0))throw new le.ErrnoError(28);if("."!==(c=V.relative(r,o)).charAt(0))throw new le.ErrnoError(55);try{u=le.lookupNode(n,i)}catch(e){}if(l!==u){var d=le.isDir(l.mode),h=le.mayDelete(t,s,d);if(h)throw new le.ErrnoError(h);if(h=u?le.mayDelete(n,i,d):le.mayCreate(n,i))throw new le.ErrnoError(h);if(!t.node_ops.rename)throw new le.ErrnoError(63);if(le.isMountpoint(l)||u&&le.isMountpoint(u))throw new le.ErrnoError(10);if(n!==t&&(h=le.nodePermissions(t,"w")))throw new le.ErrnoError(h);le.hashRemoveNode(l);try{t.node_ops.rename(l,n,i)}catch(e){throw e}finally{le.hashAddNode(l)}}},rmdir(e){var r=le.lookupPath(e,{parent:!0}).node,t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!0);if(o)throw new le.ErrnoError(o);if(!r.node_ops.rmdir)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.rmdir(r,t),le.destroyNode(n)},readdir(e){var r=le.lookupPath(e,{follow:!0}).node;if(!r.node_ops.readdir)throw new le.ErrnoError(54);return r.node_ops.readdir(r)},unlink(e){var r=le.lookupPath(e,{parent:!0}).node;if(!r)throw new le.ErrnoError(44);var t=Z.basename(e),n=le.lookupNode(r,t),o=le.mayDelete(r,t,!1);if(o)throw new le.ErrnoError(o);if(!r.node_ops.unlink)throw new le.ErrnoError(63);if(le.isMountpoint(n))throw new le.ErrnoError(10);r.node_ops.unlink(r,t),le.destroyNode(n)},readlink(e){var r=le.lookupPath(e).node;if(!r)throw new le.ErrnoError(44);if(!r.node_ops.readlink)throw new le.ErrnoError(28);return V.resolve(le.getPath(r.parent),r.node_ops.readlink(r))},stat(e,r){var t=le.lookupPath(e,{follow:!r}).node;if(!t)throw new le.ErrnoError(44);if(!t.node_ops.getattr)throw new le.ErrnoError(63);return t.node_ops.getattr(t)},lstat:e=>le.stat(e,!0),chmod(e,r,t){var n;if(!(n="string"==typeof e?le.lookupPath(e,{follow:!t}).node:e).node_ops.setattr)throw new le.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&r|-4096&n.mode,timestamp:Date.now()})},lchmod(e,r){le.chmod(e,r,!0)},fchmod(e,r){var t=le.getStreamChecked(e);le.chmod(t.node,r)},chown(e,r,t,n){var o;if(!(o="string"==typeof e?le.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new le.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){le.chown(e,r,t,!0)},fchown(e,r,t){var n=le.getStreamChecked(e);le.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new le.ErrnoError(28);var t;if(!(t="string"==typeof e?le.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new le.ErrnoError(63);if(le.isDir(t.mode))throw new le.ErrnoError(31);if(!le.isFile(t.mode))throw new le.ErrnoError(28);var n=le.nodePermissions(t,"w");if(n)throw new le.ErrnoError(n);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=le.getStreamChecked(e);if(0==(2097155&t.flags))throw new le.ErrnoError(28);le.truncate(t.node,r)},utime(e,r,t){var n=le.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(r,t)})},open(e,r,t){if(""===e)throw new le.ErrnoError(44);var o;if(t=void 0===t?438:t,t=64&(r="string"==typeof r?(e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===r)throw new Error(`Unknown file open mode: ${e}`);return r})(r):r)?4095&t|32768:0,"object"==typeof e)o=e;else{e=Z.normalize(e);try{o=le.lookupPath(e,{follow:!(131072&r)}).node}catch(e){}}var a=!1;if(64&r)if(o){if(128&r)throw new le.ErrnoError(20)}else o=le.mknod(e,t,0),a=!0;if(!o)throw new le.ErrnoError(44);if(le.isChrdev(o.mode)&&(r&=-513),65536&r&&!le.isDir(o.mode))throw new le.ErrnoError(54);if(!a){var s=le.mayOpen(o,r);if(s)throw new le.ErrnoError(s)}512&r&&!a&&le.truncate(o,0),r&=-131713;var i=le.createStream({node:o,path:le.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return i.stream_ops.open&&i.stream_ops.open(i),!n.logReadFiles||1&r||(le.readFiles||(le.readFiles={}),e in le.readFiles||(le.readFiles[e]=1)),i},close(e){if(le.isClosed(e))throw new le.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{le.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new le.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new le.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 le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(1==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.read)throw new le.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new le.ErrnoError(70)}else o=e.position;var s=e.stream_ops.read(e,r,t,n,o);return a||(e.position+=s),s},write(e,r,t,n,o,a){if(n<0||o<0)throw new le.ErrnoError(28);if(le.isClosed(e))throw new le.ErrnoError(8);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(le.isDir(e.node.mode))throw new le.ErrnoError(31);if(!e.stream_ops.write)throw new le.ErrnoError(28);e.seekable&&1024&e.flags&&le.llseek(e,0,2);var s=void 0!==o;if(s){if(!e.seekable)throw new le.ErrnoError(70)}else o=e.position;var i=e.stream_ops.write(e,r,t,n,o,a);return s||(e.position+=i),i},allocate(e,r,t){if(le.isClosed(e))throw new le.ErrnoError(8);if(r<0||t<=0)throw new le.ErrnoError(28);if(0==(2097155&e.flags))throw new le.ErrnoError(8);if(!le.isFile(e.node.mode)&&!le.isDir(e.node.mode))throw new le.ErrnoError(43);if(!e.stream_ops.allocate)throw new le.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 le.ErrnoError(2);if(1==(2097155&e.flags))throw new le.ErrnoError(2);if(!e.stream_ops.mmap)throw new le.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,o)},msync:(e,r,t,n,o)=>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 le.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=le.open(e,r.flags),o=le.stat(e).size,a=new Uint8Array(o);return le.read(n,a,0,o,0),"utf8"===r.encoding?t=Q(a,0):"binary"===r.encoding&&(t=a),le.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=le.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(re(r)+1),a=te(r,o,0,o.length);le.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(r))throw new Error("Unsupported data type");le.write(n,r,0,r.byteLength,void 0,t.canOwn)}le.close(n)},cwd:()=>le.currentPath,chdir(e){var r=le.lookupPath(e,{follow:!0});if(null===r.node)throw new le.ErrnoError(44);if(!le.isDir(r.node.mode))throw new le.ErrnoError(54);var t=le.nodePermissions(r.node,"x");if(t)throw new le.ErrnoError(t);le.currentPath=r.path},createDefaultDirectories(){le.mkdir("/tmp"),le.mkdir("/home"),le.mkdir("/home/web_user")},createDefaultDevices(){le.mkdir("/dev"),le.registerDevice(le.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n}),le.mkdev("/dev/null",le.makedev(1,3)),oe.register(le.makedev(5,0),oe.default_tty_ops),oe.register(le.makedev(6,0),oe.default_tty1_ops),le.mkdev("/dev/tty",le.makedev(5,0)),le.mkdev("/dev/tty1",le.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(0===r&&(r=G(e).byteLength),e[--r]);le.createDevice("/dev","random",t),le.createDevice("/dev","urandom",t),le.mkdir("/dev/shm"),le.mkdir("/dev/shm/tmp")},createSpecialDirectories(){le.mkdir("/proc");var e=le.mkdir("/proc/self");le.mkdir("/proc/self/fd"),le.mount({mount(){var r=le.createNode(e,"fd",16895,73);return r.node_ops={lookup(e,r){var t=+r,n=le.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},r}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?le.createDevice("/dev","stdin",n.stdin):le.symlink("/dev/tty","/dev/stdin"),n.stdout?le.createDevice("/dev","stdout",null,n.stdout):le.symlink("/dev/tty","/dev/stdout"),n.stderr?le.createDevice("/dev","stderr",null,n.stderr):le.symlink("/dev/tty1","/dev/stderr"),le.open("/dev/stdin",0),le.open("/dev/stdout",1),le.open("/dev/stderr",1)},ensureErrnoError(){le.ErrnoError||(le.ErrnoError=function(e,r){this.name="ErrnoError",this.node=r,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},le.ErrnoError.prototype=new Error,le.ErrnoError.prototype.constructor=le.ErrnoError,[44].forEach((e=>{le.genericErrors[e]=new le.ErrnoError(e),le.genericErrors[e].stack=""})))},staticInit(){le.ensureErrnoError(),le.nameTable=new Array(4096),le.mount(se,{},"/"),le.createDefaultDirectories(),le.createDefaultDevices(),le.createSpecialDirectories(),le.filesystems={MEMFS:se}},init(e,r,t){le.init.initialized=!0,le.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=r||n.stdout,n.stderr=t||n.stderr,le.createStandardStreams()},quit(){le.init.initialized=!1;for(var e=0;ethis.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,s=1048576;o||(s=n);var i=this;i.setDataGetter((e=>{var r=e*s,o=(e+1)*s-1;if(o=Math.min(o,n-1),void 0===i.chunks[e]&&(i.chunks[e]=((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!==s&&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||[]):ne(o.responseText||"",!0)})(r,o)),void 0===i.chunks[e])throw new Error("doXHR failed!");return i.chunks[e]})),!a&&n||(s=n=1,n=this.getter(0).length,s=n,_("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=s,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!d)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new a;Object.defineProperties(s,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var i={isDevice:!1,contents:s}}else i={isDevice:!1,url:t};var u=le.createFile(e,r,i,n,o);i.contents?u.contents=i.contents:i.url&&(u.contents=null,u.url=i.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,r,t,n,o){var a=e.node.contents;if(o>=a.length)return 0;var s=Math.min(a.length-o,n);if(a.slice)for(var i=0;i{var r=u.stream_ops[e];l[e]=function(){return le.forceLoadFile(u),r.apply(null,arguments)}})),l.read=(e,r,t,n,o)=>(le.forceLoadFile(u),c(e,r,t,n,o)),l.mmap=(e,r,t,n,o)=>{le.forceLoadFile(u);var a=ae();if(!a)throw new le.ErrnoError(48);return c(e,E,a,r,t),{ptr:a,allocated:!0}},u.stream_ops=l,u}},ce=(e,r)=>e?Q(k,e,r):"",de={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(Z.isAbs(r))return r;var n;if(n=-100===e?le.cwd():de.getStreamFromFD(e).path,0==r.length){if(!t)throw new le.ErrnoError(44);return n}return Z.join2(n,r)},doStat(e,r,t){try{var n=e(r)}catch(e){if(e&&e.node&&Z.normalize(r)!==Z.normalize(le.getPath(e.node)))return-54;throw e}F[t>>2]=n.dev,F[t+4>>2]=n.mode,D[t+8>>2]=n.nlink,F[t+12>>2]=n.uid,F[t+16>>2]=n.gid,F[t+20>>2]=n.rdev,I=[n.size>>>0,(j=n.size,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+24>>2]=I[0],F[t+28>>2]=I[1],F[t+32>>2]=4096,F[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),s=n.ctime.getTime();return I=[Math.floor(o/1e3)>>>0,(j=Math.floor(o/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+40>>2]=I[0],F[t+44>>2]=I[1],D[t+48>>2]=o%1e3*1e3,I=[Math.floor(a/1e3)>>>0,(j=Math.floor(a/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+56>>2]=I[0],F[t+60>>2]=I[1],D[t+64>>2]=a%1e3*1e3,I=[Math.floor(s/1e3)>>>0,(j=Math.floor(s/1e3),+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+72>>2]=I[0],F[t+76>>2]=I[1],D[t+80>>2]=s%1e3*1e3,I=[n.ino>>>0,(j=n.ino,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[t+88>>2]=I[0],F[t+92>>2]=I[1],0},doMsync(e,r,t,n,o){if(!le.isFile(r.node.mode))throw new le.ErrnoError(43);if(2&n)return 0;var a=k.slice(e,e+t);le.msync(r,a,o,t,n)},varargs:void 0,get(){var e=F[+de.varargs>>2];return de.varargs+=4,e},getp:()=>de.get(),getStr:e=>ce(e),getStreamFromFD:e=>le.getStreamChecked(e)},he=e=>(F[Oe()>>2]=e,e),fe={BUCKET_BUFFER_SIZE:8192,mount:e=>le.createNode(null,"/",16895,0),createPipe(){var e={buckets:[],refcnt:2};e.buckets.push({buffer:new Uint8Array(fe.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var r=fe.nextname(),t=fe.nextname(),n=le.createNode(fe.root,r,4096,0),o=le.createNode(fe.root,t,4096,0);n.pipe=e,o.pipe=e;var a=le.createStream({path:r,node:n,flags:0,seekable:!1,stream_ops:fe.stream_ops});n.stream=a;var s=le.createStream({path:t,node:o,flags:1,seekable:!1,stream_ops:fe.stream_ops});return o.stream=s,{readable_fd:a.fd,writable_fd:s.fd}},stream_ops:{poll(e){var r=e.node.pipe;if(1==(2097155&e.flags))return 260;if(r.buckets.length>0)for(var t=0;t0)return 65}return 0},ioctl:(e,r,t)=>28,fsync:e=>28,read(e,r,t,n,o){for(var a=e.node.pipe,s=0,i=0;i=i)return u.buffer.set(s,u.offset),u.offset+=i,i;l>0&&(u.buffer.set(s.subarray(0,l),u.offset),u.offset+=l,s=s.subarray(l,s.byteLength));for(var c=s.byteLength/fe.BUCKET_BUFFER_SIZE|0,d=s.byteLength%fe.BUCKET_BUFFER_SIZE,h=0;h0&&(f={buffer:new Uint8Array(fe.BUCKET_BUFFER_SIZE),offset:s.byteLength,roffset:0},a.buckets.push(f),f.buffer.set(s)),i},close(e){var r=e.node.pipe;r.refcnt--,0===r.refcnt&&(r.buckets=null)}},nextname:()=>(fe.nextname.current||(fe.nextname.current=0),"pipe["+fe.nextname.current+++"]")},me=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*r:NaN,pe=e=>e%4==0&&(e%100!=0||e%400==0),ve=[0,31,60,91,121,152,182,213,244,274,305,335],we=[0,31,59,90,120,151,181,212,243,273,304,334],ge=e=>(pe(e.getFullYear())?ve:we)[e.getMonth()]+e.getDate()-1,_e=(e,r,t)=>te(e,k,r,t),ye=e=>{var r=re(e)+1,t=xe(r);return t&&_e(e,t,r),t},Ee=e=>{var r=(e-g.buffer.byteLength+65535)/65536;try{return g.grow(r),C(),1}catch(e){}},be={},ke=()=>{if(!ke.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var r in be)void 0===be[r]?delete e[r]:e[r]=be[r];var t=[];for(var r in e)t.push(`${r}=${e[r]}`);ke.strings=t}return ke.strings},Se=e=>{X||(n.onExit?.(e),M=!0),l(e,new q(e))},Fe=(e,r)=>{Se(e)},De=[31,29,31,30,31,30,31,31,30,31,30,31],Me=[31,28,31,30,31,30,31,31,30,31,30,31],Ae=(e,r)=>{E.set(e,r)},Ce=e=>n["_"+e],Pe=(e,r,t,n,o)=>{var a={string:e=>{var r=0;return null!=e&&0!==e&&(r=(e=>{var r=re(e)+1,t=He(r);return _e(e,t,r),t})(e)),r},array:e=>{var r=He(e.length);return Ae(e,r),r}},s=Ce(e),i=[],u=0;if(n)for(var l=0;l{var d=r?V.resolve(Z.join2(e,r)):e;function h(t){function a(t){c?.(),u||((e,r,t,n,o,a)=>{le.createDataFile(e,r,t,n,o,a)})(e,r,t,n,o,l),s?.(),x()}((e,r,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return ie.forEach((a=>{o||a.canHandle(r)&&(a.handle(e,r,t,n),o=!0)})),o})(t,d,a,(()=>{i?.(),x()}))||a(t)}L(),"string"==typeof t?((e,r,t,n)=>{var o=n?"":`al ${e}`;a(e,(t=>{A(t,`Loading data file "${e}" failed (no arrayBuffer).`),r(new Uint8Array(t)),o&&x()}),(r=>{if(!t)throw`Loading data file "${e}" failed.`;t()})),o&&L()})(t,(e=>h(e)),i):h(t)},le.staticInit();var Ue={i:function(e){try{var r=de.getStreamFromFD(e);return le.createStream(r).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},a:function(e,r,t){de.varargs=t;try{var n=de.getStreamFromFD(e);switch(r){case 0:if((o=de.get())<0)return-28;for(;le.streams[o];)o++;return le.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=de.get();return n.flags|=o,0;case 5:return o=de.getp(),S[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return he(28),-1}}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},x:function(e,r){try{var t=de.getStreamFromFD(e);return de.doStat(le.stat,t.path,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},u:function(e,r){try{return e=de.getStr(e),de.doStat(le.lstat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},v:function(e,r,t,n){try{r=de.getStr(r);var o=256&n,a=4096&n;return n&=-6401,r=de.calculateAt(e,r,a),de.doStat(o?le.lstat:le.stat,r,t)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},y:function(e,r,t,n){de.varargs=n;try{r=de.getStr(r),r=de.calculateAt(e,r);var o=n?de.get():0;return le.open(r,t,o).fd}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},t:function(e){try{if(0==e)throw new le.ErrnoError(21);var r=fe.createPipe();return F[e>>2]=r.readable_fd,F[e+4>>2]=r.writable_fd,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},s:function(e,r,t){try{for(var n=0,o=0;o>2],i=S[a+4>>1],u=32,l=le.getStream(s);l&&(u=de.DEFAULT_POLLMASK,l.stream_ops.poll&&(u=l.stream_ops.poll(l,-1))),(u&=24|i)&&n++,S[a+6>>1]=u}return n}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},w:function(e,r){try{return e=de.getStr(e),de.doStat(le.stat,e,r)}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},q:function(e,r,t){try{return r=de.getStr(r),r=de.calculateAt(e,r),0===t?le.unlink(r):512===t?le.rmdir(r):O("Invalid flags passed to unlinkat"),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return-e.errno}},B:()=>1,k:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);F[t>>2]=o.getUTCSeconds(),F[t+4>>2]=o.getUTCMinutes(),F[t+8>>2]=o.getUTCHours(),F[t+12>>2]=o.getUTCDate(),F[t+16>>2]=o.getUTCMonth(),F[t+20>>2]=o.getUTCFullYear()-1900,F[t+24>>2]=o.getUTCDay();var a=Date.UTC(o.getUTCFullYear(),0,1,0,0,0,0),s=(o.getTime()-a)/864e5|0;F[t+28>>2]=s},l:function(e,r,t){var n=me(e,r),o=new Date(1e3*n);F[t>>2]=o.getSeconds(),F[t+4>>2]=o.getMinutes(),F[t+8>>2]=o.getHours(),F[t+12>>2]=o.getDate(),F[t+16>>2]=o.getMonth(),F[t+20>>2]=o.getFullYear()-1900,F[t+24>>2]=o.getDay();var a=0|ge(o);F[t+28>>2]=a,F[t+36>>2]=-60*o.getTimezoneOffset();var s=new Date(o.getFullYear(),0,1),i=new Date(o.getFullYear(),6,1).getTimezoneOffset(),u=s.getTimezoneOffset(),l=0|(i!=u&&o.getTimezoneOffset()==Math.min(u,i));F[t+32>>2]=l},m:function(e){var r=(()=>{var r=new Date(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),t=F[e+32>>2],n=r.getTimezoneOffset(),o=new Date(r.getFullYear(),0,1),a=new Date(r.getFullYear(),6,1).getTimezoneOffset(),s=o.getTimezoneOffset(),i=Math.min(s,a);if(t<0)F[e+32>>2]=Number(a!=s&&i==n);else if(t>0!=(i==n)){var u=Math.max(s,a),l=t>0?i:u;r.setTime(r.getTime()+6e4*(l-n))}F[e+24>>2]=r.getDay();var c=0|ge(r);F[e+28>>2]=c,F[e>>2]=r.getSeconds(),F[e+4>>2]=r.getMinutes(),F[e+8>>2]=r.getHours(),F[e+12>>2]=r.getDate(),F[e+16>>2]=r.getMonth(),F[e+20>>2]=r.getYear();var d=r.getTime();return isNaN(d)?(he(61),-1):d/1e3})();return Be((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},n:function(e){var r=(()=>{var r=Date.UTC(F[e+20>>2]+1900,F[e+16>>2],F[e+12>>2],F[e+8>>2],F[e+4>>2],F[e>>2],0),t=new Date(r);F[e+24>>2]=t.getUTCDay();var n=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),o=(t.getTime()-n)/864e5|0;return F[e+28>>2]=o,t.getTime()/1e3})();return Be((j=r,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)),r>>>0},r:(e,r,t)=>{var n=(new Date).getFullYear(),o=new Date(n,0,1),a=new Date(n,6,1),s=o.getTimezoneOffset(),i=a.getTimezoneOffset(),u=Math.max(s,i);function l(e){var r=e.toTimeString().match(/\(([A-Za-z ]+)\)$/);return r?r[1]:"GMT"}D[e>>2]=60*u,F[r>>2]=Number(s!=i);var c=l(o),d=l(a),h=ye(c),f=ye(d);i>2]=h,D[t+4>>2]=f):(D[t>>2]=f,D[t+4>>2]=h)},b:()=>{O("")},c:()=>Date.now(),h:(e,r,t)=>k.copyWithin(e,r,r+t),p:e=>{var r=k.length,t=2147483648;if((e>>>=0)>t)return!1;for(var n,o,a=1;a<=4;a*=2){var s=r*(1+.2/a);s=Math.min(s,e+100663296);var i=Math.min(t,(n=Math.max(e,s))+((o=65536)-n%o)%o);if(Ee(i))return!0}return!1},z:(e,r)=>{var t=0;return ke().forEach(((n,o)=>{var a=r+t;D[e+4*o>>2]=a,((e,r)=>{for(var t=0;t>0]=e.charCodeAt(t);E[r>>0]=0})(n,a),t+=n.length+1})),0},A:(e,r)=>{var t=ke();D[e>>2]=t.length;var n=0;return t.forEach((e=>n+=e.length+1)),D[r>>2]=n,0},g:Fe,e:function(e){try{var r=de.getStreamFromFD(e);return le.close(r),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},j:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],i=D[r+4>>2];r+=8;var u=le.read(e,E,s,i,n);if(u<0)return-1;if(o+=u,u>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},o:function(e,r,t,n,o){var a=me(r,t);try{if(isNaN(a))return 61;var s=de.getStreamFromFD(e);return le.llseek(s,a,n),I=[s.position>>>0,(j=s.position,+Math.abs(j)>=1?j>0?+Math.floor(j/4294967296)>>>0:~~+Math.ceil((j-+(~~j>>>0))/4294967296)>>>0:0)],F[o>>2]=I[0],F[o+4>>2]=I[1],s.getdents&&0===a&&0===n&&(s.getdents=null),0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},d:function(e,r,t,n){try{var o=((e,r,t,n)=>{for(var o=0,a=0;a>2],i=D[r+4>>2];r+=8;var u=le.write(e,E,s,i,n);if(u<0)return-1;o+=u,void 0!==n&&(n+=u)}return o})(de.getStreamFromFD(e),r,t);return D[n>>2]=o,0}catch(e){if(void 0===le||"ErrnoError"!==e.name)throw e;return e.errno}},f:(e,r,t,n)=>{var o=D[n+40>>2],a={tm_sec:F[n>>2],tm_min:F[n+4>>2],tm_hour:F[n+8>>2],tm_mday:F[n+12>>2],tm_mon:F[n+16>>2],tm_year:F[n+20>>2],tm_wday:F[n+24>>2],tm_yday:F[n+28>>2],tm_isdst:F[n+32>>2],tm_gmtoff:F[n+36>>2],tm_zone:o?ce(o):""},s=ce(t),i={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var u in i)s=s.replace(new RegExp(u,"g"),i[u]);var l=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,r,t){for(var n="number"==typeof e?e.toString():e||"";n.length0?1:0}var n;return 0===(n=t(e.getFullYear()-r.getFullYear()))&&0===(n=t(e.getMonth()-r.getMonth()))&&(n=t(e.getDate()-r.getDate())),n}function m(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function p(e){var r=((e,r)=>{for(var t=new Date(e.getTime());r>0;){var n=pe(t.getFullYear()),o=t.getMonth(),a=(n?De:Me)[o];if(!(r>a-t.getDate()))return t.setDate(t.getDate()+r),t;r-=a-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return t})(new Date(e.tm_year+1900,0,1),e.tm_yday),t=new Date(r.getFullYear(),0,4),n=new Date(r.getFullYear()+1,0,4),o=m(t),a=m(n);return f(o,r)<=0?f(a,r)<=0?r.getFullYear()+1:r.getFullYear():r.getFullYear()-1}var v={"%a":e=>l[e.tm_wday].substring(0,3),"%A":e=>l[e.tm_wday],"%b":e=>c[e.tm_mon].substring(0,3),"%B":e=>c[e.tm_mon],"%C":e=>h((e.tm_year+1900)/100|0,2),"%d":e=>h(e.tm_mday,2),"%e":e=>d(e.tm_mday,2," "),"%g":e=>p(e).toString().substring(2),"%G":e=>p(e),"%H":e=>h(e.tm_hour,2),"%I":e=>{var r=e.tm_hour;return 0==r?r=12:r>12&&(r-=12),h(r,2)},"%j":e=>h(e.tm_mday+((e,r)=>{for(var t=0,n=0;n<=r;t+=e[n++]);return t})(pe(e.tm_year+1900)?De:Me,e.tm_mon-1),3),"%m":e=>h(e.tm_mon+1,2),"%M":e=>h(e.tm_min,2),"%n":()=>"\n","%p":e=>e.tm_hour>=0&&e.tm_hour<12?"AM":"PM","%S":e=>h(e.tm_sec,2),"%t":()=>"\t","%u":e=>e.tm_wday||7,"%U":e=>{var r=e.tm_yday+7-e.tm_wday;return h(Math.floor(r/7),2)},"%V":e=>{var r=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&r++,r){if(53==r){var t=(e.tm_wday+371-e.tm_yday)%7;4==t||3==t&&pe(e.tm_year)||(r=1)}}else{r=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&pe(e.tm_year%400-1))&&r++}return h(r,2)},"%w":e=>e.tm_wday,"%W":e=>{var r=e.tm_yday+7-(e.tm_wday+6)%7;return h(Math.floor(r/7),2)},"%y":e=>(e.tm_year+1900).toString().substring(2),"%Y":e=>e.tm_year+1900,"%z":e=>{var r=e.tm_gmtoff,t=r>=0;return r=(r=Math.abs(r)/60)/60*100+r%60,(t?"+":"-")+String("0000"+r).slice(-4)},"%Z":e=>e.tm_zone,"%%":()=>"%"};for(var u in s=s.replace(/%%/g,"\0\0"),v)s.includes(u)&&(s=s.replace(new RegExp(u,"g"),v[u](a)));var w=ne(s=s.replace(/\0\0/g,"%"),!1);return w.length>r?0:(Ae(w,e),w.length-1)}},Le=function(){var e,r,o,a,s={a:Ue};function i(e,r){var t;return Le=e.exports,g=Le.C,C(),t=Le.D,T.unshift(t),x(),Le}if(L(),n.instantiateWasm)try{return n.instantiateWasm(s,i)}catch(e){y(`Module.instantiateWasm callback failed with error: ${e}`),t(e)}return(e=w,r=N,o=s,a=function(e){i(e.instance)},e||"function"!=typeof WebAssembly.instantiateStreaming||H(r)||Y(r)||h||"function"!=typeof fetch?K(r,o,a):fetch(r,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,o).then(a,(function(e){return y(`wasm streaming compile failed: ${e}`),y("falling back to ArrayBuffer instantiation"),K(r,o,a)}))))).catch(t),{}}();n._get_version=()=>(n._get_version=Le.E)(),n._archive_open=(e,r,t,o)=>(n._archive_open=Le.F)(e,r,t,o),n._archive_read_add_passphrase=(e,r)=>(n._archive_read_add_passphrase=Le.G)(e,r),n._archive_error_string=e=>(n._archive_error_string=Le.H)(e),n._get_next_entry=e=>(n._get_next_entry=Le.I)(e),n._get_filedata=(e,r)=>(n._get_filedata=Le.J)(e,r);var xe=n._malloc=e=>(xe=n._malloc=Le.K)(e);n._archive_close=e=>(n._archive_close=Le.L)(e),n._start_archive_write=(e,r,t,o,a,s)=>(n._start_archive_write=Le.M)(e,r,t,o,a,s),n._write_archive_file=(e,r,t,o)=>(n._write_archive_file=Le.N)(e,r,t,o),n._size_of_size_t=()=>(n._size_of_size_t=Le.O)(),n._finish_archive_write=(e,r)=>(n._finish_archive_write=Le.P)(e,r),n._free=e=>(n._free=Le.Q)(e);var Oe=()=>(Oe=Le.R)();n._archive_entry_birthtime_nsec=e=>(n._archive_entry_birthtime_nsec=Le.S)(e),n._archive_entry_filetype=e=>(n._archive_entry_filetype=Le.T)(e),n._archive_entry_mtime_nsec=e=>(n._archive_entry_mtime_nsec=Le.U)(e),n._archive_entry_pathname=e=>(n._archive_entry_pathname=Le.V)(e),n._archive_entry_pathname_utf8=e=>(n._archive_entry_pathname_utf8=Le.W)(e),n._archive_entry_size=e=>(n._archive_entry_size=Le.X)(e),n._archive_entry_is_encrypted=e=>(n._archive_entry_is_encrypted=Le.Y)(e),n._archive_read_has_encrypted_entries=e=>(n._archive_read_has_encrypted_entries=Le.Z)(e),n._archive_read_data_skip=e=>(n._archive_read_data_skip=Le._)(e);var Ne,Be=e=>(Be=Le.aa)(e),je=()=>(je=Le.ba)(),Ie=e=>(Ie=Le.ca)(e),He=e=>(He=Le.da)(e);function Ye(){function e(){Ne||(Ne=!0,n.calledRun=!0,M||(n.noFSInit||le.init.initialized||le.init(),le.ignorePermissions=!1,fe.root=le.mount(fe,{},null),$(T),r(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),function(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)e=n.postRun.shift(),R.unshift(e);var e;$(R)}()))}z>0||(function(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)e=n.preRun.shift(),P.unshift(e);var e;$(P)}(),z>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.cwrap=(e,r,t,n)=>{var o=!t||t.every((e=>"number"===e||"boolean"===e));return"string"!==r&&o&&!n?Ce(e):function(){return Pe(e,r,t,arguments)}},n.allocate=(e,r)=>{var t;return t=1==r?He(e.length):xe(e.length),e.subarray||e.slice||(e=new Uint8Array(e)),k.set(e,t),t},U=function e(){Ne||Ye(),Ne||(U=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return Ye(),e.ready});class S{constructor(){this.preRun=[],this.postRun=[],this.totalDependencies=0}print(...e){console.log(e)}printErr(...e){console.error(e)}initFunctions(){this.runCode={getVersion:this.cwrap("get_version","string",[]),openArchive:this.cwrap("archive_open","number",["number","number","string","string"]),getNextEntry:this.cwrap("get_next_entry","number",["number"]),getFileData:this.cwrap("get_filedata","number",["number","number"]),skipEntry:this.cwrap("archive_read_data_skip","number",["number"]),closeArchive:this.cwrap("archive_close",null,["number"]),getEntrySize:this.cwrap("archive_entry_size","number",["number"]),getEntryName:this.cwrap("archive_entry_pathname","string",["number"]),getEntryType:this.cwrap("archive_entry_filetype","number",["number"]),getEntryLastModified:this.cwrap("archive_entry_mtime_nsec","number",["number"]),getError:this.cwrap("archive_error_string","string",["number"]),startArchiveWrite:this.cwrap("start_archive_write","number",["string","string","number","number","number","string"]),writeArchiveFile:this.cwrap("write_archive_file",null,["number","string","number","number"]),finishArchiveWrite:this.cwrap("finish_archive_write","number",["number","number"]),entryIsEncrypted:this.cwrap("archive_entry_is_encrypted","number",["number"]),hasEncryptedEntries:this.cwrap("archive_read_has_encrypted_entries","number",["number"]),addPassphrase:this.cwrap("archive_read_add_passphrase","number",["number","string"]),string:e=>this.allocate(this.intArrayFromString(e),"i8",0),malloc:this.cwrap("malloc","number",["number"]),free:this.cwrap("free",null,["number"]),sizeOfSizeT:this.cwrap("size_of_size_t","number",[])}}monitorRunDependencies(){}}let F=null,D=null,M=!1;class A{constructor(e){A.readyCallback=e,M&&setTimeout((()=>e()),0)}open(e,r){F.open(e).then((()=>r()))}listFiles(){let e=[];for(const r of F.entries(!0))e.push(r);return e}extractFiles(){let e=[];for(const r of F.entries(!1))e.push(r);return e}extractSingleFile(e){for(const r of F.entries(!0,e))if(r.fileData)return r}hasEncryptedData(){return F.hasEncryptedData()}usePassword(e){F.setPassphrase(e)}setLocale(e){F.setLocale(e)}writeArchive(e,r,t,n){return D.write(e,r,t,n)}close(){F.close()}}var C;C=e=>{F=new y(e),D=new E(e),A?.readyCallback?.(),M=!0},k(new S).then((e=>{e.initFunctions(),C(e)})),i(A); diff --git a/lib/build/libarchive.js b/lib/build/libarchive.js index 983f552..d2c383d 100644 --- a/lib/build/libarchive.js +++ b/lib/build/libarchive.js @@ -5,7 +5,7 @@ var libarchive = (() => { return ( async function(moduleArg = {}) { -var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary;if(ENVIRONMENT_IS_NODE){const{createRequire:createRequire}=await import("module");var require=createRequire(import.meta.url);var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=require("url").fileURLToPath(new URL("./",import.meta.url))}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror,binary=true)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,binary?undefined:"utf8",(err,data)=>{if(err)onerror(err);else onload(binary?data.buffer:data)})};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow};Module["inspect"]=()=>"[Emscripten Module object]"}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");var wasmBinaryFile;if(Module["locateFile"]){wasmBinaryFile="libarchive.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}}else{wasmBinaryFile=new URL("libarchive.wasm",import.meta.url).href}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(binaryFile){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(binaryFile)){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{if(!response["ok"]){throw"failed to load wasm binary file at '"+binaryFile+"'"}return response["arrayBuffer"]()}).catch(()=>getBinarySync(binaryFile))}else if(readAsync){return new Promise((resolve,reject)=>{readAsync(binaryFile,response=>resolve(new Uint8Array(response)),reject)})}}return Promise.resolve().then(()=>getBinarySync(binaryFile))}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(binary=>WebAssembly.instantiate(binary,imports)).then(instance=>instance).then(receiver,reason=>{err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}return instantiateArrayBuffer(binaryFile,imports,callback)}function createWasm(){var info={"a":wasmImports};function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["C"];updateMemoryViews();addOnInit(wasmExports["D"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);readyPromiseReject(e)}}instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult).catch(readyPromiseReject);return{}}var tempDouble;var tempI64;function ExitStatus(status){this.name="ExitStatus";this.message=`Program terminated with exit(${status})`;this.status=status}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var noExitRuntime=Module["noExitRuntime"]||true;var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>PATH.normalize(l+"/"+r)};var initRandomFill=()=>{if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){return view=>crypto.getRandomValues(view)}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");var randomFillSync=crypto_module["randomFillSync"];if(randomFillSync){return view=>crypto_module["randomFillSync"](view)}var randomBytes=crypto_module["randomBytes"];return view=>(view.set(randomBytes(view.byteLength)),view)}catch(e){}}abort("initRandomDevice")};var randomFill=view=>(randomFill=initRandomFill())(view);var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx>10,56320|ch&1023)}}return str};var FS_stdin_getChar_buffer=[];var lengthBytesUTF8=str=>{var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close(stream){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}},ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};var mmapAlloc=size=>{abort()};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}MEMFS.ops_table||={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}};var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup(parent,name){throw FS.genericErrors[44]},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir(node){var entries=[".",".."];for(var key of Object.keys(node.contents)){entries.push(key)}return entries},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{var dep=!noRunDep?getUniqueRunDependency(`al ${url}`):"";readAsync(url,arrayBuffer=>{assert(arrayBuffer,`Loading data file "${url}" failed (no arrayBuffer).`);onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw`Loading data file "${url}" failed.`}});if(dep)addRunDependency(dep)};var FS_createDataFile=(parent,name,fileData,canRead,canWrite,canOwn)=>{FS.createDataFile(parent,name,fileData,canRead,canWrite,canOwn)};var preloadPlugins=Module["preloadPlugins"]||[];var FS_handledByPreloadPlugin=(byteArray,fullname,finish,onerror)=>{if(typeof Browser!="undefined")Browser.init();var handled=false;preloadPlugins.forEach(plugin=>{if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true}});return handled};var FS_createPreloadedFile=(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${fullname}`);function processData(byteArray){function finish(byteArray){preFinish?.();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}onload?.();removeRunDependency(dep)}if(FS_handledByPreloadPlugin(byteArray,fullname,finish,()=>{onerror?.();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}};var FS_modeStringToFlags=str=>{var flagModes={"r":0,"r+":2,"w":512|64|1,"w+":512|64|2,"a":1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error(`Unknown file open mode: ${str}`)}return flags};var FS_getMode=(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(path,opts={}){path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?`${mount}/${path}`:mount+path}path=path?`${node.name}/${path}`:node.name;node=node.parent}},hashName(parentid,name){var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode(node){FS.hashRemoveNode(node)},isRoot(node){return node===node.parent},isMountpoint(node){return!!node.mounted},isFile(mode){return(mode&61440)===32768},isDir(mode){return(mode&61440)===16384},isLink(mode){return(mode&61440)===40960},isChrdev(mode){return(mode&61440)===8192},isBlkdev(mode){return(mode&61440)===24576},isFIFO(mode){return(mode&61440)===4096},isSocket(mode){return(mode&49152)===49152},flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions(node,perms){if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup(dir){var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate(dir,name){try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen(node,flags){if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}return stream},getStream:fd=>FS.streams[fd],createStream(stream,fd=-1){if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get(){return this.node},set(val){this.node=val}},isRead:{get(){return(this.flags&2097155)!==1}},isWrite:{get(){return(this.flags&2097155)!==0}},isAppend:{get(){return this.flags&1024}},flags:{get(){return this.shared.flags},set(val){this.shared.flags=val}},position:{get(){return this.shared.position},set(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);if(fd==-1){fd=FS.nextfd()}stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream(fd){FS.streams[fd]=null},chrdev_stream_ops:{open(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;stream.stream_ops.open?.(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`)}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup(parent,name){return parent.node_ops.lookup(parent,name)},mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree(path,mode){var dirs=path.split("/");var d="";for(var i=0;i0,ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile(path,opts={}){opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error(`Invalid encoding type "${opts.encoding}"`)}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile(path,data,opts={}){opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=()=>{if(randomLeft===0){randomLeft=randomFill(randomBuffer).byteLength}return randomBuffer[--randomLeft]};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount(){var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams(){if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError(){if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.name="ErrnoError";this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit(){FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init(input,output,error){FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit(){FS.init.initialized=false;for(var i=0;ithis.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true}};node.stream_ops=stream_ops;return node}};var UTF8ToString=(ptr,maxBytesToRead)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAP32[buf+12>>2]=stat.uid;HEAP32[buf+16>>2]=stat.gid;HEAP32[buf+20>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+24>>2]=tempI64[0],HEAP32[buf+28>>2]=tempI64[1];HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();tempI64=[Math.floor(atime/1e3)>>>0,(tempDouble=Math.floor(atime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAPU32[buf+48>>2]=atime%1e3*1e3;tempI64=[Math.floor(mtime/1e3)>>>0,(tempDouble=Math.floor(mtime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=mtime%1e3*1e3;tempI64=[Math.floor(ctime/1e3)>>>0,(tempDouble=Math.floor(ctime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=ctime%1e3*1e3;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];return 0},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},varargs:undefined,get(){var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret},getp(){return SYSCALLS.get()},getStr(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream}};function ___syscall_dup(fd){try{var old=SYSCALLS.getStreamFromFD(fd);return FS.createStream(old).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var setErrNo=value=>{HEAP32[___errno_location()>>2]=value;return value};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}while(FS.streams[arg]){arg++}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.getp();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount(mount){return FS.createNode(null,"/",16384|511,0)},createPipe(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}return 0},ioctl(stream,request,varargs){return 28},fsync(stream){return 28},read(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){try{var nonzero=0;for(var i=0;i>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream,-1)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_unlinkat(dirfd,path,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(flags===0){FS.unlink(path)}else if(flags===512){FS.rmdir(path)}else{abort("Invalid flags passed to unlinkat")}return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var nowIsMonotonic=1;var __emscripten_get_now_is_monotonic=()=>nowIsMonotonic;var convertI32PairToI53Checked=(lo,hi)=>hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN;function __gmtime_js(time_low,time_high,tmPtr){var time=convertI32PairToI53Checked(time_low,time_high);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday}var isLeapYear=year=>year%4===0&&(year%100!==0||year%400===0);var MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];var MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];var ydayFromDate=date=>{var leap=isLeapYear(date.getFullYear());var monthDaysCumulative=leap?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday};function __localtime_js(time_low,time_high,tmPtr){var time=convertI32PairToI53Checked(time_low,time_high);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}var __mktime_js=function(tmPtr){var ret=(()=>{var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getYear();var timeMs=date.getTime();if(isNaN(timeMs)){setErrNo(61);return-1}return timeMs/1e3})();return setTempRet0((tempDouble=ret,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)),ret>>>0};var __timegm_js=function(tmPtr){var ret=(()=>{var time=Date.UTC(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var date=new Date(time);HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;return date.getTime()/1e3})();return setTempRet0((tempDouble=ret,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)),ret>>>0};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stringToNewUTF8=str=>{var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8(str,ret,size);return ret};var __tzset_js=(timezone,daylight,tzname)=>{var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=stringToNewUTF8(winterName);var summerNamePtr=stringToNewUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}};var _abort=()=>{abort("")};var _emscripten_date_now=()=>Date.now();var _emscripten_get_now;_emscripten_get_now=()=>performance.now();var _emscripten_memcpy_js=(dest,src,num)=>HEAPU8.copyWithin(dest,src,src+num);var getHeapMax=()=>2147483648;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}var alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var stringToAscii=(str,buffer)=>{for(var i=0;i>0]=str.charCodeAt(i)}HEAP8[buffer>>0]=0};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;getEnvStrings().forEach((string,i)=>{var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;stringToAscii(string,ptr);bufSize+=string.length+1});return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(string=>bufSize+=string.length+1);HEAPU32[penviron_buf_size>>2]=bufSize;return 0};var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doReadv=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){var offset=convertI32PairToI53Checked(offset_low,offset_high);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doWritev=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(typeof offset!=="undefined"){offset+=curr}}return ret};function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var arraySum=(array,index)=>{var sum=0;for(var i=0;i<=index;sum+=array[i++]){}return sum};var MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];var addDays=(date,days)=>{var newDate=new Date(date.getTime());while(days>0){var leap=isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var _strftime=(s,maxsize,format,tm)=>{var tm_zone=HEAPU32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":date=>WEEKDAYS[date.tm_wday].substring(0,3),"%A":date=>WEEKDAYS[date.tm_wday],"%b":date=>MONTHS[date.tm_mon].substring(0,3),"%B":date=>MONTHS[date.tm_mon],"%C":date=>{var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":date=>leadingNulls(date.tm_mday,2),"%e":date=>leadingSomething(date.tm_mday,2," "),"%g":date=>getWeekBasedYear(date).toString().substring(2),"%G":date=>getWeekBasedYear(date),"%H":date=>leadingNulls(date.tm_hour,2),"%I":date=>{var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":date=>leadingNulls(date.tm_mday+arraySum(isLeapYear(date.tm_year+1900)?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,date.tm_mon-1),3),"%m":date=>leadingNulls(date.tm_mon+1,2),"%M":date=>leadingNulls(date.tm_min,2),"%n":()=>"\n","%p":date=>{if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":date=>leadingNulls(date.tm_sec,2),"%t":()=>"\t","%u":date=>date.tm_wday||7,"%U":date=>{var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":date=>{var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":date=>date.tm_wday,"%W":date=>{var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":date=>(date.tm_year+1900).toString().substring(2),"%Y":date=>date.tm_year+1900,"%z":date=>{var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":date=>date.tm_zone,"%%":()=>"%"};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1};var getCFunc=ident=>{var func=Module["_"+ident];return func};var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},"array":arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}};var ALLOC_STACK=1;var allocate=(slab,allocator)=>{var ret;if(allocator==ALLOC_STACK){ret=stackAlloc(slab.length)}else{ret=_malloc(slab.length)}if(!slab.subarray&&!slab.slice){slab=new Uint8Array(slab)}HEAPU8.set(slab,ret);return ret};var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.createPreloadedFile=FS_createPreloadedFile;FS.staticInit();var wasmImports={i:___syscall_dup,a:___syscall_fcntl64,x:___syscall_fstat64,u:___syscall_lstat64,v:___syscall_newfstatat,y:___syscall_openat,t:___syscall_pipe,s:___syscall_poll,w:___syscall_stat64,q:___syscall_unlinkat,B:__emscripten_get_now_is_monotonic,k:__gmtime_js,l:__localtime_js,m:__mktime_js,n:__timegm_js,r:__tzset_js,b:_abort,c:_emscripten_date_now,h:_emscripten_memcpy_js,p:_emscripten_resize_heap,z:_environ_get,A:_environ_sizes_get,g:_exit,e:_fd_close,j:_fd_read,o:_fd_seek,d:_fd_write,f:_strftime};var wasmExports=createWasm();var ___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports["D"])();var _get_version=Module["_get_version"]=()=>(_get_version=Module["_get_version"]=wasmExports["E"])();var _archive_open=Module["_archive_open"]=(a0,a1,a2,a3)=>(_archive_open=Module["_archive_open"]=wasmExports["F"])(a0,a1,a2,a3);var _archive_read_add_passphrase=Module["_archive_read_add_passphrase"]=(a0,a1)=>(_archive_read_add_passphrase=Module["_archive_read_add_passphrase"]=wasmExports["G"])(a0,a1);var _archive_error_string=Module["_archive_error_string"]=a0=>(_archive_error_string=Module["_archive_error_string"]=wasmExports["H"])(a0);var _get_next_entry=Module["_get_next_entry"]=a0=>(_get_next_entry=Module["_get_next_entry"]=wasmExports["I"])(a0);var _get_filedata=Module["_get_filedata"]=(a0,a1)=>(_get_filedata=Module["_get_filedata"]=wasmExports["J"])(a0,a1);var _malloc=Module["_malloc"]=a0=>(_malloc=Module["_malloc"]=wasmExports["K"])(a0);var _archive_close=Module["_archive_close"]=a0=>(_archive_close=Module["_archive_close"]=wasmExports["L"])(a0);var _start_archive_write=Module["_start_archive_write"]=(a0,a1,a2,a3,a4,a5)=>(_start_archive_write=Module["_start_archive_write"]=wasmExports["M"])(a0,a1,a2,a3,a4,a5);var _write_archive_file=Module["_write_archive_file"]=(a0,a1,a2,a3)=>(_write_archive_file=Module["_write_archive_file"]=wasmExports["N"])(a0,a1,a2,a3);var _size_of_size_t=Module["_size_of_size_t"]=()=>(_size_of_size_t=Module["_size_of_size_t"]=wasmExports["O"])();var _free=Module["_free"]=a0=>(_free=Module["_free"]=wasmExports["P"])(a0);var ___errno_location=()=>(___errno_location=wasmExports["Q"])();var _archive_entry_birthtime_nsec=Module["_archive_entry_birthtime_nsec"]=a0=>(_archive_entry_birthtime_nsec=Module["_archive_entry_birthtime_nsec"]=wasmExports["R"])(a0);var _archive_entry_filetype=Module["_archive_entry_filetype"]=a0=>(_archive_entry_filetype=Module["_archive_entry_filetype"]=wasmExports["S"])(a0);var _archive_entry_mtime_nsec=Module["_archive_entry_mtime_nsec"]=a0=>(_archive_entry_mtime_nsec=Module["_archive_entry_mtime_nsec"]=wasmExports["T"])(a0);var _archive_entry_pathname=Module["_archive_entry_pathname"]=a0=>(_archive_entry_pathname=Module["_archive_entry_pathname"]=wasmExports["U"])(a0);var _archive_entry_pathname_utf8=Module["_archive_entry_pathname_utf8"]=a0=>(_archive_entry_pathname_utf8=Module["_archive_entry_pathname_utf8"]=wasmExports["V"])(a0);var _archive_entry_size=Module["_archive_entry_size"]=a0=>(_archive_entry_size=Module["_archive_entry_size"]=wasmExports["W"])(a0);var _archive_entry_is_encrypted=Module["_archive_entry_is_encrypted"]=a0=>(_archive_entry_is_encrypted=Module["_archive_entry_is_encrypted"]=wasmExports["X"])(a0);var _archive_read_has_encrypted_entries=Module["_archive_read_has_encrypted_entries"]=a0=>(_archive_read_has_encrypted_entries=Module["_archive_read_has_encrypted_entries"]=wasmExports["Y"])(a0);var _archive_read_data_skip=Module["_archive_read_data_skip"]=a0=>(_archive_read_data_skip=Module["_archive_read_data_skip"]=wasmExports["Z"])(a0);var _archive_write_close=Module["_archive_write_close"]=a0=>(_archive_write_close=Module["_archive_write_close"]=wasmExports["$"])(a0);var _archive_write_free=Module["_archive_write_free"]=a0=>(_archive_write_free=Module["_archive_write_free"]=wasmExports["aa"])(a0);var _htons=a0=>(_htons=wasmExports["htons"])(a0);var _ntohs=a0=>(_ntohs=wasmExports["ntohs"])(a0);var setTempRet0=a0=>(setTempRet0=wasmExports["ba"])(a0);var stackSave=()=>(stackSave=wasmExports["ca"])();var stackRestore=a0=>(stackRestore=wasmExports["da"])(a0);var stackAlloc=a0=>(stackAlloc=wasmExports["ea"])(a0);Module["cwrap"]=cwrap;Module["UTF8ToString"]=UTF8ToString;Module["intArrayFromString"]=intArrayFromString;Module["allocate"]=allocate;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(){if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); +var Module=moduleArg;var readyPromiseResolve,readyPromiseReject;Module["ready"]=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject});var moduleOverrides=Object.assign({},Module);var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof importScripts=="function";var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var read_,readAsync,readBinary;if(ENVIRONMENT_IS_NODE){const{createRequire:createRequire}=await import("module");var require=createRequire(import.meta.url);var fs=require("fs");var nodePath=require("path");if(ENVIRONMENT_IS_WORKER){scriptDirectory=nodePath.dirname(scriptDirectory)+"/"}else{scriptDirectory=require("url").fileURLToPath(new URL("./",import.meta.url))}read_=(filename,binary)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);return fs.readFileSync(filename,binary?undefined:"utf8")};readBinary=filename=>{var ret=read_(filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}return ret};readAsync=(filename,onload,onerror,binary=true)=>{filename=isFileURI(filename)?new URL(filename):nodePath.normalize(filename);fs.readFile(filename,binary?undefined:"utf8",(err,data)=>{if(err)onerror(err);else onload(binary?data.buffer:data)})};if(!Module["thisProgram"]&&process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow};Module["inspect"]=()=>"[Emscripten Module object]"}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){if(ENVIRONMENT_IS_WORKER){scriptDirectory=self.location.href}else if(typeof document!="undefined"&&document.currentScript){scriptDirectory=document.currentScript.src}if(_scriptDir){scriptDirectory=_scriptDir}if(scriptDirectory.indexOf("blob:")!==0){scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1)}else{scriptDirectory=""}{read_=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=(url,onload,onerror)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response);return}onerror()};xhr.onerror=onerror;xhr.send(null)}}}else{}var out=Module["print"]||console.log.bind(console);var err=Module["printErr"]||console.error.bind(console);Object.assign(Module,moduleOverrides);moduleOverrides=null;if(Module["arguments"])arguments_=Module["arguments"];if(Module["thisProgram"])thisProgram=Module["thisProgram"];if(Module["quit"])quit_=Module["quit"];var wasmBinary;if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(typeof WebAssembly!="object"){abort("no native wasm support detected")}var wasmMemory;var ABORT=false;var EXITSTATUS;function assert(condition,text){if(!condition){abort(text)}}var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=HEAP8=new Int8Array(b);Module["HEAP16"]=HEAP16=new Int16Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAPU16"]=HEAPU16=new Uint16Array(b);Module["HEAP32"]=HEAP32=new Int32Array(b);Module["HEAPU32"]=HEAPU32=new Uint32Array(b);Module["HEAPF32"]=HEAPF32=new Float32Array(b);Module["HEAPF64"]=HEAPF64=new Float64Array(b)}var __ATPRERUN__=[];var __ATINIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=true;if(!Module["noFSInit"]&&!FS.init.initialized)FS.init();FS.ignorePermissions=false;TTY.init();PIPEFS.root=FS.mount(PIPEFS,{},null);callRuntimeCallbacks(__ATINIT__)}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnInit(cb){__ATINIT__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;function getUniqueRunDependency(id){return id}function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies)}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(runDependencyWatcher!==null){clearInterval(runDependencyWatcher);runDependencyWatcher=null}if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback()}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;EXITSTATUS=1;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject(e);throw e}var dataURIPrefix="data:application/octet-stream;base64,";var isDataURI=filename=>filename.startsWith(dataURIPrefix);var isFileURI=filename=>filename.startsWith("file://");var wasmBinaryFile;if(Module["locateFile"]){wasmBinaryFile="libarchive.wasm";if(!isDataURI(wasmBinaryFile)){wasmBinaryFile=locateFile(wasmBinaryFile)}}else{wasmBinaryFile=new URL("libarchive.wasm",import.meta.url).href}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(binaryFile){if(!wasmBinary&&(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)){if(typeof fetch=="function"&&!isFileURI(binaryFile)){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{if(!response["ok"]){throw"failed to load wasm binary file at '"+binaryFile+"'"}return response["arrayBuffer"]()}).catch(()=>getBinarySync(binaryFile))}else if(readAsync){return new Promise((resolve,reject)=>{readAsync(binaryFile,response=>resolve(new Uint8Array(response)),reject)})}}return Promise.resolve().then(()=>getBinarySync(binaryFile))}function instantiateArrayBuffer(binaryFile,imports,receiver){return getBinaryPromise(binaryFile).then(binary=>WebAssembly.instantiate(binary,imports)).then(instance=>instance).then(receiver,reason=>{err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)})}function instantiateAsync(binary,binaryFile,imports,callback){if(!binary&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(binaryFile)&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"){return fetch(binaryFile,{credentials:"same-origin"}).then(response=>{var result=WebAssembly.instantiateStreaming(response,imports);return result.then(callback,function(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");return instantiateArrayBuffer(binaryFile,imports,callback)})})}return instantiateArrayBuffer(binaryFile,imports,callback)}function createWasm(){var info={"a":wasmImports};function receiveInstance(instance,module){wasmExports=instance.exports;wasmMemory=wasmExports["C"];updateMemoryViews();addOnInit(wasmExports["D"]);removeRunDependency("wasm-instantiate");return wasmExports}addRunDependency("wasm-instantiate");function receiveInstantiationResult(result){receiveInstance(result["instance"])}if(Module["instantiateWasm"]){try{return Module["instantiateWasm"](info,receiveInstance)}catch(e){err(`Module.instantiateWasm callback failed with error: ${e}`);readyPromiseReject(e)}}instantiateAsync(wasmBinary,wasmBinaryFile,info,receiveInstantiationResult).catch(readyPromiseReject);return{}}var tempDouble;var tempI64;function ExitStatus(status){this.name="ExitStatus";this.message=`Program terminated with exit(${status})`;this.status=status}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module)}};var noExitRuntime=Module["noExitRuntime"]||true;var PATH={isAbs:path=>path.charAt(0)==="/",splitPath:filename=>{var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return splitPathRe.exec(filename).slice(1)},normalizeArray:(parts,allowAboveRoot)=>{var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift("..")}}return parts},normalize:path=>{var isAbsolute=PATH.isAbs(path),trailingSlash=path.substr(-1)==="/";path=PATH.normalizeArray(path.split("/").filter(p=>!!p),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path},dirname:path=>{var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:path=>{if(path==="/")return"/";path=PATH.normalize(path);path=path.replace(/\/$/,"");var lastSlash=path.lastIndexOf("/");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},join:function(){var paths=Array.prototype.slice.call(arguments);return PATH.normalize(paths.join("/"))},join2:(l,r)=>PATH.normalize(l+"/"+r)};var initRandomFill=()=>{if(typeof crypto=="object"&&typeof crypto["getRandomValues"]=="function"){return view=>crypto.getRandomValues(view)}else if(ENVIRONMENT_IS_NODE){try{var crypto_module=require("crypto");var randomFillSync=crypto_module["randomFillSync"];if(randomFillSync){return view=>crypto_module["randomFillSync"](view)}var randomBytes=crypto_module["randomBytes"];return view=>(view.set(randomBytes(view.byteLength)),view)}catch(e){}}abort("initRandomDevice")};var randomFill=view=>(randomFill=initRandomFill())(view);var PATH_FS={resolve:function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){return""}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=PATH.isAbs(path)}resolvedPath=PATH.normalizeArray(resolvedPath.split("/").filter(p=>!!p),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."},relative:(from,to)=>{from=PATH_FS.resolve(from).substr(1);to=PATH_FS.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i{var endIdx=idx+maxBytesToRead;var endPtr=idx;while(heapOrArray[endPtr]&&!(endPtr>=endIdx))++endPtr;if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str="";while(idx>10,56320|ch&1023)}}return str};var FS_stdin_getChar_buffer=[];var lengthBytesUTF8=str=>{var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}}heap[outIdx]=0;return outIdx-startIdx};function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var FS_stdin_getChar=()=>{if(!FS_stdin_getChar_buffer.length){var result=null;if(ENVIRONMENT_IS_NODE){var BUFSIZE=256;var buf=Buffer.alloc(BUFSIZE);var bytesRead=0;var fd=process.stdin.fd;try{bytesRead=fs.readSync(fd,buf)}catch(e){if(e.toString().includes("EOF"))bytesRead=0;else throw e}if(bytesRead>0){result=buf.slice(0,bytesRead).toString("utf-8")}else{result=null}}else if(typeof window!="undefined"&&typeof window.prompt=="function"){result=window.prompt("Input: ");if(result!==null){result+="\n"}}else if(typeof readline=="function"){result=readline();if(result!==null){result+="\n"}}if(!result){return null}FS_stdin_getChar_buffer=intArrayFromString(result,true)}return FS_stdin_getChar_buffer.shift()};var TTY={ttys:[],init(){},shutdown(){},register(dev,ops){TTY.ttys[dev]={input:[],output:[],ops:ops};FS.registerDevice(dev,TTY.stream_ops)},stream_ops:{open(stream){var tty=TTY.ttys[stream.node.rdev];if(!tty){throw new FS.ErrnoError(43)}stream.tty=tty;stream.seekable=false},close(stream){stream.tty.ops.fsync(stream.tty)},fsync(stream){stream.tty.ops.fsync(stream.tty)},read(stream,buffer,offset,length,pos){if(!stream.tty||!stream.tty.ops.get_char){throw new FS.ErrnoError(60)}var bytesRead=0;for(var i=0;i0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}},ioctl_tcgets(tty){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(tty,optional_actions,data){return 0},ioctl_tiocgwinsz(tty){return[24,80]}},default_tty1_ops:{put_char(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},fsync(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};var mmapAlloc=size=>{abort()};var MEMFS={ops_table:null,mount(mount){return MEMFS.createNode(null,"/",16384|511,0)},createNode(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(63)}MEMFS.ops_table||={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}};var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node;parent.timestamp=node.timestamp}return node},getFileDataAsTypedArray(node){if(!node.contents)return new Uint8Array(0);if(node.contents.subarray)return node.contents.subarray(0,node.usedBytes);return new Uint8Array(node.contents)},expandFileStorage(node,newCapacity){var prevCapacity=node.contents?node.contents.length:0;if(prevCapacity>=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity>>0);if(prevCapacity!=0)newCapacity=Math.max(newCapacity,256);var oldContents=node.contents;node.contents=new Uint8Array(newCapacity);if(node.usedBytes>0)node.contents.set(oldContents.subarray(0,node.usedBytes),0)},resizeFileStorage(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0}else{var oldContents=node.contents;node.contents=new Uint8Array(newSize);if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize}},node_ops:{getattr(node){var attr={};attr.dev=FS.isChrdev(node.mode)?node.id:1;attr.ino=node.id;attr.mode=node.mode;attr.nlink=1;attr.uid=0;attr.gid=0;attr.rdev=node.rdev;if(FS.isDir(node.mode)){attr.size=4096}else if(FS.isFile(node.mode)){attr.size=node.usedBytes}else if(FS.isLink(node.mode)){attr.size=node.link.length}else{attr.size=0}attr.atime=new Date(node.timestamp);attr.mtime=new Date(node.timestamp);attr.ctime=new Date(node.timestamp);attr.blksize=4096;attr.blocks=Math.ceil(attr.size/attr.blksize);return attr},setattr(node,attr){if(attr.mode!==undefined){node.mode=attr.mode}if(attr.timestamp!==undefined){node.timestamp=attr.timestamp}if(attr.size!==undefined){MEMFS.resizeFileStorage(node,attr.size)}},lookup(parent,name){throw FS.genericErrors[44]},mknod(parent,name,mode,dev){return MEMFS.createNode(parent,name,mode,dev)},rename(old_node,new_dir,new_name){if(FS.isDir(old_node.mode)){var new_node;try{new_node=FS.lookupNode(new_dir,new_name)}catch(e){}if(new_node){for(var i in new_node.contents){throw new FS.ErrnoError(55)}}}delete old_node.parent.contents[old_node.name];old_node.parent.timestamp=Date.now();old_node.name=new_name;new_dir.contents[new_name]=old_node;new_dir.timestamp=old_node.parent.timestamp;old_node.parent=new_dir},unlink(parent,name){delete parent.contents[name];parent.timestamp=Date.now()},rmdir(parent,name){var node=FS.lookupNode(parent,name);for(var i in node.contents){throw new FS.ErrnoError(55)}delete parent.contents[name];parent.timestamp=Date.now()},readdir(node){var entries=[".",".."];for(var key of Object.keys(node.contents)){entries.push(key)}return entries},symlink(parent,newname,oldpath){var node=MEMFS.createNode(parent,newname,511|40960,0);node.link=oldpath;return node},readlink(node){if(!FS.isLink(node.mode)){throw new FS.ErrnoError(28)}return node.link}},stream_ops:{read(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length{var dep=!noRunDep?getUniqueRunDependency(`al ${url}`):"";readAsync(url,arrayBuffer=>{assert(arrayBuffer,`Loading data file "${url}" failed (no arrayBuffer).`);onload(new Uint8Array(arrayBuffer));if(dep)removeRunDependency(dep)},event=>{if(onerror){onerror()}else{throw`Loading data file "${url}" failed.`}});if(dep)addRunDependency(dep)};var FS_createDataFile=(parent,name,fileData,canRead,canWrite,canOwn)=>{FS.createDataFile(parent,name,fileData,canRead,canWrite,canOwn)};var preloadPlugins=Module["preloadPlugins"]||[];var FS_handledByPreloadPlugin=(byteArray,fullname,finish,onerror)=>{if(typeof Browser!="undefined")Browser.init();var handled=false;preloadPlugins.forEach(plugin=>{if(handled)return;if(plugin["canHandle"](fullname)){plugin["handle"](byteArray,fullname,finish,onerror);handled=true}});return handled};var FS_createPreloadedFile=(parent,name,url,canRead,canWrite,onload,onerror,dontCreateFile,canOwn,preFinish)=>{var fullname=name?PATH_FS.resolve(PATH.join2(parent,name)):parent;var dep=getUniqueRunDependency(`cp ${fullname}`);function processData(byteArray){function finish(byteArray){preFinish?.();if(!dontCreateFile){FS_createDataFile(parent,name,byteArray,canRead,canWrite,canOwn)}onload?.();removeRunDependency(dep)}if(FS_handledByPreloadPlugin(byteArray,fullname,finish,()=>{onerror?.();removeRunDependency(dep)})){return}finish(byteArray)}addRunDependency(dep);if(typeof url=="string"){asyncLoad(url,byteArray=>processData(byteArray),onerror)}else{processData(url)}};var FS_modeStringToFlags=str=>{var flagModes={"r":0,"r+":2,"w":512|64|1,"w+":512|64|2,"a":1024|64|1,"a+":1024|64|2};var flags=flagModes[str];if(typeof flags=="undefined"){throw new Error(`Unknown file open mode: ${str}`)}return flags};var FS_getMode=(canRead,canWrite)=>{var mode=0;if(canRead)mode|=292|73;if(canWrite)mode|=146;return mode};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:false,ignorePermissions:true,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(path,opts={}){path=PATH_FS.resolve(path);if(!path)return{path:"",node:null};var defaults={follow_mount:true,recurse_count:0};opts=Object.assign(defaults,opts);if(opts.recurse_count>8){throw new FS.ErrnoError(32)}var parts=path.split("/").filter(p=>!!p);var current=FS.root;var current_path="/";for(var i=0;i40){throw new FS.ErrnoError(32)}}}}return{path:current_path,node:current}},getPath(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!=="/"?`${mount}/${path}`:mount+path}path=path?`${node.name}/${path}`:node.name;node=node.parent}},hashName(parentid,name){var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode(parent,name){var errCode=FS.mayLookup(parent);if(errCode){throw new FS.ErrnoError(errCode,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode(parent,name,mode,rdev){var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode(node){FS.hashRemoveNode(node)},isRoot(node){return node===node.parent},isMountpoint(node){return!!node.mounted},isFile(mode){return(mode&61440)===32768},isDir(mode){return(mode&61440)===16384},isLink(mode){return(mode&61440)===40960},isChrdev(mode){return(mode&61440)===8192},isBlkdev(mode){return(mode&61440)===24576},isFIFO(mode){return(mode&61440)===4096},isSocket(mode){return(mode&49152)===49152},flagsToPermissionString(flag){var perms=["r","w","rw"][flag&3];if(flag&512){perms+="w"}return perms},nodePermissions(node,perms){if(FS.ignorePermissions){return 0}if(perms.includes("r")&&!(node.mode&292)){return 2}else if(perms.includes("w")&&!(node.mode&146)){return 2}else if(perms.includes("x")&&!(node.mode&73)){return 2}return 0},mayLookup(dir){var errCode=FS.nodePermissions(dir,"x");if(errCode)return errCode;if(!dir.node_ops.lookup)return 2;return 0},mayCreate(dir,name){try{var node=FS.lookupNode(dir,name);return 20}catch(e){}return FS.nodePermissions(dir,"wx")},mayDelete(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var errCode=FS.nodePermissions(dir,"wx");if(errCode){return errCode}if(isdir){if(!FS.isDir(node.mode)){return 54}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 10}}else{if(FS.isDir(node.mode)){return 31}}return 0},mayOpen(node,flags){if(!node){return 44}if(FS.isLink(node.mode)){return 32}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!=="r"||flags&512){return 31}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd(){for(var fd=0;fd<=FS.MAX_OPEN_FDS;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(33)},getStreamChecked(fd){var stream=FS.getStream(fd);if(!stream){throw new FS.ErrnoError(8)}return stream},getStream:fd=>FS.streams[fd],createStream(stream,fd=-1){if(!FS.FSStream){FS.FSStream=function(){this.shared={}};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get(){return this.node},set(val){this.node=val}},isRead:{get(){return(this.flags&2097155)!==1}},isWrite:{get(){return(this.flags&2097155)!==0}},isAppend:{get(){return this.flags&1024}},flags:{get(){return this.shared.flags},set(val){this.shared.flags=val}},position:{get(){return this.shared.position},set(val){this.shared.position=val}}})}stream=Object.assign(new FS.FSStream,stream);if(fd==-1){fd=FS.nextfd()}stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream(fd){FS.streams[fd]=null},chrdev_stream_ops:{open(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;stream.stream_ops.open?.(stream)},llseek(){throw new FS.ErrnoError(70)}},major:dev=>dev>>8,minor:dev=>dev&255,makedev:(ma,mi)=>ma<<8|mi,registerDevice(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:dev=>FS.devices[dev],getMounts(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs(populate,callback){if(typeof populate=="function"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`)}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(errCode){FS.syncFSRequests--;return callback(errCode)}function done(errCode){if(errCode){if(!done.errored){done.errored=true;return doCallback(errCode)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(mount=>{if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount(type,opts,mountpoint){var root=mountpoint==="/";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(10)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(10)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(54)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(28)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(hash=>{var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.includes(current.mount)){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);node.mount.mounts.splice(idx,1)},lookup(parent,name){return parent.node_ops.lookup(parent,name)},mknod(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name==="."||name===".."){throw new FS.ErrnoError(28)}var errCode=FS.mayCreate(parent,name);if(errCode){throw new FS.ErrnoError(errCode)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(63)}return parent.node_ops.mknod(parent,name,mode,dev)},create(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree(path,mode){var dirs=path.split("/");var d="";for(var i=0;i0,ioctl(stream,cmd,arg){if(!stream.stream_ops.ioctl){throw new FS.ErrnoError(59)}return stream.stream_ops.ioctl(stream,cmd,arg)},readFile(path,opts={}){opts.flags=opts.flags||0;opts.encoding=opts.encoding||"binary";if(opts.encoding!=="utf8"&&opts.encoding!=="binary"){throw new Error(`Invalid encoding type "${opts.encoding}"`)}var ret;var stream=FS.open(path,opts.flags);var stat=FS.stat(path);var length=stat.size;var buf=new Uint8Array(length);FS.read(stream,buf,0,length,0);if(opts.encoding==="utf8"){ret=UTF8ArrayToString(buf,0)}else if(opts.encoding==="binary"){ret=buf}FS.close(stream);return ret},writeFile(path,data,opts={}){opts.flags=opts.flags||577;var stream=FS.open(path,opts.flags,opts.mode);if(typeof data=="string"){var buf=new Uint8Array(lengthBytesUTF8(data)+1);var actualNumBytes=stringToUTF8Array(data,buf,0,buf.length);FS.write(stream,buf,0,actualNumBytes,undefined,opts.canOwn)}else if(ArrayBuffer.isView(data)){FS.write(stream,data,0,data.byteLength,undefined,opts.canOwn)}else{throw new Error("Unsupported data type")}FS.close(stream)},cwd:()=>FS.currentPath,chdir(path){var lookup=FS.lookupPath(path,{follow:true});if(lookup.node===null){throw new FS.ErrnoError(44)}if(!FS.isDir(lookup.node.mode)){throw new FS.ErrnoError(54)}var errCode=FS.nodePermissions(lookup.node,"x");if(errCode){throw new FS.ErrnoError(errCode)}FS.currentPath=lookup.path},createDefaultDirectories(){FS.mkdir("/tmp");FS.mkdir("/home");FS.mkdir("/home/web_user")},createDefaultDevices(){FS.mkdir("/dev");FS.registerDevice(FS.makedev(1,3),{read:()=>0,write:(stream,buffer,offset,length,pos)=>length});FS.mkdev("/dev/null",FS.makedev(1,3));TTY.register(FS.makedev(5,0),TTY.default_tty_ops);TTY.register(FS.makedev(6,0),TTY.default_tty1_ops);FS.mkdev("/dev/tty",FS.makedev(5,0));FS.mkdev("/dev/tty1",FS.makedev(6,0));var randomBuffer=new Uint8Array(1024),randomLeft=0;var randomByte=()=>{if(randomLeft===0){randomLeft=randomFill(randomBuffer).byteLength}return randomBuffer[--randomLeft]};FS.createDevice("/dev","random",randomByte);FS.createDevice("/dev","urandom",randomByte);FS.mkdir("/dev/shm");FS.mkdir("/dev/shm/tmp")},createSpecialDirectories(){FS.mkdir("/proc");var proc_self=FS.mkdir("/proc/self");FS.mkdir("/proc/self/fd");FS.mount({mount(){var node=FS.createNode(proc_self,"fd",16384|511,73);node.node_ops={lookup(parent,name){var fd=+name;var stream=FS.getStreamChecked(fd);var ret={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>stream.path}};ret.parent=ret;return ret}};return node}},{},"/proc/self/fd")},createStandardStreams(){if(Module["stdin"]){FS.createDevice("/dev","stdin",Module["stdin"])}else{FS.symlink("/dev/tty","/dev/stdin")}if(Module["stdout"]){FS.createDevice("/dev","stdout",null,Module["stdout"])}else{FS.symlink("/dev/tty","/dev/stdout")}if(Module["stderr"]){FS.createDevice("/dev","stderr",null,Module["stderr"])}else{FS.symlink("/dev/tty1","/dev/stderr")}var stdin=FS.open("/dev/stdin",0);var stdout=FS.open("/dev/stdout",1);var stderr=FS.open("/dev/stderr",1)},ensureErrnoError(){if(FS.ErrnoError)return;FS.ErrnoError=function ErrnoError(errno,node){this.name="ErrnoError";this.node=node;this.setErrno=function(errno){this.errno=errno};this.setErrno(errno);this.message="FS error"};FS.ErrnoError.prototype=new Error;FS.ErrnoError.prototype.constructor=FS.ErrnoError;[44].forEach(code=>{FS.genericErrors[code]=new FS.ErrnoError(code);FS.genericErrors[code].stack=""})},staticInit(){FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},"/");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={"MEMFS":MEMFS}},init(input,output,error){FS.init.initialized=true;FS.ensureErrnoError();Module["stdin"]=input||Module["stdin"];Module["stdout"]=output||Module["stdout"];Module["stderr"]=error||Module["stderr"];FS.createStandardStreams()},quit(){FS.init.initialized=false;for(var i=0;ithis.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open("HEAD",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);var datalength=Number(xhr.getResponseHeader("Content-length"));var header;var hasByteServing=(header=xhr.getResponseHeader("Accept-Ranges"))&&header==="bytes";var usesGzip=(header=xhr.getResponseHeader("Content-Encoding"))&&header==="gzip";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=(from,to)=>{if(from>to)throw new Error("invalid range ("+from+", "+to+") or no bytes requested!");if(to>datalength-1)throw new Error("only "+datalength+" bytes available! programmer error!");var xhr=new XMLHttpRequest;xhr.open("GET",url,false);if(datalength!==chunkSize)xhr.setRequestHeader("Range","bytes="+from+"-"+to);xhr.responseType="arraybuffer";if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=x-user-defined")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error("Couldn't load "+url+". Status: "+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}return intArrayFromString(xhr.responseText||"",true)};var lazyArray=this;lazyArray.setDataGetter(chunkNum=>{var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]=="undefined"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]=="undefined")throw new Error("doXHR failed!");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;out("LazyFiles on gzip forces download of the whole file when length is accessed")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!="undefined"){if(!ENVIRONMENT_IS_WORKER)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(key=>{var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){FS.forceLoadFile(node);return fn.apply(null,arguments)}});function writeChunks(stream,buffer,offset,length,position){var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);if(contents.slice){for(var i=0;i{FS.forceLoadFile(node);return writeChunks(stream,buffer,offset,length,position)};stream_ops.mmap=(stream,length,position,prot,flags)=>{FS.forceLoadFile(node);var ptr=mmapAlloc(length);if(!ptr){throw new FS.ErrnoError(48)}writeChunks(stream,HEAP8,ptr,length,position);return{ptr:ptr,allocated:true}};node.stream_ops=stream_ops;return node}};var UTF8ToString=(ptr,maxBytesToRead)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):"";var SYSCALLS={DEFAULT_POLLMASK:5,calculateAt(dirfd,path,allowEmpty){if(PATH.isAbs(path)){return path}var dir;if(dirfd===-100){dir=FS.cwd()}else{var dirstream=SYSCALLS.getStreamFromFD(dirfd);dir=dirstream.path}if(path.length==0){if(!allowEmpty){throw new FS.ErrnoError(44)}return dir}return PATH.join2(dir,path)},doStat(func,path,buf){try{var stat=func(path)}catch(e){if(e&&e.node&&PATH.normalize(path)!==PATH.normalize(FS.getPath(e.node))){return-54}throw e}HEAP32[buf>>2]=stat.dev;HEAP32[buf+4>>2]=stat.mode;HEAPU32[buf+8>>2]=stat.nlink;HEAP32[buf+12>>2]=stat.uid;HEAP32[buf+16>>2]=stat.gid;HEAP32[buf+20>>2]=stat.rdev;tempI64=[stat.size>>>0,(tempDouble=stat.size,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+24>>2]=tempI64[0],HEAP32[buf+28>>2]=tempI64[1];HEAP32[buf+32>>2]=4096;HEAP32[buf+36>>2]=stat.blocks;var atime=stat.atime.getTime();var mtime=stat.mtime.getTime();var ctime=stat.ctime.getTime();tempI64=[Math.floor(atime/1e3)>>>0,(tempDouble=Math.floor(atime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+40>>2]=tempI64[0],HEAP32[buf+44>>2]=tempI64[1];HEAPU32[buf+48>>2]=atime%1e3*1e3;tempI64=[Math.floor(mtime/1e3)>>>0,(tempDouble=Math.floor(mtime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+56>>2]=tempI64[0],HEAP32[buf+60>>2]=tempI64[1];HEAPU32[buf+64>>2]=mtime%1e3*1e3;tempI64=[Math.floor(ctime/1e3)>>>0,(tempDouble=Math.floor(ctime/1e3),+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+72>>2]=tempI64[0],HEAP32[buf+76>>2]=tempI64[1];HEAPU32[buf+80>>2]=ctime%1e3*1e3;tempI64=[stat.ino>>>0,(tempDouble=stat.ino,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[buf+88>>2]=tempI64[0],HEAP32[buf+92>>2]=tempI64[1];return 0},doMsync(addr,stream,len,flags,offset){if(!FS.isFile(stream.node.mode)){throw new FS.ErrnoError(43)}if(flags&2){return 0}var buffer=HEAPU8.slice(addr,addr+len);FS.msync(stream,buffer,offset,len,flags)},varargs:undefined,get(){var ret=HEAP32[+SYSCALLS.varargs>>2];SYSCALLS.varargs+=4;return ret},getp(){return SYSCALLS.get()},getStr(ptr){var ret=UTF8ToString(ptr);return ret},getStreamFromFD(fd){var stream=FS.getStreamChecked(fd);return stream}};function ___syscall_dup(fd){try{var old=SYSCALLS.getStreamFromFD(fd);return FS.createStream(old).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var setErrNo=value=>{HEAP32[___errno_location()>>2]=value;return value};function ___syscall_fcntl64(fd,cmd,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(fd);switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-28}while(FS.streams[arg]){arg++}var newStream;newStream=FS.createStream(stream,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 5:{var arg=SYSCALLS.getp();var offset=0;HEAP16[arg+offset>>1]=2;return 0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:setErrNo(28);return-1;default:{return-28}}}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_fstat64(fd,buf){try{var stream=SYSCALLS.getStreamFromFD(fd);return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_lstat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.lstat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_newfstatat(dirfd,path,buf,flags){try{path=SYSCALLS.getStr(path);var nofollow=flags&256;var allowEmpty=flags&4096;flags=flags&~6400;path=SYSCALLS.calculateAt(dirfd,path,allowEmpty);return SYSCALLS.doStat(nofollow?FS.lstat:FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_openat(dirfd,path,flags,varargs){SYSCALLS.varargs=varargs;try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);var mode=varargs?SYSCALLS.get():0;return FS.open(path,flags,mode).fd}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var PIPEFS={BUCKET_BUFFER_SIZE:8192,mount(mount){return FS.createNode(null,"/",16384|511,0)},createPipe(){var pipe={buckets:[],refcnt:2};pipe.buckets.push({buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:0,roffset:0});var rName=PIPEFS.nextname();var wName=PIPEFS.nextname();var rNode=FS.createNode(PIPEFS.root,rName,4096,0);var wNode=FS.createNode(PIPEFS.root,wName,4096,0);rNode.pipe=pipe;wNode.pipe=pipe;var readableStream=FS.createStream({path:rName,node:rNode,flags:0,seekable:false,stream_ops:PIPEFS.stream_ops});rNode.stream=readableStream;var writableStream=FS.createStream({path:wName,node:wNode,flags:1,seekable:false,stream_ops:PIPEFS.stream_ops});wNode.stream=writableStream;return{readable_fd:readableStream.fd,writable_fd:writableStream.fd}},stream_ops:{poll(stream){var pipe=stream.node.pipe;if((stream.flags&2097155)===1){return 256|4}if(pipe.buckets.length>0){for(var i=0;i0){return 64|1}}}return 0},ioctl(stream,request,varargs){return 28},fsync(stream){return 28},read(stream,buffer,offset,length,position){var pipe=stream.node.pipe;var currentLength=0;for(var i=0;i=dataLen){currBucket.buffer.set(data,currBucket.offset);currBucket.offset+=dataLen;return dataLen}else if(freeBytesInCurrBuffer>0){currBucket.buffer.set(data.subarray(0,freeBytesInCurrBuffer),currBucket.offset);currBucket.offset+=freeBytesInCurrBuffer;data=data.subarray(freeBytesInCurrBuffer,data.byteLength)}var numBuckets=data.byteLength/PIPEFS.BUCKET_BUFFER_SIZE|0;var remElements=data.byteLength%PIPEFS.BUCKET_BUFFER_SIZE;for(var i=0;i0){var newBucket={buffer:new Uint8Array(PIPEFS.BUCKET_BUFFER_SIZE),offset:data.byteLength,roffset:0};pipe.buckets.push(newBucket);newBucket.buffer.set(data)}return dataLen},close(stream){var pipe=stream.node.pipe;pipe.refcnt--;if(pipe.refcnt===0){pipe.buckets=null}}},nextname(){if(!PIPEFS.nextname.current){PIPEFS.nextname.current=0}return"pipe["+PIPEFS.nextname.current+++"]"}};function ___syscall_pipe(fdPtr){try{if(fdPtr==0){throw new FS.ErrnoError(21)}var res=PIPEFS.createPipe();HEAP32[fdPtr>>2]=res.readable_fd;HEAP32[fdPtr+4>>2]=res.writable_fd;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_poll(fds,nfds,timeout){try{var nonzero=0;for(var i=0;i>2];var events=HEAP16[pollfd+4>>1];var mask=32;var stream=FS.getStream(fd);if(stream){mask=SYSCALLS.DEFAULT_POLLMASK;if(stream.stream_ops.poll){mask=stream.stream_ops.poll(stream,-1)}}mask&=events|8|16;if(mask)nonzero++;HEAP16[pollfd+6>>1]=mask}return nonzero}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_stat64(path,buf){try{path=SYSCALLS.getStr(path);return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}function ___syscall_unlinkat(dirfd,path,flags){try{path=SYSCALLS.getStr(path);path=SYSCALLS.calculateAt(dirfd,path);if(flags===0){FS.unlink(path)}else if(flags===512){FS.rmdir(path)}else{abort("Invalid flags passed to unlinkat")}return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return-e.errno}}var nowIsMonotonic=1;var __emscripten_get_now_is_monotonic=()=>nowIsMonotonic;var convertI32PairToI53Checked=(lo,hi)=>hi+2097152>>>0<4194305-!!lo?(lo>>>0)+hi*4294967296:NaN;function __gmtime_js(time_low,time_high,tmPtr){var time=convertI32PairToI53Checked(time_low,time_high);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getUTCSeconds();HEAP32[tmPtr+4>>2]=date.getUTCMinutes();HEAP32[tmPtr+8>>2]=date.getUTCHours();HEAP32[tmPtr+12>>2]=date.getUTCDate();HEAP32[tmPtr+16>>2]=date.getUTCMonth();HEAP32[tmPtr+20>>2]=date.getUTCFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday}var isLeapYear=year=>year%4===0&&(year%100!==0||year%400===0);var MONTH_DAYS_LEAP_CUMULATIVE=[0,31,60,91,121,152,182,213,244,274,305,335];var MONTH_DAYS_REGULAR_CUMULATIVE=[0,31,59,90,120,151,181,212,243,273,304,334];var ydayFromDate=date=>{var leap=isLeapYear(date.getFullYear());var monthDaysCumulative=leap?MONTH_DAYS_LEAP_CUMULATIVE:MONTH_DAYS_REGULAR_CUMULATIVE;var yday=monthDaysCumulative[date.getMonth()]+date.getDate()-1;return yday};function __localtime_js(time_low,time_high,tmPtr){var time=convertI32PairToI53Checked(time_low,time_high);var date=new Date(time*1e3);HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getFullYear()-1900;HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr+36>>2]=-(date.getTimezoneOffset()*60);var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dst=(summerOffset!=winterOffset&&date.getTimezoneOffset()==Math.min(winterOffset,summerOffset))|0;HEAP32[tmPtr+32>>2]=dst}var __mktime_js=function(tmPtr){var ret=(()=>{var date=new Date(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var dst=HEAP32[tmPtr+32>>2];var guessedOffset=date.getTimezoneOffset();var start=new Date(date.getFullYear(),0,1);var summerOffset=new Date(date.getFullYear(),6,1).getTimezoneOffset();var winterOffset=start.getTimezoneOffset();var dstOffset=Math.min(winterOffset,summerOffset);if(dst<0){HEAP32[tmPtr+32>>2]=Number(summerOffset!=winterOffset&&dstOffset==guessedOffset)}else if(dst>0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}HEAP32[tmPtr+24>>2]=date.getDay();var yday=ydayFromDate(date)|0;HEAP32[tmPtr+28>>2]=yday;HEAP32[tmPtr>>2]=date.getSeconds();HEAP32[tmPtr+4>>2]=date.getMinutes();HEAP32[tmPtr+8>>2]=date.getHours();HEAP32[tmPtr+12>>2]=date.getDate();HEAP32[tmPtr+16>>2]=date.getMonth();HEAP32[tmPtr+20>>2]=date.getYear();var timeMs=date.getTime();if(isNaN(timeMs)){setErrNo(61);return-1}return timeMs/1e3})();return setTempRet0((tempDouble=ret,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)),ret>>>0};var __timegm_js=function(tmPtr){var ret=(()=>{var time=Date.UTC(HEAP32[tmPtr+20>>2]+1900,HEAP32[tmPtr+16>>2],HEAP32[tmPtr+12>>2],HEAP32[tmPtr+8>>2],HEAP32[tmPtr+4>>2],HEAP32[tmPtr>>2],0);var date=new Date(time);HEAP32[tmPtr+24>>2]=date.getUTCDay();var start=Date.UTC(date.getUTCFullYear(),0,1,0,0,0,0);var yday=(date.getTime()-start)/(1e3*60*60*24)|0;HEAP32[tmPtr+28>>2]=yday;return date.getTime()/1e3})();return setTempRet0((tempDouble=ret,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)),ret>>>0};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var stringToNewUTF8=str=>{var size=lengthBytesUTF8(str)+1;var ret=_malloc(size);if(ret)stringToUTF8(str,ret,size);return ret};var __tzset_js=(timezone,daylight,tzname)=>{var currentYear=(new Date).getFullYear();var winter=new Date(currentYear,0,1);var summer=new Date(currentYear,6,1);var winterOffset=winter.getTimezoneOffset();var summerOffset=summer.getTimezoneOffset();var stdTimezoneOffset=Math.max(winterOffset,summerOffset);HEAPU32[timezone>>2]=stdTimezoneOffset*60;HEAP32[daylight>>2]=Number(winterOffset!=summerOffset);function extractZone(date){var match=date.toTimeString().match(/\(([A-Za-z ]+)\)$/);return match?match[1]:"GMT"}var winterName=extractZone(winter);var summerName=extractZone(summer);var winterNamePtr=stringToNewUTF8(winterName);var summerNamePtr=stringToNewUTF8(summerName);if(summerOffset>2]=winterNamePtr;HEAPU32[tzname+4>>2]=summerNamePtr}else{HEAPU32[tzname>>2]=summerNamePtr;HEAPU32[tzname+4>>2]=winterNamePtr}};var _abort=()=>{abort("")};var _emscripten_date_now=()=>Date.now();var _emscripten_get_now;_emscripten_get_now=()=>performance.now();var _emscripten_memcpy_js=(dest,src,num)=>HEAPU8.copyWithin(dest,src,src+num);var getHeapMax=()=>2147483648;var growMemory=size=>{var b=wasmMemory.buffer;var pages=(size-b.byteLength+65535)/65536;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}var alignUp=(x,multiple)=>x+(multiple-x%multiple)%multiple;for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignUp(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var ENV={};var getExecutableName=()=>thisProgram||"./this.program";var getEnvStrings=()=>{if(!getEnvStrings.strings){var lang=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8";var env={"USER":"web_user","LOGNAME":"web_user","PATH":"/","PWD":"/","HOME":"/home/web_user","LANG":lang,"_":getExecutableName()};for(var x in ENV){if(ENV[x]===undefined)delete env[x];else env[x]=ENV[x]}var strings=[];for(var x in env){strings.push(`${x}=${env[x]}`)}getEnvStrings.strings=strings}return getEnvStrings.strings};var stringToAscii=(str,buffer)=>{for(var i=0;i>0]=str.charCodeAt(i)}HEAP8[buffer>>0]=0};var _environ_get=(__environ,environ_buf)=>{var bufSize=0;getEnvStrings().forEach((string,i)=>{var ptr=environ_buf+bufSize;HEAPU32[__environ+i*4>>2]=ptr;stringToAscii(string,ptr);bufSize+=string.length+1});return 0};var _environ_sizes_get=(penviron_count,penviron_buf_size)=>{var strings=getEnvStrings();HEAPU32[penviron_count>>2]=strings.length;var bufSize=0;strings.forEach(string=>bufSize+=string.length+1);HEAPU32[penviron_buf_size>>2]=bufSize;return 0};var runtimeKeepaliveCounter=0;var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;function _fd_close(fd){try{var stream=SYSCALLS.getStreamFromFD(fd);FS.close(stream);return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doReadv=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.read(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(curr>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}function _fd_seek(fd,offset_low,offset_high,whence,newOffset){var offset=convertI32PairToI53Checked(offset_low,offset_high);try{if(isNaN(offset))return 61;var stream=SYSCALLS.getStreamFromFD(fd);FS.llseek(stream,offset,whence);tempI64=[stream.position>>>0,(tempDouble=stream.position,+Math.abs(tempDouble)>=1?tempDouble>0?+Math.floor(tempDouble/4294967296)>>>0:~~+Math.ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[newOffset>>2]=tempI64[0],HEAP32[newOffset+4>>2]=tempI64[1];if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var doWritev=(stream,iov,iovcnt,offset)=>{var ret=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;var curr=FS.write(stream,HEAP8,ptr,len,offset);if(curr<0)return-1;ret+=curr;if(typeof offset!=="undefined"){offset+=curr}}return ret};function _fd_write(fd,iov,iovcnt,pnum){try{var stream=SYSCALLS.getStreamFromFD(fd);var num=doWritev(stream,iov,iovcnt);HEAPU32[pnum>>2]=num;return 0}catch(e){if(typeof FS=="undefined"||!(e.name==="ErrnoError"))throw e;return e.errno}}var arraySum=(array,index)=>{var sum=0;for(var i=0;i<=index;sum+=array[i++]){}return sum};var MONTH_DAYS_LEAP=[31,29,31,30,31,30,31,31,30,31,30,31];var MONTH_DAYS_REGULAR=[31,28,31,30,31,30,31,31,30,31,30,31];var addDays=(date,days)=>{var newDate=new Date(date.getTime());while(days>0){var leap=isLeapYear(newDate.getFullYear());var currentMonth=newDate.getMonth();var daysInCurrentMonth=(leap?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR)[currentMonth];if(days>daysInCurrentMonth-newDate.getDate()){days-=daysInCurrentMonth-newDate.getDate()+1;newDate.setDate(1);if(currentMonth<11){newDate.setMonth(currentMonth+1)}else{newDate.setMonth(0);newDate.setFullYear(newDate.getFullYear()+1)}}else{newDate.setDate(newDate.getDate()+days);return newDate}}return newDate};var writeArrayToMemory=(array,buffer)=>{HEAP8.set(array,buffer)};var _strftime=(s,maxsize,format,tm)=>{var tm_zone=HEAPU32[tm+40>>2];var date={tm_sec:HEAP32[tm>>2],tm_min:HEAP32[tm+4>>2],tm_hour:HEAP32[tm+8>>2],tm_mday:HEAP32[tm+12>>2],tm_mon:HEAP32[tm+16>>2],tm_year:HEAP32[tm+20>>2],tm_wday:HEAP32[tm+24>>2],tm_yday:HEAP32[tm+28>>2],tm_isdst:HEAP32[tm+32>>2],tm_gmtoff:HEAP32[tm+36>>2],tm_zone:tm_zone?UTF8ToString(tm_zone):""};var pattern=UTF8ToString(format);var EXPANSION_RULES_1={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var rule in EXPANSION_RULES_1){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_1[rule])}var WEEKDAYS=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];function leadingSomething(value,digits,character){var str=typeof value=="number"?value.toString():value||"";while(str.length0?1:0}var compare;if((compare=sgn(date1.getFullYear()-date2.getFullYear()))===0){if((compare=sgn(date1.getMonth()-date2.getMonth()))===0){compare=sgn(date1.getDate()-date2.getDate())}}return compare}function getFirstWeekStartDate(janFourth){switch(janFourth.getDay()){case 0:return new Date(janFourth.getFullYear()-1,11,29);case 1:return janFourth;case 2:return new Date(janFourth.getFullYear(),0,3);case 3:return new Date(janFourth.getFullYear(),0,2);case 4:return new Date(janFourth.getFullYear(),0,1);case 5:return new Date(janFourth.getFullYear()-1,11,31);case 6:return new Date(janFourth.getFullYear()-1,11,30)}}function getWeekBasedYear(date){var thisDate=addDays(new Date(date.tm_year+1900,0,1),date.tm_yday);var janFourthThisYear=new Date(thisDate.getFullYear(),0,4);var janFourthNextYear=new Date(thisDate.getFullYear()+1,0,4);var firstWeekStartThisYear=getFirstWeekStartDate(janFourthThisYear);var firstWeekStartNextYear=getFirstWeekStartDate(janFourthNextYear);if(compareByDay(firstWeekStartThisYear,thisDate)<=0){if(compareByDay(firstWeekStartNextYear,thisDate)<=0){return thisDate.getFullYear()+1}return thisDate.getFullYear()}return thisDate.getFullYear()-1}var EXPANSION_RULES_2={"%a":date=>WEEKDAYS[date.tm_wday].substring(0,3),"%A":date=>WEEKDAYS[date.tm_wday],"%b":date=>MONTHS[date.tm_mon].substring(0,3),"%B":date=>MONTHS[date.tm_mon],"%C":date=>{var year=date.tm_year+1900;return leadingNulls(year/100|0,2)},"%d":date=>leadingNulls(date.tm_mday,2),"%e":date=>leadingSomething(date.tm_mday,2," "),"%g":date=>getWeekBasedYear(date).toString().substring(2),"%G":date=>getWeekBasedYear(date),"%H":date=>leadingNulls(date.tm_hour,2),"%I":date=>{var twelveHour=date.tm_hour;if(twelveHour==0)twelveHour=12;else if(twelveHour>12)twelveHour-=12;return leadingNulls(twelveHour,2)},"%j":date=>leadingNulls(date.tm_mday+arraySum(isLeapYear(date.tm_year+1900)?MONTH_DAYS_LEAP:MONTH_DAYS_REGULAR,date.tm_mon-1),3),"%m":date=>leadingNulls(date.tm_mon+1,2),"%M":date=>leadingNulls(date.tm_min,2),"%n":()=>"\n","%p":date=>{if(date.tm_hour>=0&&date.tm_hour<12){return"AM"}return"PM"},"%S":date=>leadingNulls(date.tm_sec,2),"%t":()=>"\t","%u":date=>date.tm_wday||7,"%U":date=>{var days=date.tm_yday+7-date.tm_wday;return leadingNulls(Math.floor(days/7),2)},"%V":date=>{var val=Math.floor((date.tm_yday+7-(date.tm_wday+6)%7)/7);if((date.tm_wday+371-date.tm_yday-2)%7<=2){val++}if(!val){val=52;var dec31=(date.tm_wday+7-date.tm_yday-1)%7;if(dec31==4||dec31==5&&isLeapYear(date.tm_year%400-1)){val++}}else if(val==53){var jan1=(date.tm_wday+371-date.tm_yday)%7;if(jan1!=4&&(jan1!=3||!isLeapYear(date.tm_year)))val=1}return leadingNulls(val,2)},"%w":date=>date.tm_wday,"%W":date=>{var days=date.tm_yday+7-(date.tm_wday+6)%7;return leadingNulls(Math.floor(days/7),2)},"%y":date=>(date.tm_year+1900).toString().substring(2),"%Y":date=>date.tm_year+1900,"%z":date=>{var off=date.tm_gmtoff;var ahead=off>=0;off=Math.abs(off)/60;off=off/60*100+off%60;return(ahead?"+":"-")+String("0000"+off).slice(-4)},"%Z":date=>date.tm_zone,"%%":()=>"%"};pattern=pattern.replace(/%%/g,"\0\0");for(var rule in EXPANSION_RULES_2){if(pattern.includes(rule)){pattern=pattern.replace(new RegExp(rule,"g"),EXPANSION_RULES_2[rule](date))}}pattern=pattern.replace(/\0\0/g,"%");var bytes=intArrayFromString(pattern,false);if(bytes.length>maxsize){return 0}writeArrayToMemory(bytes,s);return bytes.length-1};var getCFunc=ident=>{var func=Module["_"+ident];return func};var stringToUTF8OnStack=str=>{var size=lengthBytesUTF8(str)+1;var ret=stackAlloc(size);stringToUTF8(str,ret,size);return ret};var ccall=(ident,returnType,argTypes,args,opts)=>{var toC={"string":str=>{var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=stringToUTF8OnStack(str)}return ret},"array":arr=>{var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType==="string"){return UTF8ToString(ret)}if(returnType==="boolean")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i{var numericArgs=!argTypes||argTypes.every(type=>type==="number"||type==="boolean");var numericRet=returnType!=="string";if(numericRet&&numericArgs&&!opts){return getCFunc(ident)}return function(){return ccall(ident,returnType,argTypes,arguments,opts)}};var ALLOC_STACK=1;var allocate=(slab,allocator)=>{var ret;if(allocator==ALLOC_STACK){ret=stackAlloc(slab.length)}else{ret=_malloc(slab.length)}if(!slab.subarray&&!slab.slice){slab=new Uint8Array(slab)}HEAPU8.set(slab,ret);return ret};var FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};var readMode=292|73;var writeMode=146;Object.defineProperties(FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}});FS.FSNode=FSNode;FS.createPreloadedFile=FS_createPreloadedFile;FS.staticInit();var wasmImports={i:___syscall_dup,a:___syscall_fcntl64,x:___syscall_fstat64,u:___syscall_lstat64,v:___syscall_newfstatat,y:___syscall_openat,t:___syscall_pipe,s:___syscall_poll,w:___syscall_stat64,q:___syscall_unlinkat,B:__emscripten_get_now_is_monotonic,k:__gmtime_js,l:__localtime_js,m:__mktime_js,n:__timegm_js,r:__tzset_js,b:_abort,c:_emscripten_date_now,h:_emscripten_memcpy_js,p:_emscripten_resize_heap,z:_environ_get,A:_environ_sizes_get,g:_exit,e:_fd_close,j:_fd_read,o:_fd_seek,d:_fd_write,f:_strftime};var wasmExports=createWasm();var ___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports["D"])();var _get_version=Module["_get_version"]=()=>(_get_version=Module["_get_version"]=wasmExports["E"])();var _archive_open=Module["_archive_open"]=(a0,a1,a2,a3)=>(_archive_open=Module["_archive_open"]=wasmExports["F"])(a0,a1,a2,a3);var _archive_read_add_passphrase=Module["_archive_read_add_passphrase"]=(a0,a1)=>(_archive_read_add_passphrase=Module["_archive_read_add_passphrase"]=wasmExports["G"])(a0,a1);var _archive_error_string=Module["_archive_error_string"]=a0=>(_archive_error_string=Module["_archive_error_string"]=wasmExports["H"])(a0);var _get_next_entry=Module["_get_next_entry"]=a0=>(_get_next_entry=Module["_get_next_entry"]=wasmExports["I"])(a0);var _get_filedata=Module["_get_filedata"]=(a0,a1)=>(_get_filedata=Module["_get_filedata"]=wasmExports["J"])(a0,a1);var _malloc=Module["_malloc"]=a0=>(_malloc=Module["_malloc"]=wasmExports["K"])(a0);var _archive_close=Module["_archive_close"]=a0=>(_archive_close=Module["_archive_close"]=wasmExports["L"])(a0);var _start_archive_write=Module["_start_archive_write"]=(a0,a1,a2,a3,a4,a5)=>(_start_archive_write=Module["_start_archive_write"]=wasmExports["M"])(a0,a1,a2,a3,a4,a5);var _write_archive_file=Module["_write_archive_file"]=(a0,a1,a2,a3)=>(_write_archive_file=Module["_write_archive_file"]=wasmExports["N"])(a0,a1,a2,a3);var _size_of_size_t=Module["_size_of_size_t"]=()=>(_size_of_size_t=Module["_size_of_size_t"]=wasmExports["O"])();var _finish_archive_write=Module["_finish_archive_write"]=(a0,a1)=>(_finish_archive_write=Module["_finish_archive_write"]=wasmExports["P"])(a0,a1);var _free=Module["_free"]=a0=>(_free=Module["_free"]=wasmExports["Q"])(a0);var ___errno_location=()=>(___errno_location=wasmExports["R"])();var _archive_entry_birthtime_nsec=Module["_archive_entry_birthtime_nsec"]=a0=>(_archive_entry_birthtime_nsec=Module["_archive_entry_birthtime_nsec"]=wasmExports["S"])(a0);var _archive_entry_filetype=Module["_archive_entry_filetype"]=a0=>(_archive_entry_filetype=Module["_archive_entry_filetype"]=wasmExports["T"])(a0);var _archive_entry_mtime_nsec=Module["_archive_entry_mtime_nsec"]=a0=>(_archive_entry_mtime_nsec=Module["_archive_entry_mtime_nsec"]=wasmExports["U"])(a0);var _archive_entry_pathname=Module["_archive_entry_pathname"]=a0=>(_archive_entry_pathname=Module["_archive_entry_pathname"]=wasmExports["V"])(a0);var _archive_entry_pathname_utf8=Module["_archive_entry_pathname_utf8"]=a0=>(_archive_entry_pathname_utf8=Module["_archive_entry_pathname_utf8"]=wasmExports["W"])(a0);var _archive_entry_size=Module["_archive_entry_size"]=a0=>(_archive_entry_size=Module["_archive_entry_size"]=wasmExports["X"])(a0);var _archive_entry_is_encrypted=Module["_archive_entry_is_encrypted"]=a0=>(_archive_entry_is_encrypted=Module["_archive_entry_is_encrypted"]=wasmExports["Y"])(a0);var _archive_read_has_encrypted_entries=Module["_archive_read_has_encrypted_entries"]=a0=>(_archive_read_has_encrypted_entries=Module["_archive_read_has_encrypted_entries"]=wasmExports["Z"])(a0);var _archive_read_data_skip=Module["_archive_read_data_skip"]=a0=>(_archive_read_data_skip=Module["_archive_read_data_skip"]=wasmExports["_"])(a0);var _htons=a0=>(_htons=wasmExports["htons"])(a0);var _ntohs=a0=>(_ntohs=wasmExports["ntohs"])(a0);var setTempRet0=a0=>(setTempRet0=wasmExports["aa"])(a0);var stackSave=()=>(stackSave=wasmExports["ba"])();var stackRestore=a0=>(stackRestore=wasmExports["ca"])(a0);var stackAlloc=a0=>(stackAlloc=wasmExports["da"])(a0);Module["cwrap"]=cwrap;Module["allocate"]=allocate;var calledRun;dependenciesFulfilled=function runCaller(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=runCaller};function run(){if(runDependencies>0){return}preRun();if(runDependencies>0){return}function doRun(){if(calledRun)return;calledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve(Module);if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}run(); return moduleArg.ready diff --git a/lib/build/libarchive.wasm b/lib/build/libarchive.wasm index 9b9e93b..31fd233 100755 Binary files a/lib/build/libarchive.wasm and b/lib/build/libarchive.wasm differ diff --git a/lib/build/main.o b/lib/build/main.o index a859973..0b690bb 100644 Binary files a/lib/build/main.o and b/lib/build/main.o differ diff --git a/lib/tools/build.sh b/lib/tools/build.sh index 2bfeb04..f2f0b78 100755 --- a/lib/tools/build.sh +++ b/lib/tools/build.sh @@ -3,7 +3,7 @@ emcc ../wrapper/main.c -c -I /usr/local/include/ -o ../build/main.o emcc ../build/main.o /usr/local/lib/libarchive.a /usr/local/lib/liblzma.a /usr/local/lib/libssl.a /usr/local/lib/libcrypto.a \ -o ../build/libarchive.js \ -s USE_ZLIB=1 -s USE_BZIP2=1 -s MODULARIZE=1 -s EXPORT_ES6=1 -s EXPORT_NAME=libarchive -s WASM=1 -O3 -s ALLOW_MEMORY_GROWTH=1 \ - -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap","allocate"]' \ + -s EXPORTED_RUNTIME_METHODS='["cwrap","allocate"]' \ -s EXPORTED_FUNCTIONS=@$PWD/lib.exports -s ERROR_ON_UNDEFINED_SYMBOLS=0 cp ../build/libarchive.js ../../src/webworker/wasm-gen/ diff --git a/lib/tools/lib.exports b/lib/tools/lib.exports index 207bfb9..72358bb 100644 --- a/lib/tools/lib.exports +++ b/lib/tools/lib.exports @@ -20,6 +20,5 @@ "_size_of_size_t", "_start_archive_write", "_write_archive_file", - "_archive_write_close", - "_archive_write_free" + "_finish_archive_write" ] \ No newline at end of file diff --git a/lib/wrapper/main.c b/lib/wrapper/main.c index 84b1337..d0c502d 100644 --- a/lib/wrapper/main.c +++ b/lib/wrapper/main.c @@ -101,7 +101,10 @@ void write_archive_file( void *a, char *pathname, size_t filesize , void *fileda archive_entry_set_filetype(entry, AE_IFREG); archive_entry_set_perm(entry, 0644); archive_write_header(a, entry); - archive_write_data(a, filedata, filesize); + int write_output = archive_write_data(a, filedata, filesize); + if( write_output != filesize ) { + fprintf(stderr, "Error occured while writing file, written bytes don't match file size\n"); + } archive_entry_free(entry); } @@ -109,4 +112,16 @@ void write_archive_file( void *a, char *pathname, size_t filesize , void *fileda EMSCRIPTEN_KEEPALIVE int size_of_size_t(){ return sizeof(size_t); +} + +EMSCRIPTEN_KEEPALIVE +int finish_archive_write(void *a, size_t *outputsize){ + if( archive_write_close(a) != ARCHIVE_OK ){ + return -1; + } + + if( archive_write_free(a) != ARCHIVE_OK ){ + return -1; + } + return *outputsize; } \ No newline at end of file diff --git a/src/webworker/archive-writer.js b/src/webworker/archive-writer.js index dda64c8..bc0bd62 100644 --- a/src/webworker/archive-writer.js +++ b/src/webworker/archive-writer.js @@ -38,15 +38,15 @@ export class ArchiveWriter { this._runCode.free(fileData.ptr); } - const closeStatus = this._runCode.closeArchiveWrite(newArchive); - const freeStatus = this._runCode.freeArchiveWrite(newArchive); + const outputSize = this._runCode.finishArchiveWrite( + newArchive, + outputSizePtr, + ); - if (closeStatus !== 0 || freeStatus !== 0) { + if (outputSize < 0) { throw new Error(this._runCode.getError(newArchive)); } - const outputSize = this.readNumberFromPointer(outputSizePtr); - return this._wasmModule.HEAPU8.slice(bufferPtr, bufferPtr + outputSize); } @@ -60,18 +60,4 @@ export class ArchiveWriter { length: array.length, }; } - - readNumberFromPointer(ptr) { - const ptrSize = this._runCode.sizeOfSizeT(); - const outputSizeBytes = this._wasmModule.HEAPU8.slice(ptr, ptr + ptrSize); - - let output = null; - if (ptrSize == 4) { - output = new Uint32Array(outputSizeBytes)[0]; - } else if (ptrSize == 8) { - output = new BigUint64Array(outputSizeBytes)[0]; - } else throw Error("Unexpected size of size_t: " + ptrSize); - - return output; - } } diff --git a/src/webworker/wasm-gen/libarchive.js b/src/webworker/wasm-gen/libarchive.js index f3931b3..ebc0308 100644 --- a/src/webworker/wasm-gen/libarchive.js +++ b/src/webworker/wasm-gen/libarchive.js @@ -3982,64 +3982,58 @@ var libarchive = (() => { )); var _size_of_size_t = (Module["_size_of_size_t"] = () => (_size_of_size_t = Module["_size_of_size_t"] = wasmExports["O"])()); + var _finish_archive_write = (Module["_finish_archive_write"] = (a0, a1) => + (_finish_archive_write = Module["_finish_archive_write"] = + wasmExports["P"])(a0, a1)); var _free = (Module["_free"] = (a0) => - (_free = Module["_free"] = wasmExports["P"])(a0)); - var ___errno_location = () => (___errno_location = wasmExports["Q"])(); + (_free = Module["_free"] = wasmExports["Q"])(a0)); + var ___errno_location = () => (___errno_location = wasmExports["R"])(); var _archive_entry_birthtime_nsec = (Module[ "_archive_entry_birthtime_nsec" ] = (a0) => (_archive_entry_birthtime_nsec = Module["_archive_entry_birthtime_nsec"] = - wasmExports["R"])(a0)); + wasmExports["S"])(a0)); var _archive_entry_filetype = (Module["_archive_entry_filetype"] = (a0) => (_archive_entry_filetype = Module["_archive_entry_filetype"] = - wasmExports["S"])(a0)); + wasmExports["T"])(a0)); var _archive_entry_mtime_nsec = (Module["_archive_entry_mtime_nsec"] = ( a0, ) => (_archive_entry_mtime_nsec = Module["_archive_entry_mtime_nsec"] = - wasmExports["T"])(a0)); + wasmExports["U"])(a0)); var _archive_entry_pathname = (Module["_archive_entry_pathname"] = (a0) => (_archive_entry_pathname = Module["_archive_entry_pathname"] = - wasmExports["U"])(a0)); + wasmExports["V"])(a0)); var _archive_entry_pathname_utf8 = (Module["_archive_entry_pathname_utf8"] = (a0) => (_archive_entry_pathname_utf8 = Module["_archive_entry_pathname_utf8"] = - wasmExports["V"])(a0)); + wasmExports["W"])(a0)); var _archive_entry_size = (Module["_archive_entry_size"] = (a0) => - (_archive_entry_size = Module["_archive_entry_size"] = wasmExports["W"])( + (_archive_entry_size = Module["_archive_entry_size"] = wasmExports["X"])( a0, )); var _archive_entry_is_encrypted = (Module["_archive_entry_is_encrypted"] = ( a0, ) => (_archive_entry_is_encrypted = Module["_archive_entry_is_encrypted"] = - wasmExports["X"])(a0)); + wasmExports["Y"])(a0)); var _archive_read_has_encrypted_entries = (Module[ "_archive_read_has_encrypted_entries" ] = (a0) => (_archive_read_has_encrypted_entries = Module[ "_archive_read_has_encrypted_entries" ] = - wasmExports["Y"])(a0)); + wasmExports["Z"])(a0)); var _archive_read_data_skip = (Module["_archive_read_data_skip"] = (a0) => (_archive_read_data_skip = Module["_archive_read_data_skip"] = - wasmExports["Z"])(a0)); - var _archive_write_close = (Module["_archive_write_close"] = (a0) => - (_archive_write_close = Module["_archive_write_close"] = - wasmExports["$"])(a0)); - var _archive_write_free = (Module["_archive_write_free"] = (a0) => - (_archive_write_free = Module["_archive_write_free"] = wasmExports["aa"])( - a0, - )); + wasmExports["_"])(a0)); var _htons = (a0) => (_htons = wasmExports["htons"])(a0); var _ntohs = (a0) => (_ntohs = wasmExports["ntohs"])(a0); - var setTempRet0 = (a0) => (setTempRet0 = wasmExports["ba"])(a0); - var stackSave = () => (stackSave = wasmExports["ca"])(); - var stackRestore = (a0) => (stackRestore = wasmExports["da"])(a0); - var stackAlloc = (a0) => (stackAlloc = wasmExports["ea"])(a0); + var setTempRet0 = (a0) => (setTempRet0 = wasmExports["aa"])(a0); + var stackSave = () => (stackSave = wasmExports["ba"])(); + var stackRestore = (a0) => (stackRestore = wasmExports["ca"])(a0); + var stackAlloc = (a0) => (stackAlloc = wasmExports["da"])(a0); Module["cwrap"] = cwrap; - Module["UTF8ToString"] = UTF8ToString; - Module["intArrayFromString"] = intArrayFromString; Module["allocate"] = allocate; var calledRun; dependenciesFulfilled = function runCaller() { diff --git a/src/webworker/wasm-gen/libarchive.wasm b/src/webworker/wasm-gen/libarchive.wasm index 9b9e93b..31fd233 100644 Binary files a/src/webworker/wasm-gen/libarchive.wasm and b/src/webworker/wasm-gen/libarchive.wasm differ diff --git a/src/webworker/wasm-module.js b/src/webworker/wasm-module.js index b0f9cd1..07516d2 100644 --- a/src/webworker/wasm-module.js +++ b/src/webworker/wasm-module.js @@ -79,14 +79,12 @@ export class WasmModule { "number", ]), - // int archive_write_close(struct archive *); - closeArchiveWrite: this.cwrap("archive_write_close", "number", [ + // int finish_archive_write(void *a, size_t *outputsize) + finishArchiveWrite: this.cwrap("finish_archive_write", "number", [ + "number", "number", ]), - // int archive_write_free(struct archive *); - freeArchiveWrite: this.cwrap("archive_write_free", "number", ["number"]), - /* * Returns 1 if the archive contains at least one encrypted entry. * If the archive format not support encryption at all