scanbot-web-sdk
Version:
Scanbot Web Document and Barcode Scanner SDK
1 lines • 133 kB
JavaScript
!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=5)}([function(t,e,r){"use strict";(function(t){function n(t,e=!1){const r=[];if(e)return r;return function t(e){if(e)if(e.constructor===ImageData)r.push(e.data.buffer);else if(e.constructor===ArrayBuffer)r.push(e);else if(ArrayBuffer.isView(e))r.push(e.buffer);else if(Array.isArray(e))for(let r=0;r<e.length;++r)t(e[r]);else if("object"==typeof e)for(const r in e)e.hasOwnProperty(r)&&t(e[r])}(t),r}function o(t){return t.startsWith("http:")||t.startsWith("https:")}function a(e){const{allowSimd:r=!0,allowThreads:n=!0}=e||{};let o="";if(r&&function(){try{const t=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])),e=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,5,3,1,0,1,11,9,1,0,65,1,65,2,106,11,0]));return t&&e}catch(t){return!1}}()){o+="-simd";n&&function(){if("undefined"!=typeof t&&"undefined"!=typeof t.versions&&"undefined"!=typeof t.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(t){return!1}}()&&(o+="-threads")}return o}r.d(e,"a",(function(){return n})),r.d(e,"c",(function(){return o})),r.d(e,"b",(function(){return a}))}).call(this,r(1))},function(t,e){var r,n,o=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(t){if(r===setTimeout)return setTimeout(t,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(t){r=a}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(t){n=i}}();var u,c=[],l=!1,d=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):d=-1,c.length&&f())}function f(){if(!l){var t=s(h);l=!0;for(var e=c.length;e;){for(u=c,c=[];++d<e;)u&&u[d].run();d=-1,e=c.length}u=null,l=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new p(t,e)),1!==c.length||l||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,r){(function(e){var r,n=(r="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){function n(){return T.buffer!=S.buffer&&V(),S}function o(){return T.buffer!=S.buffer&&V(),j}function a(){return T.buffer!=S.buffer&&V(),P}function i(){return T.buffer!=S.buffer&&V(),$}function s(){return T.buffer!=S.buffer&&V(),D}function u(){return T.buffer!=S.buffer&&V(),A}function c(){return T.buffer!=S.buffer&&V(),R}var l,d,h=t;h.ready=new Promise(((t,e)=>{l=t,d=e}));var f,p,m,v=Object.assign({},h),y="./this.program",g=(t,e)=>{throw e},w=h.ENVIRONMENT_IS_PTHREAD||!1,b="";function E(t){return h.locateFile?h.locateFile(t,b):b+t}b=self.location.href,r&&(b=r),b=0!==b.indexOf("blob:")?b.substr(0,b.replace(/[?#].*/,"").lastIndexOf("/")+1):"",f=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},m=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)},p=(t,e,r)=>{var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?e(n.response):r()},n.onerror=r,n.send(null)};var _,M=h.print||console.log.bind(console),k=h.printErr||console.error.bind(console);Object.assign(h,v),v=null,h.arguments&&h.arguments,h.thisProgram&&(y=h.thisProgram),h.quit&&(g=h.quit),h.wasmBinary&&(_=h.wasmBinary);var T,W,C=h.noExitRuntime||!0;"object"!=typeof WebAssembly&&nt("no native wasm support detected");var F,S,j,P,$,D,A,x,R,I=!1;function O(t,e){t||nt(e)}function V(){var t=T.buffer;h.HEAP8=S=new Int8Array(t),h.HEAP16=P=new Int16Array(t),h.HEAPU8=j=new Uint8Array(t),h.HEAPU16=$=new Uint16Array(t),h.HEAP32=D=new Int32Array(t),h.HEAPU32=A=new Uint32Array(t),h.HEAPF32=x=new Float32Array(t),h.HEAPF64=R=new Float64Array(t)}var Z,N=h.INITIAL_MEMORY||67108864;if(O(N>=4194304,"INITIAL_MEMORY should be larger than STACK_SIZE, was "+N+"! (STACK_SIZE=4194304)"),w)T=h.wasmMemory;else if(h.wasmMemory)T=h.wasmMemory;else if(!((T=new WebAssembly.Memory({initial:N/65536,maximum:32768,shared:!0})).buffer instanceof SharedArrayBuffer))throw k("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),Error("bad memory");V(),N=T.buffer.byteLength;var z=[],U=[],G=[],Y=0;function L(){return C||Y>0}function H(){w||(h.noFSInit||Wt.init.initialized||Wt.init(),Wt.ignorePermissions=!1,Et.init(),Dt(U))}function X(t){z.unshift(t)}var B,J,K,Q=0,q=null,tt=null;function et(t){Q++,h.monitorRunDependencies&&h.monitorRunDependencies(Q)}function rt(t){if(Q--,h.monitorRunDependencies&&h.monitorRunDependencies(Q),0==Q&&(null!==q&&(clearInterval(q),q=null),tt)){var e=tt;tt=null,e()}}function nt(t){h.onAbort&&h.onAbort(t),k(t="Aborted("+t+")"),I=!0,F=1,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw d(e),e}function ot(t){return t.startsWith("data:application/octet-stream;base64,")}function at(t){if(t==B&&_)return new Uint8Array(_);if(m)return m(t);throw"both async and sync fetching of the wasm failed"}function it(t,e,r){return function(t){return _||"function"!=typeof fetch?Promise.resolve().then((()=>at(t))):fetch(t,{credentials:"same-origin"}).then((e=>{if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((()=>at(t)))}(t).then((t=>WebAssembly.instantiate(t,e))).then((t=>t)).then(r,(t=>{k(`failed to asynchronously prepare wasm: ${t}`),nt(t)}))}ot(B="ScanbotSDK.Asm-simd-threads.wasm")||(B=E(B));var st={1570380:t=>vn(function(){return this[Ct(t)].toString()}.apply(function(){return this}.call(void 0)))};function ut(t){this.name="ExitStatus",this.message=`Program terminated with exit(${t})`,this.status=t}var ct=t=>{t.terminate(),t.onmessage=t=>{}},lt=t=>{var e=$t.pthreads[t];O(e),$t.returnWorkerToPool(e)},dt=t=>{var e=$t.getNewWorker();if(!e)return 6;$t.runningWorkers.push(e),$t.pthreads[t.pthread_ptr]=e,e.pthread_ptr=t.pthread_ptr;var r={cmd:"run",start_routine:t.startRoutine,arg:t.arg,pthread_ptr:t.pthread_ptr};return e.postMessage(r,t.transferList),0},ht={isAbs:t=>"/"===t.charAt(0),splitPath:t=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(t).slice(1),normalizeArray:(t,e)=>{for(var r=0,n=t.length-1;n>=0;n--){var o=t[n];"."===o?t.splice(n,1):".."===o?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t},normalize:t=>{var e=ht.isAbs(t),r="/"===t.substr(-1);return(t=ht.normalizeArray(t.split("/").filter((t=>!!t)),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t},dirname:t=>{var e=ht.splitPath(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},basename:t=>{if("/"===t)return"/";var e=(t=(t=ht.normalize(t)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?t:t.substr(e+1)},join:function(){var t=Array.prototype.slice.call(arguments);return ht.normalize(t.join("/"))},join2:(t,e)=>ht.normalize(t+"/"+e)},ft=t=>(ft=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return t=>(t.set(crypto.getRandomValues(new Uint8Array(t.byteLength))),t);nt("initRandomDevice")})())(t),pt={resolve:function(){for(var t="",e=!1,r=arguments.length-1;r>=-1&&!e;r--){var n=r>=0?arguments[r]:Wt.cwd();if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,e=ht.isAbs(n)}return(e?"/":"")+(t=ht.normalizeArray(t.split("/").filter((t=>!!t)),!e).join("/"))||"."},relative:(t,e)=>{function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;r>=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=pt.resolve(t).substr(1),e=pt.resolve(e).substr(1);for(var n=r(t.split("/")),o=r(e.split("/")),a=Math.min(n.length,o.length),i=a,s=0;s<a;s++)if(n[s]!==o[s]){i=s;break}var u=[];for(s=i;s<n.length;s++)u.push("..");return(u=u.concat(o.slice(i))).join("/")}},mt="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,vt=(t,e,r)=>{for(var n=e+r,o=e;t[o]&&!(o>=n);)++o;if(o-e>16&&t.buffer&&mt)return mt.decode(t.buffer instanceof SharedArrayBuffer?t.slice(e,o):t.subarray(e,o));for(var a="";e<o;){var i=t[e++];if(128&i){var s=63&t[e++];if(192!=(224&i)){var u=63&t[e++];if((i=224==(240&i)?(15&i)<<12|s<<6|u:(7&i)<<18|s<<12|u<<6|63&t[e++])<65536)a+=String.fromCharCode(i);else{var c=i-65536;a+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},yt=[],gt=t=>{for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++r):e+=3}return e},wt=(t,e,r,n)=>{if(!(n>0))return 0;for(var o=r,a=r+n-1,i=0;i<t.length;++i){var s=t.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++i)),s<=127){if(r>=a)break;e[r++]=s}else if(s<=2047){if(r+1>=a)break;e[r++]=192|s>>6,e[r++]=128|63&s}else if(s<=65535){if(r+2>=a)break;e[r++]=224|s>>12,e[r++]=128|s>>6&63,e[r++]=128|63&s}else{if(r+3>=a)break;e[r++]=240|s>>18,e[r++]=128|s>>12&63,e[r++]=128|s>>6&63,e[r++]=128|63&s}}return e[r]=0,r-o};function bt(t,e,r){var n=r>0?r:gt(t)+1,o=new Array(n),a=wt(t,o,0,o.length);return e&&(o.length=a),o}var Et={ttys:[],init(){},shutdown(){},register(t,e){Et.ttys[t]={input:[],output:[],ops:e},Wt.registerDevice(t,Et.stream_ops)},stream_ops:{open(t){var e=Et.ttys[t.node.rdev];if(!e)throw new Wt.ErrnoError(43);t.tty=e,t.seekable=!1},close(t){t.tty.ops.fsync(t.tty)},fsync(t){t.tty.ops.fsync(t.tty)},read(t,e,r,n,o){if(!t.tty||!t.tty.ops.get_char)throw new Wt.ErrnoError(60);for(var a=0,i=0;i<n;i++){var s;try{s=t.tty.ops.get_char(t.tty)}catch(t){throw new Wt.ErrnoError(29)}if(void 0===s&&0===a)throw new Wt.ErrnoError(6);if(null==s)break;a++,e[r+i]=s}return a&&(t.node.timestamp=Date.now()),a},write(t,e,r,n,o){if(!t.tty||!t.tty.ops.put_char)throw new Wt.ErrnoError(60);try{for(var a=0;a<n;a++)t.tty.ops.put_char(t.tty,e[r+a])}catch(t){throw new Wt.ErrnoError(29)}return n&&(t.node.timestamp=Date.now()),a}},default_tty_ops:{get_char:t=>(()=>{if(!yt.length){var t=null;if("undefined"!=typeof window&&"function"==typeof window.prompt?null!==(t=window.prompt("Input: "))&&(t+="\n"):"function"==typeof readline&&null!==(t=readline())&&(t+="\n"),!t)return null;yt=bt(t,!0)}return yt.shift()})(),put_char(t,e){null===e||10===e?(M(vt(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){t.output&&t.output.length>0&&(M(vt(t.output,0)),t.output=[])},ioctl_tcgets:t=>({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:(t,e,r)=>0,ioctl_tiocgwinsz:t=>[24,80]},default_tty1_ops:{put_char(t,e){null===e||10===e?(k(vt(t.output,0)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){t.output&&t.output.length>0&&(k(vt(t.output,0)),t.output=[])}}},_t=t=>{t=((t,e)=>Math.ceil(t/e)*e)(t,65536);var e=$n(65536,t);return e?((t,e)=>(o().fill(0,t,t+e),t))(e,t):0},Mt={ops_table:null,mount:t=>Mt.createNode(null,"/",16895,0),createNode(t,e,r,n){if(Wt.isBlkdev(r)||Wt.isFIFO(r))throw new Wt.ErrnoError(63);Mt.ops_table||(Mt.ops_table={dir:{node:{getattr:Mt.node_ops.getattr,setattr:Mt.node_ops.setattr,lookup:Mt.node_ops.lookup,mknod:Mt.node_ops.mknod,rename:Mt.node_ops.rename,unlink:Mt.node_ops.unlink,rmdir:Mt.node_ops.rmdir,readdir:Mt.node_ops.readdir,symlink:Mt.node_ops.symlink},stream:{llseek:Mt.stream_ops.llseek}},file:{node:{getattr:Mt.node_ops.getattr,setattr:Mt.node_ops.setattr},stream:{llseek:Mt.stream_ops.llseek,read:Mt.stream_ops.read,write:Mt.stream_ops.write,allocate:Mt.stream_ops.allocate,mmap:Mt.stream_ops.mmap,msync:Mt.stream_ops.msync}},link:{node:{getattr:Mt.node_ops.getattr,setattr:Mt.node_ops.setattr,readlink:Mt.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Mt.node_ops.getattr,setattr:Mt.node_ops.setattr},stream:Wt.chrdev_stream_ops}});var o=Wt.createNode(t,e,r,n);return Wt.isDir(o.mode)?(o.node_ops=Mt.ops_table.dir.node,o.stream_ops=Mt.ops_table.dir.stream,o.contents={}):Wt.isFile(o.mode)?(o.node_ops=Mt.ops_table.file.node,o.stream_ops=Mt.ops_table.file.stream,o.usedBytes=0,o.contents=null):Wt.isLink(o.mode)?(o.node_ops=Mt.ops_table.link.node,o.stream_ops=Mt.ops_table.link.stream):Wt.isChrdev(o.mode)&&(o.node_ops=Mt.ops_table.chrdev.node,o.stream_ops=Mt.ops_table.chrdev.stream),o.timestamp=Date.now(),t&&(t.contents[e]=o,t.timestamp=o.timestamp),o},getFileDataAsTypedArray:t=>t.contents?t.contents.subarray?t.contents.subarray(0,t.usedBytes):new Uint8Array(t.contents):new Uint8Array(0),expandFileStorage(t,e){var r=t.contents?t.contents.length:0;if(!(r>=e)){e=Math.max(e,r*(r<1048576?2:1.125)>>>0),0!=r&&(e=Math.max(e,256));var n=t.contents;t.contents=new Uint8Array(e),t.usedBytes>0&&t.contents.set(n.subarray(0,t.usedBytes),0)}},resizeFileStorage(t,e){if(t.usedBytes!=e)if(0==e)t.contents=null,t.usedBytes=0;else{var r=t.contents;t.contents=new Uint8Array(e),r&&t.contents.set(r.subarray(0,Math.min(e,t.usedBytes))),t.usedBytes=e}},node_ops:{getattr(t){var e={};return e.dev=Wt.isChrdev(t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,Wt.isDir(t.mode)?e.size=4096:Wt.isFile(t.mode)?e.size=t.usedBytes:Wt.isLink(t.mode)?e.size=t.link.length:e.size=0,e.atime=new Date(t.timestamp),e.mtime=new Date(t.timestamp),e.ctime=new Date(t.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr(t,e){void 0!==e.mode&&(t.mode=e.mode),void 0!==e.timestamp&&(t.timestamp=e.timestamp),void 0!==e.size&&Mt.resizeFileStorage(t,e.size)},lookup(t,e){throw Wt.genericErrors[44]},mknod:(t,e,r,n)=>Mt.createNode(t,e,r,n),rename(t,e,r){if(Wt.isDir(t.mode)){var n;try{n=Wt.lookupNode(e,r)}catch(t){}if(n)for(var o in n.contents)throw new Wt.ErrnoError(55)}delete t.parent.contents[t.name],t.parent.timestamp=Date.now(),t.name=r,e.contents[r]=t,e.timestamp=t.parent.timestamp,t.parent=e},unlink(t,e){delete t.contents[e],t.timestamp=Date.now()},rmdir(t,e){var r=Wt.lookupNode(t,e);for(var n in r.contents)throw new Wt.ErrnoError(55);delete t.contents[e],t.timestamp=Date.now()},readdir(t){var e=[".",".."];for(var r in t.contents)t.contents.hasOwnProperty(r)&&e.push(r);return e},symlink(t,e,r){var n=Mt.createNode(t,e,41471,0);return n.link=r,n},readlink(t){if(!Wt.isLink(t.mode))throw new Wt.ErrnoError(28);return t.link}},stream_ops:{read(t,e,r,n,o){var a=t.node.contents;if(o>=t.node.usedBytes)return 0;var i=Math.min(t.node.usedBytes-o,n);if(i>8&&a.subarray)e.set(a.subarray(o,o+i),r);else for(var s=0;s<i;s++)e[r+s]=a[o+s];return i},write(t,e,r,o,a,i){if(e.buffer===n().buffer&&(i=!1),!o)return 0;var s=t.node;if(s.timestamp=Date.now(),e.subarray&&(!s.contents||s.contents.subarray)){if(i)return s.contents=e.subarray(r,r+o),s.usedBytes=o,o;if(0===s.usedBytes&&0===a)return s.contents=e.slice(r,r+o),s.usedBytes=o,o;if(a+o<=s.usedBytes)return s.contents.set(e.subarray(r,r+o),a),o}if(Mt.expandFileStorage(s,a+o),s.contents.subarray&&e.subarray)s.contents.set(e.subarray(r,r+o),a);else for(var u=0;u<o;u++)s.contents[a+u]=e[r+u];return s.usedBytes=Math.max(s.usedBytes,a+o),o},llseek(t,e,r){var n=e;if(1===r?n+=t.position:2===r&&Wt.isFile(t.node.mode)&&(n+=t.node.usedBytes),n<0)throw new Wt.ErrnoError(28);return n},allocate(t,e,r){Mt.expandFileStorage(t.node,e+r),t.node.usedBytes=Math.max(t.node.usedBytes,e+r)},mmap(t,e,r,o,a){if(!Wt.isFile(t.node.mode))throw new Wt.ErrnoError(43);var i,s,u=t.node.contents;if(2&a||u.buffer!==n().buffer){if((r>0||r+e<u.length)&&(u=u.subarray?u.subarray(r,r+e):Array.prototype.slice.call(u,r,r+e)),s=!0,!(i=_t(e)))throw new Wt.ErrnoError(48);n().set(u,i)}else s=!1,i=u.byteOffset;return{ptr:i,allocated:s}},msync:(t,e,r,n,o)=>(Mt.stream_ops.write(t,e,0,n,r,!1),0)}},kt=h.preloadPlugins||[],Tt=(t,e)=>{var r=0;return t&&(r|=365),e&&(r|=146),r},Wt={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath(t,e={}){if(!(t=pt.resolve(t)))return{path:"",node:null};if((e=Object.assign({follow_mount:!0,recurse_count:0},e)).recurse_count>8)throw new Wt.ErrnoError(32);for(var r=t.split("/").filter((t=>!!t)),n=Wt.root,o="/",a=0;a<r.length;a++){var i=a===r.length-1;if(i&&e.parent)break;if(n=Wt.lookupNode(n,r[a]),o=ht.join2(o,r[a]),Wt.isMountpoint(n)&&(!i||i&&e.follow_mount)&&(n=n.mounted.root),!i||e.follow)for(var s=0;Wt.isLink(n.mode);){var u=Wt.readlink(o);if(o=pt.resolve(ht.dirname(o),u),n=Wt.lookupPath(o,{recurse_count:e.recurse_count+1}).node,s++>40)throw new Wt.ErrnoError(32)}}return{path:o,node:n}},getPath(t){for(var e;;){if(Wt.isRoot(t)){var r=t.mount.mountpoint;return e?"/"!==r[r.length-1]?`${r}/${e}`:r+e:r}e=e?`${t.name}/${e}`:t.name,t=t.parent}},hashName(t,e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n)|0;return(t+r>>>0)%Wt.nameTable.length},hashAddNode(t){var e=Wt.hashName(t.parent.id,t.name);t.name_next=Wt.nameTable[e],Wt.nameTable[e]=t},hashRemoveNode(t){var e=Wt.hashName(t.parent.id,t.name);if(Wt.nameTable[e]===t)Wt.nameTable[e]=t.name_next;else for(var r=Wt.nameTable[e];r;){if(r.name_next===t){r.name_next=t.name_next;break}r=r.name_next}},lookupNode(t,e){var r=Wt.mayLookup(t);if(r)throw new Wt.ErrnoError(r,t);for(var n=Wt.hashName(t.id,e),o=Wt.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===t.id&&a===e)return o}return Wt.lookup(t,e)},createNode(t,e,r,n){var o=new Wt.FSNode(t,e,r,n);return Wt.hashAddNode(o),o},destroyNode(t){Wt.hashRemoveNode(t)},isRoot:t=>t===t.parent,isMountpoint:t=>!!t.mounted,isFile:t=>32768==(61440&t),isDir:t=>16384==(61440&t),isLink:t=>40960==(61440&t),isChrdev:t=>8192==(61440&t),isBlkdev:t=>24576==(61440&t),isFIFO:t=>4096==(61440&t),isSocket:t=>49152==(49152&t),flagsToPermissionString(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e},nodePermissions:(t,e)=>Wt.ignorePermissions||(!e.includes("r")||292&t.mode)&&(!e.includes("w")||146&t.mode)&&(!e.includes("x")||73&t.mode)?0:2,mayLookup(t){var e=Wt.nodePermissions(t,"x");return e||(t.node_ops.lookup?0:2)},mayCreate(t,e){try{return Wt.lookupNode(t,e),20}catch(t){}return Wt.nodePermissions(t,"wx")},mayDelete(t,e,r){var n;try{n=Wt.lookupNode(t,e)}catch(t){return t.errno}var o=Wt.nodePermissions(t,"wx");if(o)return o;if(r){if(!Wt.isDir(n.mode))return 54;if(Wt.isRoot(n)||Wt.getPath(n)===Wt.cwd())return 10}else if(Wt.isDir(n.mode))return 31;return 0},mayOpen:(t,e)=>t?Wt.isLink(t.mode)?32:Wt.isDir(t.mode)&&("r"!==Wt.flagsToPermissionString(e)||512&e)?31:Wt.nodePermissions(t,Wt.flagsToPermissionString(e)):44,MAX_OPEN_FDS:4096,nextfd(){for(var t=0;t<=Wt.MAX_OPEN_FDS;t++)if(!Wt.streams[t])return t;throw new Wt.ErrnoError(33)},getStreamChecked(t){var e=Wt.getStream(t);if(!e)throw new Wt.ErrnoError(8);return e},getStream:t=>Wt.streams[t],createStream:(t,e=-1)=>(Wt.FSStream||(Wt.FSStream=function(){this.shared={}},Wt.FSStream.prototype={},Object.defineProperties(Wt.FSStream.prototype,{object:{get(){return this.node},set(t){this.node=t}},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(t){this.shared.flags=t}},position:{get(){return this.shared.position},set(t){this.shared.position=t}}})),t=Object.assign(new Wt.FSStream,t),-1==e&&(e=Wt.nextfd()),t.fd=e,Wt.streams[e]=t,t),closeStream(t){Wt.streams[t]=null},chrdev_stream_ops:{open(t){var e=Wt.getDevice(t.node.rdev);t.stream_ops=e.stream_ops,t.stream_ops.open&&t.stream_ops.open(t)},llseek(){throw new Wt.ErrnoError(70)}},major:t=>t>>8,minor:t=>255&t,makedev:(t,e)=>t<<8|e,registerDevice(t,e){Wt.devices[t]={stream_ops:e}},getDevice:t=>Wt.devices[t],getMounts(t){for(var e=[],r=[t];r.length;){var n=r.pop();e.push(n),r.push.apply(r,n.mounts)}return e},syncfs(t,e){"function"==typeof t&&(e=t,t=!1),Wt.syncFSRequests++,Wt.syncFSRequests>1&&k(`warning: ${Wt.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Wt.getMounts(Wt.root.mount),n=0;function o(t){return Wt.syncFSRequests--,e(t)}function a(t){if(t)return a.errored?void 0:(a.errored=!0,o(t));++n>=r.length&&o(null)}r.forEach((e=>{if(!e.type.syncfs)return a(null);e.type.syncfs(e,t,a)}))},mount(t,e,r){var n,o="/"===r,a=!r;if(o&&Wt.root)throw new Wt.ErrnoError(10);if(!o&&!a){var i=Wt.lookupPath(r,{follow_mount:!1});if(r=i.path,n=i.node,Wt.isMountpoint(n))throw new Wt.ErrnoError(10);if(!Wt.isDir(n.mode))throw new Wt.ErrnoError(54)}var s={type:t,opts:e,mountpoint:r,mounts:[]},u=t.mount(s);return u.mount=s,s.root=u,o?Wt.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(t){var e=Wt.lookupPath(t,{follow_mount:!1});if(!Wt.isMountpoint(e.node))throw new Wt.ErrnoError(28);var r=e.node,n=r.mounted,o=Wt.getMounts(n);Object.keys(Wt.nameTable).forEach((t=>{for(var e=Wt.nameTable[t];e;){var r=e.name_next;o.includes(e.mount)&&Wt.destroyNode(e),e=r}})),r.mounted=null;var a=r.mount.mounts.indexOf(n);r.mount.mounts.splice(a,1)},lookup:(t,e)=>t.node_ops.lookup(t,e),mknod(t,e,r){var n=Wt.lookupPath(t,{parent:!0}).node,o=ht.basename(t);if(!o||"."===o||".."===o)throw new Wt.ErrnoError(28);var a=Wt.mayCreate(n,o);if(a)throw new Wt.ErrnoError(a);if(!n.node_ops.mknod)throw new Wt.ErrnoError(63);return n.node_ops.mknod(n,o,e,r)},create:(t,e)=>(e=void 0!==e?e:438,e&=4095,e|=32768,Wt.mknod(t,e,0)),mkdir:(t,e)=>(e=void 0!==e?e:511,e&=1023,e|=16384,Wt.mknod(t,e,0)),mkdirTree(t,e){for(var r=t.split("/"),n="",o=0;o<r.length;++o)if(r[o]){n+="/"+r[o];try{Wt.mkdir(n,e)}catch(t){if(20!=t.errno)throw t}}},mkdev:(t,e,r)=>("undefined"==typeof r&&(r=e,e=438),e|=8192,Wt.mknod(t,e,r)),symlink(t,e){if(!pt.resolve(t))throw new Wt.ErrnoError(44);var r=Wt.lookupPath(e,{parent:!0}).node;if(!r)throw new Wt.ErrnoError(44);var n=ht.basename(e),o=Wt.mayCreate(r,n);if(o)throw new Wt.ErrnoError(o);if(!r.node_ops.symlink)throw new Wt.ErrnoError(63);return r.node_ops.symlink(r,n,t)},rename(t,e){var r,n,o=ht.dirname(t),a=ht.dirname(e),i=ht.basename(t),s=ht.basename(e);if(r=Wt.lookupPath(t,{parent:!0}).node,n=Wt.lookupPath(e,{parent:!0}).node,!r||!n)throw new Wt.ErrnoError(44);if(r.mount!==n.mount)throw new Wt.ErrnoError(75);var u,c=Wt.lookupNode(r,i),l=pt.relative(t,a);if("."!==l.charAt(0))throw new Wt.ErrnoError(28);if("."!==(l=pt.relative(e,o)).charAt(0))throw new Wt.ErrnoError(55);try{u=Wt.lookupNode(n,s)}catch(t){}if(c!==u){var d=Wt.isDir(c.mode),h=Wt.mayDelete(r,i,d);if(h)throw new Wt.ErrnoError(h);if(h=u?Wt.mayDelete(n,s,d):Wt.mayCreate(n,s))throw new Wt.ErrnoError(h);if(!r.node_ops.rename)throw new Wt.ErrnoError(63);if(Wt.isMountpoint(c)||u&&Wt.isMountpoint(u))throw new Wt.ErrnoError(10);if(n!==r&&(h=Wt.nodePermissions(r,"w")))throw new Wt.ErrnoError(h);Wt.hashRemoveNode(c);try{r.node_ops.rename(c,n,s)}catch(t){throw t}finally{Wt.hashAddNode(c)}}},rmdir(t){var e=Wt.lookupPath(t,{parent:!0}).node,r=ht.basename(t),n=Wt.lookupNode(e,r),o=Wt.mayDelete(e,r,!0);if(o)throw new Wt.ErrnoError(o);if(!e.node_ops.rmdir)throw new Wt.ErrnoError(63);if(Wt.isMountpoint(n))throw new Wt.ErrnoError(10);e.node_ops.rmdir(e,r),Wt.destroyNode(n)},readdir(t){var e=Wt.lookupPath(t,{follow:!0}).node;if(!e.node_ops.readdir)throw new Wt.ErrnoError(54);return e.node_ops.readdir(e)},unlink(t){var e=Wt.lookupPath(t,{parent:!0}).node;if(!e)throw new Wt.ErrnoError(44);var r=ht.basename(t),n=Wt.lookupNode(e,r),o=Wt.mayDelete(e,r,!1);if(o)throw new Wt.ErrnoError(o);if(!e.node_ops.unlink)throw new Wt.ErrnoError(63);if(Wt.isMountpoint(n))throw new Wt.ErrnoError(10);e.node_ops.unlink(e,r),Wt.destroyNode(n)},readlink(t){var e=Wt.lookupPath(t).node;if(!e)throw new Wt.ErrnoError(44);if(!e.node_ops.readlink)throw new Wt.ErrnoError(28);return pt.resolve(Wt.getPath(e.parent),e.node_ops.readlink(e))},stat(t,e){var r=Wt.lookupPath(t,{follow:!e}).node;if(!r)throw new Wt.ErrnoError(44);if(!r.node_ops.getattr)throw new Wt.ErrnoError(63);return r.node_ops.getattr(r)},lstat:t=>Wt.stat(t,!0),chmod(t,e,r){var n;if(!(n="string"==typeof t?Wt.lookupPath(t,{follow:!r}).node:t).node_ops.setattr)throw new Wt.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&e|-4096&n.mode,timestamp:Date.now()})},lchmod(t,e){Wt.chmod(t,e,!0)},fchmod(t,e){var r=Wt.getStreamChecked(t);Wt.chmod(r.node,e)},chown(t,e,r,n){var o;if(!(o="string"==typeof t?Wt.lookupPath(t,{follow:!n}).node:t).node_ops.setattr)throw new Wt.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(t,e,r){Wt.chown(t,e,r,!0)},fchown(t,e,r){var n=Wt.getStreamChecked(t);Wt.chown(n.node,e,r)},truncate(t,e){if(e<0)throw new Wt.ErrnoError(28);var r;if(!(r="string"==typeof t?Wt.lookupPath(t,{follow:!0}).node:t).node_ops.setattr)throw new Wt.ErrnoError(63);if(Wt.isDir(r.mode))throw new Wt.ErrnoError(31);if(!Wt.isFile(r.mode))throw new Wt.ErrnoError(28);var n=Wt.nodePermissions(r,"w");if(n)throw new Wt.ErrnoError(n);r.node_ops.setattr(r,{size:e,timestamp:Date.now()})},ftruncate(t,e){var r=Wt.getStreamChecked(t);if(0==(2097155&r.flags))throw new Wt.ErrnoError(28);Wt.truncate(r.node,e)},utime(t,e,r){var n=Wt.lookupPath(t,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(e,r)})},open(t,e,r){if(""===t)throw new Wt.ErrnoError(44);var n;if(r="undefined"==typeof r?438:r,r=64&(e="string"==typeof e?(t=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[t];if("undefined"==typeof e)throw new Error(`Unknown file open mode: ${t}`);return e})(e):e)?4095&r|32768:0,"object"==typeof t)n=t;else{t=ht.normalize(t);try{n=Wt.lookupPath(t,{follow:!(131072&e)}).node}catch(t){}}var o=!1;if(64&e)if(n){if(128&e)throw new Wt.ErrnoError(20)}else n=Wt.mknod(t,r,0),o=!0;if(!n)throw new Wt.ErrnoError(44);if(Wt.isChrdev(n.mode)&&(e&=-513),65536&e&&!Wt.isDir(n.mode))throw new Wt.ErrnoError(54);if(!o){var a=Wt.mayOpen(n,e);if(a)throw new Wt.ErrnoError(a)}512&e&&!o&&Wt.truncate(n,0),e&=-131713;var i=Wt.createStream({node:n,path:Wt.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return i.stream_ops.open&&i.stream_ops.open(i),!h.logReadFiles||1&e||(Wt.readFiles||(Wt.readFiles={}),t in Wt.readFiles||(Wt.readFiles[t]=1)),i},close(t){if(Wt.isClosed(t))throw new Wt.ErrnoError(8);t.getdents&&(t.getdents=null);try{t.stream_ops.close&&t.stream_ops.close(t)}catch(t){throw t}finally{Wt.closeStream(t.fd)}t.fd=null},isClosed:t=>null===t.fd,llseek(t,e,r){if(Wt.isClosed(t))throw new Wt.ErrnoError(8);if(!t.seekable||!t.stream_ops.llseek)throw new Wt.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Wt.ErrnoError(28);return t.position=t.stream_ops.llseek(t,e,r),t.ungotten=[],t.position},read(t,e,r,n,o){if(n<0||o<0)throw new Wt.ErrnoError(28);if(Wt.isClosed(t))throw new Wt.ErrnoError(8);if(1==(2097155&t.flags))throw new Wt.ErrnoError(8);if(Wt.isDir(t.node.mode))throw new Wt.ErrnoError(31);if(!t.stream_ops.read)throw new Wt.ErrnoError(28);var a="undefined"!=typeof o;if(a){if(!t.seekable)throw new Wt.ErrnoError(70)}else o=t.position;var i=t.stream_ops.read(t,e,r,n,o);return a||(t.position+=i),i},write(t,e,r,n,o,a){if(n<0||o<0)throw new Wt.ErrnoError(28);if(Wt.isClosed(t))throw new Wt.ErrnoError(8);if(0==(2097155&t.flags))throw new Wt.ErrnoError(8);if(Wt.isDir(t.node.mode))throw new Wt.ErrnoError(31);if(!t.stream_ops.write)throw new Wt.ErrnoError(28);t.seekable&&1024&t.flags&&Wt.llseek(t,0,2);var i="undefined"!=typeof o;if(i){if(!t.seekable)throw new Wt.ErrnoError(70)}else o=t.position;var s=t.stream_ops.write(t,e,r,n,o,a);return i||(t.position+=s),s},allocate(t,e,r){if(Wt.isClosed(t))throw new Wt.ErrnoError(8);if(e<0||r<=0)throw new Wt.ErrnoError(28);if(0==(2097155&t.flags))throw new Wt.ErrnoError(8);if(!Wt.isFile(t.node.mode)&&!Wt.isDir(t.node.mode))throw new Wt.ErrnoError(43);if(!t.stream_ops.allocate)throw new Wt.ErrnoError(138);t.stream_ops.allocate(t,e,r)},mmap(t,e,r,n,o){if(0!=(2&n)&&0==(2&o)&&2!=(2097155&t.flags))throw new Wt.ErrnoError(2);if(1==(2097155&t.flags))throw new Wt.ErrnoError(2);if(!t.stream_ops.mmap)throw new Wt.ErrnoError(43);return t.stream_ops.mmap(t,e,r,n,o)},msync:(t,e,r,n,o)=>t.stream_ops.msync?t.stream_ops.msync(t,e,r,n,o):0,munmap:t=>0,ioctl(t,e,r){if(!t.stream_ops.ioctl)throw new Wt.ErrnoError(59);return t.stream_ops.ioctl(t,e,r)},readFile(t,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding)throw new Error(`Invalid encoding type "${e.encoding}"`);var r,n=Wt.open(t,e.flags),o=Wt.stat(t).size,a=new Uint8Array(o);return Wt.read(n,a,0,o,0),"utf8"===e.encoding?r=vt(a,0):"binary"===e.encoding&&(r=a),Wt.close(n),r},writeFile(t,e,r={}){r.flags=r.flags||577;var n=Wt.open(t,r.flags,r.mode);if("string"==typeof e){var o=new Uint8Array(gt(e)+1),a=wt(e,o,0,o.length);Wt.write(n,o,0,a,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(e))throw new Error("Unsupported data type");Wt.write(n,e,0,e.byteLength,void 0,r.canOwn)}Wt.close(n)},cwd:()=>Wt.currentPath,chdir(t){var e=Wt.lookupPath(t,{follow:!0});if(null===e.node)throw new Wt.ErrnoError(44);if(!Wt.isDir(e.node.mode))throw new Wt.ErrnoError(54);var r=Wt.nodePermissions(e.node,"x");if(r)throw new Wt.ErrnoError(r);Wt.currentPath=e.path},createDefaultDirectories(){Wt.mkdir("/tmp"),Wt.mkdir("/home"),Wt.mkdir("/home/web_user")},createDefaultDevices(){Wt.mkdir("/dev"),Wt.registerDevice(Wt.makedev(1,3),{read:()=>0,write:(t,e,r,n,o)=>n}),Wt.mkdev("/dev/null",Wt.makedev(1,3)),Et.register(Wt.makedev(5,0),Et.default_tty_ops),Et.register(Wt.makedev(6,0),Et.default_tty1_ops),Wt.mkdev("/dev/tty",Wt.makedev(5,0)),Wt.mkdev("/dev/tty1",Wt.makedev(6,0));var t=new Uint8Array(1024),e=0,r=()=>(0===e&&(e=ft(t).byteLength),t[--e]);Wt.createDevice("/dev","random",r),Wt.createDevice("/dev","urandom",r),Wt.mkdir("/dev/shm"),Wt.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Wt.mkdir("/proc");var t=Wt.mkdir("/proc/self");Wt.mkdir("/proc/self/fd"),Wt.mount({mount(){var e=Wt.createNode(t,"fd",16895,73);return e.node_ops={lookup(t,e){var r=+e,n=Wt.getStreamChecked(r),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},e}},{},"/proc/self/fd")},createStandardStreams(){h.stdin?Wt.createDevice("/dev","stdin",h.stdin):Wt.symlink("/dev/tty","/dev/stdin"),h.stdout?Wt.createDevice("/dev","stdout",null,h.stdout):Wt.symlink("/dev/tty","/dev/stdout"),h.stderr?Wt.createDevice("/dev","stderr",null,h.stderr):Wt.symlink("/dev/tty1","/dev/stderr"),Wt.open("/dev/stdin",0),Wt.open("/dev/stdout",1),Wt.open("/dev/stderr",1)},ensureErrnoError(){Wt.ErrnoError||(Wt.ErrnoError=function(t,e){this.name="ErrnoError",this.node=e,this.setErrno=function(t){this.errno=t},this.setErrno(t),this.message="FS error"},Wt.ErrnoError.prototype=new Error,Wt.ErrnoError.prototype.constructor=Wt.ErrnoError,[44].forEach((t=>{Wt.genericErrors[t]=new Wt.ErrnoError(t),Wt.genericErrors[t].stack="<generic error, no stack>"})))},staticInit(){Wt.ensureErrnoError(),Wt.nameTable=new Array(4096),Wt.mount(Mt,{},"/"),Wt.createDefaultDirectories(),Wt.createDefaultDevices(),Wt.createSpecialDirectories(),Wt.filesystems={MEMFS:Mt}},init(t,e,r){Wt.init.initialized=!0,Wt.ensureErrnoError(),h.stdin=t||h.stdin,h.stdout=e||h.stdout,h.stderr=r||h.stderr,Wt.createStandardStreams()},quit(){Wt.init.initialized=!1;for(var t=0;t<Wt.streams.length;t++){var e=Wt.streams[t];e&&Wt.close(e)}},findObject(t,e){var r=Wt.analyzePath(t,e);return r.exists?r.object:null},analyzePath(t,e){try{t=(n=Wt.lookupPath(t,{follow:!e})).path}catch(t){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=Wt.lookupPath(t,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=ht.basename(t),n=Wt.lookupPath(t,{follow:!e}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot="/"===n.path}catch(t){r.error=t.errno}return r},createPath(t,e,r,n){t="string"==typeof t?t:Wt.getPath(t);for(var o=e.split("/").reverse();o.length;){var a=o.pop();if(a){var i=ht.join2(t,a);try{Wt.mkdir(i)}catch(t){}t=i}}return i},createFile(t,e,r,n,o){var a=ht.join2("string"==typeof t?t:Wt.getPath(t),e),i=Tt(n,o);return Wt.create(a,i)},createDataFile(t,e,r,n,o,a){var i=e;t&&(t="string"==typeof t?t:Wt.getPath(t),i=e?ht.join2(t,e):t);var s=Tt(n,o),u=Wt.create(i,s);if(r){if("string"==typeof r){for(var c=new Array(r.length),l=0,d=r.length;l<d;++l)c[l]=r.charCodeAt(l);r=c}Wt.chmod(u,146|s);var h=Wt.open(u,577);Wt.write(h,r,0,r.length,0,a),Wt.close(h),Wt.chmod(u,s)}return u},createDevice(t,e,r,n){var o=ht.join2("string"==typeof t?t:Wt.getPath(t),e),a=Tt(!!r,!!n);Wt.createDevice.major||(Wt.createDevice.major=64);var i=Wt.makedev(Wt.createDevice.major++,0);return Wt.registerDevice(i,{open(t){t.seekable=!1},close(t){n&&n.buffer&&n.buffer.length&&n(10)},read(t,e,n,o,a){for(var i=0,s=0;s<o;s++){var u;try{u=r()}catch(t){throw new Wt.ErrnoError(29)}if(void 0===u&&0===i)throw new Wt.ErrnoError(6);if(null==u)break;i++,e[n+s]=u}return i&&(t.node.timestamp=Date.now()),i},write(t,e,r,o,a){for(var i=0;i<o;i++)try{n(e[r+i])}catch(t){throw new Wt.ErrnoError(29)}return o&&(t.node.timestamp=Date.now()),i}}),Wt.mkdev(o,a,i)},forceLoadFile(t){if(t.isDevice||t.isFolder||t.link||t.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(!f)throw new Error("Cannot load without read() or XMLHttpRequest.");try{t.contents=bt(f(t.url),!0),t.usedBytes=t.contents.length}catch(t){throw new Wt.ErrnoError(29)}},createLazyFile(t,e,r,o,a){function i(){this.lengthKnown=!1,this.chunks=[]}if(i.prototype.get=function(t){if(!(t>this.length-1||t<0)){var e=t%this.chunkSize,r=t/this.chunkSize|0;return this.getter(r)[e]}},i.prototype.setDataGetter=function(t){this.getter=t},i.prototype.cacheLength=function(){var t=new XMLHttpRequest;if(t.open("HEAD",r,!1),t.send(null),!(t.status>=200&&t.status<300||304===t.status))throw new Error("Couldn't load "+r+". Status: "+t.status);var e,n=Number(t.getResponseHeader("Content-length")),o=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e,a=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e,i=1048576;o||(i=n);var s=this;s.setDataGetter((t=>{var e=t*i,o=(t+1)*i-1;if(o=Math.min(o,n-1),"undefined"==typeof s.chunks[t]&&(s.chunks[t]=((t,e)=>{if(t>e)throw new Error("invalid range ("+t+", "+e+") or no bytes requested!");if(e>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",r,!1),n!==i&&o.setRequestHeader("Range","bytes="+t+"-"+e),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+r+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):bt(o.responseText||"",!0)})(e,o)),"undefined"==typeof s.chunks[t])throw new Error("doXHR failed!");return s.chunks[t]})),!a&&n||(i=n=1,n=this.getter(0).length,i=n,M("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){var s=new i;Object.defineProperties(s,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var u={isDevice:!1,contents:s}}else u={isDevice:!1,url:r};var c=Wt.createFile(t,e,u,o,a);u.contents?c.contents=u.contents:u.url&&(c.contents=null,c.url=u.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var l={};function d(t,e,r,n,o){var a=t.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++)e[r+s]=a[o+s];else for(s=0;s<i;s++)e[r+s]=a.get(o+s);return i}return Object.keys(c.stream_ops).forEach((t=>{var e=c.stream_ops[t];l[t]=function(){return Wt.forceLoadFile(c),e.apply(null,arguments)}})),l.read=(t,e,r,n,o)=>(Wt.forceLoadFile(c),d(t,e,r,n,o)),l.mmap=(t,e,r,o,a)=>{Wt.forceLoadFile(c);var i=_t(e);if(!i)throw new Wt.ErrnoError(48);return d(t,n(),i,e,r),{ptr:i,allocated:!0}},c.stream_ops=l,c}},Ct=(t,e)=>t?vt(o(),t,e):"",Ft={DEFAULT_POLLMASK:5,calculateAt(t,e,r){if(ht.isAbs(e))return e;var n;if(n=-100===t?Wt.cwd():Ft.getStreamFromFD(t).path,0==e.length){if(!r)throw new Wt.ErrnoError(44);return n}return ht.join2(n,e)},doStat(t,e,r){try{var n=t(e)}catch(t){if(t&&t.node&&ht.normalize(e)!==ht.normalize(Wt.getPath(t.node)))return-54;throw t}s()[r>>2]=n.dev,s()[r+4>>2]=n.mode,u()[r+8>>2]=n.nlink,s()[r+12>>2]=n.uid,s()[r+16>>2]=n.gid,s()[r+20>>2]=n.rdev,K=[n.size>>>0,(J=n.size,+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+24>>2]=K[0],s()[r+28>>2]=K[1],s()[r+32>>2]=4096,s()[r+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),i=n.ctime.getTime();return K=[Math.floor(o/1e3)>>>0,(J=Math.floor(o/1e3),+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+40>>2]=K[0],s()[r+44>>2]=K[1],u()[r+48>>2]=o%1e3*1e3,K=[Math.floor(a/1e3)>>>0,(J=Math.floor(a/1e3),+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+56>>2]=K[0],s()[r+60>>2]=K[1],u()[r+64>>2]=a%1e3*1e3,K=[Math.floor(i/1e3)>>>0,(J=Math.floor(i/1e3),+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+72>>2]=K[0],s()[r+76>>2]=K[1],u()[r+80>>2]=i%1e3*1e3,K=[n.ino>>>0,(J=n.ino,+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[r+88>>2]=K[0],s()[r+92>>2]=K[1],0},doMsync(t,e,r,n,a){if(!Wt.isFile(e.node.mode))throw new Wt.ErrnoError(43);if(2&n)return 0;var i=o().slice(t,t+r);Wt.msync(e,i,a,r,n)},varargs:void 0,get(){var t=s()[Ft.varargs>>2];return Ft.varargs+=4,t},getp:()=>Ft.get(),getStr:t=>Ct(t),getStreamFromFD:t=>Wt.getStreamChecked(t)};function St(t){if(w)return Ar(0,1,t);F=t,L()||($t.terminateAllThreads(),h.onExit&&h.onExit(t),I=!0),g(t,new ut(t))}var jt=(t,e)=>{if(F=t,w)throw At(t),"unwind";St(t)},Pt=t=>{if(t instanceof ut||"unwind"==t)return F;g(1,t)},$t={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){w?$t.initWorker():$t.initMainThread()},initMainThread(){for(var t=Math.min(4,Math.max(1,navigator.hardwareConcurrency-1));t--;)$t.allocateUnusedWorker();X((()=>{et(),$t.loadWasmModuleToAllWorkers((()=>rt()))}))},initWorker(){C=!1},setExitStatus:t=>{F=t},terminateAllThreads__deps:["$terminateWorker"],terminateAllThreads:()=>{for(var t of $t.runningWorkers)ct(t);for(var t of $t.unusedWorkers)ct(t);$t.unusedWorkers=[],$t.runningWorkers=[],$t.pthreads=[]},returnWorkerToPool:t=>{var e=t.pthread_ptr;delete $t.pthreads[e],$t.unusedWorkers.push(t),$t.runningWorkers.splice($t.runningWorkers.indexOf(t),1),t.pthread_ptr=0,Rn(e)},receiveObjectTransfer(t){},threadInitTLS(){$t.tlsInitFunctions.forEach((t=>t()))},loadWasmModuleToWorker:t=>new Promise((e=>{t.onmessage=r=>{var n=r.data,o=n.cmd;if(n.targetThread&&n.targetThread!=jn()){var a=$t.pthreads[n.targetThread];a?a.postMessage(n,n.transferList):k(`Internal error! Worker sent a message "${o}" to target pthread ${n.targetThread}, but that thread no longer exists!`)}else{var i;"checkMailbox"===o?$r():"spawnThread"===o?dt(n):"cleanupThread"===o?lt(n.thread):"killThread"===o?(t=>{var e=$t.pthreads[t];delete $t.pthreads[t],ct(e),Rn(t),$t.runningWorkers.splice($t.runningWorkers.indexOf(e),1),e.pthread_ptr=0})(n.thread):"cancelThread"===o?(i=n.thread,$t.pthreads[i].postMessage({cmd:"cancel"})):"loaded"===o?(t.loaded=!0,e(t)):"alert"===o?alert(`Thread ${n.threadId}: ${n.text}`):"setimmediate"===n.target?t.postMessage(n):"callHandler"===o?h[n.handler](...n.args):o&&k(`worker sent an unknown command ${o}`)}},t.onerror=t=>{throw k(`worker sent an error! ${t.filename}:${t.lineno}: ${t.message}`),t};var n=[];for(var o of["onExit","onAbort","print","printErr"])h.hasOwnProperty(o)&&n.push(o);t.postMessage({cmd:"load",handlers:n,urlOrBlob:h.mainScriptUrlOrBlob||r,wasmMemory:T,wasmModule:W})})),loadWasmModuleToAllWorkers(t){if(w)return t();Promise.all($t.unusedWorkers.map($t.loadWasmModuleToWorker)).then(t)},allocateUnusedWorker(){var t,e=E("ScanbotSDK.Asm-simd-threads.worker.js");t=new Worker(e),$t.unusedWorkers.push(t)},getNewWorker:()=>(0==$t.unusedWorkers.length&&($t.allocateUnusedWorker(),$t.loadWasmModuleToWorker($t.unusedWorkers[0])),$t.unusedWorkers.pop())};h.PThread=$t;var Dt=t=>{for(;t.length>0;)t.shift()(h)};function At(t){if(w)return Ar(1,0,t);jt(t)}h.establishStackSpace=()=>{var t=jn(),e=s()[t+52>>2],r=s()[t+56>>2];Zn(e,e-r),zn(e)};var xt=t=>Z.get(t);h.invokeEntryPoint=(t,e)=>{!function(t){L()?$t.setExitStatus(t):In(t)}(xt(t)(e))};var Rt=t=>{$t.tlsInitFunctions.push(t)},It=[],Ot=0,Vt=0;function Zt(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){u()[this.ptr+4>>2]=t},this.get_type=function(){return u()[this.ptr+4>>2]},this.set_destructor=function(t){u()[this.ptr+8>>2]=t},this.get_destructor=function(){return u()[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,n()[this.ptr+12>>0]=t},this.get_caught=function(){return 0!=n()[this.ptr+12>>0]},this.set_rethrown=function(t){t=t?1:0,n()[this.ptr+13>>0]=t},this.get_rethrown=function(){return 0!=n()[this.ptr+13>>0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e)},this.set_adjusted_ptr=function(t){u()[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return u()[this.ptr+16>>2]},this.get_exception_ptr=function(){if(Hn(this.get_type()))return u()[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}var Nt=t=>{var e=Vt;if(!e)return Pn(0),0;var r=new Zt(e);r.set_adjusted_ptr(e);var n=r.get_type();if(!n)return Pn(0),e;for(var o in t){var a=t[o];if(0===a||a===n)break;var i=r.ptr+16;if(Ln(a,n,i))return Pn(a),e}return Pn(n),e},zt=()=>{var t=It.pop();t||nt("no exception to throw");var e=t.excPtr;throw t.get_rethrown()||(It.push(t),t.set_rethrown(!0),t.set_caught(!1),Ot++),Vt=e};function Ut(t,e,r,n){return w?Ar(2,1,t,e,r,n):Gt(t,e,r,n)}var Gt=(t,e,r,n)=>{if("undefined"==typeof SharedArrayBuffer)return k("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var o=[];if(w&&0===o.length)return Ut(t,e,r,n);var a={startRoutine:r,pthread_ptr:t,arg:n,transferList:o};return w?(a.cmd="spawnThread",postMessage(a,o),0):dt(a)};function Yt(t,e,r,n,o){if(w)return Ar(3,1,t,e,r,n,o);try{for(var a=0,i=e?s()[e>>2]:0,u=e?s()[e+4>>2]:0,c=r?s()[r>>2]:0,l=r?s()[r+4>>2]:0,d=n?s()[n>>2]:0,h=n?s()[n+4>>2]:0,f=0,p=0,m=0,v=0,y=0,g=0,b=(e?s()[e>>2]:0)|(r?s()[r>>2]:0)|(n?s()[n>>2]:0),E=(e?s()[e+4>>2]:0)|(r?s()[r+4>>2]:0)|(n?s()[n+4>>2]:0),_=function(t,e,r,n){return t<32?e&n:r&n},M=0;M<t;M++){var k=1<<M%32;if(_(M,b,E,k)){var T=Ft.getStreamFromFD(M),W=Ft.DEFAULT_POLLMASK;if(T.stream_ops.poll){var C=-1;o&&(C=1e3*((e?s()[o>>2]:0)+(e?s()[o+8>>2]:0)/1e6)),W=T.stream_ops.poll(T,C)}1&W&&_(M,i,u,k)&&(M<32?f|=k:p|=k,a++),4&W&&_(M,c,l,k)&&(M<32?m|=k:v|=k,a++),2&W&&_(M,d,h,k)&&(M<32?y|=k:g|=k,a++)}}return e&&(s()[e>>2]=f,s()[e+4>>2]=p),r&&(s()[r>>2]=m,s()[r+4>>2]=v),n&&(s()[n>>2]=y,s()[n+4>>2]=g),a}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}function Lt(t,e){if(w)return Ar(4,1,t,e);try{return t=Ft.getStr(t),Wt.chmod(t,e),0}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}function Ht(t,e){if(w)return Ar(5,1,t,e);try{return Wt.fchmod(t,e),0}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}function Xt(t,e,r){if(w)return Ar(6,1,t,e,r);Ft.varargs=r;try{var n=Ft.getStreamFromFD(t);switch(e){case 0:if((o=Ft.get())<0)return-28;for(;Wt.streams[o];)o++;return Wt.createStream(n,o).fd;case 1:case 2:case 6:case 7:return 0;case 3:return n.flags;case 4:var o=Ft.get();return n.flags|=o,0;case 5:return o=Ft.getp(),a()[o+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return i=28,s()[Sn()>>2]=i,-1}}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}var i}function Bt(t,e){if(w)return Ar(7,1,t,e);try{var r=Ft.getStreamFromFD(t);return Ft.doStat(Wt.stat,r.path,e)}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}var Jt=(t,e)=>e+2097152>>>0<4194305-!!t?(t>>>0)+4294967296*e:NaN;function Kt(t,e,r){if(w)return Ar(8,1,t,e,r);var n=Jt(e,r);try{return isNaN(n)?61:(Wt.ftruncate(t,n),0)}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}var Qt=(t,e,r)=>wt(t,o(),e,r);function qt(t,e){if(w)return Ar(9,1,t,e);try{if(0===e)return-28;var r=Wt.cwd(),n=gt(r)+1;return e<n?-68:(Qt(r,t,e),n)}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}function te(t,e,r){if(w)return Ar(10,1,t,e,r);try{var o=Ft.getStreamFromFD(t);o.getdents||(o.getdents=Wt.readdir(o.path));for(var i=280,u=0,c=Wt.llseek(o,0,1),l=Math.floor(c/i);l<o.getdents.length&&u+i<=r;){var d,h,f=o.getdents[l];if("."===f)d=o.node.id,h=4;else if(".."===f)d=Wt.lookupPath(o.path,{parent:!0}).node.id,h=4;else{var p=Wt.lookupNode(o.node,f);d=p.id,h=Wt.isChrdev(p.mode)?2:Wt.isDir(p.mode)?4:Wt.isLink(p.mode)?10:8}K=[d>>>0,(J=d,+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[e+u>>2]=K[0],s()[e+u+4>>2]=K[1],K=[(l+1)*i>>>0,(J=(l+1)*i,+Math.abs(J)>=1?J>0?+Math.floor(J/4294967296)>>>0:~~+Math.ceil((J-+(~~J>>>0))/4294967296)>>>0:0)],s()[e+u+8>>2]=K[0],s()[e+u+12>>2]=K[1],a()[e+u+16>>1]=280,n()[e+u+18>>0]=h,Qt(f,e+u+19,256),u+=i,l+=1}return Wt.llseek(o,l*i,0),u}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}function ee(t,e,r){if(w)return Ar(11,1,t,e,r);Ft.varargs=r;try{var o=Ft.getStreamFromFD(t);switch(e){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return o.tty?0:-59;case 21505:if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var i=o.tty.ops.ioctl_tcgets(o),u=Ft.getp();s()[u>>2]=i.c_iflag||0,s()[u+4>>2]=i.c_oflag||0,s()[u+8>>2]=i.c_cflag||0,s()[u+12>>2]=i.c_lflag||0;for(var c=0;c<32;c++)n()[u+c+17>>0]=i.c_cc[c]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){u=Ft.getp();var l=s()[u>>2],d=s()[u+4>>2],h=s()[u+8>>2],f=s()[u+12>>2],p=[];for(c=0;c<32;c++)p.push(n()[u+c+17>>0]);return o.tty.ops.ioctl_tcsets(o.tty,e,{c_iflag:l,c_oflag:d,c_cflag:h,c_lflag:f,c_cc:p})}return 0;case 21519:return o.tty?(u=Ft.getp(),s()[u>>2]=0,0):-59;case 21520:return o.tty?-28:-59;case 21531:return u=Ft.getp(),Wt.ioctl(o,e,u);case 21523:if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var m=o.tty.ops.ioctl_tiocgwinsz(o.tty);u=Ft.getp(),a()[u>>1]=m[0],a()[u+2>>1]=m[1]}return 0;default:return-28}}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}function re(t,e){if(w)return Ar(12,1,t,e);try{return t=Ft.getStr(t),Ft.doStat(Wt.lstat,t,e)}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}function ne(t,e,r){if(w)return Ar(13,1,t,e,r);try{return e=Ft.getStr(e),e=Ft.calculateAt(t,e),"/"===(e=ht.normalize(e))[e.length-1]&&(e=e.substr(0,e.length-1)),Wt.mkdir(e,r,0),0}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}function oe(t,e,r,n){if(w)return Ar(14,1,t,e,r,n);try{e=Ft.getStr(e);var o=256&n,a=4096&n;return n&=-6401,e=Ft.calculateAt(t,e,a),Ft.doStat(o?Wt.lstat:Wt.stat,e,r)}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}function ae(t,e,r,n){if(w)return Ar(15,1,t,e,r,n);Ft.varargs=n;try{e=Ft.getStr(e),e=Ft.calculateAt(t,e);var o=n?Ft.get():0;return Wt.open(e,r,o).fd}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}function ie(t,e,r,o){if(w)return Ar(16,1,t,e,r,o);try{if(e=Ft.getStr(e),e=Ft.calculateAt(t,e),o<=0)return-28;var a=Wt.readlink(e),i=Math.min(o,gt(a)),s=n()[r+i];return Qt(a,r,o+1),n()[r+i]=s,i}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}function se(t){if(w)return Ar(17,1,t);try{return t=Ft.getStr(t),Wt.rmdir(t),0}catch(t){if("undefined"==typeof Wt||"ErrnoError"!==t.name)throw t;return-t.errno}}function ue(t,e){if(w)return Ar(18,1,t,e);try