@pspdfkit/nodejs
Version:
Convert documents in your Node.js apps.
18 lines • 80.7 kB
JavaScript
/*!
* PSPDFKit for Node.js 0.0.7 (https://pspdfkit.com/nodejs)
*
* Copyright (c) 2024 PSPDFKit GmbH. All rights reserved.
*
* THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY INTERNATIONAL COPYRIGHT LAW
* AND MAY NOT BE RESOLD OR REDISTRIBUTED. USAGE IS BOUND TO THE PSPDFKIT LICENSE AGREEMENT.
* UNAUTHORIZED REPRODUCTION OR DISTRIBUTION IS SUBJECT TO CIVIL AND CRIMINAL PENALTIES.
* This notice may not be removed from this file.
*
* PSPDFKit uses several open source third-party components: https://pspdfkit.com/acknowledgements/nodejs/
*/
var e,r=(e="undefined"!=typeof document?document.currentScript?.src:void 0,"undefined"!=typeof __filename&&(e||=__filename),function(r={}){var t,n,o,a,i,s,l,u,d,c,f,h,p,m,v,y,g,w,E,_,b,k,$,C,P,T=new Promise((e,r)=>{t=e,n=r}),D="object"==typeof window,F="function"==typeof importScripts,S="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,M=Object.assign({},r),A="./this.program",j=(e,r)=>{throw r},O="";if(S){var R=require("fs"),N=require("path");O=__dirname+"/",a=e=>(e=Z(e)?new URL(e):N.normalize(e),R.readFileSync(e)),o=(e,r=!0)=>(e=Z(e)?new URL(e):N.normalize(e),new Promise((t,n)=>{R.readFile(e,r?void 0:"utf8",(e,o)=>{e?n(e):t(r?o.buffer:o)})})),!r.thisProgram&&process.argv.length>1&&(A=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),j=(e,r)=>{throw process.exitCode=e,r}}else(D||F)&&(F?O=self.location.href:"undefined"!=typeof document&&document.currentScript&&(O=document.currentScript.src),e&&(O=e),O=O.startsWith("blob:")?"":O.substr(0,O.replace(/[?#].*/,"").lastIndexOf("/")+1),F&&(a=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),o=e=>Z(e)?new Promise((r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{(200==n.status||0==n.status&&n.response)&&t(n.response),r(n.status)},n.onerror=r,n.send(null)}):fetch(e,{credentials:"same-origin"}).then(e=>e.ok?e.arrayBuffer():Promise.reject(Error(e.status+" : "+e.url))));var z=r.print||console.log.bind(console),x=r.printErr||console.error.bind(console);Object.assign(r,M),M=null,r.arguments&&r.arguments,r.thisProgram&&(A=r.thisProgram),r.quit&&(j=r.quit),r.wasmBinary&&(i=r.wasmBinary);var U=!1;function W(){var e=s.buffer;r.HEAP8=l=new Int8Array(e),r.HEAP16=d=new Int16Array(e),r.HEAPU8=u=new Uint8Array(e),r.HEAPU16=c=new Uint16Array(e),r.HEAP32=f=new Int32Array(e),r.HEAPU32=h=new Uint32Array(e),r.HEAPF32=p=new Float32Array(e),r.HEAPF64=m=new Float64Array(e)}var L=[],I=[],H=[],B=!1,V=0,q=null,Y=null;function G(e){V++,r.monitorRunDependencies?.(V)}function X(e){if(V--,r.monitorRunDependencies?.(V),0==V&&(null!==q&&(clearInterval(q),q=null),Y)){var t=Y;Y=null,t()}}function J(e){r.onAbort?.(e),x(e="Aborted("+e+")"),U=!0,e+=". Build with -sASSERTIONS for more info.",B&&tE();var t=new WebAssembly.RuntimeError(e);throw n(t),t}var K=e=>e.startsWith("data:application/octet-stream;base64,"),Z=e=>e.startsWith("file://");function Q(e){if(e==v&&i)return new Uint8Array(i);if(a)return a(e);throw"both async and sync fetching of the wasm failed"}function ee(e,r,t){return(i?Promise.resolve().then(()=>Q(e)):o(e).then(e=>new Uint8Array(e),()=>Q(e))).then(e=>WebAssembly.instantiate(e,r)).then(t,e=>{x(`failed to asynchronously prepare wasm: ${e}`),J(e)})}var er={3120600:()=>"undefined"!=typeof wasmOffsetConverter};function et(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var en=e=>{for(;e.length>0;)e.shift()(r)},eo=r.noExitRuntime||!0,ea={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=ea.isAbs(e),t="/"===e.substr(-1);return(e=ea.normalizeArray(e.split("/").filter(e=>!!e),!r).join("/"))||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=ea.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=ea.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return -1===r?e:e.substr(r+1)},join:(...e)=>ea.normalize(e.join("/")),join2:(e,r)=>ea.normalize(e+"/"+r)},ei=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);if(S)try{var e=require("crypto");if(e.randomFillSync)return r=>e.randomFillSync(r);var r=e.randomBytes;return e=>(e.set(r(e.byteLength)),e)}catch(e){}J("initRandomDevice")},es=e=>(es=ei())(e),el={resolve:(...e)=>{for(var r="",t=!1,n=e.length-1;n>=-1&&!t;n--){var o=n>=0?e[n]:eF.cwd();if("string"!=typeof o)throw TypeError("Arguments to path.resolve must be strings");if(!o)return"";r=o+"/"+r,t=ea.isAbs(o)}return r=ea.normalizeArray(r.split("/").filter(e=>!!e),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{function t(e){for(var r=0;r<e.length&&""===e[r];r++);for(var t=e.length-1;t>=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=el.resolve(e).substr(1),r=el.resolve(r).substr(1);for(var n=t(e.split("/")),o=t(r.split("/")),a=Math.min(n.length,o.length),i=a,s=0;s<a;s++)if(n[s]!==o[s]){i=s;break}for(var l=[],s=i;s<n.length;s++)l.push("..");return(l=l.concat(o.slice(i))).join("/")}},eu="undefined"!=typeof TextDecoder?new TextDecoder:void 0,ed=(e,r,t)=>{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&eu)return eu.decode(e.subarray(r,o));for(var a="";r<o;){var i=e[r++];if(!(128&i)){a+=String.fromCharCode(i);continue}var s=63&e[r++];if((224&i)==192){a+=String.fromCharCode((31&i)<<6|s);continue}var l=63&e[r++];if((i=(240&i)==224?(15&i)<<12|s<<6|l:(7&i)<<18|s<<12|l<<6|63&e[r++])<65536)a+=String.fromCharCode(i);else{var u=i-65536;a+=String.fromCharCode(55296|u>>10,56320|1023&u)}}return a},ec=[],ef=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},eh=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),s<=127){if(t>=a)break;r[t++]=s}else if(s<=2047){if(t+1>=a)break;r[t++]=192|s>>6,r[t++]=128|63&s}else if(s<=65535){if(t+2>=a)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(t+3>=a)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o};function ep(e,r,t){var n=Array(t>0?t:ef(e)+1),o=eh(e,n,0,n.length);return r&&(n.length=o),n}var em=()=>{if(!ec.length){var e=null;if(S){var r=Buffer.alloc(256),t=0,n=process.stdin.fd;try{t=R.readSync(n,r,0,256)}catch(e){if(e.toString().includes("EOF"))t=0;else throw e}t>0&&(e=r.slice(0,t).toString("utf-8"))}else"undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n");if(!e)return null;ec=ep(e,!0)}return ec.shift()},ev={ttys:[],init(){},shutdown(){},register(e,r){ev.ttys[e]={input:[],output:[],ops:r},eF.registerDevice(e,ev.stream_ops)},stream_ops:{open(e){var r=ev.ttys[e.node.rdev];if(!r)throw new eF.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 eF.ErrnoError(60);for(var a,i=0,s=0;s<n;s++){try{a=e.tty.ops.get_char(e.tty)}catch(e){throw new eF.ErrnoError(29)}if(void 0===a&&0===i)throw new eF.ErrnoError(6);if(null==a)break;i++,r[t+s]=a}return i&&(e.node.timestamp=Date.now()),i},write(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new eF.ErrnoError(60);try{for(var a=0;a<n;a++)e.tty.ops.put_char(e.tty,r[t+a])}catch(e){throw new eF.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),a}},default_tty_ops:{get_char:e=>em(),put_char(e,r){null===r||10===r?(z(ed(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(z(ed(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?(x(ed(e.output,0)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output&&e.output.length>0&&(x(ed(e.output,0)),e.output=[])}}},ey=(e,r)=>(u.fill(0,e,e+r),e),eg=(e,r)=>Math.ceil(e/r)*r,ew=e=>{e=eg(e,65536);var r=tw(65536,e);return r?ey(r,e):0},eE={ops_table:null,mount:e=>eE.createNode(null,"/",16895,0),createNode(e,r,t,n){if(eF.isBlkdev(t)||eF.isFIFO(t))throw new eF.ErrnoError(63);eE.ops_table||={dir:{node:{getattr:eE.node_ops.getattr,setattr:eE.node_ops.setattr,lookup:eE.node_ops.lookup,mknod:eE.node_ops.mknod,rename:eE.node_ops.rename,unlink:eE.node_ops.unlink,rmdir:eE.node_ops.rmdir,readdir:eE.node_ops.readdir,symlink:eE.node_ops.symlink},stream:{llseek:eE.stream_ops.llseek}},file:{node:{getattr:eE.node_ops.getattr,setattr:eE.node_ops.setattr},stream:{llseek:eE.stream_ops.llseek,read:eE.stream_ops.read,write:eE.stream_ops.write,allocate:eE.stream_ops.allocate,mmap:eE.stream_ops.mmap,msync:eE.stream_ops.msync}},link:{node:{getattr:eE.node_ops.getattr,setattr:eE.node_ops.setattr,readlink:eE.node_ops.readlink},stream:{}},chrdev:{node:{getattr:eE.node_ops.getattr,setattr:eE.node_ops.setattr},stream:eF.chrdev_stream_ops}};var o=eF.createNode(e,r,t,n);return eF.isDir(o.mode)?(o.node_ops=eE.ops_table.dir.node,o.stream_ops=eE.ops_table.dir.stream,o.contents={}):eF.isFile(o.mode)?(o.node_ops=eE.ops_table.file.node,o.stream_ops=eE.ops_table.file.stream,o.usedBytes=0,o.contents=null):eF.isLink(o.mode)?(o.node_ops=eE.ops_table.link.node,o.stream_ops=eE.ops_table.link.stream):eF.isChrdev(o.mode)&&(o.node_ops=eE.ops_table.chrdev.node,o.stream_ops=eE.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=eF.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,eF.isDir(e.mode)?r.size=4096:eF.isFile(e.mode)?r.size=e.usedBytes:eF.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&&eE.resizeFileStorage(e,r.size)},lookup(e,r){throw eF.genericErrors[44]},mknod:(e,r,t,n)=>eE.createNode(e,r,t,n),rename(e,r,t){if(eF.isDir(e.mode)){var n;try{n=eF.lookupNode(r,t)}catch(e){}if(n)for(var o in n.contents)throw new eF.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},unlink(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir(e,r){var t=eF.lookupNode(e,r);for(var n in t.contents)throw new eF.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=eE.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!eF.isLink(e.mode))throw new eF.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;s<i;s++)r[t+s]=a[o+s];return i},write(e,r,t,n,o,a){if(r.buffer,l.buffer,!n)return 0;var i=e.node;if(i.timestamp=Date.now(),r.subarray&&(!i.contents||i.contents.subarray)){if(0===i.usedBytes&&0===o)return i.contents=r.slice(t,t+n),i.usedBytes=n,n;if(o+n<=i.usedBytes)return i.contents.set(r.subarray(t,t+n),o),n}if(eE.expandFileStorage(i,o+n),i.contents.subarray&&r.subarray)i.contents.set(r.subarray(t,t+n),o);else for(var s=0;s<n;s++)i.contents[o+s]=r[t+s];return i.usedBytes=Math.max(i.usedBytes,o+n),n},llseek(e,r,t){var n=r;if(1===t?n+=e.position:2===t&&eF.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new eF.ErrnoError(28);return n},allocate(e,r,t){eE.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap(e,r,t,n,o){if(!eF.isFile(e.node.mode))throw new eF.ErrnoError(43);var a,i,s=e.node.contents;if(2&o||s.buffer!==l.buffer){if((t>0||t+r<s.length)&&(s=s.subarray?s.subarray(t,t+r):Array.prototype.slice.call(s,t,t+r)),i=!0,!(a=ew(r)))throw new eF.ErrnoError(48);l.set(s,a)}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:(e,r,t,n,o)=>(eE.stream_ops.write(e,r,0,n,t,!1),0)}},e_=(e,r,t,n)=>{var a=n?"":`al ${e}`;o(e).then(e=>{r(new Uint8Array(e)),a&&X(a)},r=>{if(t)t();else throw`Loading data file "${e}" failed.`}),a&&G(a)},eb=(e,r,t,n,o,a)=>{eF.createDataFile(e,r,t,n,o,a)},ek=r.preloadPlugins||[],e$=(e,r,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return ek.forEach(a=>{!o&&a.canHandle(r)&&(a.handle(e,r,t,n),o=!0)}),o},eC=(e,r,t,n,o,a,i,s,l,u)=>{var d=r?el.resolve(ea.join2(e,r)):e,c=`cp ${d}`;function f(t){function f(t){u?.(),s||eb(e,r,t,n,o,l),a?.(),X(c)}e$(t,d,f,()=>{i?.(),X(c)})||f(t)}G(c),"string"==typeof t?e_(t,f,i):f(t)},eP=e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===r)throw Error(`Unknown file open mode: ${e}`);return r},eT=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},eD={DIR_MODE:16895,FILE_MODE:33279,reader:null,mount(e){F||J(void 0),eD.reader||(eD.reader=new FileReaderSync);var r=eD.createNode(null,"/",eD.DIR_MODE,0),t={};function n(e){for(var n=e.split("/"),o=r,a=0;a<n.length-1;a++){var i=n.slice(0,a+1).join("/");t[i]||=eD.createNode(o,n[a],eD.DIR_MODE,0),o=t[i]}return o}function o(e){var r=e.split("/");return r[r.length-1]}return Array.prototype.forEach.call(e.opts.files||[],function(e){eD.createNode(n(e.name),o(e.name),eD.FILE_MODE,0,e,e.lastModifiedDate)}),(e.opts.blobs||[]).forEach(function(e){eD.createNode(n(e.name),o(e.name),eD.FILE_MODE,0,e.data)}),(e.opts.packages||[]).forEach(function(e){e.metadata.files.forEach(function(r){var t=r.filename.substr(1);eD.createNode(n(t),o(t),eD.FILE_MODE,0,e.blob.slice(r.start,r.end))})}),r},createNode(e,r,t,n,o,a){var i=eF.createNode(e,r,t);return i.mode=t,i.node_ops=eD.node_ops,i.stream_ops=eD.stream_ops,i.timestamp=(a||new Date).getTime(),eD.FILE_MODE!==eD.DIR_MODE||J(void 0),t===eD.FILE_MODE?(i.size=o.size,i.contents=o):(i.size=4096,i.contents={}),e&&(e.contents[r]=i),i},node_ops:{getattr:e=>({dev:1,ino:e.id,mode:e.mode,nlink:1,uid:0,gid:0,rdev:0,size:e.size,atime:new Date(e.timestamp),mtime:new Date(e.timestamp),ctime:new Date(e.timestamp),blksize:4096,blocks:Math.ceil(e.size/4096)}),setattr(e,r){void 0!==r.mode&&(e.mode=r.mode),void 0!==r.timestamp&&(e.timestamp=r.timestamp)},lookup(e,r){throw new eF.ErrnoError(44)},mknod(e,r,t,n){throw new eF.ErrnoError(63)},rename(e,r,t){throw new eF.ErrnoError(63)},unlink(e,r){throw new eF.ErrnoError(63)},rmdir(e,r){throw new eF.ErrnoError(63)},readdir(e){var r=[".",".."];for(var t of Object.keys(e.contents))r.push(t);return r},symlink(e,r,t){throw new eF.ErrnoError(63)}},stream_ops:{read(e,r,t,n,o){if(o>=e.node.size)return 0;var a=e.node.contents.slice(o,o+n),i=eD.reader.readAsArrayBuffer(a);return r.set(new Uint8Array(i),t),a.size},write(e,r,t,n,o){throw new eF.ErrnoError(29)},llseek(e,r,t){var n=r;if(1===t?n+=e.position:2===t&&eF.isFile(e.node.mode)&&(n+=e.node.size),n<0)throw new eF.ErrnoError(28);return n}}},eF={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(e){this.name="ErrnoError",this.errno=e}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(e){this.node=e}get isRead(){return(2097155&this.flags)!=1}get isWrite(){return(2097155&this.flags)!=0}get isAppend(){return 1024&this.flags}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,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=eF.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n,this.readMode=365,this.writeMode=146}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 eF.isDir(this.mode)}get isDevice(){return eF.isChrdev(this.mode)}},lookupPath(e,r={}){if(!(e=el.resolve(e)))return{path:"",node:null};if((r=Object.assign({follow_mount:!0,recurse_count:0},r)).recurse_count>8)throw new eF.ErrnoError(32);for(var t=e.split("/").filter(e=>!!e),n=eF.root,o="/",a=0;a<t.length;a++){var i=a===t.length-1;if(i&&r.parent)break;if(n=eF.lookupNode(n,t[a]),o=ea.join2(o,t[a]),eF.isMountpoint(n)&&(!i||i&&r.follow_mount)&&(n=n.mounted.root),!i||r.follow)for(var s=0;eF.isLink(n.mode);){var l=eF.readlink(o);if(o=el.resolve(ea.dirname(o),l),n=eF.lookupPath(o,{recurse_count:r.recurse_count+1}).node,s++>40)throw new eF.ErrnoError(32)}}return{path:o,node:n}},getPath(e){for(var r;;){if(eF.isRoot(e)){var t=e.mount.mountpoint;if(!r)return t;return"/"!==t[t.length-1]?`${t}/${r}`:t+r}r=r?`${e.name}/${r}`:e.name,e=e.parent}},hashName(e,r){for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%eF.nameTable.length},hashAddNode(e){var r=eF.hashName(e.parent.id,e.name);e.name_next=eF.nameTable[r],eF.nameTable[r]=e},hashRemoveNode(e){var r=eF.hashName(e.parent.id,e.name);if(eF.nameTable[r]===e)eF.nameTable[r]=e.name_next;else for(var t=eF.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=eF.mayLookup(e);if(t)throw new eF.ErrnoError(t);for(var n=eF.hashName(e.id,r),o=eF.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===e.id&&a===r)return o}return eF.lookup(e,r)},createNode(e,r,t,n){var o=new eF.FSNode(e,r,t,n);return eF.hashAddNode(o),o},destroyNode(e){eF.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>(61440&e)==32768,isDir:e=>(61440&e)==16384,isLink:e=>(61440&e)==40960,isChrdev:e=>(61440&e)==8192,isBlkdev:e=>(61440&e)==24576,isFIFO:e=>(61440&e)==4096,isSocket:e=>(49152&e)==49152,flagsToPermissionString(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>eF.ignorePermissions?0:r.includes("r")&&!(292&e.mode)||r.includes("w")&&!(146&e.mode)||r.includes("x")&&!(73&e.mode)?2:0,mayLookup:e=>eF.isDir(e.mode)?eF.nodePermissions(e,"x")||(e.node_ops.lookup?0:2):54,mayCreate(e,r){try{return eF.lookupNode(e,r),20}catch(e){}return eF.nodePermissions(e,"wx")},mayDelete(e,r,t){try{n=eF.lookupNode(e,r)}catch(e){return e.errno}var n,o=eF.nodePermissions(e,"wx");if(o)return o;if(t){if(!eF.isDir(n.mode))return 54;if(eF.isRoot(n)||eF.getPath(n)===eF.cwd())return 10}else if(eF.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?eF.isLink(e.mode)?32:eF.isDir(e.mode)&&("r"!==eF.flagsToPermissionString(r)||512&r)?31:eF.nodePermissions(e,eF.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=eF.MAX_OPEN_FDS;e++)if(!eF.streams[e])return e;throw new eF.ErrnoError(33)},getStreamChecked(e){var r=eF.getStream(e);if(!r)throw new eF.ErrnoError(8);return r},getStream:e=>eF.streams[e],createStream:(e,r=-1)=>(e=Object.assign(new eF.FSStream,e),-1==r&&(r=eF.nextfd()),e.fd=r,eF.streams[r]=e,e),closeStream(e){eF.streams[e]=null},dupStream(e,r=-1){var t=eF.createStream(e,r);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(e){var r=eF.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new eF.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice(e,r){eF.devices[e]={stream_ops:r}},getDevice:e=>eF.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts)}return r},syncfs(e,r){"function"==typeof e&&(r=e,e=!1),eF.syncFSRequests++,eF.syncFSRequests>1&&x(`warning: ${eF.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=eF.getMounts(eF.root.mount),n=0;function o(e){return eF.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&&eF.root)throw new eF.ErrnoError(10);if(!o&&!a){var i=eF.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,eF.isMountpoint(n))throw new eF.ErrnoError(10);if(!eF.isDir(n.mode))throw new eF.ErrnoError(54)}var s={type:e,opts:r,mountpoint:t,mounts:[]},l=e.mount(s);return l.mount=s,s.root=l,o?eF.root=l:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),l},unmount(e){var r=eF.lookupPath(e,{follow_mount:!1});if(!eF.isMountpoint(r.node))throw new eF.ErrnoError(28);var t=r.node,n=t.mounted,o=eF.getMounts(n);Object.keys(eF.nameTable).forEach(e=>{for(var r=eF.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&eF.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=eF.lookupPath(e,{parent:!0}).node,o=ea.basename(e);if(!o||"."===o||".."===o)throw new eF.ErrnoError(28);var a=eF.mayCreate(n,o);if(a)throw new eF.ErrnoError(a);if(!n.node_ops.mknod)throw new eF.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},create:(e,r)=>(r=(void 0!==r?r:438)&4095|32768,eF.mknod(e,r,0)),mkdir:(e,r)=>(r=(void 0!==r?r:511)&1023|16384,eF.mknod(e,r,0)),mkdirTree(e,r){for(var t=e.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{eF.mkdir(n,r)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,r,t)=>(void 0===t&&(t=r,r=438),r|=8192,eF.mknod(e,r,t)),symlink(e,r){if(!el.resolve(e))throw new eF.ErrnoError(44);var t=eF.lookupPath(r,{parent:!0}).node;if(!t)throw new eF.ErrnoError(44);var n=ea.basename(r),o=eF.mayCreate(t,n);if(o)throw new eF.ErrnoError(o);if(!t.node_ops.symlink)throw new eF.ErrnoError(63);return t.node_ops.symlink(t,n,e)},rename(e,r){var t,n,o,a=ea.dirname(e),i=ea.dirname(r),s=ea.basename(e),l=ea.basename(r);if(t=eF.lookupPath(e,{parent:!0}).node,n=eF.lookupPath(r,{parent:!0}).node,!t||!n)throw new eF.ErrnoError(44);if(t.mount!==n.mount)throw new eF.ErrnoError(75);var u=eF.lookupNode(t,s),d=el.relative(e,i);if("."!==d.charAt(0))throw new eF.ErrnoError(28);if("."!==(d=el.relative(r,a)).charAt(0))throw new eF.ErrnoError(55);try{o=eF.lookupNode(n,l)}catch(e){}if(u!==o){var c=eF.isDir(u.mode),f=eF.mayDelete(t,s,c);if(f||(f=o?eF.mayDelete(n,l,c):eF.mayCreate(n,l)))throw new eF.ErrnoError(f);if(!t.node_ops.rename)throw new eF.ErrnoError(63);if(eF.isMountpoint(u)||o&&eF.isMountpoint(o))throw new eF.ErrnoError(10);if(n!==t&&(f=eF.nodePermissions(t,"w")))throw new eF.ErrnoError(f);eF.hashRemoveNode(u);try{t.node_ops.rename(u,n,l),u.parent=n}catch(e){throw e}finally{eF.hashAddNode(u)}}},rmdir(e){var r=eF.lookupPath(e,{parent:!0}).node,t=ea.basename(e),n=eF.lookupNode(r,t),o=eF.mayDelete(r,t,!0);if(o)throw new eF.ErrnoError(o);if(!r.node_ops.rmdir)throw new eF.ErrnoError(63);if(eF.isMountpoint(n))throw new eF.ErrnoError(10);r.node_ops.rmdir(r,t),eF.destroyNode(n)},readdir(e){var r=eF.lookupPath(e,{follow:!0}).node;if(!r.node_ops.readdir)throw new eF.ErrnoError(54);return r.node_ops.readdir(r)},unlink(e){var r=eF.lookupPath(e,{parent:!0}).node;if(!r)throw new eF.ErrnoError(44);var t=ea.basename(e),n=eF.lookupNode(r,t),o=eF.mayDelete(r,t,!1);if(o)throw new eF.ErrnoError(o);if(!r.node_ops.unlink)throw new eF.ErrnoError(63);if(eF.isMountpoint(n))throw new eF.ErrnoError(10);r.node_ops.unlink(r,t),eF.destroyNode(n)},readlink(e){var r=eF.lookupPath(e).node;if(!r)throw new eF.ErrnoError(44);if(!r.node_ops.readlink)throw new eF.ErrnoError(28);return el.resolve(eF.getPath(r.parent),r.node_ops.readlink(r))},stat(e,r){var t=eF.lookupPath(e,{follow:!r}).node;if(!t)throw new eF.ErrnoError(44);if(!t.node_ops.getattr)throw new eF.ErrnoError(63);return t.node_ops.getattr(t)},lstat:e=>eF.stat(e,!0),chmod(e,r,t){var n;if(!(n="string"==typeof e?eF.lookupPath(e,{follow:!t}).node:e).node_ops.setattr)throw new eF.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&r|-4096&n.mode,timestamp:Date.now()})},lchmod(e,r){eF.chmod(e,r,!0)},fchmod(e,r){var t=eF.getStreamChecked(e);eF.chmod(t.node,r)},chown(e,r,t,n){var o;if(!(o="string"==typeof e?eF.lookupPath(e,{follow:!n}).node:e).node_ops.setattr)throw new eF.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(e,r,t){eF.chown(e,r,t,!0)},fchown(e,r,t){var n=eF.getStreamChecked(e);eF.chown(n.node,r,t)},truncate(e,r){if(r<0)throw new eF.ErrnoError(28);if("string"==typeof e){var t;t=eF.lookupPath(e,{follow:!0}).node}else t=e;if(!t.node_ops.setattr)throw new eF.ErrnoError(63);if(eF.isDir(t.mode))throw new eF.ErrnoError(31);if(!eF.isFile(t.mode))throw new eF.ErrnoError(28);var n=eF.nodePermissions(t,"w");if(n)throw new eF.ErrnoError(n);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate(e,r){var t=eF.getStreamChecked(e);if((2097155&t.flags)==0)throw new eF.ErrnoError(28);eF.truncate(t.node,r)},utime(e,r,t){var n=eF.lookupPath(e,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(r,t)})},open(e,t,n){if(""===e)throw new eF.ErrnoError(44);if(n=64&(t="string"==typeof t?eP(t):t)?4095&(n=void 0===n?438:n)|32768:0,"object"==typeof e)o=e;else{e=ea.normalize(e);try{var o;o=eF.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var a=!1;if(64&t){if(o){if(128&t)throw new eF.ErrnoError(20)}else o=eF.mknod(e,n,0),a=!0}if(!o)throw new eF.ErrnoError(44);if(eF.isChrdev(o.mode)&&(t&=-513),65536&t&&!eF.isDir(o.mode))throw new eF.ErrnoError(54);if(!a){var i=eF.mayOpen(o,t);if(i)throw new eF.ErrnoError(i)}512&t&&!a&&eF.truncate(o,0),t&=-131713;var s=eF.createStream({node:o,path:eF.getPath(o),flags:t,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!r.logReadFiles||1&t||(eF.readFiles||(eF.readFiles={}),e in eF.readFiles||(eF.readFiles[e]=1)),s},close(e){if(eF.isClosed(e))throw new eF.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{eF.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,r,t){if(eF.isClosed(e))throw new eF.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new eF.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new eF.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 eF.ErrnoError(28);if(eF.isClosed(e)||(2097155&e.flags)==1)throw new eF.ErrnoError(8);if(eF.isDir(e.node.mode))throw new eF.ErrnoError(31);if(!e.stream_ops.read)throw new eF.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new eF.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 eF.ErrnoError(28);if(eF.isClosed(e)||(2097155&e.flags)==0)throw new eF.ErrnoError(8);if(eF.isDir(e.node.mode))throw new eF.ErrnoError(31);if(!e.stream_ops.write)throw new eF.ErrnoError(28);e.seekable&&1024&e.flags&&eF.llseek(e,0,2);var i=void 0!==o;if(i){if(!e.seekable)throw new eF.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(eF.isClosed(e))throw new eF.ErrnoError(8);if(r<0||t<=0)throw new eF.ErrnoError(28);if((2097155&e.flags)==0)throw new eF.ErrnoError(8);if(!eF.isFile(e.node.mode)&&!eF.isDir(e.node.mode))throw new eF.ErrnoError(43);if(!e.stream_ops.allocate)throw new eF.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap(e,r,t,n,o){if((2&n)!=0&&(2&o)==0&&(2097155&e.flags)!=2||(2097155&e.flags)==1)throw new eF.ErrnoError(2);if(!e.stream_ops.mmap)throw new eF.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,ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new eF.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 Error(`Invalid encoding type "${r.encoding}"`);var t,n=eF.open(e,r.flags),o=eF.stat(e).size,a=new Uint8Array(o);return eF.read(n,a,0,o,0),"utf8"===r.encoding?t=ed(a,0):"binary"===r.encoding&&(t=a),eF.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=eF.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(ef(r)+1),a=eh(r,o,0,o.length);eF.write(n,o,0,a,void 0,t.canOwn)}else if(ArrayBuffer.isView(r))eF.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw Error("Unsupported data type");eF.close(n)},cwd:()=>eF.currentPath,chdir(e){var r=eF.lookupPath(e,{follow:!0});if(null===r.node)throw new eF.ErrnoError(44);if(!eF.isDir(r.node.mode))throw new eF.ErrnoError(54);var t=eF.nodePermissions(r.node,"x");if(t)throw new eF.ErrnoError(t);eF.currentPath=r.path},createDefaultDirectories(){eF.mkdir("/tmp"),eF.mkdir("/home"),eF.mkdir("/home/web_user")},createDefaultDevices(){eF.mkdir("/dev"),eF.registerDevice(eF.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n}),eF.mkdev("/dev/null",eF.makedev(1,3)),ev.register(eF.makedev(5,0),ev.default_tty_ops),ev.register(eF.makedev(6,0),ev.default_tty1_ops),eF.mkdev("/dev/tty",eF.makedev(5,0)),eF.mkdev("/dev/tty1",eF.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(0===r&&(r=es(e).byteLength),e[--r]);eF.createDevice("/dev","random",t),eF.createDevice("/dev","urandom",t),eF.mkdir("/dev/shm"),eF.mkdir("/dev/shm/tmp")},createSpecialDirectories(){eF.mkdir("/proc");var e=eF.mkdir("/proc/self");eF.mkdir("/proc/self/fd"),eF.mount({mount(){var r=eF.createNode(e,"fd",16895,73);return r.node_ops={lookup(e,r){var t=eF.getStreamChecked(+r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>t.path}};return n.parent=n,n}},r}},{},"/proc/self/fd")},createStandardStreams(){r.stdin?eF.createDevice("/dev","stdin",r.stdin):eF.symlink("/dev/tty","/dev/stdin"),r.stdout?eF.createDevice("/dev","stdout",null,r.stdout):eF.symlink("/dev/tty","/dev/stdout"),r.stderr?eF.createDevice("/dev","stderr",null,r.stderr):eF.symlink("/dev/tty1","/dev/stderr"),eF.open("/dev/stdin",0),eF.open("/dev/stdout",1),eF.open("/dev/stderr",1)},staticInit(){[44].forEach(e=>{eF.genericErrors[e]=new eF.ErrnoError(e),eF.genericErrors[e].stack="<generic error, no stack>"}),eF.nameTable=Array(4096),eF.mount(eE,{},"/"),eF.createDefaultDirectories(),eF.createDefaultDevices(),eF.createSpecialDirectories(),eF.filesystems={MEMFS:eE,WORKERFS:eD}},init(e,t,n){eF.init.initialized=!0,r.stdin=e||r.stdin,r.stdout=t||r.stdout,r.stderr=n||r.stderr,eF.createStandardStreams()},quit(){eF.init.initialized=!1;for(var e=0;e<eF.streams.length;e++){var r=eF.streams[e];r&&eF.close(r)}},findObject(e,r){var t=eF.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{var t=eF.lookupPath(e,{follow:!r});e=t.path}catch(e){}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=eF.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=ea.basename(e),t=eF.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot="/"===t.path}catch(e){n.error=e.errno}return n},createPath(e,r,t,n){e="string"==typeof e?e:eF.getPath(e);for(var o=r.split("/").reverse();o.length;){var a=o.pop();if(a){var i=ea.join2(e,a);try{eF.mkdir(i)}catch(e){}e=i}}return i},createFile(e,r,t,n,o){var a=ea.join2("string"==typeof e?e:eF.getPath(e),r),i=eT(n,o);return eF.create(a,i)},createDataFile(e,r,t,n,o,a){var i=r;e&&(e="string"==typeof e?e:eF.getPath(e),i=r?ea.join2(e,r):e);var s=eT(n,o),l=eF.create(i,s);if(t){if("string"==typeof t){for(var u=Array(t.length),d=0,c=t.length;d<c;++d)u[d]=t.charCodeAt(d);t=u}eF.chmod(l,146|s);var f=eF.open(l,577);eF.write(f,t,0,t.length,0,a),eF.close(f),eF.chmod(l,s)}},createDevice(e,r,t,n){var o=ea.join2("string"==typeof e?e:eF.getPath(e),r),a=eT(!!t,!!n);eF.createDevice.major||(eF.createDevice.major=64);var i=eF.makedev(eF.createDevice.major++,0);return eF.registerDevice(i,{open(e){e.seekable=!1},close(e){n?.buffer?.length&&n(10)},read(e,r,n,o,a){for(var i,s=0,l=0;l<o;l++){try{i=t()}catch(e){throw new eF.ErrnoError(29)}if(void 0===i&&0===s)throw new eF.ErrnoError(6);if(null==i)break;s++,r[n+l]=i}return s&&(e.node.timestamp=Date.now()),s},write(e,r,t,o,a){for(var i=0;i<o;i++)try{n(r[t+i])}catch(e){throw new eF.ErrnoError(29)}return o&&(e.node.timestamp=Date.now()),i}}),eF.mkdev(o,a,i)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw 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=a(e.url),e.usedBytes=e.contents.length}catch(e){throw new eF.ErrnoError(29)}},createLazyFile(e,r,t,n,o){if("undefined"!=typeof XMLHttpRequest){if(!F)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a={isDevice:!1,contents:new class{constructor(){this.lengthKnown=!1,this.chunks=[]}get(e){if(!(e>this.length-1)&&!(e<0)){var r=e%this.chunkSize,t=e/this.chunkSize|0;return this.getter(t)[r]}}setDataGetter(e){this.getter=e}cacheLength(){var e,r=new XMLHttpRequest;if(r.open("HEAD",t,!1),r.send(null),!(r.status>=200&&r.status<300||304===r.status))throw Error("Couldn't load "+t+". Status: "+r.status);var n=Number(r.getResponseHeader("Content-length")),o=(e=r.getResponseHeader("Accept-Ranges"))&&"bytes"===e,a=(e=r.getResponseHeader("Content-Encoding"))&&"gzip"===e,i=1048576;o||(i=n);var s=(e,r)=>{if(e>r)throw Error("invalid range ("+e+", "+r+") or no bytes requested!");if(r>n-1)throw 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 Error("Couldn't load "+t+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):ep(o.responseText||"",!0)},l=this;l.setDataGetter(e=>{var r=e*i,t=(e+1)*i-1;if(t=Math.min(t,n-1),void 0===l.chunks[e]&&(l.chunks[e]=s(r,t)),void 0===l.chunks[e])throw Error("doXHR failed!");return l.chunks[e]}),(a||!n)&&(i=n=1,i=n=this.getter(0).length,z("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}}}else var a={isDevice:!1,url:t};var i=eF.createFile(e,r,a,n,o);a.contents?i.contents=a.contents:a.url&&(i.contents=null,i.url=a.url),Object.defineProperties(i,{usedBytes:{get:function(){return this.contents.length}}});var s={};function u(e,r,t,n,o){var a=e.node.contents;if(o>=a.length)return 0;var i=Math.min(a.length-o,n);if(a.slice)for(var s=0;s<i;s++)r[t+s]=a[o+s];else for(var s=0;s<i;s++)r[t+s]=a.get(o+s);return i}return Object.keys(i.stream_ops).forEach(e=>{var r=i.stream_ops[e];s[e]=(...e)=>(eF.forceLoadFile(i),r(...e))}),s.read=(e,r,t,n,o)=>(eF.forceLoadFile(i),u(e,r,t,n,o)),s.mmap=(e,r,t,n,o)=>{eF.forceLoadFile(i);var a=ew(r);if(!a)throw new eF.ErrnoError(48);return u(e,l,a,r,t),{ptr:a,allocated:!0}},i.stream_ops=s,i}},eS=(e,r)=>e?ed(u,e,r):"",eM={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(ea.isAbs(r))return r;if(-100===e)n=eF.cwd();else{var n;n=eM.getStreamFromFD(e).path}if(0==r.length){if(!t)throw new eF.ErrnoError(44);return n}return ea.join2(n,r)},doStat(e,r,t){var n=e(r);f[t>>2]=n.dev,f[t+4>>2]=n.mode,h[t+8>>2]=n.nlink,f[t+12>>2]=n.uid,f[t+16>>2]=n.gid,f[t+20>>2]=n.rdev,g=[n.size>>>0,+Math.abs(y=n.size)>=1?y>0?+Math.floor(y/4294967296)>>>0:~~+Math.ceil((y-+(~~y>>>0))/4294967296)>>>0:0],f[t+24>>2]=g[0],f[t+28>>2]=g[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 g=[Math.floor(o/1e3)>>>0,+Math.abs(y=Math.floor(o/1e3))>=1?y>0?+Math.floor(y/4294967296)>>>0:~~+Math.ceil((y-+(~~y>>>0))/4294967296)>>>0:0],f[t+40>>2]=g[0],f[t+44>>2]=g[1],h[t+48>>2]=o%1e3*1e3,g=[Math.floor(a/1e3)>>>0,+Math.abs(y=Math.floor(a/1e3))>=1?y>0?+Math.floor(y/4294967296)>>>0:~~+Math.ceil((y-+(~~y>>>0))/4294967296)>>>0:0],f[t+56>>2]=g[0],f[t+60>>2]=g[1],h[t+64>>2]=a%1e3*1e3,g=[Math.floor(i/1e3)>>>0,+Math.abs(y=Math.floor(i/1e3))>=1?y>0?+Math.floor(y/4294967296)>>>0:~~+Math.ceil((y-+(~~y>>>0))/4294967296)>>>0:0],f[t+72>>2]=g[0],f[t+76>>2]=g[1],h[t+80>>2]=i%1e3*1e3,g=[n.ino>>>0,+Math.abs(y=n.ino)>=1?y>0?+Math.floor(y/4294967296)>>>0:~~+Math.ceil((y-+(~~y>>>0))/4294967296)>>>0:0],f[t+88>>2]=g[0],f[t+92>>2]=g[1],0},doMsync(e,r,t,n,o){if(!eF.isFile(r.node.mode))throw new eF.ErrnoError(43);if(2&n)return 0;var a=u.slice(e,e+t);eF.msync(r,a,o,t,n)},getStreamFromFD:e=>eF.getStreamChecked(e),varargs:void 0,getStr:e=>eS(e)};function eA(){var e=f[+eM.varargs>>2];return eM.varargs+=4,e}var ej=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*r:NaN,eO=(e,r,t)=>eh(e,u,r,t),eR=(e,r)=>Object.defineProperty(r,"name",{value:e}),eN=[],ez=[],ex=e=>{throw new w(e)},eU={toValue:e=>(e||ex("Cannot use deleted val. handle = "+e),ez[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let r=eN.pop()||ez.length;return ez[r]=e,ez[r+1]=1,r}}}},eW=(e,r)=>{var t=eR(r,function(e){this.name=r,this.message=e;var t=Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},t},eL=e=>{for(var r="",t=e;u[t];)r+=_[u[t++]];return r},eI=[],eH=()=>{for(;eI.length;){var e=eI.pop();e.$$.deleteScheduled=!1,e.delete()}},eB={},eV=(e,r)=>{for(void 0===r&&ex("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r},eq=(e,r,t)=>{r=eV(e,r),eB.hasOwnProperty(r)?ex(`Tried to register registered instance: ${r}`):eB[r]=t},eY={},eG=e=>{var r=tv(e),t=eL(r);return tg(r),t},eX=(e,r)=>{var t=eY[e];return void 0===t&&ex(`${r} has unknown type ${eG(e)}`),t},eJ=(e,r)=>{r=eV(e,r),eB.hasOwnProperty(r)?delete eB[r]:ex(`Tried to unregister unregistered instance: ${r}`)},eK=e=>{},eZ=!1,eQ=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},e0=e=>{e.count.value-=1,0===e.count.value&&eQ(e)},e2=(e,r,t)=>{if(r===t)return e;if(void 0===t.baseClass)return null;var n=e2(e,r,t.baseClass);return null===n?null:t.downcast(n)},e1={},e4=(e,r)=>eB[r=eV(e,r)],e6=e=>{throw new k(e)},e3=(e,r)=>(r.ptrType&&r.ptr||e6("makeClassHandle requires ptr and ptrType"),!!r.smartPtrType!=!!r.smartPtr&&e6("Both smartPtrType and smartPtr must be specified"),r.count={value:1},e5(Object.create(e,{$$:{value:r,writable:!0}}))),e5=e=>"undefined"==typeof FinalizationRegistry?(e5=e=>e,e):(eZ=new FinalizationRegistry(e=>{e0(e.$$)}),e5=e=>{var r=e.$$;return r.smartPtr&&eZ.register(e,{$$:r},e),e},eK=e=>eZ.unregister(e),e5(e)),e9={},e8=e=>{for(;e.length;){var r=e.pop();e.pop()(r)}};function e7(e){return this.fromWireType(h[e>>2])}var re={},rr={},rt=(e,r,t)=>{function n(r){var n=t(r);n.length!==e.length&&e6("Mismatched type converter count");for(var o=0;o<e.length;++o)rn(e[o],n[o])}e.forEach(function(e){rr[e]=r});var o=Array(r.length),a=[],i=0;r.forEach((e,r)=>{eY.hasOwnProperty(e)?o[r]=eY[e]:(a.push(e),re.hasOwnProperty(e)||(re[e]=[]),re[e].push(()=>{o[r]=eY[e],++i===a.length&&n(o)}))}),0===a.length&&n(o)};function rn(e,r,t={}){if(!("argPackAdvance"in r))throw TypeError("registerType registeredInstance requires argPackAdvance");return function(e,r,t={}){var n=r.name;if(e||ex(`type "${n}" must have a positive integer typeid pointer`),eY.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;ex(`Cannot register type '${n}' twice`)}if(eY[e]=r,delete rr[e],re.hasOwnProperty(e)){var o=re[e];delete re[e],o.forEach(e=>e())}}(e,r,t)}var ro=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),ra=e=>{ex(e.$$.ptrType.registeredClass.name+" instance already deleted")};function ri(){}var rs=(e,r,t)=>{if(void 0===e[r].overloadTable){var n=e[r];e[r]=function(...n){return e[r].overloadTable.hasOwnProperty(n.length)||ex(`Function '${t}' called with an invalid number of arguments (${n.length}) - expects one of (${e[r].overloadTable})!`),e[r].overloadTable[n.length].apply(this,n)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}},rl=(e,t,n)=>{r.hasOwnProperty(e)?((void 0===n||void 0!==r[e].overloadTable&&void 0!==r[e].overloadTable[n])&&ex(`Cannot register public name '${e}' twice`),rs(r,e,e),r.hasOwnProperty(n)&&ex(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),r[e].overloadTable[n]=t):(r[e]=t,void 0!==n&&(r[e].numArguments=n))},ru=e=>{if(void 0===e)return"_unknown";var r=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return r>=48&&r<=57?`_${e}`:e};function rd(e,r,t,n,o,a,i,s){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=o,this.getActualType=a,this.upcast=i,this.downcast=s,this.pureVirtualFunctions=[]}var rc=(e,r,t)=>{for(;r!==t;)r.upcast||ex(`Expected null or instance of ${t.name}, got an instance of ${r.name}`),e=r.upcast(e),r=r.baseClass;return e};function rf(e,r){if(null===r)return this.isReference&&ex(`null is not a valid ${this.name}`),0;r.$$||ex(`Cannot pass "${rA(r)}" as a ${this.name}`),r.$$.ptr||ex(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=r.$$.ptrType.registeredClass;return rc(r.$$.ptr,t,this.registeredClass)}function rh(e,r){if(null===r)return(this.isReference&&ex(`null is not a valid ${this.name}`),this.isSmartPointer)?(t=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,t),t):0;r&&r.$$||ex(`Cannot pass "${rA(r)}" as a ${this.name}`),r.$$.ptr||ex(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&r.$$.ptrType.isConst&&ex(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);var t,n=r.$$.ptrType.registeredClass;if(t=rc(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===r.$$.smartPtr&&ex("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:ex(`Cannot convert argument of type ${r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var o=r.clone();t=this.rawShare(t,eU.toHandle(()=>o.delete())),null!==e&&e.push(this.rawDestructor,t)}break;default:ex("Unsupporting sharing policy")}return t}function rp(e,r){if(null===r)return this.isReference&&ex(`null is not a valid ${this.name}`),0;r.$$||ex(`Cannot pass "${rA(r)}" as a ${this.name}`),r.$$.ptr||ex(`Cannot pass deleted object as a pointer of type ${this.name}`),r.$$.ptrType.isConst&&ex(`Cannot convert argument of type ${r.$$.ptrType.name} to parameter type ${this.name}`);var t=r.$$.ptrType.registeredClass;return rc(r.$$.ptr,t,this.registeredClass)}function rm(e,r,t,n,o,a,i,s,l,u,d){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=o,this.pointeeType=a,this.sharingPolicy=i,this.rawGetPointee=s,this.rawConstructor=l,this.rawShare=u,this.rawDestructor=d,o||void 0!==r.baseClass?this.toWireType=rh:(n?this.toWireType=rf:this.toWireType=rp,this.destructorFunction=null)}var rv=(e,t,n)=>{r.hasOwnProperty(e)||e6("Replacing nonexistent public symbol"),void 0!==r[e].overloadTable&&void 0!==n?r[e].overloadTable[n]=t:(r[e]=t,r[e].argCount=n)},ry=(e,t,n)=>(0,r["dynCall_"+(e=e.replace(/p/g,"i"))])(t,...n),rg=e=>$.get(e),rw=(e,r,t=[])=>e.includes("j")?ry(e,r,t):rg(r)(...t),rE=(e,r)=>(...t)=>rw(e,r,t),r_=(e,r)=>{var t=(e=eL(e)).includes("j")?rE(e,r):rg(r);return"function"!=typeof t&&ex(`unknown function pointer with signature ${e}: ${r}`),t},rb=(e,r)=>{var t=[],n={};throw r.forEach(function e(r){if(!n[r]&&!eY[r]){if(rr[r]){rr[r].forEach(e);return}t.push(r),n[r]=!0}}),new C(`${e}: `+t.map(eG).join([", "]))};function rk(e){for(var r=1;r<e.length;++r)if(null!==e[r]&&void 0===e[r].destructorFunction)return!0;return!1}function r$(e,r){if(!(e instanceof Function))throw TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var t=eR(e.name||"unknownFunctionName",function(){});t.prototype=e.prototype;var n=new t,o=e.apply(n,r);return o instanceof Object?o:n}function rC(e,r,t,n,o,a){var i=r.length;i<2&&ex("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==r[1]&&null!==t,l=rk(r),u="void"!==r[0].name,d=[e,ex,n,o,e8,r[0],r[1]],c=0;c<i-2;++c)d.push(r[c+2]);if(!l)for(var c=s?1:2;c<r.length;++c)null!==r[c].destructorFunction&&d.push(r[c].destructorFunction);let[f,h]=function(e,r,t,n){for(var o=rk(e),a=e.length,i="",s="",l=0;l<a-2;++l)i+=(0!==l?", ":"")+"arg"+l,s+=(0!==l?", ":"")+"arg"+l+"Wired";var u=`
return function (${i}) {
if (arguments.length !== ${a-2}) {
throwBindingError('function ' + humanName + ' called with ' + arguments.length + ' arguments, expected ${a-2}');
}`;o&&(u+="var destructors = [];\n");var d=o?"destructors":"null",c=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];r&&(u+="var thisWired = classParam['toWireType']("+d+", this);\n");for(var l=0;l<a-2;++l)u+="var arg"+l+"Wired = argType"+l+"['toWireType']("+d+", arg"+l+");\n",c.push("argType"+l);if(r&&(s="thisWired"+(s.length>0?", ":"")+s),u+=(t||n?"var rv = ":"")+"invoker(fn"+(s.length>0?", ":"")+s+");\n",o)u+="runDestructors(destructors);\n";else for(var l=r?1:2;l<e.length;++l){var f=1===l?"thisWired":"arg"+(l-2)+"Wired";null!==e[l].destructorFunction&&(u+=`${f}_dtor(${f});
`,c.push(`${f}_dtor`))}return t&&(u+="var ret = retType['fromWireType'](rv);\nreturn ret;\n"),[c,u+="}\n"]}(r,s,u,a);return f.push(h),eR(e,r$(Function,f)(...d))}var rP=(e,r)=>{for(var t=[],n=0;n<e;n++)t.push(h[r+4*n>>2]);return t},rT=e=>{e=e.trim();let r=e.indexOf("(");return -1!==r?e.substr(0,r):e},rD=(e,r,t)=>(e instanceof Object||ex(`${t} with invalid "this": ${e}`),e instanceof r.registeredClass.constructor||ex(`${t} incompatible with "this" of type ${e.constructor.name}`),e.$$.ptr||ex(`cannot call emscripten binding method ${t} on deleted object`),rc(e.$$.ptr,e.$$.ptrType.registeredClass,r.registeredClass)),rF=e=>{e>9&&0==--ez[e+1]&&(ez[e]=void 0,eN.push(e))},rS={name:"emscripten::val",fromWireType:e=>{var r=eU.toValue(e);return rF(e),r},toWireType:(e,r)=>eU.toHandle(r),argPackAdvance:8,readValueFromPointer:e7,destructorFunction:null},rM=e=>rn(e,rS),rA=e=>{if(null===e)return"null";var r=typeof e;return"object"===r||"array"===r||"function"===r?e.toString():""+e},rj=(e,r)=>{switch(r){case 4:return function(e){return this.fromWireType(p[e>>2])};case 8:return function(e){return this.fromWireType(m[e>>3])};default:throw TypeError(`invalid float width (${r}): ${e}`)}},rO=(e,r,t)=>{switch(r){case 1:return t?e=>l[e]:e=>u[e];case 2:return t?e=>d[e>>1]:e=>c[e>>1];case 4:return t?e=>f[e>>2]:e=>h[e>>2];default:throw TypeError(`invalid integer width (${r}): ${e}`)}},rR="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,rN=(e,r)=>{for(var t=e,n=t>>1,o=n+r/2;!(n>=o)&&c[n];)++n;if((t=n<<1)-e>32&&rR)return rR.decode(u.subarray(e,t));for(var a="",i=0;!(i>=r/2);++i){var s=d[e+2*i>>1];if(0==s)break;a+=String.fromCharCode(s)}return a},rz=(e,r,t)=>{if((t??=2147483647)<2)return 0;for(var n=r,o=(t-=2)<2*e.length?t/2:e.length,a=0;a<o;++a){var i=e.charCodeAt(a);d[r>>1]=i,r+=2}return d[r>>1]=0,r-n},rx=e=>2*e.length,rU=(e,r)=>{for(var t=0,n="";!(t>=r/4);){var o=f[e+4*t>>2];if(0==o)break;if(++t,o>=65536){var a=o-65536;n+=String.fromCharCode(55296|a>>10,56320|1023&a)}else n+=String.fromCharCode(o)}return n},rW=(e,r,t)=>{if((t??=2147483647)<4)return 0;for(var n=r,o=n+t-4,a=0;a<e.length;++a){var i=e.charCodeAt(a);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++a)),f[r>>2]=i,(r+=4)+4>o)break}return f[r>>2]=0,r-n},rL=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&++t,r+=4}return r},rI=(e,r,t)=>{var n=[],o=e.toWireType(n,t);return n.length&&(h[r>>2]=eU.toHandle(n)),o},rH=[],rB={},rV=e=>{var r=rB[e];return void 0===r?eL(e):r},rq=()=>"object"==typeof globalThis?globalThis:Function("return this")(),rY=e=>{var r=rH.length;return rH.push(e),r},rG=(e,r)=>{for(var t=Array(e),n=0;n<e;++n)t[n]=eX(h[r+4*n>>2],"parameter "+n);return t};Reflect.construct;var rX=e=>e%4==0&&(e%100!=0||e%400==0),rJ=[0,31,60,91,121,152,182,213,244,274,305,335],rK=[0,31,59,90,120,151,181,212,243,273,304,334],rZ=e=>(rX(e.getFullYear())?rJ:rK)[e.getMonth()]+e.getDate()-1,rQ=e=>t_(e),r0=[],r2=(e,r)=>{for(r0.length=0;t=u[e++];){var t,n=105!=t;n&=112!=t,r+=n&&r%8?4:0,r0.push(112==t?h[r>>2]:105==t?f[r>>2]:m[r>>3]),r+=n?8:4}return r0},r1=(e,r,t)=>{var n=r2(r,t);return er[e](...n)},r4=()=>2147483648,r6=e=>{var r=(e-s.buffer.byteLength+65535)/65536;try{return s.grow(r),W(),1}catch(e){}},r3=e=>(J("Cannot use convertFrameToPC (needed by __builtin_return_address) wit