UNPKG

@foxglove/sql.js

Version:

SQLite library with support for opening and writing databases, prepared statements, and more. This SQLite library is in pure javascript (compiled with emscripten).

177 lines (164 loc) 54.2 kB
// We are modularizing this manually because the current modularize setting in Emscripten has some issues: // https://github.com/kripken/emscripten/issues/5820 // In addition, When you use emcc's modularization, it still expects to export a global object called `Module`, // which is able to be used/called before the WASM is loaded. // The modularization below exports a promise that loads and resolves to the actual sql.js module. // That way, this module can't be used before the WASM is finished loading. // We are going to define a function that a user will call to start loading initializing our Sql.js library // However, that function might be called multiple times, and on subsequent calls, we don't actually want it to instantiate a new instance of the Module // Instead, we want to return the previously loaded module // TODO: Make this not declare a global if used in the browser var initSqlJsPromise = undefined; var initSqlJs = function (moduleConfig) { if (initSqlJsPromise){ return initSqlJsPromise; } // If we're here, we've never called this function before initSqlJsPromise = new Promise(function (resolveModule, reject) { // We are modularizing this manually because the current modularize setting in Emscripten has some issues: // https://github.com/kripken/emscripten/issues/5820 // The way to affect the loading of emcc compiled modules is to create a variable called `Module` and add // properties to it, like `preRun`, `postRun`, etc // We are using that to get notified when the WASM has finished loading. // Only then will we return our promise // If they passed in a moduleConfig object, use that // Otherwise, initialize Module to the empty object var Module = typeof moduleConfig !== 'undefined' ? moduleConfig : {}; // EMCC only allows for a single onAbort function (not an array of functions) // So if the user defined their own onAbort function, we remember it and call it var originalOnAbortFunction = Module['onAbort']; Module['onAbort'] = function (errorThatCausedAbort) { reject(new Error(errorThatCausedAbort)); if (originalOnAbortFunction){ originalOnAbortFunction(errorThatCausedAbort); } }; Module['postRun'] = Module['postRun'] || []; Module['postRun'].push(function () { // When Emscripted calls postRun, this promise resolves with the built Module resolveModule(Module); }); // There is a section of code in the emcc-generated code below that looks like this: // (Note that this is lowercase `module`) // if (typeof module !== 'undefined') { // module['exports'] = Module; // } // When that runs, it's going to overwrite our own modularization export efforts in shell-post.js! // The only way to tell emcc not to emit it is to pass the MODULARIZE=1 or MODULARIZE_INSTANCE=1 flags, // but that carries with it additional unnecessary baggage/bugs we don't want either. // So, we have three options: // 1) We undefine `module` // 2) We remember what `module['exports']` was at the beginning of this function and we restore it later // 3) We write a script to remove those lines of code as part of the Make process. // // Since those are the only lines of code that care about module, we will undefine it. It's the most straightforward // of the options, and has the side effect of reducing emcc's efforts to modify the module if its output were to change in the future. // That's a nice side effect since we're handling the modularization efforts ourselves module = undefined; // The emcc-generated code and shell-post.js code goes below, // meaning that all of it runs inside of this promise. If anything throws an exception, our promise will abort var f;f||(f=typeof Module !== 'undefined' ? Module : {});null; f.onRuntimeInitialized=function(){function a(h,m){this.Qa=h;this.db=m;this.Oa=1;this.nb=[]}function b(h,m){this.db=m;m=aa(h)+1;this.eb=da(m);if(null===this.eb)throw Error("Unable to allocate memory for the SQL string");ea(h,k,this.eb,m);this.kb=this.eb;this.$a=this.rb=null}function c(h){h=h||{};this.filename="dbfile_"+(4294967295*Math.random()>>>0);null!=h.data?fa(this.filename,h.data):h.file?(h=h.file,n.gb||(n.gb=new FileReaderSync),n.createNode(ha,this.filename,n.Za,0,h,h.lastModifiedDate)):(h instanceof Array||h instanceof Uint8Array)&&fa(this.filename,h);this.handleError(g(this.filename,d));this.db=q(d,"i32");jc(this.db);this.hb={};this.Wa={}}var d=v(4),e=f.cwrap,g=e("sqlite3_open","number",["string","number"]),l=e("sqlite3_close_v2","number",["number"]),p=e("sqlite3_exec","number",["number","string","number","number","number"]),w=e("sqlite3_changes","number",["number"]),u=e("sqlite3_prepare_v2","number",["number","string","number","number","number"]),D=e("sqlite3_sql","string",["number"]),J=e("sqlite3_normalized_sql", "string",["number"]),ba=e("sqlite3_prepare_v2","number",["number","number","number","number","number"]),kc=e("sqlite3_bind_text","number",["number","number","number","number","number"]),rb=e("sqlite3_bind_blob","number",["number","number","number","number","number"]),lc=e("sqlite3_bind_double","number",["number","number","number"]),mc=e("sqlite3_bind_int","number",["number","number","number"]),nc=e("sqlite3_bind_parameter_index","number",["number","string"]),oc=e("sqlite3_step","number",["number"]), pc=e("sqlite3_errmsg","string",["number"]),qc=e("sqlite3_column_count","number",["number"]),rc=e("sqlite3_data_count","number",["number"]),sc=e("sqlite3_column_double","number",["number","number"]),sb=e("sqlite3_column_text","string",["number","number"]),tc=e("sqlite3_column_blob","number",["number","number"]),uc=e("sqlite3_column_bytes","number",["number","number"]),vc=e("sqlite3_column_type","number",["number","number"]),wc=e("sqlite3_column_name","string",["number","number"]),xc=e("sqlite3_reset", "number",["number"]),yc=e("sqlite3_clear_bindings","number",["number"]),zc=e("sqlite3_finalize","number",["number"]),Ac=e("sqlite3_create_function_v2","number","number string number number number number number number number".split(" ")),Bc=e("sqlite3_value_type","number",["number"]),Cc=e("sqlite3_value_bytes","number",["number"]),Dc=e("sqlite3_value_text","string",["number"]),Ec=e("sqlite3_value_blob","number",["number"]),Fc=e("sqlite3_value_double","number",["number"]),Gc=e("sqlite3_result_double", "",["number","number"]),tb=e("sqlite3_result_null","",["number"]),Hc=e("sqlite3_result_text","",["number","string","number","number"]),Ic=e("sqlite3_result_blob","",["number","number","number","number"]),Jc=e("sqlite3_result_int","",["number","number"]),ub=e("sqlite3_result_error","",["number","string","number"]),jc=e("RegisterExtensionFunctions","number",["number"]);a.prototype.bind=function(h){if(!this.Qa)throw"Statement closed";this.reset();return Array.isArray(h)?this.Hb(h):null!=h&&"object"=== typeof h?this.Ib(h):!0};a.prototype.step=function(){if(!this.Qa)throw"Statement closed";this.Oa=1;var h=oc(this.Qa);switch(h){case 100:return!0;case 101:return!1;default:throw this.db.handleError(h);}};a.prototype.Db=function(h){null==h&&(h=this.Oa,this.Oa+=1);return sc(this.Qa,h)};a.prototype.Kb=function(h){null==h&&(h=this.Oa,this.Oa+=1);h=sb(this.Qa,h);if("function"!==typeof BigInt)throw Error("BigInt is not supported");return BigInt(h)};a.prototype.Lb=function(h){null==h&&(h=this.Oa,this.Oa+= 1);return sb(this.Qa,h)};a.prototype.getBlob=function(h){null==h&&(h=this.Oa,this.Oa+=1);var m=uc(this.Qa,h);h=tc(this.Qa,h);for(var t=new Uint8Array(m),r=0;r<m;r+=1)t[r]=x[h+r];return t};a.prototype.get=function(h,m){m=m||{};null!=h&&this.bind(h)&&this.step();h=[];for(var t=rc(this.Qa),r=0;r<t;r+=1)switch(vc(this.Qa,r)){case 1:var C=m.useBigInt?this.Kb(r):this.Db(r);h.push(C);break;case 2:h.push(this.Db(r));break;case 3:h.push(this.Lb(r));break;case 4:h.push(this.getBlob(r));break;default:h.push(null)}return h}; a.prototype.getColumnNames=function(){for(var h=[],m=qc(this.Qa),t=0;t<m;t+=1)h.push(wc(this.Qa,t));return h};a.prototype.getAsObject=function(h,m){h=this.get(h,m);m=this.getColumnNames();for(var t={},r=0;r<m.length;r+=1)t[m[r]]=h[r];return t};a.prototype.getSQL=function(){return D(this.Qa)};a.prototype.getNormalizedSQL=function(){return J(this.Qa)};a.prototype.run=function(h){null!=h&&this.bind(h);this.step();return this.reset()};a.prototype.xb=function(h,m){null==m&&(m=this.Oa,this.Oa+=1);h=ia(h); var t=ja(h);this.nb.push(t);this.db.handleError(kc(this.Qa,m,t,h.length-1,0))};a.prototype.Gb=function(h,m){null==m&&(m=this.Oa,this.Oa+=1);var t=ja(h);this.nb.push(t);this.db.handleError(rb(this.Qa,m,t,h.length,0))};a.prototype.wb=function(h,m){null==m&&(m=this.Oa,this.Oa+=1);this.db.handleError((h===(h|0)?mc:lc)(this.Qa,m,h))};a.prototype.Jb=function(h){null==h&&(h=this.Oa,this.Oa+=1);rb(this.Qa,h,0,0,0)};a.prototype.yb=function(h,m){null==m&&(m=this.Oa,this.Oa+=1);switch(typeof h){case "string":this.xb(h, m);return;case "number":this.wb(h,m);return;case "bigint":this.xb(h.toString(),m);return;case "boolean":this.wb(h+0,m);return;case "object":if(null===h){this.Jb(m);return}if(null!=h.length){this.Gb(h,m);return}}throw"Wrong API use : tried to bind a value of an unknown type ("+h+").";};a.prototype.Ib=function(h){var m=this;Object.keys(h).forEach(function(t){var r=nc(m.Qa,t);0!==r&&m.yb(h[t],r)});return!0};a.prototype.Hb=function(h){for(var m=0;m<h.length;m+=1)this.yb(h[m],m+1);return!0};a.prototype.reset= function(){this.freemem();return 0===yc(this.Qa)&&0===xc(this.Qa)};a.prototype.freemem=function(){for(var h;void 0!==(h=this.nb.pop());)la(h)};a.prototype.free=function(){this.freemem();var h=0===zc(this.Qa);delete this.db.hb[this.Qa];this.Qa=0;return h};b.prototype.next=function(){if(null===this.eb)return{done:!0};null!==this.$a&&(this.$a.free(),this.$a=null);if(!this.db.db)throw this.pb(),Error("Database closed");var h=ma(),m=v(4);na(d);na(m);try{this.db.handleError(ba(this.db.db,this.kb,-1,d,m)); this.kb=q(m,"i32");var t=q(d,"i32");if(0===t)return this.pb(),{done:!0};this.$a=new a(t,this.db);this.db.hb[t]=this.$a;return{value:this.$a,done:!1}}catch(r){throw this.rb=y(this.kb),this.pb(),r;}finally{oa(h)}};b.prototype.pb=function(){la(this.eb);this.eb=null};b.prototype.getRemainingSQL=function(){return null!==this.rb?this.rb:y(this.kb)};"function"===typeof Symbol&&"symbol"===typeof Symbol.iterator&&(b.prototype[Symbol.iterator]=function(){return this});c.prototype.run=function(h,m){if(!this.db)throw"Database closed"; if(m){h=this.prepare(h,m);try{h.step()}finally{h.free()}}else this.handleError(p(this.db,h,0,0,d));return this};c.prototype.exec=function(h,m,t){if(!this.db)throw"Database closed";var r=ma(),C=null;try{var V=aa(h)+1,H=v(V);ea(h,x,H,V);var ka=H;var ca=v(4);for(h=[];0!==q(ka,"i8");){na(d);na(ca);this.handleError(ba(this.db,ka,-1,d,ca));var E=q(d,"i32");ka=q(ca,"i32");if(0!==E){V=null;C=new a(E,this);for(null!=m&&C.bind(m);C.step();)null===V&&(V={columns:C.getColumnNames(),values:[]},h.push(V)),V.values.push(C.get(null, t));C.free()}}return h}catch(O){throw C&&C.free(),O;}finally{oa(r)}};c.prototype.each=function(h,m,t,r,C){"function"===typeof m&&(r=t,t=m,m=void 0);h=this.prepare(h,m);try{for(;h.step();)t(h.getAsObject(null,C))}finally{h.free()}if("function"===typeof r)return r()};c.prototype.prepare=function(h,m){na(d);this.handleError(u(this.db,h,-1,d,0));h=q(d,"i32");if(0===h)throw"Nothing to prepare";var t=new a(h,this);null!=m&&t.bind(m);return this.hb[h]=t};c.prototype.iterateStatements=function(h){return new b(h, this)};c.prototype["export"]=function(){Object.values(this.hb).forEach(function(m){m.free()});Object.values(this.Wa).forEach(pa);this.Wa={};this.handleError(l(this.db));var h=qa(this.filename);this.handleError(g(this.filename,d));this.db=q(d,"i32");return h};c.prototype.close=function(){null!==this.db&&(Object.values(this.hb).forEach(function(h){h.free()}),Object.values(this.Wa).forEach(pa),this.Wa={},this.handleError(l(this.db)),ra("/"+this.filename),this.db=null)};c.prototype.handleError=function(h){if(0=== h)return null;h=pc(this.db);throw Error(h);};c.prototype.getRowsModified=function(){return w(this.db)};c.prototype.create_function=function(h,m){Object.prototype.hasOwnProperty.call(this.Wa,h)&&(pa(this.Wa[h]),delete this.Wa[h]);var t=sa(function(r,C,V){for(var H,ka=[],ca=0;ca<C;ca+=1){var E=q(V+4*ca,"i32"),O=Bc(E);if(1===O||2===O)E=Fc(E);else if(3===O)E=Dc(E);else if(4===O){O=E;E=Cc(O);O=Ec(O);for(var xb=new Uint8Array(E),Aa=0;Aa<E;Aa+=1)xb[Aa]=x[O+Aa];E=xb}else E=null;ka.push(E)}try{H=m.apply(null, ka)}catch(Mc){ub(r,Mc,-1);return}switch(typeof H){case "boolean":Jc(r,H?1:0);break;case "number":Gc(r,H);break;case "string":Hc(r,H,-1,-1);break;case "object":null===H?tb(r):null!=H.length?(C=ja(H),Ic(r,C,H.length,-1),la(C)):ub(r,"Wrong API use : tried to return a value of an unknown type ("+H+").",-1);break;default:tb(r)}});this.Wa[h]=t;this.handleError(Ac(this.db,h,m.length,1,0,t,0,0,0));return this};f.Database=c};var ta={},z;for(z in f)f.hasOwnProperty(z)&&(ta[z]=f[z]); var ua="./this.program",va="object"===typeof window,wa="function"===typeof importScripts,xa="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node,A="",ya,za,Ba,Ca,Da; if(xa)A=wa?require("path").dirname(A)+"/":__dirname+"/",ya=function(a,b){Ca||(Ca=require("fs"));Da||(Da=require("path"));a=Da.normalize(a);return Ca.readFileSync(a,b?null:"utf8")},Ba=function(a){a=ya(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a},za=function(a,b,c){Ca||(Ca=require("fs"));Da||(Da=require("path"));a=Da.normalize(a);Ca.readFile(a,function(d,e){d?c(d):b(e.buffer)})},1<process.argv.length&&(ua=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),"undefined"!==typeof module&& (module.exports=f),f.inspect=function(){return"[Emscripten Module object]"};else if(va||wa)wa?A=self.location.href:"undefined"!==typeof document&&document.currentScript&&(A=document.currentScript.src),A=0!==A.indexOf("blob:")?A.substr(0,A.lastIndexOf("/")+1):"",ya=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},wa&&(Ba=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),za= function(a,b,c){var d=new XMLHttpRequest;d.open("GET",a,!0);d.responseType="arraybuffer";d.onload=function(){200==d.status||0==d.status&&d.response?b(d.response):c()};d.onerror=c;d.send(null)};var Ea=f.print||console.log.bind(console),B=f.printErr||console.warn.bind(console);for(z in ta)ta.hasOwnProperty(z)&&(f[z]=ta[z]);ta=null;f.thisProgram&&(ua=f.thisProgram);var Fa=[],Ga;function pa(a){Ga.delete(F.get(a));Fa.push(a)} function sa(a){if(!Ga){Ga=new WeakMap;for(var b=0;b<F.length;b++){var c=F.get(b);c&&Ga.set(c,b)}}if(Ga.has(a))a=Ga.get(a);else{if(Fa.length)b=Fa.pop();else{try{F.grow(1)}catch(g){if(!(g instanceof RangeError))throw g;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";}b=F.length-1}try{F.set(b,a)}catch(g){if(!(g instanceof TypeError))throw g;if("function"===typeof WebAssembly.Function){var d={i:"i32",j:"i64",f:"f32",d:"f64"},e={parameters:[],results:[]};for(c=1;4>c;++c)e.parameters.push(d["viii"[c]]); c=new WebAssembly.Function(e,a)}else{d=[1,0,1,96];e={i:127,j:126,f:125,d:124};d.push(3);for(c=0;3>c;++c)d.push(e["iii"[c]]);d.push(0);d[1]=d.length-2;c=new Uint8Array([0,97,115,109,1,0,0,0].concat(d,[2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0]));c=new WebAssembly.Module(c);c=(new WebAssembly.Instance(c,{e:{f:a}})).exports.f}F.set(b,c)}Ga.set(a,b);a=b}return a}var Ha;f.wasmBinary&&(Ha=f.wasmBinary);var noExitRuntime=f.noExitRuntime||!0;"object"!==typeof WebAssembly&&G("no native wasm support detected"); function na(a){var b="i32";"*"===b.charAt(b.length-1)&&(b="i32");switch(b){case "i1":x[a>>0]=0;break;case "i8":x[a>>0]=0;break;case "i16":Ia[a>>1]=0;break;case "i32":I[a>>2]=0;break;case "i64":K=[0,(L=0,1<=+Math.abs(L)?0<L?(Math.min(+Math.floor(L/4294967296),4294967295)|0)>>>0:~~+Math.ceil((L-+(~~L>>>0))/4294967296)>>>0:0)];I[a>>2]=K[0];I[a+4>>2]=K[1];break;case "float":Ja[a>>2]=0;break;case "double":Ka[a>>3]=0;break;default:G("invalid type for setValue: "+b)}} function q(a,b){b=b||"i8";"*"===b.charAt(b.length-1)&&(b="i32");switch(b){case "i1":return x[a>>0];case "i8":return x[a>>0];case "i16":return Ia[a>>1];case "i32":return I[a>>2];case "i64":return I[a>>2];case "float":return Ja[a>>2];case "double":return Ka[a>>3];default:G("invalid type for getValue: "+b)}return null}var La,Ma=!1;function assert(a,b){a||G("Assertion failed: "+b)}function Na(a){var b=f["_"+a];assert(b,"Cannot call unknown function "+a+", make sure it is exported");return b} function Oa(a,b,c,d){var e={string:function(u){var D=0;if(null!==u&&void 0!==u&&0!==u){var J=(u.length<<2)+1;D=v(J);ea(u,k,D,J)}return D},array:function(u){var D=v(u.length);x.set(u,D);return D}};a=Na(a);var g=[],l=0;if(d)for(var p=0;p<d.length;p++){var w=e[c[p]];w?(0===l&&(l=ma()),g[p]=w(d[p])):g[p]=d[p]}c=a.apply(null,g);return c=function(u){0!==l&&oa(l);return"string"===b?y(u):"boolean"===b?!!u:u}(c)}var Pa=0,Qa=1; function ja(a){var b=Pa==Qa?v(a.length):da(a.length);a.subarray||a.slice?k.set(a,b):k.set(new Uint8Array(a),b);return b}var Ra="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0; function Sa(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16<c-b&&a.subarray&&Ra)return Ra.decode(a.subarray(b,c));for(d="";b<c;){var e=a[b++];if(e&128){var g=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|g);else{var l=a[b++]&63;e=224==(e&240)?(e&15)<<12|g<<6|l:(e&7)<<18|g<<12|l<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d}function y(a,b){return a?Sa(k,a,b):""} function ea(a,b,c,d){if(!(0<d))return 0;var e=c;d=c+d-1;for(var g=0;g<a.length;++g){var l=a.charCodeAt(g);if(55296<=l&&57343>=l){var p=a.charCodeAt(++g);l=65536+((l&1023)<<10)|p&1023}if(127>=l){if(c>=d)break;b[c++]=l}else{if(2047>=l){if(c+1>=d)break;b[c++]=192|l>>6}else{if(65535>=l){if(c+2>=d)break;b[c++]=224|l>>12}else{if(c+3>=d)break;b[c++]=240|l>>18;b[c++]=128|l>>12&63}b[c++]=128|l>>6&63}b[c++]=128|l&63}}b[c]=0;return c-e} function aa(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}function Ta(a){var b=aa(a)+1,c=da(b);c&&ea(a,x,c,b);return c}var Ua,x,k,Ia,I,Ja,Ka; function Va(){var a=La.buffer;Ua=a;f.HEAP8=x=new Int8Array(a);f.HEAP16=Ia=new Int16Array(a);f.HEAP32=I=new Int32Array(a);f.HEAPU8=k=new Uint8Array(a);f.HEAPU16=new Uint16Array(a);f.HEAPU32=new Uint32Array(a);f.HEAPF32=Ja=new Float32Array(a);f.HEAPF64=Ka=new Float64Array(a)}var F,Wa=[],Xa=[],Ya=[];function Za(){var a=f.preRun.shift();Wa.unshift(a)}var $a=0,ab=null,bb=null;f.preloadedImages={};f.preloadedAudios={}; function G(a){if(f.onAbort)f.onAbort(a);B(a);Ma=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function cb(){return M.startsWith("data:application/octet-stream;base64,")}var M;M="sql-wasm.wasm";if(!cb()){var db=M;M=f.locateFile?f.locateFile(db,A):A+db}function eb(){var a=M;try{if(a==M&&Ha)return new Uint8Array(Ha);if(Ba)return Ba(a);throw"both async and sync fetching of the wasm failed";}catch(b){G(b)}} function fb(){if(!Ha&&(va||wa)){if("function"===typeof fetch&&!M.startsWith("file://"))return fetch(M,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+M+"'";return a.arrayBuffer()}).catch(function(){return eb()});if(za)return new Promise(function(a,b){za(M,function(c){a(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return eb()})}var L,K; function gb(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(f);else{var c=b.Ub;"number"===typeof c?void 0===b.ob?F.get(c)():F.get(c)(b.ob):c(void 0===b.ob?null:b.ob)}}}function hb(a){return a.replace(/\b_Z[\w\d_]+/g,function(b){return b===b?b:b+" ["+b+"]"})} function ib(){function a(l){return(l=l.toTimeString().match(/\(([A-Za-z ]+)\)$/))?l[1]:"GMT"}var b=(new Date).getFullYear(),c=new Date(b,0,1),d=new Date(b,6,1);b=c.getTimezoneOffset();var e=d.getTimezoneOffset(),g=Math.max(b,e);I[jb()>>2]=60*g;I[kb()>>2]=Number(b!=e);c=a(c);d=a(d);c=Ta(c);d=Ta(d);e<b?(I[lb()>>2]=c,I[lb()+4>>2]=d):(I[lb()>>2]=d,I[lb()+4>>2]=c)}var mb; function nb(a,b){for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}function N(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=nb(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a} function ob(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function pb(a){if("/"===a)return"/";a=N(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)} function qb(){if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);return function(){crypto.getRandomValues(a);return a[0]}}if(xa)try{var b=require("crypto");return function(){return b.randomBytes(1)[0]}}catch(c){}return function(){G("randomDevice")}} function vb(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=nb(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var wb=[];function yb(a,b){wb[a]={input:[],output:[],cb:b};zb(a,Ab)} var Ab={open:function(a){var b=wb[a.node.rdev];if(!b)throw new P(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.cb.flush(a.tty)},flush:function(a){a.tty.cb.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.cb.Eb)throw new P(60);for(var e=0,g=0;g<d;g++){try{var l=a.tty.cb.Eb(a.tty)}catch(p){throw new P(29);}if(void 0===l&&0===e)throw new P(6);if(null===l||void 0===l)break;e++;b[c+g]=l}e&&(a.node.timestamp=Date.now());return e},write:function(a,b,c,d){if(!a.tty||!a.tty.cb.tb)throw new P(60); try{for(var e=0;e<d;e++)a.tty.cb.tb(a.tty,b[c+e])}catch(g){throw new P(29);}d&&(a.node.timestamp=Date.now());return e}},Bb={Eb:function(a){if(!a.input.length){var b=null;if(xa){var c=Buffer.alloc(256),d=0;try{d=Ca.readSync(process.stdin.fd,c,0,256,null)}catch(e){if(e.toString().includes("EOF"))d=0;else throw e;}0<d?b=c.slice(0,d).toString("utf-8"):b=null}else"undefined"!=typeof window&&"function"==typeof window.prompt?(b=window.prompt("Input: "),null!==b&&(b+="\n")):"function"==typeof readline&&(b= readline(),null!==b&&(b+="\n"));if(!b)return null;a.input=ia(b,!0)}return a.input.shift()},tb:function(a,b){null===b||10===b?(Ea(Sa(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(Ea(Sa(a.output,0)),a.output=[])}},Cb={tb:function(a,b){null===b||10===b?(B(Sa(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(B(Sa(a.output,0)),a.output=[])}}; function Db(a){a=65536*Math.ceil(a/65536);var b=Eb(65536,a);if(!b)return 0;k.fill(0,b,b+a);return b} var Q={Va:null,Ua:function(){return Q.createNode(null,"/",16895,0)},createNode:function(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new P(63);Q.Va||(Q.Va={dir:{node:{Ta:Q.La.Ta,Sa:Q.La.Sa,lookup:Q.La.lookup,fb:Q.La.fb,rename:Q.La.rename,unlink:Q.La.unlink,rmdir:Q.La.rmdir,readdir:Q.La.readdir,symlink:Q.La.symlink},stream:{Xa:Q.Ma.Xa}},file:{node:{Ta:Q.La.Ta,Sa:Q.La.Sa},stream:{Xa:Q.Ma.Xa,read:Q.Ma.read,write:Q.Ma.write,vb:Q.Ma.vb,ib:Q.Ma.ib,jb:Q.Ma.jb}},link:{node:{Ta:Q.La.Ta,Sa:Q.La.Sa, readlink:Q.La.readlink},stream:{}},Ab:{node:{Ta:Q.La.Ta,Sa:Q.La.Sa},stream:Fb}});c=Gb(a,b,c,d);R(c.mode)?(c.La=Q.Va.dir.node,c.Ma=Q.Va.dir.stream,c.Na={}):32768===(c.mode&61440)?(c.La=Q.Va.file.node,c.Ma=Q.Va.file.stream,c.Ra=0,c.Na=null):40960===(c.mode&61440)?(c.La=Q.Va.link.node,c.Ma=Q.Va.link.stream):8192===(c.mode&61440)&&(c.La=Q.Va.Ab.node,c.Ma=Q.Va.Ab.stream);c.timestamp=Date.now();a&&(a.Na[b]=c,a.timestamp=c.timestamp);return c},Vb:function(a){return a.Na?a.Na.subarray?a.Na.subarray(0,a.Ra): new Uint8Array(a.Na):new Uint8Array(0)},Bb:function(a,b){var c=a.Na?a.Na.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Na,a.Na=new Uint8Array(b),0<a.Ra&&a.Na.set(c.subarray(0,a.Ra),0))},Rb:function(a,b){if(a.Ra!=b)if(0==b)a.Na=null,a.Ra=0;else{var c=a.Na;a.Na=new Uint8Array(b);c&&a.Na.set(c.subarray(0,Math.min(b,a.Ra)));a.Ra=b}},La:{Ta:function(a){var b={};b.dev=8192===(a.mode&61440)?a.id:1;b.ino=a.id;b.mode=a.mode;b.nlink=1;b.uid=0;b.gid=0;b.rdev=a.rdev;R(a.mode)? b.size=4096:32768===(a.mode&61440)?b.size=a.Ra:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.atime=new Date(a.timestamp);b.mtime=new Date(a.timestamp);b.ctime=new Date(a.timestamp);b.zb=4096;b.blocks=Math.ceil(b.size/b.zb);return b},Sa:function(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&(a.timestamp=b.timestamp);void 0!==b.size&&Q.Rb(a,b.size)},lookup:function(){throw Hb[44];},fb:function(a,b,c,d){return Q.createNode(a,b,c,d)},rename:function(a,b,c){if(R(a.mode)){try{var d= Ib(b,c)}catch(g){}if(d)for(var e in d.Na)throw new P(55);}delete a.parent.Na[a.name];a.parent.timestamp=Date.now();a.name=c;b.Na[c]=a;b.timestamp=a.parent.timestamp;a.parent=b},unlink:function(a,b){delete a.Na[b];a.timestamp=Date.now()},rmdir:function(a,b){var c=Ib(a,b),d;for(d in c.Na)throw new P(55);delete a.Na[b];a.timestamp=Date.now()},readdir:function(a){var b=[".",".."],c;for(c in a.Na)a.Na.hasOwnProperty(c)&&b.push(c);return b},symlink:function(a,b,c){a=Q.createNode(a,b,41471,0);a.link=c;return a}, readlink:function(a){if(40960!==(a.mode&61440))throw new P(28);return a.link}},Ma:{read:function(a,b,c,d,e){var g=a.node.Na;if(e>=a.node.Ra)return 0;a=Math.min(a.node.Ra-e,d);if(8<a&&g.subarray)b.set(g.subarray(e,e+a),c);else for(d=0;d<a;d++)b[c+d]=g[e+d];return a},write:function(a,b,c,d,e,g){b.buffer===x.buffer&&(g=!1);if(!d)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.Na||a.Na.subarray)){if(g)return a.Na=b.subarray(c,c+d),a.Ra=d;if(0===a.Ra&&0===e)return a.Na=b.slice(c,c+d),a.Ra= d;if(e+d<=a.Ra)return a.Na.set(b.subarray(c,c+d),e),d}Q.Bb(a,e+d);if(a.Na.subarray&&b.subarray)a.Na.set(b.subarray(c,c+d),e);else for(g=0;g<d;g++)a.Na[e+g]=b[c+g];a.Ra=Math.max(a.Ra,e+d);return d},Xa:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Ra);if(0>b)throw new P(28);return b},vb:function(a,b,c){Q.Bb(a.node,b+c);a.node.Ra=Math.max(a.node.Ra,b+c)},ib:function(a,b,c,d,e,g){if(0!==b)throw new P(28);if(32768!==(a.node.mode&61440))throw new P(43);a=a.node.Na;if(g& 2||a.buffer!==Ua){if(0<d||d+c<a.length)a.subarray?a=a.subarray(d,d+c):a=Array.prototype.slice.call(a,d,d+c);d=!0;c=Db(c);if(!c)throw new P(48);x.set(a,c)}else d=!1,c=a.byteOffset;return{Qb:c,mb:d}},jb:function(a,b,c,d,e){if(32768!==(a.node.mode&61440))throw new P(43);if(e&2)return 0;Q.Ma.write(a,b,0,d,c,!1);return 0}}},n={lb:16895,Za:33279,gb:null,Ua:function(a){function b(g){g=g.split("/");for(var l=d,p=0;p<g.length-1;p++){var w=g.slice(0,p+1).join("/");e[w]||(e[w]=n.createNode(l,g[p],n.lb,0));l= e[w]}return l}function c(g){g=g.split("/");return g[g.length-1]}assert(wa);n.gb||(n.gb=new FileReaderSync);var d=n.createNode(null,"/",n.lb,0),e={};Array.prototype.forEach.call(a.sb.files||[],function(g){n.createNode(b(g.name),c(g.name),n.Za,0,g,g.lastModifiedDate)});(a.sb.blobs||[]).forEach(function(g){n.createNode(b(g.name),c(g.name),n.Za,0,g.data)});(a.sb.packages||[]).forEach(function(g){g.metadata.files.forEach(function(l){var p=l.filename.substr(1);n.createNode(b(p),c(p),n.Za,0,g.blob.slice(l.start, l.end))})});return d},createNode:function(a,b,c,d,e,g){d=Gb(a,b,c);d.mode=c;d.La=n.La;d.Ma=n.Ma;d.timestamp=(g||new Date).getTime();assert(n.Za!==n.lb);c===n.Za?(d.size=e.size,d.Na=e):(d.size=4096,d.Na={});a&&(a.Na[b]=d);return d},La:{Ta:function(a){return{dev:1,ino:a.id,mode:a.mode,nlink:1,uid:0,gid:0,rdev:void 0,size:a.size,atime:new Date(a.timestamp),mtime:new Date(a.timestamp),ctime:new Date(a.timestamp),zb:4096,blocks:Math.ceil(a.size/4096)}},Sa:function(a,b){void 0!==b.mode&&(a.mode=b.mode); void 0!==b.timestamp&&(a.timestamp=b.timestamp)},lookup:function(){throw new P(44);},fb:function(){throw new P(63);},rename:function(){throw new P(63);},unlink:function(){throw new P(63);},rmdir:function(){throw new P(63);},readdir:function(a){var b=[".",".."],c;for(c in a.Na)a.Na.hasOwnProperty(c)&&b.push(c);return b},symlink:function(){throw new P(63);},readlink:function(){throw new P(63);}},Ma:{read:function(a,b,c,d,e){if(e>=a.node.size)return 0;a=a.node.Na.slice(e,e+d);d=n.gb.readAsArrayBuffer(a); b.set(new Uint8Array(d),c);return a.size},write:function(){throw new P(29);},Xa:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.size);if(0>b)throw new P(28);return b}}},ha=null,Jb={},S=[],Kb=1,T=null,Lb=!0,U={},P=null,Hb={}; function W(a,b){a=vb("/",a);b=b||{};if(!a)return{path:"",node:null};var c={Cb:!0,ub:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);if(8<b.ub)throw new P(32);a=nb(a.split("/").filter(function(l){return!!l}),!1);var e=ha;c="/";for(d=0;d<a.length;d++){var g=d===a.length-1;if(g&&b.parent)break;e=Ib(e,a[d]);c=N(c+"/"+a[d]);e.ab&&(!g||g&&b.Cb)&&(e=e.ab.root);if(!g||b.Ya)for(g=0;40960===(e.mode&61440);)if(e=Mb(c),c=vb(ob(c),e),e=W(c,{ub:b.ub}).node,40<g++)throw new P(32);}return{path:c,node:e}} function Nb(a){for(var b;;){if(a===a.parent)return a=a.Ua.Fb,b?"/"!==a[a.length-1]?a+"/"+b:a+b:a;b=b?a.name+"/"+b:a.name;a=a.parent}}function Ob(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%T.length}function Pb(a){var b=Ob(a.parent.id,a.name);if(T[b]===a)T[b]=a.bb;else for(b=T[b];b;){if(b.bb===a){b.bb=a.bb;break}b=b.bb}} function Ib(a,b){var c;if(c=(c=Qb(a,"x"))?c:a.La.lookup?0:2)throw new P(c,a);for(c=T[Ob(a.id,b)];c;c=c.bb){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.La.lookup(a,b)}function Gb(a,b,c,d){a=new Rb(a,b,c,d);b=Ob(a.parent.id,a.name);a.bb=T[b];return T[b]=a}function R(a){return 16384===(a&61440)}var Sb={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090};function Tb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b} function Qb(a,b){if(Lb)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function Ub(a,b){try{return Ib(a,b),20}catch(c){}return Qb(a,"wx")}function Vb(a,b,c){try{var d=Ib(a,b)}catch(e){return e.Pa}if(a=Qb(a,"wx"))return a;if(c){if(!R(d.mode))return 54;if(d===d.parent||"/"===Nb(d))return 10}else if(R(d.mode))return 31;return 0}function Wb(a){var b=4096;for(a=a||0;a<=b;a++)if(!S[a])return a;throw new P(33);} function Xb(a,b){Yb||(Yb=function(){},Yb.prototype={});var c=new Yb,d;for(d in a)c[d]=a[d];a=c;b=Wb(b);a.fd=b;return S[b]=a}var Fb={open:function(a){a.Ma=Jb[a.node.rdev].Ma;a.Ma.open&&a.Ma.open(a)},Xa:function(){throw new P(70);}};function zb(a,b){Jb[a]={Ma:b}} function Zb(a,b){var c="/"===b,d=!b;if(c&&ha)throw new P(10);if(!c&&!d){var e=W(b,{Cb:!1});b=e.path;e=e.node;if(e.ab)throw new P(10);if(!R(e.mode))throw new P(54);}b={type:a,sb:{},Fb:b,Ob:[]};a=a.Ua(b);a.Ua=b;b.root=a;c?ha=a:e&&(e.ab=b,e.Ua&&e.Ua.Ob.push(b))}function $b(a,b,c){var d=W(a,{parent:!0}).node;a=pb(a);if(!a||"."===a||".."===a)throw new P(28);var e=Ub(d,a);if(e)throw new P(e);if(!d.La.fb)throw new P(63);return d.La.fb(d,a,b,c)} function X(a,b){return $b(a,(void 0!==b?b:511)&1023|16384,0)}function ac(a,b,c){"undefined"===typeof c&&(c=b,b=438);$b(a,b|8192,c)}function bc(a,b){if(!vb(a))throw new P(44);var c=W(b,{parent:!0}).node;if(!c)throw new P(44);b=pb(b);var d=Ub(c,b);if(d)throw new P(d);if(!c.La.symlink)throw new P(63);c.La.symlink(c,b,a)} function ra(a){var b=W(a,{parent:!0}).node,c=pb(a),d=Ib(b,c),e=Vb(b,c,!1);if(e)throw new P(e);if(!b.La.unlink)throw new P(63);if(d.ab)throw new P(10);try{U.willDeletePath&&U.willDeletePath(a)}catch(g){B("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+g.message)}b.La.unlink(b,c);Pb(d);try{if(U.onDeletePath)U.onDeletePath(a)}catch(g){B("FS.trackingDelegate['onDeletePath']('"+a+"') threw an exception: "+g.message)}} function Mb(a){a=W(a).node;if(!a)throw new P(44);if(!a.La.readlink)throw new P(28);return vb(Nb(a.parent),a.La.readlink(a))}function cc(a,b){a=W(a,{Ya:!b}).node;if(!a)throw new P(44);if(!a.La.Ta)throw new P(63);return a.La.Ta(a)}function dc(a){return cc(a,!0)}function ec(a,b){a="string"===typeof a?W(a,{Ya:!0}).node:a;if(!a.La.Sa)throw new P(63);a.La.Sa(a,{mode:b&4095|a.mode&-4096,timestamp:Date.now()})} function fc(a){a="string"===typeof a?W(a,{Ya:!0}).node:a;if(!a.La.Sa)throw new P(63);a.La.Sa(a,{timestamp:Date.now()})}function gc(a,b){if(0>b)throw new P(28);a="string"===typeof a?W(a,{Ya:!0}).node:a;if(!a.La.Sa)throw new P(63);if(R(a.mode))throw new P(31);if(32768!==(a.mode&61440))throw new P(28);var c=Qb(a,"w");if(c)throw new P(c);a.La.Sa(a,{size:b,timestamp:Date.now()})} function hc(a,b,c,d){if(""===a)throw new P(44);if("string"===typeof b){var e=Sb[b];if("undefined"===typeof e)throw Error("Unknown file open mode: "+b);b=e}c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;if("object"===typeof a)var g=a;else{a=N(a);try{g=W(a,{Ya:!(b&131072)}).node}catch(l){}}e=!1;if(b&64)if(g){if(b&128)throw new P(20);}else g=$b(a,c,0),e=!0;if(!g)throw new P(44);8192===(g.mode&61440)&&(b&=-513);if(b&65536&&!R(g.mode))throw new P(54);if(!e&&(c=g?40960===(g.mode&61440)?32:R(g.mode)&& ("r"!==Tb(b)||b&512)?31:Qb(g,Tb(b)):44))throw new P(c);b&512&&gc(g,0);b&=-131713;d=Xb({node:g,path:Nb(g),flags:b,seekable:!0,position:0,Ma:g.Ma,Tb:[],error:!1},d);d.Ma.open&&d.Ma.open(d);!f.logReadFiles||b&1||(ic||(ic={}),a in ic||(ic[a]=1,B("FS.trackingDelegate error on read file: "+a)));try{U.onOpenFile&&(g=0,1!==(b&2097155)&&(g|=1),0!==(b&2097155)&&(g|=2),U.onOpenFile(a,g))}catch(l){B("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+l.message)}return d} function Kc(a){if(null===a.fd)throw new P(8);a.qb&&(a.qb=null);try{a.Ma.close&&a.Ma.close(a)}catch(b){throw b;}finally{S[a.fd]=null}a.fd=null}function Lc(a,b,c){if(null===a.fd)throw new P(8);if(!a.seekable||!a.Ma.Xa)throw new P(70);if(0!=c&&1!=c&&2!=c)throw new P(28);a.position=a.Ma.Xa(a,b,c);a.Tb=[]} function Nc(a,b,c,d,e){if(0>d||0>e)throw new P(28);if(null===a.fd)throw new P(8);if(1===(a.flags&2097155))throw new P(8);if(R(a.node.mode))throw new P(31);if(!a.Ma.read)throw new P(28);var g="undefined"!==typeof e;if(!g)e=a.position;else if(!a.seekable)throw new P(70);b=a.Ma.read(a,b,c,d,e);g||(a.position+=b);return b} function Oc(a,b,c,d,e,g){if(0>d||0>e)throw new P(28);if(null===a.fd)throw new P(8);if(0===(a.flags&2097155))throw new P(8);if(R(a.node.mode))throw new P(31);if(!a.Ma.write)throw new P(28);a.seekable&&a.flags&1024&&Lc(a,0,2);var l="undefined"!==typeof e;if(!l)e=a.position;else if(!a.seekable)throw new P(70);b=a.Ma.write(a,b,c,d,e,g);l||(a.position+=b);try{if(a.path&&U.onWriteToFile)U.onWriteToFile(a.path)}catch(p){B("FS.trackingDelegate['onWriteToFile']('"+a.path+"') threw an exception: "+p.message)}return b} function qa(a){var b={encoding:"binary"};b=b||{};b.flags=b.flags||0;b.encoding=b.encoding||"binary";if("utf8"!==b.encoding&&"binary"!==b.encoding)throw Error('Invalid encoding type "'+b.encoding+'"');var c,d=hc(a,b.flags);a=cc(a).size;var e=new Uint8Array(a);Nc(d,e,0,a,0);"utf8"===b.encoding?c=Sa(e,0):"binary"===b.encoding&&(c=e);Kc(d);return c} function Pc(){P||(P=function(a,b){this.node=b;this.Sb=function(c){this.Pa=c};this.Sb(a);this.message="FS error"},P.prototype=Error(),P.prototype.constructor=P,[44].forEach(function(a){Hb[a]=new P(a);Hb[a].stack="<generic error, no stack>"}))}var Qc;function Rc(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c} function fa(a,b){var c=a?N("//"+a):"/";a=Rc(!0,!0);c=$b(c,(void 0!==a?a:438)&4095|32768,0);if(b){if("string"===typeof b){for(var d=Array(b.length),e=0,g=b.length;e<g;++e)d[e]=b.charCodeAt(e);b=d}ec(c,a|146);d=hc(c,577);Oc(d,b,0,b.length,0,void 0);Kc(d);ec(c,a)}} function Sc(a,b,c){a=N("/dev/"+a);var d=Rc(!!b,!!c);Tc||(Tc=64);var e=Tc++<<8|0;zb(e,{open:function(g){g.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(g,l,p,w){for(var u=0,D=0;D<w;D++){try{var J=b()}catch(ba){throw new P(29);}if(void 0===J&&0===u)throw new P(6);if(null===J||void 0===J)break;u++;l[p+D]=J}u&&(g.node.timestamp=Date.now());return u},write:function(g,l,p,w){for(var u=0;u<w;u++)try{c(l[p+u])}catch(D){throw new P(29);}w&&(g.node.timestamp=Date.now());return u}}); ac(a,d,e)}var Tc,Y={},Yb,ic,Uc={}; function Vc(a,b,c){try{var d=a(b)}catch(e){if(e&&e.node&&N(b)!==N(Nb(e.node)))return-54;throw e;}I[c>>2]=d.dev;I[c+4>>2]=0;I[c+8>>2]=d.ino;I[c+12>>2]=d.mode;I[c+16>>2]=d.nlink;I[c+20>>2]=d.uid;I[c+24>>2]=d.gid;I[c+28>>2]=d.rdev;I[c+32>>2]=0;K=[d.size>>>0,(L=d.size,1<=+Math.abs(L)?0<L?(Math.min(+Math.floor(L/4294967296),4294967295)|0)>>>0:~~+Math.ceil((L-+(~~L>>>0))/4294967296)>>>0:0)];I[c+40>>2]=K[0];I[c+44>>2]=K[1];I[c+48>>2]=4096;I[c+52>>2]=d.blocks;I[c+56>>2]=d.atime.getTime()/1E3|0;I[c+60>>2]= 0;I[c+64>>2]=d.mtime.getTime()/1E3|0;I[c+68>>2]=0;I[c+72>>2]=d.ctime.getTime()/1E3|0;I[c+76>>2]=0;K=[d.ino>>>0,(L=d.ino,1<=+Math.abs(L)?0<L?(Math.min(+Math.floor(L/4294967296),4294967295)|0)>>>0:~~+Math.ceil((L-+(~~L>>>0))/4294967296)>>>0:0)];I[c+80>>2]=K[0];I[c+84>>2]=K[1];return 0}var Wc=void 0;function Xc(){Wc+=4;return I[Wc-4>>2]}function Z(a){a=S[a];if(!a)throw new P(8);return a}var Yc;Yc=xa?function(){var a=process.hrtime();return 1E3*a[0]+a[1]/1E6}:function(){return performance.now()}; var Zc={};function $c(){if(!ad){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ua||"./this.program"},b;for(b in Zc)void 0===Zc[b]?delete a[b]:a[b]=Zc[b];var c=[];for(b in a)c.push(b+"="+a[b]);ad=c}return ad}var ad; function Rb(a,b,c,d){a||(a=this);this.parent=a;this.Ua=a.Ua;this.ab=null;this.id=Kb++;this.name=b;this.mode=c;this.La={};this.Ma={};this.rdev=d}Object.defineProperties(Rb.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});Pc();T=Array(4096);Zb(Q,"/");X("/tmp");X("/home");X("/home/web_user"); (function(){X("/dev");zb(259,{read:function(){return 0},write:function(b,c,d,e){return e}});ac("/dev/null",259);yb(1280,Bb);yb(1536,Cb);ac("/dev/tty",1280);ac("/dev/tty1",1536);var a=qb();Sc("random",a);Sc("urandom",a);X("/dev/shm");X("/dev/shm/tmp")})(); (function(){X("/proc");var a=X("/proc/self");X("/proc/self/fd");Zb({Ua:function(){var b=Gb(a,"fd",16895,73);b.La={lookup:function(c,d){var e=S[+d];if(!e)throw new P(8);c={parent:null,Ua:{Fb:"fake"},La:{readlink:function(){return e.path}}};return c.parent=c}};return b}},"/proc/self/fd")})();function ia(a,b){var c=Array(aa(a)+1);a=ea(a,c,0,c.length);b&&(c.length=a);return c} var cd={a:function(a,b,c,d){G("Assertion failed: "+y(a)+", at: "+[b?y(b):"unknown filename",c,d?y(d):"unknown function"])},r:function(a,b){mb||(mb=!0,ib());a=new Date(1E3*I[a>>2]);I[b>>2]=a.getSeconds();I[b+4>>2]=a.getMinutes();I[b+8>>2]=a.getHours();I[b+12>>2]=a.getDate();I[b+16>>2]=a.getMonth();I[b+20>>2]=a.getFullYear()-1900;I[b+24>>2]=a.getDay();var c=new Date(a.getFullYear(),0,1);I[b+28>>2]=(a.getTime()-c.getTime())/864E5|0;I[b+36>>2]=-(60*a.getTimezoneOffset());var d=(new Date(a.getFullYear(), 6,1)).getTimezoneOffset();c=c.getTimezoneOffset();a=(d!=c&&a.getTimezoneOffset()==Math.min(c,d))|0;I[b+32>>2]=a;a=I[lb()+(a?4:0)>>2];I[b+40>>2]=a;return b},D:function(a,b){try{a=y(a);if(b&-8)var c=-28;else{var d;(d=W(a,{Ya:!0}).node)?(a="",b&4&&(a+="r"),b&2&&(a+="w"),b&1&&(a+="x"),c=a&&Qb(d,a)?-2:0):c=-44}return c}catch(e){return"undefined"!==typeof Y&&e instanceof P||G(e),-e.Pa}},I:function(a,b){try{return a=y(a),ec(a,b),0}catch(c){return"undefined"!==typeof Y&&c instanceof P||G(c),-c.Pa}},x:function(a){try{return a= y(a),fc(a),0}catch(b){return"undefined"!==typeof Y&&b instanceof P||G(b),-b.Pa}},J:function(a,b){try{var c=S[a];if(!c)throw new P(8);ec(c.node,b);return 0}catch(d){return"undefined"!==typeof Y&&d instanceof P||G(d),-d.Pa}},y:function(a){try{var b=S[a];if(!b)throw new P(8);fc(b.node);return 0}catch(c){return"undefined"!==typeof Y&&c instanceof P||G(c),-c.Pa}},b:function(a,b,c){Wc=c;try{var d=Z(a);switch(b){case 0:var e=Xc();return 0>e?-28:hc(d.path,d.flags,0,e).fd;case 1:case 2:return 0;case 3:return d.flags; case 4:return e=Xc(),d.flags|=e,0;case 12:return e=Xc(),Ia[e+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return I[bd()>>2]=28,-1;default:return-28}}catch(g){return"undefined"!==typeof Y&&g instanceof P||G(g),-g.Pa}},G:function(a,b){try{var c=Z(a);return Vc(cc,c.path,b)}catch(d){return"undefined"!==typeof Y&&d instanceof P||G(d),-d.Pa}},E:function(a,b,c){try{var d=S[a];if(!d)throw new P(8);if(0===(d.flags&2097155))throw new P(28);gc(d.node,c);return 0}catch(e){return"undefined"!== typeof Y&&e instanceof P||G(e),-e.Pa}},B:function(a,b){try{if(0===b)return-28;if(b<aa("/")+1)return-68;ea("/",k,a,b);return a}catch(c){return"undefined"!==typeof Y&&c instanceof P||G(c),-c.Pa}},F:function(){return 0},d:function(){return 42},H:function(a,b){try{return a=y(a),Vc(dc,a,b)}catch(c){return"undefined"!==typeof Y&&c instanceof P||G(c),-c.Pa}},h:function(a,b){try{return a=y(a),a=N(a),"/"===a[a.length-1]&&(a=a.substr(0,a.length-1)),X(a,b),0}catch(c){return"undefined"!==typeof Y&&c instanceof P||G(c),-c.Pa}},k:function(a,b,c,d,e,g){try{a:{g<<=12;var l=!1;if(0!==(d&16)&&0!==a%65536)var p=-28;else{if(0!==(d&32)){var w=Db(b);if(!w){p=-48;break a}l=!0}else{var u=S[e];if(!u){p=-8;break a}var D=g;if(0!==(c&2)&&0===(d&2)&&2!==(u.flags&2097155))throw new P(2);if(1===(u.flags&2097155))throw new P(2);if(!u.Ma.ib)throw new P(43);var J=u.Ma.ib(u,a,b,D,c,d);w=J.Qb;l=J.mb}Uc[w]={Nb:w,Mb:b,mb:l,fd:e,Pb:c,flags:d,offset:g};p=w}}return p}catch(ba){return"undefined"!==typeof Y&&ba instanceof P||G(ba),-ba.Pa}}, j:function(a,b){try{var c=Uc[a];if(0!==b&&c){if(b===c.Mb){var d=S[c.fd];if(d&&c.Pb&2){var e=c.flags,g=c.offset,l=k.slice(a,a+b);d&&d.Ma.jb&&d.Ma.jb(d,l,g,b,e)}Uc[a]=null;c.mb&&la(c.Nb)}var p=0}else p=-28;return p}catch(w){return"undefined"!==typeof Y&&w instanceof P||G(w),-w.Pa}},i:function(a,b,c){Wc=c;try{var d=y(a),e=c?Xc():0;return hc(d,b,e).fd}catch(g){return"undefined"!==typeof Y&&g instanceof P||G(g),-g.Pa}},u:function(a,b,c){try{a=y(a);if(0>=c)var d=-28;else{var e=Mb(a),g=Math.min(c,aa(e)), l=x[b+g];ea(e,k,b,c+1);x[b+g]=l;d=g}return d}catch(p){return"undefined"!==typeof Y&&p instanceof P||G(p),-p.Pa}},v:function(a){try{a=y(a);var b=W(a,{parent:!0}).node,c=pb(a),d=Ib(b,c),e=Vb(b,c,!0);if(e)throw new P(e);if(!b.La.rmdir)throw new P(63);if(d.ab)throw new P(10);try{U.willDeletePath&&U.willDeletePath(a)}catch(g){B("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+g.message)}b.La.rmdir(b,c);Pb(d);try{if(U.onDeletePath)U.onDeletePath(a)}catch(g){B("FS.trackingDelegate['onDeletePath']('"+ a+"') threw an exception: "+g.message)}return 0}catch(g){return"undefined"!==typeof Y&&g instanceof P||G(g),-g.Pa}},f:function(a,b){try{return a=y(a),Vc(cc,a,b)}catch(c){return"undefined"!==typeof Y&&c instanceof P||G(c),-c.Pa}},w:function(a){try{return a=y(a),ra(a),0}catch(b){return"undefined"!==typeof Y&&b instanceof P||G(b),-b.Pa}},s:function(){return 2147483648},m:function(a,b,c){k.copyWithin(a,b,b+c)},c:function(a){var b=k.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b* (1+.2/c);d=Math.min(d,a+100663296);d=Math.max(a,d);0<d%65536&&(d+=65536-d%65536);a:{try{La.grow(Math.min(2147483648,d)-Ua.byteLength+65535>>>16);Va();var e=1;break a}catch(g){}e=void 0}if(e)return!0}return!1},q:function(a){for(var b=Yc();Yc()-b<a;);},o:function(a,b){var c=0;$c().forEach(function(d,e){var g=b+c;e=I[a+4*e>>2]=g;for(g=0;g<d.length;++g)x[e++>>0]=d.charCodeAt(g);x[e>>0]=0;c+=d.length+1});return 0},p:function(a,b){var c=$c();I[a>>2]=c.length;var d=0;c.forEach(function(e){d+=e.length+1}); I[b>>2]=d;return 0},e:function(a){try{var b=Z(a);Kc(b);return 0}catch(c){return"undefined"!==typeof Y&&c instanceof P||G(c),c.Pa}},n:function(a,b){try{var c=Z(a);x[b>>0]=c.tty?2:R(c.mode)?3:40960===(c.mode&61440)?7:4;return 0}catch(d){return"undefined"!==typeof Y&&d instanceof P||G(d),d.Pa}},C:function(a,b,c,d){try{a:{for(var e=Z(a),g=a=0;g<c;g++){var l=I[b+(8*g+4)>>2],p=Nc(e,x,I[b+8*g>>2],l,void 0);if(0>p){var w=-1;break a}a+=p;if(p<l)break}w=a}I[d>>2]=w;return 0}catch(u){return"undefined"!==typeof Y&& u instanceof P||G(u),u.Pa}},l:function(a,b,c,d,e){try{var g=Z(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;Lc(g,a,d);K=[g.position>>>0,(L=g.position,1<=+Math.abs(L)?0<L?(Math.min(+Math.floor(L/4294967296),4294967295)|0)>>>0:~~+Math.ceil((L-+(~~L>>>0))/4294967296)>>>0:0)];I[e>>2]=K[0];I[e+4>>2]=K[1];g.qb&&0===a&&0===d&&(g.qb=null);return 0}catch(l){return"undefined"!==typeof Y&&l instanceof P||G(l),l.Pa}},z:function(a){try{var b=Z(a);return b.Ma&&b.Ma.fsync?-b.Ma.fsync(b): 0}catch(c){return"undefined"!==typeof Y&&c instanceof P||G(c),c.Pa}},t:function(a,b,c,d){try{a:{for(var e=Z(a),g=a=0;g<c;g++){var l=Oc(e,x,I[b+8*g>>2],I[b+(8*g+4)>>2],void 0);if(0>l){var p=-1;break a}a+=l}p=a}I[d>>2]=p;return 0}catch(w){return"undefined"!==typeof Y&&w instanceof P||G(w),w.Pa}},g:function(a){var b=Date.now();I[a>>2]=b/1E3|0;I[a+4>>2]=b%1E3*1E3|0;return 0},K:function(a){var b=Date.now()/1E3|0;a&&(I[a>>2]=b);return b},A:function(a,b){if(b){var c=b+8;b=1E3*I[c>>2];b+=I[c+4>>2]/1E3}else b= Date.now();a=y(a);try{var d=W(a,{Ya:!0}).node;d.La.Sa(d,{timestamp:Math.max(b,b)});var e=0}catch(g){if(!(g instanceof P)){b:{e=Error();if(!e.stack){try{throw Error();}catch(l){e=l}if(!e.stack){e="(no stack trace available)";break b}}e=e.stack.toString()}f.extraStackTrace&&(e+="\n"+f.extraStackTrace());e=hb(e);throw g+" : "+e;}e=g.Pa;I[bd()>>2]=e;e=-1}return e}}; (function(){function a(e){f.asm=e.exports;La=f.asm.L;Va();F=f.asm.Ca;Xa.unshift(f.asm.M);$a--;f.monitorRunDependencies&&f.monitorRunDependencies($a);0==$a&&(null!==ab&&(clearInterval(ab),ab=null),bb&&(e=bb,bb=null,e()))}function b(e){a(e.instance)}function c(e){return fb().then(function(g){return WebAssembly.instantiate(g,d)}).then(function(g){return g}).then(e,function(g){B("failed to asynchronously prepare wasm: "+g);G(g)})}var d={a:cd};$a++;f.monitorRunDependencies&&f.monitorRunDependencies($a); if(f.instantiateWasm)try{return f.instantiateWasm(d,a)}catch(e){return B("Module.instantiateWasm callback failed with error: "+e),!1}(function(){return Ha||"function"!==typeof WebAssembly.instantiateStreaming||cb()||M.startsWith("file://")||"function"!==typeof fetch?c(b):fetch(M,{credentials:"same-origin"}).then(function(e){return WebAssembly.instantiateStreaming(e,d).then(b,function(g){B("wasm streaming compile failed: "+g);B("falling back to ArrayBuffer instantiation");return c(b)})})})();return{}})(); f.___wasm_call_ctors=function(){return(f.___wasm_call_ctors=f.asm.M).apply(null,arguments)};f._sqlite3_free=function(){return(f._sqlite3_free=f.asm.N).apply(null,arguments)};var bd=f.___errno_location=function(){return(bd=f.___errno_location=f.asm.O).apply(null,arguments)};f._sqlite3_step=function(){return(f._sqlite3_step=f.asm.P).apply(null,arguments)};f._sqlite3_finalize=function(){return(f._sqlite3_finalize=f.asm.Q).apply(null,arguments)}; f._sqlite3_prepare_v2=function(){return(f._sqlite3_prepare_v2=f.asm.R).apply(null,arguments)};f._sqlite3_reset=function(){return(f._sqlite3_reset=f.asm.S).apply(null,arguments)};f._sqlite3_clear_bindings=function(){return(f._sqlite3_clear_bindings=f.asm.T).apply(null,arguments)};f._sqlite3_value_blob=function(){return(f._sqlite3_value_blob=f.asm.U).apply(null,arguments)};f._sqlite3_value_text=function(){return(f._sqlite3_value_text=f.asm.V).apply(null,arguments)}; f._sqlite3_value_bytes=function(){return(f._sqlite3_value_bytes=f.asm.W).apply(null,arguments)};f._sqlite3_value_double=function(){return(f._sqlite3_value_double=f.asm.X).apply(null,arguments)};f._sqlite3_value_int=function(){return(f._sqlite3_value_int=f.asm.Y).apply(null,arguments)};f._sqlite3_value_type=function(){return(f._sqlite3_value_type=f.asm.Z).apply(null,arguments)};f._sqlite3_result_blob=function(){return(f._sqlite3_result_blob=f.asm._).apply(null,arguments)}; f._sqlite3_result_double=function(){return(f._sqlite3_result_double=f.asm.$).apply(null,arguments)};f._sqlite3_result_error=function(){return(f._sqlite3_result_error=f.asm.aa).apply(null,arguments)};f._sqlite3_result_int=function(){return(f._sqlite3_result_int=f.asm.ba).apply(null,arguments)};f._sqlite3_result_int64=function(){return(f._sqlite3_result_int64=f.asm.ca).apply(null,arguments)};f._sqlite3_result_null=function(){return(f._sqlite3_result_null=f.asm.da).apply(null,arguments)}; f._sqlite3_result_text=function(){return(f._sqlite3_result_text=f.asm.ea).apply(null,arguments)};f._sqlite3_column_count=function(){return(f._sqlite3_column_count=f.asm.fa).apply(null,arguments)};f._sqlite3_data_count=function(){return(f._sqlite3_data_count=f.asm.ga).apply(null,arguments)};f._sqlite3_column_blob=function(){return(f._sqlite3_column_blob=f.asm.ha).apply(null,arguments)};f._sqlite3_column_bytes=function(){return(f._sqlite3_column_bytes=f.asm.ia).apply(null,arguments)}; f._sqlite3_column_double=function(){return(f._sqlite3_column_double=f.asm.ja).apply(null,arguments)};f._sqlite3_column_text=function(){return(f._sqlite3_column_text=f.asm.ka).apply(null,arguments)};f._sqlite3_column_type=function(){return(f._sqlite3_column_type=f.