UNPKG

scanbot-web-sdk

Version:

Scanbot Web Document and Barcode Scanner SDK

1 lines 133 kB
!function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t,r){"use strict";(function(e){function i(e,t=!1){const r=[];if(t)return r;return function e(t){if(t)if(t.constructor===ImageData)r.push(t.data.buffer);else if(t.constructor===ArrayBuffer)r.push(t);else if(ArrayBuffer.isView(t))r.push(t.buffer);else if(Array.isArray(t))for(let r=0;r<t.length;++r)e(t[r]);else if(t.constructor===Object)for(const r in t)t.hasOwnProperty(r)&&e(t[r])}(e),r}function n(e){return e.startsWith("http:")||e.startsWith("https:")}function o(t){const{allowSimd:r=!0,allowThreads:i=!0}=t||{};let n="";if(r&&function(){try{return WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]))}catch(e){return!1}}()){n+="-simd";i&&function(){if("undefined"!=typeof e&&"undefined"!=typeof e.versions&&"undefined"!=typeof e.versions.node)return!1;if(/(iPad|iPhone|iPod)/g.test(navigator.userAgent))return!1;try{return(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]))}catch(e){return!1}}()&&(n+="-threads")}return n}r.d(t,"a",(function(){return i})),r.d(t,"c",(function(){return n})),r.d(t,"b",(function(){return o}))}).call(this,r(1))},function(e,t){var r,i,n=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var u,d=[],c=!1,m=-1;function l(){c&&u&&(c=!1,u.length?d=u.concat(d):m=-1,d.length&&h())}function h(){if(!c){var e=s(l);c=!0;for(var t=d.length;t;){for(u=d,d=[];++m<t;)u&&u[m].run();m=-1,t=d.length}u=null,c=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];d.push(new f(e,t)),1!==d.length||c||s(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},function(e,t,r){"use strict";var i,n=(i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e={}){var t,r,n=e;n.ready=new Promise(((e,i)=>{t=e,r=i}));var o,a,s,u=Object.assign({},n),d="./this.program",c=(e,t)=>{throw t},m="";m=self.location.href,i&&(m=i),m=0!==m.indexOf("blob:")?m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):"",o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)},a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)};var l,h=n.print||console.log.bind(console),f=n.printErr||console.error.bind(console);Object.assign(n,u),u=null,n.arguments&&n.arguments,n.thisProgram&&(d=n.thisProgram),n.quit&&(c=n.quit),n.wasmBinary&&(l=n.wasmBinary);var p,g=n.noExitRuntime||!0;"object"!=typeof WebAssembly&&B("no native wasm support detected");var v,y,w,S,C,F,b,E,_,x=!1;function A(){var e=p.buffer;n.HEAP8=v=new Int8Array(e),n.HEAP16=w=new Int16Array(e),n.HEAPU8=y=new Uint8Array(e),n.HEAPU16=S=new Uint16Array(e),n.HEAP32=C=new Int32Array(e),n.HEAPU32=F=new Uint32Array(e),n.HEAPF32=b=new Float32Array(e),n.HEAPF64=E=new Float64Array(e)}var D,T,k,P,z=[],O=[],M=[],R=0,Q=null,Z=null;function $(e){R++,n.monitorRunDependencies&&n.monitorRunDependencies(R)}function L(e){if(R--,n.monitorRunDependencies&&n.monitorRunDependencies(R),0==R&&(null!==Q&&(clearInterval(Q),Q=null),Z)){var t=Z;Z=null,t()}}function B(e){n.onAbort&&n.onAbort(e),f(e="Aborted("+e+")"),x=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw r(t),t}function I(e){return e.startsWith("data:application/octet-stream;base64,")}function j(e){if(e==D&&l)return new Uint8Array(l);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}function N(e,t,r){return function(e){return l||"function"!=typeof fetch?Promise.resolve().then((()=>j(e))):fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>j(e)))}(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{f(`failed to asynchronously prepare wasm: ${e}`),B(e)}))}I(D="ScanbotSDK.Asm-simd.wasm")||(T=D,D=n.locateFile?n.locateFile(T,m):m+T);var W={4002080:e=>mr(function(){return this[pe(e)].toString()}.apply((0,eval)("(()=>this)()")))};function H(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var U=e=>{for(;e.length>0;)e.shift()(n)},V=[],q=0,Y=0;function G(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){F[this.ptr+4>>2]=e},this.get_type=function(){return F[this.ptr+4>>2]},this.set_destructor=function(e){F[this.ptr+8>>2]=e},this.get_destructor=function(){return F[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,v[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=v[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,v[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=v[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){F[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return F[this.ptr+16>>2]},this.get_exception_ptr=function(){if(kr(this.get_type()))return F[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var X=e=>{var t=Y;if(!t)return Cr(0),0;var r=new G(t);r.set_adjusted_ptr(t);var i=r.get_type();if(!i)return Cr(0),t;for(var n in e){var o=e[n];if(0===o||o===i)break;var a=r.ptr+16;if(Tr(o,i,a))return Cr(o),t}return Cr(i),t},K=()=>{var e=V.pop();e||B("no exception to throw");var t=e.excPtr;throw e.get_rethrown()||(V.push(e),e.set_rethrown(!0),e.set_caught(!1),q++),Y=t},J={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=J.isAbs(e),r="/"===e.substr(-1);return(e=J.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=J.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=J.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments);return J.normalize(e.join("/"))},join2:(e,t)=>J.normalize(e+"/"+t)},ee=e=>(ee=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);B("initRandomDevice")})())(e),te={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:fe.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=J.isAbs(i)}return(t?"/":"")+(e=J.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=te.resolve(e).substr(1),t=te.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),o=Math.min(i.length,n.length),a=o,s=0;s<o;s++)if(i[s]!==n[s]){a=s;break}var u=[];for(s=a;s<i.length;s++)u.push("..");return(u=u.concat(n.slice(a))).join("/")}},re="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,ie=(e,t,r)=>{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&re)return re.decode(e.subarray(t,n));for(var o="";t<n;){var a=e[t++];if(128&a){var s=63&e[t++];if(192!=(224&a)){var u=63&e[t++];if((a=224==(240&a)?(15&a)<<12|s<<6|u:(7&a)<<18|s<<12|u<<6|63&e[t++])<65536)o+=String.fromCharCode(a);else{var d=a-65536;o+=String.fromCharCode(55296|d>>10,56320|1023&d)}}else o+=String.fromCharCode((31&a)<<6|s)}else o+=String.fromCharCode(a)}return o},ne=[],oe=e=>{for(var t=0,r=0;r<e.length;++r){var i=e.charCodeAt(r);i<=127?t++:i<=2047?t+=2:i>=55296&&i<=57343?(t+=4,++r):t+=3}return t},ae=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,o=r+i-1,a=0;a<e.length;++a){var s=e.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(r>=o)break;t[r++]=s}else if(s<=2047){if(r+1>=o)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=o)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=o)break;t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}return t[r]=0,r-n};function se(e,t,r){var i=r>0?r:oe(e)+1,n=new Array(i),o=ae(e,n,0,n.length);return t&&(n.length=o),n}var ue={ttys:[],init(){},shutdown(){},register(e,t){ue.ttys[e]={input:[],output:[],ops:t},fe.registerDevice(e,ue.stream_ops)},stream_ops:{open(e){var t=ue.ttys[e.node.rdev];if(!t)throw new fe.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new fe.ErrnoError(60);for(var o=0,a=0;a<i;a++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new fe.ErrnoError(29)}if(void 0===s&&0===o)throw new fe.ErrnoError(6);if(null==s)break;o++,t[r+a]=s}return o&&(e.node.timestamp=Date.now()),o},write(e,t,r,i,n){if(!e.tty||!e.tty.ops.put_char)throw new fe.ErrnoError(60);try{for(var o=0;o<i;o++)e.tty.ops.put_char(e.tty,t[r+o])}catch(e){throw new fe.ErrnoError(29)}return i&&(e.node.timestamp=Date.now()),o}},default_tty_ops:{get_char:e=>(()=>{if(!ne.length){var e=null;if("undefined"!=typeof window&&"function"==typeof window.prompt?null!==(e=window.prompt("Input: "))&&(e+="\n"):"function"==typeof readline&&null!==(e=readline())&&(e+="\n"),!e)return null;ne=se(e,!0)}return ne.shift()})(),put_char(e,t){null===t||10===t?(h(ie(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(h(ie(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,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(f(ie(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(f(ie(e.output,0)),e.output=[])}}},de=e=>{e=((e,t)=>Math.ceil(e/t)*t)(e,65536);var t=br(65536,e);return t?((e,t)=>(y.fill(0,e,e+t),e))(t,e):0},ce={ops_table:null,mount:e=>ce.createNode(null,"/",16895,0),createNode(e,t,r,i){if(fe.isBlkdev(r)||fe.isFIFO(r))throw new fe.ErrnoError(63);ce.ops_table||(ce.ops_table={dir:{node:{getattr:ce.node_ops.getattr,setattr:ce.node_ops.setattr,lookup:ce.node_ops.lookup,mknod:ce.node_ops.mknod,rename:ce.node_ops.rename,unlink:ce.node_ops.unlink,rmdir:ce.node_ops.rmdir,readdir:ce.node_ops.readdir,symlink:ce.node_ops.symlink},stream:{llseek:ce.stream_ops.llseek}},file:{node:{getattr:ce.node_ops.getattr,setattr:ce.node_ops.setattr},stream:{llseek:ce.stream_ops.llseek,read:ce.stream_ops.read,write:ce.stream_ops.write,allocate:ce.stream_ops.allocate,mmap:ce.stream_ops.mmap,msync:ce.stream_ops.msync}},link:{node:{getattr:ce.node_ops.getattr,setattr:ce.node_ops.setattr,readlink:ce.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ce.node_ops.getattr,setattr:ce.node_ops.setattr},stream:fe.chrdev_stream_ops}});var n=fe.createNode(e,t,r,i);return fe.isDir(n.mode)?(n.node_ops=ce.ops_table.dir.node,n.stream_ops=ce.ops_table.dir.stream,n.contents={}):fe.isFile(n.mode)?(n.node_ops=ce.ops_table.file.node,n.stream_ops=ce.ops_table.file.stream,n.usedBytes=0,n.contents=null):fe.isLink(n.mode)?(n.node_ops=ce.ops_table.link.node,n.stream_ops=ce.ops_table.link.stream):fe.isChrdev(n.mode)&&(n.node_ops=ce.ops_table.chrdev.node,n.stream_ops=ce.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=fe.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,fe.isDir(e.mode)?t.size=4096:fe.isFile(e.mode)?t.size=e.usedBytes:fe.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&ce.resizeFileStorage(e,t.size)},lookup(e,t){throw fe.genericErrors[44]},mknod:(e,t,r,i)=>ce.createNode(e,t,r,i),rename(e,t,r){if(fe.isDir(e.mode)){var i;try{i=fe.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new fe.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var r=fe.lookupNode(e,t);for(var i in r.contents)throw new fe.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink(e,t,r){var i=ce.createNode(e,t,41471,0);return i.link=r,i},readlink(e){if(!fe.isLink(e.mode))throw new fe.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,i,n){var o=e.node.contents;if(n>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-n,i);if(a>8&&o.subarray)t.set(o.subarray(n,n+a),r);else for(var s=0;s<a;s++)t[r+s]=o[n+s];return a},write(e,t,r,i,n,o){if(t.buffer===v.buffer&&(o=!1),!i)return 0;var a=e.node;if(a.timestamp=Date.now(),t.subarray&&(!a.contents||a.contents.subarray)){if(o)return a.contents=t.subarray(r,r+i),a.usedBytes=i,i;if(0===a.usedBytes&&0===n)return a.contents=t.slice(r,r+i),a.usedBytes=i,i;if(n+i<=a.usedBytes)return a.contents.set(t.subarray(r,r+i),n),i}if(ce.expandFileStorage(a,n+i),a.contents.subarray&&t.subarray)a.contents.set(t.subarray(r,r+i),n);else for(var s=0;s<i;s++)a.contents[n+s]=t[r+s];return a.usedBytes=Math.max(a.usedBytes,n+i),i},llseek(e,t,r){var i=t;if(1===r?i+=e.position:2===r&&fe.isFile(e.node.mode)&&(i+=e.node.usedBytes),i<0)throw new fe.ErrnoError(28);return i},allocate(e,t,r){ce.expandFileStorage(e.node,t+r),e.node.usedBytes=Math.max(e.node.usedBytes,t+r)},mmap(e,t,r,i,n){if(!fe.isFile(e.node.mode))throw new fe.ErrnoError(43);var o,a,s=e.node.contents;if(2&n||s.buffer!==v.buffer){if((r>0||r+t<s.length)&&(s=s.subarray?s.subarray(r,r+t):Array.prototype.slice.call(s,r,r+t)),a=!0,!(o=de(t)))throw new fe.ErrnoError(48);v.set(s,o)}else a=!1,o=s.byteOffset;return{ptr:o,allocated:a}},msync:(e,t,r,i,n)=>(ce.stream_ops.write(e,t,0,i,r,!1),0)}},me=(e,t,r,i)=>{var n=i?"":`al ${e}`;a(e,(r=>{var i;i=`Loading data file "${e}" failed (no arrayBuffer).`,r||B(i),t(new Uint8Array(r)),n&&L()}),(t=>{if(!r)throw`Loading data file "${e}" failed.`;r()})),n&&$()},le=n.preloadPlugins||[],he=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},fe={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(e,t={}){if(!(e=te.resolve(e)))return{path:"",node:null};if((t=Object.assign({follow_mount:!0,recurse_count:0},t)).recurse_count>8)throw new fe.ErrnoError(32);for(var r=e.split("/").filter((e=>!!e)),i=fe.root,n="/",o=0;o<r.length;o++){var a=o===r.length-1;if(a&&t.parent)break;if(i=fe.lookupNode(i,r[o]),n=J.join2(n,r[o]),fe.isMountpoint(i)&&(!a||a&&t.follow_mount)&&(i=i.mounted.root),!a||t.follow)for(var s=0;fe.isLink(i.mode);){var u=fe.readlink(n);if(n=te.resolve(J.dirname(n),u),i=fe.lookupPath(n,{recurse_count:t.recurse_count+1}).node,s++>40)throw new fe.ErrnoError(32)}}return{path:n,node:i}},getPath(e){for(var t;;){if(fe.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,i=0;i<t.length;i++)r=(r<<5)-r+t.charCodeAt(i)|0;return(e+r>>>0)%fe.nameTable.length},hashAddNode(e){var t=fe.hashName(e.parent.id,e.name);e.name_next=fe.nameTable[t],fe.nameTable[t]=e},hashRemoveNode(e){var t=fe.hashName(e.parent.id,e.name);if(fe.nameTable[t]===e)fe.nameTable[t]=e.name_next;else for(var r=fe.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=fe.mayLookup(e);if(r)throw new fe.ErrnoError(r,e);for(var i=fe.hashName(e.id,t),n=fe.nameTable[i];n;n=n.name_next){var o=n.name;if(n.parent.id===e.id&&o===t)return n}return fe.lookup(e,t)},createNode(e,t,r,i){var n=new fe.FSNode(e,t,r,i);return fe.hashAddNode(n),n},destroyNode(e){fe.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>fe.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup(e){var t=fe.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{return fe.lookupNode(e,t),20}catch(e){}return fe.nodePermissions(e,"wx")},mayDelete(e,t,r){var i;try{i=fe.lookupNode(e,t)}catch(e){return e.errno}var n=fe.nodePermissions(e,"wx");if(n)return n;if(r){if(!fe.isDir(i.mode))return 54;if(fe.isRoot(i)||fe.getPath(i)===fe.cwd())return 10}else if(fe.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?fe.isLink(e.mode)?32:fe.isDir(e.mode)&&("r"!==fe.flagsToPermissionString(t)||512&t)?31:fe.nodePermissions(e,fe.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=fe.MAX_OPEN_FDS;e++)if(!fe.streams[e])return e;throw new fe.ErrnoError(33)},getStreamChecked(e){var t=fe.getStream(e);if(!t)throw new fe.ErrnoError(8);return t},getStream:e=>fe.streams[e],createStream:(e,t=-1)=>(fe.FSStream||(fe.FSStream=function(){this.shared={}},fe.FSStream.prototype={},Object.defineProperties(fe.FSStream.prototype,{object:{get(){return this.node},set(e){this.node=e}},isRead:{get(){return 1!=(2097155&this.flags)}},isWrite:{get(){return 0!=(2097155&this.flags)}},isAppend:{get(){return 1024&this.flags}},flags:{get(){return this.shared.flags},set(e){this.shared.flags=e}},position:{get(){return this.shared.position},set(e){this.shared.position=e}}})),e=Object.assign(new fe.FSStream,e),-1==t&&(t=fe.nextfd()),e.fd=t,fe.streams[t]=e,e),closeStream(e){fe.streams[e]=null},chrdev_stream_ops:{open(e){var t=fe.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek(){throw new fe.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){fe.devices[e]={stream_ops:t}},getDevice:e=>fe.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),fe.syncFSRequests++,fe.syncFSRequests>1&&f(`warning: ${fe.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=fe.getMounts(fe.root.mount),i=0;function n(e){return fe.syncFSRequests--,t(e)}function o(e){if(e)return o.errored?void 0:(o.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return o(null);t.type.syncfs(t,e,o)}))},mount(e,t,r){var i,n="/"===r,o=!r;if(n&&fe.root)throw new fe.ErrnoError(10);if(!n&&!o){var a=fe.lookupPath(r,{follow_mount:!1});if(r=a.path,i=a.node,fe.isMountpoint(i))throw new fe.ErrnoError(10);if(!fe.isDir(i.mode))throw new fe.ErrnoError(54)}var s={type:e,opts:t,mountpoint:r,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,n?fe.root=u:i&&(i.mounted=s,i.mount&&i.mount.mounts.push(s)),u},unmount(e){var t=fe.lookupPath(e,{follow_mount:!1});if(!fe.isMountpoint(t.node))throw new fe.ErrnoError(28);var r=t.node,i=r.mounted,n=fe.getMounts(i);Object.keys(fe.nameTable).forEach((e=>{for(var t=fe.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&fe.destroyNode(t),t=r}})),r.mounted=null;var o=r.mount.mounts.indexOf(i);r.mount.mounts.splice(o,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var i=fe.lookupPath(e,{parent:!0}).node,n=J.basename(e);if(!n||"."===n||".."===n)throw new fe.ErrnoError(28);var o=fe.mayCreate(i,n);if(o)throw new fe.ErrnoError(o);if(!i.node_ops.mknod)throw new fe.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,fe.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,fe.mknod(e,t,0)),mkdirTree(e,t){for(var r=e.split("/"),i="",n=0;n<r.length;++n)if(r[n]){i+="/"+r[n];try{fe.mkdir(i,t)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,t,r)=>("undefined"==typeof r&&(r=t,t=438),t|=8192,fe.mknod(e,t,r)),symlink(e,t){if(!te.resolve(e))throw new fe.ErrnoError(44);var r=fe.lookupPath(t,{parent:!0}).node;if(!r)throw new fe.ErrnoError(44);var i=J.basename(t),n=fe.mayCreate(r,i);if(n)throw new fe.ErrnoError(n);if(!r.node_ops.symlink)throw new fe.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename(e,t){var r,i,n=J.dirname(e),o=J.dirname(t),a=J.basename(e),s=J.basename(t);if(r=fe.lookupPath(e,{parent:!0}).node,i=fe.lookupPath(t,{parent:!0}).node,!r||!i)throw new fe.ErrnoError(44);if(r.mount!==i.mount)throw new fe.ErrnoError(75);var u,d=fe.lookupNode(r,a),c=te.relative(e,o);if("."!==c.charAt(0))throw new fe.ErrnoError(28);if("."!==(c=te.relative(t,n)).charAt(0))throw new fe.ErrnoError(55);try{u=fe.lookupNode(i,s)}catch(e){}if(d!==u){var m=fe.isDir(d.mode),l=fe.mayDelete(r,a,m);if(l)throw new fe.ErrnoError(l);if(l=u?fe.mayDelete(i,s,m):fe.mayCreate(i,s))throw new fe.ErrnoError(l);if(!r.node_ops.rename)throw new fe.ErrnoError(63);if(fe.isMountpoint(d)||u&&fe.isMountpoint(u))throw new fe.ErrnoError(10);if(i!==r&&(l=fe.nodePermissions(r,"w")))throw new fe.ErrnoError(l);fe.hashRemoveNode(d);try{r.node_ops.rename(d,i,s)}catch(e){throw e}finally{fe.hashAddNode(d)}}},rmdir(e){var t=fe.lookupPath(e,{parent:!0}).node,r=J.basename(e),i=fe.lookupNode(t,r),n=fe.mayDelete(t,r,!0);if(n)throw new fe.ErrnoError(n);if(!t.node_ops.rmdir)throw new fe.ErrnoError(63);if(fe.isMountpoint(i))throw new fe.ErrnoError(10);t.node_ops.rmdir(t,r),fe.destroyNode(i)},readdir(e){var t=fe.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new fe.ErrnoError(54);return t.node_ops.readdir(t)},unlink(e){var t=fe.lookupPath(e,{parent:!0}).node;if(!t)throw new fe.ErrnoError(44);var r=J.basename(e),i=fe.lookupNode(t,r),n=fe.mayDelete(t,r,!1);if(n)throw new fe.ErrnoError(n);if(!t.node_ops.unlink)throw new fe.ErrnoError(63);if(fe.isMountpoint(i))throw new fe.ErrnoError(10);t.node_ops.unlink(t,r),fe.destroyNode(i)},readlink(e){var t=fe.lookupPath(e).node;if(!t)throw new fe.ErrnoError(44);if(!t.node_ops.readlink)throw new fe.ErrnoError(28);return te.resolve(fe.getPath(t.parent),t.node_ops.readlink(t))},stat(e,t){var r=fe.lookupPath(e,{follow:!t}).node;if(!r)throw new fe.ErrnoError(44);if(!r.node_ops.getattr)throw new fe.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>fe.stat(e,!0),chmod(e,t,r){var i;if(!(i="string"==typeof e?fe.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new fe.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod(e,t){fe.chmod(e,t,!0)},fchmod(e,t){var r=fe.getStreamChecked(e);fe.chmod(r.node,t)},chown(e,t,r,i){var n;if(!(n="string"==typeof e?fe.lookupPath(e,{follow:!i}).node:e).node_ops.setattr)throw new fe.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown(e,t,r){fe.chown(e,t,r,!0)},fchown(e,t,r){var i=fe.getStreamChecked(e);fe.chown(i.node,t,r)},truncate(e,t){if(t<0)throw new fe.ErrnoError(28);var r;if(!(r="string"==typeof e?fe.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new fe.ErrnoError(63);if(fe.isDir(r.mode))throw new fe.ErrnoError(31);if(!fe.isFile(r.mode))throw new fe.ErrnoError(28);var i=fe.nodePermissions(r,"w");if(i)throw new fe.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate(e,t){var r=fe.getStreamChecked(e);if(0==(2097155&r.flags))throw new fe.ErrnoError(28);fe.truncate(r.node,t)},utime(e,t,r){var i=fe.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open(e,t,r){if(""===e)throw new fe.ErrnoError(44);var i;if(r="undefined"==typeof r?438:r,r=64&(t="string"==typeof t?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if("undefined"==typeof t)throw new Error(`Unknown file open mode: ${e}`);return t})(t):t)?4095&r|32768:0,"object"==typeof e)i=e;else{e=J.normalize(e);try{i=fe.lookupPath(e,{follow:!(131072&t)}).node}catch(e){}}var o=!1;if(64&t)if(i){if(128&t)throw new fe.ErrnoError(20)}else i=fe.mknod(e,r,0),o=!0;if(!i)throw new fe.ErrnoError(44);if(fe.isChrdev(i.mode)&&(t&=-513),65536&t&&!fe.isDir(i.mode))throw new fe.ErrnoError(54);if(!o){var a=fe.mayOpen(i,t);if(a)throw new fe.ErrnoError(a)}512&t&&!o&&fe.truncate(i,0),t&=-131713;var s=fe.createStream({node:i,path:fe.getPath(i),flags:t,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return s.stream_ops.open&&s.stream_ops.open(s),!n.logReadFiles||1&t||(fe.readFiles||(fe.readFiles={}),e in fe.readFiles||(fe.readFiles[e]=1)),s},close(e){if(fe.isClosed(e))throw new fe.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{fe.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(fe.isClosed(e))throw new fe.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new fe.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new fe.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,i,n){if(i<0||n<0)throw new fe.ErrnoError(28);if(fe.isClosed(e))throw new fe.ErrnoError(8);if(1==(2097155&e.flags))throw new fe.ErrnoError(8);if(fe.isDir(e.node.mode))throw new fe.ErrnoError(31);if(!e.stream_ops.read)throw new fe.ErrnoError(28);var o="undefined"!=typeof n;if(o){if(!e.seekable)throw new fe.ErrnoError(70)}else n=e.position;var a=e.stream_ops.read(e,t,r,i,n);return o||(e.position+=a),a},write(e,t,r,i,n,o){if(i<0||n<0)throw new fe.ErrnoError(28);if(fe.isClosed(e))throw new fe.ErrnoError(8);if(0==(2097155&e.flags))throw new fe.ErrnoError(8);if(fe.isDir(e.node.mode))throw new fe.ErrnoError(31);if(!e.stream_ops.write)throw new fe.ErrnoError(28);e.seekable&&1024&e.flags&&fe.llseek(e,0,2);var a="undefined"!=typeof n;if(a){if(!e.seekable)throw new fe.ErrnoError(70)}else n=e.position;var s=e.stream_ops.write(e,t,r,i,n,o);return a||(e.position+=s),s},allocate(e,t,r){if(fe.isClosed(e))throw new fe.ErrnoError(8);if(t<0||r<=0)throw new fe.ErrnoError(28);if(0==(2097155&e.flags))throw new fe.ErrnoError(8);if(!fe.isFile(e.node.mode)&&!fe.isDir(e.node.mode))throw new fe.ErrnoError(43);if(!e.stream_ops.allocate)throw new fe.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap(e,t,r,i,n){if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new fe.ErrnoError(2);if(1==(2097155&e.flags))throw new fe.ErrnoError(2);if(!e.stream_ops.mmap)throw new fe.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new fe.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error(`Invalid encoding type "${t.encoding}"`);var r,i=fe.open(e,t.flags),n=fe.stat(e).size,o=new Uint8Array(n);return fe.read(i,o,0,n,0),"utf8"===t.encoding?r=ie(o,0):"binary"===t.encoding&&(r=o),fe.close(i),r},writeFile(e,t,r={}){r.flags=r.flags||577;var i=fe.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(oe(t)+1),o=ae(t,n,0,n.length);fe.write(i,n,0,o,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");fe.write(i,t,0,t.byteLength,void 0,r.canOwn)}fe.close(i)},cwd:()=>fe.currentPath,chdir(e){var t=fe.lookupPath(e,{follow:!0});if(null===t.node)throw new fe.ErrnoError(44);if(!fe.isDir(t.node.mode))throw new fe.ErrnoError(54);var r=fe.nodePermissions(t.node,"x");if(r)throw new fe.ErrnoError(r);fe.currentPath=t.path},createDefaultDirectories(){fe.mkdir("/tmp"),fe.mkdir("/home"),fe.mkdir("/home/web_user")},createDefaultDevices(){fe.mkdir("/dev"),fe.registerDevice(fe.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),fe.mkdev("/dev/null",fe.makedev(1,3)),ue.register(fe.makedev(5,0),ue.default_tty_ops),ue.register(fe.makedev(6,0),ue.default_tty1_ops),fe.mkdev("/dev/tty",fe.makedev(5,0)),fe.mkdev("/dev/tty1",fe.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(t=ee(e).byteLength),e[--t]);fe.createDevice("/dev","random",r),fe.createDevice("/dev","urandom",r),fe.mkdir("/dev/shm"),fe.mkdir("/dev/shm/tmp")},createSpecialDirectories(){fe.mkdir("/proc");var e=fe.mkdir("/proc/self");fe.mkdir("/proc/self/fd"),fe.mount({mount(){var t=fe.createNode(e,"fd",16895,73);return t.node_ops={lookup(e,t){var r=+t,i=fe.getStreamChecked(r),n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams(){n.stdin?fe.createDevice("/dev","stdin",n.stdin):fe.symlink("/dev/tty","/dev/stdin"),n.stdout?fe.createDevice("/dev","stdout",null,n.stdout):fe.symlink("/dev/tty","/dev/stdout"),n.stderr?fe.createDevice("/dev","stderr",null,n.stderr):fe.symlink("/dev/tty1","/dev/stderr"),fe.open("/dev/stdin",0),fe.open("/dev/stdout",1),fe.open("/dev/stderr",1)},ensureErrnoError(){fe.ErrnoError||(fe.ErrnoError=function(e,t){this.name="ErrnoError",this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},fe.ErrnoError.prototype=new Error,fe.ErrnoError.prototype.constructor=fe.ErrnoError,[44].forEach((e=>{fe.genericErrors[e]=new fe.ErrnoError(e),fe.genericErrors[e].stack="<generic error, no stack>"})))},staticInit(){fe.ensureErrnoError(),fe.nameTable=new Array(4096),fe.mount(ce,{},"/"),fe.createDefaultDirectories(),fe.createDefaultDevices(),fe.createSpecialDirectories(),fe.filesystems={MEMFS:ce}},init(e,t,r){fe.init.initialized=!0,fe.ensureErrnoError(),n.stdin=e||n.stdin,n.stdout=t||n.stdout,n.stderr=r||n.stderr,fe.createStandardStreams()},quit(){fe.init.initialized=!1;for(var e=0;e<fe.streams.length;e++){var t=fe.streams[e];t&&fe.close(t)}},findObject(e,t){var r=fe.analyzePath(e,t);return r.exists?r.object:null},analyzePath(e,t){try{e=(i=fe.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=fe.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=i.path,r.parentObject=i.node,r.name=J.basename(e),i=fe.lookupPath(e,{follow:!t}),r.exists=!0,r.path=i.path,r.object=i.node,r.name=i.node.name,r.isRoot="/"===i.path}catch(e){r.error=e.errno}return r},createPath(e,t,r,i){e="string"==typeof e?e:fe.getPath(e);for(var n=t.split("/").reverse();n.length;){var o=n.pop();if(o){var a=J.join2(e,o);try{fe.mkdir(a)}catch(e){}e=a}}return a},createFile(e,t,r,i,n){var o=J.join2("string"==typeof e?e:fe.getPath(e),t),a=he(i,n);return fe.create(o,a)},createDataFile(e,t,r,i,n,o){var a=t;e&&(e="string"==typeof e?e:fe.getPath(e),a=t?J.join2(e,t):e);var s=he(i,n),u=fe.create(a,s);if(r){if("string"==typeof r){for(var d=new Array(r.length),c=0,m=r.length;c<m;++c)d[c]=r.charCodeAt(c);r=d}fe.chmod(u,146|s);var l=fe.open(u,577);fe.write(l,r,0,r.length,0,o),fe.close(l),fe.chmod(u,s)}return u},createDevice(e,t,r,i){var n=J.join2("string"==typeof e?e:fe.getPath(e),t),o=he(!!r,!!i);fe.createDevice.major||(fe.createDevice.major=64);var a=fe.makedev(fe.createDevice.major++,0);return fe.registerDevice(a,{open(e){e.seekable=!1},close(e){i&&i.buffer&&i.buffer.length&&i(10)},read(e,t,i,n,o){for(var a=0,s=0;s<n;s++){var u;try{u=r()}catch(e){throw new fe.ErrnoError(29)}if(void 0===u&&0===a)throw new fe.ErrnoError(6);if(null==u)break;a++,t[i+s]=u}return a&&(e.node.timestamp=Date.now()),a},write(e,t,r,n,o){for(var a=0;a<n;a++)try{i(t[r+a])}catch(e){throw new fe.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),a}}),fe.mkdev(n,o,a)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!o)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=se(o(e.url),!0),e.usedBytes=e.contents.length}catch(e){throw new fe.ErrnoError(29)}},createLazyFile(e,t,r,i,n){function o(){this.lengthKnown=!1,this.chunks=[]}if(o.prototype.get=function(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},o.prototype.setDataGetter=function(e){this.getter=e},o.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,o=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;n||(a=i);var s=this;s.setDataGetter((e=>{var t=e*a,n=(e+1)*a-1;if(n=Math.min(n,i-1),"undefined"==typeof s.chunks[e]&&(s.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==a&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):se(n.responseText||"",!0)})(t,n)),"undefined"==typeof s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]})),!o&&i||(a=i=1,i=this.getter(0).length,a=i,h("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){var a=new o;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var s={isDevice:!1,contents:a}}else s={isDevice:!1,url:r};var u=fe.createFile(e,t,s,i,n);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var d={};function c(e,t,r,i,n){var o=e.node.contents;if(n>=o.length)return 0;var a=Math.min(o.length-n,i);if(o.slice)for(var s=0;s<a;s++)t[r+s]=o[n+s];else for(s=0;s<a;s++)t[r+s]=o.get(n+s);return a}return Object.keys(u.stream_ops).forEach((e=>{var t=u.stream_ops[e];d[e]=function(){return fe.forceLoadFile(u),t.apply(null,arguments)}})),d.read=(e,t,r,i,n)=>(fe.forceLoadFile(u),c(e,t,r,i,n)),d.mmap=(e,t,r,i,n)=>{fe.forceLoadFile(u);var o=de(t);if(!o)throw new fe.ErrnoError(48);return c(e,v,o,t,r),{ptr:o,allocated:!0}},u.stream_ops=d,u}},pe=(e,t)=>e?ie(y,e,t):"",ge={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(J.isAbs(t))return t;var i;if(i=-100===e?fe.cwd():ge.getStreamFromFD(e).path,0==t.length){if(!r)throw new fe.ErrnoError(44);return i}return J.join2(i,t)},doStat(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&J.normalize(t)!==J.normalize(fe.getPath(e.node)))return-54;throw e}C[r>>2]=i.dev,C[r+4>>2]=i.mode,F[r+8>>2]=i.nlink,C[r+12>>2]=i.uid,C[r+16>>2]=i.gid,C[r+20>>2]=i.rdev,P=[i.size>>>0,(k=i.size,+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],C[r+24>>2]=P[0],C[r+28>>2]=P[1],C[r+32>>2]=4096,C[r+36>>2]=i.blocks;var n=i.atime.getTime(),o=i.mtime.getTime(),a=i.ctime.getTime();return P=[Math.floor(n/1e3)>>>0,(k=Math.floor(n/1e3),+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],C[r+40>>2]=P[0],C[r+44>>2]=P[1],F[r+48>>2]=n%1e3*1e3,P=[Math.floor(o/1e3)>>>0,(k=Math.floor(o/1e3),+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],C[r+56>>2]=P[0],C[r+60>>2]=P[1],F[r+64>>2]=o%1e3*1e3,P=[Math.floor(a/1e3)>>>0,(k=Math.floor(a/1e3),+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],C[r+72>>2]=P[0],C[r+76>>2]=P[1],F[r+80>>2]=a%1e3*1e3,P=[i.ino>>>0,(k=i.ino,+Math.abs(k)>=1?k>0?+Math.floor(k/4294967296)>>>0:~~+Math.ceil((k-+(~~k>>>0))/4294967296)>>>0:0)],C[r+88>>2]=P[0],C[r+92>>2]=P[1],0},doMsync(e,t,r,i,n){if(!fe.isFile(t.node.mode))throw new fe.ErrnoError(43);if(2&i)return 0;var o=y.slice(e,e+r);fe.msync(t,o,n,r,i)},varargs:void 0,get(){var e=C[ge.varargs>>2];return ge.varargs+=4,e},getp:()=>ge.get(),getStr:e=>pe(e),getStreamFromFD:e=>fe.getStreamChecked(e)},ve=void 0,ye=e=>{for(var t="",r=e;y[r];)t+=ve[y[r++]];return t},we={},Se={},Ce={},Fe=void 0,be=e=>{throw new Fe(e)},Ee=void 0,_e=e=>{throw new Ee(e)},xe=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&_e("Mismatched type converter count");for(var n=0;n<e.length;++n)Ae(e[n],i[n])}e.forEach((function(e){Ce[e]=t}));var n=new Array(t.length),o=[],a=0;t.forEach(((e,t)=>{Se.hasOwnProperty(e)?n[t]=Se[e]:(o.push(e),we.hasOwnProperty(e)||(we[e]=[]),we[e].push((()=>{n[t]=Se[e],++a===o.length&&i(n)})))})),0===o.length&&i(n)};function Ae(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t,r={}){var i=t.name;if(e||be(`type "${i}" must have a positive integer typeid pointer`),Se.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;be(`Cannot register type '${i}' twice`)}if(Se[e]=t,delete Ce[e],we.hasOwnProperty(e)){var n=we[e];delete we[e],n.forEach((e=>e()))}}(e,t,r)}function De(e){if(!(this instanceof Ge))return!1;if(!(e instanceof Ge))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n}var Te=e=>{be(e.$$.ptrType.registeredClass.name+" instance already deleted")},ke=!1,Pe=e=>{},ze=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},Oe=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=Oe(e,t,r.baseClass);return null===i?null:r.downcast(i)},Me={},Re=()=>Object.keys(Ie).length,Qe=()=>{var e=[];for(var t in Ie)Ie.hasOwnProperty(t)&&e.push(Ie[t]);return e},Ze=[],$e=()=>{for(;Ze.length;){var e=Ze.pop();e.$$.deleteScheduled=!1,e.delete()}},Le=void 0,Be=e=>{Le=e,Ze.length&&Le&&Le($e)},Ie={},je=(e,t)=>(t=((e,t)=>{for(void 0===t&&be("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(e,t),Ie[t]),Ne=(e,t)=>(t.ptrType&&t.ptr||_e("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&_e("Both smartPtrType and smartPtr must be specified"),t.count={value:1},He(Object.create(e,{$$:{value:t}})));function We(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=je(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?Ne(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Ne(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var o,a=this.registeredClass.getActualType(t),s=Me[a];if(!s)return n.call(this);o=this.isConst?s.constPointerType:s.pointerType;var u=Oe(t,this.registeredClass,o.registeredClass);return null===u?n.call(this):this.isSmartPointer?Ne(o.registeredClass.instancePrototype,{ptrType:o,ptr:u,smartPtrType:this,smartPtr:e}):Ne(o.registeredClass.instancePrototype,{ptrType:o,ptr:u})}var He=e=>"undefined"==typeof FinalizationRegistry?(He=e=>e,e):(ke=new FinalizationRegistry((e=>{ze(e.$$)})),He=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};ke.register(e,r,e)}return e},Pe=e=>ke.unregister(e),He(e));function Ue(){if(this.$$.ptr||Te(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=He(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function Ve(){this.$$.ptr||Te(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&be("Object already scheduled for deletion"),Pe(this),ze(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function qe(){return!this.$$.ptr}function Ye(){return this.$$.ptr||Te(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&be("Object already scheduled for deletion"),Ze.push(this),1===Ze.length&&Le&&Le($e),this.$$.deleteScheduled=!0,this}function Ge(){}var Xe=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e};function Ke(e,t){return{[e=Xe(e)]:function(){return t.apply(this,arguments)}}[e]}var Je=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||be(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},et=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&be(`Cannot register public name '${e}' twice`),Je(n,e,e),n.hasOwnProperty(r)&&be(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))};function tt(e,t,r,i,n,o,a,s){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=o,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}var rt=(e,t,r)=>{for(;t!==r;)t.upcast||be(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function it(e,t){if(null===t)return this.isReference&&be(`null is not a valid ${this.name}`),0;t.$$||be(`Cannot pass "${Tt(t)}" as a ${this.name}`),t.$$.ptr||be(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return rt(t.$$.ptr,r,this.registeredClass)}function nt(e,t){var r;if(null===t)return this.isReference&&be(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||be(`Cannot pass "${Tt(t)}" as a ${this.name}`),t.$$.ptr||be(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&be(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=rt(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&be("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:be(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,xt.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:be("Unsupporting sharing policy")}return r}function ot(e,t){if(null===t)return this.isReference&&be(`null is not a valid ${this.name}`),0;t.$$||be(`Cannot pass "${Tt(t)}" as a ${this.name}`),t.$$.ptr||be(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&be(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return rt(t.$$.ptr,r,this.registeredClass)}function at(e){return this.fromWireType(F[e>>2])}function st(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function ut(e){this.rawDestructor&&this.rawDestructor(e)}var dt=e=>{null!==e&&e.delete()};function ct(e,t,r,i,n,o,a,s,u,d,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=o,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=d,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=nt:i?(this.toWireType=it,this.destructorFunction=null):(this.toWireType=ot,this.destructorFunction=null)}var mt=(e,t,r)=>{n.hasOwnProperty(e)||_e("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},lt=e=>_.get(e),ht=(e,t,r)=>e.includes("j")?((e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)})(e,t,r):lt(t).apply(null,r),ft=(e,t)=>{var r,i,n,o=(e=ye(e)).includes("j")?(r=e,i=t,n=[],function(){return n.length=0,Object.assign(n,arguments),ht(r,i,n)}):lt(t);return"function"!=typeof o&&be(`unknown function pointer with signature ${e}: ${t}`),o},pt=void 0,gt=e=>{var t=Fr(e),r=ye(t);return wr(t),r},vt=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||Se[t]||(Ce[t]?Ce[t].forEach(e):(r.push(t),i[t]=!0))})),new pt(`${e}: `+r.map(gt).join([", "]))},yt=(e,t)=>{for(var r=[],i=0;i<e;i++)r.push(F[t+4*i>>2]);return r},wt=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function St(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=Ke(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function Ct(e,t,r,i,n,o){var a=t.length;a<2&&be("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==t[1]&&null!==r,u=!1,d=1;d<t.length;++d)if(null!==t[d]&&void 0===t[d].destructorFunction){u=!0;break}var c="void"!==t[0].name,m="",l="";for(d=0;d<a-2;++d)m+=(0!==d?", ":"")+"arg"+d,l+=(0!==d?", ":"")+"arg"+d+"Wired";var h=`\n return function ${Xe(e)}(${m}) {\n if (arguments.length !== ${a-2}) {\n throwBindingError('function ${e} called with ' + arguments.length + ' arguments, expected ${a-2}');\n }`;u&&(h+="var destructors = [];\n");var f=u?"destructors":"null",p=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],g=[be,i,n,wt,t[0],t[1]];for(s&&(h+="var thisWired = classParam.toWireType("+f+", this);\n"),d=0;d<a-2;++d)h+="var arg"+d+"Wired = argType"+d+".toWireType("+f+", arg"+d+"); // "+t[d+2].name+"\n",p.push("argType"+d),g.push(t[d+2]);if(s&&(l="thisWired"+(l.length>0?", ":"")+l),h+=(c||o?"var rv = ":"")+"invoker(fn"+(l.length>0?", ":"")+l+");\n",u)h+="runDestructors(destructors);\n";else for(d=s?1:2;d<t.length;++d){var v=1===d?"thisWired":"arg"+(d-2)+"Wired";null!==t[d].destructorFunction&&(h+=v+"_dtor("+v+"); // "+t[d].name+"\n",p.push(v+"_dtor"),g.push(t[d].destructorFunction))}return c&&(h+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),h+="}\n",p.push(h),St(Function,p).apply(null,g)}function Ft(){this.allocated=[void 0],this.freelist=[]}var bt=new Ft,Et=e=>{e>=bt.reserved&&0==--bt.get(e).