diff --git a/src/pages/create.tsx b/src/pages/create.tsx index 0c6be3a..faa48f2 100644 --- a/src/pages/create.tsx +++ b/src/pages/create.tsx @@ -35,6 +35,8 @@ import styles from "./index.module.css"; import { MsEdgeTTS, OUTPUT_FORMAT } from "msedge-tts"; import { ProgressBar } from "primereact/progressbar"; +let host = "https://krmanik.github.io/Anki-xiehanzi"; + export default function CreateDeck(): JSX.Element { const [words, setWords] = useState< { @@ -290,7 +292,7 @@ export default function CreateDeck(): JSX.Element { DICT.loadDict(); setupSql(); init( - "https://cdn.jsdelivr.net/npm/jieba-wasm@latest/pkg/web/jieba_rs_wasm_bg.wasm" + `${host}/data/jieba_rs_wasm_bg.wasm` ); }, []); @@ -298,7 +300,7 @@ export default function CreateDeck(): JSX.Element { try { const SQL = await initSqlJs({ locateFile: (filename) => - "https://cdn.jsdelivr.net/npm/sql.js/dist/sql-wasm.wasm", + `${host}/data/sql-wasm.wasm`, }); let db = new SQL.Database(); setDb(db); diff --git a/static/data/jieba_rs_wasm_bg.wasm b/static/data/jieba_rs_wasm_bg.wasm new file mode 100644 index 0000000..15154ce Binary files /dev/null and b/static/data/jieba_rs_wasm_bg.wasm differ diff --git a/static/data/sql-wasm.js b/static/data/sql-wasm.js new file mode 100644 index 0000000..f4e407e --- /dev/null +++ b/static/data/sql-wasm.js @@ -0,0 +1,192 @@ + +// 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||=typeof Module !== 'undefined' ? Module : {};"use strict"; +f.onRuntimeInitialized=function(){function a(g,l){switch(typeof l){case "boolean":mc(g,l?1:0);break;case "number":nc(g,l);break;case "string":oc(g,l,-1,-1);break;case "object":if(null===l)lb(g);else if(null!=l.length){var n=aa(l,ba);pc(g,n,l.length,-1);ca(n)}else Aa(g,"Wrong API use : tried to return a value of an unknown type ("+l+").",-1);break;default:lb(g)}}function b(g,l){for(var n=[],t=0;t>>0);if(null!=g){var l=this.filename,n="/",t=l;n&&(n="string"==typeof n?n:ha(n),t=l?u(n+"/"+l): +n);l=ia(!0,!0);t=ja(t,(void 0!==l?l:438)&4095|32768,0);if(g){if("string"==typeof g){n=Array(g.length);for(var w=0,z=g.length;w{a=Ia(a)?new URL(a):Ha.normalize(a);return fs.readFileSync(a,b?void 0:"utf8")};Ga=a=>{a=Ea(a,!0);a.buffer||(a=new Uint8Array(a));return a};Fa=(a,b,c,d=!0)=>{a=Ia(a)?new URL(a):Ha.normalize(a);fs.readFile(a,d?void 0:"utf8",(e,h)=>{e?c(e):b(d?h.buffer:h)})};!f.thisProgram&&1"[Emscripten Module object]"}else if(Ba||Ca)Ca?A=self.location.href:"undefined"!=typeof document&&document.currentScript&&(A=document.currentScript.src),A=0!==A.indexOf("blob:")?A.substr(0,A.replace(/[?#].*/,"").lastIndexOf("/")+1):"",Ea=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},Ca&&(Ga=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),Fa=(a,b,c)=>{var d=new XMLHttpRequest;d.open("GET", +a,!0);d.responseType="arraybuffer";d.onload=()=>{200==d.status||0==d.status&&d.response?b(d.response):c()};d.onerror=c;d.send(null)};var Ja=f.print||console.log.bind(console),B=f.printErr||console.error.bind(console);Object.assign(f,ya);ya=null;f.thisProgram&&(za=f.thisProgram);var Ka;f.wasmBinary&&(Ka=f.wasmBinary);"object"!=typeof WebAssembly&&C("no native wasm support detected");var La,Ma=!1,p,q,Na,D,E,Oa,Pa; +function Qa(){var a=La.buffer;f.HEAP8=p=new Int8Array(a);f.HEAP16=Na=new Int16Array(a);f.HEAPU8=q=new Uint8Array(a);f.HEAPU16=new Uint16Array(a);f.HEAP32=D=new Int32Array(a);f.HEAPU32=E=new Uint32Array(a);f.HEAPF32=Oa=new Float32Array(a);f.HEAPF64=Pa=new Float64Array(a)}var Ra=[],Sa=[],Ta=[];function Va(){var a=f.preRun.shift();Ra.unshift(a)}var G=0,Wa=null,Xa=null; +function C(a){f.onAbort?.(a);a="Aborted("+a+")";B(a);Ma=!0;throw new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");}var Ya=a=>a.startsWith("data:application/octet-stream;base64,"),Ia=a=>a.startsWith("file://"),Za;Za="sql-wasm.wasm";if(!Ya(Za)){var $a=Za;Za=f.locateFile?f.locateFile($a,A):A+$a}function ab(a){if(a==Za&&Ka)return new Uint8Array(Ka);if(Ga)return Ga(a);throw"both async and sync fetching of the wasm failed";} +function bb(a){if(!Ka&&(Ba||Ca)){if("function"==typeof fetch&&!Ia(a))return fetch(a,{credentials:"same-origin"}).then(b=>{if(!b.ok)throw"failed to load wasm binary file at '"+a+"'";return b.arrayBuffer()}).catch(()=>ab(a));if(Fa)return new Promise((b,c)=>{Fa(a,d=>b(new Uint8Array(d)),c)})}return Promise.resolve().then(()=>ab(a))}function cb(a,b,c){return bb(a).then(d=>WebAssembly.instantiate(d,b)).then(d=>d).then(c,d=>{B(`failed to asynchronously prepare wasm: ${d}`);C(d)})} +function db(a,b){var c=Za;Ka||"function"!=typeof WebAssembly.instantiateStreaming||Ya(c)||Ia(c)||Da||"function"!=typeof fetch?cb(c,a,b):fetch(c,{credentials:"same-origin"}).then(d=>WebAssembly.instantiateStreaming(d,a).then(b,function(e){B(`wasm streaming compile failed: ${e}`);B("falling back to ArrayBuffer instantiation");return cb(c,a,b)}))}var I,J,eb=a=>{for(;0>0];case "i8":return p[a>>0];case "i16":return Na[a>>1];case "i32":return D[a>>2];case "i64":C("to do getValue(i64) use WASM_BIGINT");case "float":return Oa[a>>2];case "double":return Pa[a>>3];case "*":return E[a>>2];default:C(`invalid type for getValue: ${b}`)}} +function qa(a){var b="i32";b.endsWith("*")&&(b="*");switch(b){case "i1":p[a>>0]=0;break;case "i8":p[a>>0]=0;break;case "i16":Na[a>>1]=0;break;case "i32":D[a>>2]=0;break;case "i64":C("to do setValue(i64) use WASM_BIGINT");case "float":Oa[a>>2]=0;break;case "double":Pa[a>>3]=0;break;case "*":E[a>>2]=0;break;default:C(`invalid type for setValue: ${b}`)}} +var fb="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,M=(a,b,c)=>{var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d}, +ra=(a,b)=>a?M(q,a,b):"",gb=(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},u=a=>{var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=gb(a.split("/").filter(d=>!!d),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},hb=a=>{var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&=b.substr(0,b.length-1);return a+ +b},ib=a=>{if("/"===a)return"/";a=u(a);a=a.replace(/\/$/,"");var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)},jb=()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return c=>crypto.getRandomValues(c);if(Da)try{var a=require("crypto");if(a.randomFillSync)return c=>a.randomFillSync(c);var b=a.randomBytes;return c=>(c.set(b(c.byteLength)),c)}catch(c){}C("initRandomDevice")},kb=a=>(kb=jb())(a); +function mb(){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=gb(a.split("/").filter(d=>!!d),!b).join("/");return(b?"/":"")+a||"."} +var nb=[],da=a=>{for(var b=0,c=0;c=d?b++:2047>=d?b+=2:55296<=d&&57343>=d?(b+=4,++c):b+=3}return b},fa=(a,b,c,d)=>{if(!(0=k){var r=a.charCodeAt(++h);k=65536+((k&1023)<<10)|r&1023}if(127>=k){if(c>=d)break;b[c++]=k}else{if(2047>=k){if(c+1>=d)break;b[c++]=192|k>>6}else{if(65535>=k){if(c+2>=d)break;b[c++]=224|k>>12}else{if(c+3>=d)break;b[c++]=240|k>>18;b[c++]=128|k>> +12&63}b[c++]=128|k>>6&63}b[c++]=128|k&63}}b[c]=0;return c-e};function oa(a,b){var c=Array(da(a)+1);a=fa(a,c,0,c.length);b&&(c.length=a);return c}var vb=[];function wb(a,b){vb[a]={input:[],output:[],Xa:b};xb(a,yb)} +var yb={open(a){var b=vb[a.node.rdev];if(!b)throw new P(43);a.tty=b;a.seekable=!1},close(a){a.tty.Xa.fsync(a.tty)},fsync(a){a.tty.Xa.fsync(a.tty)},read(a,b,c,d){if(!a.tty||!a.tty.Xa.sb)throw new P(60);for(var e=0,h=0;h=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Ia,a.Ia=new Uint8Array(b),0=a.node.Ma)return 0;a=Math.min(a.node.Ma-e,d);if(8b)throw new P(28);return b},lb(a,b,c){Bb(a.node,b+c);a.node.Ma=Math.max(a.node.Ma,b+c)}, +bb(a,b,c,d,e){if(32768!==(a.node.mode&61440))throw new P(43);a=a.node.Ia;if(e&2||a.buffer!==p.buffer){if(0{var c=0;a&&(c|=365);b&&(c|=146);return c},Hb=null,Ib={},Jb=[],Kb=1,S=null,Lb=!0,P=null,Eb={}; +function T(a,b={}){a=mb(a);if(!a)return{path:"",node:null};b=Object.assign({qb:!0,kb:0},b);if(8!!k);for(var c=Hb,d="/",e=0;e>>0)%S.length}function Ob(a){var b=Nb(a.parent.id,a.name);if(S[b]===a)S[b]=a.Wa;else for(b=S[b];b;){if(b.Wa===a){b.Wa=a.Wa;break}b=b.Wa}} +function Fb(a,b){var c;if(c=(c=Pb(a,"x"))?c:a.Ga.lookup?0:2)throw new P(c,a);for(c=S[Nb(a.id,b)];c;c=c.Wa){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.Ga.lookup(a,b)}function Db(a,b,c,d){a=new Qb(a,b,c,d);b=Nb(a.parent.id,a.name);a.Wa=S[b];return S[b]=a}function R(a){return 16384===(a&61440)}function Rb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b} +function Pb(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 Sb(a,b){try{return Fb(a,b),20}catch(c){}return Pb(a,"wx")}function Tb(a,b,c){try{var d=Fb(a,b)}catch(e){return e.Ka}if(a=Pb(a,"wx"))return a;if(c){if(!R(d.mode))return 54;if(d===d.parent||"/"===ha(d))return 10}else if(R(d.mode))return 31;return 0}function Ub(){for(var a=0;4096>=a;a++)if(!Jb[a])return a;throw new P(33);} +function U(a){a=Jb[a];if(!a)throw new P(8);return a}function Vb(a,b=-1){Wb||(Wb=function(){this.$a={}},Wb.prototype={},Object.defineProperties(Wb.prototype,{object:{get(){return this.node},set(c){this.node=c}},flags:{get(){return this.$a.flags},set(c){this.$a.flags=c}},position:{get(){return this.$a.position},set(c){this.$a.position=c}}}));a=Object.assign(new Wb,a);-1==b&&(b=Ub());a.fd=b;return Jb[b]=a}var Cb={open(a){a.Ha=Ib[a.node.rdev].Ha;a.Ha.open?.(a)},Ta(){throw new P(70);}}; +function xb(a,b){Ib[a]={Ha:b}}function Xb(a,b){var c="/"===b,d=!b;if(c&&Hb)throw new P(10);if(!c&&!d){var e=T(b,{qb:!1});b=e.path;e=e.node;if(e.Va)throw new P(10);if(!R(e.mode))throw new P(54);}b={type:a,Pb:{},tb:b,Cb:[]};a=a.Ra(b);a.Ra=b;b.root=a;c?Hb=a:e&&(e.Va=b,e.Ra&&e.Ra.Cb.push(b))}function ja(a,b,c){var d=T(a,{parent:!0}).node;a=ib(a);if(!a||"."===a||".."===a)throw new P(28);var e=Sb(d,a);if(e)throw new P(e);if(!d.Ga.ab)throw new P(63);return d.Ga.ab(d,a,b,c)} +function V(a,b){return ja(a,(void 0!==b?b:511)&1023|16384,0)}function Yb(a,b,c){"undefined"==typeof c&&(c=b,b=438);ja(a,b|8192,c)}function Zb(a,b){if(!mb(a))throw new P(44);var c=T(b,{parent:!0}).node;if(!c)throw new P(44);b=ib(b);var d=Sb(c,b);if(d)throw new P(d);if(!c.Ga.symlink)throw new P(63);c.Ga.symlink(c,b,a)}function $b(a){var b=T(a,{parent:!0}).node;a=ib(a);var c=Fb(b,a),d=Tb(b,a,!0);if(d)throw new P(d);if(!b.Ga.rmdir)throw new P(63);if(c.Va)throw new P(10);b.Ga.rmdir(b,a);Ob(c)} +function wa(a){var b=T(a,{parent:!0}).node;if(!b)throw new P(44);a=ib(a);var c=Fb(b,a),d=Tb(b,a,!1);if(d)throw new P(d);if(!b.Ga.unlink)throw new P(63);if(c.Va)throw new P(10);b.Ga.unlink(b,a);Ob(c)}function Mb(a){a=T(a).node;if(!a)throw new P(44);if(!a.Ga.readlink)throw new P(28);return mb(ha(a.parent),a.Ga.readlink(a))}function ac(a,b){a=T(a,{Sa:!b}).node;if(!a)throw new P(44);if(!a.Ga.Pa)throw new P(63);return a.Ga.Pa(a)}function bc(a){return ac(a,!0)} +function ka(a,b){a="string"==typeof a?T(a,{Sa:!0}).node:a;if(!a.Ga.Oa)throw new P(63);a.Ga.Oa(a,{mode:b&4095|a.mode&-4096,timestamp:Date.now()})}function cc(a,b){if(0>b)throw new P(28);a="string"==typeof a?T(a,{Sa:!0}).node:a;if(!a.Ga.Oa)throw new P(63);if(R(a.mode))throw new P(31);if(32768!==(a.mode&61440))throw new P(28);var c=Pb(a,"w");if(c)throw new P(c);a.Ga.Oa(a,{size:b,timestamp:Date.now()})} +function la(a,b,c){if(""===a)throw new P(44);if("string"==typeof b){var d={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof d)throw Error(`Unknown file open mode: ${b}`);b=d}c=b&64?("undefined"==typeof c?438:c)&4095|32768:0;if("object"==typeof a)var e=a;else{a=u(a);try{e=T(a,{Sa:!(b&131072)}).node}catch(h){}}d=!1;if(b&64)if(e){if(b&128)throw new P(20);}else e=ja(a,c,0),d=!0;if(!e)throw new P(44);8192===(e.mode&61440)&&(b&=-513);if(b&65536&&!R(e.mode))throw new P(54);if(!d&&(c= +e?40960===(e.mode&61440)?32:R(e.mode)&&("r"!==Rb(b)||b&512)?31:Pb(e,Rb(b)):44))throw new P(c);b&512&&!d&&cc(e,0);b&=-131713;e=Vb({node:e,path:ha(e),flags:b,seekable:!0,position:0,Ha:e.Ha,Fb:[],error:!1});e.Ha.open&&e.Ha.open(e);!f.logReadFiles||b&1||(dc||={},a in dc||(dc[a]=1));return e}function na(a){if(null===a.fd)throw new P(8);a.hb&&(a.hb=null);try{a.Ha.close&&a.Ha.close(a)}catch(b){throw b;}finally{Jb[a.fd]=null}a.fd=null} +function ec(a,b,c){if(null===a.fd)throw new P(8);if(!a.seekable||!a.Ha.Ta)throw new P(70);if(0!=c&&1!=c&&2!=c)throw new P(28);a.position=a.Ha.Ta(a,b,c);a.Fb=[]}function fc(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.Ha.read)throw new P(28);var h="undefined"!=typeof e;if(!h)e=a.position;else if(!a.seekable)throw new P(70);b=a.Ha.read(a,b,c,d,e);h||(a.position+=b);return b} +function ma(a,b,c,d,e){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.Ha.write)throw new P(28);a.seekable&&a.flags&1024&&ec(a,0,2);var h="undefined"!=typeof e;if(!h)e=a.position;else if(!a.seekable)throw new P(70);b=a.Ha.write(a,b,c,d,e,void 0);h||(a.position+=b);return b} +function va(a){var b="binary";if("utf8"!==b&&"binary"!==b)throw Error(`Invalid encoding type "${b}"`);var c;var d=la(a,d||0);a=ac(a).size;var e=new Uint8Array(a);fc(d,e,0,a,0);"utf8"===b?c=M(e,0):"binary"===b&&(c=e);na(d);return c}function gc(){P||(P=function(a,b){this.name="ErrnoError";this.node=b;this.Eb=function(c){this.Ka=c};this.Eb(a);this.message="FS error"},P.prototype=Error(),P.prototype.constructor=P,[44].forEach(a=>{Eb[a]=new P(a);Eb[a].stack=""}))}var hc; +function ic(a,b,c){a=u("/dev/"+a);var d=ia(!!b,!!c);jc||=64;var e=jc++<<8|0;xb(e,{open(h){h.seekable=!1},close(){c?.buffer?.length&&c(10)},read(h,k,r,y){for(var v=0,F=0;F>2]=d.dev;D[c+4>>2]=d.mode;E[c+8>>2]=d.nlink;D[c+12>>2]=d.uid;D[c+16>>2]=d.gid;D[c+20>>2]=d.rdev;J=[d.size>>>0,(I=d.size,1<=+Math.abs(I)?0>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];D[c+24>>2]=J[0];D[c+28>>2]=J[1];D[c+32>>2]=4096;D[c+36>>2]=d.blocks;a=d.atime.getTime();b=d.mtime.getTime();var e=d.ctime.getTime();J=[Math.floor(a/1E3)>>>0,(I=Math.floor(a/1E3),1<= ++Math.abs(I)?0>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];D[c+40>>2]=J[0];D[c+44>>2]=J[1];E[c+48>>2]=a%1E3*1E3;J=[Math.floor(b/1E3)>>>0,(I=Math.floor(b/1E3),1<=+Math.abs(I)?0>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];D[c+56>>2]=J[0];D[c+60>>2]=J[1];E[c+64>>2]=b%1E3*1E3;J=[Math.floor(e/1E3)>>>0,(I=Math.floor(e/1E3),1<=+Math.abs(I)?0>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];D[c+72>>2]=J[0]; +D[c+76>>2]=J[1];E[c+80>>2]=e%1E3*1E3;J=[d.ino>>>0,(I=d.ino,1<=+Math.abs(I)?0>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];D[c+88>>2]=J[0];D[c+92>>2]=J[1];return 0}var Mc=void 0;function Oc(){var a=D[+Mc>>2];Mc+=4;return a} +var Pc=(a,b)=>b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN,Qc=[0,31,60,91,121,152,182,213,244,274,305,335],Rc=[0,31,59,90,120,151,181,212,243,273,304,334],Sc=a=>{var b=da(a)+1,c=ea(b);c&&fa(a,q,c,b);return c},Tc={},Vc=()=>{if(!Uc){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",_:za||"./this.program"},b;for(b in Tc)void 0===Tc[b]?delete a[b]:a[b]=Tc[b]; +var c=[];for(b in a)c.push(`${b}=${a[b]}`);Uc=c}return Uc},Uc,ta=a=>{var b=da(a)+1,c=x(b);fa(a,q,c,b);return c},Wc=(a,b,c,d)=>{var e={string:v=>{var F=0;null!==v&&void 0!==v&&0!==v&&(F=ta(v));return F},array:v=>{var F=x(v.length);p.set(v,F);return F}};a=f["_"+a];var h=[],k=0;if(d)for(var r=0;r{b=1==b?x(a.length): +ea(a.length);a.subarray||a.slice||(a=new Uint8Array(a));q.set(a,b);return b},Xc,Yc=[],Y,ua=a=>{Xc.delete(Y.get(a));Y.set(a,null);Yc.push(a)},xa=(a,b)=>{if(!Xc){Xc=new WeakMap;var c=Y.length;if(Xc)for(var d=0;d<0+c;d++){var e=Y.get(d);e&&Xc.set(e,d)}}if(c=Xc.get(a)||0)return c;if(Yc.length)c=Yc.pop();else{try{Y.grow(1)}catch(r){if(!(r instanceof RangeError))throw r;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";}c=Y.length-1}try{Y.set(c,a)}catch(r){if(!(r instanceof TypeError))throw r;if("function"== +typeof WebAssembly.Function){d=WebAssembly.Function;e={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"};for(var h={parameters:[],results:"v"==b[0]?[]:[e[b[0]]]},k=1;kk?d.push(k):d.push(k%128|128,k>>7);for(k=0;ke?b.push(e):b.push(e%128| +128,e>>7);b.push.apply(b,d);b.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);b=new WebAssembly.Module(new Uint8Array(b));b=(new WebAssembly.Instance(b,{e:{f:a}})).exports.f}Y.set(c,b)}Xc.set(a,c);return c};function Qb(a,b,c,d){a||=this;this.parent=a;this.Ra=a.Ra;this.Va=null;this.id=Kb++;this.name=b;this.mode=c;this.Ga={};this.Ha={};this.rdev=d} +Object.defineProperties(Qb.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}}});gc();S=Array(4096);Xb(Q,"/");V("/tmp");V("/home");V("/home/web_user"); +(function(){V("/dev");xb(259,{read:()=>0,write:(d,e,h,k)=>k});Yb("/dev/null",259);wb(1280,zb);wb(1536,Ab);Yb("/dev/tty",1280);Yb("/dev/tty1",1536);var a=new Uint8Array(1024),b=0,c=()=>{0===b&&(b=kb(a).byteLength);return a[--b]};ic("random",c);ic("urandom",c);V("/dev/shm");V("/dev/shm/tmp")})(); +(function(){V("/proc");var a=V("/proc/self");V("/proc/self/fd");Xb({Ra(){var b=Db(a,"fd",16895,73);b.Ga={lookup(c,d){var e=U(+d);c={parent:null,Ra:{tb:"fake"},Ga:{readlink:()=>e.path}};return c.parent=c}};return b}},"/proc/self/fd")})(); +var $c={a:(a,b,c,d)=>{C(`Assertion failed: ${a?M(q,a):""}, at: `+[b?b?M(q,b):"":"unknown filename",c,d?d?M(q,d):"":"unknown function"])},h:function(a,b){try{return a=a?M(q,a):"",ka(a,b),0}catch(c){if("undefined"==typeof W||"ErrnoError"!==c.name)throw c;return-c.Ka}},H:function(a,b,c){try{b=b?M(q,b):"";b=kc(a,b);if(c&-8)return-28;var d=T(b,{Sa:!0}).node;if(!d)return-44;a="";c&4&&(a+="r");c&2&&(a+="w");c&1&&(a+="x");return a&&Pb(d,a)?-2:0}catch(e){if("undefined"==typeof W||"ErrnoError"!==e.name)throw e; +return-e.Ka}},i:function(a,b){try{var c=U(a);ka(c.node,b);return 0}catch(d){if("undefined"==typeof W||"ErrnoError"!==d.name)throw d;return-d.Ka}},g:function(a){try{var b=U(a).node;var c="string"==typeof b?T(b,{Sa:!0}).node:b;if(!c.Ga.Oa)throw new P(63);c.Ga.Oa(c,{timestamp:Date.now()});return 0}catch(d){if("undefined"==typeof W||"ErrnoError"!==d.name)throw d;return-d.Ka}},b:function(a,b,c){Mc=c;try{var d=U(a);switch(b){case 0:var e=Oc();if(0>e)return-28;for(;Jb[e];)e++;return Vb(d,e).fd;case 1:case 2:return 0; +case 3:return d.flags;case 4:return e=Oc(),d.flags|=e,0;case 5:return e=Oc(),Na[e+0>>1]=2,0;case 6:case 7:return 0;case 16:case 8:return-28;case 9:return D[Zc()>>2]=28,-1;default:return-28}}catch(h){if("undefined"==typeof W||"ErrnoError"!==h.name)throw h;return-h.Ka}},f:function(a,b){try{var c=U(a);return lc(ac,c.path,b)}catch(d){if("undefined"==typeof W||"ErrnoError"!==d.name)throw d;return-d.Ka}},n:function(a,b,c){b=Pc(b,c);try{if(isNaN(b))return 61;var d=U(a);if(0===(d.flags&2097155))throw new P(28); +cc(d.node,b);return 0}catch(e){if("undefined"==typeof W||"ErrnoError"!==e.name)throw e;return-e.Ka}},C:function(a,b){try{if(0===b)return-28;var c=da("/")+1;if(b=d)return-28; +var e=Mb(b),h=Math.min(d,da(e)),k=p[c+h];fa(e,q,c,d+1);p[c+h]=k;return h}catch(r){if("undefined"==typeof W||"ErrnoError"!==r.name)throw r;return-r.Ka}},v:function(a){try{return a=a?M(q,a):"",$b(a),0}catch(b){if("undefined"==typeof W||"ErrnoError"!==b.name)throw b;return-b.Ka}},G:function(a,b){try{return a=a?M(q,a):"",lc(ac,a,b)}catch(c){if("undefined"==typeof W||"ErrnoError"!==c.name)throw c;return-c.Ka}},r:function(a,b,c){try{return b=b?M(q,b):"",b=kc(a,b),0===c?wa(b):512===c?$b(b):C("Invalid flags passed to unlinkat"), +0}catch(d){if("undefined"==typeof W||"ErrnoError"!==d.name)throw d;return-d.Ka}},q:function(a,b,c){try{b=b?M(q,b):"";b=kc(a,b,!0);if(c){var d=E[c>>2]+4294967296*D[c+4>>2],e=D[c+8>>2];h=1E3*d+e/1E6;c+=16;d=E[c>>2]+4294967296*D[c+4>>2];e=D[c+8>>2];k=1E3*d+e/1E6}else var h=Date.now(),k=h;a=h;var r=T(b,{Sa:!0}).node;r.Ga.Oa(r,{timestamp:Math.max(a,k)});return 0}catch(y){if("undefined"==typeof W||"ErrnoError"!==y.name)throw y;return-y.Ka}},l:function(a,b,c){a=new Date(1E3*Pc(a,b));D[c>>2]=a.getSeconds(); +D[c+4>>2]=a.getMinutes();D[c+8>>2]=a.getHours();D[c+12>>2]=a.getDate();D[c+16>>2]=a.getMonth();D[c+20>>2]=a.getFullYear()-1900;D[c+24>>2]=a.getDay();b=a.getFullYear();D[c+28>>2]=(0!==b%4||0===b%100&&0!==b%400?Rc:Qc)[a.getMonth()]+a.getDate()-1|0;D[c+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();D[c+32>>2]=(b!=d&&a.getTimezoneOffset()==Math.min(d,b))|0},j:function(a,b,c,d,e,h,k,r){e=Pc(e,h);try{if(isNaN(e))return 61; +var y=U(d);if(0!==(b&2)&&0===(c&2)&&2!==(y.flags&2097155))throw new P(2);if(1===(y.flags&2097155))throw new P(2);if(!y.Ha.bb)throw new P(43);var v=y.Ha.bb(y,a,e,b,c);var F=v.Db;D[k>>2]=v.ub;E[r>>2]=F;return 0}catch(H){if("undefined"==typeof W||"ErrnoError"!==H.name)throw H;return-H.Ka}},k:function(a,b,c,d,e,h,k){h=Pc(h,k);try{if(isNaN(h))return 61;var r=U(e);if(c&2){if(32768!==(r.node.mode&61440))throw new P(43);if(!(d&2)){var y=q.slice(a,a+b);r.Ha.cb&&r.Ha.cb(r,y,h,b,d)}}}catch(v){if("undefined"== +typeof W||"ErrnoError"!==v.name)throw v;return-v.Ka}},s:(a,b,c)=>{function d(y){return(y=y.toTimeString().match(/\(([A-Za-z ]+)\)$/))?y[1]:"GMT"}var e=(new Date).getFullYear(),h=new Date(e,0,1),k=new Date(e,6,1);e=h.getTimezoneOffset();var r=k.getTimezoneOffset();E[a>>2]=60*Math.max(e,r);D[b>>2]=Number(e!=r);a=d(h);b=d(k);a=Sc(a);b=Sc(b);r>2]=a,E[c+4>>2]=b):(E[c>>2]=b,E[c+4>>2]=a)},d:()=>Date.now(),t:()=>2147483648,c:()=>performance.now(),o:a=>{var b=q.length;a>>>=0;if(2147483648=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);var e=Math;d=Math.max(a,d);a:{e=(e.min.call(e,2147483648,d+(65536-d%65536)%65536)-La.buffer.byteLength+65535)/65536;try{La.grow(e);Qa();var h=1;break a}catch(k){}h=void 0}if(h)return!0}return!1},A:(a,b)=>{var c=0;Vc().forEach((d,e)=>{var h=b+c;e=E[a+4*e>>2]=h;for(h=0;h>0]=d.charCodeAt(h);p[e>>0]=0;c+=d.length+1});return 0},B:(a,b)=>{var c=Vc();E[a>>2]=c.length;var d=0;c.forEach(e=>d+=e.length+1);E[b>>2]=d;return 0}, +e:function(a){try{var b=U(a);na(b);return 0}catch(c){if("undefined"==typeof W||"ErrnoError"!==c.name)throw c;return c.Ka}},p:function(a,b){try{var c=U(a);p[b>>0]=c.tty?2:R(c.mode)?3:40960===(c.mode&61440)?7:4;Na[b+2>>1]=0;J=[0,(I=0,1<=+Math.abs(I)?0>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];D[b+8>>2]=J[0];D[b+12>>2]=J[1];J=[0,(I=0,1<=+Math.abs(I)?0>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];D[b+16>>2]=J[0];D[b+20>>2]=J[1]; +return 0}catch(d){if("undefined"==typeof W||"ErrnoError"!==d.name)throw d;return d.Ka}},x:function(a,b,c,d){try{a:{var e=U(a);a=b;for(var h,k=b=0;k>2],y=E[a+4>>2];a+=8;var v=fc(e,p,r,y,h);if(0>v){var F=-1;break a}b+=v;if(v>2]=F;return 0}catch(H){if("undefined"==typeof W||"ErrnoError"!==H.name)throw H;return H.Ka}},m:function(a,b,c,d,e){b=Pc(b,c);try{if(isNaN(b))return 61;var h=U(a);ec(h,b,d);J=[h.position>>>0,(I=h.position,1<=+Math.abs(I)? +0>>0:~~+Math.ceil((I-+(~~I>>>0))/4294967296)>>>0:0)];D[e>>2]=J[0];D[e+4>>2]=J[1];h.hb&&0===b&&0===d&&(h.hb=null);return 0}catch(k){if("undefined"==typeof W||"ErrnoError"!==k.name)throw k;return k.Ka}},D:function(a){try{var b=U(a);return b.Ha?.fsync?b.Ha.fsync(b):0}catch(c){if("undefined"==typeof W||"ErrnoError"!==c.name)throw c;return c.Ka}},u:function(a,b,c,d){try{a:{var e=U(a);a=b;for(var h,k=b=0;k>2],y=E[a+4>>2];a+=8;var v=ma(e,p,r,y,h);if(0>v){var F= +-1;break a}b+=v;"undefined"!==typeof h&&(h+=v)}F=b}E[d>>2]=F;return 0}catch(H){if("undefined"==typeof W||"ErrnoError"!==H.name)throw H;return H.Ka}}},Z=function(){function a(c){Z=c.exports;La=Z.I;Qa();Y=Z.Aa;Sa.unshift(Z.J);G--;f.monitorRunDependencies?.(G);0==G&&(null!==Wa&&(clearInterval(Wa),Wa=null),Xa&&(c=Xa,Xa=null,c()));return Z}var b={a:$c};G++;f.monitorRunDependencies?.(G);if(f.instantiateWasm)try{return f.instantiateWasm(b,a)}catch(c){return B(`Module.instantiateWasm callback failed with error: ${c}`), +!1}db(b,function(c){a(c.instance)});return{}}();f._sqlite3_free=a=>(f._sqlite3_free=Z.K)(a);f._sqlite3_value_text=a=>(f._sqlite3_value_text=Z.L)(a);var Zc=()=>(Zc=Z.M)();f._sqlite3_prepare_v2=(a,b,c,d,e)=>(f._sqlite3_prepare_v2=Z.N)(a,b,c,d,e);f._sqlite3_step=a=>(f._sqlite3_step=Z.O)(a);f._sqlite3_reset=a=>(f._sqlite3_reset=Z.P)(a);f._sqlite3_exec=(a,b,c,d,e)=>(f._sqlite3_exec=Z.Q)(a,b,c,d,e);f._sqlite3_finalize=a=>(f._sqlite3_finalize=Z.R)(a); +f._sqlite3_column_name=(a,b)=>(f._sqlite3_column_name=Z.S)(a,b);f._sqlite3_column_text=(a,b)=>(f._sqlite3_column_text=Z.T)(a,b);f._sqlite3_column_type=(a,b)=>(f._sqlite3_column_type=Z.U)(a,b);f._sqlite3_errmsg=a=>(f._sqlite3_errmsg=Z.V)(a);f._sqlite3_clear_bindings=a=>(f._sqlite3_clear_bindings=Z.W)(a);f._sqlite3_value_blob=a=>(f._sqlite3_value_blob=Z.X)(a);f._sqlite3_value_bytes=a=>(f._sqlite3_value_bytes=Z.Y)(a);f._sqlite3_value_double=a=>(f._sqlite3_value_double=Z.Z)(a); +f._sqlite3_value_int=a=>(f._sqlite3_value_int=Z._)(a);f._sqlite3_value_type=a=>(f._sqlite3_value_type=Z.$)(a);f._sqlite3_result_blob=(a,b,c,d)=>(f._sqlite3_result_blob=Z.aa)(a,b,c,d);f._sqlite3_result_double=(a,b)=>(f._sqlite3_result_double=Z.ba)(a,b);f._sqlite3_result_error=(a,b,c)=>(f._sqlite3_result_error=Z.ca)(a,b,c);f._sqlite3_result_int=(a,b)=>(f._sqlite3_result_int=Z.da)(a,b);f._sqlite3_result_int64=(a,b,c)=>(f._sqlite3_result_int64=Z.ea)(a,b,c); +f._sqlite3_result_null=a=>(f._sqlite3_result_null=Z.fa)(a);f._sqlite3_result_text=(a,b,c,d)=>(f._sqlite3_result_text=Z.ga)(a,b,c,d);f._sqlite3_aggregate_context=(a,b)=>(f._sqlite3_aggregate_context=Z.ha)(a,b);f._sqlite3_column_count=a=>(f._sqlite3_column_count=Z.ia)(a);f._sqlite3_data_count=a=>(f._sqlite3_data_count=Z.ja)(a);f._sqlite3_column_blob=(a,b)=>(f._sqlite3_column_blob=Z.ka)(a,b);f._sqlite3_column_bytes=(a,b)=>(f._sqlite3_column_bytes=Z.la)(a,b); +f._sqlite3_column_double=(a,b)=>(f._sqlite3_column_double=Z.ma)(a,b);f._sqlite3_bind_blob=(a,b,c,d,e)=>(f._sqlite3_bind_blob=Z.na)(a,b,c,d,e);f._sqlite3_bind_double=(a,b,c)=>(f._sqlite3_bind_double=Z.oa)(a,b,c);f._sqlite3_bind_int=(a,b,c)=>(f._sqlite3_bind_int=Z.pa)(a,b,c);f._sqlite3_bind_text=(a,b,c,d,e)=>(f._sqlite3_bind_text=Z.qa)(a,b,c,d,e);f._sqlite3_bind_parameter_index=(a,b)=>(f._sqlite3_bind_parameter_index=Z.ra)(a,b);f._sqlite3_sql=a=>(f._sqlite3_sql=Z.sa)(a); +f._sqlite3_normalized_sql=a=>(f._sqlite3_normalized_sql=Z.ta)(a);f._sqlite3_changes=a=>(f._sqlite3_changes=Z.ua)(a);f._sqlite3_close_v2=a=>(f._sqlite3_close_v2=Z.va)(a);f._sqlite3_create_function_v2=(a,b,c,d,e,h,k,r,y)=>(f._sqlite3_create_function_v2=Z.wa)(a,b,c,d,e,h,k,r,y);f._sqlite3_open=(a,b)=>(f._sqlite3_open=Z.xa)(a,b);var ea=f._malloc=a=>(ea=f._malloc=Z.ya)(a),ca=f._free=a=>(ca=f._free=Z.za)(a);f._RegisterExtensionFunctions=a=>(f._RegisterExtensionFunctions=Z.Ba)(a); +var Gb=(a,b)=>(Gb=Z.Ca)(a,b),pa=()=>(pa=Z.Da)(),sa=a=>(sa=Z.Ea)(a),x=a=>(x=Z.Fa)(a);f.stackAlloc=x;f.stackSave=pa;f.stackRestore=sa;f.cwrap=(a,b,c,d)=>{var e=!c||c.every(h=>"number"===h||"boolean"===h);return"string"!==b&&e&&!d?f["_"+a]:function(){return Wc(a,b,c,arguments)}};f.addFunction=xa;f.removeFunction=ua;f.UTF8ToString=ra;f.ALLOC_NORMAL=ba;f.allocate=aa;f.allocateUTF8OnStack=ta;var ad;Xa=function bd(){ad||cd();ad||(Xa=bd)}; +function cd(){function a(){if(!ad&&(ad=!0,f.calledRun=!0,!Ma)){f.noFSInit||hc||(hc=!0,gc(),f.stdin=f.stdin,f.stdout=f.stdout,f.stderr=f.stderr,f.stdin?ic("stdin",f.stdin):Zb("/dev/tty","/dev/stdin"),f.stdout?ic("stdout",null,f.stdout):Zb("/dev/tty","/dev/stdout"),f.stderr?ic("stderr",null,f.stderr):Zb("/dev/tty1","/dev/stderr"),la("/dev/stdin",0),la("/dev/stdout",1),la("/dev/stderr",1));Lb=!1;eb(Sa);if(f.onRuntimeInitialized)f.onRuntimeInitialized();if(f.postRun)for("function"==typeof f.postRun&& +(f.postRun=[f.postRun]);f.postRun.length;){var b=f.postRun.shift();Ta.unshift(b)}eb(Ta)}}if(!(0