filens-preview 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -16
- package/dist/all-in-one/THIRD-PARTY-NOTICES.txt +1902 -63
- package/dist/all-in-one/archive/7zz.wasm +0 -0
- package/dist/all-in-one/assets/archive-worker-Cy3bEdVg.js +2 -0
- package/dist/all-in-one/filens.js +5063 -108925
- package/dist/all-in-one/index.html +12 -3
- package/dist/index.d.ts +7 -0
- package/dist/split/THIRD-PARTY-NOTICES.txt +1902 -63
- package/dist/split/archive/7zz.wasm +0 -0
- package/dist/split/assets/archive-worker-Cy3bEdVg.js +2 -0
- package/dist/split/assets/{iwork-worker-DiTOJG8f.js → iwork-worker-B9KPoDW3.js} +17 -17
- package/dist/split/chunks/archive-DMapcEqq.js +1 -0
- package/dist/split/chunks/browser-video-session-CGI8FpX_.js +1 -0
- package/dist/split/chunks/cad-BvXJNqHR.js +7 -0
- package/dist/split/chunks/core-BLayEJn5.js +17 -0
- package/dist/split/chunks/diagram-DlpgioZ9.js +1 -0
- package/dist/split/chunks/docx-Sii3GNtE.js +1 -0
- package/dist/split/chunks/ebook-CLCQfska.js +5 -0
- package/dist/split/chunks/index-BPK_cNTp.js +1 -0
- package/dist/split/chunks/index-DI_GyFX1.js +1 -0
- package/dist/split/chunks/iwork-Datv3D5d.js +4 -0
- package/dist/split/chunks/media-runtime-tb-Q4Sah.js +1 -0
- package/dist/split/chunks/mindmap-B_GYpiFO.js +1 -0
- package/dist/split/chunks/model3d-BsIQNF2D.js +55 -0
- package/dist/split/chunks/mp4box.all-Bw_Tlr0T-D0URDfA1.js +1 -0
- package/dist/split/chunks/panorama-CIdiLIwD.js +973 -0
- package/dist/split/chunks/pdf-Dzzffz3p.js +12 -0
- package/dist/split/chunks/vendor-CBCxJuSg.js +4115 -0
- package/dist/split/chunks/xlsx-D2NFYc3n.js +3 -0
- package/dist/split/converter-image.wasm +0 -0
- package/dist/split/filens.js +2 -4781
- package/dist/split/index.html +12 -3
- package/package.json +2 -2
- package/dist/split/chunks/archive-_cUUL2-3.js +0 -731
- package/dist/split/chunks/cad-Cyh8aipO.js +0 -2405
- package/dist/split/chunks/core-gp02JQ3r.js +0 -14182
- package/dist/split/chunks/diagram-rxvArV-1.js +0 -654
- package/dist/split/chunks/docx-ecvZsSWm.js +0 -299
- package/dist/split/chunks/ebook-5FyKWZ8s.js +0 -623
- package/dist/split/chunks/iwork-DlaehzuR.js +0 -772
- package/dist/split/chunks/media-runtime-DwW7eq4g.js +0 -48
- package/dist/split/chunks/mindmap-D9lNNDoa.js +0 -560
- package/dist/split/chunks/model3d-BtFT01ZH.js +0 -5093
- package/dist/split/chunks/panorama-Ci6DK6sa.js +0 -5960
- package/dist/split/chunks/pdf-CecYOWld.js +0 -17898
- package/dist/split/chunks/vendor-DvWhw-zP.js +0 -54471
- package/dist/split/chunks/xlsx-VJTu9XNS.js +0 -818
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var Bt=Object.defineProperty;var Ut=(Q,j,ae)=>j in Q?Bt(Q,j,{enumerable:!0,configurable:!0,writable:!0,value:ae}):Q[j]=ae;var O=(Q,j,ae)=>Ut(Q,typeof j!="symbol"?j+"":j,ae);(function(){"use strict";var Q=async function(h={}){var ur;var m,u=h,$=typeof window=="object",W=typeof WorkerGlobalScope<"u",A=typeof process=="object"&&((ur=process.versions)==null?void 0:ur.node)&&process.type!="renderer";if(A){const{createRequire:e}=await Promise.resolve().then(function(){return mr});var R=e(self.location.href)}u.noInitialRun=!0;var P=[],C="./this.program",B=(e,r)=>{throw r},N=self.location.href,T="";function _e(e){return u.locateFile?u.locateFile(e,T):T+e}var V,Y;if(A){var ce=R("fs");N.startsWith("file:")&&(T=R("path").dirname(R("url").fileURLToPath(N))+"/"),Y=e=>{e=ee(e)?new URL(e):e;var r=ce.readFileSync(e);return r},V=async(e,r=!0)=>{e=ee(e)?new URL(e):e;var t=ce.readFileSync(e,r?void 0:"utf8");return t},process.argv.length>1&&(C=process.argv[1].replace(/\\/g,"/")),P=process.argv.slice(2),B=(e,r)=>{throw process.exitCode=e,r}}else if($||W){try{T=new URL(".",N).href}catch{}W&&(Y=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),V=async e=>{if(ee(e))return new Promise((t,o)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{if(i.status==200||i.status==0&&i.response){t(i.response);return}o(i.status)},i.onerror=o,i.send(null)});var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)}}var se=console.log.bind(console),z=console.error.bind(console),X,Z=!1,q,ee=e=>e.startsWith("file://"),re,te,ne,w,G,J,d,D,x,xe=!1;function Le(){var e=ne.buffer;w=new Int8Array(e),J=new Int16Array(e),G=new Uint8Array(e),d=new Int32Array(e),D=new Uint32Array(e),x=new BigInt64Array(e),new BigUint64Array(e)}function hr(){if(u.preRun)for(typeof u.preRun=="function"&&(u.preRun=[u.preRun]);u.preRun.length;)Dr(u.preRun.shift());Ue(Oe)}function wr(){xe=!0,!u.noFSInit&&!n.initialized&&n.init(),ue.P(),n.ignorePermissions=!1}function yr(){if(u.postRun)for(typeof u.postRun=="function"&&(u.postRun=[u.postRun]);u.postRun.length;)Ar(u.postRun.shift());Ue(Ie)}var oe=0,ve=null;function Pe(e){var r;oe++,(r=u.monitorRunDependencies)==null||r.call(u,oe)}function be(e){var t;if(oe--,(t=u.monitorRunDependencies)==null||t.call(u,oe),oe==0&&ve){var r=ve;ve=null,r()}}function Se(e){var t;(t=u.onAbort)==null||t.call(u,e),e="Aborted("+e+")",z(e),Z=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw te==null||te(r),r}var Ae;function gr(){if(u.locateFile)return _e("7zz.wasm");throw new Error("The archive host must supply the external WASM URL.")}function pr(e){if(e==Ae&&X)return new Uint8Array(X);if(Y)return Y(e);throw"both async and sync fetching of the wasm failed"}async function _r(e){if(!X)try{var r=await V(e);return new Uint8Array(r)}catch{}return pr(e)}async function Er(e,r){try{var t=await _r(e),o=await WebAssembly.instantiate(t,r);return o}catch(i){z(`failed to asynchronously prepare wasm: ${i}`),Se(i)}}async function kr(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!ee(r)&&!A)try{var o=fetch(r,{credentials:"same-origin"}),i=await WebAssembly.instantiateStreaming(o,t);return i}catch(a){z(`wasm streaming compile failed: ${a}`),z("falling back to ArrayBuffer instantiation")}return Er(r,t)}function br(){return{a:Lt}}async function Sr(){function e(a,s){return ue=a.exports,ne=ue.O,Le(),$e=ue.R,xt(ue),be(),ue}Pe();function r(a){return e(a.instance)}var t=br();if(u.instantiateWasm)return new Promise((a,s)=>{u.instantiateWasm(t,(f,l)=>{a(e(f))})});Ae??(Ae=gr());var o=await kr(X,Ae,t),i=r(o);return i}class Be{constructor(r){O(this,"name","ExitStatus");this.message=`Program terminated with exit(${r})`,this.status=r}}var Ue=e=>{for(;e.length>0;)e.shift()(u)},Ie=[],Ar=e=>Ie.push(e),Oe=[],Dr=e=>Oe.push(e),De=!0,je=[],$e,Fr=e=>{var r=je[e];return r||(je[e]=r=$e.get(e)),r},Tr=(e,r)=>Fr(e)(r);class Mr{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){D[this.ptr+4>>2]=r}get_type(){return D[this.ptr+4>>2]}set_destructor(r){D[this.ptr+8>>2]=r}get_destructor(){return D[this.ptr+8>>2]}set_caught(r){r=r?1:0,w[this.ptr+12]=r}get_caught(){return w[this.ptr+12]!=0}set_rethrown(r){r=r?1:0,w[this.ptr+13]=r}get_rethrown(){return w[this.ptr+13]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){D[this.ptr+16>>2]=r}get_adjusted_ptr(){return D[this.ptr+16>>2]}}var He=0,Rr=(e,r,t)=>{var o=new Mr(e);throw o.init(r,t),He=e,He},S={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,o=e.length-1;o>=0;o--){var i=e[o];i==="."?e.splice(o,1):i===".."?(e.splice(o,1),t++):t&&(e.splice(o,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=S.isAbs(e),t=e.slice(-1)==="/";return e=S.normalizeArray(e.split("/").filter(o=>!!o),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=S.splitPath(e),t=r[0],o=r[1];return!t&&!o?".":(o&&(o=o.slice(0,-1)),t+o)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>S.normalize(e.join("/")),join2:(e,r)=>S.normalize(e+"/"+r)},Cr=()=>{if(A){var e=R("crypto");return r=>e.randomFillSync(r)}return r=>crypto.getRandomValues(r)},We=e=>{(We=Cr())(e)},fe={resolve:(...e)=>{for(var r="",t=!1,o=e.length-1;o>=-1&&!t;o--){var i=o>=0?e[o]:n.cwd();if(typeof i!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";r=i+"/"+r,t=S.isAbs(i)}return r=S.normalizeArray(r.split("/").filter(a=>!!a),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{e=fe.resolve(e).slice(1),r=fe.resolve(r).slice(1);function t(c){for(var E=0;E<c.length&&c[E]==="";E++);for(var _=c.length-1;_>=0&&c[_]==="";_--);return E>_?[]:c.slice(E,_-E+1)}for(var o=t(e.split("/")),i=t(r.split("/")),a=Math.min(o.length,i.length),s=a,f=0;f<a;f++)if(o[f]!==i[f]){s=f;break}for(var l=[],f=s;f<o.length;f++)l.push("..");return l=l.concat(i.slice(s)),l.join("/")}},Ve=typeof TextDecoder<"u"?new TextDecoder:void 0,le=(e,r=0,t=NaN)=>{for(var o=r+t,i=r;e[i]&&!(i>=o);)++i;if(i-r>16&&e.buffer&&Ve)return Ve.decode(e.subarray(r,i));for(var a="";r<i;){var s=e[r++];if(!(s&128)){a+=String.fromCharCode(s);continue}var f=e[r++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|f);continue}var l=e[r++]&63;if((s&240)==224?s=(s&15)<<12|f<<6|l:s=(s&7)<<18|f<<12|l<<6|e[r++]&63,s<65536)a+=String.fromCharCode(s);else{var c=s-65536;a+=String.fromCharCode(55296|c>>10,56320|c&1023)}}return a},Fe=[],me=e=>{for(var r=0,t=0;t<e.length;++t){var o=e.charCodeAt(t);o<=127?r++:o<=2047?r+=2:o>=55296&&o<=57343?(r+=4,++t):r+=3}return r},Ye=(e,r,t,o)=>{if(!(o>0))return 0;for(var i=t,a=t+o-1,s=0;s<e.length;++s){var f=e.codePointAt(s);if(f<=127){if(t>=a)break;r[t++]=f}else if(f<=2047){if(t+1>=a)break;r[t++]=192|f>>6,r[t++]=128|f&63}else if(f<=65535){if(t+2>=a)break;r[t++]=224|f>>12,r[t++]=128|f>>6&63,r[t++]=128|f&63}else{if(t+3>=a)break;r[t++]=240|f>>18,r[t++]=128|f>>12&63,r[t++]=128|f>>6&63,r[t++]=128|f&63,s++}}return r[t]=0,t-i},Te=(e,r,t)=>{var o=me(e)+1,i=new Array(o),a=Ye(e,i,0,i.length);return i.length=a,i},Nr=()=>{if(!Fe.length){var e=null;if(A){var r=256,t=Buffer.alloc(r),o=0,i=process.stdin.fd;try{o=ce.readSync(i,t,0,r)}catch(a){if(a.toString().includes("EOF"))o=0;else throw a}o>0&&(e=t.slice(0,o).toString("utf-8"))}else typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
2
|
+
`));if(!e)return null;Fe=Te(e)}return Fe.shift()},ie={ttys:[],init(){},shutdown(){},register(e,r){ie.ttys[e]={input:[],output:[],ops:r},n.registerDevice(e,ie.stream_ops)},stream_ops:{open(e){var r=ie.ttys[e.node.rdev];if(!r)throw new n.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,o,i){if(!e.tty||!e.tty.ops.get_char)throw new n.ErrnoError(60);for(var a=0,s=0;s<o;s++){var f;try{f=e.tty.ops.get_char(e.tty)}catch{throw new n.ErrnoError(29)}if(f===void 0&&a===0)throw new n.ErrnoError(6);if(f==null)break;a++,r[t+s]=f}return a&&(e.node.atime=Date.now()),a},write(e,r,t,o,i){if(!e.tty||!e.tty.ops.put_char)throw new n.ErrnoError(60);try{for(var a=0;a<o;a++)e.tty.ops.put_char(e.tty,r[t+a])}catch{throw new n.ErrnoError(29)}return o&&(e.node.mtime=e.node.ctime=Date.now()),a}},default_tty_ops:{get_char(e){return Nr()},put_char(e,r){r===null||r===10?(se(le(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){var r;((r=e.output)==null?void 0:r.length)>0&&(se(le(e.output)),e.output=[])},ioctl_tcgets(e){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(e,r,t){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,r){r===null||r===10?(z(le(e.output)),e.output=[]):r!=0&&e.output.push(r)},fsync(e){var r;((r=e.output)==null?void 0:r.length)>0&&(z(le(e.output)),e.output=[])}}},Xe=e=>{Se()},y={ops_table:null,mount(e){return y.createNode(null,"/",16895,0)},createNode(e,r,t,o){if(n.isBlkdev(t)||n.isFIFO(t))throw new n.ErrnoError(63);y.ops_table||(y.ops_table={dir:{node:{getattr:y.node_ops.getattr,setattr:y.node_ops.setattr,lookup:y.node_ops.lookup,mknod:y.node_ops.mknod,rename:y.node_ops.rename,unlink:y.node_ops.unlink,rmdir:y.node_ops.rmdir,readdir:y.node_ops.readdir,symlink:y.node_ops.symlink},stream:{llseek:y.stream_ops.llseek}},file:{node:{getattr:y.node_ops.getattr,setattr:y.node_ops.setattr},stream:{llseek:y.stream_ops.llseek,read:y.stream_ops.read,write:y.stream_ops.write,mmap:y.stream_ops.mmap,msync:y.stream_ops.msync}},link:{node:{getattr:y.node_ops.getattr,setattr:y.node_ops.setattr,readlink:y.node_ops.readlink},stream:{}},chrdev:{node:{getattr:y.node_ops.getattr,setattr:y.node_ops.setattr},stream:n.chrdev_stream_ops}});var i=n.createNode(e,r,t,o);return n.isDir(i.mode)?(i.node_ops=y.ops_table.dir.node,i.stream_ops=y.ops_table.dir.stream,i.contents={}):n.isFile(i.mode)?(i.node_ops=y.ops_table.file.node,i.stream_ops=y.ops_table.file.stream,i.usedBytes=0,i.contents=null):n.isLink(i.mode)?(i.node_ops=y.ops_table.link.node,i.stream_ops=y.ops_table.link.stream):n.isChrdev(i.mode)&&(i.node_ops=y.ops_table.chrdev.node,i.stream_ops=y.ops_table.chrdev.stream),i.atime=i.mtime=i.ctime=Date.now(),e&&(e.contents[r]=i,e.atime=e.mtime=e.ctime=i.atime),i},getFileDataAsTypedArray(e){return 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)){var o=1024*1024;r=Math.max(r,t*(t<o?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var i=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(r==0)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=n.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,n.isDir(e.mode)?r.size=4096:n.isFile(e.mode)?r.size=e.usedBytes:n.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){for(const t of["mode","atime","mtime","ctime"])r[t]!=null&&(e[t]=r[t]);r.size!==void 0&&y.resizeFileStorage(e,r.size)},lookup(e,r){throw y.doesNotExistError},mknod(e,r,t,o){return y.createNode(e,r,t,o)},rename(e,r,t){var o;try{o=n.lookupNode(r,t)}catch{}if(o){if(n.isDir(e.mode))for(var i in o.contents)throw new n.ErrnoError(55);n.hashRemoveNode(o)}delete e.parent.contents[e.name],r.contents[t]=e,e.name=t,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.contents[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var t=n.lookupNode(e,r);for(var o in t.contents)throw new n.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,r,t){var o=y.createNode(e,r,41471,0);return o.link=t,o},readlink(e){if(!n.isLink(e.mode))throw new n.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,o,i){var a=e.node.contents;if(i>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-i,o);if(s>8&&a.subarray)r.set(a.subarray(i,i+s),t);else for(var f=0;f<s;f++)r[t+f]=a[i+f];return s},write(e,r,t,o,i,a){if(r.buffer===w.buffer&&(a=!1),!o)return 0;var s=e.node;if(s.mtime=s.ctime=Date.now(),r.subarray&&(!s.contents||s.contents.subarray)){if(a)return s.contents=r.subarray(t,t+o),s.usedBytes=o,o;if(s.usedBytes===0&&i===0)return s.contents=r.slice(t,t+o),s.usedBytes=o,o;if(i+o<=s.usedBytes)return s.contents.set(r.subarray(t,t+o),i),o}if(y.expandFileStorage(s,i+o),s.contents.subarray&&r.subarray)s.contents.set(r.subarray(t,t+o),i);else for(var f=0;f<o;f++)s.contents[i+f]=r[t+f];return s.usedBytes=Math.max(s.usedBytes,i+o),o},llseek(e,r,t){var o=r;if(t===1?o+=e.position:t===2&&n.isFile(e.node.mode)&&(o+=e.node.usedBytes),o<0)throw new n.ErrnoError(28);return o},mmap(e,r,t,o,i){if(!n.isFile(e.node.mode))throw new n.ErrnoError(43);var a,s,f=e.node.contents;if(!(i&2)&&f&&f.buffer===w.buffer)s=!1,a=f.byteOffset;else{if(s=!0,a=Xe(),!a)throw new n.ErrnoError(48);f&&((t>0||t+r<f.length)&&(f.subarray?f=f.subarray(t,t+r):f=Array.prototype.slice.call(f,t,t+r)),w.set(f,a))}return{ptr:a,allocated:s}},msync(e,r,t,o,i){return y.stream_ops.write(e,r,0,o,t,!1),0}}},zr=async e=>{var r=await V(e);return new Uint8Array(r)},xr=(...e)=>n.createDataFile(...e),Ge=[],Lr=(e,r,t,o)=>{typeof Browser<"u"&&Browser.init();var i=!1;return Ge.forEach(a=>{i||a.canHandle(r)&&(a.handle(e,r,t,o),i=!0)}),i},Pr=(e,r,t,o,i,a,s,f,l,c)=>{var E=r?fe.resolve(S.join2(e,r)):e;function _(k){function v(p){c==null||c(),f||xr(e,r,p,o,i,l),a==null||a(),be()}Lr(k,E,v,()=>{s==null||s(),be()})||v(k)}Pe(),typeof t=="string"?zr(t).then(_,s):_(t)},Br=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=r[e];if(typeof t>"u")throw new Error(`Unknown file open mode: ${e}`);return t},Me=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},n={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:class{constructor(e){O(this,"name","ErrnoError");this.errno=e}},FSStream:class{constructor(){O(this,"shared",{})}get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,r,t,o){O(this,"node_ops",{});O(this,"stream_ops",{});O(this,"readMode",365);O(this,"writeMode",146);O(this,"mounted",null);e||(e=this),this.parent=e,this.mount=e.mount,this.id=n.nextInode++,this.name=r,this.mode=t,this.rdev=o,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return n.isDir(this.mode)}get isDevice(){return n.isChrdev(this.mode)}},lookupPath(e,r={}){if(!e)throw new n.ErrnoError(44);r.follow_mount??(r.follow_mount=!0),S.isAbs(e)||(e=n.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var o=e.split("/").filter(c=>!!c),i=n.root,a="/",s=0;s<o.length;s++){var f=s===o.length-1;if(f&&r.parent)break;if(o[s]!=="."){if(o[s]===".."){if(a=S.dirname(a),n.isRoot(i)){e=a+"/"+o.slice(s+1).join("/");continue e}else i=i.parent;continue}a=S.join2(a,o[s]);try{i=n.lookupNode(i,o[s])}catch(c){if((c==null?void 0:c.errno)===44&&f&&r.noent_okay)return{path:a};throw c}if(n.isMountpoint(i)&&(!f||r.follow_mount)&&(i=i.mounted.root),n.isLink(i.mode)&&(!f||r.follow)){if(!i.node_ops.readlink)throw new n.ErrnoError(52);var l=i.node_ops.readlink(i);S.isAbs(l)||(l=S.dirname(a)+"/"+l),e=l+"/"+o.slice(s+1).join("/");continue e}}}return{path:a,node:i}}throw new n.ErrnoError(32)},getPath(e){for(var r;;){if(n.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,o=0;o<r.length;o++)t=(t<<5)-t+r.charCodeAt(o)|0;return(e+t>>>0)%n.nameTable.length},hashAddNode(e){var r=n.hashName(e.parent.id,e.name);e.name_next=n.nameTable[r],n.nameTable[r]=e},hashRemoveNode(e){var r=n.hashName(e.parent.id,e.name);if(n.nameTable[r]===e)n.nameTable[r]=e.name_next;else for(var t=n.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=n.mayLookup(e);if(t)throw new n.ErrnoError(t);for(var o=n.hashName(e.id,r),i=n.nameTable[o];i;i=i.name_next){var a=i.name;if(i.parent.id===e.id&&a===r)return i}return n.lookup(e,r)},createNode(e,r,t,o){var i=new n.FSNode(e,r,t,o);return n.hashAddNode(i),i},destroyNode(e){n.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions(e,r){return n.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!n.isDir(e.mode))return 54;var r=n.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate(e,r){if(!n.isDir(e.mode))return 54;try{var t=n.lookupNode(e,r);return 20}catch{}return n.nodePermissions(e,"wx")},mayDelete(e,r,t){var o;try{o=n.lookupNode(e,r)}catch(a){return a.errno}var i=n.nodePermissions(e,"wx");if(i)return i;if(t){if(!n.isDir(o.mode))return 54;if(n.isRoot(o)||n.getPath(o)===n.cwd())return 10}else if(n.isDir(o.mode))return 31;return 0},mayOpen(e,r){return e?n.isLink(e.mode)?32:n.isDir(e.mode)&&(n.flagsToPermissionString(r)!=="r"||r&576)?31:n.nodePermissions(e,n.flagsToPermissionString(r)):44},checkOpExists(e,r){if(!e)throw new n.ErrnoError(r);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=n.MAX_OPEN_FDS;e++)if(!n.streams[e])return e;throw new n.ErrnoError(33)},getStreamChecked(e){var r=n.getStream(e);if(!r)throw new n.ErrnoError(8);return r},getStream:e=>n.streams[e],createStream(e,r=-1){return e=Object.assign(new n.FSStream,e),r==-1&&(r=n.nextfd()),e.fd=r,n.streams[r]=e,e},closeStream(e){n.streams[e]=null},dupStream(e,r=-1){var o,i;var t=n.createStream(e,r);return(i=(o=t.stream_ops)==null?void 0:o.dup)==null||i.call(o,t),t},doSetAttr(e,r,t){var o=e==null?void 0:e.stream_ops.setattr,i=o?e:r;o??(o=r.node_ops.setattr),n.checkOpExists(o,63),o(i,t)},chrdev_stream_ops:{open(e){var t,o;var r=n.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,(o=(t=e.stream_ops).open)==null||o.call(t,e)},llseek(){throw new n.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice(e,r){n.devices[e]={stream_ops:r}},getDevice:e=>n.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var o=t.pop();r.push(o),t.push(...o.mounts)}return r},syncfs(e,r){typeof e=="function"&&(r=e,e=!1),n.syncFSRequests++,n.syncFSRequests>1&&z(`warning: ${n.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=n.getMounts(n.root.mount),o=0;function i(s){return n.syncFSRequests--,r(s)}function a(s){if(s)return a.errored?void 0:(a.errored=!0,i(s));++o>=t.length&&i(null)}t.forEach(s=>{if(!s.type.syncfs)return a(null);s.type.syncfs(s,e,a)})},mount(e,r,t){var o=t==="/",i=!t,a;if(o&&n.root)throw new n.ErrnoError(10);if(!o&&!i){var s=n.lookupPath(t,{follow_mount:!1});if(t=s.path,a=s.node,n.isMountpoint(a))throw new n.ErrnoError(10);if(!n.isDir(a.mode))throw new n.ErrnoError(54)}var f={type:e,opts:r,mountpoint:t,mounts:[]},l=e.mount(f);return l.mount=f,f.root=l,o?n.root=l:a&&(a.mounted=f,a.mount&&a.mount.mounts.push(f)),l},unmount(e){var r=n.lookupPath(e,{follow_mount:!1});if(!n.isMountpoint(r.node))throw new n.ErrnoError(28);var t=r.node,o=t.mounted,i=n.getMounts(o);Object.keys(n.nameTable).forEach(s=>{for(var f=n.nameTable[s];f;){var l=f.name_next;i.includes(f.mount)&&n.destroyNode(f),f=l}}),t.mounted=null;var a=t.mount.mounts.indexOf(o);t.mount.mounts.splice(a,1)},lookup(e,r){return e.node_ops.lookup(e,r)},mknod(e,r,t){var o=n.lookupPath(e,{parent:!0}),i=o.node,a=S.basename(e);if(!a)throw new n.ErrnoError(28);if(a==="."||a==="..")throw new n.ErrnoError(20);var s=n.mayCreate(i,a);if(s)throw new n.ErrnoError(s);if(!i.node_ops.mknod)throw new n.ErrnoError(63);return i.node_ops.mknod(i,a,r,t)},statfs(e){return n.statfsNode(n.lookupPath(e,{follow:!0}).node)},statfsStream(e){return n.statfsNode(e.node)},statfsNode(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:n.nextInode,ffree:n.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(r,e.node_ops.statfs(e.mount.opts.root)),r},create(e,r=438){return r&=4095,r|=32768,n.mknod(e,r,0)},mkdir(e,r=511){return r&=1023,r|=16384,n.mknod(e,r,0)},mkdirTree(e,r){var t=e.split("/"),o="";for(var i of t)if(i){(o||S.isAbs(e))&&(o+="/"),o+=i;try{n.mkdir(o,r)}catch(a){if(a.errno!=20)throw a}}},mkdev(e,r,t){return typeof t>"u"&&(t=r,r=438),r|=8192,n.mknod(e,r,t)},symlink(e,r){if(!fe.resolve(e))throw new n.ErrnoError(44);var t=n.lookupPath(r,{parent:!0}),o=t.node;if(!o)throw new n.ErrnoError(44);var i=S.basename(r),a=n.mayCreate(o,i);if(a)throw new n.ErrnoError(a);if(!o.node_ops.symlink)throw new n.ErrnoError(63);return o.node_ops.symlink(o,i,e)},rename(e,r){var t=S.dirname(e),o=S.dirname(r),i=S.basename(e),a=S.basename(r),s,f,l;if(s=n.lookupPath(e,{parent:!0}),f=s.node,s=n.lookupPath(r,{parent:!0}),l=s.node,!f||!l)throw new n.ErrnoError(44);if(f.mount!==l.mount)throw new n.ErrnoError(75);var c=n.lookupNode(f,i),E=fe.relative(e,o);if(E.charAt(0)!==".")throw new n.ErrnoError(28);if(E=fe.relative(r,t),E.charAt(0)!==".")throw new n.ErrnoError(55);var _;try{_=n.lookupNode(l,a)}catch{}if(c!==_){var k=n.isDir(c.mode),v=n.mayDelete(f,i,k);if(v)throw new n.ErrnoError(v);if(v=_?n.mayDelete(l,a,k):n.mayCreate(l,a),v)throw new n.ErrnoError(v);if(!f.node_ops.rename)throw new n.ErrnoError(63);if(n.isMountpoint(c)||_&&n.isMountpoint(_))throw new n.ErrnoError(10);if(l!==f&&(v=n.nodePermissions(f,"w"),v))throw new n.ErrnoError(v);n.hashRemoveNode(c);try{f.node_ops.rename(c,l,a),c.parent=l}catch(p){throw p}finally{n.hashAddNode(c)}}},rmdir(e){var r=n.lookupPath(e,{parent:!0}),t=r.node,o=S.basename(e),i=n.lookupNode(t,o),a=n.mayDelete(t,o,!0);if(a)throw new n.ErrnoError(a);if(!t.node_ops.rmdir)throw new n.ErrnoError(63);if(n.isMountpoint(i))throw new n.ErrnoError(10);t.node_ops.rmdir(t,o),n.destroyNode(i)},readdir(e){var r=n.lookupPath(e,{follow:!0}),t=r.node,o=n.checkOpExists(t.node_ops.readdir,54);return o(t)},unlink(e){var r=n.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new n.ErrnoError(44);var o=S.basename(e),i=n.lookupNode(t,o),a=n.mayDelete(t,o,!1);if(a)throw new n.ErrnoError(a);if(!t.node_ops.unlink)throw new n.ErrnoError(63);if(n.isMountpoint(i))throw new n.ErrnoError(10);t.node_ops.unlink(t,o),n.destroyNode(i)},readlink(e){var r=n.lookupPath(e),t=r.node;if(!t)throw new n.ErrnoError(44);if(!t.node_ops.readlink)throw new n.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,r){var t=n.lookupPath(e,{follow:!r}),o=t.node,i=n.checkOpExists(o.node_ops.getattr,63);return i(o)},fstat(e){var r=n.getStreamChecked(e),t=r.node,o=r.stream_ops.getattr,i=o?r:t;return o??(o=t.node_ops.getattr),n.checkOpExists(o,63),o(i)},lstat(e){return n.stat(e,!0)},doChmod(e,r,t,o){n.doSetAttr(e,r,{mode:t&4095|r.mode&-4096,ctime:Date.now(),dontFollow:o})},chmod(e,r,t){var o;if(typeof e=="string"){var i=n.lookupPath(e,{follow:!t});o=i.node}else o=e;n.doChmod(null,o,r,t)},lchmod(e,r){n.chmod(e,r,!0)},fchmod(e,r){var t=n.getStreamChecked(e);n.doChmod(t,t.node,r,!1)},doChown(e,r,t){n.doSetAttr(e,r,{timestamp:Date.now(),dontFollow:t})},chown(e,r,t,o){var i;if(typeof e=="string"){var a=n.lookupPath(e,{follow:!o});i=a.node}else i=e;n.doChown(null,i,o)},lchown(e,r,t){n.chown(e,r,t,!0)},fchown(e,r,t){var o=n.getStreamChecked(e);n.doChown(o,o.node,!1)},doTruncate(e,r,t){if(n.isDir(r.mode))throw new n.ErrnoError(31);if(!n.isFile(r.mode))throw new n.ErrnoError(28);var o=n.nodePermissions(r,"w");if(o)throw new n.ErrnoError(o);n.doSetAttr(e,r,{size:t,timestamp:Date.now()})},truncate(e,r){if(r<0)throw new n.ErrnoError(28);var t;if(typeof e=="string"){var o=n.lookupPath(e,{follow:!0});t=o.node}else t=e;n.doTruncate(null,t,r)},ftruncate(e,r){var t=n.getStreamChecked(e);if(r<0||!(t.flags&2097155))throw new n.ErrnoError(28);n.doTruncate(t,t.node,r)},utime(e,r,t){var o=n.lookupPath(e,{follow:!0}),i=o.node,a=n.checkOpExists(i.node_ops.setattr,63);a(i,{atime:r,mtime:t})},open(e,r,t=438){if(e==="")throw new n.ErrnoError(44);r=typeof r=="string"?Br(r):r,r&64?t=t&4095|32768:t=0;var o,i;if(typeof e=="object")o=e;else{i=e.endsWith("/");var a=n.lookupPath(e,{follow:!(r&131072),noent_okay:!0});o=a.node,e=a.path}var s=!1;if(r&64)if(o){if(r&128)throw new n.ErrnoError(20)}else{if(i)throw new n.ErrnoError(31);o=n.mknod(e,t|511,0),s=!0}if(!o)throw new n.ErrnoError(44);if(n.isChrdev(o.mode)&&(r&=-513),r&65536&&!n.isDir(o.mode))throw new n.ErrnoError(54);if(!s){var f=n.mayOpen(o,r);if(f)throw new n.ErrnoError(f)}r&512&&!s&&n.truncate(o,0),r&=-131713;var l=n.createStream({node:o,path:n.getPath(o),flags:r,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return l.stream_ops.open&&l.stream_ops.open(l),s&&n.chmod(o,t&511),u.logReadFiles&&!(r&1)&&(e in n.readFiles||(n.readFiles[e]=1)),l},close(e){if(n.isClosed(e))throw new n.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{n.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,r,t){if(n.isClosed(e))throw new n.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new n.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new n.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,o,i){if(o<0||i<0)throw new n.ErrnoError(28);if(n.isClosed(e))throw new n.ErrnoError(8);if((e.flags&2097155)===1)throw new n.ErrnoError(8);if(n.isDir(e.node.mode))throw new n.ErrnoError(31);if(!e.stream_ops.read)throw new n.ErrnoError(28);var a=typeof i<"u";if(!a)i=e.position;else if(!e.seekable)throw new n.ErrnoError(70);var s=e.stream_ops.read(e,r,t,o,i);return a||(e.position+=s),s},write(e,r,t,o,i,a){if(o<0||i<0)throw new n.ErrnoError(28);if(n.isClosed(e))throw new n.ErrnoError(8);if(!(e.flags&2097155))throw new n.ErrnoError(8);if(n.isDir(e.node.mode))throw new n.ErrnoError(31);if(!e.stream_ops.write)throw new n.ErrnoError(28);e.seekable&&e.flags&1024&&n.llseek(e,0,2);var s=typeof i<"u";if(!s)i=e.position;else if(!e.seekable)throw new n.ErrnoError(70);var f=e.stream_ops.write(e,r,t,o,i,a);return s||(e.position+=f),f},mmap(e,r,t,o,i){if(o&2&&!(i&2)&&(e.flags&2097155)!==2)throw new n.ErrnoError(2);if((e.flags&2097155)===1)throw new n.ErrnoError(2);if(!e.stream_ops.mmap)throw new n.ErrnoError(43);if(!r)throw new n.ErrnoError(28);return e.stream_ops.mmap(e,r,t,o,i)},msync(e,r,t,o,i){return e.stream_ops.msync?e.stream_ops.msync(e,r,t,o,i):0},ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new n.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error(`Invalid encoding type "${r.encoding}"`);var t=n.open(e,r.flags),o=n.stat(e),i=o.size,a=new Uint8Array(i);return n.read(t,a,0,i,0),r.encoding==="utf8"&&(a=le(a)),n.close(t),a},writeFile(e,r,t={}){t.flags=t.flags||577;var o=n.open(e,t.flags,t.mode);if(typeof r=="string"&&(r=new Uint8Array(Te(r))),ArrayBuffer.isView(r))n.write(o,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");n.close(o)},cwd:()=>n.currentPath,chdir(e){var r=n.lookupPath(e,{follow:!0});if(r.node===null)throw new n.ErrnoError(44);if(!n.isDir(r.node.mode))throw new n.ErrnoError(54);var t=n.nodePermissions(r.node,"x");if(t)throw new n.ErrnoError(t);n.currentPath=r.path},createDefaultDirectories(){n.mkdir("/tmp"),n.mkdir("/home"),n.mkdir("/home/web_user")},createDefaultDevices(){n.mkdir("/dev"),n.registerDevice(n.makedev(1,3),{read:()=>0,write:(o,i,a,s,f)=>s,llseek:()=>0}),n.mkdev("/dev/null",n.makedev(1,3)),ie.register(n.makedev(5,0),ie.default_tty_ops),ie.register(n.makedev(6,0),ie.default_tty1_ops),n.mkdev("/dev/tty",n.makedev(5,0)),n.mkdev("/dev/tty1",n.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(r===0&&(We(e),r=e.byteLength),e[--r]);n.createDevice("/dev","random",t),n.createDevice("/dev","urandom",t),n.mkdir("/dev/shm"),n.mkdir("/dev/shm/tmp")},createSpecialDirectories(){n.mkdir("/proc");var e=n.mkdir("/proc/self");n.mkdir("/proc/self/fd"),n.mount({mount(){var r=n.createNode(e,"fd",16895,73);return r.stream_ops={llseek:y.stream_ops.llseek},r.node_ops={lookup(t,o){var i=+o,a=n.getStreamChecked(i),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>a.path},id:i+1};return s.parent=s,s},readdir(){return Array.from(n.streams.entries()).filter(([t,o])=>o).map(([t,o])=>t.toString())}},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?n.createDevice("/dev","stdin",e):n.symlink("/dev/tty","/dev/stdin"),r?n.createDevice("/dev","stdout",null,r):n.symlink("/dev/tty","/dev/stdout"),t?n.createDevice("/dev","stderr",null,t):n.symlink("/dev/tty1","/dev/stderr"),n.open("/dev/stdin",0),n.open("/dev/stdout",1),n.open("/dev/stderr",1)},staticInit(){n.nameTable=new Array(4096),n.mount(y,{},"/"),n.createDefaultDirectories(),n.createDefaultDevices(),n.createSpecialDirectories(),n.filesystems={MEMFS:y}},init(e,r,t){n.initialized=!0,e??(e=u.stdin),r??(r=u.stdout),t??(t=u.stderr),n.createStandardStreams(e,r,t)},quit(){n.initialized=!1;for(var e of n.streams)e&&n.close(e)},findObject(e,r){var t=n.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=n.lookupPath(e,{follow:!r});e=t.path}catch{}var o={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=n.lookupPath(e,{parent:!0});o.parentExists=!0,o.parentPath=t.path,o.parentObject=t.node,o.name=S.basename(e),t=n.lookupPath(e,{follow:!r}),o.exists=!0,o.path=t.path,o.object=t.node,o.name=t.node.name,o.isRoot=t.path==="/"}catch(i){o.error=i.errno}return o},createPath(e,r,t,o){e=typeof e=="string"?e:n.getPath(e);for(var i=r.split("/").reverse();i.length;){var a=i.pop();if(a){var s=S.join2(e,a);try{n.mkdir(s)}catch(f){if(f.errno!=20)throw f}e=s}}return s},createFile(e,r,t,o,i){var a=S.join2(typeof e=="string"?e:n.getPath(e),r),s=Me(o,i);return n.create(a,s)},createDataFile(e,r,t,o,i,a){var s=r;e&&(e=typeof e=="string"?e:n.getPath(e),s=r?S.join2(e,r):e);var f=Me(o,i),l=n.create(s,f);if(t){if(typeof t=="string"){for(var c=new Array(t.length),E=0,_=t.length;E<_;++E)c[E]=t.charCodeAt(E);t=c}n.chmod(l,f|146);var k=n.open(l,577);n.write(k,t,0,t.length,0,a),n.close(k),n.chmod(l,f)}},createDevice(e,r,t,o){var f;var i=S.join2(typeof e=="string"?e:n.getPath(e),r),a=Me(!!t,!!o);(f=n.createDevice).major??(f.major=64);var s=n.makedev(n.createDevice.major++,0);return n.registerDevice(s,{open(l){l.seekable=!1},close(l){var c;(c=o==null?void 0:o.buffer)!=null&&c.length&&o(10)},read(l,c,E,_,k){for(var v=0,p=0;p<_;p++){var b;try{b=t()}catch{throw new n.ErrnoError(29)}if(b===void 0&&v===0)throw new n.ErrnoError(6);if(b==null)break;v++,c[E+p]=b}return v&&(l.node.atime=Date.now()),v},write(l,c,E,_,k){for(var v=0;v<_;v++)try{o(c[E+v])}catch{throw new n.ErrnoError(29)}return _&&(l.node.mtime=l.node.ctime=Date.now()),v}}),n.mkdev(i,a,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=Y(e.url),e.usedBytes=e.contents.length}catch{throw new n.ErrnoError(29)}},createLazyFile(e,r,t,o,i){class a{constructor(){O(this,"lengthKnown",!1);O(this,"chunks",[])}get(v){if(!(v>this.length-1||v<0)){var p=v%this.chunkSize,b=v/this.chunkSize|0;return this.getter(b)[p]}}setDataGetter(v){this.getter=v}cacheLength(){var v=new XMLHttpRequest;if(v.open("HEAD",t,!1),v.send(null),!(v.status>=200&&v.status<300||v.status===304))throw new Error("Couldn't load "+t+". Status: "+v.status);var p=Number(v.getResponseHeader("Content-length")),b,L=(b=v.getResponseHeader("Accept-Ranges"))&&b==="bytes",M=(b=v.getResponseHeader("Content-Encoding"))&&b==="gzip",U=1024*1024;L||(U=p);var I=(H,de)=>{if(H>de)throw new Error("invalid range ("+H+", "+de+") or no bytes requested!");if(de>p-1)throw new Error("only "+p+" bytes available! programmer error!");var F=new XMLHttpRequest;if(F.open("GET",t,!1),p!==U&&F.setRequestHeader("Range","bytes="+H+"-"+de),F.responseType="arraybuffer",F.overrideMimeType&&F.overrideMimeType("text/plain; charset=x-user-defined"),F.send(null),!(F.status>=200&&F.status<300||F.status===304))throw new Error("Couldn't load "+t+". Status: "+F.status);return F.response!==void 0?new Uint8Array(F.response||[]):Te(F.responseText||"")},ge=this;ge.setDataGetter(H=>{var de=H*U,F=(H+1)*U-1;if(F=Math.min(F,p-1),typeof ge.chunks[H]>"u"&&(ge.chunks[H]=I(de,F)),typeof ge.chunks[H]>"u")throw new Error("doXHR failed!");return ge.chunks[H]}),(M||!p)&&(U=p=1,p=this.getter(0).length,U=p,se("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=p,this._chunkSize=U,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!W)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new a,f={isDevice:!1,contents:s}}else var f={isDevice:!1,url:t};var l=n.createFile(e,r,f,o,i);f.contents?l.contents=f.contents:f.url&&(l.contents=null,l.url=f.url),Object.defineProperties(l,{usedBytes:{get:function(){return this.contents.length}}});var c={},E=Object.keys(l.stream_ops);E.forEach(k=>{var v=l.stream_ops[k];c[k]=(...p)=>(n.forceLoadFile(l),v(...p))});function _(k,v,p,b,L){var M=k.node.contents;if(L>=M.length)return 0;var U=Math.min(M.length-L,b);if(M.slice)for(var I=0;I<U;I++)v[p+I]=M[L+I];else for(var I=0;I<U;I++)v[p+I]=M.get(L+I);return U}return c.read=(k,v,p,b,L)=>(n.forceLoadFile(l),_(k,v,p,b,L)),c.mmap=(k,v,p,b,L)=>{n.forceLoadFile(l);var M=Xe();if(!M)throw new n.ErrnoError(48);return _(k,w,M,v,p),{ptr:M,allocated:!0}},l.stream_ops=c,l}},Ur=(e,r)=>e?le(G,e,r):"",g={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(S.isAbs(r))return r;var o;if(e===-100)o=n.cwd();else{var i=g.getStreamFromFD(e);o=i.path}if(r.length==0){if(!t)throw new n.ErrnoError(44);return o}return o+"/"+r},writeStat(e,r){d[e>>2]=r.dev,d[e+4>>2]=r.mode,D[e+8>>2]=r.nlink,d[e+12>>2]=r.uid,d[e+16>>2]=r.gid,d[e+20>>2]=r.rdev,x[e+24>>3]=BigInt(r.size),d[e+32>>2]=4096,d[e+36>>2]=r.blocks;var t=r.atime.getTime(),o=r.mtime.getTime(),i=r.ctime.getTime();return x[e+40>>3]=BigInt(Math.floor(t/1e3)),D[e+48>>2]=t%1e3*1e3*1e3,x[e+56>>3]=BigInt(Math.floor(o/1e3)),D[e+64>>2]=o%1e3*1e3*1e3,x[e+72>>3]=BigInt(Math.floor(i/1e3)),D[e+80>>2]=i%1e3*1e3*1e3,x[e+88>>3]=BigInt(r.ino),0},writeStatFs(e,r){d[e+4>>2]=r.bsize,d[e+40>>2]=r.bsize,d[e+8>>2]=r.blocks,d[e+12>>2]=r.bfree,d[e+16>>2]=r.bavail,d[e+20>>2]=r.files,d[e+24>>2]=r.ffree,d[e+28>>2]=r.fsid,d[e+44>>2]=r.flags,d[e+36>>2]=r.namelen},doMsync(e,r,t,o,i){if(!n.isFile(r.node.mode))throw new n.ErrnoError(43);if(o&2)return 0;var a=G.slice(e,e+t);n.msync(r,a,i,t,o)},getStreamFromFD(e){var r=n.getStreamChecked(e);return r},varargs:void 0,getStr(e){var r=Ur(e);return r}};function Ir(e,r){try{return e=g.getStr(e),n.chmod(e,r),0}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function Or(e,r,t,o,i){try{r=g.getStr(r);var a=i&256;return i=i&-257,r=g.calculateAt(e,r),(a?n.lchown:n.chown)(r,t,o),0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function jr(e,r){try{return g.writeStat(r,n.fstat(e))}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var $r=9007199254740992,Hr=-9007199254740992,Ee=e=>e<Hr||e>$r?NaN:Number(e);function Wr(e,r){r=Ee(r);try{return isNaN(r)?-61:(n.ftruncate(e,r),0)}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var K=(e,r,t)=>Ye(e,G,r,t);function Vr(e,r){try{if(r===0)return-28;var t=n.cwd(),o=me(t)+1;return r<o?-68:(K(t,e,r),o)}catch(i){if(typeof n>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function Yr(e,r,t){try{var o=g.getStreamFromFD(e);o.getdents||(o.getdents=n.readdir(o.path));for(var i=280,a=0,s=n.llseek(o,0,1),f=Math.floor(s/i),l=Math.min(o.getdents.length,f+Math.floor(t/i)),c=f;c<l;c++){var E,_,k=o.getdents[c];if(k===".")E=o.node.id,_=4;else if(k===".."){var v=n.lookupPath(o.path,{parent:!0});E=v.node.id,_=4}else{var p;try{p=n.lookupNode(o.node,k)}catch(b){if((b==null?void 0:b.errno)===28)continue;throw b}E=p.id,_=n.isChrdev(p.mode)?2:n.isDir(p.mode)?4:n.isLink(p.mode)?10:8}x[r+a>>3]=BigInt(E),x[r+a+8>>3]=BigInt((c+1)*i),J[r+a+16>>1]=280,w[r+a+18]=_,K(k,r+a+19,256),a+=i}return n.llseek(o,c*i,0),a}catch(b){if(typeof n>"u"||b.name!=="ErrnoError")throw b;return-b.errno}}var Ke=()=>{var e=d[+g.varargs>>2];return g.varargs+=4,e},he=Ke;function Xr(e,r,t){g.varargs=t;try{var o=g.getStreamFromFD(e);switch(r){case 21509:return o.tty?0:-59;case 21505:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var i=o.tty.ops.ioctl_tcgets(o),a=he();d[a>>2]=i.c_iflag||0,d[a+4>>2]=i.c_oflag||0,d[a+8>>2]=i.c_cflag||0,d[a+12>>2]=i.c_lflag||0;for(var s=0;s<32;s++)w[a+s+17]=i.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return o.tty?0:-59;case 21506:case 21507:case 21508:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){for(var a=he(),f=d[a>>2],l=d[a+4>>2],c=d[a+8>>2],E=d[a+12>>2],_=[],s=0;s<32;s++)_.push(w[a+s+17]);return o.tty.ops.ioctl_tcsets(o.tty,r,{c_iflag:f,c_oflag:l,c_cflag:c,c_lflag:E,c_cc:_})}return 0}case 21519:{if(!o.tty)return-59;var a=he();return d[a>>2]=0,0}case 21520:return o.tty?-28:-59;case 21531:{var a=he();return n.ioctl(o,r,a)}case 21523:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var k=o.tty.ops.ioctl_tiocgwinsz(o.tty),a=he();J[a>>1]=k[0],J[a+2>>1]=k[1]}return 0}case 21524:return o.tty?0:-59;case 21515:return o.tty?0:-59;default:return-28}}catch(v){if(typeof n>"u"||v.name!=="ErrnoError")throw v;return-v.errno}}function Gr(e,r){try{return e=g.getStr(e),g.writeStat(r,n.lstat(e))}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function Kr(e,r,t){try{return r=g.getStr(r),r=g.calculateAt(e,r),n.mkdir(r,t,0),0}catch(o){if(typeof n>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Zr(e,r,t,o){try{r=g.getStr(r);var i=o&256,a=o&4096;return o=o&-6401,r=g.calculateAt(e,r,a),g.writeStat(t,i?n.lstat(r):n.stat(r))}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function Jr(e,r,t,o){g.varargs=o;try{r=g.getStr(r),r=g.calculateAt(e,r);var i=o?Ke():0;return n.open(r,t,i).fd}catch(a){if(typeof n>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function Qr(e,r,t,o){try{if(r=g.getStr(r),r=g.calculateAt(e,r),o<=0)return-28;var i=n.readlink(r),a=Math.min(o,me(i)),s=w[t+a];return K(i,t,o+1),w[t+a]=s,a}catch(f){if(typeof n>"u"||f.name!=="ErrnoError")throw f;return-f.errno}}function qr(e,r,t,o){try{return r=g.getStr(r),o=g.getStr(o),r=g.calculateAt(e,r),o=g.calculateAt(t,o),n.rename(r,o),0}catch(i){if(typeof n>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function et(e){try{return e=g.getStr(e),n.rmdir(e),0}catch(r){if(typeof n>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function rt(e,r){try{return e=g.getStr(e),g.writeStat(r,n.stat(e))}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function tt(e,r,t){try{return e=g.getStr(e),t=g.getStr(t),t=g.calculateAt(r,t),n.symlink(e,t),0}catch(o){if(typeof n>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function nt(e,r,t){try{if(r=g.getStr(r),r=g.calculateAt(e,r),!t)n.unlink(r);else if(t===512)n.rmdir(r);else return-28;return 0}catch(o){if(typeof n>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var Ze=e=>D[e>>2]+d[e+4>>2]*4294967296;function ot(e,r,t,o){try{r=g.getStr(r),r=g.calculateAt(e,r,!0);var i=Date.now(),a,s;if(!t)a=i,s=i;else{var f=Ze(t),l=d[t+8>>2];l==1073741823?a=i:l==1073741822?a=null:a=f*1e3+l/1e6,t+=16,f=Ze(t),l=d[t+8>>2],l==1073741823?s=i:l==1073741822?s=null:s=f*1e3+l/1e6}return(s??a)!==null&&n.utime(r,a,s),0}catch(c){if(typeof n>"u"||c.name!=="ErrnoError")throw c;return-c.errno}}var it=()=>Se(""),Je=0,at=()=>{De=!1,Je=0};function st(e,r){e=Ee(e);var t=new Date(e*1e3);d[r>>2]=t.getUTCSeconds(),d[r+4>>2]=t.getUTCMinutes(),d[r+8>>2]=t.getUTCHours(),d[r+12>>2]=t.getUTCDate(),d[r+16>>2]=t.getUTCMonth(),d[r+20>>2]=t.getUTCFullYear()-1900,d[r+24>>2]=t.getUTCDay();var o=Date.UTC(t.getUTCFullYear(),0,1,0,0,0,0),i=(t.getTime()-o)/(1e3*60*60*24)|0;d[r+28>>2]=i}var ft=e=>e%4===0&&(e%100!==0||e%400===0),lt=[0,31,60,91,121,152,182,213,244,274,305,335],ut=[0,31,59,90,120,151,181,212,243,273,304,334],Qe=e=>{var r=ft(e.getFullYear()),t=r?lt:ut,o=t[e.getMonth()]+e.getDate()-1;return o};function dt(e,r){e=Ee(e);var t=new Date(e*1e3);d[r>>2]=t.getSeconds(),d[r+4>>2]=t.getMinutes(),d[r+8>>2]=t.getHours(),d[r+12>>2]=t.getDate(),d[r+16>>2]=t.getMonth(),d[r+20>>2]=t.getFullYear()-1900,d[r+24>>2]=t.getDay();var o=Qe(t)|0;d[r+28>>2]=o,d[r+36>>2]=-(t.getTimezoneOffset()*60);var i=new Date(t.getFullYear(),0,1),a=new Date(t.getFullYear(),6,1).getTimezoneOffset(),s=i.getTimezoneOffset(),f=(a!=s&&t.getTimezoneOffset()==Math.min(s,a))|0;d[r+32>>2]=f}var ct=function(e){var r=(()=>{var t=new Date(d[e+20>>2]+1900,d[e+16>>2],d[e+12>>2],d[e+8>>2],d[e+4>>2],d[e>>2],0),o=d[e+32>>2],i=t.getTimezoneOffset(),a=new Date(t.getFullYear(),0,1),s=new Date(t.getFullYear(),6,1).getTimezoneOffset(),f=a.getTimezoneOffset(),l=Math.min(f,s);if(o<0)d[e+32>>2]=+(s!=f&&l==i);else if(o>0!=(l==i)){var c=Math.max(f,s),E=o>0?l:c;t.setTime(t.getTime()+(E-i)*6e4)}d[e+24>>2]=t.getDay();var _=Qe(t)|0;d[e+28>>2]=_,d[e>>2]=t.getSeconds(),d[e+4>>2]=t.getMinutes(),d[e+8>>2]=t.getHours(),d[e+12>>2]=t.getDate(),d[e+16>>2]=t.getMonth(),d[e+20>>2]=t.getYear();var k=t.getTime();return isNaN(k)?-1:k/1e3})();return BigInt(r)},we={},Re=e=>{if(e instanceof Be||e=="unwind")return q;B(1,e)},qe=()=>De||Je>0,er=e=>{var r;q=e,qe()||((r=u.onExit)==null||r.call(u,e),Z=!0),B(e,new Be(e))},rr=(e,r)=>{q=e,er(e)},tr=rr,vt=()=>{if(!qe())try{tr(q)}catch(e){Re(e)}},mt=e=>{if(!Z)try{e(),vt()}catch(r){Re(r)}},nr=()=>performance.now(),ht=(e,r)=>{if(we[e]&&(clearTimeout(we[e].id),delete we[e]),!r)return 0;var t=setTimeout(()=>{delete we[e],mt(()=>fr(e,nr()))},r);return we[e]={id:t,timeout_ms:r},0},wt=(e,r,t,o)=>{var i=new Date().getFullYear(),a=new Date(i,0,1),s=new Date(i,6,1),f=a.getTimezoneOffset(),l=s.getTimezoneOffset(),c=Math.max(f,l);D[e>>2]=c*60,d[r>>2]=+(f!=l);var E=v=>{var p=v>=0?"-":"+",b=Math.abs(v),L=String(Math.floor(b/60)).padStart(2,"0"),M=String(b%60).padStart(2,"0");return`UTC${p}${L}${M}`},_=E(f),k=E(l);l<f?(K(_,t,17),K(k,o,17)):(K(_,o,17),K(k,t,17))},or=()=>Date.now(),yt=e=>e>=0&&e<=3;function gt(e,r,t){if(!yt(e))return 28;var o;e===0?o=or():o=nr();var i=Math.round(o*1e3*1e3);return x[t>>3]=BigInt(i),0}var ir=()=>2147483648,pt=()=>ir(),_t=(e,r)=>Math.ceil(e/r)*r,Et=e=>{var r=ne.buffer,t=(e-r.byteLength+65535)/65536|0;try{return ne.grow(t),Le(),1}catch{}},kt=e=>{var r=G.length;e>>>=0;var t=ir();if(e>t)return!1;for(var o=1;o<=4;o*=2){var i=r*(1+.2/o);i=Math.min(i,e+100663296);var a=Math.min(t,_t(Math.max(e,i),65536)),s=Et(a);if(s)return!0}return!1},Ce={},bt=()=>C||"./this.program",ye=()=>{if(!ye.strings){var e=(typeof navigator=="object"&&navigator.language||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:bt()};for(var t in Ce)Ce[t]===void 0?delete r[t]:r[t]=Ce[t];var o=[];for(var t in r)o.push(`${t}=${r[t]}`);ye.strings=o}return ye.strings},St=(e,r)=>{var t=0,o=0;for(var i of ye()){var a=r+t;D[e+o>>2]=a,t+=K(i,a,1/0)+1,o+=4}return 0},At=(e,r)=>{var t=ye();D[e>>2]=t.length;var o=0;for(var i of t)o+=me(i)+1;return D[r>>2]=o,0};function Dt(e){try{var r=g.getStreamFromFD(e);return n.close(r),0}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return t.errno}}function Ft(e,r){try{var t=0,o=0,i=0,a=g.getStreamFromFD(e),s=a.tty?2:n.isDir(a.mode)?3:n.isLink(a.mode)?7:4;return w[r]=s,J[r+2>>1]=i,x[r+8>>3]=BigInt(t),x[r+16>>3]=BigInt(o),0}catch(f){if(typeof n>"u"||f.name!=="ErrnoError")throw f;return f.errno}}var Tt=(e,r,t,o)=>{for(var i=0,a=0;a<t;a++){var s=D[r>>2],f=D[r+4>>2];r+=8;var l=n.read(e,w,s,f,o);if(l<0)return-1;if(i+=l,l<f)break}return i};function Mt(e,r,t,o){try{var i=g.getStreamFromFD(e),a=Tt(i,r,t);return D[o>>2]=a,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function Rt(e,r,t,o){r=Ee(r);try{if(isNaN(r))return 61;var i=g.getStreamFromFD(e);return n.llseek(i,r,t),x[o>>3]=BigInt(i.position),i.getdents&&r===0&&t===0&&(i.getdents=null),0}catch(a){if(typeof n>"u"||a.name!=="ErrnoError")throw a;return a.errno}}var Ct=(e,r,t,o)=>{for(var i=0,a=0;a<t;a++){var s=D[r>>2],f=D[r+4>>2];r+=8;var l=n.write(e,w,s,f,o);if(l<0)return-1;if(i+=l,l<f)break}return i};function Nt(e,r,t,o){try{var i=g.getStreamFromFD(e),a=Ct(i,r,t);return D[o>>2]=a,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var ar=e=>lr(e),zt=e=>{var r=me(e)+1,t=ar(r);return K(e,t,r),t};n.createPreloadedFile=Pr,n.staticInit(),y.doesNotExistError=new n.ErrnoError(44),y.doesNotExistError.stack="<generic error, no stack>",u.noExitRuntime&&(De=u.noExitRuntime),u.preloadPlugins&&(Ge=u.preloadPlugins),u.print&&(se=u.print),u.printErr&&(z=u.printErr),u.wasmBinary&&(X=u.wasmBinary),u.arguments&&(P=u.arguments),u.thisProgram&&(C=u.thisProgram),u.callMain=Ne,u.FS=n;var sr,fr,lr;function xt(e){u._main=sr=e.Q,fr=e.S,lr=e.T}var Lt={m:Tr,a:Rr,D:Ir,w:Or,l:jr,M:Wr,L:Vr,B:Yr,h:Xr,j:Gr,I:Kr,i:Zr,C:Jr,A:Qr,z:qr,e:et,k:rt,v:tt,f:nt,s:ot,q:it,o:at,E:st,F:dt,G:ct,p:ht,H:wt,t:gt,c:or,u:pt,r:kt,x:St,y:At,N:tr,b:Dt,K:Ft,g:Mt,J:Rt,d:Nt,n:er},ue=await Sr();function Ne(e=[]){var r=sr;e.unshift(C);var t=e.length,o=ar((t+1)*4),i=o;e.forEach(s=>{D[i>>2]=zt(s),i+=4}),D[i>>2]=0;try{var a=r(t,o);return rr(a,!0),a}catch(s){return Re(s)}}function ze(e=P){if(oe>0){ve=ze;return}if(hr(),oe>0){ve=ze;return}function r(){var o;if(u.calledRun=!0,!Z){wr(),re==null||re(u),(o=u.onRuntimeInitialized)==null||o.call(u);var t=u.noInitialRun||!1;t||Ne(e),yr()}}u.setStatus?(u.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>u.setStatus(""),1),r()},1)):r()}function Pt(){if(u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.shift()()}return Pt(),ze(),u.FS=n,u.callMain=Ne,xe?m=u:m=new Promise((e,r)=>{re=e,te=r}),m};const j={maxVolumes:256,maxBytes:512*1024*1024};function ae(h){let m=/^(.*\.part)(\d+)(\.rar)$/i.exec(h);if(m)return{format:"rar",kind:"rar-part",key:`${m[1]}*.rar`.toLowerCase(),base:m[1],index:Number(m[2])-1,width:m[2].length};if(m=/^(.*\.(7z|zip))\.(\d{3,})$/i.exec(h),m)return{format:m[2].toLowerCase(),kind:"numbered",key:`${m[1]}.*`.toLowerCase(),base:m[1],index:Number(m[3])-1,width:m[3].length};if(m=/^(.*)\.([r-y])(\d{2})$/i.exec(h),m)return{format:"rar",kind:"rar-old",key:`${m[1]}.rar`.toLowerCase(),base:m[1],index:(m[2].toLowerCase().charCodeAt(0)-114)*100+Number(m[3])+1,width:2};if(m=/^(.*)\.rar$/i.exec(h),m)return{format:"rar",kind:"rar-old",key:h.toLowerCase(),base:m[1],index:0,width:2};if(m=/^(.*)\.z(\d{2,})$/i.exec(h),m)return{format:"zip",kind:"zip",key:`${m[1]}.zip`.toLowerCase(),base:m[1],index:Number(m[2])-1,width:m[2].length};if(m=/^(.*)\.zip$/i.exec(h),m)return{format:"zip",kind:"zip",key:h.toLowerCase(),base:m[1],index:1/0,width:2}}function dr(h){const m=ae(h);return!!(m&&(m.kind==="numbered"||m.kind==="rar-part"||!/\.(rar|zip)$/i.test(h)))}class pe extends Error{constructor(m,u){super(m),this.code=u}}async function cr(h,m){var ee,re,te,ne;const u=((ee=h.name)==null?void 0:ee.toLowerCase())??"input.archive",$=[{name:u,bytes:h.bytes},...(h.volumes??[]).map(w=>({...w,name:w.name.toLowerCase()}))];if($.length>j.maxVolumes)throw new Error("Archive contains too many volumes.");if($.reduce((w,G)=>w+G.bytes.byteLength,0)>j.maxBytes)throw new Error("Archive volumes exceed the preview input size limit.");const W=new Set;for(const w of $){if(!w.name||/[/\\\u0000-\u001f\u007f]/.test(w.name)||w.name==="."||w.name===".."||W.has(w.name))throw new Error("Invalid or duplicate archive volume filename.");W.add(w.name)}const A=h.entry!==void 0;if((re=h.entry)!=null&&re.encrypted&&h.password===void 0)throw new pe("Archive entry requires a password.","password_required");if(h.entry&&(h.entry.size>h.maxEntryBytes||h.entry.size<0))throw new Error("Attachment exceeds the preview size limit.");const R=A?h.entry.size:16*1024*1024,P=[];let C=new Uint8Array(65536),B=0,N=0,T="",_e=!1,V;const Y=await m({...h.wasmUrl?{locateFile:()=>h.wasmUrl}:{},...h.wasmModule?{instantiateWasm(w,G){const J=new WebAssembly.Instance(h.wasmModule,w);return G(J,h.wasmModule),J.exports}}:{},stdin:()=>(_e=!0,null),stdout(w){if(w!==null){if(++N>R)throw V=new Error("Expanded archive exceeds the preview size limit."),V;C[B++]=w,B===C.length&&(P.push(C),C=new Uint8Array(65536),B=0)}},stderr(w){w!==null&&T.length<65536&&(T+=String.fromCharCode(w))}});Y.FS.mkdir("/archive");for(const w of $)Y.FS.writeFile(`/archive/${w.name}`,w.bytes);const ce=/\.(7z|zip)\.\d{3,}$/.test(u)?`${h.format}.split`:h.format==="rar"&&h.bytes[6]===1?"rar5":h.format,se=[A?"x":"l",`/archive/${u}`,`-t${ce}`,"-bd","-bsp0","-sccUTF-8",...h.password===void 0?[]:[`-p${h.password}`],...A?["-so","-bso0","-bse2","-spd","-r-",`-i!${h.entry.path}`]:["-slt","-ba"]];let z,X;try{z=Y.callMain(se)}catch(w){X=w}if(V)throw V;if(X!==void 0||z!==0)throw _e||/wrong password|password is incorrect|encrypted file/i.test(T)||typeof X=="number"&&h.password!==void 0&&(!A&&h.format!=="zip"||((te=h.entry)==null?void 0:te.encrypted))?new pe("Unable to decrypt archive.",h.password===void 0?"password_required":"password_invalid"):(ne=h.volumes)!=null&&ne.length||dr(u)||h.format==="rar"&&z===2||/missing volume|cannot find volume/i.test(T)?new pe("Archive volumes are missing or damaged. Select all parts of this archive."):new pe(T.trim()||"The archive is damaged or uses an unsupported compression method.");P.push(C.subarray(0,B));const Z=new Uint8Array(N);let q=0;for(const w of P)Z.set(w,q),q+=w.length;if(A){if(N!==h.entry.size)throw new Error("Archive entry size does not match its metadata.");return{bytes:Z}}return{entries:vr(new TextDecoder().decode(Z),h.maxEntries)}}function vr(h,m){const u=[],$=new Set;for(const W of h.split(/\r?\n\r?\n/)){if(!W.trim())continue;const A=new Map;for(const N of W.split(/\r?\n/)){const T=N.indexOf(" = ");if(T<0||A.has(N.slice(0,T)))throw new Error("Unsupported archive entry metadata.");A.set(N.slice(0,T),N.slice(T+3))}const R=A.get("Path");if(!R||/[\u0000-\u001f\u007f]/.test(R)||$.has(R))throw new Error("Unsupported or duplicate archive entry name.");if($.add(R),$.size>m)throw new Error("Archive contains too many entries.");if(A.get("Symbolic Link")||A.get("Hard Link")||A.get("Copy Link")||/(?:^|\s)l[rwx-]{9}/.test(A.get("Attributes")??""))continue;const P=Number(A.get("Size"));if(!Number.isSafeInteger(P)||P<0)throw new Error("Invalid archive entry size.");const C=A.get("Folder")==="+"||/^D/.test(A.get("Attributes")??""),B=Date.parse((A.get("Modified")??"").replace(" ","T"));u.push({path:R,directory:C,size:P,encrypted:A.get("Encrypted")==="+",modified:Number.isFinite(B)?B:void 0})}return u}const ke=self;ke.onmessage=h=>{cr(h.data,Q).then(m=>{ke.postMessage({result:m},m.bytes?[m.bytes.buffer]:[])},m=>{ke.postMessage({error:{message:m instanceof Error?m.message:String(m),code:m==null?void 0:m.code}})})};var mr=Object.freeze({__proto__:null})})();
|