UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

5 lines • 54.1 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{c as r,g as e}from"./_commonjsHelpers.js";var t,n={exports:{}};function o(){return t||(t=1,e=n,o="undefined"!=typeof document?document.currentScript?.src:void 0,a=function(e={}){var t,n,a,i,s=e,l=new Promise(((r,e)=>{t=r,n=e})),u=Object.assign({},s),d="./this.program",c=(r,e)=>{throw e},f="";function h(r){return s.locateFile?s.locateFile(r,f):f+r}"undefined"!=typeof document&&document.currentScript&&(f=document.currentScript.src),o&&(f=o),f=f.startsWith("blob:")?"":f.substr(0,f.replace(/[?#].*/,"").lastIndexOf("/")+1),a=r=>fetch(r,{credentials:"same-origin"}).then((r=>r.ok?r.arrayBuffer():Promise.reject(new Error(r.status+" : "+r.url))));var m=s.print||console.log.bind(console),p=s.printErr||console.error.bind(console);Object.assign(s,u),u=null,s.arguments&&s.arguments,s.thisProgram&&(d=s.thisProgram);var v,w,y,g,E,_,b,k,F,P=s.wasmBinary,A=!1;function S(){var r=v.buffer;s.HEAP8=w=new Int8Array(r),s.HEAP16=g=new Int16Array(r),s.HEAPU8=y=new Uint8Array(r),s.HEAPU16=E=new Uint16Array(r),s.HEAP32=_=new Int32Array(r),s.HEAPU32=b=new Uint32Array(r),s.HEAPF32=k=new Float32Array(r),s.HEAPF64=F=new Float64Array(r)}var D=[],$=[],C=[];function T(){if(s.preRun)for("function"==typeof s.preRun&&(s.preRun=[s.preRun]);s.preRun.length;)x(s.preRun.shift());tr(D)}function j(){s.noFSInit||jr.initialized||jr.init(),jr.ignorePermissions=!1,tr($)}function M(){if(s.postRun)for("function"==typeof s.postRun&&(s.postRun=[s.postRun]);s.postRun.length;)N(s.postRun.shift());tr(C)}function x(r){D.unshift(r)}function R(r){$.unshift(r)}function N(r){C.unshift(r)}var z=0,W=null;function O(r){return r}function U(r){z++,s.monitorRunDependencies?.(z)}function B(r){if(z--,s.monitorRunDependencies?.(z),0==z&&W){var e=W;W=null,e()}}function L(r){s.onAbort?.(r),p(r="Aborted("+r+")"),A=!0,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw n(e),e}var I,H,V,q="data:application/octet-stream;base64,",X=r=>r.startsWith(q);function G(){var r="lyr3DWorker.wasm";return X(r)?r:h(r)}function K(r){if(r==I&&P)return new Uint8Array(P);throw"both async and sync fetching of the wasm failed"}function Y(r){return P?Promise.resolve().then((()=>K(r))):a(r).then((r=>new Uint8Array(r)),(()=>K(r)))}function J(r,e,t){return Y(r).then((r=>WebAssembly.instantiate(r,e))).then(t,(r=>{p(`failed to asynchronously prepare wasm: ${r}`),L(r)}))}function Q(r,e,t,n){return r||"function"!=typeof WebAssembly.instantiateStreaming||X(e)||"function"!=typeof fetch?J(e,t,n):fetch(e,{credentials:"same-origin"}).then((r=>WebAssembly.instantiateStreaming(r,t).then(n,(function(r){return p(`wasm streaming compile failed: ${r}`),p("falling back to ArrayBuffer instantiation"),J(e,t,n)}))))}function Z(){return{a:nn}}function rr(){function r(r,e){return on=r.exports,v=on._,S(),ye=on.ba,R(on.$),B(),on}function e(e){r(e.instance)}U();var t=Z();if(s.instantiateWasm)try{return s.instantiateWasm(t,r)}catch(o){p(`Module.instantiateWasm callback failed with error: ${o}`),n(o)}return I??=G(),Q(P,I,t,e).catch(n),{}}class er{name="ExitStatus";constructor(r){this.message=`Program terminated with exit(${r})`,this.status=r}}var tr=r=>{for(;r.length>0;)r.shift()(s)},nr=s.noExitRuntime||!0,or=r=>dn(r),ar=()=>cn();class ir{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){b[this.ptr+4>>2]=r}get_type(){return b[this.ptr+4>>2]}set_destructor(r){b[this.ptr+8>>2]=r}get_destructor(){return b[this.ptr+8>>2]}set_caught(r){r=r?1:0,w[this.ptr+12]=r}get_caught(){return 0!=w[this.ptr+12]}set_rethrown(r){r=r?1:0,w[this.ptr+13]=r}get_rethrown(){return 0!=w[this.ptr+13]}init(r,e){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(e)}set_adjusted_ptr(r){b[this.ptr+16>>2]=r}get_adjusted_ptr(){return b[this.ptr+16>>2]}}var sr=(r,e,t)=>{throw new ir(r).init(e,t),r},lr=()=>{var r=_[+xr.varargs>>2];return xr.varargs+=4,r},ur=lr,dr={isAbs:r=>"/"===r.charAt(0),splitPath:r=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(r).slice(1),normalizeArray:(r,e)=>{for(var t=0,n=r.length-1;n>=0;n--){var o=r[n];"."===o?r.splice(n,1):".."===o?(r.splice(n,1),t++):t&&(r.splice(n,1),t--)}if(e)for(;t;t--)r.unshift("..");return r},normalize:r=>{var e=dr.isAbs(r),t="/"===r.substr(-1);return(r=dr.normalizeArray(r.split("/").filter((r=>!!r)),!e).join("/"))||e||(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=dr.splitPath(r),t=e[0],n=e[1];return t||n?(n&&(n=n.substr(0,n.length-1)),t+n):"."},basename:r=>{if("/"===r)return"/";var e=(r=(r=dr.normalize(r)).replace(/\/$/,"")).lastIndexOf("/");return-1===e?r:r.substr(e+1)},join:(...r)=>dr.normalize(r.join("/")),join2:(r,e)=>dr.normalize(r+"/"+e)},cr=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return r=>crypto.getRandomValues(r);L("initRandomDevice")},fr=r=>(fr=cr())(r),hr={resolve:(...r)=>{for(var e="",t=!1,n=r.length-1;n>=-1&&!t;n--){var o=n>=0?r[n]:jr.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";e=o+"/"+e,t=dr.isAbs(o)}return(t?"/":"")+(e=dr.normalizeArray(e.split("/").filter((r=>!!r)),!t).join("/"))||"."},relative:(r,e)=>{function t(r){for(var e=0;e<r.length&&""===r[e];e++);for(var t=r.length-1;t>=0&&""===r[t];t--);return e>t?[]:r.slice(e,t-e+1)}r=hr.resolve(r).substr(1),e=hr.resolve(e).substr(1);for(var n=t(r.split("/")),o=t(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 l=[];for(s=i;s<n.length;s++)l.push("..");return(l=l.concat(o.slice(i))).join("/")}},mr="undefined"!=typeof TextDecoder?new TextDecoder:void 0,pr=(r,e=0,t=NaN)=>{for(var n=e+t,o=e;r[o]&&!(o>=n);)++o;if(o-e>16&&r.buffer&&mr)return mr.decode(r.subarray(e,o));for(var a="";e<o;){var i=r[e++];if(128&i){var s=63&r[e++];if(192!=(224&i)){var l=63&r[e++];if((i=224==(240&i)?(15&i)<<12|s<<6|l:(7&i)<<18|s<<12|l<<6|63&r[e++])<65536)a+=String.fromCharCode(i);else{var u=i-65536;a+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},vr=[],wr=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n<=127?e++:n<=2047?e+=2:n>=55296&&n<=57343?(e+=4,++t):e+=3}return e},yr=(r,e,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,i=0;i<r.length;++i){var s=r.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&r.charCodeAt(++i)),s<=127){if(t>=a)break;e[t++]=s}else if(s<=2047){if(t+1>=a)break;e[t++]=192|s>>6,e[t++]=128|63&s}else if(s<=65535){if(t+2>=a)break;e[t++]=224|s>>12,e[t++]=128|s>>6&63,e[t++]=128|63&s}else{if(t+3>=a)break;e[t++]=240|s>>18,e[t++]=128|s>>12&63,e[t++]=128|s>>6&63,e[t++]=128|63&s}}return e[t]=0,t-o};function gr(r,e,t){var n=wr(r)+1,o=new Array(n),a=yr(r,o,0,o.length);return o.length=a,o}var Er=()=>{if(!vr.length){var r=null;if("undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(r=window.prompt("Input: "))&&(r+="\n"),!r)return null;vr=gr(r)}return vr.shift()},_r={ttys:[],init(){},shutdown(){},register(r,e){_r.ttys[r]={input:[],output:[],ops:e},jr.registerDevice(r,_r.stream_ops)},stream_ops:{open(r){var e=_r.ttys[r.node.rdev];if(!e)throw new jr.ErrnoError(43);r.tty=e,r.seekable=!1},close(r){r.tty.ops.fsync(r.tty)},fsync(r){r.tty.ops.fsync(r.tty)},read(r,e,t,n,o){if(!r.tty||!r.tty.ops.get_char)throw new jr.ErrnoError(60);for(var a=0,i=0;i<n;i++){var s;try{s=r.tty.ops.get_char(r.tty)}catch(l){throw new jr.ErrnoError(29)}if(void 0===s&&0===a)throw new jr.ErrnoError(6);if(null==s)break;a++,e[t+i]=s}return a&&(r.node.timestamp=Date.now()),a},write(r,e,t,n,o){if(!r.tty||!r.tty.ops.put_char)throw new jr.ErrnoError(60);try{for(var a=0;a<n;a++)r.tty.ops.put_char(r.tty,e[t+a])}catch(i){throw new jr.ErrnoError(29)}return n&&(r.node.timestamp=Date.now()),a}},default_tty_ops:{get_char:r=>Er(),put_char(r,e){null===e||10===e?(m(pr(r.output)),r.output=[]):0!=e&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(m(pr(r.output)),r.output=[])},ioctl_tcgets:r=>({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:(r,e,t)=>0,ioctl_tiocgwinsz:r=>[24,80]},default_tty1_ops:{put_char(r,e){null===e||10===e?(p(pr(r.output)),r.output=[]):0!=e&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(p(pr(r.output)),r.output=[])}}},br=(r,e)=>Math.ceil(r/e)*e,kr=r=>{L()},Fr={ops_table:null,mount:r=>Fr.createNode(null,"/",16895,0),createNode(r,e,t,n){if(jr.isBlkdev(t)||jr.isFIFO(t))throw new jr.ErrnoError(63);Fr.ops_table||={dir:{node:{getattr:Fr.node_ops.getattr,setattr:Fr.node_ops.setattr,lookup:Fr.node_ops.lookup,mknod:Fr.node_ops.mknod,rename:Fr.node_ops.rename,unlink:Fr.node_ops.unlink,rmdir:Fr.node_ops.rmdir,readdir:Fr.node_ops.readdir,symlink:Fr.node_ops.symlink},stream:{llseek:Fr.stream_ops.llseek}},file:{node:{getattr:Fr.node_ops.getattr,setattr:Fr.node_ops.setattr},stream:{llseek:Fr.stream_ops.llseek,read:Fr.stream_ops.read,write:Fr.stream_ops.write,allocate:Fr.stream_ops.allocate,mmap:Fr.stream_ops.mmap,msync:Fr.stream_ops.msync}},link:{node:{getattr:Fr.node_ops.getattr,setattr:Fr.node_ops.setattr,readlink:Fr.node_ops.readlink},stream:{}},chrdev:{node:{getattr:Fr.node_ops.getattr,setattr:Fr.node_ops.setattr},stream:jr.chrdev_stream_ops}};var o=jr.createNode(r,e,t,n);return jr.isDir(o.mode)?(o.node_ops=Fr.ops_table.dir.node,o.stream_ops=Fr.ops_table.dir.stream,o.contents={}):jr.isFile(o.mode)?(o.node_ops=Fr.ops_table.file.node,o.stream_ops=Fr.ops_table.file.stream,o.usedBytes=0,o.contents=null):jr.isLink(o.mode)?(o.node_ops=Fr.ops_table.link.node,o.stream_ops=Fr.ops_table.link.stream):jr.isChrdev(o.mode)&&(o.node_ops=Fr.ops_table.chrdev.node,o.stream_ops=Fr.ops_table.chrdev.stream),o.timestamp=Date.now(),r&&(r.contents[e]=o,r.timestamp=o.timestamp),o},getFileDataAsTypedArray:r=>r.contents?r.contents.subarray?r.contents.subarray(0,r.usedBytes):new Uint8Array(r.contents):new Uint8Array(0),expandFileStorage(r,e){var t=r.contents?r.contents.length:0;if(!(t>=e)){var n=1048576;e=Math.max(e,t*(t<n?2:1.125)>>>0),0!=t&&(e=Math.max(e,256));var o=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(o.subarray(0,r.usedBytes),0)}},resizeFileStorage(r,e){if(r.usedBytes!=e)if(0==e)r.contents=null,r.usedBytes=0;else{var t=r.contents;r.contents=new Uint8Array(e),t&&r.contents.set(t.subarray(0,Math.min(e,r.usedBytes))),r.usedBytes=e}},node_ops:{getattr(r){var e={};return e.dev=jr.isChrdev(r.mode)?r.id:1,e.ino=r.id,e.mode=r.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=r.rdev,jr.isDir(r.mode)?e.size=4096:jr.isFile(r.mode)?e.size=r.usedBytes:jr.isLink(r.mode)?e.size=r.link.length:e.size=0,e.atime=new Date(r.timestamp),e.mtime=new Date(r.timestamp),e.ctime=new Date(r.timestamp),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},setattr(r,e){void 0!==e.mode&&(r.mode=e.mode),void 0!==e.timestamp&&(r.timestamp=e.timestamp),void 0!==e.size&&Fr.resizeFileStorage(r,e.size)},lookup(r,e){throw Fr.doesNotExistError},mknod:(r,e,t,n)=>Fr.createNode(r,e,t,n),rename(r,e,t){if(jr.isDir(r.mode)){var n;try{n=jr.lookupNode(e,t)}catch(a){}if(n)for(var o in n.contents)throw new jr.ErrnoError(55)}delete r.parent.contents[r.name],r.parent.timestamp=Date.now(),r.name=t,e.contents[t]=r,e.timestamp=r.parent.timestamp},unlink(r,e){delete r.contents[e],r.timestamp=Date.now()},rmdir(r,e){var t=jr.lookupNode(r,e);for(var n in t.contents)throw new jr.ErrnoError(55);delete r.contents[e],r.timestamp=Date.now()},readdir(r){var e=[".",".."];for(var t of Object.keys(r.contents))e.push(t);return e},symlink(r,e,t){var n=Fr.createNode(r,e,41471,0);return n.link=t,n},readlink(r){if(!jr.isLink(r.mode))throw new jr.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,n,o){var a=r.node.contents;if(o>=r.node.usedBytes)return 0;var i=Math.min(r.node.usedBytes-o,n);if(i>8&&a.subarray)e.set(a.subarray(o,o+i),t);else for(var s=0;s<i;s++)e[t+s]=a[o+s];return i},write(r,e,t,n,o,a){if(e.buffer===w.buffer&&(a=!1),!n)return 0;var i=r.node;if(i.timestamp=Date.now(),e.subarray&&(!i.contents||i.contents.subarray)){if(a)return i.contents=e.subarray(t,t+n),i.usedBytes=n,n;if(0===i.usedBytes&&0===o)return i.contents=e.slice(t,t+n),i.usedBytes=n,n;if(o+n<=i.usedBytes)return i.contents.set(e.subarray(t,t+n),o),n}if(Fr.expandFileStorage(i,o+n),i.contents.subarray&&e.subarray)i.contents.set(e.subarray(t,t+n),o);else for(var s=0;s<n;s++)i.contents[o+s]=e[t+s];return i.usedBytes=Math.max(i.usedBytes,o+n),n},llseek(r,e,t){var n=e;if(1===t?n+=r.position:2===t&&jr.isFile(r.node.mode)&&(n+=r.node.usedBytes),n<0)throw new jr.ErrnoError(28);return n},allocate(r,e,t){Fr.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,n,o){if(!jr.isFile(r.node.mode))throw new jr.ErrnoError(43);var a,i,s=r.node.contents;if(2&o||!s||s.buffer!==w.buffer){if(i=!0,!(a=kr()))throw new jr.ErrnoError(48);s&&((t>0||t+e<s.length)&&(s=s.subarray?s.subarray(t,t+e):Array.prototype.slice.call(s,t,t+e)),w.set(s,a))}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:(r,e,t,n,o)=>(Fr.stream_ops.write(r,e,0,n,t,!1),0)}},Pr=(r,e,t,n)=>{var o=O(`al ${r}`);a(r).then((r=>{e(new Uint8Array(r)),o&&B()}),(e=>{if(!t)throw`Loading data file "${r}" failed.`;t()})),o&&U()},Ar=(r,e,t,n,o,a)=>{jr.createDataFile(r,e,t,n,o,a)},Sr=s.preloadPlugins||[],Dr=(r,e,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return Sr.forEach((a=>{o||a.canHandle(e)&&(a.handle(r,e,t,n),o=!0)})),o},$r=(r,e,t,n,o,a,i,s,l,u)=>{var d=e?hr.resolve(dr.join2(r,e)):r;function c(t){function c(t){u?.(),s||Ar(r,e,t,n,o,l),a?.(),B()}Dr(t,d,c,(()=>{i?.(),B()}))||c(t)}U(),"string"==typeof t?Pr(t,c,i):c(t)},Cr=r=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[r];if(void 0===e)throw new Error(`Unknown file open mode: ${r}`);return e},Tr=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},jr={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{name="ErrnoError";constructor(r){this.errno=r}},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{shared={};get object(){return this.node}set object(r){this.node=r}get isRead(){return 1!=(2097155&this.flags)}get isWrite(){return!!(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(r,e,t,n){r||(r=this),this.parent=r,this.mount=r.mount,this.id=jr.nextInode++,this.name=e,this.mode=t,this.rdev=n}get read(){return(this.mode&this.readMode)===this.readMode}set read(r){r?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(r){r?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return jr.isDir(this.mode)}get isDevice(){return jr.isChrdev(this.mode)}},lookupPath(r,e={}){if(!(r=hr.resolve(r)))return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if((e=Object.assign(t,e)).recurse_count>8)throw new jr.ErrnoError(32);for(var n=r.split("/").filter((r=>!!r)),o=jr.root,a="/",i=0;i<n.length;i++){var s=i===n.length-1;if(s&&e.parent)break;if(o=jr.lookupNode(o,n[i]),a=dr.join2(a,n[i]),jr.isMountpoint(o)&&(!s||s&&e.follow_mount)&&(o=o.mounted.root),!s||e.follow)for(var l=0;jr.isLink(o.mode);){var u=jr.readlink(a);if(a=hr.resolve(dr.dirname(a),u),o=jr.lookupPath(a,{recurse_count:e.recurse_count+1}).node,l++>40)throw new jr.ErrnoError(32)}}return{path:a,node:o}},getPath(r){for(var e;;){if(jr.isRoot(r)){var t=r.mount.mountpoint;return e?"/"!==t[t.length-1]?`${t}/${e}`:t+e:t}e=e?`${r.name}/${e}`:r.name,r=r.parent}},hashName(r,e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return(r+t>>>0)%jr.nameTable.length},hashAddNode(r){var e=jr.hashName(r.parent.id,r.name);r.name_next=jr.nameTable[e],jr.nameTable[e]=r},hashRemoveNode(r){var e=jr.hashName(r.parent.id,r.name);if(jr.nameTable[e]===r)jr.nameTable[e]=r.name_next;else for(var t=jr.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=jr.mayLookup(r);if(t)throw new jr.ErrnoError(t);for(var n=jr.hashName(r.id,e),o=jr.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===r.id&&a===e)return o}return jr.lookup(r,e)},createNode(r,e,t,n){var o=new jr.FSNode(r,e,t,n);return jr.hashAddNode(o),o},destroyNode(r){jr.hashRemoveNode(r)},isRoot:r=>r===r.parent,isMountpoint:r=>!!r.mounted,isFile:r=>32768==(61440&r),isDir:r=>16384==(61440&r),isLink:r=>40960==(61440&r),isChrdev:r=>8192==(61440&r),isBlkdev:r=>24576==(61440&r),isFIFO:r=>4096==(61440&r),isSocket:r=>!(49152&~r),flagsToPermissionString(r){var e=["r","w","rw"][3&r];return 512&r&&(e+="w"),e},nodePermissions:(r,e)=>jr.ignorePermissions||(!e.includes("r")||292&r.mode)&&(!e.includes("w")||146&r.mode)&&(!e.includes("x")||73&r.mode)?0:2,mayLookup(r){if(!jr.isDir(r.mode))return 54;var e=jr.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){try{return jr.lookupNode(r,e),20}catch(t){}return jr.nodePermissions(r,"wx")},mayDelete(r,e,t){var n;try{n=jr.lookupNode(r,e)}catch(a){return a.errno}var o=jr.nodePermissions(r,"wx");if(o)return o;if(t){if(!jr.isDir(n.mode))return 54;if(jr.isRoot(n)||jr.getPath(n)===jr.cwd())return 10}else if(jr.isDir(n.mode))return 31;return 0},mayOpen:(r,e)=>r?jr.isLink(r.mode)?32:jr.isDir(r.mode)&&("r"!==jr.flagsToPermissionString(e)||512&e)?31:jr.nodePermissions(r,jr.flagsToPermissionString(e)):44,MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=jr.MAX_OPEN_FDS;r++)if(!jr.streams[r])return r;throw new jr.ErrnoError(33)},getStreamChecked(r){var e=jr.getStream(r);if(!e)throw new jr.ErrnoError(8);return e},getStream:r=>jr.streams[r],createStream:(r,e=-1)=>(r=Object.assign(new jr.FSStream,r),-1==e&&(e=jr.nextfd()),r.fd=e,jr.streams[e]=r,r),closeStream(r){jr.streams[r]=null},dupStream(r,e=-1){var t=jr.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=jr.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new jr.ErrnoError(70)}},major:r=>r>>8,minor:r=>255&r,makedev:(r,e)=>r<<8|e,registerDevice(r,e){jr.devices[r]={stream_ops:e}},getDevice:r=>jr.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var n=t.pop();e.push(n),t.push(...n.mounts)}return e},syncfs(r,e){"function"==typeof r&&(e=r,r=!1),jr.syncFSRequests++,jr.syncFSRequests>1&&p(`warning: ${jr.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=jr.getMounts(jr.root.mount),n=0;function o(r){return jr.syncFSRequests--,e(r)}function a(r){if(r)return a.errored?void 0:(a.errored=!0,o(r));++n>=t.length&&o(null)}t.forEach((e=>{if(!e.type.syncfs)return a(null);e.type.syncfs(e,r,a)}))},mount(r,e,t){var n,o="/"===t,a=!t;if(o&&jr.root)throw new jr.ErrnoError(10);if(!o&&!a){var i=jr.lookupPath(t,{follow_mount:!1});if(t=i.path,n=i.node,jr.isMountpoint(n))throw new jr.ErrnoError(10);if(!jr.isDir(n.mode))throw new jr.ErrnoError(54)}var s={type:r,opts:e,mountpoint:t,mounts:[]},l=r.mount(s);return l.mount=s,s.root=l,o?jr.root=l:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),l},unmount(r){var e=jr.lookupPath(r,{follow_mount:!1});if(!jr.isMountpoint(e.node))throw new jr.ErrnoError(28);var t=e.node,n=t.mounted,o=jr.getMounts(n);Object.keys(jr.nameTable).forEach((r=>{for(var e=jr.nameTable[r];e;){var t=e.name_next;o.includes(e.mount)&&jr.destroyNode(e),e=t}})),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup:(r,e)=>r.node_ops.lookup(r,e),mknod(r,e,t){var n=jr.lookupPath(r,{parent:!0}).node,o=dr.basename(r);if(!o||"."===o||".."===o)throw new jr.ErrnoError(28);var a=jr.mayCreate(n,o);if(a)throw new jr.ErrnoError(a);if(!n.node_ops.mknod)throw new jr.ErrnoError(63);return n.node_ops.mknod(n,o,e,t)},statfs(r){var e={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:jr.nextInode,ffree:jr.nextInode-1,fsid:42,flags:2,namelen:255},t=jr.lookupPath(r,{follow:!0}).node;return t?.node_ops.statfs&&Object.assign(e,t.node_ops.statfs(t.mount.opts.root)),e},create:(r,e=438)=>(e&=4095,e|=32768,jr.mknod(r,e,0)),mkdir:(r,e=511)=>(e&=1023,e|=16384,jr.mknod(r,e,0)),mkdirTree(r,e){for(var t=r.split("/"),n="",o=0;o<t.length;++o)if(t[o]){n+="/"+t[o];try{jr.mkdir(n,e)}catch(a){if(20!=a.errno)throw a}}},mkdev:(r,e,t)=>(void 0===t&&(t=e,e=438),e|=8192,jr.mknod(r,e,t)),symlink(r,e){if(!hr.resolve(r))throw new jr.ErrnoError(44);var t=jr.lookupPath(e,{parent:!0}).node;if(!t)throw new jr.ErrnoError(44);var n=dr.basename(e),o=jr.mayCreate(t,n);if(o)throw new jr.ErrnoError(o);if(!t.node_ops.symlink)throw new jr.ErrnoError(63);return t.node_ops.symlink(t,n,r)},rename(r,e){var t,n,o=dr.dirname(r),a=dr.dirname(e),i=dr.basename(r),s=dr.basename(e);if(t=jr.lookupPath(r,{parent:!0}).node,n=jr.lookupPath(e,{parent:!0}).node,!t||!n)throw new jr.ErrnoError(44);if(t.mount!==n.mount)throw new jr.ErrnoError(75);var l,u=jr.lookupNode(t,i),d=hr.relative(r,a);if("."!==d.charAt(0))throw new jr.ErrnoError(28);if("."!==(d=hr.relative(e,o)).charAt(0))throw new jr.ErrnoError(55);try{l=jr.lookupNode(n,s)}catch(h){}if(u!==l){var c=jr.isDir(u.mode),f=jr.mayDelete(t,i,c);if(f)throw new jr.ErrnoError(f);if(f=l?jr.mayDelete(n,s,c):jr.mayCreate(n,s))throw new jr.ErrnoError(f);if(!t.node_ops.rename)throw new jr.ErrnoError(63);if(jr.isMountpoint(u)||l&&jr.isMountpoint(l))throw new jr.ErrnoError(10);if(n!==t&&(f=jr.nodePermissions(t,"w")))throw new jr.ErrnoError(f);jr.hashRemoveNode(u);try{t.node_ops.rename(u,n,s),u.parent=n}catch(h){throw h}finally{jr.hashAddNode(u)}}},rmdir(r){var e=jr.lookupPath(r,{parent:!0}).node,t=dr.basename(r),n=jr.lookupNode(e,t),o=jr.mayDelete(e,t,!0);if(o)throw new jr.ErrnoError(o);if(!e.node_ops.rmdir)throw new jr.ErrnoError(63);if(jr.isMountpoint(n))throw new jr.ErrnoError(10);e.node_ops.rmdir(e,t),jr.destroyNode(n)},readdir(r){var e=jr.lookupPath(r,{follow:!0}).node;if(!e.node_ops.readdir)throw new jr.ErrnoError(54);return e.node_ops.readdir(e)},unlink(r){var e=jr.lookupPath(r,{parent:!0}).node;if(!e)throw new jr.ErrnoError(44);var t=dr.basename(r),n=jr.lookupNode(e,t),o=jr.mayDelete(e,t,!1);if(o)throw new jr.ErrnoError(o);if(!e.node_ops.unlink)throw new jr.ErrnoError(63);if(jr.isMountpoint(n))throw new jr.ErrnoError(10);e.node_ops.unlink(e,t),jr.destroyNode(n)},readlink(r){var e=jr.lookupPath(r).node;if(!e)throw new jr.ErrnoError(44);if(!e.node_ops.readlink)throw new jr.ErrnoError(28);return e.node_ops.readlink(e)},stat(r,e){var t=jr.lookupPath(r,{follow:!e}).node;if(!t)throw new jr.ErrnoError(44);if(!t.node_ops.getattr)throw new jr.ErrnoError(63);return t.node_ops.getattr(t)},lstat:r=>jr.stat(r,!0),chmod(r,e,t){var n;if(!(n="string"==typeof r?jr.lookupPath(r,{follow:!t}).node:r).node_ops.setattr)throw new jr.ErrnoError(63);n.node_ops.setattr(n,{mode:4095&e|-4096&n.mode,timestamp:Date.now()})},lchmod(r,e){jr.chmod(r,e,!0)},fchmod(r,e){var t=jr.getStreamChecked(r);jr.chmod(t.node,e)},chown(r,e,t,n){var o;if(!(o="string"==typeof r?jr.lookupPath(r,{follow:!n}).node:r).node_ops.setattr)throw new jr.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(r,e,t){jr.chown(r,e,t,!0)},fchown(r,e,t){var n=jr.getStreamChecked(r);jr.chown(n.node,e,t)},truncate(r,e){if(e<0)throw new jr.ErrnoError(28);var t;if(!(t="string"==typeof r?jr.lookupPath(r,{follow:!0}).node:r).node_ops.setattr)throw new jr.ErrnoError(63);if(jr.isDir(t.mode))throw new jr.ErrnoError(31);if(!jr.isFile(t.mode))throw new jr.ErrnoError(28);var n=jr.nodePermissions(t,"w");if(n)throw new jr.ErrnoError(n);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=jr.getStreamChecked(r);if(!(2097155&t.flags))throw new jr.ErrnoError(28);jr.truncate(t.node,e)},utime(r,e,t){var n=jr.lookupPath(r,{follow:!0}).node;n.node_ops.setattr(n,{timestamp:Math.max(e,t)})},open(r,e,t=438){if(""===r)throw new jr.ErrnoError(44);var n;if(t=64&(e="string"==typeof e?Cr(e):e)?4095&t|32768:0,"object"==typeof r)n=r;else{r=dr.normalize(r);try{n=jr.lookupPath(r,{follow:!(131072&e)}).node}catch(l){}}var o=!1;if(64&e)if(n){if(128&e)throw new jr.ErrnoError(20)}else n=jr.mknod(r,t,0),o=!0;if(!n)throw new jr.ErrnoError(44);if(jr.isChrdev(n.mode)&&(e&=-513),65536&e&&!jr.isDir(n.mode))throw new jr.ErrnoError(54);if(!o){var a=jr.mayOpen(n,e);if(a)throw new jr.ErrnoError(a)}512&e&&!o&&jr.truncate(n,0),e&=-131713;var i=jr.createStream({node:n,path:jr.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),!s.logReadFiles||1&e||r in jr.readFiles||(jr.readFiles[r]=1),i},close(r){if(jr.isClosed(r))throw new jr.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{jr.closeStream(r.fd)}r.fd=null},isClosed:r=>null===r.fd,llseek(r,e,t){if(jr.isClosed(r))throw new jr.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new jr.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new jr.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,n,o){if(n<0||o<0)throw new jr.ErrnoError(28);if(jr.isClosed(r))throw new jr.ErrnoError(8);if(1==(2097155&r.flags))throw new jr.ErrnoError(8);if(jr.isDir(r.node.mode))throw new jr.ErrnoError(31);if(!r.stream_ops.read)throw new jr.ErrnoError(28);var a=void 0!==o;if(a){if(!r.seekable)throw new jr.ErrnoError(70)}else o=r.position;var i=r.stream_ops.read(r,e,t,n,o);return a||(r.position+=i),i},write(r,e,t,n,o,a){if(n<0||o<0)throw new jr.ErrnoError(28);if(jr.isClosed(r))throw new jr.ErrnoError(8);if(!(2097155&r.flags))throw new jr.ErrnoError(8);if(jr.isDir(r.node.mode))throw new jr.ErrnoError(31);if(!r.stream_ops.write)throw new jr.ErrnoError(28);r.seekable&&1024&r.flags&&jr.llseek(r,0,2);var i=void 0!==o;if(i){if(!r.seekable)throw new jr.ErrnoError(70)}else o=r.position;var s=r.stream_ops.write(r,e,t,n,o,a);return i||(r.position+=s),s},allocate(r,e,t){if(jr.isClosed(r))throw new jr.ErrnoError(8);if(e<0||t<=0)throw new jr.ErrnoError(28);if(!(2097155&r.flags))throw new jr.ErrnoError(8);if(!jr.isFile(r.node.mode)&&!jr.isDir(r.node.mode))throw new jr.ErrnoError(43);if(!r.stream_ops.allocate)throw new jr.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,n,o){if(2&n&&!(2&o)&&2!=(2097155&r.flags))throw new jr.ErrnoError(2);if(1==(2097155&r.flags))throw new jr.ErrnoError(2);if(!r.stream_ops.mmap)throw new jr.ErrnoError(43);if(!e)throw new jr.ErrnoError(28);return r.stream_ops.mmap(r,e,t,n,o)},msync:(r,e,t,n,o)=>r.stream_ops.msync?r.stream_ops.msync(r,e,t,n,o):0,ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new jr.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,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 t,n=jr.open(r,e.flags),o=jr.stat(r).size,a=new Uint8Array(o);return jr.read(n,a,0,o,0),"utf8"===e.encoding?t=pr(a):"binary"===e.encoding&&(t=a),jr.close(n),t},writeFile(r,e,t={}){t.flags=t.flags||577;var n=jr.open(r,t.flags,t.mode);if("string"==typeof e){var o=new Uint8Array(wr(e)+1),a=yr(e,o,0,o.length);jr.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(e))throw new Error("Unsupported data type");jr.write(n,e,0,e.byteLength,void 0,t.canOwn)}jr.close(n)},cwd:()=>jr.currentPath,chdir(r){var e=jr.lookupPath(r,{follow:!0});if(null===e.node)throw new jr.ErrnoError(44);if(!jr.isDir(e.node.mode))throw new jr.ErrnoError(54);var t=jr.nodePermissions(e.node,"x");if(t)throw new jr.ErrnoError(t);jr.currentPath=e.path},createDefaultDirectories(){jr.mkdir("/tmp"),jr.mkdir("/home"),jr.mkdir("/home/web_user")},createDefaultDevices(){jr.mkdir("/dev"),jr.registerDevice(jr.makedev(1,3),{read:()=>0,write:(r,e,t,n,o)=>n,llseek:()=>0}),jr.mkdev("/dev/null",jr.makedev(1,3)),_r.register(jr.makedev(5,0),_r.default_tty_ops),_r.register(jr.makedev(6,0),_r.default_tty1_ops),jr.mkdev("/dev/tty",jr.makedev(5,0)),jr.mkdev("/dev/tty1",jr.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(0===e&&(e=fr(r).byteLength),r[--e]);jr.createDevice("/dev","random",t),jr.createDevice("/dev","urandom",t),jr.mkdir("/dev/shm"),jr.mkdir("/dev/shm/tmp")},createSpecialDirectories(){jr.mkdir("/proc");var r=jr.mkdir("/proc/self");jr.mkdir("/proc/self/fd"),jr.mount({mount(){var e=jr.createNode(r,"fd",16895,73);return e.node_ops={lookup(r,e){var t=+e,n=jr.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path}};return o.parent=o,o}},e}},{},"/proc/self/fd")},createStandardStreams(r,e,t){r?jr.createDevice("/dev","stdin",r):jr.symlink("/dev/tty","/dev/stdin"),e?jr.createDevice("/dev","stdout",null,e):jr.symlink("/dev/tty","/dev/stdout"),t?jr.createDevice("/dev","stderr",null,t):jr.symlink("/dev/tty1","/dev/stderr"),jr.open("/dev/stdin",0),jr.open("/dev/stdout",1),jr.open("/dev/stderr",1)},staticInit(){jr.nameTable=new Array(4096),jr.mount(Fr,{},"/"),jr.createDefaultDirectories(),jr.createDefaultDevices(),jr.createSpecialDirectories(),jr.filesystems={MEMFS:Fr}},init(r,e,t){jr.initialized=!0,r??=s.stdin,e??=s.stdout,t??=s.stderr,jr.createStandardStreams(r,e,t)},quit(){jr.initialized=!1;for(var r=0;r<jr.streams.length;r++){var e=jr.streams[r];e&&jr.close(e)}},findObject(r,e){var t=jr.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{r=(n=jr.lookupPath(r,{follow:!e})).path}catch(o){}var t={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=jr.lookupPath(r,{parent:!0});t.parentExists=!0,t.parentPath=n.path,t.parentObject=n.node,t.name=dr.basename(r),n=jr.lookupPath(r,{follow:!e}),t.exists=!0,t.path=n.path,t.object=n.node,t.name=n.node.name,t.isRoot="/"===n.path}catch(o){t.error=o.errno}return t},createPath(r,e,t,n){r="string"==typeof r?r:jr.getPath(r);for(var o=e.split("/").reverse();o.length;){var a=o.pop();if(a){var i=dr.join2(r,a);try{jr.mkdir(i)}catch(s){}r=i}}return i},createFile(r,e,t,n,o){var a=dr.join2("string"==typeof r?r:jr.getPath(r),e),i=Tr(n,o);return jr.create(a,i)},createDataFile(r,e,t,n,o,a){var i=e;r&&(r="string"==typeof r?r:jr.getPath(r),i=e?dr.join2(r,e):r);var s=Tr(n,o),l=jr.create(i,s);if(t){if("string"==typeof t){for(var u=new Array(t.length),d=0,c=t.length;d<c;++d)u[d]=t.charCodeAt(d);t=u}jr.chmod(l,146|s);var f=jr.open(l,577);jr.write(f,t,0,t.length,0,a),jr.close(f),jr.chmod(l,s)}},createDevice(r,e,t,n){var o=dr.join2("string"==typeof r?r:jr.getPath(r),e),a=Tr(!!t,!!n);jr.createDevice.major??=64;var i=jr.makedev(jr.createDevice.major++,0);return jr.registerDevice(i,{open(r){r.seekable=!1},close(r){n?.buffer?.length&&n(10)},read(r,e,n,o,a){for(var i=0,s=0;s<o;s++){var l;try{l=t()}catch(u){throw new jr.ErrnoError(29)}if(void 0===l&&0===i)throw new jr.ErrnoError(6);if(null==l)break;i++,e[n+s]=l}return i&&(r.node.timestamp=Date.now()),i},write(r,e,t,o,a){for(var i=0;i<o;i++)try{n(e[t+i])}catch(s){throw new jr.ErrnoError(29)}return o&&(r.node.timestamp=Date.now()),i}}),jr.mkdev(o,a,i)},forceLoadFile(r){if(r.isDevice||r.isFolder||r.link||r.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.");try{r.contents=i(r.url),r.usedBytes=r.contents.length}catch(e){throw new jr.ErrnoError(29)}},createLazyFile(r,e,t,n,o){if("undefined"!=typeof XMLHttpRequest)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a={isDevice:!1,url:t},i=jr.createFile(r,e,a,n,o);a.contents?i.contents=a.contents:a.url&&(i.contents=null,i.url=a.url),Object.defineProperties(i,{usedBytes:{get:function(){return this.contents.length}}});var s={};function l(r,e,t,n,o){var a=r.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[t+s]=a[o+s];else for(s=0;s<i;s++)e[t+s]=a.get(o+s);return i}return Object.keys(i.stream_ops).forEach((r=>{var e=i.stream_ops[r];s[r]=(...r)=>(jr.forceLoadFile(i),e(...r))})),s.read=(r,e,t,n,o)=>(jr.forceLoadFile(i),l(r,e,t,n,o)),s.mmap=(r,e,t,n,o)=>{jr.forceLoadFile(i);var a=kr();if(!a)throw new jr.ErrnoError(48);return l(r,w,a,e,t),{ptr:a,allocated:!0}},i.stream_ops=s,i}},Mr=(r,e)=>r?pr(y,r,e):"",xr={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(dr.isAbs(e))return e;var n;if(n=-100===r?jr.cwd():xr.getStreamFromFD(r).path,0==e.length){if(!t)throw new jr.ErrnoError(44);return n}return dr.join2(n,e)},doStat(r,e,t){var n=r(e);_[t>>2]=n.dev,_[t+4>>2]=n.mode,b[t+8>>2]=n.nlink,_[t+12>>2]=n.uid,_[t+16>>2]=n.gid,_[t+20>>2]=n.rdev,V=[n.size>>>0,(H=n.size,+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],_[t+24>>2]=V[0],_[t+28>>2]=V[1],_[t+32>>2]=4096,_[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),i=n.ctime.getTime();return V=[Math.floor(o/1e3)>>>0,(H=Math.floor(o/1e3),+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],_[t+40>>2]=V[0],_[t+44>>2]=V[1],b[t+48>>2]=o%1e3*1e3*1e3,V=[Math.floor(a/1e3)>>>0,(H=Math.floor(a/1e3),+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],_[t+56>>2]=V[0],_[t+60>>2]=V[1],b[t+64>>2]=a%1e3*1e3*1e3,V=[Math.floor(i/1e3)>>>0,(H=Math.floor(i/1e3),+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],_[t+72>>2]=V[0],_[t+76>>2]=V[1],b[t+80>>2]=i%1e3*1e3*1e3,V=[n.ino>>>0,(H=n.ino,+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],_[t+88>>2]=V[0],_[t+92>>2]=V[1],0},doMsync(r,e,t,n,o){if(!jr.isFile(e.node.mode))throw new jr.ErrnoError(43);if(2&n)return 0;var a=y.slice(r,r+t);jr.msync(e,a,o,t,n)},getStreamFromFD:r=>jr.getStreamChecked(r),varargs:void 0,getStr:r=>Mr(r)};function Rr(r,e,t){xr.varargs=t;try{var n=xr.getStreamFromFD(r);switch(e){case 0:if((o=lr())<0)return-28;for(;jr.streams[o];)o++;return jr.dupStream(n,o).fd;case 1:case 2:case 13:case 14:return 0;case 3:return n.flags;case 4:var o=lr();return n.flags|=o,0;case 12:return o=ur(),g[o+0>>1]=2,0}return-28}catch(a){if(void 0===jr||"ErrnoError"!==a.name)throw a;return-a.errno}}function Nr(r,e,t){xr.varargs=t;try{var n=xr.getStreamFromFD(r);switch(e){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return n.tty?0:-59;case 21505:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcgets){var o=n.tty.ops.ioctl_tcgets(n),a=ur();_[a>>2]=o.c_iflag||0,_[a+4>>2]=o.c_oflag||0,_[a+8>>2]=o.c_cflag||0,_[a+12>>2]=o.c_lflag||0;for(var i=0;i<32;i++)w[a+i+17]=o.c_cc[i]||0;return 0}return 0;case 21506:case 21507:case 21508:if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){a=ur();var s=_[a>>2],l=_[a+4>>2],u=_[a+8>>2],d=_[a+12>>2],c=[];for(i=0;i<32;i++)c.push(w[a+i+17]);return n.tty.ops.ioctl_tcsets(n.tty,e,{c_iflag:s,c_oflag:l,c_cflag:u,c_lflag:d,c_cc:c})}return 0;case 21519:return n.tty?(a=ur(),_[a>>2]=0,0):-59;case 21520:return n.tty?-28:-59;case 21531:return a=ur(),jr.ioctl(n,e,a);case 21523:if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var f=n.tty.ops.ioctl_tiocgwinsz(n.tty);a=ur(),g[a>>1]=f[0],g[a+2>>1]=f[1]}return 0;default:return-28}}catch(h){if(void 0===jr||"ErrnoError"!==h.name)throw h;return-h.errno}}function zr(r,e,t,n){xr.varargs=n;try{e=xr.getStr(e),e=xr.calculateAt(r,e);var o=n?lr():0;return jr.open(e,t,o).fd}catch(a){if(void 0===jr||"ErrnoError"!==a.name)throw a;return-a.errno}}var Wr=()=>L(""),Or={},Ur=r=>{for(;r.length;){var e=r.pop();r.pop()(e)}};function Br(r){return this.fromWireType(b[r>>2])}var Lr,Ir,Hr,Vr={},qr={},Xr={},Gr=r=>{throw new Lr(r)},Kr=(r,e,t)=>{function n(e){var n=t(e);n.length!==r.length&&Gr("Mismatched type converter count");for(var o=0;o<r.length;++o)te(r[o],n[o])}r.forEach((r=>Xr[r]=e));var o=new Array(e.length),a=[],i=0;e.forEach(((r,e)=>{qr.hasOwnProperty(r)?o[e]=qr[r]:(a.push(r),Vr.hasOwnProperty(r)||(Vr[r]=[]),Vr[r].push((()=>{o[e]=qr[r],++i===a.length&&n(o)})))})),0===a.length&&n(o)},Yr=r=>{var e=Or[r];delete Or[r];var t=e.rawConstructor,n=e.rawDestructor,o=e.fields,a=o.map((r=>r.getterReturnType)).concat(o.map((r=>r.setterArgumentType)));Kr([r],a,(r=>{var a={};return o.forEach(((e,t)=>{var n=e.fieldName,i=r[t],s=e.getter,l=e.getterContext,u=r[t+o.length],d=e.setter,c=e.setterContext;a[n]={read:r=>i.fromWireType(s(l,r)),write:(r,e)=>{var t=[];d(c,r,u.toWireType(t,e)),Ur(t)}}})),[{name:e.name,fromWireType:r=>{var e={};for(var t in a)e[t]=a[t].read(r);return n(r),e},toWireType:(r,e)=>{for(var o in a)if(!(o in e))throw new TypeError(`Missing field: "${o}"`);var i=t();for(o in a)a[o].write(i,e[o]);return null!==r&&r.push(n,i),i},argPackAdvance:ne,readValueFromPointer:Br,destructorFunction:n}]}))},Jr=(r,e,t,n,o)=>{},Qr=()=>{for(var r=new Array(256),e=0;e<256;++e)r[e]=String.fromCharCode(e);Ir=r},Zr=r=>{for(var e="",t=r;y[t];)e+=Ir[y[t++]];return e},re=r=>{throw new Hr(r)};function ee(r,e,t={}){var n=e.name;if(r||re(`type "${n}" must have a positive integer typeid pointer`),qr.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;re(`Cannot register type '${n}' twice`)}if(qr[r]=e,delete Xr[r],Vr.hasOwnProperty(r)){var o=Vr[r];delete Vr[r],o.forEach((r=>r()))}}function te(r,e,t={}){return ee(r,e,t)}var ne=8,oe=(r,e,t,n)=>{te(r,{name:e=Zr(e),fromWireType:function(r){return!!r},toWireType:function(r,e){return e?t:n},argPackAdvance:ne,readValueFromPointer:function(r){return this.fromWireType(y[r])},destructorFunction:null})},ae=[],ie=[],se=r=>{r>9&&0==--ie[r+1]&&(ie[r]=void 0,ae.push(r))},le=()=>ie.length/2-5-ae.length,ue=()=>{ie.push(0,1,void 0,1,null,1,!0,1,!1,1),s.count_emval_handles=le},de={toValue:r=>(r||re("Cannot use deleted val. handle = "+r),ie[r]),toHandle:r=>{switch(r){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const e=ae.pop()||ie.length;return ie[e]=r,ie[e+1]=1,e}}}},ce={name:"emscripten::val",fromWireType:r=>{var e=de.toValue(r);return se(r),e},toWireType:(r,e)=>de.toHandle(e),argPackAdvance:ne,readValueFromPointer:Br,destructorFunction:null},fe=r=>te(r,ce),he=(r,e)=>{switch(e){case 4:return function(r){return this.fromWireType(k[r>>2])};case 8:return function(r){return this.fromWireType(F[r>>3])};default:throw new TypeError(`invalid float width (${e}): ${r}`)}},me=(r,e,t)=>{te(r,{name:e=Zr(e),fromWireType:r=>r,toWireType:(r,e)=>e,argPackAdvance:ne,readValueFromPointer:he(e,t),destructorFunction:null})},pe=(r,e)=>Object.defineProperty(e,"name",{value:r});function ve(r){for(var e=1;e<r.length;++e)if(null!==r[e]&&void 0===r[e].destructorFunction)return!0;return!1}function we(r,e,t,n,o,a){var i=e.length;i<2&&re("argTypes array size mismatch! Must at least get return value and 'this' types!"),e[1];var s=ve(e),l="void"!==e[0].name,u=i-2,d=new Array(u),c=[],f=[];return pe(r,(function(...r){var t;f.length=0,c.length=1,c[0]=o;for(var a=0;a<u;++a)d[a]=e[a+2].toWireType(f,r[a]),c.push(d[a]);function i(r){if(s)Ur(f);else for(var n=2;n<e.length;n++){var o=1===n?t:d[n-2];null!==e[n].destructorFunction&&e[n].destructorFunction(o)}if(l)return e[0].fromWireType(r)}return i(n(...c))}))}var ye,ge,Ee=(r,e,t)=>{if(void 0===r[e].overloadTable){var n=r[e];r[e]=function(...n){return r[e].overloadTable.hasOwnProperty(n.length)||re(`Function '${t}' called with an invalid number of arguments (${n.length}) - expects one of (${r[e].overloadTable})!`),r[e].overloadTable[n.length].apply(this,n)},r[e].overloadTable=[],r[e].overloadTable[n.argCount]=n}},_e=(r,e,t)=>{s.hasOwnProperty(r)?((void 0===t||void 0!==s[r].overloadTable&&void 0!==s[r].overloadTable[t])&&re(`Cannot register public name '${r}' twice`),Ee(s,r,r),s[r].overloadTable.hasOwnProperty(t)&&re(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),s[r].overloadTable[t]=e):(s[r]=e,s[r].argCount=t)},be=(r,e)=>{for(var t=[],n=0;n<r;n++)t.push(b[e+4*n>>2]);return t},ke=(r,e,t)=>{s.hasOwnProperty(r)||Gr("Replacing nonexistent public symbol"),void 0!==s[r].overloadTable&&void 0!==t?s[r].overloadTable[t]=e:(s[r]=e,s[r].argCount=t)},Fe=(r,e,t)=>(r=r.replace(/p/g,"i"),(0,s["dynCall_"+r])(e,...t)),Pe=[],Ae=r=>{var e=Pe[r];return e||(r>=Pe.length&&(Pe.length=r+1),Pe[r]=e=ye.get(r)),e},Se=(r,e,t=[])=>r.includes("j")?Fe(r,e,t):Ae(e)(...t),De=(r,e)=>(...t)=>Se(r,e,t),$e=(r,e)=>{function t(){return r.includes("j")?De(r,e):Ae(e)}r=Zr(r);var n=t();return"function"!=typeof n&&re(`unknown function pointer with signature ${r}: ${e}`),n},Ce=(r,e)=>{var t=pe(e,(function(r){this.name=e,this.message=r;var t=new Error(r).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))}));return t.prototype=Object.create(r.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},t},Te=r=>{var e=an(r),t=Zr(e);return ln(e),t},je=(r,e)=>{var t=[],n={};function o(r){n[r]||qr[r]||(Xr[r]?Xr[r].forEach(o):(t.push(r),n[r]=!0))}throw e.forEach(o),new ge(`${r}: `+t.map(Te).join([", "]))},Me=r=>{const e=(r=r.trim()).indexOf("(");return-1!==e?r.substr(0,e):r},xe=(r,e,t,n,o,a,i,s)=>{var l=be(e,t);r=Zr(r),r=Me(r),o=$e(n,o),_e(r,(function(){je(`Cannot call ${r} due to unbound types`,l)}),e-1),Kr([],l,(t=>{var n=[t[0],null].concat(t.slice(1));return ke(r,we(r,n,null,o,a),e-1),[]}))},Re=(r,e,t)=>{switch(e){case 1:return t?r=>w[r]:r=>y[r];case 2:return t?r=>g[r>>1]:r=>E[r>>1];case 4:return t?r=>_[r>>2]:r=>b[r>>2];default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},Ne=(r,e,t,n,o)=>{e=Zr(e);var a=r=>r;if(0===n){var i=32-8*t;a=r=>r<<i>>>i}var s=e.includes("unsigned"),l=(r,e)=>{};te(r,{name:e,fromWireType:a,toWireType:s?function(r,e){return l(e,this.name),e>>>0}:function(r,e){return l(e,this.name),e},argPackAdvance:ne,readValueFromPointer:Re(e,t,0!==n),destructorFunction:null})},ze=(r,e,t)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];function o(r){var e=b[r>>2],t=b[r+4>>2];return new n(w.buffer,t,e)}te(r,{name:t=Zr(t),fromWireType:o,argPackAdvance:ne,readValueFromPointer:o},{ignoreDuplicateRegistrations:!0})},We=(r,e,t)=>yr(r,y,e,t),Oe=(r,e)=>{var t="std::string"===(e=Zr(e));te(r,{name:e,fromWireType(r){var e,n=b[r>>2],o=r+4;if(t)for(var a=o,i=0;i<=n;++i){var s=o+i;if(i==n||0==y[s]){var l=Mr(a,s-a);void 0===e?e=l:(e+=String.fromCharCode(0),e+=l),a=s+1}}else{var u=new Array(n);for(i=0;i<n;++i)u[i]=String.fromCharCode(y[o+i]);e=u.join("")}return ln(r),e},toWireType(r,e){var n;e instanceof ArrayBuffer&&(e=new Uint8Array(e));var o="string"==typeof e;o||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||re("Cannot pass non-string to std::string"),n=t&&o?wr(e):e.length;var a=sn(4+n+1),i=a+4;if(b[a>>2]=n,t&&o)We(e,i,n+1);else if(o)for(var s=0;s<n;++s){var l=e.charCodeAt(s);l>255&&(ln(i),re("String has UTF-16 code units that do not fit in 8 bits")),y[i+s]=l}else for(s=0;s<n;++s)y[i+s]=e[s];return null!==r&&r.push(ln,a),a},argPackAdvance:ne,readValueFromPointer:Br,destructorFunction(r){ln(r)}})},Ue="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Be=(r,e)=>{for(var t=r,n=t>>1,o=n+e/2;!(n>=o)&&E[n];)++n;if((t=n<<1)-r>32&&Ue)return Ue.decode(y.subarray(r,t));for(var a="",i=0;!(i>=e/2);++i){var s=g[r+2*i>>1];if(0==s)break;a+=String.fromCharCode(s)}return a},Le=(r,e,t)=>{if(t??=2147483647,t<2)return 0;for(var n=e,o=(t-=2)<2*r.length?t/2:r.length,a=0;a<o;++a){var i=r.charCodeAt(a);g[e>>1]=i,e+=2}return g[e>>1]=0,e-n},Ie=r=>2*r.length,He=(r,e)=>{for(var t=0,n="";!(t>=e/4);){var o=_[r+4*t>>2];if(0==o)break;if(++t,o>=65536){var a=o-65536;n+=String.fromCharCode(55296|a>>10,56320|1023&a)}else n+=String.fromCharCode(o)}return n},Ve=(r,e,t)=>{if(t??=2147483647,t<4)return 0;for(var n=e,o=n+t-4,a=0;a<r.length;++a){var i=r.charCodeAt(a);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&r.charCodeAt(++a)),_[e>>2]=i,(e+=4)+4>o)break}return _[e>>2]=0,e-n},qe=r=>{for(var e=0,t=0;t<r.length;++t){var n=r.charCodeAt(t);n>=55296&&n<=57343&&++t,e+=4}return e},Xe=(r,e,t)=>{var n,o,a,i;t=Zr(t),2===e?(n=Be,o=Le,i=Ie,a=r=>E[r>>1]):4===e&&(n=He,o=Ve,i=qe,a=r=>b[r>>2]),te(r,{name:t,fromWireType:r=>{for(var t,o=b[r>>2],i=r+4,s=0;s<=o;++s){var l=r+4+s*e;if(s==o||0==a(l)){var u=n(i,l-i);void 0===t?t=u:(t+=String.fromCharCode(0),t+=u),i=l+e}}return ln(r),t},toWireType:(r,n)=>{"string"!=typeof n&&re(`Cannot pass non-string to C++ string type ${t}`);var a=i(n),s=sn(4+a+e);return b[s>>2]=a/e,o(n,s+4,a+e),null!==r&&r.push(ln,s),s},argPackAdvance:ne,readValueFromPointer:Br,destructorFunction(r){ln(r)}})},Ge=(r,e,t,n,o,a)=>{Or[r]={name:Zr(e),rawConstructor:$e(t,n),rawDestructor:$e(o,a),fields:[]}},Ke=(r,e,t,n,o,a,i,s,l,u)=>{Or[r].fields.push({fieldName:Zr(e),getterReturnType:t,getter:$e(n,o),getterContext:a,setterArgumentType:i,setter:$e(s,l),setterContext:u})},Ye=(r,e)=>{te(r,{isVoid:!0,name:e=Zr(e),argPackAdvance:0,fromWireType:()=>{},toWireType:(r,e)=>{}})},Je=r=>{do{var e=b[r>>2],t=b[(r+=4)>>2],n=b[(r+=4)>>2];r+=4;var o=Mr(e);jr.createPath("/",dr.dirname(o),!0,!0),jr.createDataFile(o,null,w.subarray(n,n+t),!0,!0,!0)}while(b[r>>2])},Qe=(r,e,t)=>y.copyWithin(r,e,e+t),Ze=()=>{throw 1/0},rt=(r,e)=>{var t=qr[r];return void 0===t&&re(`${e} has unknown type ${Te(r)}`),t},et=(r,e,t)=>{var n=[],o=r.toWireType(n,t);return n.length&&(b[e>>2]=de.toHandle(n)),o},tt=(r,e,t)=>(r=de.toValue(r),e=rt(e,"emval::as"),et(e,t,r)),nt={},ot=r=>{var e=nt[r];return void 0===e?Zr(r):e},at=[],it=(r,e,t,n,o)=>(r=at[r])(e=de.toValue(e),e[t=ot(t)],n,o),st=()=>{if("object"==typeof globalThis)return globalThis;function e(r){r.$$$embind_global$$$=r;var e="object"==typeof $$$embind_global$$$&&r.$$$embind_global$$$==r;return e||delete r.$$$embind_global$$$,e}if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;if("object"==typeof r&&e(r)?$$$embind_global$$$=r:"object"==typeof self&&e(self)&&($$$embind_global$$$=self),"object"==typeof $$$embind_global$$$)return $$$embind_global$$$;throw Error("unable to get global object.")},lt=r=>0===r?de.toHandle(st()):(r=ot(r),de.toHandle(st()[r])),ut=r=>{var e=at.length;return at.push(r),e},dt=(r,e)=>{for(var t=new Array(r),n=0;n<r;++n)t[n]=rt(b[e+4*n>>2],"parameter "+n);return t},ct=Reflect.construct,ft=(r,e,t)=>{var n=dt(r,e),o=n.shift();r--;var a=new Array(r),i=(e,i,s,l)=>{for(var u=0,d=0;d<r;++d)a[d]=n[d].readValueFromPointer(l+u),u+=n[d].argPackAdvance;var c=1===t?ct(i,a):i.apply(e,a);return et(o,s,c)},s=`methodCaller<(${n.map((r=>r.name)).join(", ")}) => ${o.name}>`;return ut(pe(s,i))},ht=(r,e)=>(r=de.toValue(r),e=de.toValue(e),de.toHandle(r[e])),mt=r=>{r>9&&(ie[r+1]+=1)},pt=()=>de.toHandle([]),vt=r=>de.toHandle(ot(r)),wt=r=>{var e=de.toValue(r);Ur(e),se(r)},yt=(r,e,t)=>{r=de.toValue(r),e=de.toValue(e),t=de.toValue(t),r[e]=t},gt=(r,e)=>{var t=(r=rt(r,"_emval_take_value")).readValueFromPointer(e);return de.toHandle(t)},Et=(r,e,t,n)=>{var o=(new Date).getFullYear(),a=new Date(o,0,1),i=new Date(o,6,1),s=a.getTimezoneOffset(),l=i.getTimezoneOffset(),u=Math.max(s,l);b[r>>2]=60*u,_[e>>2]=Number(s!=l);var d=r=>{var e=r>=0?"-":"+",t=Math.abs(r);return`UTC${e}${String(Math.floor(t/60)).padStart(2,"0")}${String(t%60).padStart(2,"0")}`},c=d(s),f=d(l);l<s?(We(c,t,17),We(f,n,17)):(We(c,n,17),We(f,t,17))},_t=()=>2147483648,bt=r=>{var e=(r-v.buffer.byteLength+65535)/65536|0;try{return v.grow(e),S(),1}catch(t){}},kt=r=>{var e=y.length;r>>>=0;var t=_t();if(r>t)return!1;for(var n=1;n<=4;n*=2){var o=e*(1+.2/n);o=Math.min(o,r+100663296);var a=Math.min(t,br(Math.max(r,o),65536));if(bt(a))return!0}return!1},Ft={},Pt=()=>d||"./this.program",At=()=>{if(!At.strings){var r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:Pt()};for(var e in Ft)void 0===Ft[e]?delete r[e]:r[e]=Ft[e];var t=[];for(var e in r)t.push(`${e}=${r[e]}`);At.strings=t}return At.strings},St=(r,e)=>{for(var t=0;t<r.length;++t)w[e++]=r.charCodeAt(t);w[e]=0},Dt=(r,e)=>{var t=0;return At().forEach(((n,o)=>{var a=e+t;b[r+4*o>>2]=a,St(n,a),t+=n.length+1})),0},$t=(r,e)=>{var t=At();b[r>>2]=t.length;var n=0;return t.forEach((r=>n+=r.length+1)),b[e>>2]=n,0},Ct=0,Tt=()=>nr||Ct>0,jt=r=>{Tt()||(s.onExit?.(r),A=!0),c(r,new er(r))},Mt=(r,e)=>{jt(r)};function xt(r){try{var e=xr.getStreamFromFD(r);return jr.close(e),0}catch(t){if(void 0===jr||"ErrnoError"!==t.name)throw t;return t.errno}}var Rt=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var i=b[e>>2],s=b[e+4>>2];e+=8;var l=jr.read(r,w,i,s,n);if(l<0)return-1;if(o+=l,l<s)break}return o};function Nt(r,e,t,n){try{var o=xr.getStreamFromFD(r),a=Rt(o,e,t);return b[n>>2]=a,0}catch(i){if(void 0===jr||"ErrnoError"!==i.name)throw i;return i.errno}}var zt=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+4294967296*e:NaN;function Wt(r,e,t,n,o){var a=zt(e,t);try{if(isNaN(a))return 61;var i=xr.getStreamFromFD(r);return jr.llseek(i,a,n),V=[i.position>>>0,(H=i.position,+Math.abs(H)>=1?H>0?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],_[o>>2]=V[0],_[o+4>>2]=V[1],i.getdents&&0===a&&0===n&&(i.getdents=null),0}catch(s){if(void 0===jr||"ErrnoError"!==s.name)throw s;return s.errno}}var Ot=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var i=b[e>>2],s=b[e+4>>2];e+=8;var l=jr.write(r,w,i,s,n);if(l<0)return-1;if(o+=l,l<s)break}return o};function Ut(r,e,t,n){try{var o=xr.getStreamFromFD(r),a=Ot(o,e,t);return b[n>>2]=a,0}catch(i){if(void 0===jr||"ErrnoError"!==i.name)throw i;return i.errno}}var Bt,Lt=(r,e)=>{r<128?e.push(r):e.push(r%128|128,r>>7)},It=r=>{for(var e={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},t={parameters:[],results:"v"==r[0]?[]:[e[r[0]]]},n=1;n<r.length;++n)t.parameters.push(e[r[n]]);return t},Ht=(r,e)=>{var t=r.slice(0,1),n=r.slice(1),o={i:127,p:127,j:126,f:125,d:124,e:111};e.push(96),Lt(n.length,e);for(var a=0;a<n.length;++a)e.push(o[n[a]]);"v"==t?e.push(0):e.push(1,o[t])},Vt=(r,e)=>{if("function"==typeof WebAssemb