@areb0s/scip.js 1.1.9 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scip-core.js +14 -14
- package/dist/scip-wrapper.js +510 -448
- package/dist/scip.js +401 -327
- package/dist/scip.min.js +10 -10
- package/dist/scip.wasm +0 -0
- package/package.json +1 -1
package/dist/scip.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`)):typeof readline=="function"&&(r=readline(),r!==null&&(r+=`
|
|
3
|
-
`)),!r)return null;Ir=Dr(r,!0)}return Ir.shift()},rr={ttys:[],init(){},shutdown(){},register(r,e){rr.ttys[r]={input:[],output:[],ops:e},n.registerDevice(r,rr.stream_ops)},stream_ops:{open(r){var e=rr.ttys[r.node.rdev];if(!e)throw new n.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,o,a){if(!r.tty||!r.tty.ops.get_char)throw new n.ErrnoError(60);for(var i=0,s=0;s<o;s++){var u;try{u=r.tty.ops.get_char(r.tty)}catch{throw new n.ErrnoError(29)}if(u===void 0&&i===0)throw new n.ErrnoError(6);if(u==null)break;i++,e[t+s]=u}return i&&(r.node.timestamp=Date.now()),i},write(r,e,t,o,a){if(!r.tty||!r.tty.ops.put_char)throw new n.ErrnoError(60);try{for(var i=0;i<o;i++)r.tty.ops.put_char(r.tty,e[t+i])}catch{throw new n.ErrnoError(29)}return o&&(r.node.timestamp=Date.now()),i}},default_tty_ops:{get_char(r){return Ve()},put_char(r,e){e===null||e===10?(vr(lr(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(vr(lr(r.output,0)),r.output=[])},ioctl_tcgets(r){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(r,e,t){return 0},ioctl_tiocgwinsz(r){return[24,80]}},default_tty1_ops:{put_char(r,e){e===null||e===10?(W(lr(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(W(lr(r.output,0)),r.output=[])}}},Ge=(r,e)=>(z.fill(0,r,r+e),r),Ke=(r,e)=>Math.ceil(r/e)*e,ee=r=>{r=Ke(r,65536);var e=ce(65536,r);return e?Ge(e,r):0},p={ops_table:null,mount(r){return p.createNode(null,"/",16895,0)},createNode(r,e,t,o){if(n.isBlkdev(t)||n.isFIFO(t))throw new n.ErrnoError(63);p.ops_table||(p.ops_table={dir:{node:{getattr:p.node_ops.getattr,setattr:p.node_ops.setattr,lookup:p.node_ops.lookup,mknod:p.node_ops.mknod,rename:p.node_ops.rename,unlink:p.node_ops.unlink,rmdir:p.node_ops.rmdir,readdir:p.node_ops.readdir,symlink:p.node_ops.symlink},stream:{llseek:p.stream_ops.llseek}},file:{node:{getattr:p.node_ops.getattr,setattr:p.node_ops.setattr},stream:{llseek:p.stream_ops.llseek,read:p.stream_ops.read,write:p.stream_ops.write,allocate:p.stream_ops.allocate,mmap:p.stream_ops.mmap,msync:p.stream_ops.msync}},link:{node:{getattr:p.node_ops.getattr,setattr:p.node_ops.setattr,readlink:p.node_ops.readlink},stream:{}},chrdev:{node:{getattr:p.node_ops.getattr,setattr:p.node_ops.setattr},stream:n.chrdev_stream_ops}});var a=n.createNode(r,e,t,o);return n.isDir(a.mode)?(a.node_ops=p.ops_table.dir.node,a.stream_ops=p.ops_table.dir.stream,a.contents={}):n.isFile(a.mode)?(a.node_ops=p.ops_table.file.node,a.stream_ops=p.ops_table.file.stream,a.usedBytes=0,a.contents=null):n.isLink(a.mode)?(a.node_ops=p.ops_table.link.node,a.stream_ops=p.ops_table.link.stream):n.isChrdev(a.mode)&&(a.node_ops=p.ops_table.chrdev.node,a.stream_ops=p.ops_table.chrdev.stream),a.timestamp=Date.now(),r&&(r.contents[e]=a,r.timestamp=a.timestamp),a},getFileDataAsTypedArray(r){return 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 o=1024*1024;e=Math.max(e,t*(t<o?2:1.125)>>>0),t!=0&&(e=Math.max(e,256));var a=r.contents;r.contents=new Uint8Array(e),r.usedBytes>0&&r.contents.set(a.subarray(0,r.usedBytes),0)}},resizeFileStorage(r,e){if(r.usedBytes!=e)if(e==0)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=n.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,n.isDir(r.mode)?e.size=4096:n.isFile(r.mode)?e.size=r.usedBytes:n.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){e.mode!==void 0&&(r.mode=e.mode),e.timestamp!==void 0&&(r.timestamp=e.timestamp),e.size!==void 0&&p.resizeFileStorage(r,e.size)},lookup(r,e){throw n.genericErrors[44]},mknod(r,e,t,o){return p.createNode(r,e,t,o)},rename(r,e,t){if(n.isDir(r.mode)){var o;try{o=n.lookupNode(e,t)}catch{}if(o)for(var a in o.contents)throw new n.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,r.parent=e},unlink(r,e){delete r.contents[e],r.timestamp=Date.now()},rmdir(r,e){var t=n.lookupNode(r,e);for(var o in t.contents)throw new n.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 o=p.createNode(r,e,41471,0);return o.link=t,o},readlink(r){if(!n.isLink(r.mode))throw new n.ErrnoError(28);return r.link}},stream_ops:{read(r,e,t,o,a){var i=r.node.contents;if(a>=r.node.usedBytes)return 0;var s=Math.min(r.node.usedBytes-a,o);if(s>8&&i.subarray)e.set(i.subarray(a,a+s),t);else for(var u=0;u<s;u++)e[t+u]=i[a+u];return s},write(r,e,t,o,a,i){if(e.buffer===R.buffer&&(i=!1),!o)return 0;var s=r.node;if(s.timestamp=Date.now(),e.subarray&&(!s.contents||s.contents.subarray)){if(i)return s.contents=e.subarray(t,t+o),s.usedBytes=o,o;if(s.usedBytes===0&&a===0)return s.contents=e.slice(t,t+o),s.usedBytes=o,o;if(a+o<=s.usedBytes)return s.contents.set(e.subarray(t,t+o),a),o}if(p.expandFileStorage(s,a+o),s.contents.subarray&&e.subarray)s.contents.set(e.subarray(t,t+o),a);else for(var u=0;u<o;u++)s.contents[a+u]=e[t+u];return s.usedBytes=Math.max(s.usedBytes,a+o),o},llseek(r,e,t){var o=e;if(t===1?o+=r.position:t===2&&n.isFile(r.node.mode)&&(o+=r.node.usedBytes),o<0)throw new n.ErrnoError(28);return o},allocate(r,e,t){p.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,o,a){if(!n.isFile(r.node.mode))throw new n.ErrnoError(43);var i,s,u=r.node.contents;if(!(a&2)&&u.buffer===R.buffer)s=!1,i=u.byteOffset;else{if((t>0||t+e<u.length)&&(u.subarray?u=u.subarray(t,t+e):u=Array.prototype.slice.call(u,t,t+e)),s=!0,i=ee(e),!i)throw new n.ErrnoError(48);R.set(u,i)}return{ptr:i,allocated:s}},msync(r,e,t,o,a){return p.stream_ops.write(r,e,0,o,t,!1),0}}},Je=(r,e,t,o)=>{var a=o?"":`al ${r}`;ur(r,i=>{e(new Uint8Array(i)),a&&pr(a)},i=>{if(t)t();else throw`Loading data file "${r}" failed.`}),a&&kr(a)},Qe=(r,e,t,o,a,i)=>{n.createDataFile(r,e,t,o,a,i)},Ze=l.preloadPlugins||[],rt=(r,e,t,o)=>{typeof Browser<"u"&&Browser.init();var a=!1;return Ze.forEach(i=>{a||i.canHandle(e)&&(i.handle(r,e,t,o),a=!0)}),a},et=(r,e,t,o,a,i,s,u,c,h)=>{var k=e?J.resolve(D.join2(r,e)):r,S=`cp ${k}`;function m(v){function E(L){h?.(),u||Qe(r,e,L,o,a,c),i?.(),pr(S)}rt(v,k,E,()=>{s?.(),pr(S)})||E(v)}kr(S),typeof t=="string"?Je(t,m,s):m(t)},tt=r=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=e[r];if(typeof t>"u")throw new Error(`Unknown file open mode: ${r}`);return t},Lr=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},n={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(r){this.name="ErrnoError",this.errno=r}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(r){this.node=r}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{constructor(r,e,t,o){r||(r=this),this.parent=r,this.mount=r.mount,this.mounted=null,this.id=n.nextInode++,this.name=e,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=o,this.readMode=365,this.writeMode=146}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 n.isDir(this.mode)}get isDevice(){return n.isChrdev(this.mode)}},lookupPath(r,e={}){if(r=J.resolve(r),!r)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(e=Object.assign(t,e),e.recurse_count>8)throw new n.ErrnoError(32);for(var o=r.split("/").filter(S=>!!S),a=n.root,i="/",s=0;s<o.length;s++){var u=s===o.length-1;if(u&&e.parent)break;if(a=n.lookupNode(a,o[s]),i=D.join2(i,o[s]),n.isMountpoint(a)&&(!u||u&&e.follow_mount)&&(a=a.mounted.root),!u||e.follow)for(var c=0;n.isLink(a.mode);){var h=n.readlink(i);i=J.resolve(D.dirname(i),h);var k=n.lookupPath(i,{recurse_count:e.recurse_count+1});if(a=k.node,c++>40)throw new n.ErrnoError(32)}}return{path:i,node:a}},getPath(r){for(var e;;){if(n.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,o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o)|0;return(r+t>>>0)%n.nameTable.length},hashAddNode(r){var e=n.hashName(r.parent.id,r.name);r.name_next=n.nameTable[e],n.nameTable[e]=r},hashRemoveNode(r){var e=n.hashName(r.parent.id,r.name);if(n.nameTable[e]===r)n.nameTable[e]=r.name_next;else for(var t=n.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=n.mayLookup(r);if(t)throw new n.ErrnoError(t);for(var o=n.hashName(r.id,e),a=n.nameTable[o];a;a=a.name_next){var i=a.name;if(a.parent.id===r.id&&i===e)return a}return n.lookup(r,e)},createNode(r,e,t,o){var a=new n.FSNode(r,e,t,o);return n.hashAddNode(a),a},destroyNode(r){n.hashRemoveNode(r)},isRoot(r){return r===r.parent},isMountpoint(r){return!!r.mounted},isFile(r){return(r&61440)===32768},isDir(r){return(r&61440)===16384},isLink(r){return(r&61440)===40960},isChrdev(r){return(r&61440)===8192},isBlkdev(r){return(r&61440)===24576},isFIFO(r){return(r&61440)===4096},isSocket(r){return(r&49152)===49152},flagsToPermissionString(r){var e=["r","w","rw"][r&3];return r&512&&(e+="w"),e},nodePermissions(r,e){return n.ignorePermissions?0:e.includes("r")&&!(r.mode&292)||e.includes("w")&&!(r.mode&146)||e.includes("x")&&!(r.mode&73)?2:0},mayLookup(r){if(!n.isDir(r.mode))return 54;var e=n.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){try{var t=n.lookupNode(r,e);return 20}catch{}return n.nodePermissions(r,"wx")},mayDelete(r,e,t){var o;try{o=n.lookupNode(r,e)}catch(i){return i.errno}var a=n.nodePermissions(r,"wx");if(a)return a;if(t){if(!n.isDir(o.mode))return 54;if(n.isRoot(o)||n.getPath(o)===n.cwd())return 10}else if(n.isDir(o.mode))return 31;return 0},mayOpen(r,e){return r?n.isLink(r.mode)?32:n.isDir(r.mode)&&(n.flagsToPermissionString(e)!=="r"||e&512)?31:n.nodePermissions(r,n.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=n.MAX_OPEN_FDS;r++)if(!n.streams[r])return r;throw new n.ErrnoError(33)},getStreamChecked(r){var e=n.getStream(r);if(!e)throw new n.ErrnoError(8);return e},getStream:r=>n.streams[r],createStream(r,e=-1){return r=Object.assign(new n.FSStream,r),e==-1&&(e=n.nextfd()),r.fd=e,n.streams[e]=r,r},closeStream(r){n.streams[r]=null},dupStream(r,e=-1){var t=n.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=n.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new n.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,e)=>r<<8|e,registerDevice(r,e){n.devices[r]={stream_ops:e}},getDevice:r=>n.devices[r],getMounts(r){for(var e=[],t=[r];t.length;){var o=t.pop();e.push(o),t.push(...o.mounts)}return e},syncfs(r,e){typeof r=="function"&&(e=r,r=!1),n.syncFSRequests++,n.syncFSRequests>1&&W(`warning: ${n.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=n.getMounts(n.root.mount),o=0;function a(s){return n.syncFSRequests--,e(s)}function i(s){if(s)return i.errored?void 0:(i.errored=!0,a(s));++o>=t.length&&a(null)}t.forEach(s=>{if(!s.type.syncfs)return i(null);s.type.syncfs(s,r,i)})},mount(r,e,t){var o=t==="/",a=!t,i;if(o&&n.root)throw new n.ErrnoError(10);if(!o&&!a){var s=n.lookupPath(t,{follow_mount:!1});if(t=s.path,i=s.node,n.isMountpoint(i))throw new n.ErrnoError(10);if(!n.isDir(i.mode))throw new n.ErrnoError(54)}var u={type:r,opts:e,mountpoint:t,mounts:[]},c=r.mount(u);return c.mount=u,u.root=c,o?n.root=c:i&&(i.mounted=u,i.mount&&i.mount.mounts.push(u)),c},unmount(r){var e=n.lookupPath(r,{follow_mount:!1});if(!n.isMountpoint(e.node))throw new n.ErrnoError(28);var t=e.node,o=t.mounted,a=n.getMounts(o);Object.keys(n.nameTable).forEach(s=>{for(var u=n.nameTable[s];u;){var c=u.name_next;a.includes(u.mount)&&n.destroyNode(u),u=c}}),t.mounted=null;var i=t.mount.mounts.indexOf(o);t.mount.mounts.splice(i,1)},lookup(r,e){return r.node_ops.lookup(r,e)},mknod(r,e,t){var o=n.lookupPath(r,{parent:!0}),a=o.node,i=D.basename(r);if(!i||i==="."||i==="..")throw new n.ErrnoError(28);var s=n.mayCreate(a,i);if(s)throw new n.ErrnoError(s);if(!a.node_ops.mknod)throw new n.ErrnoError(63);return a.node_ops.mknod(a,i,e,t)},create(r,e){return e=e!==void 0?e:438,e&=4095,e|=32768,n.mknod(r,e,0)},mkdir(r,e){return e=e!==void 0?e:511,e&=1023,e|=16384,n.mknod(r,e,0)},mkdirTree(r,e){for(var t=r.split("/"),o="",a=0;a<t.length;++a)if(t[a]){o+="/"+t[a];try{n.mkdir(o,e)}catch(i){if(i.errno!=20)throw i}}},mkdev(r,e,t){return typeof t>"u"&&(t=e,e=438),e|=8192,n.mknod(r,e,t)},symlink(r,e){if(!J.resolve(r))throw new n.ErrnoError(44);var t=n.lookupPath(e,{parent:!0}),o=t.node;if(!o)throw new n.ErrnoError(44);var a=D.basename(e),i=n.mayCreate(o,a);if(i)throw new n.ErrnoError(i);if(!o.node_ops.symlink)throw new n.ErrnoError(63);return o.node_ops.symlink(o,a,r)},rename(r,e){var t=D.dirname(r),o=D.dirname(e),a=D.basename(r),i=D.basename(e),s,u,c;if(s=n.lookupPath(r,{parent:!0}),u=s.node,s=n.lookupPath(e,{parent:!0}),c=s.node,!u||!c)throw new n.ErrnoError(44);if(u.mount!==c.mount)throw new n.ErrnoError(75);var h=n.lookupNode(u,a),k=J.relative(r,o);if(k.charAt(0)!==".")throw new n.ErrnoError(28);if(k=J.relative(e,t),k.charAt(0)!==".")throw new n.ErrnoError(55);var S;try{S=n.lookupNode(c,i)}catch{}if(h!==S){var m=n.isDir(h.mode),v=n.mayDelete(u,a,m);if(v)throw new n.ErrnoError(v);if(v=S?n.mayDelete(c,i,m):n.mayCreate(c,i),v)throw new n.ErrnoError(v);if(!u.node_ops.rename)throw new n.ErrnoError(63);if(n.isMountpoint(h)||S&&n.isMountpoint(S))throw new n.ErrnoError(10);if(c!==u&&(v=n.nodePermissions(u,"w"),v))throw new n.ErrnoError(v);n.hashRemoveNode(h);try{u.node_ops.rename(h,c,i)}catch(E){throw E}finally{n.hashAddNode(h)}}},rmdir(r){var e=n.lookupPath(r,{parent:!0}),t=e.node,o=D.basename(r),a=n.lookupNode(t,o),i=n.mayDelete(t,o,!0);if(i)throw new n.ErrnoError(i);if(!t.node_ops.rmdir)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);t.node_ops.rmdir(t,o),n.destroyNode(a)},readdir(r){var e=n.lookupPath(r,{follow:!0}),t=e.node;if(!t.node_ops.readdir)throw new n.ErrnoError(54);return t.node_ops.readdir(t)},unlink(r){var e=n.lookupPath(r,{parent:!0}),t=e.node;if(!t)throw new n.ErrnoError(44);var o=D.basename(r),a=n.lookupNode(t,o),i=n.mayDelete(t,o,!1);if(i)throw new n.ErrnoError(i);if(!t.node_ops.unlink)throw new n.ErrnoError(63);if(n.isMountpoint(a))throw new n.ErrnoError(10);t.node_ops.unlink(t,o),n.destroyNode(a)},readlink(r){var e=n.lookupPath(r),t=e.node;if(!t)throw new n.ErrnoError(44);if(!t.node_ops.readlink)throw new n.ErrnoError(28);return J.resolve(n.getPath(t.parent),t.node_ops.readlink(t))},stat(r,e){var t=n.lookupPath(r,{follow:!e}),o=t.node;if(!o)throw new n.ErrnoError(44);if(!o.node_ops.getattr)throw new n.ErrnoError(63);return o.node_ops.getattr(o)},lstat(r){return n.stat(r,!0)},chmod(r,e,t){var o;if(typeof r=="string"){var a=n.lookupPath(r,{follow:!t});o=a.node}else o=r;if(!o.node_ops.setattr)throw new n.ErrnoError(63);o.node_ops.setattr(o,{mode:e&4095|o.mode&-4096,timestamp:Date.now()})},lchmod(r,e){n.chmod(r,e,!0)},fchmod(r,e){var t=n.getStreamChecked(r);n.chmod(t.node,e)},chown(r,e,t,o){var a;if(typeof r=="string"){var i=n.lookupPath(r,{follow:!o});a=i.node}else a=r;if(!a.node_ops.setattr)throw new n.ErrnoError(63);a.node_ops.setattr(a,{timestamp:Date.now()})},lchown(r,e,t){n.chown(r,e,t,!0)},fchown(r,e,t){var o=n.getStreamChecked(r);n.chown(o.node,e,t)},truncate(r,e){if(e<0)throw new n.ErrnoError(28);var t;if(typeof r=="string"){var o=n.lookupPath(r,{follow:!0});t=o.node}else t=r;if(!t.node_ops.setattr)throw new n.ErrnoError(63);if(n.isDir(t.mode))throw new n.ErrnoError(31);if(!n.isFile(t.mode))throw new n.ErrnoError(28);var a=n.nodePermissions(t,"w");if(a)throw new n.ErrnoError(a);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=n.getStreamChecked(r);if(!(t.flags&2097155))throw new n.ErrnoError(28);n.truncate(t.node,e)},utime(r,e,t){var o=n.lookupPath(r,{follow:!0}),a=o.node;a.node_ops.setattr(a,{timestamp:Math.max(e,t)})},open(r,e,t){if(r==="")throw new n.ErrnoError(44);e=typeof e=="string"?tt(e):e,t=typeof t>"u"?438:t,e&64?t=t&4095|32768:t=0;var o;if(typeof r=="object")o=r;else{r=D.normalize(r);try{var a=n.lookupPath(r,{follow:!(e&131072)});o=a.node}catch{}}var i=!1;if(e&64)if(o){if(e&128)throw new n.ErrnoError(20)}else o=n.mknod(r,t,0),i=!0;if(!o)throw new n.ErrnoError(44);if(n.isChrdev(o.mode)&&(e&=-513),e&65536&&!n.isDir(o.mode))throw new n.ErrnoError(54);if(!i){var s=n.mayOpen(o,e);if(s)throw new n.ErrnoError(s)}e&512&&!i&&n.truncate(o,0),e&=-131713;var u=n.createStream({node:o,path:n.getPath(o),flags:e,seekable:!0,position:0,stream_ops:o.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),l.logReadFiles&&!(e&1)&&(n.readFiles||(n.readFiles={}),r in n.readFiles||(n.readFiles[r]=1)),u},close(r){if(n.isClosed(r))throw new n.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{n.closeStream(r.fd)}r.fd=null},isClosed(r){return r.fd===null},llseek(r,e,t){if(n.isClosed(r))throw new n.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new n.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new n.ErrnoError(28);return r.position=r.stream_ops.llseek(r,e,t),r.ungotten=[],r.position},read(r,e,t,o,a){if(o<0||a<0)throw new n.ErrnoError(28);if(n.isClosed(r))throw new n.ErrnoError(8);if((r.flags&2097155)===1)throw new n.ErrnoError(8);if(n.isDir(r.node.mode))throw new n.ErrnoError(31);if(!r.stream_ops.read)throw new n.ErrnoError(28);var i=typeof a<"u";if(!i)a=r.position;else if(!r.seekable)throw new n.ErrnoError(70);var s=r.stream_ops.read(r,e,t,o,a);return i||(r.position+=s),s},write(r,e,t,o,a,i){if(o<0||a<0)throw new n.ErrnoError(28);if(n.isClosed(r))throw new n.ErrnoError(8);if(!(r.flags&2097155))throw new n.ErrnoError(8);if(n.isDir(r.node.mode))throw new n.ErrnoError(31);if(!r.stream_ops.write)throw new n.ErrnoError(28);r.seekable&&r.flags&1024&&n.llseek(r,0,2);var s=typeof a<"u";if(!s)a=r.position;else if(!r.seekable)throw new n.ErrnoError(70);var u=r.stream_ops.write(r,e,t,o,a,i);return s||(r.position+=u),u},allocate(r,e,t){if(n.isClosed(r))throw new n.ErrnoError(8);if(e<0||t<=0)throw new n.ErrnoError(28);if(!(r.flags&2097155))throw new n.ErrnoError(8);if(!n.isFile(r.node.mode)&&!n.isDir(r.node.mode))throw new n.ErrnoError(43);if(!r.stream_ops.allocate)throw new n.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,o,a){if(o&2&&!(a&2)&&(r.flags&2097155)!==2)throw new n.ErrnoError(2);if((r.flags&2097155)===1)throw new n.ErrnoError(2);if(!r.stream_ops.mmap)throw new n.ErrnoError(43);return r.stream_ops.mmap(r,e,t,o,a)},msync(r,e,t,o,a){return r.stream_ops.msync?r.stream_ops.msync(r,e,t,o,a):0},ioctl(r,e,t){if(!r.stream_ops.ioctl)throw new n.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary",e.encoding!=="utf8"&&e.encoding!=="binary")throw new Error(`Invalid encoding type "${e.encoding}"`);var t,o=n.open(r,e.flags),a=n.stat(r),i=a.size,s=new Uint8Array(i);return n.read(o,s,0,i,0),e.encoding==="utf8"?t=lr(s,0):e.encoding==="binary"&&(t=s),n.close(o),t},writeFile(r,e,t={}){t.flags=t.flags||577;var o=n.open(r,t.flags,t.mode);if(typeof e=="string"){var a=new Uint8Array(Fr(e)+1),i=zr(e,a,0,a.length);n.write(o,a,0,i,void 0,t.canOwn)}else if(ArrayBuffer.isView(e))n.write(o,e,0,e.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");n.close(o)},cwd:()=>n.currentPath,chdir(r){var e=n.lookupPath(r,{follow:!0});if(e.node===null)throw new n.ErrnoError(44);if(!n.isDir(e.node.mode))throw new n.ErrnoError(54);var t=n.nodePermissions(e.node,"x");if(t)throw new n.ErrnoError(t);n.currentPath=e.path},createDefaultDirectories(){n.mkdir("/tmp"),n.mkdir("/home"),n.mkdir("/home/web_user")},createDefaultDevices(){n.mkdir("/dev"),n.registerDevice(n.makedev(1,3),{read:()=>0,write:(o,a,i,s,u)=>s}),n.mkdev("/dev/null",n.makedev(1,3)),rr.register(n.makedev(5,0),rr.default_tty_ops),rr.register(n.makedev(6,0),rr.default_tty1_ops),n.mkdev("/dev/tty",n.makedev(5,0)),n.mkdev("/dev/tty1",n.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(e===0&&(e=Zr(r).byteLength),r[--e]);n.createDevice("/dev","random",t),n.createDevice("/dev","urandom",t),n.mkdir("/dev/shm"),n.mkdir("/dev/shm/tmp")},createSpecialDirectories(){n.mkdir("/proc");var r=n.mkdir("/proc/self");n.mkdir("/proc/self/fd"),n.mount({mount(){var e=n.createNode(r,"fd",16895,73);return e.node_ops={lookup(t,o){var a=+o,i=n.getStreamChecked(a),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return s.parent=s,s}},e}},{},"/proc/self/fd")},createStandardStreams(){l.stdin?n.createDevice("/dev","stdin",l.stdin):n.symlink("/dev/tty","/dev/stdin"),l.stdout?n.createDevice("/dev","stdout",null,l.stdout):n.symlink("/dev/tty","/dev/stdout"),l.stderr?n.createDevice("/dev","stderr",null,l.stderr):n.symlink("/dev/tty1","/dev/stderr");var r=n.open("/dev/stdin",0),e=n.open("/dev/stdout",1),t=n.open("/dev/stderr",1)},staticInit(){[44].forEach(r=>{n.genericErrors[r]=new n.ErrnoError(r),n.genericErrors[r].stack="<generic error, no stack>"}),n.nameTable=new Array(4096),n.mount(p,{},"/"),n.createDefaultDirectories(),n.createDefaultDevices(),n.createSpecialDirectories(),n.filesystems={MEMFS:p}},init(r,e,t){n.init.initialized=!0,l.stdin=r||l.stdin,l.stdout=e||l.stdout,l.stderr=t||l.stderr,n.createStandardStreams()},quit(){n.init.initialized=!1;for(var r=0;r<n.streams.length;r++){var e=n.streams[r];e&&n.close(e)}},findObject(r,e){var t=n.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{var t=n.lookupPath(r,{follow:!e});r=t.path}catch{}var o={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=n.lookupPath(r,{parent:!0});o.parentExists=!0,o.parentPath=t.path,o.parentObject=t.node,o.name=D.basename(r),t=n.lookupPath(r,{follow:!e}),o.exists=!0,o.path=t.path,o.object=t.node,o.name=t.node.name,o.isRoot=t.path==="/"}catch(a){o.error=a.errno}return o},createPath(r,e,t,o){r=typeof r=="string"?r:n.getPath(r);for(var a=e.split("/").reverse();a.length;){var i=a.pop();if(i){var s=D.join2(r,i);try{n.mkdir(s)}catch{}r=s}}return s},createFile(r,e,t,o,a){var i=D.join2(typeof r=="string"?r:n.getPath(r),e),s=Lr(o,a);return n.create(i,s)},createDataFile(r,e,t,o,a,i){var s=e;r&&(r=typeof r=="string"?r:n.getPath(r),s=e?D.join2(r,e):r);var u=Lr(o,a),c=n.create(s,u);if(t){if(typeof t=="string"){for(var h=new Array(t.length),k=0,S=t.length;k<S;++k)h[k]=t.charCodeAt(k);t=h}n.chmod(c,u|146);var m=n.open(c,577);n.write(m,t,0,t.length,0,i),n.close(m),n.chmod(c,u)}},createDevice(r,e,t,o){var a=D.join2(typeof r=="string"?r:n.getPath(r),e),i=Lr(!!t,!!o);n.createDevice.major||(n.createDevice.major=64);var s=n.makedev(n.createDevice.major++,0);return n.registerDevice(s,{open(u){u.seekable=!1},close(u){o?.buffer?.length&&o(10)},read(u,c,h,k,S){for(var m=0,v=0;v<k;v++){var E;try{E=t()}catch{throw new n.ErrnoError(29)}if(E===void 0&&m===0)throw new n.ErrnoError(6);if(E==null)break;m++,c[h+v]=E}return m&&(u.node.timestamp=Date.now()),m},write(u,c,h,k,S){for(var m=0;m<k;m++)try{o(c[h+m])}catch{throw new n.ErrnoError(29)}return k&&(u.node.timestamp=Date.now()),m}}),n.mkdev(a,i,s)},forceLoadFile(r){if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(U)try{r.contents=Dr(U(r.url),!0),r.usedBytes=r.contents.length}catch{throw new n.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(r,e,t,o,a){class i{constructor(){this.lengthKnown=!1,this.chunks=[]}get(v){if(!(v>this.length-1||v<0)){var E=v%this.chunkSize,L=v/this.chunkSize|0;return this.getter(L)[E]}}setDataGetter(v){this.getter=v}cacheLength(){var v=new XMLHttpRequest;if(v.open("HEAD",t,!1),v.send(null),!(v.status>=200&&v.status<300||v.status===304))throw new Error("Couldn't load "+t+". Status: "+v.status);var E=Number(v.getResponseHeader("Content-length")),L,Y=(L=v.getResponseHeader("Accept-Ranges"))&&L==="bytes",O=(L=v.getResponseHeader("Content-Encoding"))&&L==="gzip",f=1024*1024;Y||(f=E);var d=(M,$)=>{if(M>$)throw new Error("invalid range ("+M+", "+$+") or no bytes requested!");if($>E-1)throw new Error("only "+E+" bytes available! programmer error!");var T=new XMLHttpRequest;if(T.open("GET",t,!1),E!==f&&T.setRequestHeader("Range","bytes="+M+"-"+$),T.responseType="arraybuffer",T.overrideMimeType&&T.overrideMimeType("text/plain; charset=x-user-defined"),T.send(null),!(T.status>=200&&T.status<300||T.status===304))throw new Error("Couldn't load "+t+". Status: "+T.status);return T.response!==void 0?new Uint8Array(T.response||[]):Dr(T.responseText||"",!0)},C=this;C.setDataGetter(M=>{var $=M*f,T=(M+1)*f-1;if(T=Math.min(T,E-1),typeof C.chunks[M]>"u"&&(C.chunks[M]=d($,T)),typeof C.chunks[M]>"u")throw new Error("doXHR failed!");return C.chunks[M]}),(O||!E)&&(f=E=1,E=this.getter(0).length,f=E,vr("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=E,this._chunkSize=f,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!tr)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new i,u={isDevice:!1,contents:s}}else var u={isDevice:!1,url:t};var c=n.createFile(r,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 h={},k=Object.keys(c.stream_ops);k.forEach(m=>{var v=c.stream_ops[m];h[m]=(...E)=>(n.forceLoadFile(c),v(...E))});function S(m,v,E,L,Y){var O=m.node.contents;if(Y>=O.length)return 0;var f=Math.min(O.length-Y,L);if(O.slice)for(var d=0;d<f;d++)v[E+d]=O[Y+d];else for(var d=0;d<f;d++)v[E+d]=O.get(Y+d);return f}return h.read=(m,v,E,L,Y)=>(n.forceLoadFile(c),S(m,v,E,L,Y)),h.mmap=(m,v,E,L,Y)=>{n.forceLoadFile(c);var O=ee(v);if(!O)throw new n.ErrnoError(48);return S(m,R,O,v,E),{ptr:O,allocated:!0}},c.stream_ops=h,c}},Or=(r,e)=>r?lr(z,r,e):"",_={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(D.isAbs(e))return e;var o;if(r===-100)o=n.cwd();else{var a=_.getStreamFromFD(r);o=a.path}if(e.length==0){if(!t)throw new n.ErrnoError(44);return o}return D.join2(o,e)},doStat(r,e,t){var o=r(e);w[t>>2]=o.dev,w[t+4>>2]=o.mode,P[t+8>>2]=o.nlink,w[t+12>>2]=o.uid,w[t+16>>2]=o.gid,w[t+20>>2]=o.rdev,N=[o.size>>>0,(g=o.size,+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],w[t+24>>2]=N[0],w[t+28>>2]=N[1],w[t+32>>2]=4096,w[t+36>>2]=o.blocks;var a=o.atime.getTime(),i=o.mtime.getTime(),s=o.ctime.getTime();return N=[Math.floor(a/1e3)>>>0,(g=Math.floor(a/1e3),+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],w[t+40>>2]=N[0],w[t+44>>2]=N[1],P[t+48>>2]=a%1e3*1e3,N=[Math.floor(i/1e3)>>>0,(g=Math.floor(i/1e3),+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],w[t+56>>2]=N[0],w[t+60>>2]=N[1],P[t+64>>2]=i%1e3*1e3,N=[Math.floor(s/1e3)>>>0,(g=Math.floor(s/1e3),+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],w[t+72>>2]=N[0],w[t+76>>2]=N[1],P[t+80>>2]=s%1e3*1e3,N=[o.ino>>>0,(g=o.ino,+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],w[t+88>>2]=N[0],w[t+92>>2]=N[1],0},doMsync(r,e,t,o,a){if(!n.isFile(e.node.mode))throw new n.ErrnoError(43);if(o&2)return 0;var i=z.slice(r,r+t);n.msync(e,i,a,t,o)},varargs:void 0,get(){var r=w[+_.varargs>>2];return _.varargs+=4,r},getp(){return _.get()},getStr(r){var e=Or(r);return e},getStreamFromFD(r){var e=n.getStreamChecked(r);return e}};function nt(r){try{return r=_.getStr(r),n.chdir(r),0}catch(e){if(typeof n>"u"||e.name!=="ErrnoError")throw e;return-e.errno}}function ot(r,e,t,o){try{if(e=_.getStr(e),e=_.calculateAt(r,e),t&-8)return-28;var a=n.lookupPath(e,{follow:!0}),i=a.node;if(!i)return-44;var s="";return t&4&&(s+="r"),t&2&&(s+="w"),t&1&&(s+="x"),s&&n.nodePermissions(i,s)?-2:0}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function at(r,e,t){_.varargs=t;try{var o=_.getStreamFromFD(r);switch(e){case 0:{var a=_.get();if(a<0)return-28;for(;n.streams[a];)a++;var i;return i=n.dupStream(o,a),i.fd}case 1:case 2:return 0;case 3:return o.flags;case 4:{var a=_.get();return o.flags|=a,0}case 12:{var a=_.getp(),s=0;return Er[a+s>>1]=2,0}case 13:case 14:return 0}return-28}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function it(r,e){try{var t=_.getStreamFromFD(r);return _.doStat(n.stat,t.path,e)}catch(o){if(typeof n>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}var te=(r,e,t)=>zr(r,z,e,t);function st(r,e){try{if(e===0)return-28;var t=n.cwd(),o=Fr(t)+1;return e<o?-68:(te(t,r,e),o)}catch(a){if(typeof n>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function ut(r,e,t){_.varargs=t;try{var o=_.getStreamFromFD(r);switch(e){case 21509:return o.tty?0:-59;case 21505:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcgets){var a=o.tty.ops.ioctl_tcgets(o),i=_.getp();w[i>>2]=a.c_iflag||0,w[i+4>>2]=a.c_oflag||0,w[i+8>>2]=a.c_cflag||0,w[i+12>>2]=a.c_lflag||0;for(var s=0;s<32;s++)R[i+s+17]=a.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return o.tty?0:-59;case 21506:case 21507:case 21508:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tcsets){for(var i=_.getp(),u=w[i>>2],c=w[i+4>>2],h=w[i+8>>2],k=w[i+12>>2],S=[],s=0;s<32;s++)S.push(R[i+s+17]);return o.tty.ops.ioctl_tcsets(o.tty,e,{c_iflag:u,c_oflag:c,c_cflag:h,c_lflag:k,c_cc:S})}return 0}case 21519:{if(!o.tty)return-59;var i=_.getp();return w[i>>2]=0,0}case 21520:return o.tty?-28:-59;case 21531:{var i=_.getp();return n.ioctl(o,e,i)}case 21523:{if(!o.tty)return-59;if(o.tty.ops.ioctl_tiocgwinsz){var m=o.tty.ops.ioctl_tiocgwinsz(o.tty),i=_.getp();Er[i>>1]=m[0],Er[i+2>>1]=m[1]}return 0}case 21524:return o.tty?0:-59;case 21515:return o.tty?0:-59;default:return-28}}catch(v){if(typeof n>"u"||v.name!=="ErrnoError")throw v;return-v.errno}}function lt(r,e,t,o){try{e=_.getStr(e);var a=o&256,i=o&4096;return o=o&-6401,e=_.calculateAt(r,e,i),_.doStat(a?n.lstat:n.stat,e,t)}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function ft(r,e,t,o){_.varargs=o;try{e=_.getStr(e),e=_.calculateAt(r,e);var a=o?_.get():0;return n.open(e,t,a).fd}catch(i){if(typeof n>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function ct(r,e){try{return r=_.getStr(r),_.doStat(n.stat,r,e)}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var dt=1,vt=()=>dt,mt=()=>{Kr=!1,ae=0},ht=()=>{throw 1/0},xr=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+e*4294967296:NaN;function pt(r,e,t,o,a,i,s,u){var c=xr(a,i);try{if(isNaN(c))return 61;var h=_.getStreamFromFD(o),k=n.mmap(h,r,c,e,t),S=k.ptr;return w[s>>2]=k.allocated,P[u>>2]=S,0}catch(m){if(typeof n>"u"||m.name!=="ErrnoError")throw m;return-m.errno}}function wt(r,e,t,o,a,i,s){var u=xr(i,s);try{var c=_.getStreamFromFD(a);t&2&&_.doMsync(r,c,e,o,u)}catch(h){if(typeof n>"u"||h.name!=="ErrnoError")throw h;return-h.errno}}var yt=()=>{Cr("")},_t=()=>Date.now(),ne=()=>2147483648,gt=()=>ne(),oe;oe=()=>performance.now();var Et=(r,e,t)=>z.copyWithin(r,e,e+t),kt=r=>{var e=or.buffer,t=(r-e.byteLength+65535)/65536;try{return or.grow(t),Hr(),1}catch{}},St=r=>{var e=z.length;r>>>=0;var t=ne();if(r>t)return!1;for(var o=(c,h)=>c+(h-c%h)%h,a=1;a<=4;a*=2){var i=e*(1+.2/a);i=Math.min(i,r+100663296);var s=Math.min(t,o(Math.max(r,i),65536)),u=kt(s);if(u)return!0}return!1},Ur={},bt=()=>X||"./this.program",wr=()=>{if(!wr.strings){var r=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:r,_:bt()};for(var t in Ur)Ur[t]===void 0?delete e[t]:e[t]=Ur[t];var o=[];for(var t in e)o.push(`${t}=${e[t]}`);wr.strings=o}return wr.strings},Ft=(r,e)=>{for(var t=0;t<r.length;++t)R[e++]=r.charCodeAt(t);R[e]=0},Dt=(r,e)=>{var t=0;return wr().forEach((o,a)=>{var i=e+t;P[r+a*4>>2]=i,Ft(o,i),t+=o.length+1}),0},Pt=(r,e)=>{var t=wr();P[r>>2]=t.length;var o=0;return t.forEach(a=>o+=a.length+1),P[e>>2]=o,0},ae=0,Mt=()=>Kr||ae>0,ie=r=>{ar=r,Mt()||(l.onExit?.(r),mr=!0),x(r,new Gr(r))},se=(r,e)=>{ar=r,ie(r)},At=se;function Rt(r){try{var e=_.getStreamFromFD(r);return n.close(e),0}catch(t){if(typeof n>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var Tt=(r,e,t,o)=>{for(var a=0,i=0;i<t;i++){var s=P[e>>2],u=P[e+4>>2];e+=8;var c=n.read(r,R,s,u,o);if(c<0)return-1;if(a+=c,c<u)break;typeof o<"u"&&(o+=c)}return a};function Nt(r,e,t,o){try{var a=_.getStreamFromFD(r),i=Tt(a,e,t);return P[o>>2]=i,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function Ct(r,e,t,o,a){var i=xr(e,t);try{if(isNaN(i))return 61;var s=_.getStreamFromFD(r);return n.llseek(s,i,o),N=[s.position>>>0,(g=s.position,+Math.abs(g)>=1?g>0?+Math.floor(g/4294967296)>>>0:~~+Math.ceil((g-+(~~g>>>0))/4294967296)>>>0:0)],w[a>>2]=N[0],w[a+4>>2]=N[1],s.getdents&&i===0&&o===0&&(s.getdents=null),0}catch(u){if(typeof n>"u"||u.name!=="ErrnoError")throw u;return u.errno}}var It=(r,e,t,o)=>{for(var a=0,i=0;i<t;i++){var s=P[e>>2],u=P[e+4>>2];e+=8;var c=n.write(r,R,s,u,o);if(c<0)return-1;a+=c,typeof o<"u"&&(o+=c)}return a};function zt(r,e,t,o){try{var a=_.getStreamFromFD(r),i=It(a,e,t);return P[o>>2]=i,0}catch(s){if(typeof n>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var Pr=r=>r%4===0&&(r%100!==0||r%400===0),Lt=(r,e)=>{for(var t=0,o=0;o<=e;t+=r[o++]);return t},ue=[31,29,31,30,31,30,31,31,30,31,30,31],le=[31,28,31,30,31,30,31,31,30,31,30,31],Ot=(r,e)=>{for(var t=new Date(r.getTime());e>0;){var o=Pr(t.getFullYear()),a=t.getMonth(),i=(o?ue:le)[a];if(e>i-t.getDate())e-=i-t.getDate()+1,t.setDate(1),a<11?t.setMonth(a+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+e),t}return t},xt=(r,e)=>{R.set(r,e)},Ut=(r,e,t,o)=>{var a=P[o+40>>2],i={tm_sec:w[o>>2],tm_min:w[o+4>>2],tm_hour:w[o+8>>2],tm_mday:w[o+12>>2],tm_mon:w[o+16>>2],tm_year:w[o+20>>2],tm_wday:w[o+24>>2],tm_yday:w[o+28>>2],tm_isdst:w[o+32>>2],tm_gmtoff:w[o+36>>2],tm_zone:a?Or(a):""},s=Or(t),u={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var c in u)s=s.replace(new RegExp(c,"g"),u[c]);var h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],k=["January","February","March","April","May","June","July","August","September","October","November","December"];function S(f,d,C){for(var M=typeof f=="number"?f.toString():f||"";M.length<d;)M=C[0]+M;return M}function m(f,d){return S(f,d,"0")}function v(f,d){function C($){return $<0?-1:$>0?1:0}var M;return(M=C(f.getFullYear()-d.getFullYear()))===0&&(M=C(f.getMonth()-d.getMonth()))===0&&(M=C(f.getDate()-d.getDate())),M}function E(f){switch(f.getDay()){case 0:return new Date(f.getFullYear()-1,11,29);case 1:return f;case 2:return new Date(f.getFullYear(),0,3);case 3:return new Date(f.getFullYear(),0,2);case 4:return new Date(f.getFullYear(),0,1);case 5:return new Date(f.getFullYear()-1,11,31);case 6:return new Date(f.getFullYear()-1,11,30)}}function L(f){var d=Ot(new Date(f.tm_year+1900,0,1),f.tm_yday),C=new Date(d.getFullYear(),0,4),M=new Date(d.getFullYear()+1,0,4),$=E(C),T=E(M);return v($,d)<=0?v(T,d)<=0?d.getFullYear()+1:d.getFullYear():d.getFullYear()-1}var Y={"%a":f=>h[f.tm_wday].substring(0,3),"%A":f=>h[f.tm_wday],"%b":f=>k[f.tm_mon].substring(0,3),"%B":f=>k[f.tm_mon],"%C":f=>{var d=f.tm_year+1900;return m(d/100|0,2)},"%d":f=>m(f.tm_mday,2),"%e":f=>S(f.tm_mday,2," "),"%g":f=>L(f).toString().substring(2),"%G":L,"%H":f=>m(f.tm_hour,2),"%I":f=>{var d=f.tm_hour;return d==0?d=12:d>12&&(d-=12),m(d,2)},"%j":f=>m(f.tm_mday+Lt(Pr(f.tm_year+1900)?ue:le,f.tm_mon-1),3),"%m":f=>m(f.tm_mon+1,2),"%M":f=>m(f.tm_min,2),"%n":()=>`
|
|
4
|
-
`,"%p":f=>f.tm_hour>=0&&f.tm_hour<12?"AM":"PM","%S":f=>m(f.tm_sec,2),"%t":()=>" ","%u":f=>f.tm_wday||7,"%U":f=>{var d=f.tm_yday+7-f.tm_wday;return m(Math.floor(d/7),2)},"%V":f=>{var d=Math.floor((f.tm_yday+7-(f.tm_wday+6)%7)/7);if((f.tm_wday+371-f.tm_yday-2)%7<=2&&d++,d){if(d==53){var M=(f.tm_wday+371-f.tm_yday)%7;M!=4&&(M!=3||!Pr(f.tm_year))&&(d=1)}}else{d=52;var C=(f.tm_wday+7-f.tm_yday-1)%7;(C==4||C==5&&Pr(f.tm_year%400-1))&&d++}return m(d,2)},"%w":f=>f.tm_wday,"%W":f=>{var d=f.tm_yday+7-(f.tm_wday+6)%7;return m(Math.floor(d/7),2)},"%y":f=>(f.tm_year+1900).toString().substring(2),"%Y":f=>f.tm_year+1900,"%z":f=>{var d=f.tm_gmtoff,C=d>=0;return d=Math.abs(d)/60,d=d/60*100+d%60,(C?"+":"-")+("0000"+d).slice(-4)},"%Z":f=>f.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var c in Y)s.includes(c)&&(s=s.replace(new RegExp(c,"g"),Y[c](i)));s=s.replace(/\0\0/g,"%");var O=Dr(s,!1);return O.length>e?0:(xt(O,r),O.length-1)},Bt=(r,e,t,o,a)=>Ut(r,e,t,o),jt=r=>{if(r instanceof Gr||r=="unwind")return ar;x(1,r)},Ht=r=>{var e=Fr(r)+1,t=Br(e);return te(r,t,e),t};n.createPreloadedFile=et,n.staticInit(),l.FS_createPath=n.createPath,l.FS_createDataFile=n.createDataFile,l.FS_createPreloadedFile=n.createPreloadedFile,l.FS_unlink=n.unlink,l.FS_createLazyFile=n.createLazyFile,l.FS_createDevice=n.createDevice;var Wt={y:We,a:$e,L:nt,M:ot,q:at,G:it,D:st,N:ut,E:lt,n:ft,F:ct,I:vt,A:mt,v:ht,r:pt,s:wt,b:yt,J:_t,x:gt,H:oe,K:Et,w:St,B:Dt,C:Pt,j:At,l:Rt,p:Nt,t:Ct,o:zt,h:Kt,k:qt,d:Xt,e:$t,m:Jt,c:Vt,f:Gt,i:Zt,g:Qt,z:ie,u:Bt},j=He(),Yt=()=>(Yt=j.P)(),fe=l._main=(r,e)=>(fe=l._main=j.Q)(r,e),ce=(r,e)=>(ce=j.S)(r,e),V=(r,e)=>(V=j.T)(r,e),G=()=>(G=j.U)(),K=r=>(K=j.V)(r),Br=r=>(Br=j.W)(r),de=r=>(de=j.X)(r);function Xt(r,e,t,o){var a=G();try{return q(r)(e,t,o)}catch(i){if(K(a),i!==i+0)throw i;V(1,0)}}function $t(r,e,t,o,a){var i=G();try{return q(r)(e,t,o,a)}catch(s){if(K(i),s!==s+0)throw s;V(1,0)}}function qt(r,e,t){var o=G();try{return q(r)(e,t)}catch(a){if(K(o),a!==a+0)throw a;V(1,0)}}function Vt(r){var e=G();try{q(r)()}catch(t){if(K(e),t!==t+0)throw t;V(1,0)}}function Gt(r,e){var t=G();try{q(r)(e)}catch(o){if(K(t),o!==o+0)throw o;V(1,0)}}function Kt(r){var e=G();try{return q(r)()}catch(t){if(K(e),t!==t+0)throw t;V(1,0)}}function Jt(r,e,t,o,a,i){var s=G();try{return q(r)(e,t,o,a,i)}catch(u){if(K(s),u!==u+0)throw u;V(1,0)}}function Qt(r,e,t,o){var a=G();try{q(r)(e,t,o)}catch(i){if(K(a),i!==i+0)throw i;V(1,0)}}function Zt(r,e,t){var o=G();try{q(r)(e,t)}catch(a){if(K(o),a!==a+0)throw a;V(1,0)}}l.addRunDependency=kr,l.removeRunDependency=pr,l.FS_createPath=n.createPath,l.FS_createLazyFile=n.createLazyFile,l.FS_createDevice=n.createDevice,l.callMain=ve,l.FS_createPreloadedFile=n.createPreloadedFile,l.FS=n,l.FS_createDataFile=n.createDataFile,l.FS_unlink=n.unlink;var Mr;hr=function r(){Mr||me(),Mr||(hr=r)};function ve(r=[]){var e=fe;r.unshift(X);var t=r.length,o=Br((t+1)*4),a=o;r.forEach(s=>{P[a>>2]=Ht(s),a+=4}),P[a>>2]=0;try{var i=e(t,o);return se(i,!0),i}catch(s){return jt(s)}}function me(r=Q){if(ir>0||(Ne(),ir>0))return;function e(){Mr||(Mr=!0,l.calledRun=!0,!mr&&(Ce(),Ie(),H(l),l.onRuntimeInitialized&&l.onRuntimeInitialized(),he&&ve(r),ze()))}l.setStatus?(l.setStatus("Running..."),setTimeout(function(){setTimeout(function(){l.setStatus("")},1),e()},1)):e()}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();var he=!1;return l.noInitialRun&&(he=!1),me(),b.ready}})(),A=null,fr=!1,yr=null,Rr=null,cr=null,ye=new Promise(function(y,b){Rr=y,cr=b}),er={OPTIMAL:"optimal",INFEASIBLE:"infeasible",UNBOUNDED:"unbounded",TIME_LIMIT:"timelimit",UNKNOWN:"unknown",ERROR:"error"};function _e(y){return y.includes("optimal solution found")?er.OPTIMAL:y.includes("problem is infeasible")?er.INFEASIBLE:y.includes("problem is unbounded")?er.UNBOUNDED:y.includes("time limit reached")?er.TIME_LIMIT:er.UNKNOWN}function ge(y,b){var l={},H={value:null},F=b||y,I=F.match(/objective value:\s*([\d.e+-]+)/i);I&&(H.value=parseFloat(I[1]));for(var Q=/^([\w$#]+)\s+([\d.e+-]+)/gm,X;(X=Q.exec(F))!==null;){var x=X[1],Z=parseFloat(X[2]);!isNaN(Z)&&x!=="objective"&&x!=="solution"&&(l[x]=Z)}return{variables:l,objective:H}}function Ee(y){var b={solvingTime:null,nodes:null,iterations:null,gap:null},l=y.match(/Solving Time \(sec\)\s*:\s*([\d.]+)/);l&&(b.solvingTime=parseFloat(l[1]));var H=y.match(/Nodes\s*:\s*(\d+)/);H&&(b.nodes=parseInt(H[1]));var F=y.match(/LP Iterations\s*:\s*(\d+)/);F&&(b.iterations=parseInt(F[1]));var I=y.match(/Gap\s*:\s*([\d.]+)\s*%/);return I&&(b.gap=parseFloat(I[1])),b}function _r(y){return y=y||{},fr?Promise.resolve():yr||(yr=new Promise(function(b,l){try{var H=y.wasmPath||Ar+"scip.wasm";we({locateFile:function(F){return F.endsWith(".wasm")?H:F},print:function(F){A&&A.onStdout&&A.onStdout(F)},printErr:function(F){A&&A.onStderr&&A.onStderr(F)}}).then(function(F){if(A=F,A.FS){try{A.FS.mkdir("/problems")}catch{}try{A.FS.mkdir("/solutions")}catch{}try{A.FS.mkdir("/settings")}catch{}}fr=!0,Rr&&Rr(),b()}).catch(function(F){var I=new Error("SCIP WASM loading failed: "+(F.message||F));cr&&cr(I),l(I)})}catch(F){cr&&cr(F),l(F)}}),yr)}function Tr(y,b){b=b||{};var l=function(){var H=b.format||"lp",F=b.timeLimit||3600,I=b.gap||null,Q=b.verbose||!1,X=b.parameters||{},x="",Z="";A.onStdout=function(z){x+=z+`
|
|
5
|
-
`,
|
|
6
|
-
`,
|
|
7
|
-
`);
|
|
8
|
-
`+
|
|
9
|
-
`+
|
|
10
|
-
`},
|
|
1
|
+
(function(Ie){"use strict";var br=function(){if(typeof SCIP_BASE_URL<"u"&&SCIP_BASE_URL)return SCIP_BASE_URL+(SCIP_BASE_URL.endsWith("/")?"":"/");if(typeof document<"u"&&document.currentScript&&document.currentScript.src){var F=document.currentScript.src;return F.substring(0,F.lastIndexOf("/")+1)}return"https://cdn.jsdelivr.net/npm/@areb0s/scip.js@latest/dist/"}(),Ne=(()=>{var F=br;return function(R={}){var f=R,H,M;f.ready=new Promise((r,e)=>{H=r,M=e});var U=Object.assign({},f),rr=[],G="./this.program",W=(r,e)=>{throw e},ur=typeof window=="object",ir=typeof importScripts=="function",re=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",X="";function Mr(r){return f.locateFile?f.locateFile(r,X):X+r}var Y,cr,mr;(ur||ir)&&(ir?X=self.location.href:typeof document<"u"&&document.currentScript&&(X=document.currentScript.src),F&&(X=F),X.startsWith("blob:")?X="":X=X.substr(0,X.replace(/[?#].*/,"").lastIndexOf("/")+1),Y=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.send(null),e.responseText},ir&&(mr=r=>{var e=new XMLHttpRequest;return e.open("GET",r,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),cr=(r,e,t)=>{var n=new XMLHttpRequest;n.open("GET",r,!0),n.responseType="arraybuffer",n.onload=()=>{if(n.status==200||n.status==0&&n.response){e(n.response);return}t()},n.onerror=t,n.send(null)});var _r=f.print||console.log.bind(console),K=f.printErr||console.error.bind(console);Object.assign(f,U),U=null,f.arguments&&(rr=f.arguments),f.thisProgram&&(G=f.thisProgram),f.quit&&(W=f.quit);var er;f.wasmBinary&&(er=f.wasmBinary);var fr,lr=!1,or,N,q,J,pr,k,S,Dr,$e;function ee(){var r=fr.buffer;f.HEAP8=N=new Int8Array(r),f.HEAP16=J=new Int16Array(r),f.HEAPU8=q=new Uint8Array(r),f.HEAPU16=pr=new Uint16Array(r),f.HEAP32=k=new Int32Array(r),f.HEAPU32=S=new Uint32Array(r),f.HEAPF32=Dr=new Float32Array(r),f.HEAPF64=$e=new Float64Array(r)}var te=[],ne=[],Xe=[],ie=[],qe=!1;function Ve(){if(f.preRun)for(typeof f.preRun=="function"&&(f.preRun=[f.preRun]);f.preRun.length;)Ze(f.preRun.shift());Cr(te)}function Ge(){qe=!0,!f.noFSInit&&!i.init.initialized&&i.init(),i.ignorePermissions=!1,tr.init(),Cr(ne)}function Ke(){Cr(Xe)}function Je(){if(f.postRun)for(typeof f.postRun=="function"&&(f.postRun=[f.postRun]);f.postRun.length;)rt(f.postRun.shift());Cr(ie)}function Ze(r){te.unshift(r)}function Qe(r){ne.unshift(r)}function rt(r){ie.unshift(r)}var ar=0,Yr=null,wr=null;function bi(r){return r}function Ar(r){ar++,f.monitorRunDependencies?.(ar)}function yr(r){if(ar--,f.monitorRunDependencies?.(ar),ar==0&&(Yr!==null&&(clearInterval(Yr),Yr=null),wr)){var e=wr;wr=null,e()}}function Rr(r){f.onAbort?.(r),r="Aborted("+r+")",K(r),lr=!0,or=1,r+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(r);throw M(e),e}var et="data:application/octet-stream;base64,",oe=r=>r.startsWith(et),sr;f.locateFile?(sr="scip.wasm",oe(sr)||(sr=Mr(sr))):sr=new URL("scip.wasm",br).href;function ae(r){if(r==sr&&er)return new Uint8Array(er);if(mr)return mr(r);throw"both async and sync fetching of the wasm failed"}function tt(r){return!er&&(ur||ir)&&typeof fetch=="function"?fetch(r,{credentials:"same-origin"}).then(e=>{if(!e.ok)throw`failed to load wasm binary file at '${r}'`;return e.arrayBuffer()}).catch(()=>ae(r)):Promise.resolve().then(()=>ae(r))}function se(r,e,t){return tt(r).then(n=>WebAssembly.instantiate(n,e)).then(t,n=>{K(`failed to asynchronously prepare wasm: ${n}`),Rr(n)})}function nt(r,e,t,n){return!r&&typeof WebAssembly.instantiateStreaming=="function"&&!oe(e)&&typeof fetch=="function"?fetch(e,{credentials:"same-origin"}).then(o=>{var a=WebAssembly.instantiateStreaming(o,t);return a.then(n,function(s){return K(`wasm streaming compile failed: ${s}`),K("falling back to ArrayBuffer instantiation"),se(e,t,n)})}):se(e,t,n)}function it(){var r={a:yn};function e(n,o){return I=n.exports,fr=I.Ra,ee(),fe=I.Ua,Qe(I.Sa),yr("wasm-instantiate"),I}Ar("wasm-instantiate");function t(n){e(n.instance)}if(f.instantiateWasm)try{return f.instantiateWasm(r,e)}catch(n){K(`Module.instantiateWasm callback failed with error: ${n}`),M(n)}return nt(er,sr,r,t).catch(M),{}}var A,O;function ue(r){this.name="ExitStatus",this.message=`Program terminated with exit(${r})`,this.status=r}var Cr=r=>{for(;r.length>0;)r.shift()(f)},ce=f.noExitRuntime||!0,xr=[],fe,g=r=>{var e=xr[r];return e||(r>=xr.length&&(xr.length=r+1),xr[r]=e=fe.get(r)),e},ot=(r,e)=>g(r)(e),Tr=[],Ir=0,at=r=>{var e=new $r(r);return e.get_caught()||(e.set_caught(!0),Ir--),e.set_rethrown(!1),Tr.push(e),Qr(e.excPtr),e.get_exception_ptr()},Z=0,st=()=>{m(0,0);var r=Tr.pop();Zr(r.excPtr),Z=0};class $r{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){S[this.ptr+4>>2]=e}get_type(){return S[this.ptr+4>>2]}set_destructor(e){S[this.ptr+8>>2]=e}get_destructor(){return S[this.ptr+8>>2]}set_caught(e){e=e?1:0,N[this.ptr+12]=e}get_caught(){return N[this.ptr+12]!=0}set_rethrown(e){e=e?1:0,N[this.ptr+13]=e}get_rethrown(){return N[this.ptr+13]!=0}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){S[this.ptr+16>>2]=e}get_adjusted_ptr(){return S[this.ptr+16>>2]}get_exception_ptr(){var e=Pe(this.get_type());if(e)return S[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}var ut=r=>{throw Z||(Z=r),Z},Nr=r=>{var e=Z;if(!e)return kr(0),0;var t=new $r(e);t.set_adjusted_ptr(e);var n=t.get_type();if(!n)return kr(0),e;for(var o in r){var a=r[o];if(a===0||a===n)break;var s=t.ptr+16;if(Fe(a,n,s))return kr(a),e}return kr(n),e},ct=()=>Nr([]),ft=r=>Nr([r]),lt=(r,e)=>Nr([r,e]),dt=(r,e,t,n,o)=>Nr([r,e,t,n,o]),vt=()=>{var r=Tr.pop();r||Rr("no exception to throw");var e=r.excPtr;throw r.get_rethrown()||(Tr.push(r),r.set_rethrown(!0),r.set_caught(!1),Ir++),Z=e,Z},ht=(r,e,t)=>{var n=new $r(r);throw n.init(e,t),Z=r,Ir++,Z},mt=()=>Ir,C={isAbs:r=>r.charAt(0)==="/",splitPath:r=>{var e=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return e.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=C.isAbs(r),t=r.substr(-1)==="/";return r=C.normalizeArray(r.split("/").filter(n=>!!n),!e).join("/"),!r&&!e&&(r="."),r&&t&&(r+="/"),(e?"/":"")+r},dirname:r=>{var e=C.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"/";r=C.normalize(r),r=r.replace(/\/$/,"");var e=r.lastIndexOf("/");return e===-1?r:r.substr(e+1)},join:(...r)=>C.normalize(r.join("/")),join2:(r,e)=>C.normalize(r+"/"+e)},_t=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return r=>crypto.getRandomValues(r);Rr("initRandomDevice")},le=r=>(le=_t())(r),Q={resolve:(...r)=>{for(var e="",t=!1,n=r.length-1;n>=-1&&!t;n--){var o=n>=0?r[n]:i.cwd();if(typeof o!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";e=o+"/"+e,t=C.isAbs(o)}return e=C.normalizeArray(e.split("/").filter(a=>!!a),!t).join("/"),(t?"/":"")+e||"."},relative:(r,e)=>{r=Q.resolve(r).substr(1),e=Q.resolve(e).substr(1);function t(d){for(var v=0;v<d.length&&d[v]==="";v++);for(var E=d.length-1;E>=0&&d[E]==="";E--);return v>E?[]:d.slice(v,E-v+1)}for(var n=t(r.split("/")),o=t(e.split("/")),a=Math.min(n.length,o.length),s=a,u=0;u<a;u++)if(n[u]!==o[u]){s=u;break}for(var c=[],u=s;u<n.length;u++)c.push("..");return c=c.concat(o.slice(s)),c.join("/")}},de=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,dr=(r,e,t)=>{for(var n=e+t,o=e;r[o]&&!(o>=n);)++o;if(o-e>16&&r.buffer&&de)return de.decode(r.subarray(e,o));for(var a="";e<o;){var s=r[e++];if(!(s&128)){a+=String.fromCharCode(s);continue}var u=r[e++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|u);continue}var c=r[e++]&63;if((s&240)==224?s=(s&15)<<12|u<<6|c:s=(s&7)<<18|u<<12|c<<6|r[e++]&63,s<65536)a+=String.fromCharCode(s);else{var d=s-65536;a+=String.fromCharCode(55296|d>>10,56320|d&1023)}}return a},Xr=[],jr=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},qr=(r,e,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,s=0;s<r.length;++s){var u=r.charCodeAt(s);if(u>=55296&&u<=57343){var c=r.charCodeAt(++s);u=65536+((u&1023)<<10)|c&1023}if(u<=127){if(t>=a)break;e[t++]=u}else if(u<=2047){if(t+1>=a)break;e[t++]=192|u>>6,e[t++]=128|u&63}else if(u<=65535){if(t+2>=a)break;e[t++]=224|u>>12,e[t++]=128|u>>6&63,e[t++]=128|u&63}else{if(t+3>=a)break;e[t++]=240|u>>18,e[t++]=128|u>>12&63,e[t++]=128|u>>6&63,e[t++]=128|u&63}}return e[t]=0,t-o};function Lr(r,e,t){var n=t>0?t:jr(r)+1,o=new Array(n),a=qr(r,o,0,o.length);return e&&(o.length=a),o}var pt=()=>{if(!Xr.length){var r=null;if(typeof window<"u"&&typeof window.prompt=="function"?(r=window.prompt("Input: "),r!==null&&(r+=`
|
|
2
|
+
`)):typeof readline=="function"&&(r=readline(),r!==null&&(r+=`
|
|
3
|
+
`)),!r)return null;Xr=Lr(r,!0)}return Xr.shift()},tr={ttys:[],init(){},shutdown(){},register(r,e){tr.ttys[r]={input:[],output:[],ops:e},i.registerDevice(r,tr.stream_ops)},stream_ops:{open(r){var e=tr.ttys[r.node.rdev];if(!e)throw new i.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 i.ErrnoError(60);for(var a=0,s=0;s<n;s++){var u;try{u=r.tty.ops.get_char(r.tty)}catch{throw new i.ErrnoError(29)}if(u===void 0&&a===0)throw new i.ErrnoError(6);if(u==null)break;a++,e[t+s]=u}return a&&(r.node.timestamp=Date.now()),a},write(r,e,t,n,o){if(!r.tty||!r.tty.ops.put_char)throw new i.ErrnoError(60);try{for(var a=0;a<n;a++)r.tty.ops.put_char(r.tty,e[t+a])}catch{throw new i.ErrnoError(29)}return n&&(r.node.timestamp=Date.now()),a}},default_tty_ops:{get_char(r){return pt()},put_char(r,e){e===null||e===10?(_r(dr(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(_r(dr(r.output,0)),r.output=[])},ioctl_tcgets(r){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(r,e,t){return 0},ioctl_tiocgwinsz(r){return[24,80]}},default_tty1_ops:{put_char(r,e){e===null||e===10?(K(dr(r.output,0)),r.output=[]):e!=0&&r.output.push(e)},fsync(r){r.output&&r.output.length>0&&(K(dr(r.output,0)),r.output=[])}}},wt=(r,e)=>(q.fill(0,r,r+e),r),yt=(r,e)=>Math.ceil(r/e)*e,ve=r=>{r=yt(r,65536);var e=Se(65536,r);return e?wt(e,r):0},b={ops_table:null,mount(r){return b.createNode(null,"/",16895,0)},createNode(r,e,t,n){if(i.isBlkdev(t)||i.isFIFO(t))throw new i.ErrnoError(63);b.ops_table||(b.ops_table={dir:{node:{getattr:b.node_ops.getattr,setattr:b.node_ops.setattr,lookup:b.node_ops.lookup,mknod:b.node_ops.mknod,rename:b.node_ops.rename,unlink:b.node_ops.unlink,rmdir:b.node_ops.rmdir,readdir:b.node_ops.readdir,symlink:b.node_ops.symlink},stream:{llseek:b.stream_ops.llseek}},file:{node:{getattr:b.node_ops.getattr,setattr:b.node_ops.setattr},stream:{llseek:b.stream_ops.llseek,read:b.stream_ops.read,write:b.stream_ops.write,allocate:b.stream_ops.allocate,mmap:b.stream_ops.mmap,msync:b.stream_ops.msync}},link:{node:{getattr:b.node_ops.getattr,setattr:b.node_ops.setattr,readlink:b.node_ops.readlink},stream:{}},chrdev:{node:{getattr:b.node_ops.getattr,setattr:b.node_ops.setattr},stream:i.chrdev_stream_ops}});var o=i.createNode(r,e,t,n);return i.isDir(o.mode)?(o.node_ops=b.ops_table.dir.node,o.stream_ops=b.ops_table.dir.stream,o.contents={}):i.isFile(o.mode)?(o.node_ops=b.ops_table.file.node,o.stream_ops=b.ops_table.file.stream,o.usedBytes=0,o.contents=null):i.isLink(o.mode)?(o.node_ops=b.ops_table.link.node,o.stream_ops=b.ops_table.link.stream):i.isChrdev(o.mode)&&(o.node_ops=b.ops_table.chrdev.node,o.stream_ops=b.ops_table.chrdev.stream),o.timestamp=Date.now(),r&&(r.contents[e]=o,r.timestamp=o.timestamp),o},getFileDataAsTypedArray(r){return 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=1024*1024;e=Math.max(e,t*(t<n?2:1.125)>>>0),t!=0&&(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(e==0)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=i.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,i.isDir(r.mode)?e.size=4096:i.isFile(r.mode)?e.size=r.usedBytes:i.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){e.mode!==void 0&&(r.mode=e.mode),e.timestamp!==void 0&&(r.timestamp=e.timestamp),e.size!==void 0&&b.resizeFileStorage(r,e.size)},lookup(r,e){throw i.genericErrors[44]},mknod(r,e,t,n){return b.createNode(r,e,t,n)},rename(r,e,t){if(i.isDir(r.mode)){var n;try{n=i.lookupNode(e,t)}catch{}if(n)for(var o in n.contents)throw new i.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,r.parent=e},unlink(r,e){delete r.contents[e],r.timestamp=Date.now()},rmdir(r,e){var t=i.lookupNode(r,e);for(var n in t.contents)throw new i.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=b.createNode(r,e,41471,0);return n.link=t,n},readlink(r){if(!i.isLink(r.mode))throw new i.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 s=Math.min(r.node.usedBytes-o,n);if(s>8&&a.subarray)e.set(a.subarray(o,o+s),t);else for(var u=0;u<s;u++)e[t+u]=a[o+u];return s},write(r,e,t,n,o,a){if(e.buffer===N.buffer&&(a=!1),!n)return 0;var s=r.node;if(s.timestamp=Date.now(),e.subarray&&(!s.contents||s.contents.subarray)){if(a)return s.contents=e.subarray(t,t+n),s.usedBytes=n,n;if(s.usedBytes===0&&o===0)return s.contents=e.slice(t,t+n),s.usedBytes=n,n;if(o+n<=s.usedBytes)return s.contents.set(e.subarray(t,t+n),o),n}if(b.expandFileStorage(s,o+n),s.contents.subarray&&e.subarray)s.contents.set(e.subarray(t,t+n),o);else for(var u=0;u<n;u++)s.contents[o+u]=e[t+u];return s.usedBytes=Math.max(s.usedBytes,o+n),n},llseek(r,e,t){var n=e;if(t===1?n+=r.position:t===2&&i.isFile(r.node.mode)&&(n+=r.node.usedBytes),n<0)throw new i.ErrnoError(28);return n},allocate(r,e,t){b.expandFileStorage(r.node,e+t),r.node.usedBytes=Math.max(r.node.usedBytes,e+t)},mmap(r,e,t,n,o){if(!i.isFile(r.node.mode))throw new i.ErrnoError(43);var a,s,u=r.node.contents;if(!(o&2)&&u.buffer===N.buffer)s=!1,a=u.byteOffset;else{if((t>0||t+e<u.length)&&(u.subarray?u=u.subarray(t,t+e):u=Array.prototype.slice.call(u,t,t+e)),s=!0,a=ve(e),!a)throw new i.ErrnoError(48);N.set(u,a)}return{ptr:a,allocated:s}},msync(r,e,t,n,o){return b.stream_ops.write(r,e,0,n,t,!1),0}}},gt=(r,e,t,n)=>{var o=n?"":`al ${r}`;cr(r,a=>{e(new Uint8Array(a)),o&&yr(o)},a=>{if(t)t();else throw`Loading data file "${r}" failed.`}),o&&Ar(o)},Et=(r,e,t,n,o,a)=>{i.createDataFile(r,e,t,n,o,a)},kt=f.preloadPlugins||[],St=(r,e,t,n)=>{typeof Browser<"u"&&Browser.init();var o=!1;return kt.forEach(a=>{o||a.canHandle(e)&&(a.handle(r,e,t,n),o=!0)}),o},bt=(r,e,t,n,o,a,s,u,c,d)=>{var v=e?Q.resolve(C.join2(r,e)):r,E=`cp ${v}`;function h(w){function P(j){d?.(),u||Et(r,e,j,n,o,c),a?.(),yr(E)}St(w,v,P,()=>{s?.(),yr(E)})||P(w)}Ar(E),typeof t=="string"?gt(t,h,s):h(t)},Ft=r=>{var e={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},t=e[r];if(typeof t>"u")throw new Error(`Unknown file open mode: ${r}`);return t},Vr=(r,e)=>{var t=0;return r&&(t|=365),e&&(t|=146),t},i={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(r){this.name="ErrnoError",this.errno=r}},genericErrors:{},filesystems:null,syncFSRequests:0,FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(r){this.node=r}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(r){this.shared.flags=r}get position(){return this.shared.position}set position(r){this.shared.position=r}},FSNode:class{constructor(r,e,t,n){r||(r=this),this.parent=r,this.mount=r.mount,this.mounted=null,this.id=i.nextInode++,this.name=e,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(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 i.isDir(this.mode)}get isDevice(){return i.isChrdev(this.mode)}},lookupPath(r,e={}){if(r=Q.resolve(r),!r)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(e=Object.assign(t,e),e.recurse_count>8)throw new i.ErrnoError(32);for(var n=r.split("/").filter(E=>!!E),o=i.root,a="/",s=0;s<n.length;s++){var u=s===n.length-1;if(u&&e.parent)break;if(o=i.lookupNode(o,n[s]),a=C.join2(a,n[s]),i.isMountpoint(o)&&(!u||u&&e.follow_mount)&&(o=o.mounted.root),!u||e.follow)for(var c=0;i.isLink(o.mode);){var d=i.readlink(a);a=Q.resolve(C.dirname(a),d);var v=i.lookupPath(a,{recurse_count:e.recurse_count+1});if(o=v.node,c++>40)throw new i.ErrnoError(32)}}return{path:a,node:o}},getPath(r){for(var e;;){if(i.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)%i.nameTable.length},hashAddNode(r){var e=i.hashName(r.parent.id,r.name);r.name_next=i.nameTable[e],i.nameTable[e]=r},hashRemoveNode(r){var e=i.hashName(r.parent.id,r.name);if(i.nameTable[e]===r)i.nameTable[e]=r.name_next;else for(var t=i.nameTable[e];t;){if(t.name_next===r){t.name_next=r.name_next;break}t=t.name_next}},lookupNode(r,e){var t=i.mayLookup(r);if(t)throw new i.ErrnoError(t);for(var n=i.hashName(r.id,e),o=i.nameTable[n];o;o=o.name_next){var a=o.name;if(o.parent.id===r.id&&a===e)return o}return i.lookup(r,e)},createNode(r,e,t,n){var o=new i.FSNode(r,e,t,n);return i.hashAddNode(o),o},destroyNode(r){i.hashRemoveNode(r)},isRoot(r){return r===r.parent},isMountpoint(r){return!!r.mounted},isFile(r){return(r&61440)===32768},isDir(r){return(r&61440)===16384},isLink(r){return(r&61440)===40960},isChrdev(r){return(r&61440)===8192},isBlkdev(r){return(r&61440)===24576},isFIFO(r){return(r&61440)===4096},isSocket(r){return(r&49152)===49152},flagsToPermissionString(r){var e=["r","w","rw"][r&3];return r&512&&(e+="w"),e},nodePermissions(r,e){return i.ignorePermissions?0:e.includes("r")&&!(r.mode&292)||e.includes("w")&&!(r.mode&146)||e.includes("x")&&!(r.mode&73)?2:0},mayLookup(r){if(!i.isDir(r.mode))return 54;var e=i.nodePermissions(r,"x");return e||(r.node_ops.lookup?0:2)},mayCreate(r,e){try{var t=i.lookupNode(r,e);return 20}catch{}return i.nodePermissions(r,"wx")},mayDelete(r,e,t){var n;try{n=i.lookupNode(r,e)}catch(a){return a.errno}var o=i.nodePermissions(r,"wx");if(o)return o;if(t){if(!i.isDir(n.mode))return 54;if(i.isRoot(n)||i.getPath(n)===i.cwd())return 10}else if(i.isDir(n.mode))return 31;return 0},mayOpen(r,e){return r?i.isLink(r.mode)?32:i.isDir(r.mode)&&(i.flagsToPermissionString(e)!=="r"||e&512)?31:i.nodePermissions(r,i.flagsToPermissionString(e)):44},MAX_OPEN_FDS:4096,nextfd(){for(var r=0;r<=i.MAX_OPEN_FDS;r++)if(!i.streams[r])return r;throw new i.ErrnoError(33)},getStreamChecked(r){var e=i.getStream(r);if(!e)throw new i.ErrnoError(8);return e},getStream:r=>i.streams[r],createStream(r,e=-1){return r=Object.assign(new i.FSStream,r),e==-1&&(e=i.nextfd()),r.fd=e,i.streams[e]=r,r},closeStream(r){i.streams[r]=null},dupStream(r,e=-1){var t=i.createStream(r,e);return t.stream_ops?.dup?.(t),t},chrdev_stream_ops:{open(r){var e=i.getDevice(r.node.rdev);r.stream_ops=e.stream_ops,r.stream_ops.open?.(r)},llseek(){throw new i.ErrnoError(70)}},major:r=>r>>8,minor:r=>r&255,makedev:(r,e)=>r<<8|e,registerDevice(r,e){i.devices[r]={stream_ops:e}},getDevice:r=>i.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){typeof r=="function"&&(e=r,r=!1),i.syncFSRequests++,i.syncFSRequests>1&&K(`warning: ${i.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=i.getMounts(i.root.mount),n=0;function o(s){return i.syncFSRequests--,e(s)}function a(s){if(s)return a.errored?void 0:(a.errored=!0,o(s));++n>=t.length&&o(null)}t.forEach(s=>{if(!s.type.syncfs)return a(null);s.type.syncfs(s,r,a)})},mount(r,e,t){var n=t==="/",o=!t,a;if(n&&i.root)throw new i.ErrnoError(10);if(!n&&!o){var s=i.lookupPath(t,{follow_mount:!1});if(t=s.path,a=s.node,i.isMountpoint(a))throw new i.ErrnoError(10);if(!i.isDir(a.mode))throw new i.ErrnoError(54)}var u={type:r,opts:e,mountpoint:t,mounts:[]},c=r.mount(u);return c.mount=u,u.root=c,n?i.root=c:a&&(a.mounted=u,a.mount&&a.mount.mounts.push(u)),c},unmount(r){var e=i.lookupPath(r,{follow_mount:!1});if(!i.isMountpoint(e.node))throw new i.ErrnoError(28);var t=e.node,n=t.mounted,o=i.getMounts(n);Object.keys(i.nameTable).forEach(s=>{for(var u=i.nameTable[s];u;){var c=u.name_next;o.includes(u.mount)&&i.destroyNode(u),u=c}}),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup(r,e){return r.node_ops.lookup(r,e)},mknod(r,e,t){var n=i.lookupPath(r,{parent:!0}),o=n.node,a=C.basename(r);if(!a||a==="."||a==="..")throw new i.ErrnoError(28);var s=i.mayCreate(o,a);if(s)throw new i.ErrnoError(s);if(!o.node_ops.mknod)throw new i.ErrnoError(63);return o.node_ops.mknod(o,a,e,t)},create(r,e){return e=e!==void 0?e:438,e&=4095,e|=32768,i.mknod(r,e,0)},mkdir(r,e){return e=e!==void 0?e:511,e&=1023,e|=16384,i.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{i.mkdir(n,e)}catch(a){if(a.errno!=20)throw a}}},mkdev(r,e,t){return typeof t>"u"&&(t=e,e=438),e|=8192,i.mknod(r,e,t)},symlink(r,e){if(!Q.resolve(r))throw new i.ErrnoError(44);var t=i.lookupPath(e,{parent:!0}),n=t.node;if(!n)throw new i.ErrnoError(44);var o=C.basename(e),a=i.mayCreate(n,o);if(a)throw new i.ErrnoError(a);if(!n.node_ops.symlink)throw new i.ErrnoError(63);return n.node_ops.symlink(n,o,r)},rename(r,e){var t=C.dirname(r),n=C.dirname(e),o=C.basename(r),a=C.basename(e),s,u,c;if(s=i.lookupPath(r,{parent:!0}),u=s.node,s=i.lookupPath(e,{parent:!0}),c=s.node,!u||!c)throw new i.ErrnoError(44);if(u.mount!==c.mount)throw new i.ErrnoError(75);var d=i.lookupNode(u,o),v=Q.relative(r,n);if(v.charAt(0)!==".")throw new i.ErrnoError(28);if(v=Q.relative(e,t),v.charAt(0)!==".")throw new i.ErrnoError(55);var E;try{E=i.lookupNode(c,a)}catch{}if(d!==E){var h=i.isDir(d.mode),w=i.mayDelete(u,o,h);if(w)throw new i.ErrnoError(w);if(w=E?i.mayDelete(c,a,h):i.mayCreate(c,a),w)throw new i.ErrnoError(w);if(!u.node_ops.rename)throw new i.ErrnoError(63);if(i.isMountpoint(d)||E&&i.isMountpoint(E))throw new i.ErrnoError(10);if(c!==u&&(w=i.nodePermissions(u,"w"),w))throw new i.ErrnoError(w);i.hashRemoveNode(d);try{u.node_ops.rename(d,c,a)}catch(P){throw P}finally{i.hashAddNode(d)}}},rmdir(r){var e=i.lookupPath(r,{parent:!0}),t=e.node,n=C.basename(r),o=i.lookupNode(t,n),a=i.mayDelete(t,n,!0);if(a)throw new i.ErrnoError(a);if(!t.node_ops.rmdir)throw new i.ErrnoError(63);if(i.isMountpoint(o))throw new i.ErrnoError(10);t.node_ops.rmdir(t,n),i.destroyNode(o)},readdir(r){var e=i.lookupPath(r,{follow:!0}),t=e.node;if(!t.node_ops.readdir)throw new i.ErrnoError(54);return t.node_ops.readdir(t)},unlink(r){var e=i.lookupPath(r,{parent:!0}),t=e.node;if(!t)throw new i.ErrnoError(44);var n=C.basename(r),o=i.lookupNode(t,n),a=i.mayDelete(t,n,!1);if(a)throw new i.ErrnoError(a);if(!t.node_ops.unlink)throw new i.ErrnoError(63);if(i.isMountpoint(o))throw new i.ErrnoError(10);t.node_ops.unlink(t,n),i.destroyNode(o)},readlink(r){var e=i.lookupPath(r),t=e.node;if(!t)throw new i.ErrnoError(44);if(!t.node_ops.readlink)throw new i.ErrnoError(28);return Q.resolve(i.getPath(t.parent),t.node_ops.readlink(t))},stat(r,e){var t=i.lookupPath(r,{follow:!e}),n=t.node;if(!n)throw new i.ErrnoError(44);if(!n.node_ops.getattr)throw new i.ErrnoError(63);return n.node_ops.getattr(n)},lstat(r){return i.stat(r,!0)},chmod(r,e,t){var n;if(typeof r=="string"){var o=i.lookupPath(r,{follow:!t});n=o.node}else n=r;if(!n.node_ops.setattr)throw new i.ErrnoError(63);n.node_ops.setattr(n,{mode:e&4095|n.mode&-4096,timestamp:Date.now()})},lchmod(r,e){i.chmod(r,e,!0)},fchmod(r,e){var t=i.getStreamChecked(r);i.chmod(t.node,e)},chown(r,e,t,n){var o;if(typeof r=="string"){var a=i.lookupPath(r,{follow:!n});o=a.node}else o=r;if(!o.node_ops.setattr)throw new i.ErrnoError(63);o.node_ops.setattr(o,{timestamp:Date.now()})},lchown(r,e,t){i.chown(r,e,t,!0)},fchown(r,e,t){var n=i.getStreamChecked(r);i.chown(n.node,e,t)},truncate(r,e){if(e<0)throw new i.ErrnoError(28);var t;if(typeof r=="string"){var n=i.lookupPath(r,{follow:!0});t=n.node}else t=r;if(!t.node_ops.setattr)throw new i.ErrnoError(63);if(i.isDir(t.mode))throw new i.ErrnoError(31);if(!i.isFile(t.mode))throw new i.ErrnoError(28);var o=i.nodePermissions(t,"w");if(o)throw new i.ErrnoError(o);t.node_ops.setattr(t,{size:e,timestamp:Date.now()})},ftruncate(r,e){var t=i.getStreamChecked(r);if(!(t.flags&2097155))throw new i.ErrnoError(28);i.truncate(t.node,e)},utime(r,e,t){var n=i.lookupPath(r,{follow:!0}),o=n.node;o.node_ops.setattr(o,{timestamp:Math.max(e,t)})},open(r,e,t){if(r==="")throw new i.ErrnoError(44);e=typeof e=="string"?Ft(e):e,t=typeof t>"u"?438:t,e&64?t=t&4095|32768:t=0;var n;if(typeof r=="object")n=r;else{r=C.normalize(r);try{var o=i.lookupPath(r,{follow:!(e&131072)});n=o.node}catch{}}var a=!1;if(e&64)if(n){if(e&128)throw new i.ErrnoError(20)}else n=i.mknod(r,t,0),a=!0;if(!n)throw new i.ErrnoError(44);if(i.isChrdev(n.mode)&&(e&=-513),e&65536&&!i.isDir(n.mode))throw new i.ErrnoError(54);if(!a){var s=i.mayOpen(n,e);if(s)throw new i.ErrnoError(s)}e&512&&!a&&i.truncate(n,0),e&=-131713;var u=i.createStream({node:n,path:i.getPath(n),flags:e,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return u.stream_ops.open&&u.stream_ops.open(u),f.logReadFiles&&!(e&1)&&(i.readFiles||(i.readFiles={}),r in i.readFiles||(i.readFiles[r]=1)),u},close(r){if(i.isClosed(r))throw new i.ErrnoError(8);r.getdents&&(r.getdents=null);try{r.stream_ops.close&&r.stream_ops.close(r)}catch(e){throw e}finally{i.closeStream(r.fd)}r.fd=null},isClosed(r){return r.fd===null},llseek(r,e,t){if(i.isClosed(r))throw new i.ErrnoError(8);if(!r.seekable||!r.stream_ops.llseek)throw new i.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new i.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 i.ErrnoError(28);if(i.isClosed(r))throw new i.ErrnoError(8);if((r.flags&2097155)===1)throw new i.ErrnoError(8);if(i.isDir(r.node.mode))throw new i.ErrnoError(31);if(!r.stream_ops.read)throw new i.ErrnoError(28);var a=typeof o<"u";if(!a)o=r.position;else if(!r.seekable)throw new i.ErrnoError(70);var s=r.stream_ops.read(r,e,t,n,o);return a||(r.position+=s),s},write(r,e,t,n,o,a){if(n<0||o<0)throw new i.ErrnoError(28);if(i.isClosed(r))throw new i.ErrnoError(8);if(!(r.flags&2097155))throw new i.ErrnoError(8);if(i.isDir(r.node.mode))throw new i.ErrnoError(31);if(!r.stream_ops.write)throw new i.ErrnoError(28);r.seekable&&r.flags&1024&&i.llseek(r,0,2);var s=typeof o<"u";if(!s)o=r.position;else if(!r.seekable)throw new i.ErrnoError(70);var u=r.stream_ops.write(r,e,t,n,o,a);return s||(r.position+=u),u},allocate(r,e,t){if(i.isClosed(r))throw new i.ErrnoError(8);if(e<0||t<=0)throw new i.ErrnoError(28);if(!(r.flags&2097155))throw new i.ErrnoError(8);if(!i.isFile(r.node.mode)&&!i.isDir(r.node.mode))throw new i.ErrnoError(43);if(!r.stream_ops.allocate)throw new i.ErrnoError(138);r.stream_ops.allocate(r,e,t)},mmap(r,e,t,n,o){if(n&2&&!(o&2)&&(r.flags&2097155)!==2)throw new i.ErrnoError(2);if((r.flags&2097155)===1)throw new i.ErrnoError(2);if(!r.stream_ops.mmap)throw new i.ErrnoError(43);return r.stream_ops.mmap(r,e,t,n,o)},msync(r,e,t,n,o){return 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 i.ErrnoError(59);return r.stream_ops.ioctl(r,e,t)},readFile(r,e={}){if(e.flags=e.flags||0,e.encoding=e.encoding||"binary",e.encoding!=="utf8"&&e.encoding!=="binary")throw new Error(`Invalid encoding type "${e.encoding}"`);var t,n=i.open(r,e.flags),o=i.stat(r),a=o.size,s=new Uint8Array(a);return i.read(n,s,0,a,0),e.encoding==="utf8"?t=dr(s,0):e.encoding==="binary"&&(t=s),i.close(n),t},writeFile(r,e,t={}){t.flags=t.flags||577;var n=i.open(r,t.flags,t.mode);if(typeof e=="string"){var o=new Uint8Array(jr(e)+1),a=qr(e,o,0,o.length);i.write(n,o,0,a,void 0,t.canOwn)}else if(ArrayBuffer.isView(e))i.write(n,e,0,e.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");i.close(n)},cwd:()=>i.currentPath,chdir(r){var e=i.lookupPath(r,{follow:!0});if(e.node===null)throw new i.ErrnoError(44);if(!i.isDir(e.node.mode))throw new i.ErrnoError(54);var t=i.nodePermissions(e.node,"x");if(t)throw new i.ErrnoError(t);i.currentPath=e.path},createDefaultDirectories(){i.mkdir("/tmp"),i.mkdir("/home"),i.mkdir("/home/web_user")},createDefaultDevices(){i.mkdir("/dev"),i.registerDevice(i.makedev(1,3),{read:()=>0,write:(n,o,a,s,u)=>s}),i.mkdev("/dev/null",i.makedev(1,3)),tr.register(i.makedev(5,0),tr.default_tty_ops),tr.register(i.makedev(6,0),tr.default_tty1_ops),i.mkdev("/dev/tty",i.makedev(5,0)),i.mkdev("/dev/tty1",i.makedev(6,0));var r=new Uint8Array(1024),e=0,t=()=>(e===0&&(e=le(r).byteLength),r[--e]);i.createDevice("/dev","random",t),i.createDevice("/dev","urandom",t),i.mkdir("/dev/shm"),i.mkdir("/dev/shm/tmp")},createSpecialDirectories(){i.mkdir("/proc");var r=i.mkdir("/proc/self");i.mkdir("/proc/self/fd"),i.mount({mount(){var e=i.createNode(r,"fd",16895,73);return e.node_ops={lookup(t,n){var o=+n,a=i.getStreamChecked(o),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>a.path}};return s.parent=s,s}},e}},{},"/proc/self/fd")},createStandardStreams(){f.stdin?i.createDevice("/dev","stdin",f.stdin):i.symlink("/dev/tty","/dev/stdin"),f.stdout?i.createDevice("/dev","stdout",null,f.stdout):i.symlink("/dev/tty","/dev/stdout"),f.stderr?i.createDevice("/dev","stderr",null,f.stderr):i.symlink("/dev/tty1","/dev/stderr");var r=i.open("/dev/stdin",0),e=i.open("/dev/stdout",1),t=i.open("/dev/stderr",1)},staticInit(){[44].forEach(r=>{i.genericErrors[r]=new i.ErrnoError(r),i.genericErrors[r].stack="<generic error, no stack>"}),i.nameTable=new Array(4096),i.mount(b,{},"/"),i.createDefaultDirectories(),i.createDefaultDevices(),i.createSpecialDirectories(),i.filesystems={MEMFS:b}},init(r,e,t){i.init.initialized=!0,f.stdin=r||f.stdin,f.stdout=e||f.stdout,f.stderr=t||f.stderr,i.createStandardStreams()},quit(){i.init.initialized=!1;for(var r=0;r<i.streams.length;r++){var e=i.streams[r];e&&i.close(e)}},findObject(r,e){var t=i.analyzePath(r,e);return t.exists?t.object:null},analyzePath(r,e){try{var t=i.lookupPath(r,{follow:!e});r=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=i.lookupPath(r,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=C.basename(r),t=i.lookupPath(r,{follow:!e}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(o){n.error=o.errno}return n},createPath(r,e,t,n){r=typeof r=="string"?r:i.getPath(r);for(var o=e.split("/").reverse();o.length;){var a=o.pop();if(a){var s=C.join2(r,a);try{i.mkdir(s)}catch{}r=s}}return s},createFile(r,e,t,n,o){var a=C.join2(typeof r=="string"?r:i.getPath(r),e),s=Vr(n,o);return i.create(a,s)},createDataFile(r,e,t,n,o,a){var s=e;r&&(r=typeof r=="string"?r:i.getPath(r),s=e?C.join2(r,e):r);var u=Vr(n,o),c=i.create(s,u);if(t){if(typeof t=="string"){for(var d=new Array(t.length),v=0,E=t.length;v<E;++v)d[v]=t.charCodeAt(v);t=d}i.chmod(c,u|146);var h=i.open(c,577);i.write(h,t,0,t.length,0,a),i.close(h),i.chmod(c,u)}},createDevice(r,e,t,n){var o=C.join2(typeof r=="string"?r:i.getPath(r),e),a=Vr(!!t,!!n);i.createDevice.major||(i.createDevice.major=64);var s=i.makedev(i.createDevice.major++,0);return i.registerDevice(s,{open(u){u.seekable=!1},close(u){n?.buffer?.length&&n(10)},read(u,c,d,v,E){for(var h=0,w=0;w<v;w++){var P;try{P=t()}catch{throw new i.ErrnoError(29)}if(P===void 0&&h===0)throw new i.ErrnoError(6);if(P==null)break;h++,c[d+w]=P}return h&&(u.node.timestamp=Date.now()),h},write(u,c,d,v,E){for(var h=0;h<v;h++)try{n(c[d+h])}catch{throw new i.ErrnoError(29)}return v&&(u.node.timestamp=Date.now()),h}}),i.mkdev(o,a,s)},forceLoadFile(r){if(r.isDevice||r.isFolder||r.link||r.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(Y)try{r.contents=Lr(Y(r.url),!0),r.usedBytes=r.contents.length}catch{throw new i.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile(r,e,t,n,o){class a{constructor(){this.lengthKnown=!1,this.chunks=[]}get(w){if(!(w>this.length-1||w<0)){var P=w%this.chunkSize,j=w/this.chunkSize|0;return this.getter(j)[P]}}setDataGetter(w){this.getter=w}cacheLength(){var w=new XMLHttpRequest;if(w.open("HEAD",t,!1),w.send(null),!(w.status>=200&&w.status<300||w.status===304))throw new Error("Couldn't load "+t+". Status: "+w.status);var P=Number(w.getResponseHeader("Content-length")),j,$=(j=w.getResponseHeader("Accept-Ranges"))&&j==="bytes",L=(j=w.getResponseHeader("Content-Encoding"))&&j==="gzip",l=1024*1024;$||(l=P);var y=(T,V)=>{if(T>V)throw new Error("invalid range ("+T+", "+V+") or no bytes requested!");if(V>P-1)throw new Error("only "+P+" bytes available! programmer error!");var z=new XMLHttpRequest;if(z.open("GET",t,!1),P!==l&&z.setRequestHeader("Range","bytes="+T+"-"+V),z.responseType="arraybuffer",z.overrideMimeType&&z.overrideMimeType("text/plain; charset=x-user-defined"),z.send(null),!(z.status>=200&&z.status<300||z.status===304))throw new Error("Couldn't load "+t+". Status: "+z.status);return z.response!==void 0?new Uint8Array(z.response||[]):Lr(z.responseText||"",!0)},B=this;B.setDataGetter(T=>{var V=T*l,z=(T+1)*l-1;if(z=Math.min(z,P-1),typeof B.chunks[T]>"u"&&(B.chunks[T]=y(V,z)),typeof B.chunks[T]>"u")throw new Error("doXHR failed!");return B.chunks[T]}),(L||!P)&&(l=P=1,P=this.getter(0).length,l=P,_r("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=P,this._chunkSize=l,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!ir)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new a,u={isDevice:!1,contents:s}}else var u={isDevice:!1,url:t};var c=i.createFile(r,e,u,n,o);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 d={},v=Object.keys(c.stream_ops);v.forEach(h=>{var w=c.stream_ops[h];d[h]=(...P)=>(i.forceLoadFile(c),w(...P))});function E(h,w,P,j,$){var L=h.node.contents;if($>=L.length)return 0;var l=Math.min(L.length-$,j);if(L.slice)for(var y=0;y<l;y++)w[P+y]=L[$+y];else for(var y=0;y<l;y++)w[P+y]=L.get($+y);return l}return d.read=(h,w,P,j,$)=>(i.forceLoadFile(c),E(h,w,P,j,$)),d.mmap=(h,w,P,j,$)=>{i.forceLoadFile(c);var L=ve(w);if(!L)throw new i.ErrnoError(48);return E(h,N,L,w,P),{ptr:L,allocated:!0}},c.stream_ops=d,c}},gr=(r,e)=>r?dr(q,r,e):"",D={DEFAULT_POLLMASK:5,calculateAt(r,e,t){if(C.isAbs(e))return e;var n;if(r===-100)n=i.cwd();else{var o=D.getStreamFromFD(r);n=o.path}if(e.length==0){if(!t)throw new i.ErrnoError(44);return n}return C.join2(n,e)},doStat(r,e,t){var n=r(e);k[t>>2]=n.dev,k[t+4>>2]=n.mode,S[t+8>>2]=n.nlink,k[t+12>>2]=n.uid,k[t+16>>2]=n.gid,k[t+20>>2]=n.rdev,O=[n.size>>>0,(A=n.size,+Math.abs(A)>=1?A>0?+Math.floor(A/4294967296)>>>0:~~+Math.ceil((A-+(~~A>>>0))/4294967296)>>>0:0)],k[t+24>>2]=O[0],k[t+28>>2]=O[1],k[t+32>>2]=4096,k[t+36>>2]=n.blocks;var o=n.atime.getTime(),a=n.mtime.getTime(),s=n.ctime.getTime();return O=[Math.floor(o/1e3)>>>0,(A=Math.floor(o/1e3),+Math.abs(A)>=1?A>0?+Math.floor(A/4294967296)>>>0:~~+Math.ceil((A-+(~~A>>>0))/4294967296)>>>0:0)],k[t+40>>2]=O[0],k[t+44>>2]=O[1],S[t+48>>2]=o%1e3*1e3,O=[Math.floor(a/1e3)>>>0,(A=Math.floor(a/1e3),+Math.abs(A)>=1?A>0?+Math.floor(A/4294967296)>>>0:~~+Math.ceil((A-+(~~A>>>0))/4294967296)>>>0:0)],k[t+56>>2]=O[0],k[t+60>>2]=O[1],S[t+64>>2]=a%1e3*1e3,O=[Math.floor(s/1e3)>>>0,(A=Math.floor(s/1e3),+Math.abs(A)>=1?A>0?+Math.floor(A/4294967296)>>>0:~~+Math.ceil((A-+(~~A>>>0))/4294967296)>>>0:0)],k[t+72>>2]=O[0],k[t+76>>2]=O[1],S[t+80>>2]=s%1e3*1e3,O=[n.ino>>>0,(A=n.ino,+Math.abs(A)>=1?A>0?+Math.floor(A/4294967296)>>>0:~~+Math.ceil((A-+(~~A>>>0))/4294967296)>>>0:0)],k[t+88>>2]=O[0],k[t+92>>2]=O[1],0},doMsync(r,e,t,n,o){if(!i.isFile(e.node.mode))throw new i.ErrnoError(43);if(n&2)return 0;var a=q.slice(r,r+t);i.msync(e,a,o,t,n)},varargs:void 0,get(){var r=k[+D.varargs>>2];return D.varargs+=4,r},getp(){return D.get()},getStr(r){var e=gr(r);return e},getStreamFromFD(r){var e=i.getStreamChecked(r);return e}};function Pt(r){try{return r=D.getStr(r),i.chdir(r),0}catch(e){if(typeof i>"u"||e.name!=="ErrnoError")throw e;return-e.errno}}function Mt(r,e,t,n){try{if(e=D.getStr(e),e=D.calculateAt(r,e),t&-8)return-28;var o=i.lookupPath(e,{follow:!0}),a=o.node;if(!a)return-44;var s="";return t&4&&(s+="r"),t&2&&(s+="w"),t&1&&(s+="x"),s&&i.nodePermissions(a,s)?-2:0}catch(u){if(typeof i>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function Dt(r,e,t){D.varargs=t;try{var n=D.getStreamFromFD(r);switch(e){case 0:{var o=D.get();if(o<0)return-28;for(;i.streams[o];)o++;var a;return a=i.dupStream(n,o),a.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var o=D.get();return n.flags|=o,0}case 12:{var o=D.getp(),s=0;return J[o+s>>1]=2,0}case 13:case 14:return 0}return-28}catch(u){if(typeof i>"u"||u.name!=="ErrnoError")throw u;return-u.errno}}function At(r,e){try{var t=D.getStreamFromFD(r);return D.doStat(i.stat,t.path,e)}catch(n){if(typeof i>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var he=(r,e,t)=>qr(r,q,e,t);function Rt(r,e){try{if(e===0)return-28;var t=i.cwd(),n=jr(t)+1;return e<n?-68:(he(t,r,e),n)}catch(o){if(typeof i>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function Ct(r,e,t){D.varargs=t;try{var n=D.getStreamFromFD(r);switch(e){case 21509: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=D.getp();k[a>>2]=o.c_iflag||0,k[a+4>>2]=o.c_oflag||0,k[a+8>>2]=o.c_cflag||0,k[a+12>>2]=o.c_lflag||0;for(var s=0;s<32;s++)N[a+s+17]=o.c_cc[s]||0;return 0}return 0}case 21510:case 21511:case 21512:return n.tty?0:-59;case 21506:case 21507:case 21508:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tcsets){for(var a=D.getp(),u=k[a>>2],c=k[a+4>>2],d=k[a+8>>2],v=k[a+12>>2],E=[],s=0;s<32;s++)E.push(N[a+s+17]);return n.tty.ops.ioctl_tcsets(n.tty,e,{c_iflag:u,c_oflag:c,c_cflag:d,c_lflag:v,c_cc:E})}return 0}case 21519:{if(!n.tty)return-59;var a=D.getp();return k[a>>2]=0,0}case 21520:return n.tty?-28:-59;case 21531:{var a=D.getp();return i.ioctl(n,e,a)}case 21523:{if(!n.tty)return-59;if(n.tty.ops.ioctl_tiocgwinsz){var h=n.tty.ops.ioctl_tiocgwinsz(n.tty),a=D.getp();J[a>>1]=h[0],J[a+2>>1]=h[1]}return 0}case 21524:return n.tty?0:-59;case 21515:return n.tty?0:-59;default:return-28}}catch(w){if(typeof i>"u"||w.name!=="ErrnoError")throw w;return-w.errno}}function xt(r,e,t,n){try{e=D.getStr(e);var o=n&256,a=n&4096;return n=n&-6401,e=D.calculateAt(r,e,a),D.doStat(o?i.lstat:i.stat,e,t)}catch(s){if(typeof i>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function Tt(r,e,t,n){D.varargs=n;try{e=D.getStr(e),e=D.calculateAt(r,e);var o=n?D.get():0;return i.open(e,t,o).fd}catch(a){if(typeof i>"u"||a.name!=="ErrnoError")throw a;return-a.errno}}function It(r,e){try{return r=D.getStr(r),D.doStat(i.stat,r,e)}catch(t){if(typeof i>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}var Nt=1,jt=()=>Nt,Lt=()=>{ce=!1,pe=0},zt=()=>{throw 1/0},Gr=(r,e)=>e+2097152>>>0<4194305-!!r?(r>>>0)+e*4294967296:NaN;function Ut(r,e,t,n,o,a,s,u){var c=Gr(o,a);try{if(isNaN(c))return 61;var d=D.getStreamFromFD(n),v=i.mmap(d,r,c,e,t),E=v.ptr;return k[s>>2]=v.allocated,S[u>>2]=E,0}catch(h){if(typeof i>"u"||h.name!=="ErrnoError")throw h;return-h.errno}}function Ot(r,e,t,n,o,a,s){var u=Gr(a,s);try{var c=D.getStreamFromFD(o);t&2&&D.doMsync(r,c,e,n,u)}catch(d){if(typeof i>"u"||d.name!=="ErrnoError")throw d;return-d.errno}}var Bt=()=>{Rr("")},Ht=()=>Date.now(),me=()=>2147483648,Wt=()=>me(),_e;_e=()=>performance.now();var Yt=(r,e,t)=>q.copyWithin(r,e,e+t),$t=r=>{var e=fr.buffer,t=(r-e.byteLength+65535)/65536;try{return fr.grow(t),ee(),1}catch{}},Xt=r=>{var e=q.length;r>>>=0;var t=me();if(r>t)return!1;for(var n=(c,d)=>c+(d-c%d)%d,o=1;o<=4;o*=2){var a=e*(1+.2/o);a=Math.min(a,r+100663296);var s=Math.min(t,n(Math.max(r,a),65536)),u=$t(s);if(u)return!0}return!1},Kr={},qt=()=>G||"./this.program",Er=()=>{if(!Er.strings){var r=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:r,_:qt()};for(var t in Kr)Kr[t]===void 0?delete e[t]:e[t]=Kr[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);Er.strings=n}return Er.strings},Vt=(r,e)=>{for(var t=0;t<r.length;++t)N[e++]=r.charCodeAt(t);N[e]=0},Gt=(r,e)=>{var t=0;return Er().forEach((n,o)=>{var a=e+t;S[r+o*4>>2]=a,Vt(n,a),t+=n.length+1}),0},Kt=(r,e)=>{var t=Er();S[r>>2]=t.length;var n=0;return t.forEach(o=>n+=o.length+1),S[e>>2]=n,0},pe=0,Jt=()=>ce||pe>0,we=r=>{or=r,Jt()||(f.onExit?.(r),lr=!0),W(r,new ue(r))},ye=(r,e)=>{or=r,we(r)},Zt=ye;function Qt(r){try{var e=D.getStreamFromFD(r);return i.close(e),0}catch(t){if(typeof i>"u"||t.name!=="ErrnoError")throw t;return t.errno}}var rn=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var s=S[e>>2],u=S[e+4>>2];e+=8;var c=i.read(r,N,s,u,n);if(c<0)return-1;if(o+=c,c<u)break;typeof n<"u"&&(n+=c)}return o};function en(r,e,t,n){try{var o=D.getStreamFromFD(r),a=rn(o,e,t);return S[n>>2]=a,0}catch(s){if(typeof i>"u"||s.name!=="ErrnoError")throw s;return s.errno}}function tn(r,e,t,n,o){var a=Gr(e,t);try{if(isNaN(a))return 61;var s=D.getStreamFromFD(r);return i.llseek(s,a,n),O=[s.position>>>0,(A=s.position,+Math.abs(A)>=1?A>0?+Math.floor(A/4294967296)>>>0:~~+Math.ceil((A-+(~~A>>>0))/4294967296)>>>0:0)],k[o>>2]=O[0],k[o+4>>2]=O[1],s.getdents&&a===0&&n===0&&(s.getdents=null),0}catch(u){if(typeof i>"u"||u.name!=="ErrnoError")throw u;return u.errno}}var nn=(r,e,t,n)=>{for(var o=0,a=0;a<t;a++){var s=S[e>>2],u=S[e+4>>2];e+=8;var c=i.write(r,N,s,u,n);if(c<0)return-1;o+=c,typeof n<"u"&&(n+=c)}return o};function on(r,e,t,n){try{var o=D.getStreamFromFD(r),a=nn(o,e,t);return S[n>>2]=a,0}catch(s){if(typeof i>"u"||s.name!=="ErrnoError")throw s;return s.errno}}var an=r=>r,zr=r=>r%4===0&&(r%100!==0||r%400===0),sn=(r,e)=>{for(var t=0,n=0;n<=e;t+=r[n++]);return t},ge=[31,29,31,30,31,30,31,31,30,31,30,31],Ee=[31,28,31,30,31,30,31,31,30,31,30,31],un=(r,e)=>{for(var t=new Date(r.getTime());e>0;){var n=zr(t.getFullYear()),o=t.getMonth(),a=(n?ge:Ee)[o];if(e>a-t.getDate())e-=a-t.getDate()+1,t.setDate(1),o<11?t.setMonth(o+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1));else return t.setDate(t.getDate()+e),t}return t},cn=(r,e)=>{N.set(r,e)},fn=(r,e,t,n)=>{var o=S[n+40>>2],a={tm_sec:k[n>>2],tm_min:k[n+4>>2],tm_hour:k[n+8>>2],tm_mday:k[n+12>>2],tm_mon:k[n+16>>2],tm_year:k[n+20>>2],tm_wday:k[n+24>>2],tm_yday:k[n+28>>2],tm_isdst:k[n+32>>2],tm_gmtoff:k[n+36>>2],tm_zone:o?gr(o):""},s=gr(t),u={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var c in u)s=s.replace(new RegExp(c,"g"),u[c]);var d=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],v=["January","February","March","April","May","June","July","August","September","October","November","December"];function E(l,y,B){for(var T=typeof l=="number"?l.toString():l||"";T.length<y;)T=B[0]+T;return T}function h(l,y){return E(l,y,"0")}function w(l,y){function B(V){return V<0?-1:V>0?1:0}var T;return(T=B(l.getFullYear()-y.getFullYear()))===0&&(T=B(l.getMonth()-y.getMonth()))===0&&(T=B(l.getDate()-y.getDate())),T}function P(l){switch(l.getDay()){case 0:return new Date(l.getFullYear()-1,11,29);case 1:return l;case 2:return new Date(l.getFullYear(),0,3);case 3:return new Date(l.getFullYear(),0,2);case 4:return new Date(l.getFullYear(),0,1);case 5:return new Date(l.getFullYear()-1,11,31);case 6:return new Date(l.getFullYear()-1,11,30)}}function j(l){var y=un(new Date(l.tm_year+1900,0,1),l.tm_yday),B=new Date(y.getFullYear(),0,4),T=new Date(y.getFullYear()+1,0,4),V=P(B),z=P(T);return w(V,y)<=0?w(z,y)<=0?y.getFullYear()+1:y.getFullYear():y.getFullYear()-1}var $={"%a":l=>d[l.tm_wday].substring(0,3),"%A":l=>d[l.tm_wday],"%b":l=>v[l.tm_mon].substring(0,3),"%B":l=>v[l.tm_mon],"%C":l=>{var y=l.tm_year+1900;return h(y/100|0,2)},"%d":l=>h(l.tm_mday,2),"%e":l=>E(l.tm_mday,2," "),"%g":l=>j(l).toString().substring(2),"%G":j,"%H":l=>h(l.tm_hour,2),"%I":l=>{var y=l.tm_hour;return y==0?y=12:y>12&&(y-=12),h(y,2)},"%j":l=>h(l.tm_mday+sn(zr(l.tm_year+1900)?ge:Ee,l.tm_mon-1),3),"%m":l=>h(l.tm_mon+1,2),"%M":l=>h(l.tm_min,2),"%n":()=>`
|
|
4
|
+
`,"%p":l=>l.tm_hour>=0&&l.tm_hour<12?"AM":"PM","%S":l=>h(l.tm_sec,2),"%t":()=>" ","%u":l=>l.tm_wday||7,"%U":l=>{var y=l.tm_yday+7-l.tm_wday;return h(Math.floor(y/7),2)},"%V":l=>{var y=Math.floor((l.tm_yday+7-(l.tm_wday+6)%7)/7);if((l.tm_wday+371-l.tm_yday-2)%7<=2&&y++,y){if(y==53){var T=(l.tm_wday+371-l.tm_yday)%7;T!=4&&(T!=3||!zr(l.tm_year))&&(y=1)}}else{y=52;var B=(l.tm_wday+7-l.tm_yday-1)%7;(B==4||B==5&&zr(l.tm_year%400-1))&&y++}return h(y,2)},"%w":l=>l.tm_wday,"%W":l=>{var y=l.tm_yday+7-(l.tm_wday+6)%7;return h(Math.floor(y/7),2)},"%y":l=>(l.tm_year+1900).toString().substring(2),"%Y":l=>l.tm_year+1900,"%z":l=>{var y=l.tm_gmtoff,B=y>=0;return y=Math.abs(y)/60,y=y/60*100+y%60,(B?"+":"-")+("0000"+y).slice(-4)},"%Z":l=>l.tm_zone,"%%":()=>"%"};s=s.replace(/%%/g,"\0\0");for(var c in $)s.includes(c)&&(s=s.replace(new RegExp(c,"g"),$[c](a)));s=s.replace(/\0\0/g,"%");var L=Lr(s,!1);return L.length>e?0:(cn(L,r),L.length-1)},ln=(r,e,t,n,o)=>fn(r,e,t,n),dn=r=>{if(r instanceof ue||r=="unwind")return or;W(1,r)},vn=r=>{var e=jr(r)+1,t=Sr(e);return he(r,t,e),t},hn=r=>{var e=_(),t=r();return p(e),t},mn=r=>hn(()=>{var e=Sr(4),t=Sr(4);be(r,e,t);var n=S[e>>2],o=S[t>>2],a=gr(n);Jr(n);var s;return o&&(s=gr(o),Jr(o)),[a,s]}),_n=r=>mn(r),pn=r=>Qr(r),wn=r=>Zr(r);i.createPreloadedFile=bt,i.staticInit(),f.FS_createPath=i.createPath,f.FS_createDataFile=i.createDataFile,f.FS_createPreloadedFile=i.createPreloadedFile,f.FS_unlink=i.unlink,f.FS_createLazyFile=i.createLazyFile,f.FS_createDevice=i.createDevice;var yn={ka:ot,l:at,t:st,a:ct,h:ft,E:lt,Pa:dt,P:vt,r:ht,ga:mt,d:ut,xa:Pt,ya:Mt,T:Dt,sa:At,pa:Rt,za:Ct,qa:xt,Q:Tt,ra:It,ua:jt,ma:Lt,ha:zt,aa:Ut,ba:Ot,q:Bt,va:Ht,ja:Wt,ta:_e,wa:Yt,ia:Xt,na:Gt,oa:Kt,L:Zt,M:Qt,S:en,ca:tn,R:on,s:An,z:Zn,K:Gn,O:pi,v:Fn,g:Sn,n:Un,b:kn,y:Kn,Na:Yn,e:xn,C:ni,G:Jn,Oa:Wn,p:zn,U:_i,Ma:$n,Da:ci,N:ii,w:Mn,Z:ai,Fa:oi,Ka:qn,A:Nn,La:Xn,Ea:ui,x:On,Qa:Hn,Ja:Vn,J:wi,Y:si,$:ki,_:Si,j:jn,i:bn,D:Qn,Ba:hi,Ca:vi,Ga:ti,c:Dn,Aa:mi,Ha:ei,Ia:ri,f:Rn,k:Tn,W:li,u:Pn,V:di,X:fi,B:Cn,o:In,H:Bn,F:Ln,I:yi,da:Ei,ea:gi,m:an,la:we,fa:ln},I=it(),gn=()=>(gn=I.Sa)(),ke=f._main=(r,e)=>(ke=f._main=I.Ta)(r,e),Jr=r=>(Jr=I.Va)(r),En=r=>(En=I.__cxa_free_exception)(r),kr=r=>(kr=I.Wa)(r),Se=(r,e)=>(Se=I.Xa)(r,e),m=(r,e)=>(m=I.Ya)(r,e),_=()=>(_=I.Za)(),p=r=>(p=I._a)(r),Sr=r=>(Sr=I.$a)(r),Zr=r=>(Zr=I.ab)(r),Qr=r=>(Qr=I.bb)(r),be=(r,e,t)=>(be=I.cb)(r,e,t),Fe=(r,e,t)=>(Fe=I.db)(r,e,t),Pe=r=>(Pe=I.eb)(r),Me=f.dynCall_vij=(r,e,t,n)=>(Me=f.dynCall_vij=I.fb)(r,e,t,n),De=f.dynCall_j=r=>(De=f.dynCall_j=I.gb)(r),Ae=f.dynCall_viijii=(r,e,t,n,o,a,s)=>(Ae=f.dynCall_viijii=I.hb)(r,e,t,n,o,a,s),Re=f.dynCall_jiiii=(r,e,t,n,o)=>(Re=f.dynCall_jiiii=I.ib)(r,e,t,n,o);function kn(r,e,t){var n=_();try{return g(r)(e,t)}catch(o){if(p(n),o!==o+0)throw o;m(1,0)}}function Sn(r,e){var t=_();try{return g(r)(e)}catch(n){if(p(t),n!==n+0)throw n;m(1,0)}}function bn(r,e){var t=_();try{g(r)(e)}catch(n){if(p(t),n!==n+0)throw n;m(1,0)}}function Fn(r){var e=_();try{return g(r)()}catch(t){if(p(e),t!==t+0)throw t;m(1,0)}}function Pn(r,e,t,n,o,a){var s=_();try{g(r)(e,t,n,o,a)}catch(u){if(p(s),u!==u+0)throw u;m(1,0)}}function Mn(r,e,t,n,o,a){var s=_();try{return g(r)(e,t,n,o,a)}catch(u){if(p(s),u!==u+0)throw u;m(1,0)}}function Dn(r,e,t){var n=_();try{g(r)(e,t)}catch(o){if(p(n),o!==o+0)throw o;m(1,0)}}function An(r,e){var t=_();try{return g(r)(e)}catch(n){if(p(t),n!==n+0)throw n;m(1,0)}}function Rn(r,e,t,n){var o=_();try{g(r)(e,t,n)}catch(a){if(p(o),a!==a+0)throw a;m(1,0)}}function Cn(r,e,t,n,o,a,s){var u=_();try{g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function xn(r,e,t,n){var o=_();try{return g(r)(e,t,n)}catch(a){if(p(o),a!==a+0)throw a;m(1,0)}}function Tn(r,e,t,n,o){var a=_();try{g(r)(e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}function In(r,e,t,n,o,a,s,u){var c=_();try{g(r)(e,t,n,o,a,s,u)}catch(d){if(p(c),d!==d+0)throw d;m(1,0)}}function Nn(r,e,t,n,o,a,s){var u=_();try{return g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function jn(r){var e=_();try{g(r)()}catch(t){if(p(e),t!==t+0)throw t;m(1,0)}}function Ln(r,e,t,n,o,a,s,u,c,d,v){var E=_();try{g(r)(e,t,n,o,a,s,u,c,d,v)}catch(h){if(p(E),h!==h+0)throw h;m(1,0)}}function zn(r,e,t,n,o){var a=_();try{return g(r)(e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}function Un(r,e,t){var n=_();try{return g(r)(e,t)}catch(o){if(p(n),o!==o+0)throw o;m(1,0)}}function On(r,e,t,n,o,a,s,u){var c=_();try{return g(r)(e,t,n,o,a,s,u)}catch(d){if(p(c),d!==d+0)throw d;m(1,0)}}function Bn(r,e,t,n,o,a,s,u,c){var d=_();try{g(r)(e,t,n,o,a,s,u,c)}catch(v){if(p(d),v!==v+0)throw v;m(1,0)}}function Hn(r,e,t,n,o,a,s,u,c,d){var v=_();try{return g(r)(e,t,n,o,a,s,u,c,d)}catch(E){if(p(v),E!==E+0)throw E;m(1,0)}}function Wn(r,e,t,n,o,a,s,u){var c=_();try{return g(r)(e,t,n,o,a,s,u)}catch(d){if(p(c),d!==d+0)throw d;m(1,0)}}function Yn(r,e,t,n,o,a){var s=_();try{return g(r)(e,t,n,o,a)}catch(u){if(p(s),u!==u+0)throw u;m(1,0)}}function $n(r,e,t,n,o,a,s){var u=_();try{return g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function Xn(r,e,t,n,o,a,s,u,c){var d=_();try{return g(r)(e,t,n,o,a,s,u,c)}catch(v){if(p(d),v!==v+0)throw v;m(1,0)}}function qn(r,e,t,n,o,a,s,u,c){var d=_();try{return g(r)(e,t,n,o,a,s,u,c)}catch(v){if(p(d),v!==v+0)throw v;m(1,0)}}function Vn(r,e,t,n,o,a,s,u,c,d,v){var E=_();try{return g(r)(e,t,n,o,a,s,u,c,d,v)}catch(h){if(p(E),h!==h+0)throw h;m(1,0)}}function Gn(r,e,t,n){var o=_();try{return g(r)(e,t,n)}catch(a){if(p(o),a!==a+0)throw a;m(1,0)}}function Kn(r,e,t,n){var o=_();try{return g(r)(e,t,n)}catch(a){if(p(o),a!==a+0)throw a;m(1,0)}}function Jn(r,e,t,n,o,a){var s=_();try{return g(r)(e,t,n,o,a)}catch(u){if(p(s),u!==u+0)throw u;m(1,0)}}function Zn(r,e,t){var n=_();try{return g(r)(e,t)}catch(o){if(p(n),o!==o+0)throw o;m(1,0)}}function Qn(r,e,t){var n=_();try{g(r)(e,t)}catch(o){if(p(n),o!==o+0)throw o;m(1,0)}}function ri(r,e,t,n,o,a){var s=_();try{g(r)(e,t,n,o,a)}catch(u){if(p(s),u!==u+0)throw u;m(1,0)}}function ei(r,e,t,n,o){var a=_();try{g(r)(e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}function ti(r,e,t,n,o,a,s,u,c){var d=_();try{g(r)(e,t,n,o,a,s,u,c)}catch(v){if(p(d),v!==v+0)throw v;m(1,0)}}function ni(r,e,t,n,o){var a=_();try{return g(r)(e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}function ii(r,e,t,n,o,a,s){var u=_();try{return g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function oi(r,e,t,n,o,a,s,u){var c=_();try{return g(r)(e,t,n,o,a,s,u)}catch(d){if(p(c),d!==d+0)throw d;m(1,0)}}function ai(r,e,t,n,o,a,s){var u=_();try{return g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function si(r,e,t,n,o,a,s,u,c,d,v,E,h){var w=_();try{return g(r)(e,t,n,o,a,s,u,c,d,v,E,h)}catch(P){if(p(w),P!==P+0)throw P;m(1,0)}}function ui(r,e,t,n,o,a,s,u,c,d,v){var E=_();try{return g(r)(e,t,n,o,a,s,u,c,d,v)}catch(h){if(p(E),h!==h+0)throw h;m(1,0)}}function ci(r,e,t,n,o,a,s,u){var c=_();try{return g(r)(e,t,n,o,a,s,u)}catch(d){if(p(c),d!==d+0)throw d;m(1,0)}}function fi(r,e,t,n,o,a,s,u,c,d){var v=_();try{g(r)(e,t,n,o,a,s,u,c,d)}catch(E){if(p(v),E!==E+0)throw E;m(1,0)}}function li(r,e,t,n,o,a,s){var u=_();try{g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function di(r,e,t,n,o,a,s,u,c){var d=_();try{g(r)(e,t,n,o,a,s,u,c)}catch(v){if(p(d),v!==v+0)throw v;m(1,0)}}function vi(r,e,t,n,o,a,s){var u=_();try{g(r)(e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function hi(r,e,t,n,o){var a=_();try{g(r)(e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}function mi(r,e,t,n,o){var a=_();try{g(r)(e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}function _i(r,e,t,n,o,a){var s=_();try{return g(r)(e,t,n,o,a)}catch(u){if(p(s),u!==u+0)throw u;m(1,0)}}function pi(r,e,t,n){var o=_();try{return g(r)(e,t,n)}catch(a){if(p(o),a!==a+0)throw a;m(1,0)}}function wi(r,e,t,n,o,a,s,u,c,d,v,E){var h=_();try{return g(r)(e,t,n,o,a,s,u,c,d,v,E)}catch(w){if(p(h),w!==w+0)throw w;m(1,0)}}function yi(r,e,t,n,o,a,s,u,c,d,v,E,h,w,P,j){var $=_();try{g(r)(e,t,n,o,a,s,u,c,d,v,E,h,w,P,j)}catch(L){if(p($),L!==L+0)throw L;m(1,0)}}function gi(r,e,t,n){var o=_();try{Me(r,e,t,n)}catch(a){if(p(o),a!==a+0)throw a;m(1,0)}}function Ei(r,e,t,n,o,a,s){var u=_();try{Ae(r,e,t,n,o,a,s)}catch(c){if(p(u),c!==c+0)throw c;m(1,0)}}function ki(r){var e=_();try{return De(r)}catch(t){if(p(e),t!==t+0)throw t;m(1,0)}}function Si(r,e,t,n,o){var a=_();try{return Re(r,e,t,n,o)}catch(s){if(p(a),s!==s+0)throw s;m(1,0)}}f.addRunDependency=Ar,f.removeRunDependency=yr,f.FS_createPath=i.createPath,f.FS_createLazyFile=i.createLazyFile,f.FS_createDevice=i.createDevice,f.callMain=Ce,f.incrementExceptionRefcount=pn,f.decrementExceptionRefcount=wn,f.getExceptionMessage=_n,f.FS_createPreloadedFile=i.createPreloadedFile,f.FS=i,f.FS_createDataFile=i.createDataFile,f.FS_unlink=i.unlink;var Ur;wr=function r(){Ur||xe(),Ur||(wr=r)};function Ce(r=[]){var e=ke;r.unshift(G);var t=r.length,n=Sr((t+1)*4),o=n;r.forEach(s=>{S[o>>2]=vn(s),o+=4}),S[o>>2]=0;try{var a=e(t,n);return ye(a,!0),a}catch(s){return dn(s)}}function xe(r=rr){if(ar>0||(Ve(),ar>0))return;function e(){Ur||(Ur=!0,f.calledRun=!0,!lr&&(Ge(),Ke(),H(f),f.onRuntimeInitialized&&f.onRuntimeInitialized(),Te&&Ce(r),Je()))}f.setStatus?(f.setStatus("Running..."),setTimeout(function(){setTimeout(function(){f.setStatus("")},1),e()},1)):e()}if(f.preInit)for(typeof f.preInit=="function"&&(f.preInit=[f.preInit]);f.preInit.length>0;)f.preInit.pop()();var Te=!1;return f.noInitialRun&&(Te=!1),xe(),R.ready}})(),x=null,vr=!1,Fr=null,Or=null,hr=null,Br=null,Hr=null,je=new Promise(function(F,R){Or=F,hr=R}),nr={OPTIMAL:"optimal",INFEASIBLE:"infeasible",UNBOUNDED:"unbounded",TIME_LIMIT:"timelimit",UNKNOWN:"unknown",ERROR:"error"};function Le(F){return F.includes("optimal solution found")?nr.OPTIMAL:F.includes("problem is infeasible")?nr.INFEASIBLE:F.includes("problem is unbounded")?nr.UNBOUNDED:F.includes("time limit reached")?nr.TIME_LIMIT:nr.UNKNOWN}function ze(F){var R={},f={value:null},H=F.match(/objective value:\s*([\d.e+-]+)/i);H&&(f.value=parseFloat(H[1]));for(var M=/^(\w+)\s+([\d.e+-]+)/gm,U,rr=F.split("solution:")[1]||F;(U=M.exec(rr))!==null;){var G=U[1],W=parseFloat(U[2]);!isNaN(W)&&G!=="objective"&&(R[G]=W)}return{variables:R,objective:f}}function Ue(F){var R={solvingTime:null,nodes:null,iterations:null,gap:null},f=F.match(/Solving Time \(sec\)\s*:\s*([\d.]+)/);f&&(R.solvingTime=parseFloat(f[1]));var H=F.match(/Nodes\s*:\s*(\d+)/);H&&(R.nodes=parseInt(H[1]));var M=F.match(/LP Iterations\s*:\s*(\d+)/);M&&(R.iterations=parseInt(M[1]));var U=F.match(/Gap\s*:\s*([\d.]+)\s*%/);return U&&(R.gap=parseFloat(U[1])),R}function Pr(F){return F=F||{},vr?Promise.resolve():Fr||(Fr=new Promise(function(R,f){try{var H=F.wasmPath||br+"scip.wasm";console.log("[SCIP.js] __SCIP_SCRIPT_DIR__:",br),console.log("[SCIP.js] Loading WASM from:",H),fetch(H,{method:"HEAD"}).then(function(M){console.log("[SCIP.js] WASM file check:",M.ok?"OK":"FAILED",M.status)}).catch(function(M){console.error("[SCIP.js] WASM file check failed:",M)}),Ne({locateFile:function(M){return M.endsWith(".wasm")?(console.log("[SCIP.js] locateFile called for:",M,"-> returning:",H),H):M},print:function(M){x&&x.onStdout&&x.onStdout(M)},printErr:function(M){x&&x.onStderr&&x.onStderr(M)},onAbort:function(M){Br=M,console.error("[SCIP WASM Abort]",M)},onExit:function(M){Hr=M,M!==0&&console.error("[SCIP WASM Exit]",M)}}).then(function(M){if(console.log("[SCIP.js] WASM loaded successfully"),x=M,x.FS){try{x.FS.mkdir("/problems")}catch{}try{x.FS.mkdir("/solutions")}catch{}try{x.FS.mkdir("/settings")}catch{}}vr=!0,Or&&Or(),R()}).catch(function(M){console.error("[SCIP.js] WASM loading failed:",M),console.error("[SCIP.js] Attempted WASM path:",H),console.error("[SCIP.js] Make sure the WASM file is accessible at this URL."),console.error("[SCIP.js] You can set window.SCIP_BASE_URL before loading this script to specify a custom path.");var U=new Error("SCIP WASM loading failed: "+(M.message||M)+". WASM path: "+H);hr&&hr(U),f(U)})}catch(M){console.error("[SCIP.js] Initialization error:",M),hr&&hr(M),f(M)}}),Fr)}function Wr(F,R){R=R||{};var f=function(){var H=R.format||"lp",M=R.timeLimit||3600,U=R.gap||null,rr=R.verbose||!1,G=R.parameters||{},W="",ur="";x.onStdout=function(S){W+=S+`
|
|
5
|
+
`,rr&&console.log("[SCIP]",S)},x.onStderr=function(S){ur+=S+`
|
|
6
|
+
`,rr&&console.error("[SCIP Error]",S)};try{var ir={mps:"mps",zpl:"zpl",cip:"cip",lp:"lp"},re=ir[H]||"lp",X="/problems/problem."+re,Mr="/solutions/solution.sol";x.FS.writeFile(X,F);var Y=[];Y.push("set limits time "+M),U!==null&&Y.push("set limits gap "+U);for(var cr in G)G.hasOwnProperty(cr)&&Y.push("set "+cr+" "+G[cr]);Y.push("read "+X),Y.push("optimize"),Y.push("display solution"),Y.push("write solution "+Mr),Y.push("display statistics"),Y.push("quit");var mr=Y.join(`
|
|
7
|
+
`);x.FS.writeFile("/settings/commands.txt",mr);var _r=x.callMain(["-b","/settings/commands.txt"]),K=Le(W),er=ze(W),fr=Ue(W),lr=null;try{lr=x.FS.readFile(Mr,{encoding:"utf8"})}catch{}for(var or=["/problems/problem.lp","/problems/problem.mps","/problems/problem.zpl","/problems/problem.cip","/solutions/solution.sol","/settings/commands.txt"],N=0;N<or.length;N++)try{x.FS.unlink(or[N])}catch{}return{status:K,objective:er.objective.value,variables:er.variables,statistics:fr,exitCode:_r,output:rr?W:void 0,rawSolution:lr}}catch(S){var q=S.message||String(S),J=null;if(typeof S=="number"||/^\d+$/.test(String(S))){var pr=typeof S=="number"?S:parseInt(String(S),10);if(x)try{if(typeof x.getExceptionMessage=="function")J=x.getExceptionMessage(pr),q="WASM Exception: "+J;else if(typeof x.UTF8ToString=="function")try{var k=x.UTF8ToString(pr);k&&k.length>0&&k.length<1e3&&(J=k,q="WASM Exception: "+k)}catch{}}catch(Dr){console.error("[SCIP] Failed to get exception message:",Dr)}J||(q="WASM Exception (ptr: "+pr+"). Enable exception handling in build for details.")}return{status:nr.ERROR,error:q,errorDetails:{rawError:String(S),exceptionInfo:J,abortReason:Br,exitCode:Hr,type:typeof S,stdout:W,stderr:ur},output:W+ur}}Br=null,Hr=null};return vr?Promise.resolve(f()):Pr(R).then(f)}function Oe(F,R){return F.toLowerCase().includes("minimize")||(F=`Minimize
|
|
8
|
+
`+F),Wr(F,R)}function Be(F,R){return F.toLowerCase().includes("maximize")||(F=`Maximize
|
|
9
|
+
`+F),Wr(F,R)}function He(){var F=function(){var R="";return x.onStdout=function(f){R+=f+`
|
|
10
|
+
`},x.callMain(["--version"]),R.trim()};return vr?Promise.resolve(F()):Pr().then(F)}function We(){return vr}var Ye={init:Pr,ready:je,isReady:We,solve:Wr,minimize:Oe,maximize:Be,version:He,Status:nr};Ie.SCIP=Ye,Pr().catch(function(F){console.error("[SCIP.js] Auto-initialization failed:",F.message)})})(typeof self<"u"?self:typeof window<"u"?window:globalThis);
|
package/dist/scip.wasm
CHANGED
|
Binary file
|