4 lines
195 KiB
JavaScript
4 lines
195 KiB
JavaScript
import"./Sa-_S7_w.js";var Ft=(()=>{var qe=import.meta.url;return function(ce={}){var ge,i=ce,ye,Ee,Ne=new Promise((e,t)=>{ye=e,Ee=t}),Je=typeof window=="object",Oe=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";const Fe=globalThis.sqlite3InitModuleState||Object.assign(Object.create(null),{debugModule:()=>{}});delete globalThis.sqlite3InitModuleState,Fe.debugModule("globalThis.location =",globalThis.location);var Qe=Object.assign({},i),re="./this.program",me="";function Ae(e){return i.locateFile?i.locateFile(e,me):me+e}var Le,Me;(Je||Oe)&&(Oe?me=self.location.href:typeof document<"u"&&document.currentScript&&(me=document.currentScript.src),qe&&(me=qe),me.startsWith("blob:")?me="":me=me.substr(0,me.replace(/[?#].*/,"").lastIndexOf("/")+1),Oe&&(Me=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),Le=e=>fetch(e,{credentials:"same-origin"}).then(t=>t.ok?t.arrayBuffer():Promise.reject(new Error(t.status+" : "+t.url))));var He=i.print||console.log.bind(console),Pe=i.printErr||console.error.bind(console);Object.assign(i,Qe),Qe=null,i.arguments&&i.arguments,i.thisProgram&&(re=i.thisProgram);var Xe=i.wasmBinary,Ce,ut=!1,xe,je,Ve,ue,we,Ie;function ft(){var e=Ce.buffer;i.HEAP8=xe=new Int8Array(e),i.HEAP16=Ve=new Int16Array(e),i.HEAPU8=je=new Uint8Array(e),i.HEAPU16=new Uint16Array(e),i.HEAP32=ue=new Int32Array(e),i.HEAPU32=we=new Uint32Array(e),i.HEAPF32=new Float32Array(e),i.HEAPF64=new Float64Array(e),i.HEAP64=Ie=new BigInt64Array(e),i.HEAPU64=new BigUint64Array(e)}if(i.wasmMemory)Ce=i.wasmMemory;else{var Pt=i.INITIAL_MEMORY||16777216;Ce=new WebAssembly.Memory({initial:Pt/65536,maximum:32768})}ft();var dt=[],pt=[],mt=[];function Ot(){var e=i.preRun;e&&(typeof e=="function"&&(e=[e]),e.forEach(Dt)),it(dt)}function Lt(){!i.noFSInit&&!a.initialized&&a.init(),a.ignorePermissions=!1,it(pt)}function Ct(){var e=i.postRun;e&&(typeof e=="function"&&(e=[e]),e.forEach(Nt)),it(mt)}function Dt(e){dt.unshift(e)}function Rt(e){pt.unshift(e)}function Nt(e){mt.unshift(e)}var De=0,Ge=null;function Yn(e){return e}function nt(e){De++,i.monitorRunDependencies?.(De)}function Ye(e){if(De--,i.monitorRunDependencies?.(De),De==0&&Ge){var t=Ge;Ge=null,t()}}function rt(e){i.onAbort?.(e),e="Aborted("+e+")",Pe(e),ut=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw Ee(t),t}var Mt="data:application/octet-stream;base64,",ht=e=>e.startsWith(Mt);function jt(){if(i.locateFile){var e="sqlite3.wasm";return ht(e)?e:Ae(e)}return new URL(""+new URL("sqlite3.DBpDb1lf.wasm",import.meta.url).href,import.meta.url).href}var st;function gt(e){if(e==st&&Xe)return new Uint8Array(Xe);if(Me)return Me(e);throw"both async and sync fetching of the wasm failed"}function Bt(e){return Xe?Promise.resolve().then(()=>gt(e)):Le(e).then(t=>new Uint8Array(t),()=>gt(e))}function qt(e,t,n){return Bt(e).then(r=>WebAssembly.instantiate(r,t)).then(n,r=>{Pe(`failed to asynchronously prepare wasm: ${r}`),rt(r)})}function Ut(e,t,n,r){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!ht(t)&&typeof fetch=="function"?fetch(t,{credentials:"same-origin"}).then(s=>{var o=WebAssembly.instantiateStreaming(s,n);return o.then(r,function(p){return Pe(`wasm streaming compile failed: ${p}`),Pe("falling back to ArrayBuffer instantiation"),qt(t,n,r)})}):qt(t,n,r)}function zt(){return{env:St,wasi_snapshot_preview1:St}}function Wt(){var e=zt();function t(r,s){return m=r.exports,Rt(m.__wasm_call_ctors),Ye(),m}nt();function n(r){t(r.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(r){Pe(`Module.instantiateWasm callback failed with error: ${r}`),Ee(r)}return st??=jt(),Ut(Xe,st,e,n).catch(Ee),{}}var it=e=>{e.forEach(t=>t(i))};i.noExitRuntime;var fe={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return t.exec(e).slice(1)},normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var s=e[r];s==="."?e.splice(r,1):s===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift("..");return e},normalize:e=>{var t=fe.isAbs(e),n=e.substr(-1)==="/";return e=fe.normalizeArray(e.split("/").filter(r=>!!r),!t).join("/"),!e&&!t&&(e="."),e&&n&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=fe.splitPath(e),n=t[0],r=t[1];return!n&&!r?".":(r&&(r=r.substr(0,r.length-1)),n+r)},basename:e=>{if(e==="/")return"/";e=fe.normalize(e),e=e.replace(/\/$/,"");var t=e.lastIndexOf("/");return t===-1?e:e.substr(t+1)},join:(...e)=>fe.normalize(e.join("/")),join2:(e,t)=>fe.normalize(e+"/"+t)},Qt=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);rt("initRandomDevice")},bt=e=>(bt=Qt())(e),ke={resolve:(...e)=>{for(var t="",n=!1,r=e.length-1;r>=-1&&!n;r--){var s=r>=0?e[r]:a.cwd();if(typeof s!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!s)return"";t=s+"/"+t,n=fe.isAbs(s)}return t=fe.normalizeArray(t.split("/").filter(o=>!!o),!n).join("/"),(n?"/":"")+t||"."},relative:(e,t)=>{e=ke.resolve(e).substr(1),t=ke.resolve(t).substr(1);function n(R){for(var z=0;z<R.length&&R[z]==="";z++);for(var Q=R.length-1;Q>=0&&R[Q]==="";Q--);return z>Q?[]:R.slice(z,Q-z+1)}for(var r=n(e.split("/")),s=n(t.split("/")),o=Math.min(r.length,s.length),p=o,g=0;g<o;g++)if(r[g]!==s[g]){p=g;break}for(var P=[],g=p;g<r.length;g++)P.push("..");return P=P.concat(s.slice(p)),P.join("/")}},yt=typeof TextDecoder<"u"?new TextDecoder:void 0,Be=(e,t=0,n=NaN)=>{for(var r=t+n,s=t;e[s]&&!(s>=r);)++s;if(s-t>16&&e.buffer&&yt)return yt.decode(e.subarray(t,s));for(var o="";t<s;){var p=e[t++];if(!(p&128)){o+=String.fromCharCode(p);continue}var g=e[t++]&63;if((p&224)==192){o+=String.fromCharCode((p&31)<<6|g);continue}var P=e[t++]&63;if((p&240)==224?p=(p&15)<<12|g<<6|P:p=(p&7)<<18|g<<12|P<<6|e[t++]&63,p<65536)o+=String.fromCharCode(p);else{var R=p-65536;o+=String.fromCharCode(55296|R>>10,56320|R&1023)}}return o},ot=[],Ze=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},lt=(e,t,n,r)=>{if(!(r>0))return 0;for(var s=n,o=n+r-1,p=0;p<e.length;++p){var g=e.charCodeAt(p);if(g>=55296&&g<=57343){var P=e.charCodeAt(++p);g=65536+((g&1023)<<10)|P&1023}if(g<=127){if(n>=o)break;t[n++]=g}else if(g<=2047){if(n+1>=o)break;t[n++]=192|g>>6,t[n++]=128|g&63}else if(g<=65535){if(n+2>=o)break;t[n++]=224|g>>12,t[n++]=128|g>>6&63,t[n++]=128|g&63}else{if(n+3>=o)break;t[n++]=240|g>>18,t[n++]=128|g>>12&63,t[n++]=128|g>>6&63,t[n++]=128|g&63}}return t[n]=0,n-s};function wt(e,t,n){var r=Ze(e)+1,s=new Array(r),o=lt(e,s,0,s.length);return s.length=o,s}var Ht=()=>{if(!ot.length){var e=null;if(typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`
|
|
`)),!e)return null;ot=wt(e)}return ot.shift()},Re={ttys:[],init(){},shutdown(){},register(e,t){Re.ttys[e]={input:[],output:[],ops:t},a.registerDevice(e,Re.stream_ops)},stream_ops:{open(e){var t=Re.ttys[e.node.rdev];if(!t)throw new a.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,s){if(!e.tty||!e.tty.ops.get_char)throw new a.ErrnoError(60);for(var o=0,p=0;p<r;p++){var g;try{g=e.tty.ops.get_char(e.tty)}catch{throw new a.ErrnoError(29)}if(g===void 0&&o===0)throw new a.ErrnoError(6);if(g==null)break;o++,t[n+p]=g}return o&&(e.node.timestamp=Date.now()),o},write(e,t,n,r,s){if(!e.tty||!e.tty.ops.put_char)throw new a.ErrnoError(60);try{for(var o=0;o<r;o++)e.tty.ops.put_char(e.tty,t[n+o])}catch{throw new a.ErrnoError(29)}return r&&(e.node.timestamp=Date.now()),o}},default_tty_ops:{get_char(e){return Ht()},put_char(e,t){t===null||t===10?(He(Be(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(He(Be(e.output)),e.output=[])},ioctl_tcgets(e){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(e,t,n){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,t){t===null||t===10?(Pe(Be(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(Pe(Be(e.output)),e.output=[])}}},Vt=(e,t)=>{je.fill(0,e,e+t)},Et=(e,t)=>Math.ceil(e/t)*t,vt=e=>{e=Et(e,65536);var t=At(65536,e);return t&&Vt(t,e),t},oe={ops_table:null,mount(e){return oe.createNode(null,"/",16895,0)},createNode(e,t,n,r){if(a.isBlkdev(n)||a.isFIFO(n))throw new a.ErrnoError(63);oe.ops_table||={dir:{node:{getattr:oe.node_ops.getattr,setattr:oe.node_ops.setattr,lookup:oe.node_ops.lookup,mknod:oe.node_ops.mknod,rename:oe.node_ops.rename,unlink:oe.node_ops.unlink,rmdir:oe.node_ops.rmdir,readdir:oe.node_ops.readdir,symlink:oe.node_ops.symlink},stream:{llseek:oe.stream_ops.llseek}},file:{node:{getattr:oe.node_ops.getattr,setattr:oe.node_ops.setattr},stream:{llseek:oe.stream_ops.llseek,read:oe.stream_ops.read,write:oe.stream_ops.write,allocate:oe.stream_ops.allocate,mmap:oe.stream_ops.mmap,msync:oe.stream_ops.msync}},link:{node:{getattr:oe.node_ops.getattr,setattr:oe.node_ops.setattr,readlink:oe.node_ops.readlink},stream:{}},chrdev:{node:{getattr:oe.node_ops.getattr,setattr:oe.node_ops.setattr},stream:a.chrdev_stream_ops}};var s=a.createNode(e,t,n,r);return a.isDir(s.mode)?(s.node_ops=oe.ops_table.dir.node,s.stream_ops=oe.ops_table.dir.stream,s.contents={}):a.isFile(s.mode)?(s.node_ops=oe.ops_table.file.node,s.stream_ops=oe.ops_table.file.stream,s.usedBytes=0,s.contents=null):a.isLink(s.mode)?(s.node_ops=oe.ops_table.link.node,s.stream_ops=oe.ops_table.link.stream):a.isChrdev(s.mode)&&(s.node_ops=oe.ops_table.chrdev.node,s.stream_ops=oe.ops_table.chrdev.stream),s.timestamp=Date.now(),e&&(e.contents[t]=s,e.timestamp=s.timestamp),s},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){var r=1024*1024;t=Math.max(t,n*(n<r?2:1.125)>>>0),n!=0&&(t=Math.max(t,256));var s=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(s.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(t==0)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=a.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,a.isDir(e.mode)?t.size=4096:a.isFile(e.mode)?t.size=e.usedBytes:a.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){t.mode!==void 0&&(e.mode=t.mode),t.timestamp!==void 0&&(e.timestamp=t.timestamp),t.size!==void 0&&oe.resizeFileStorage(e,t.size)},lookup(e,t){throw a.genericErrors[44]},mknod(e,t,n,r){return oe.createNode(e,t,n,r)},rename(e,t,n){if(a.isDir(e.mode)){var r;try{r=a.lookupNode(t,n)}catch{}if(r)for(var s in r.contents)throw new a.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=n,t.contents[n]=e,t.timestamp=e.parent.timestamp},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var n=a.lookupNode(e,t);for(var r in n.contents)throw new a.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var n of Object.keys(e.contents))t.push(n);return t},symlink(e,t,n){var r=oe.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!a.isLink(e.mode))throw new a.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,s){var o=e.node.contents;if(s>=e.node.usedBytes)return 0;var p=Math.min(e.node.usedBytes-s,r);if(p>8&&o.subarray)t.set(o.subarray(s,s+p),n);else for(var g=0;g<p;g++)t[n+g]=o[s+g];return p},write(e,t,n,r,s,o){if(t.buffer===xe.buffer&&(o=!1),!r)return 0;var p=e.node;if(p.timestamp=Date.now(),t.subarray&&(!p.contents||p.contents.subarray)){if(o)return p.contents=t.subarray(n,n+r),p.usedBytes=r,r;if(p.usedBytes===0&&s===0)return p.contents=t.slice(n,n+r),p.usedBytes=r,r;if(s+r<=p.usedBytes)return p.contents.set(t.subarray(n,n+r),s),r}if(oe.expandFileStorage(p,s+r),p.contents.subarray&&t.subarray)p.contents.set(t.subarray(n,n+r),s);else for(var g=0;g<r;g++)p.contents[s+g]=t[n+g];return p.usedBytes=Math.max(p.usedBytes,s+r),r},llseek(e,t,n){var r=t;if(n===1?r+=e.position:n===2&&a.isFile(e.node.mode)&&(r+=e.node.usedBytes),r<0)throw new a.ErrnoError(28);return r},allocate(e,t,n){oe.expandFileStorage(e.node,t+n),e.node.usedBytes=Math.max(e.node.usedBytes,t+n)},mmap(e,t,n,r,s){if(!a.isFile(e.node.mode))throw new a.ErrnoError(43);var o,p,g=e.node.contents;if(!(s&2)&&g&&g.buffer===xe.buffer)p=!1,o=g.byteOffset;else{if(p=!0,o=vt(t),!o)throw new a.ErrnoError(48);g&&((n>0||n+t<g.length)&&(g.subarray?g=g.subarray(n,n+t):g=Array.prototype.slice.call(g,n,n+t)),xe.set(g,o))}return{ptr:o,allocated:p}},msync(e,t,n,r,s){return oe.stream_ops.write(e,t,0,r,n,!1),0}}},Gt=(e,t,n,r)=>{var s=`al ${e}`;Le(e).then(o=>{t(new Uint8Array(o)),s&&Ye()},o=>{if(n)n();else throw`Loading data file "${e}" failed.`}),s&&nt()},$t=(e,t,n,r,s,o)=>{a.createDataFile(e,t,n,r,s,o)},Kt=i.preloadPlugins||[],Jt=(e,t,n,r)=>{typeof Browser<"u"&&Browser.init();var s=!1;return Kt.forEach(o=>{s||o.canHandle(t)&&(o.handle(e,t,n,r),s=!0)}),s},Xt=(e,t,n,r,s,o,p,g,P,R)=>{var z=t?ke.resolve(fe.join2(e,t)):e;function Q(T){function A(D){R?.(),g||$t(e,t,D,r,s,P),o?.(),Ye()}Jt(T,z,A,()=>{p?.(),Ye()})||A(T)}nt(),typeof n=="string"?Gt(n,Q,p):Q(n)},Yt=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},n=t[e];if(typeof n>"u")throw new Error(`Unknown file open mode: ${e}`);return n},at=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},a={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(e){this.name="ErrnoError",this.errno=e}},genericErrors:{},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(e){this.node=e}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(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,t,n,r){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=a.nextInode++,this.name=t,this.mode=n,this.node_ops={},this.stream_ops={},this.rdev=r,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return a.isDir(this.mode)}get isDevice(){return a.isChrdev(this.mode)}},lookupPath(e,t={}){if(e=ke.resolve(e),!e)return{path:"",node:null};var n={follow_mount:!0,recurse_count:0};if(t=Object.assign(n,t),t.recurse_count>8)throw new a.ErrnoError(32);for(var r=e.split("/").filter(Q=>!!Q),s=a.root,o="/",p=0;p<r.length;p++){var g=p===r.length-1;if(g&&t.parent)break;if(s=a.lookupNode(s,r[p]),o=fe.join2(o,r[p]),a.isMountpoint(s)&&(!g||g&&t.follow_mount)&&(s=s.mounted.root),!g||t.follow)for(var P=0;a.isLink(s.mode);){var R=a.readlink(o);o=ke.resolve(fe.dirname(o),R);var z=a.lookupPath(o,{recurse_count:t.recurse_count+1});if(s=z.node,P++>40)throw new a.ErrnoError(32)}}return{path:o,node:s}},getPath(e){for(var t;;){if(a.isRoot(e)){var n=e.mount.mountpoint;return t?n[n.length-1]!=="/"?`${n}/${t}`:n+t:n}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>0)%a.nameTable.length},hashAddNode(e){var t=a.hashName(e.parent.id,e.name);e.name_next=a.nameTable[t],a.nameTable[t]=e},hashRemoveNode(e){var t=a.hashName(e.parent.id,e.name);if(a.nameTable[t]===e)a.nameTable[t]=e.name_next;else for(var n=a.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=a.mayLookup(e);if(n)throw new a.ErrnoError(n);for(var r=a.hashName(e.id,t),s=a.nameTable[r];s;s=s.name_next){var o=s.name;if(s.parent.id===e.id&&o===t)return s}return a.lookup(e,t)},createNode(e,t,n,r){var s=new a.FSNode(e,t,n,r);return a.hashAddNode(s),s},destroyNode(e){a.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var t=["r","w","rw"][e&3];return e&512&&(t+="w"),t},nodePermissions(e,t){return a.ignorePermissions?0:t.includes("r")&&!(e.mode&292)||t.includes("w")&&!(e.mode&146)||t.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!a.isDir(e.mode))return 54;var t=a.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{var n=a.lookupNode(e,t);return 20}catch{}return a.nodePermissions(e,"wx")},mayDelete(e,t,n){var r;try{r=a.lookupNode(e,t)}catch(o){return o.errno}var s=a.nodePermissions(e,"wx");if(s)return s;if(n){if(!a.isDir(r.mode))return 54;if(a.isRoot(r)||a.getPath(r)===a.cwd())return 10}else if(a.isDir(r.mode))return 31;return 0},mayOpen(e,t){return e?a.isLink(e.mode)?32:a.isDir(e.mode)&&(a.flagsToPermissionString(t)!=="r"||t&512)?31:a.nodePermissions(e,a.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=a.MAX_OPEN_FDS;e++)if(!a.streams[e])return e;throw new a.ErrnoError(33)},getStreamChecked(e){var t=a.getStream(e);if(!t)throw new a.ErrnoError(8);return t},getStream:e=>a.streams[e],createStream(e,t=-1){return e=Object.assign(new a.FSStream,e),t==-1&&(t=a.nextfd()),e.fd=t,a.streams[t]=e,e},closeStream(e){a.streams[e]=null},dupStream(e,t=-1){var n=a.createStream(e,t);return n.stream_ops?.dup?.(n),n},chrdev_stream_ops:{open(e){var t=a.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new a.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,t)=>e<<8|t,registerDevice(e,t){a.devices[e]={stream_ops:t}},getDevice:e=>a.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){typeof e=="function"&&(t=e,e=!1),a.syncFSRequests++,a.syncFSRequests>1&&Pe(`warning: ${a.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=a.getMounts(a.root.mount),r=0;function s(p){return a.syncFSRequests--,t(p)}function o(p){if(p)return o.errored?void 0:(o.errored=!0,s(p));++r>=n.length&&s(null)}n.forEach(p=>{if(!p.type.syncfs)return o(null);p.type.syncfs(p,e,o)})},mount(e,t,n){var r=n==="/",s=!n,o;if(r&&a.root)throw new a.ErrnoError(10);if(!r&&!s){var p=a.lookupPath(n,{follow_mount:!1});if(n=p.path,o=p.node,a.isMountpoint(o))throw new a.ErrnoError(10);if(!a.isDir(o.mode))throw new a.ErrnoError(54)}var g={type:e,opts:t,mountpoint:n,mounts:[]},P=e.mount(g);return P.mount=g,g.root=P,r?a.root=P:o&&(o.mounted=g,o.mount&&o.mount.mounts.push(g)),P},unmount(e){var t=a.lookupPath(e,{follow_mount:!1});if(!a.isMountpoint(t.node))throw new a.ErrnoError(28);var n=t.node,r=n.mounted,s=a.getMounts(r);Object.keys(a.nameTable).forEach(p=>{for(var g=a.nameTable[p];g;){var P=g.name_next;s.includes(g.mount)&&a.destroyNode(g),g=P}}),n.mounted=null;var o=n.mount.mounts.indexOf(r);n.mount.mounts.splice(o,1)},lookup(e,t){return e.node_ops.lookup(e,t)},mknod(e,t,n){var r=a.lookupPath(e,{parent:!0}),s=r.node,o=fe.basename(e);if(!o||o==="."||o==="..")throw new a.ErrnoError(28);var p=a.mayCreate(s,o);if(p)throw new a.ErrnoError(p);if(!s.node_ops.mknod)throw new a.ErrnoError(63);return s.node_ops.mknod(s,o,t,n)},create(e,t){return t=t!==void 0?t:438,t&=4095,t|=32768,a.mknod(e,t,0)},mkdir(e,t){return t=t!==void 0?t:511,t&=1023,t|=16384,a.mknod(e,t,0)},mkdirTree(e,t){for(var n=e.split("/"),r="",s=0;s<n.length;++s)if(n[s]){r+="/"+n[s];try{a.mkdir(r,t)}catch(o){if(o.errno!=20)throw o}}},mkdev(e,t,n){return typeof n>"u"&&(n=t,t=438),t|=8192,a.mknod(e,t,n)},symlink(e,t){if(!ke.resolve(e))throw new a.ErrnoError(44);var n=a.lookupPath(t,{parent:!0}),r=n.node;if(!r)throw new a.ErrnoError(44);var s=fe.basename(t),o=a.mayCreate(r,s);if(o)throw new a.ErrnoError(o);if(!r.node_ops.symlink)throw new a.ErrnoError(63);return r.node_ops.symlink(r,s,e)},rename(e,t){var n=fe.dirname(e),r=fe.dirname(t),s=fe.basename(e),o=fe.basename(t),p,g,P;if(p=a.lookupPath(e,{parent:!0}),g=p.node,p=a.lookupPath(t,{parent:!0}),P=p.node,!g||!P)throw new a.ErrnoError(44);if(g.mount!==P.mount)throw new a.ErrnoError(75);var R=a.lookupNode(g,s),z=ke.relative(e,r);if(z.charAt(0)!==".")throw new a.ErrnoError(28);if(z=ke.relative(t,n),z.charAt(0)!==".")throw new a.ErrnoError(55);var Q;try{Q=a.lookupNode(P,o)}catch{}if(R!==Q){var T=a.isDir(R.mode),A=a.mayDelete(g,s,T);if(A)throw new a.ErrnoError(A);if(A=Q?a.mayDelete(P,o,T):a.mayCreate(P,o),A)throw new a.ErrnoError(A);if(!g.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(R)||Q&&a.isMountpoint(Q))throw new a.ErrnoError(10);if(P!==g&&(A=a.nodePermissions(g,"w"),A))throw new a.ErrnoError(A);a.hashRemoveNode(R);try{g.node_ops.rename(R,P,o),R.parent=P}catch(D){throw D}finally{a.hashAddNode(R)}}},rmdir(e){var t=a.lookupPath(e,{parent:!0}),n=t.node,r=fe.basename(e),s=a.lookupNode(n,r),o=a.mayDelete(n,r,!0);if(o)throw new a.ErrnoError(o);if(!n.node_ops.rmdir)throw new a.ErrnoError(63);if(a.isMountpoint(s))throw new a.ErrnoError(10);n.node_ops.rmdir(n,r),a.destroyNode(s)},readdir(e){var t=a.lookupPath(e,{follow:!0}),n=t.node;if(!n.node_ops.readdir)throw new a.ErrnoError(54);return n.node_ops.readdir(n)},unlink(e){var t=a.lookupPath(e,{parent:!0}),n=t.node;if(!n)throw new a.ErrnoError(44);var r=fe.basename(e),s=a.lookupNode(n,r),o=a.mayDelete(n,r,!1);if(o)throw new a.ErrnoError(o);if(!n.node_ops.unlink)throw new a.ErrnoError(63);if(a.isMountpoint(s))throw new a.ErrnoError(10);n.node_ops.unlink(n,r),a.destroyNode(s)},readlink(e){var t=a.lookupPath(e),n=t.node;if(!n)throw new a.ErrnoError(44);if(!n.node_ops.readlink)throw new a.ErrnoError(28);return ke.resolve(a.getPath(n.parent),n.node_ops.readlink(n))},stat(e,t){var n=a.lookupPath(e,{follow:!t}),r=n.node;if(!r)throw new a.ErrnoError(44);if(!r.node_ops.getattr)throw new a.ErrnoError(63);return r.node_ops.getattr(r)},lstat(e){return a.stat(e,!0)},chmod(e,t,n){var r;if(typeof e=="string"){var s=a.lookupPath(e,{follow:!n});r=s.node}else r=e;if(!r.node_ops.setattr)throw new a.ErrnoError(63);r.node_ops.setattr(r,{mode:t&4095|r.mode&-4096,timestamp:Date.now()})},lchmod(e,t){a.chmod(e,t,!0)},fchmod(e,t){var n=a.getStreamChecked(e);a.chmod(n.node,t)},chown(e,t,n,r){var s;if(typeof e=="string"){var o=a.lookupPath(e,{follow:!r});s=o.node}else s=e;if(!s.node_ops.setattr)throw new a.ErrnoError(63);s.node_ops.setattr(s,{timestamp:Date.now()})},lchown(e,t,n){a.chown(e,t,n,!0)},fchown(e,t,n){var r=a.getStreamChecked(e);a.chown(r.node,t,n)},truncate(e,t){if(t<0)throw new a.ErrnoError(28);var n;if(typeof e=="string"){var r=a.lookupPath(e,{follow:!0});n=r.node}else n=e;if(!n.node_ops.setattr)throw new a.ErrnoError(63);if(a.isDir(n.mode))throw new a.ErrnoError(31);if(!a.isFile(n.mode))throw new a.ErrnoError(28);var s=a.nodePermissions(n,"w");if(s)throw new a.ErrnoError(s);n.node_ops.setattr(n,{size:t,timestamp:Date.now()})},ftruncate(e,t){var n=a.getStreamChecked(e);if((n.flags&2097155)===0)throw new a.ErrnoError(28);a.truncate(n.node,t)},utime(e,t,n){var r=a.lookupPath(e,{follow:!0}),s=r.node;s.node_ops.setattr(s,{timestamp:Math.max(t,n)})},open(e,t,n){if(e==="")throw new a.ErrnoError(44);t=typeof t=="string"?Yt(t):t,t&64?(n=typeof n>"u"?438:n,n=n&4095|32768):n=0;var r;if(typeof e=="object")r=e;else{e=fe.normalize(e);try{var s=a.lookupPath(e,{follow:!(t&131072)});r=s.node}catch{}}var o=!1;if(t&64)if(r){if(t&128)throw new a.ErrnoError(20)}else r=a.mknod(e,n,0),o=!0;if(!r)throw new a.ErrnoError(44);if(a.isChrdev(r.mode)&&(t&=-513),t&65536&&!a.isDir(r.mode))throw new a.ErrnoError(54);if(!o){var p=a.mayOpen(r,t);if(p)throw new a.ErrnoError(p)}t&512&&!o&&a.truncate(r,0),t&=-131713;var g=a.createStream({node:r,path:a.getPath(r),flags:t,seekable:!0,position:0,stream_ops:r.stream_ops,ungotten:[],error:!1});return g.stream_ops.open&&g.stream_ops.open(g),i.logReadFiles&&!(t&1)&&(e in a.readFiles||(a.readFiles[e]=1)),g},close(e){if(a.isClosed(e))throw new a.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(t){throw t}finally{a.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,t,n){if(a.isClosed(e))throw new a.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new a.ErrnoError(70);if(n!=0&&n!=1&&n!=2)throw new a.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,s){if(r<0||s<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===1)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.read)throw new a.ErrnoError(28);var o=typeof s<"u";if(!o)s=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var p=e.stream_ops.read(e,t,n,r,s);return o||(e.position+=p),p},write(e,t,n,r,s,o){if(r<0||s<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===0)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.write)throw new a.ErrnoError(28);e.seekable&&e.flags&1024&&a.llseek(e,0,2);var p=typeof s<"u";if(!p)s=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var g=e.stream_ops.write(e,t,n,r,s,o);return p||(e.position+=g),g},allocate(e,t,n){if(a.isClosed(e))throw new a.ErrnoError(8);if(t<0||n<=0)throw new a.ErrnoError(28);if((e.flags&2097155)===0)throw new a.ErrnoError(8);if(!a.isFile(e.node.mode)&&!a.isDir(e.node.mode))throw new a.ErrnoError(43);if(!e.stream_ops.allocate)throw new a.ErrnoError(138);e.stream_ops.allocate(e,t,n)},mmap(e,t,n,r,s){if((r&2)!==0&&(s&2)===0&&(e.flags&2097155)!==2)throw new a.ErrnoError(2);if((e.flags&2097155)===1)throw new a.ErrnoError(2);if(!e.stream_ops.mmap)throw new a.ErrnoError(43);if(!t)throw new a.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,s)},msync(e,t,n,r,s){return e.stream_ops.msync?e.stream_ops.msync(e,t,n,r,s):0},ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new a.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary",t.encoding!=="utf8"&&t.encoding!=="binary")throw new Error(`Invalid encoding type "${t.encoding}"`);var n,r=a.open(e,t.flags),s=a.stat(e),o=s.size,p=new Uint8Array(o);return a.read(r,p,0,o,0),t.encoding==="utf8"?n=Be(p):t.encoding==="binary"&&(n=p),a.close(r),n},writeFile(e,t,n={}){n.flags=n.flags||577;var r=a.open(e,n.flags,n.mode);if(typeof t=="string"){var s=new Uint8Array(Ze(t)+1),o=lt(t,s,0,s.length);a.write(r,s,0,o,void 0,n.canOwn)}else if(ArrayBuffer.isView(t))a.write(r,t,0,t.byteLength,void 0,n.canOwn);else throw new Error("Unsupported data type");a.close(r)},cwd:()=>a.currentPath,chdir(e){var t=a.lookupPath(e,{follow:!0});if(t.node===null)throw new a.ErrnoError(44);if(!a.isDir(t.node.mode))throw new a.ErrnoError(54);var n=a.nodePermissions(t.node,"x");if(n)throw new a.ErrnoError(n);a.currentPath=t.path},createDefaultDirectories(){a.mkdir("/tmp"),a.mkdir("/home"),a.mkdir("/home/web_user")},createDefaultDevices(){a.mkdir("/dev"),a.registerDevice(a.makedev(1,3),{read:()=>0,write:(r,s,o,p,g)=>p}),a.mkdev("/dev/null",a.makedev(1,3)),Re.register(a.makedev(5,0),Re.default_tty_ops),Re.register(a.makedev(6,0),Re.default_tty1_ops),a.mkdev("/dev/tty",a.makedev(5,0)),a.mkdev("/dev/tty1",a.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(t===0&&(t=bt(e).byteLength),e[--t]);a.createDevice("/dev","random",n),a.createDevice("/dev","urandom",n),a.mkdir("/dev/shm"),a.mkdir("/dev/shm/tmp")},createSpecialDirectories(){a.mkdir("/proc");var e=a.mkdir("/proc/self");a.mkdir("/proc/self/fd"),a.mount({mount(){var t=a.createNode(e,"fd",16895,73);return t.node_ops={lookup(n,r){var s=+r,o=a.getStreamChecked(s),p={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>o.path}};return p.parent=p,p}},t}},{},"/proc/self/fd")},createStandardStreams(e,t,n){e?a.createDevice("/dev","stdin",e):a.symlink("/dev/tty","/dev/stdin"),t?a.createDevice("/dev","stdout",null,t):a.symlink("/dev/tty","/dev/stdout"),n?a.createDevice("/dev","stderr",null,n):a.symlink("/dev/tty1","/dev/stderr"),a.open("/dev/stdin",0),a.open("/dev/stdout",1),a.open("/dev/stderr",1)},staticInit(){[44].forEach(e=>{a.genericErrors[e]=new a.ErrnoError(e),a.genericErrors[e].stack="<generic error, no stack>"}),a.nameTable=new Array(4096),a.mount(oe,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:oe}},init(e,t,n){a.initialized=!0,e??=i.stdin,t??=i.stdout,n??=i.stderr,a.createStandardStreams(e,t,n)},quit(){a.initialized=!1;for(var e=0;e<a.streams.length;e++){var t=a.streams[e];t&&a.close(t)}},findObject(e,t){var n=a.analyzePath(e,t);return n.exists?n.object:null},analyzePath(e,t){try{var n=a.lookupPath(e,{follow:!t});e=n.path}catch{}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=a.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=fe.basename(e),n=a.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot=n.path==="/"}catch(s){r.error=s.errno}return r},createPath(e,t,n,r){e=typeof e=="string"?e:a.getPath(e);for(var s=t.split("/").reverse();s.length;){var o=s.pop();if(o){var p=fe.join2(e,o);try{a.mkdir(p)}catch{}e=p}}return p},createFile(e,t,n,r,s){var o=fe.join2(typeof e=="string"?e:a.getPath(e),t),p=at(r,s);return a.create(o,p)},createDataFile(e,t,n,r,s,o){var p=t;e&&(e=typeof e=="string"?e:a.getPath(e),p=t?fe.join2(e,t):e);var g=at(r,s),P=a.create(p,g);if(n){if(typeof n=="string"){for(var R=new Array(n.length),z=0,Q=n.length;z<Q;++z)R[z]=n.charCodeAt(z);n=R}a.chmod(P,g|146);var T=a.open(P,577);a.write(T,n,0,n.length,0,o),a.close(T),a.chmod(P,g)}},createDevice(e,t,n,r){var s=fe.join2(typeof e=="string"?e:a.getPath(e),t),o=at(!!n,!!r);a.createDevice.major??=64;var p=a.makedev(a.createDevice.major++,0);return a.registerDevice(p,{open(g){g.seekable=!1},close(g){r?.buffer?.length&&r(10)},read(g,P,R,z,Q){for(var T=0,A=0;A<z;A++){var D;try{D=n()}catch{throw new a.ErrnoError(29)}if(D===void 0&&T===0)throw new a.ErrnoError(6);if(D==null)break;T++,P[R+A]=D}return T&&(g.node.timestamp=Date.now()),T},write(g,P,R,z,Q){for(var T=0;T<z;T++)try{r(P[R+T])}catch{throw new a.ErrnoError(29)}return z&&(g.node.timestamp=Date.now()),T}}),a.mkdev(s,o,p)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.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.");try{e.contents=Me(e.url),e.usedBytes=e.contents.length}catch{throw new a.ErrnoError(29)}},createLazyFile(e,t,n,r,s){class o{constructor(){this.lengthKnown=!1,this.chunks=[]}get(A){if(!(A>this.length-1||A<0)){var D=A%this.chunkSize,q=A/this.chunkSize|0;return this.getter(q)[D]}}setDataGetter(A){this.getter=A}cacheLength(){var A=new XMLHttpRequest;if(A.open("HEAD",n,!1),A.send(null),!(A.status>=200&&A.status<300||A.status===304))throw new Error("Couldn't load "+n+". Status: "+A.status);var D=Number(A.getResponseHeader("Content-length")),q,w=(q=A.getResponseHeader("Accept-Ranges"))&&q==="bytes",x=(q=A.getResponseHeader("Content-Encoding"))&&q==="gzip",N=1024*1024;w||(N=D);var O=(L,$)=>{if(L>$)throw new Error("invalid range ("+L+", "+$+") or no bytes requested!");if($>D-1)throw new Error("only "+D+" bytes available! programmer error!");var c=new XMLHttpRequest;if(c.open("GET",n,!1),D!==N&&c.setRequestHeader("Range","bytes="+L+"-"+$),c.responseType="arraybuffer",c.overrideMimeType&&c.overrideMimeType("text/plain; charset=x-user-defined"),c.send(null),!(c.status>=200&&c.status<300||c.status===304))throw new Error("Couldn't load "+n+". Status: "+c.status);return c.response!==void 0?new Uint8Array(c.response||[]):wt(c.responseText||"")},S=this;S.setDataGetter(L=>{var $=L*N,c=(L+1)*N-1;if(c=Math.min(c,D-1),typeof S.chunks[L]>"u"&&(S.chunks[L]=O($,c)),typeof S.chunks[L]>"u")throw new Error("doXHR failed!");return S.chunks[L]}),(x||!D)&&(N=D=1,D=this.getter(0).length,N=D,He("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=D,this._chunkSize=N,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(!Oe)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var p=new o,g={isDevice:!1,contents:p}}else var g={isDevice:!1,url:n};var P=a.createFile(e,t,g,r,s);g.contents?P.contents=g.contents:g.url&&(P.contents=null,P.url=g.url),Object.defineProperties(P,{usedBytes:{get:function(){return this.contents.length}}});var R={},z=Object.keys(P.stream_ops);z.forEach(T=>{var A=P.stream_ops[T];R[T]=(...D)=>(a.forceLoadFile(P),A(...D))});function Q(T,A,D,q,w){var x=T.node.contents;if(w>=x.length)return 0;var N=Math.min(x.length-w,q);if(x.slice)for(var O=0;O<N;O++)A[D+O]=x[w+O];else for(var O=0;O<N;O++)A[D+O]=x.get(w+O);return N}return R.read=(T,A,D,q,w)=>(a.forceLoadFile(P),Q(T,A,D,q,w)),R.mmap=(T,A,D,q,w)=>{a.forceLoadFile(P);var x=vt(A);if(!x)throw new a.ErrnoError(48);return Q(T,xe,x,A,D),{ptr:x,allocated:!0}},P.stream_ops=R,P}},Zt=(e,t)=>e?Be(je,e,t):"",ae={DEFAULT_POLLMASK:5,calculateAt(e,t,n){if(fe.isAbs(t))return t;var r;if(e===-100)r=a.cwd();else{var s=ae.getStreamFromFD(e);r=s.path}if(t.length==0){if(!n)throw new a.ErrnoError(44);return r}return fe.join2(r,t)},doStat(e,t,n){var r=e(t);ue[n>>2]=r.dev,ue[n+4>>2]=r.mode,we[n+8>>2]=r.nlink,ue[n+12>>2]=r.uid,ue[n+16>>2]=r.gid,ue[n+20>>2]=r.rdev,Ie[n+24>>3]=BigInt(r.size),ue[n+32>>2]=4096,ue[n+36>>2]=r.blocks;var s=r.atime.getTime(),o=r.mtime.getTime(),p=r.ctime.getTime();return Ie[n+40>>3]=BigInt(Math.floor(s/1e3)),we[n+48>>2]=s%1e3*1e3*1e3,Ie[n+56>>3]=BigInt(Math.floor(o/1e3)),we[n+64>>2]=o%1e3*1e3*1e3,Ie[n+72>>3]=BigInt(Math.floor(p/1e3)),we[n+80>>2]=p%1e3*1e3*1e3,Ie[n+88>>3]=BigInt(r.ino),0},doMsync(e,t,n,r,s){if(!a.isFile(t.node.mode))throw new a.ErrnoError(43);if(r&2)return 0;var o=je.slice(e,e+n);a.msync(t,o,s,n,r)},getStreamFromFD(e){var t=a.getStreamChecked(e);return t},varargs:void 0,getStr(e){var t=Zt(e);return t}};function en(e,t){try{return e=ae.getStr(e),a.chmod(e,t),0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function tn(e,t,n,r){try{if(t=ae.getStr(t),t=ae.calculateAt(e,t),n&-8)return-28;var s=a.lookupPath(t,{follow:!0}),o=s.node;if(!o)return-44;var p="";return n&4&&(p+="r"),n&2&&(p+="w"),n&1&&(p+="x"),p&&a.nodePermissions(o,p)?-2:0}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function nn(e,t){try{return a.fchmod(e,t),0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function rn(e,t,n){try{return a.fchown(e,t,n),0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function et(){var e=ue[+ae.varargs>>2];return ae.varargs+=4,e}var Ue=et;function sn(e,t,n){ae.varargs=n;try{var r=ae.getStreamFromFD(e);switch(t){case 0:{var s=et();if(s<0)return-28;for(;a.streams[s];)s++;var o;return o=a.dupStream(r,s),o.fd}case 1:case 2:return 0;case 3:return r.flags;case 4:{var s=et();return r.flags|=s,0}case 12:{var s=Ue(),p=0;return Ve[s+p>>1]=2,0}case 13:case 14:return 0}return-28}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function on(e,t){try{var n=ae.getStreamFromFD(e);return ae.doStat(a.stat,n.path,t)}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}var ln=9007199254740992,an=-9007199254740992,$e=e=>e<an||e>ln?NaN:Number(e);function cn(e,t){t=$e(t);try{return isNaN(t)?61:(a.ftruncate(e,t),0)}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var ze=(e,t,n)=>lt(e,je,t,n);function _n(e,t){try{if(t===0)return-28;var n=a.cwd(),r=Ze(n)+1;return t<r?-68:(ze(n,e,t),r)}catch(s){if(typeof a>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function un(e,t,n){ae.varargs=n;try{var r=ae.getStreamFromFD(e);switch(t){case 21509:return r.tty?0:-59;case 21505:{if(!r.tty)return-59;if(r.tty.ops.ioctl_tcgets){var s=r.tty.ops.ioctl_tcgets(r),o=Ue();ue[o>>2]=s.c_iflag||0,ue[o+4>>2]=s.c_oflag||0,ue[o+8>>2]=s.c_cflag||0,ue[o+12>>2]=s.c_lflag||0;for(var p=0;p<32;p++)xe[o+p+17]=s.c_cc[p]||0;return 0}return 0}case 21510:case 21511:case 21512:return r.tty?0:-59;case 21506:case 21507:case 21508:{if(!r.tty)return-59;if(r.tty.ops.ioctl_tcsets){for(var o=Ue(),g=ue[o>>2],P=ue[o+4>>2],R=ue[o+8>>2],z=ue[o+12>>2],Q=[],p=0;p<32;p++)Q.push(xe[o+p+17]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:g,c_oflag:P,c_cflag:R,c_lflag:z,c_cc:Q})}return 0}case 21519:{if(!r.tty)return-59;var o=Ue();return ue[o>>2]=0,0}case 21520:return r.tty?-28:-59;case 21531:{var o=Ue();return a.ioctl(r,t,o)}case 21523:{if(!r.tty)return-59;if(r.tty.ops.ioctl_tiocgwinsz){var T=r.tty.ops.ioctl_tiocgwinsz(r.tty),o=Ue();Ve[o>>1]=T[0],Ve[o+2>>1]=T[1]}return 0}case 21524:return r.tty?0:-59;case 21515:return r.tty?0:-59;default:return-28}}catch(A){if(typeof a>"u"||A.name!=="ErrnoError")throw A;return-A.errno}}function fn(e,t){try{return e=ae.getStr(e),ae.doStat(a.lstat,e,t)}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function dn(e,t,n){try{return t=ae.getStr(t),t=ae.calculateAt(e,t),t=fe.normalize(t),t[t.length-1]==="/"&&(t=t.substr(0,t.length-1)),a.mkdir(t,n,0),0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function pn(e,t,n,r){try{t=ae.getStr(t);var s=r&256,o=r&4096;return r=r&-6401,t=ae.calculateAt(e,t,o),ae.doStat(s?a.lstat:a.stat,t,n)}catch(p){if(typeof a>"u"||p.name!=="ErrnoError")throw p;return-p.errno}}function mn(e,t,n,r){ae.varargs=r;try{t=ae.getStr(t),t=ae.calculateAt(e,t);var s=r?et():0;return a.open(t,n,s).fd}catch(o){if(typeof a>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function hn(e,t,n,r){try{if(t=ae.getStr(t),t=ae.calculateAt(e,t),r<=0)return-28;var s=a.readlink(t),o=Math.min(r,Ze(s)),p=xe[n+o];return ze(s,n,r+1),xe[n+o]=p,o}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function gn(e){try{return e=ae.getStr(e),a.rmdir(e),0}catch(t){if(typeof a>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function qn(e,t){try{return e=ae.getStr(e),ae.doStat(a.stat,e,t)}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function bn(e,t,n){try{return t=ae.getStr(t),t=ae.calculateAt(e,t),n===0?a.unlink(t):n===512?a.rmdir(t):rt("Invalid flags passed to unlinkat"),0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}var xt=e=>we[e>>2]+ue[e+4>>2]*4294967296;function yn(e,t,n,r){try{t=ae.getStr(t),t=ae.calculateAt(e,t,!0);var s=Date.now(),o,p;if(!n)o=s,p=s;else{var g=xt(n),P=ue[n+8>>2];P==1073741823?o=s:P==1073741822?o=-1:o=g*1e3+P/(1e3*1e3),n+=16,g=xt(n),P=ue[n+8>>2],P==1073741823?p=s:P==1073741822?p=-1:p=g*1e3+P/(1e3*1e3)}return(p!=-1||o!=-1)&&a.utime(t,o,p),0}catch(R){if(typeof a>"u"||R.name!=="ErrnoError")throw R;return-R.errno}}var wn=1,En=()=>wn,vn=e=>e%4===0&&(e%100!==0||e%400===0),xn=[0,31,60,91,121,152,182,213,244,274,305,335],Sn=[0,31,59,90,120,151,181,212,243,273,304,334],An=e=>{var t=vn(e.getFullYear()),n=t?xn:Sn,r=n[e.getMonth()]+e.getDate()-1;return r};function In(e,t){e=$e(e);var n=new Date(e*1e3);ue[t>>2]=n.getSeconds(),ue[t+4>>2]=n.getMinutes(),ue[t+8>>2]=n.getHours(),ue[t+12>>2]=n.getDate(),ue[t+16>>2]=n.getMonth(),ue[t+20>>2]=n.getFullYear()-1900,ue[t+24>>2]=n.getDay();var r=An(n)|0;ue[t+28>>2]=r,ue[t+36>>2]=-(n.getTimezoneOffset()*60);var s=new Date(n.getFullYear(),0,1),o=new Date(n.getFullYear(),6,1).getTimezoneOffset(),p=s.getTimezoneOffset(),g=(o!=p&&n.getTimezoneOffset()==Math.min(p,o))|0;ue[t+32>>2]=g}function kn(e,t,n,r,s,o,p){s=$e(s);try{if(isNaN(s))return 61;var g=ae.getStreamFromFD(r),P=a.mmap(g,e,s,t,n),R=P.ptr;return ue[o>>2]=P.allocated,we[p>>2]=R,0}catch(z){if(typeof a>"u"||z.name!=="ErrnoError")throw z;return-z.errno}}function Tn(e,t,n,r,s,o){o=$e(o);try{var p=ae.getStreamFromFD(s);n&2&&ae.doMsync(e,p,t,r,o)}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}var Fn=(e,t,n,r)=>{var s=new Date().getFullYear(),o=new Date(s,0,1),p=new Date(s,6,1),g=o.getTimezoneOffset(),P=p.getTimezoneOffset(),R=Math.max(g,P);we[e>>2]=R*60,ue[t>>2]=+(g!=P);var z=A=>{var D=A>=0?"-":"+",q=Math.abs(A),w=String(Math.floor(q/60)).padStart(2,"0"),x=String(q%60).padStart(2,"0");return`UTC${D}${w}${x}`},Q=z(g),T=z(P);P<g?(ze(Q,n,17),ze(T,r,17)):(ze(Q,r,17),ze(T,n,17))},Pn=()=>Date.now(),On=()=>performance.now(),Ln=()=>2147483648,Cn=e=>{var t=Ce.buffer,n=(e-t.byteLength+65535)/65536|0;try{return Ce.grow(n),ft(),1}catch{}},Dn=e=>{var t=je.length;e>>>=0;var n=Ln();if(e>n)return!1;for(var r=1;r<=4;r*=2){var s=t*(1+.2/r);s=Math.min(s,e+100663296);var o=Math.min(n,Et(Math.max(e,s),65536)),p=Cn(o);if(p)return!0}return!1},ct={},Rn=()=>re||"./this.program",Ke=()=>{if(!Ke.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Rn()};for(var n in ct)ct[n]===void 0?delete t[n]:t[n]=ct[n];var r=[];for(var n in t)r.push(`${n}=${t[n]}`);Ke.strings=r}return Ke.strings},Nn=(e,t)=>{for(var n=0;n<e.length;++n)xe[t++]=e.charCodeAt(n);xe[t]=0},Mn=(e,t)=>{var n=0;return Ke().forEach((r,s)=>{var o=t+n;we[e+s*4>>2]=o,Nn(r,o),n+=r.length+1}),0},jn=(e,t)=>{var n=Ke();we[e>>2]=n.length;var r=0;return n.forEach(s=>r+=s.length+1),we[t>>2]=r,0};function Bn(e){try{var t=ae.getStreamFromFD(e);return a.close(t),0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return n.errno}}function Un(e,t){try{var n=0,r=0,s=0,o=ae.getStreamFromFD(e),p=o.tty?2:a.isDir(o.mode)?3:a.isLink(o.mode)?7:4;return xe[t]=p,Ve[t+2>>1]=s,Ie[t+8>>3]=BigInt(n),Ie[t+16>>3]=BigInt(r),0}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return g.errno}}var zn=(e,t,n,r)=>{for(var s=0,o=0;o<n;o++){var p=we[t>>2],g=we[t+4>>2];t+=8;var P=a.read(e,xe,p,g,r);if(P<0)return-1;if(s+=P,P<g)break}return s};function Wn(e,t,n,r){try{var s=ae.getStreamFromFD(e),o=zn(s,t,n);return we[r>>2]=o,0}catch(p){if(typeof a>"u"||p.name!=="ErrnoError")throw p;return p.errno}}function Qn(e,t,n,r){t=$e(t);try{if(isNaN(t))return 61;var s=ae.getStreamFromFD(e);return a.llseek(s,t,n),Ie[r>>3]=BigInt(s.position),s.getdents&&t===0&&n===0&&(s.getdents=null),0}catch(o){if(typeof a>"u"||o.name!=="ErrnoError")throw o;return o.errno}}function Hn(e){try{var t=ae.getStreamFromFD(e);return t.stream_ops?.fsync?t.stream_ops.fsync(t):0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return n.errno}}var Vn=(e,t,n,r)=>{for(var s=0,o=0;o<n;o++){var p=we[t>>2],g=we[t+4>>2];t+=8;var P=a.write(e,xe,p,g,r);if(P<0)return-1;if(s+=P,P<g)break}return s};function Gn(e,t,n,r){try{var s=ae.getStreamFromFD(e),o=Vn(s,t,n);return we[r>>2]=o,0}catch(p){if(typeof a>"u"||p.name!=="ErrnoError")throw p;return p.errno}}a.createPreloadedFile=Xt,a.staticInit();var St={__syscall_chmod:en,__syscall_faccessat:tn,__syscall_fchmod:nn,__syscall_fchown32:rn,__syscall_fcntl64:sn,__syscall_fstat64:on,__syscall_ftruncate64:cn,__syscall_getcwd:_n,__syscall_ioctl:un,__syscall_lstat64:fn,__syscall_mkdirat:dn,__syscall_newfstatat:pn,__syscall_openat:mn,__syscall_readlinkat:hn,__syscall_rmdir:gn,__syscall_stat64:qn,__syscall_unlinkat:bn,__syscall_utimensat:yn,_emscripten_get_now_is_monotonic:En,_localtime_js:In,_mmap_js:kn,_munmap_js:Tn,_tzset_js:Fn,emscripten_date_now:Pn,emscripten_get_now:On,emscripten_resize_heap:Dn,environ_get:Mn,environ_sizes_get:jn,fd_close:Bn,fd_fdstat_get:Un,fd_read:Wn,fd_seek:Qn,fd_sync:Hn,fd_write:Gn,memory:Ce},m=Wt();i._sqlite3_status64=(e,t,n,r)=>(i._sqlite3_status64=m.sqlite3_status64)(e,t,n,r),i._sqlite3_status=(e,t,n,r)=>(i._sqlite3_status=m.sqlite3_status)(e,t,n,r),i._sqlite3_db_status=(e,t,n,r,s)=>(i._sqlite3_db_status=m.sqlite3_db_status)(e,t,n,r,s),i._sqlite3_msize=e=>(i._sqlite3_msize=m.sqlite3_msize)(e),i._sqlite3_vfs_find=e=>(i._sqlite3_vfs_find=m.sqlite3_vfs_find)(e),i._sqlite3_initialize=()=>(i._sqlite3_initialize=m.sqlite3_initialize)(),i._sqlite3_malloc=e=>(i._sqlite3_malloc=m.sqlite3_malloc)(e),i._sqlite3_free=e=>(i._sqlite3_free=m.sqlite3_free)(e),i._sqlite3_vfs_register=(e,t)=>(i._sqlite3_vfs_register=m.sqlite3_vfs_register)(e,t),i._sqlite3_vfs_unregister=e=>(i._sqlite3_vfs_unregister=m.sqlite3_vfs_unregister)(e),i._sqlite3_malloc64=e=>(i._sqlite3_malloc64=m.sqlite3_malloc64)(e),i._sqlite3_realloc=(e,t)=>(i._sqlite3_realloc=m.sqlite3_realloc)(e,t),i._sqlite3_realloc64=(e,t)=>(i._sqlite3_realloc64=m.sqlite3_realloc64)(e,t),i._sqlite3_value_text=e=>(i._sqlite3_value_text=m.sqlite3_value_text)(e),i._sqlite3_randomness=(e,t)=>(i._sqlite3_randomness=m.sqlite3_randomness)(e,t),i._sqlite3_stricmp=(e,t)=>(i._sqlite3_stricmp=m.sqlite3_stricmp)(e,t),i._sqlite3_strnicmp=(e,t,n)=>(i._sqlite3_strnicmp=m.sqlite3_strnicmp)(e,t,n),i._sqlite3_uri_parameter=(e,t)=>(i._sqlite3_uri_parameter=m.sqlite3_uri_parameter)(e,t),i._sqlite3_uri_boolean=(e,t,n)=>(i._sqlite3_uri_boolean=m.sqlite3_uri_boolean)(e,t,n),i._sqlite3_serialize=(e,t,n,r)=>(i._sqlite3_serialize=m.sqlite3_serialize)(e,t,n,r),i._sqlite3_prepare_v2=(e,t,n,r,s)=>(i._sqlite3_prepare_v2=m.sqlite3_prepare_v2)(e,t,n,r,s),i._sqlite3_step=e=>(i._sqlite3_step=m.sqlite3_step)(e),i._sqlite3_column_int64=(e,t)=>(i._sqlite3_column_int64=m.sqlite3_column_int64)(e,t),i._sqlite3_reset=e=>(i._sqlite3_reset=m.sqlite3_reset)(e),i._sqlite3_exec=(e,t,n,r,s)=>(i._sqlite3_exec=m.sqlite3_exec)(e,t,n,r,s),i._sqlite3_column_int=(e,t)=>(i._sqlite3_column_int=m.sqlite3_column_int)(e,t),i._sqlite3_finalize=e=>(i._sqlite3_finalize=m.sqlite3_finalize)(e),i._sqlite3_file_control=(e,t,n,r)=>(i._sqlite3_file_control=m.sqlite3_file_control)(e,t,n,r),i._sqlite3_column_name=(e,t)=>(i._sqlite3_column_name=m.sqlite3_column_name)(e,t),i._sqlite3_column_text=(e,t)=>(i._sqlite3_column_text=m.sqlite3_column_text)(e,t),i._sqlite3_column_type=(e,t)=>(i._sqlite3_column_type=m.sqlite3_column_type)(e,t),i._sqlite3_errmsg=e=>(i._sqlite3_errmsg=m.sqlite3_errmsg)(e),i._sqlite3_deserialize=(e,t,n,r,s,o)=>(i._sqlite3_deserialize=m.sqlite3_deserialize)(e,t,n,r,s,o),i._sqlite3_clear_bindings=e=>(i._sqlite3_clear_bindings=m.sqlite3_clear_bindings)(e),i._sqlite3_value_blob=e=>(i._sqlite3_value_blob=m.sqlite3_value_blob)(e),i._sqlite3_value_bytes=e=>(i._sqlite3_value_bytes=m.sqlite3_value_bytes)(e),i._sqlite3_value_double=e=>(i._sqlite3_value_double=m.sqlite3_value_double)(e),i._sqlite3_value_int=e=>(i._sqlite3_value_int=m.sqlite3_value_int)(e),i._sqlite3_value_int64=e=>(i._sqlite3_value_int64=m.sqlite3_value_int64)(e),i._sqlite3_value_subtype=e=>(i._sqlite3_value_subtype=m.sqlite3_value_subtype)(e),i._sqlite3_value_pointer=(e,t)=>(i._sqlite3_value_pointer=m.sqlite3_value_pointer)(e,t),i._sqlite3_value_type=e=>(i._sqlite3_value_type=m.sqlite3_value_type)(e),i._sqlite3_value_nochange=e=>(i._sqlite3_value_nochange=m.sqlite3_value_nochange)(e),i._sqlite3_value_frombind=e=>(i._sqlite3_value_frombind=m.sqlite3_value_frombind)(e),i._sqlite3_value_dup=e=>(i._sqlite3_value_dup=m.sqlite3_value_dup)(e),i._sqlite3_value_free=e=>(i._sqlite3_value_free=m.sqlite3_value_free)(e),i._sqlite3_result_blob=(e,t,n,r)=>(i._sqlite3_result_blob=m.sqlite3_result_blob)(e,t,n,r),i._sqlite3_result_error_toobig=e=>(i._sqlite3_result_error_toobig=m.sqlite3_result_error_toobig)(e),i._sqlite3_result_error_nomem=e=>(i._sqlite3_result_error_nomem=m.sqlite3_result_error_nomem)(e),i._sqlite3_result_double=(e,t)=>(i._sqlite3_result_double=m.sqlite3_result_double)(e,t),i._sqlite3_result_error=(e,t,n)=>(i._sqlite3_result_error=m.sqlite3_result_error)(e,t,n),i._sqlite3_result_int=(e,t)=>(i._sqlite3_result_int=m.sqlite3_result_int)(e,t),i._sqlite3_result_int64=(e,t)=>(i._sqlite3_result_int64=m.sqlite3_result_int64)(e,t),i._sqlite3_result_null=e=>(i._sqlite3_result_null=m.sqlite3_result_null)(e),i._sqlite3_result_pointer=(e,t,n,r)=>(i._sqlite3_result_pointer=m.sqlite3_result_pointer)(e,t,n,r),i._sqlite3_result_subtype=(e,t)=>(i._sqlite3_result_subtype=m.sqlite3_result_subtype)(e,t),i._sqlite3_result_text=(e,t,n,r)=>(i._sqlite3_result_text=m.sqlite3_result_text)(e,t,n,r),i._sqlite3_result_zeroblob=(e,t)=>(i._sqlite3_result_zeroblob=m.sqlite3_result_zeroblob)(e,t),i._sqlite3_result_zeroblob64=(e,t)=>(i._sqlite3_result_zeroblob64=m.sqlite3_result_zeroblob64)(e,t),i._sqlite3_result_error_code=(e,t)=>(i._sqlite3_result_error_code=m.sqlite3_result_error_code)(e,t),i._sqlite3_user_data=e=>(i._sqlite3_user_data=m.sqlite3_user_data)(e),i._sqlite3_context_db_handle=e=>(i._sqlite3_context_db_handle=m.sqlite3_context_db_handle)(e),i._sqlite3_vtab_nochange=e=>(i._sqlite3_vtab_nochange=m.sqlite3_vtab_nochange)(e),i._sqlite3_vtab_in_first=(e,t)=>(i._sqlite3_vtab_in_first=m.sqlite3_vtab_in_first)(e,t),i._sqlite3_vtab_in_next=(e,t)=>(i._sqlite3_vtab_in_next=m.sqlite3_vtab_in_next)(e,t),i._sqlite3_aggregate_context=(e,t)=>(i._sqlite3_aggregate_context=m.sqlite3_aggregate_context)(e,t),i._sqlite3_get_auxdata=(e,t)=>(i._sqlite3_get_auxdata=m.sqlite3_get_auxdata)(e,t),i._sqlite3_set_auxdata=(e,t,n,r)=>(i._sqlite3_set_auxdata=m.sqlite3_set_auxdata)(e,t,n,r),i._sqlite3_column_count=e=>(i._sqlite3_column_count=m.sqlite3_column_count)(e),i._sqlite3_data_count=e=>(i._sqlite3_data_count=m.sqlite3_data_count)(e),i._sqlite3_column_blob=(e,t)=>(i._sqlite3_column_blob=m.sqlite3_column_blob)(e,t),i._sqlite3_column_bytes=(e,t)=>(i._sqlite3_column_bytes=m.sqlite3_column_bytes)(e,t),i._sqlite3_column_double=(e,t)=>(i._sqlite3_column_double=m.sqlite3_column_double)(e,t),i._sqlite3_column_value=(e,t)=>(i._sqlite3_column_value=m.sqlite3_column_value)(e,t),i._sqlite3_column_decltype=(e,t)=>(i._sqlite3_column_decltype=m.sqlite3_column_decltype)(e,t),i._sqlite3_bind_blob=(e,t,n,r,s)=>(i._sqlite3_bind_blob=m.sqlite3_bind_blob)(e,t,n,r,s),i._sqlite3_bind_double=(e,t,n)=>(i._sqlite3_bind_double=m.sqlite3_bind_double)(e,t,n),i._sqlite3_bind_int=(e,t,n)=>(i._sqlite3_bind_int=m.sqlite3_bind_int)(e,t,n),i._sqlite3_bind_int64=(e,t,n)=>(i._sqlite3_bind_int64=m.sqlite3_bind_int64)(e,t,n),i._sqlite3_bind_null=(e,t)=>(i._sqlite3_bind_null=m.sqlite3_bind_null)(e,t),i._sqlite3_bind_pointer=(e,t,n,r,s)=>(i._sqlite3_bind_pointer=m.sqlite3_bind_pointer)(e,t,n,r,s),i._sqlite3_bind_text=(e,t,n,r,s)=>(i._sqlite3_bind_text=m.sqlite3_bind_text)(e,t,n,r,s),i._sqlite3_bind_parameter_count=e=>(i._sqlite3_bind_parameter_count=m.sqlite3_bind_parameter_count)(e),i._sqlite3_bind_parameter_name=(e,t)=>(i._sqlite3_bind_parameter_name=m.sqlite3_bind_parameter_name)(e,t),i._sqlite3_bind_parameter_index=(e,t)=>(i._sqlite3_bind_parameter_index=m.sqlite3_bind_parameter_index)(e,t),i._sqlite3_db_handle=e=>(i._sqlite3_db_handle=m.sqlite3_db_handle)(e),i._sqlite3_stmt_readonly=e=>(i._sqlite3_stmt_readonly=m.sqlite3_stmt_readonly)(e),i._sqlite3_stmt_isexplain=e=>(i._sqlite3_stmt_isexplain=m.sqlite3_stmt_isexplain)(e),i._sqlite3_stmt_explain=(e,t)=>(i._sqlite3_stmt_explain=m.sqlite3_stmt_explain)(e,t),i._sqlite3_stmt_busy=e=>(i._sqlite3_stmt_busy=m.sqlite3_stmt_busy)(e),i._sqlite3_stmt_status=(e,t,n)=>(i._sqlite3_stmt_status=m.sqlite3_stmt_status)(e,t,n),i._sqlite3_sql=e=>(i._sqlite3_sql=m.sqlite3_sql)(e),i._sqlite3_expanded_sql=e=>(i._sqlite3_expanded_sql=m.sqlite3_expanded_sql)(e),i._sqlite3_preupdate_old=(e,t,n)=>(i._sqlite3_preupdate_old=m.sqlite3_preupdate_old)(e,t,n),i._sqlite3_preupdate_count=e=>(i._sqlite3_preupdate_count=m.sqlite3_preupdate_count)(e),i._sqlite3_preupdate_depth=e=>(i._sqlite3_preupdate_depth=m.sqlite3_preupdate_depth)(e),i._sqlite3_preupdate_blobwrite=e=>(i._sqlite3_preupdate_blobwrite=m.sqlite3_preupdate_blobwrite)(e),i._sqlite3_preupdate_new=(e,t,n)=>(i._sqlite3_preupdate_new=m.sqlite3_preupdate_new)(e,t,n),i._sqlite3_value_numeric_type=e=>(i._sqlite3_value_numeric_type=m.sqlite3_value_numeric_type)(e),i._sqlite3_set_authorizer=(e,t,n)=>(i._sqlite3_set_authorizer=m.sqlite3_set_authorizer)(e,t,n),i._sqlite3_strglob=(e,t)=>(i._sqlite3_strglob=m.sqlite3_strglob)(e,t),i._sqlite3_strlike=(e,t,n)=>(i._sqlite3_strlike=m.sqlite3_strlike)(e,t,n),i._sqlite3_auto_extension=e=>(i._sqlite3_auto_extension=m.sqlite3_auto_extension)(e),i._sqlite3_cancel_auto_extension=e=>(i._sqlite3_cancel_auto_extension=m.sqlite3_cancel_auto_extension)(e),i._sqlite3_reset_auto_extension=()=>(i._sqlite3_reset_auto_extension=m.sqlite3_reset_auto_extension)(),i._sqlite3_prepare_v3=(e,t,n,r,s,o)=>(i._sqlite3_prepare_v3=m.sqlite3_prepare_v3)(e,t,n,r,s,o),i._sqlite3_create_module=(e,t,n,r)=>(i._sqlite3_create_module=m.sqlite3_create_module)(e,t,n,r),i._sqlite3_create_module_v2=(e,t,n,r,s)=>(i._sqlite3_create_module_v2=m.sqlite3_create_module_v2)(e,t,n,r,s),i._sqlite3_drop_modules=(e,t)=>(i._sqlite3_drop_modules=m.sqlite3_drop_modules)(e,t),i._sqlite3_declare_vtab=(e,t)=>(i._sqlite3_declare_vtab=m.sqlite3_declare_vtab)(e,t),i._sqlite3_vtab_on_conflict=e=>(i._sqlite3_vtab_on_conflict=m.sqlite3_vtab_on_conflict)(e),i._sqlite3_vtab_collation=(e,t)=>(i._sqlite3_vtab_collation=m.sqlite3_vtab_collation)(e,t),i._sqlite3_vtab_in=(e,t,n)=>(i._sqlite3_vtab_in=m.sqlite3_vtab_in)(e,t,n),i._sqlite3_vtab_rhs_value=(e,t,n)=>(i._sqlite3_vtab_rhs_value=m.sqlite3_vtab_rhs_value)(e,t,n),i._sqlite3_vtab_distinct=e=>(i._sqlite3_vtab_distinct=m.sqlite3_vtab_distinct)(e),i._sqlite3_keyword_name=(e,t,n)=>(i._sqlite3_keyword_name=m.sqlite3_keyword_name)(e,t,n),i._sqlite3_keyword_count=()=>(i._sqlite3_keyword_count=m.sqlite3_keyword_count)(),i._sqlite3_keyword_check=(e,t)=>(i._sqlite3_keyword_check=m.sqlite3_keyword_check)(e,t),i._sqlite3_complete=e=>(i._sqlite3_complete=m.sqlite3_complete)(e),i._sqlite3_libversion=()=>(i._sqlite3_libversion=m.sqlite3_libversion)(),i._sqlite3_libversion_number=()=>(i._sqlite3_libversion_number=m.sqlite3_libversion_number)(),i._sqlite3_shutdown=()=>(i._sqlite3_shutdown=m.sqlite3_shutdown)(),i._sqlite3_last_insert_rowid=e=>(i._sqlite3_last_insert_rowid=m.sqlite3_last_insert_rowid)(e),i._sqlite3_set_last_insert_rowid=(e,t)=>(i._sqlite3_set_last_insert_rowid=m.sqlite3_set_last_insert_rowid)(e,t),i._sqlite3_changes64=e=>(i._sqlite3_changes64=m.sqlite3_changes64)(e),i._sqlite3_changes=e=>(i._sqlite3_changes=m.sqlite3_changes)(e),i._sqlite3_total_changes64=e=>(i._sqlite3_total_changes64=m.sqlite3_total_changes64)(e),i._sqlite3_total_changes=e=>(i._sqlite3_total_changes=m.sqlite3_total_changes)(e),i._sqlite3_txn_state=(e,t)=>(i._sqlite3_txn_state=m.sqlite3_txn_state)(e,t),i._sqlite3_close_v2=e=>(i._sqlite3_close_v2=m.sqlite3_close_v2)(e),i._sqlite3_busy_handler=(e,t,n)=>(i._sqlite3_busy_handler=m.sqlite3_busy_handler)(e,t,n),i._sqlite3_progress_handler=(e,t,n,r)=>(i._sqlite3_progress_handler=m.sqlite3_progress_handler)(e,t,n,r),i._sqlite3_busy_timeout=(e,t)=>(i._sqlite3_busy_timeout=m.sqlite3_busy_timeout)(e,t),i._sqlite3_interrupt=e=>(i._sqlite3_interrupt=m.sqlite3_interrupt)(e),i._sqlite3_is_interrupted=e=>(i._sqlite3_is_interrupted=m.sqlite3_is_interrupted)(e),i._sqlite3_create_function=(e,t,n,r,s,o,p,g)=>(i._sqlite3_create_function=m.sqlite3_create_function)(e,t,n,r,s,o,p,g),i._sqlite3_create_function_v2=(e,t,n,r,s,o,p,g,P)=>(i._sqlite3_create_function_v2=m.sqlite3_create_function_v2)(e,t,n,r,s,o,p,g,P),i._sqlite3_create_window_function=(e,t,n,r,s,o,p,g,P,R)=>(i._sqlite3_create_window_function=m.sqlite3_create_window_function)(e,t,n,r,s,o,p,g,P,R),i._sqlite3_overload_function=(e,t,n)=>(i._sqlite3_overload_function=m.sqlite3_overload_function)(e,t,n),i._sqlite3_trace_v2=(e,t,n,r)=>(i._sqlite3_trace_v2=m.sqlite3_trace_v2)(e,t,n,r),i._sqlite3_commit_hook=(e,t,n)=>(i._sqlite3_commit_hook=m.sqlite3_commit_hook)(e,t,n),i._sqlite3_update_hook=(e,t,n)=>(i._sqlite3_update_hook=m.sqlite3_update_hook)(e,t,n),i._sqlite3_rollback_hook=(e,t,n)=>(i._sqlite3_rollback_hook=m.sqlite3_rollback_hook)(e,t,n),i._sqlite3_preupdate_hook=(e,t,n)=>(i._sqlite3_preupdate_hook=m.sqlite3_preupdate_hook)(e,t,n),i._sqlite3_error_offset=e=>(i._sqlite3_error_offset=m.sqlite3_error_offset)(e),i._sqlite3_errcode=e=>(i._sqlite3_errcode=m.sqlite3_errcode)(e),i._sqlite3_extended_errcode=e=>(i._sqlite3_extended_errcode=m.sqlite3_extended_errcode)(e),i._sqlite3_errstr=e=>(i._sqlite3_errstr=m.sqlite3_errstr)(e),i._sqlite3_limit=(e,t,n)=>(i._sqlite3_limit=m.sqlite3_limit)(e,t,n),i._sqlite3_open=(e,t)=>(i._sqlite3_open=m.sqlite3_open)(e,t),i._sqlite3_open_v2=(e,t,n,r)=>(i._sqlite3_open_v2=m.sqlite3_open_v2)(e,t,n,r),i._sqlite3_create_collation=(e,t,n,r,s)=>(i._sqlite3_create_collation=m.sqlite3_create_collation)(e,t,n,r,s),i._sqlite3_create_collation_v2=(e,t,n,r,s,o)=>(i._sqlite3_create_collation_v2=m.sqlite3_create_collation_v2)(e,t,n,r,s,o),i._sqlite3_collation_needed=(e,t,n)=>(i._sqlite3_collation_needed=m.sqlite3_collation_needed)(e,t,n),i._sqlite3_get_autocommit=e=>(i._sqlite3_get_autocommit=m.sqlite3_get_autocommit)(e),i._sqlite3_table_column_metadata=(e,t,n,r,s,o,p,g,P)=>(i._sqlite3_table_column_metadata=m.sqlite3_table_column_metadata)(e,t,n,r,s,o,p,g,P),i._sqlite3_extended_result_codes=(e,t)=>(i._sqlite3_extended_result_codes=m.sqlite3_extended_result_codes)(e,t),i._sqlite3_uri_key=(e,t)=>(i._sqlite3_uri_key=m.sqlite3_uri_key)(e,t),i._sqlite3_uri_int64=(e,t,n)=>(i._sqlite3_uri_int64=m.sqlite3_uri_int64)(e,t,n),i._sqlite3_db_name=(e,t)=>(i._sqlite3_db_name=m.sqlite3_db_name)(e,t),i._sqlite3_db_filename=(e,t)=>(i._sqlite3_db_filename=m.sqlite3_db_filename)(e,t),i._sqlite3_db_readonly=(e,t)=>(i._sqlite3_db_readonly=m.sqlite3_db_readonly)(e,t),i._sqlite3_compileoption_used=e=>(i._sqlite3_compileoption_used=m.sqlite3_compileoption_used)(e),i._sqlite3_compileoption_get=e=>(i._sqlite3_compileoption_get=m.sqlite3_compileoption_get)(e),i._sqlite3session_diff=(e,t,n,r)=>(i._sqlite3session_diff=m.sqlite3session_diff)(e,t,n,r),i._sqlite3session_attach=(e,t)=>(i._sqlite3session_attach=m.sqlite3session_attach)(e,t),i._sqlite3session_create=(e,t,n)=>(i._sqlite3session_create=m.sqlite3session_create)(e,t,n),i._sqlite3session_delete=e=>(i._sqlite3session_delete=m.sqlite3session_delete)(e),i._sqlite3session_table_filter=(e,t,n)=>(i._sqlite3session_table_filter=m.sqlite3session_table_filter)(e,t,n),i._sqlite3session_changeset=(e,t,n)=>(i._sqlite3session_changeset=m.sqlite3session_changeset)(e,t,n),i._sqlite3session_changeset_strm=(e,t,n)=>(i._sqlite3session_changeset_strm=m.sqlite3session_changeset_strm)(e,t,n),i._sqlite3session_patchset_strm=(e,t,n)=>(i._sqlite3session_patchset_strm=m.sqlite3session_patchset_strm)(e,t,n),i._sqlite3session_patchset=(e,t,n)=>(i._sqlite3session_patchset=m.sqlite3session_patchset)(e,t,n),i._sqlite3session_enable=(e,t)=>(i._sqlite3session_enable=m.sqlite3session_enable)(e,t),i._sqlite3session_indirect=(e,t)=>(i._sqlite3session_indirect=m.sqlite3session_indirect)(e,t),i._sqlite3session_isempty=e=>(i._sqlite3session_isempty=m.sqlite3session_isempty)(e),i._sqlite3session_memory_used=e=>(i._sqlite3session_memory_used=m.sqlite3session_memory_used)(e),i._sqlite3session_object_config=(e,t,n)=>(i._sqlite3session_object_config=m.sqlite3session_object_config)(e,t,n),i._sqlite3session_changeset_size=e=>(i._sqlite3session_changeset_size=m.sqlite3session_changeset_size)(e),i._sqlite3changeset_start=(e,t,n)=>(i._sqlite3changeset_start=m.sqlite3changeset_start)(e,t,n),i._sqlite3changeset_start_v2=(e,t,n,r)=>(i._sqlite3changeset_start_v2=m.sqlite3changeset_start_v2)(e,t,n,r),i._sqlite3changeset_start_strm=(e,t,n)=>(i._sqlite3changeset_start_strm=m.sqlite3changeset_start_strm)(e,t,n),i._sqlite3changeset_start_v2_strm=(e,t,n,r)=>(i._sqlite3changeset_start_v2_strm=m.sqlite3changeset_start_v2_strm)(e,t,n,r),i._sqlite3changeset_next=e=>(i._sqlite3changeset_next=m.sqlite3changeset_next)(e),i._sqlite3changeset_op=(e,t,n,r,s)=>(i._sqlite3changeset_op=m.sqlite3changeset_op)(e,t,n,r,s),i._sqlite3changeset_pk=(e,t,n)=>(i._sqlite3changeset_pk=m.sqlite3changeset_pk)(e,t,n),i._sqlite3changeset_old=(e,t,n)=>(i._sqlite3changeset_old=m.sqlite3changeset_old)(e,t,n),i._sqlite3changeset_new=(e,t,n)=>(i._sqlite3changeset_new=m.sqlite3changeset_new)(e,t,n),i._sqlite3changeset_conflict=(e,t,n)=>(i._sqlite3changeset_conflict=m.sqlite3changeset_conflict)(e,t,n),i._sqlite3changeset_fk_conflicts=(e,t)=>(i._sqlite3changeset_fk_conflicts=m.sqlite3changeset_fk_conflicts)(e,t),i._sqlite3changeset_finalize=e=>(i._sqlite3changeset_finalize=m.sqlite3changeset_finalize)(e),i._sqlite3changeset_invert=(e,t,n,r)=>(i._sqlite3changeset_invert=m.sqlite3changeset_invert)(e,t,n,r),i._sqlite3changeset_invert_strm=(e,t,n,r)=>(i._sqlite3changeset_invert_strm=m.sqlite3changeset_invert_strm)(e,t,n,r),i._sqlite3changeset_apply_v2=(e,t,n,r,s,o,p,g,P)=>(i._sqlite3changeset_apply_v2=m.sqlite3changeset_apply_v2)(e,t,n,r,s,o,p,g,P),i._sqlite3changeset_apply=(e,t,n,r,s,o)=>(i._sqlite3changeset_apply=m.sqlite3changeset_apply)(e,t,n,r,s,o),i._sqlite3changeset_apply_v2_strm=(e,t,n,r,s,o,p,g,P)=>(i._sqlite3changeset_apply_v2_strm=m.sqlite3changeset_apply_v2_strm)(e,t,n,r,s,o,p,g,P),i._sqlite3changeset_apply_strm=(e,t,n,r,s,o)=>(i._sqlite3changeset_apply_strm=m.sqlite3changeset_apply_strm)(e,t,n,r,s,o),i._sqlite3changegroup_new=e=>(i._sqlite3changegroup_new=m.sqlite3changegroup_new)(e),i._sqlite3changegroup_add=(e,t,n)=>(i._sqlite3changegroup_add=m.sqlite3changegroup_add)(e,t,n),i._sqlite3changegroup_output=(e,t,n)=>(i._sqlite3changegroup_output=m.sqlite3changegroup_output)(e,t,n),i._sqlite3changegroup_add_strm=(e,t,n)=>(i._sqlite3changegroup_add_strm=m.sqlite3changegroup_add_strm)(e,t,n),i._sqlite3changegroup_output_strm=(e,t,n)=>(i._sqlite3changegroup_output_strm=m.sqlite3changegroup_output_strm)(e,t,n),i._sqlite3changegroup_delete=e=>(i._sqlite3changegroup_delete=m.sqlite3changegroup_delete)(e),i._sqlite3changeset_concat=(e,t,n,r,s,o)=>(i._sqlite3changeset_concat=m.sqlite3changeset_concat)(e,t,n,r,s,o),i._sqlite3changeset_concat_strm=(e,t,n,r,s,o)=>(i._sqlite3changeset_concat_strm=m.sqlite3changeset_concat_strm)(e,t,n,r,s,o),i._sqlite3session_config=(e,t)=>(i._sqlite3session_config=m.sqlite3session_config)(e,t),i._sqlite3_sourceid=()=>(i._sqlite3_sourceid=m.sqlite3_sourceid)(),i._sqlite3__wasm_pstack_ptr=()=>(i._sqlite3__wasm_pstack_ptr=m.sqlite3__wasm_pstack_ptr)(),i._sqlite3__wasm_pstack_restore=e=>(i._sqlite3__wasm_pstack_restore=m.sqlite3__wasm_pstack_restore)(e),i._sqlite3__wasm_pstack_alloc=e=>(i._sqlite3__wasm_pstack_alloc=m.sqlite3__wasm_pstack_alloc)(e),i._sqlite3__wasm_pstack_remaining=()=>(i._sqlite3__wasm_pstack_remaining=m.sqlite3__wasm_pstack_remaining)(),i._sqlite3__wasm_pstack_quota=()=>(i._sqlite3__wasm_pstack_quota=m.sqlite3__wasm_pstack_quota)(),i._sqlite3__wasm_db_error=(e,t,n)=>(i._sqlite3__wasm_db_error=m.sqlite3__wasm_db_error)(e,t,n),i._sqlite3__wasm_test_struct=e=>(i._sqlite3__wasm_test_struct=m.sqlite3__wasm_test_struct)(e),i._sqlite3__wasm_enum_json=()=>(i._sqlite3__wasm_enum_json=m.sqlite3__wasm_enum_json)(),i._sqlite3__wasm_vfs_unlink=(e,t)=>(i._sqlite3__wasm_vfs_unlink=m.sqlite3__wasm_vfs_unlink)(e,t),i._sqlite3__wasm_db_vfs=(e,t)=>(i._sqlite3__wasm_db_vfs=m.sqlite3__wasm_db_vfs)(e,t),i._sqlite3__wasm_db_reset=e=>(i._sqlite3__wasm_db_reset=m.sqlite3__wasm_db_reset)(e),i._sqlite3__wasm_db_export_chunked=(e,t)=>(i._sqlite3__wasm_db_export_chunked=m.sqlite3__wasm_db_export_chunked)(e,t),i._sqlite3__wasm_db_serialize=(e,t,n,r,s)=>(i._sqlite3__wasm_db_serialize=m.sqlite3__wasm_db_serialize)(e,t,n,r,s),i._sqlite3__wasm_vfs_create_file=(e,t,n,r)=>(i._sqlite3__wasm_vfs_create_file=m.sqlite3__wasm_vfs_create_file)(e,t,n,r),i._sqlite3__wasm_posix_create_file=(e,t,n)=>(i._sqlite3__wasm_posix_create_file=m.sqlite3__wasm_posix_create_file)(e,t,n),i._sqlite3__wasm_kvvfsMakeKeyOnPstack=(e,t)=>(i._sqlite3__wasm_kvvfsMakeKeyOnPstack=m.sqlite3__wasm_kvvfsMakeKeyOnPstack)(e,t),i._sqlite3__wasm_kvvfs_methods=()=>(i._sqlite3__wasm_kvvfs_methods=m.sqlite3__wasm_kvvfs_methods)(),i._sqlite3__wasm_vtab_config=(e,t,n)=>(i._sqlite3__wasm_vtab_config=m.sqlite3__wasm_vtab_config)(e,t,n),i._sqlite3__wasm_db_config_ip=(e,t,n,r)=>(i._sqlite3__wasm_db_config_ip=m.sqlite3__wasm_db_config_ip)(e,t,n,r),i._sqlite3__wasm_db_config_pii=(e,t,n,r,s)=>(i._sqlite3__wasm_db_config_pii=m.sqlite3__wasm_db_config_pii)(e,t,n,r,s),i._sqlite3__wasm_db_config_s=(e,t,n)=>(i._sqlite3__wasm_db_config_s=m.sqlite3__wasm_db_config_s)(e,t,n),i._sqlite3__wasm_config_i=(e,t)=>(i._sqlite3__wasm_config_i=m.sqlite3__wasm_config_i)(e,t),i._sqlite3__wasm_config_ii=(e,t,n)=>(i._sqlite3__wasm_config_ii=m.sqlite3__wasm_config_ii)(e,t,n),i._sqlite3__wasm_config_j=(e,t)=>(i._sqlite3__wasm_config_j=m.sqlite3__wasm_config_j)(e,t),i._sqlite3__wasm_qfmt_token=(e,t)=>(i._sqlite3__wasm_qfmt_token=m.sqlite3__wasm_qfmt_token)(e,t),i._sqlite3__wasm_init_wasmfs=e=>(i._sqlite3__wasm_init_wasmfs=m.sqlite3__wasm_init_wasmfs)(e),i._sqlite3__wasm_test_intptr=e=>(i._sqlite3__wasm_test_intptr=m.sqlite3__wasm_test_intptr)(e),i._sqlite3__wasm_test_voidptr=e=>(i._sqlite3__wasm_test_voidptr=m.sqlite3__wasm_test_voidptr)(e),i._sqlite3__wasm_test_int64_max=()=>(i._sqlite3__wasm_test_int64_max=m.sqlite3__wasm_test_int64_max)(),i._sqlite3__wasm_test_int64_min=()=>(i._sqlite3__wasm_test_int64_min=m.sqlite3__wasm_test_int64_min)(),i._sqlite3__wasm_test_int64_times2=e=>(i._sqlite3__wasm_test_int64_times2=m.sqlite3__wasm_test_int64_times2)(e),i._sqlite3__wasm_test_int64_minmax=(e,t)=>(i._sqlite3__wasm_test_int64_minmax=m.sqlite3__wasm_test_int64_minmax)(e,t),i._sqlite3__wasm_test_int64ptr=e=>(i._sqlite3__wasm_test_int64ptr=m.sqlite3__wasm_test_int64ptr)(e),i._sqlite3__wasm_test_stack_overflow=e=>(i._sqlite3__wasm_test_stack_overflow=m.sqlite3__wasm_test_stack_overflow)(e),i._sqlite3__wasm_test_str_hello=e=>(i._sqlite3__wasm_test_str_hello=m.sqlite3__wasm_test_str_hello)(e),i._sqlite3__wasm_SQLTester_strglob=(e,t)=>(i._sqlite3__wasm_SQLTester_strglob=m.sqlite3__wasm_SQLTester_strglob)(e,t),i._malloc=e=>(i._malloc=m.malloc)(e),i._free=e=>(i._free=m.free)(e),i._realloc=(e,t)=>(i._realloc=m.realloc)(e,t);var At=(e,t)=>(At=m.emscripten_builtin_memalign)(e,t);i.wasmMemory=Ce;var tt,It;Ge=function e(){tt||kt(),tt||(Ge=e)};function kt(){if(De>0||!It&&(It=1,Ot(),De>0))return;function e(){tt||(tt=1,i.calledRun=1,!ut&&(Lt(),ye(i),i.onRuntimeInitialized?.(),Ct()))}i.setStatus?(i.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>i.setStatus(""),1),e()},1)):e()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return kt(),i.runSQLite3PostLoadInit=function(e){if(globalThis.sqlite3ApiBootstrap=function t(n=globalThis.sqlite3ApiConfig||t.defaultConfig){if(t.sqlite3)return(t.sqlite3.config||console).warn("sqlite3ApiBootstrap() called multiple times.","Config and external initializers are ignored on calls after the first."),t.sqlite3;const r=Object.assign(Object.create(null),{exports:void 0,memory:void 0,bigIntEnabled:typeof i<"u"&&i.HEAPU64?!0:!!globalThis.BigInt64Array,debug:console.debug.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),log:console.log.bind(console),wasmfsOpfsDir:"/opfs",useStdAlloc:!1},n||{});Object.assign(r,{allocExportName:r.useStdAlloc?"malloc":"sqlite3_malloc",deallocExportName:r.useStdAlloc?"free":"sqlite3_free",reallocExportName:r.useStdAlloc?"realloc":"sqlite3_realloc"},r),["exports","memory","wasmfsOpfsDir"].forEach(l=>{typeof r[l]=="function"&&(r[l]=r[l]())}),delete globalThis.sqlite3ApiConfig,delete t.defaultConfig;const s=Object.create(null),o=Object.create(null),p=l=>s.sqlite3_js_rc_str&&s.sqlite3_js_rc_str(l)||"Unknown result code #"+l,g=l=>typeof l=="number"&&l===(l|0);class P extends Error{constructor(..._){let u;if(_.length)if(g(_[0]))if(u=_[0],_.length===1)super(p(_[0]));else{const I=p(u);typeof _[1]=="object"?super(I,_[1]):(_[0]=I+":",super(_.join(" ")))}else _.length===2&&typeof _[1]=="object"?super(..._):super(_.join(" "));this.resultCode=u||s.SQLITE_ERROR,this.name="SQLite3Error"}}P.toss=(...l)=>{throw new P(...l)};const R=P.toss;r.wasmfsOpfsDir&&!/^\/[^/]+$/.test(r.wasmfsOpfsDir)&&R("config.wasmfsOpfsDir must be falsy or in the form '/dir-name'.");const z=l=>typeof l!="bigint"&&l===(l|0)&&l<=2147483647&&l>=-2147483648,Q=function l(_){return l._max||(l._max=BigInt("0x7fffffffffffffff"),l._min=~l._max),_>=l._min&&_<=l._max},T=l=>l>=-0x7fffffffn-1n&&l<=0x7fffffffn,A=function l(_){return l._min||(l._min=Number.MIN_SAFE_INTEGER,l._max=Number.MAX_SAFE_INTEGER),_>=l._min&&_<=l._max},D=l=>l&&l.constructor&&z(l.constructor.BYTES_PER_ELEMENT)?l:!1,q=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,w=l=>l.buffer instanceof q,x=(l,_,u)=>w(l)?l.slice(_,u):l.subarray(_,u),N=l=>l&&(l instanceof Uint8Array||l instanceof Int8Array||l instanceof ArrayBuffer),O=l=>l&&(l instanceof Uint8Array||l instanceof Int8Array||l instanceof ArrayBuffer),S=l=>N(l)||R("Value is not of a supported TypedArray type."),L=new TextDecoder("utf-8"),$=function(l,_,u){return L.decode(x(l,_,u))},c=function(l){return O(l)?$(l instanceof ArrayBuffer?new Uint8Array(l):l):Array.isArray(l)?l.join(""):(o.isPtr(l)&&(l=o.cstrToJs(l)),l)};class d extends Error{constructor(..._){_.length===2&&typeof _[1]=="object"?super(..._):_.length?super(_.join(" ")):super("Allocation failed."),this.resultCode=s.SQLITE_NOMEM,this.name="WasmAllocError"}}d.toss=(...l)=>{throw new d(...l)},Object.assign(s,{sqlite3_bind_blob:void 0,sqlite3_bind_text:void 0,sqlite3_create_function_v2:(l,_,u,I,U,ee,ne,se,ie)=>{},sqlite3_create_function:(l,_,u,I,U,ee,ne,se)=>{},sqlite3_create_window_function:(l,_,u,I,U,ee,ne,se,ie,j)=>{},sqlite3_prepare_v3:(l,_,u,I,U,ee)=>{},sqlite3_prepare_v2:(l,_,u,I,U)=>{},sqlite3_exec:(l,_,u,I,U)=>{},sqlite3_randomness:(l,_)=>{}});const y={affirmBindableTypedArray:S,flexibleString:c,bigIntFits32:T,bigIntFits64:Q,bigIntFitsDouble:A,isBindableTypedArray:N,isInt32:z,isSQLableTypedArray:O,isTypedArray:D,typedArrayToString:$,isUIThread:()=>globalThis.window===globalThis&&!!globalThis.document,isSharedTypedArray:w,toss:function(...l){throw new Error(l.join(" "))},toss3:R,typedArrayPart:x,affirmDbHeader:function(l){l instanceof ArrayBuffer&&(l=new Uint8Array(l));const _="SQLite format 3";_.length>l.byteLength&&R("Input does not contain an SQLite3 database header.");for(let u=0;u<_.length;++u)_.charCodeAt(u)!==l[u]&&R("Input does not contain an SQLite3 database header.")},affirmIsDb:function(l){l instanceof ArrayBuffer&&(l=new Uint8Array(l));const _=l.byteLength;(_<512||_%512!==0)&&R("Byte array size",_,"is invalid for an SQLite3 db."),y.affirmDbHeader(l)}};Object.assign(o,{ptrSizeof:r.wasmPtrSizeof||4,ptrIR:r.wasmPtrIR||"i32",bigIntEnabled:!!r.bigIntEnabled,exports:r.exports||R("Missing API config.exports (WASM module exports)."),memory:r.memory||r.exports.memory||R("API config object requires a WebAssembly.Memory object","in either config.exports.memory (exported)","or config.memory (imported)."),alloc:void 0,realloc:void 0,dealloc:void 0}),o.allocFromTypedArray=function(l){l instanceof ArrayBuffer&&(l=new Uint8Array(l)),S(l);const _=o.alloc(l.byteLength||1);return o.heapForSize(l.constructor).set(l.byteLength?l:[0],_),_};{const l=r.allocExportName,_=r.deallocExportName,u=r.reallocExportName;for(const I of[l,_,u])o.exports[I]instanceof Function||R("Missing required exports[",I,"] function.");o.alloc=function I(U){return I.impl(U)||d.toss("Failed to allocate",U," bytes.")},o.alloc.impl=o.exports[l],o.realloc=function I(U,ee){const ne=I.impl(U,ee);return ee?ne||d.toss("Failed to reallocate",ee," bytes."):0},o.realloc.impl=o.exports[u],o.dealloc=o.exports[_]}o.compileOptionUsed=function l(_){if(arguments.length){if(Array.isArray(_)){const u={};return _.forEach(I=>{u[I]=s.sqlite3_compileoption_used(I)}),u}else if(typeof _=="object")return Object.keys(_).forEach(u=>{_[u]=s.sqlite3_compileoption_used(u)}),_}else{if(l._result)return l._result;l._opt||(l._rx=/^([^=]+)=(.+)/,l._rxInt=/^-?\d+$/,l._opt=function(ne,se){const ie=l._rx.exec(ne);se[0]=ie?ie[1]:ne,se[1]=ie?l._rxInt.test(ie[2])?+ie[2]:ie[2]:!0});const u={},I=[0,0];let U=0,ee;for(;ee=s.sqlite3_compileoption_get(U++);)l._opt(ee,I),u[I[0]]=I[1];return l._result=u}return typeof _=="string"?!!s.sqlite3_compileoption_used(_):!1},o.pstack=Object.assign(Object.create(null),{restore:o.exports.sqlite3__wasm_pstack_restore,alloc:function(l){return typeof l=="string"&&!(l=o.sizeofIR(l))&&d.toss("Invalid value for pstack.alloc(",arguments[0],")"),o.exports.sqlite3__wasm_pstack_alloc(l)||d.toss("Could not allocate",l,"bytes from the pstack.")},allocChunks:function(l,_){typeof _=="string"&&!(_=o.sizeofIR(_))&&d.toss("Invalid size value for allocChunks(",arguments[1],")");const u=o.pstack.alloc(l*_),I=[];let U=0,ee=0;for(;U<l;++U,ee+=_)I.push(u+ee);return I},allocPtr:(l=1,_=!0)=>l===1?o.pstack.alloc(_?8:o.ptrSizeof):o.pstack.allocChunks(l,_?8:o.ptrSizeof),call:function(l){const _=o.pstack.pointer;try{return l(h)}finally{o.pstack.restore(_)}}}),Object.defineProperties(o.pstack,{pointer:{configurable:!1,iterable:!0,writeable:!1,get:o.exports.sqlite3__wasm_pstack_ptr},quota:{configurable:!1,iterable:!0,writeable:!1,get:o.exports.sqlite3__wasm_pstack_quota},remaining:{configurable:!1,iterable:!0,writeable:!1,get:o.exports.sqlite3__wasm_pstack_remaining}}),s.sqlite3_randomness=(...l)=>{if(l.length===1&&y.isTypedArray(l[0])&&l[0].BYTES_PER_ELEMENT===1){const _=l[0];if(_.byteLength===0)return o.exports.sqlite3_randomness(0,0),_;const u=o.pstack.pointer;try{let I=_.byteLength,U=0;const ee=o.exports.sqlite3_randomness,ne=o.heap8u(),se=I<512?I:512,ie=o.pstack.alloc(se);do{const j=I>se?se:I;ee(j,ie),_.set(x(ne,ie,ie+j),U),I-=j,U+=j}while(I>0)}catch(I){console.error("Highly unexpected (and ignored!) exception in sqlite3_randomness():",I)}finally{o.pstack.restore(u)}return _}o.exports.sqlite3_randomness(...l)};let B;if(s.sqlite3_wasmfs_opfs_dir=function(){if(B!==void 0)return B;const l=r.wasmfsOpfsDir;if(!l||!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle)return B="";try{return l&&o.xCallWrapped("sqlite3__wasm_init_wasmfs","i32",["string"],l)===0?B=l:B=""}catch{return B=""}},s.sqlite3_wasmfs_filename_is_persistent=function(l){const _=s.sqlite3_wasmfs_opfs_dir();return _&&l?l.startsWith(_+"/"):!1},s.sqlite3_js_db_uses_vfs=function(l,_,u=0){try{const I=s.sqlite3_vfs_find(_);return I?l?I===s.sqlite3_js_db_vfs(l,u)?I:!1:I===s.sqlite3_vfs_find(0)?I:!1:!1}catch{return!1}},s.sqlite3_js_vfs_list=function(){const l=[];let _=s.sqlite3_vfs_find(0);for(;_;){const u=new s.sqlite3_vfs(_);l.push(o.cstrToJs(u.$zName)),_=u.$pNext,u.dispose()}return l},s.sqlite3_js_db_export=function(l,_=0){l=o.xWrap.testConvertArg("sqlite3*",l),l||R("Invalid sqlite3* argument."),o.bigIntEnabled||R("BigInt64 support is not enabled.");const u=o.scopedAllocPush();let I;try{const U=o.scopedAlloc(8+o.ptrSizeof),ee=U+8,ne=_?o.isPtr(_)?_:o.scopedAllocCString(""+_):0;let se=o.exports.sqlite3__wasm_db_serialize(l,ne,ee,U,0);se&&R("Database serialization failed with code",h.capi.sqlite3_js_rc_str(se)),I=o.peekPtr(ee);const ie=o.peek(U,"i64");return se=ie?o.heap8u().slice(I,I+Number(ie)):new Uint8Array,se}finally{I&&o.exports.sqlite3_free(I),o.scopedAllocPop(u)}},s.sqlite3_js_db_vfs=(l,_=0)=>y.sqlite3__wasm_db_vfs(l,_),s.sqlite3_js_aggregate_context=(l,_)=>s.sqlite3_aggregate_context(l,_)||(_?d.toss("Cannot allocate",_,"bytes for sqlite3_aggregate_context()"):0),s.sqlite3_js_posix_create_file=function(l,_,u){let I;_&&o.isPtr(_)?I=_:_ instanceof ArrayBuffer||_ instanceof Uint8Array?(I=o.allocFromTypedArray(_),(arguments.length<3||!y.isInt32(u)||u<0)&&(u=_.byteLength)):P.toss("Invalid 2nd argument for sqlite3_js_posix_create_file().");try{(!y.isInt32(u)||u<0)&&P.toss("Invalid 3rd argument for sqlite3_js_posix_create_file().");const U=y.sqlite3__wasm_posix_create_file(l,I,u);U&&P.toss("Creation of file failed with sqlite3 result code",s.sqlite3_js_rc_str(U))}finally{o.dealloc(I)}},s.sqlite3_js_vfs_create_file=function(l,_,u,I){r.warn("sqlite3_js_vfs_create_file() is deprecated and","should be avoided because it can lead to C-level crashes.","See its documentation for alternative options.");let U;u?(o.isPtr(u)?U=u:u instanceof ArrayBuffer&&(u=new Uint8Array(u)),u instanceof Uint8Array?(U=o.allocFromTypedArray(u),(arguments.length<4||!y.isInt32(I)||I<0)&&(I=u.byteLength)):P.toss("Invalid 3rd argument type for sqlite3_js_vfs_create_file().")):U=0,(!y.isInt32(I)||I<0)&&(o.dealloc(U),P.toss("Invalid 4th argument for sqlite3_js_vfs_create_file()."));try{const ee=y.sqlite3__wasm_vfs_create_file(l,_,U,I);ee&&P.toss("Creation of file failed with sqlite3 result code",s.sqlite3_js_rc_str(ee))}finally{o.dealloc(U)}},s.sqlite3_js_sql_to_string=l=>{if(typeof l=="string")return l;const _=c(v);return _===v?void 0:_},y.isUIThread()){const l=function(_){const u=Object.create(null);return u.prefix="kvvfs-"+_,u.stores=[],(_==="session"||_==="")&&u.stores.push(globalThis.sessionStorage),(_==="local"||_==="")&&u.stores.push(globalThis.localStorage),u};s.sqlite3_js_kvvfs_clear=function(_=""){let u=0;const I=l(_);return I.stores.forEach(U=>{const ee=[];let ne;for(ne=0;ne<U.length;++ne){const se=U.key(ne);se.startsWith(I.prefix)&&ee.push(se)}ee.forEach(se=>U.removeItem(se)),u+=ee.length}),u},s.sqlite3_js_kvvfs_size=function(_=""){let u=0;const I=l(_);return I.stores.forEach(U=>{let ee;for(ee=0;ee<U.length;++ee){const ne=U.key(ee);ne.startsWith(I.prefix)&&(u+=ne.length,u+=U.getItem(ne).length)}}),u*2}}s.sqlite3_db_config=(function(l,_,...u){switch(_){case s.SQLITE_DBCONFIG_ENABLE_FKEY:case s.SQLITE_DBCONFIG_ENABLE_TRIGGER:case s.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER:case s.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION:case s.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE:case s.SQLITE_DBCONFIG_ENABLE_QPSG:case s.SQLITE_DBCONFIG_TRIGGER_EQP:case s.SQLITE_DBCONFIG_RESET_DATABASE:case s.SQLITE_DBCONFIG_DEFENSIVE:case s.SQLITE_DBCONFIG_WRITABLE_SCHEMA:case s.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE:case s.SQLITE_DBCONFIG_DQS_DML:case s.SQLITE_DBCONFIG_DQS_DDL:case s.SQLITE_DBCONFIG_ENABLE_VIEW:case s.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT:case s.SQLITE_DBCONFIG_TRUSTED_SCHEMA:case s.SQLITE_DBCONFIG_STMT_SCANSTATUS:case s.SQLITE_DBCONFIG_REVERSE_SCANORDER:case s.SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE:case s.SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE:case s.SQLITE_DBCONFIG_ENABLE_COMMENTS:return this.ip||(this.ip=o.xWrap("sqlite3__wasm_db_config_ip","int",["sqlite3*","int","int","*"])),this.ip(l,_,u[0],u[1]||0);case s.SQLITE_DBCONFIG_LOOKASIDE:return this.pii||(this.pii=o.xWrap("sqlite3__wasm_db_config_pii","int",["sqlite3*","int","*","int","int"])),this.pii(l,_,u[0],u[1],u[2]);case s.SQLITE_DBCONFIG_MAINDBNAME:return this.s||(this.s=o.xWrap("sqlite3__wasm_db_config_s","int",["sqlite3*","int","string:static"])),this.s(l,_,u[0]);default:return s.SQLITE_MISUSE}}).bind(Object.create(null)),s.sqlite3_value_to_js=function(l,_=!0){let u;const I=s.sqlite3_value_type(l);switch(I){case s.SQLITE_INTEGER:o.bigIntEnabled?(u=s.sqlite3_value_int64(l),y.bigIntFitsDouble(u)&&(u=Number(u))):u=s.sqlite3_value_double(l);break;case s.SQLITE_FLOAT:u=s.sqlite3_value_double(l);break;case s.SQLITE_TEXT:u=s.sqlite3_value_text(l);break;case s.SQLITE_BLOB:{const U=s.sqlite3_value_bytes(l),ee=s.sqlite3_value_blob(l);U&&!ee&&h.WasmAllocError.toss("Cannot allocate memory for blob argument of",U,"byte(s)"),u=U?o.heap8u().slice(ee,ee+Number(U)):null;break}case s.SQLITE_NULL:u=null;break;default:_&&R(s.SQLITE_MISMATCH,"Unhandled sqlite3_value_type():",I),u=void 0}return u},s.sqlite3_values_to_js=function(l,_,u=!0){let I;const U=[];for(I=0;I<l;++I)U.push(s.sqlite3_value_to_js(o.peekPtr(_+o.ptrSizeof*I),u));return U},s.sqlite3_result_error_js=function(l,_){_ instanceof d?s.sqlite3_result_error_nomem(l):s.sqlite3_result_error(l,""+_,-1)},s.sqlite3_result_js=function(l,_){if(_ instanceof Error){s.sqlite3_result_error_js(l,_);return}try{switch(typeof _){case"undefined":break;case"boolean":s.sqlite3_result_int(l,_?1:0);break;case"bigint":y.bigIntFits32(_)?s.sqlite3_result_int(l,Number(_)):y.bigIntFitsDouble(_)?s.sqlite3_result_double(l,Number(_)):o.bigIntEnabled?y.bigIntFits64(_)?s.sqlite3_result_int64(l,_):R("BigInt value",_.toString(),"is too BigInt for int64."):R("BigInt value",_.toString(),"is too BigInt.");break;case"number":{let u;y.isInt32(_)?u=s.sqlite3_result_int:o.bigIntEnabled&&Number.isInteger(_)&&y.bigIntFits64(BigInt(_))?u=s.sqlite3_result_int64:u=s.sqlite3_result_double,u(l,_);break}case"string":{const[u,I]=o.allocCString(_,!0);s.sqlite3_result_text(l,u,I,s.SQLITE_WASM_DEALLOC);break}case"object":if(_===null){s.sqlite3_result_null(l);break}else if(y.isBindableTypedArray(_)){const u=o.allocFromTypedArray(_);s.sqlite3_result_blob(l,u,_.byteLength,s.SQLITE_WASM_DEALLOC);break}default:R("Don't not how to handle this UDF result value:",typeof _,_)}}catch(u){s.sqlite3_result_error_js(l,u)}},s.sqlite3_column_js=function(l,_,u=!0){const I=s.sqlite3_column_value(l,_);return I===0?void 0:s.sqlite3_value_to_js(I,u)};const f=(function(l,_,u){u=s[u],this.ptr?o.pokePtr(this.ptr,0):this.ptr=o.allocPtr();const I=u(l,_,this.ptr);if(I)return P.toss(I,arguments[2]+"() failed with code "+I);const U=o.peekPtr(this.ptr);return U?s.sqlite3_value_to_js(U,!0):void 0}).bind(Object.create(null));s.sqlite3_preupdate_new_js=(l,_)=>f(l,_,"sqlite3_preupdate_new"),s.sqlite3_preupdate_old_js=(l,_)=>f(l,_,"sqlite3_preupdate_old"),s.sqlite3changeset_new_js=(l,_)=>f(l,_,"sqlite3changeset_new"),s.sqlite3changeset_old_js=(l,_)=>f(l,_,"sqlite3changeset_old");const h={WasmAllocError:d,SQLite3Error:P,capi:s,util:y,wasm:o,config:r,version:Object.create(null),client:void 0,asyncPostInit:async function l(){if(l.isReady instanceof Promise)return l.isReady;let _=t.initializersAsync;delete t.initializersAsync;const u=async()=>(h.__isUnderTest||(delete h.util,delete h.StructBinder),h),I=ee=>{throw r.error("an async sqlite3 initializer failed:",ee),ee};if(!_||!_.length)return l.isReady=u().catch(I);_=_.map(ee=>ee instanceof Function?async ne=>ee(h):ee),_.push(u);let U=Promise.resolve(h);for(;_.length;)U=U.then(_.shift());return l.isReady=U.catch(I)},scriptInfo:void 0};try{t.initializers.forEach(l=>{l(h)})}catch(l){throw console.error("sqlite3 bootstrap initializer threw:",l),l}return delete t.initializers,t.sqlite3=h,h},globalThis.sqlite3ApiBootstrap.initializers=[],globalThis.sqlite3ApiBootstrap.initializersAsync=[],globalThis.sqlite3ApiBootstrap.defaultConfig=Object.create(null),globalThis.sqlite3ApiBootstrap.sqlite3=void 0,globalThis.WhWasmUtilInstaller=function(t){t.bigIntEnabled===void 0&&(t.bigIntEnabled=!!globalThis.BigInt64Array);const n=(...c)=>{throw new Error(c.join(" "))};t.exports||Object.defineProperty(t,"exports",{enumerable:!0,configurable:!0,get:()=>t.instance&&t.instance.exports});const r=t.pointerIR||"i32",s=t.ptrSizeof=r==="i32"?4:r==="i64"?8:n("Unhandled ptrSizeof:",r),o=Object.create(null);o.heapSize=0,o.memory=null,o.freeFuncIndexes=[],o.scopedAlloc=[],o.utf8Decoder=new TextDecoder,o.utf8Encoder=new TextEncoder("utf-8"),t.sizeofIR=c=>{switch(c){case"i8":return 1;case"i16":return 2;case"i32":case"f32":case"float":return 4;case"i64":case"f64":case"double":return 8;case"*":return s;default:return(""+c).endsWith("*")?s:void 0}};const p=function(){if(!o.memory)o.memory=t.memory instanceof WebAssembly.Memory?t.memory:t.exports.memory;else if(o.heapSize===o.memory.buffer.byteLength)return o;const c=o.memory.buffer;return o.HEAP8=new Int8Array(c),o.HEAP8U=new Uint8Array(c),o.HEAP16=new Int16Array(c),o.HEAP16U=new Uint16Array(c),o.HEAP32=new Int32Array(c),o.HEAP32U=new Uint32Array(c),t.bigIntEnabled&&(o.HEAP64=new BigInt64Array(c),o.HEAP64U=new BigUint64Array(c)),o.HEAP32F=new Float32Array(c),o.HEAP64F=new Float64Array(c),o.heapSize=c.byteLength,o};t.heap8=()=>p().HEAP8,t.heap8u=()=>p().HEAP8U,t.heap16=()=>p().HEAP16,t.heap16u=()=>p().HEAP16U,t.heap32=()=>p().HEAP32,t.heap32u=()=>p().HEAP32U,t.heapForSize=function(c,d=!0){const y=o.memory&&o.heapSize===o.memory.buffer.byteLength?o:p();switch(c){case Int8Array:return y.HEAP8;case Uint8Array:return y.HEAP8U;case Int16Array:return y.HEAP16;case Uint16Array:return y.HEAP16U;case Int32Array:return y.HEAP32;case Uint32Array:return y.HEAP32U;case 8:return d?y.HEAP8U:y.HEAP8;case 16:return d?y.HEAP16U:y.HEAP16;case 32:return d?y.HEAP32U:y.HEAP32;case 64:if(y.HEAP64)return d?y.HEAP64U:y.HEAP64;break;default:if(t.bigIntEnabled){if(c===globalThis.BigUint64Array)return y.HEAP64U;if(c===globalThis.BigInt64Array)return y.HEAP64;break}}n("Invalid heapForSize() size: expecting 8, 16, 32,","or (if BigInt is enabled) 64.")},t.functionTable=function(){return t.exports.__indirect_function_table},t.functionEntry=function(c){const d=t.functionTable();return c<d.length?d.get(c):void 0},t.jsFuncToWasm=function c(d,y){if(c._||(c._={sigTypes:Object.assign(Object.create(null),{i:"i32",p:"i32",P:"i32",s:"i32",j:"i64",f:"f32",d:"f64"}),typeCodes:Object.assign(Object.create(null),{f64:124,f32:125,i64:126,i32:127}),uleb128Encode:function(h,l,_){_<128?h[l](_):h[l](_%128|128,_>>7)},rxJSig:/^(\w)\((\w*)\)$/,sigParams:function(h){const l=c._.rxJSig.exec(h);return l?l[2]:h.substr(1)},letterType:h=>c._.sigTypes[h]||n("Invalid signature letter:",h),pushSigType:(h,l)=>h.push(c._.typeCodes[c._.letterType(l)])}),typeof d=="string"){const h=y;y=d,d=h}const B=c._.sigParams(y),f=[1,96];c._.uleb128Encode(f,"push",B.length);for(const h of B)c._.pushSigType(f,h);return y[0]==="v"?f.push(0):(f.push(1),c._.pushSigType(f,y[0])),c._.uleb128Encode(f,"unshift",f.length),f.unshift(0,97,115,109,1,0,0,0,1),f.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array(f)),{e:{f:d}}).exports.f};const g=function(d,y,B){if(B&&!o.scopedAlloc.length&&n("No scopedAllocPush() scope is active."),typeof d=="string"){const _=y;y=d,d=_}(typeof y!="string"||!(d instanceof Function))&&n("Invalid arguments: expecting (function,signature) or (signature,function).");const f=t.functionTable(),h=f.length;let l;for(;o.freeFuncIndexes.length&&(l=o.freeFuncIndexes.pop(),f.get(l));){l=null;continue}l||(l=h,f.grow(1));try{return f.set(l,d),B&&o.scopedAlloc[o.scopedAlloc.length-1].push(l),l}catch(_){if(!(_ instanceof TypeError))throw l===h&&o.freeFuncIndexes.push(h),_}try{const _=t.jsFuncToWasm(d,y);f.set(l,_),B&&o.scopedAlloc[o.scopedAlloc.length-1].push(l)}catch(_){throw l===h&&o.freeFuncIndexes.push(h),_}return l};t.installFunction=(c,d)=>g(c,d,!1),t.scopedInstallFunction=(c,d)=>g(c,d,!0),t.uninstallFunction=function(c){if(!c&&c!==0)return;const d=o.freeFuncIndexes,y=t.functionTable();d.push(c);const B=y.get(c);return y.set(c,null),B},t.peek=function(d,y="i8"){y.endsWith("*")&&(y=r);const B=o.memory&&o.heapSize===o.memory.buffer.byteLength?o:p(),f=Array.isArray(d)?[]:void 0;let h;do{switch(f&&(d=arguments[0].shift()),y){case"i1":case"i8":h=B.HEAP8[d>>0];break;case"i16":h=B.HEAP16[d>>1];break;case"i32":h=B.HEAP32[d>>2];break;case"float":case"f32":h=B.HEAP32F[d>>2];break;case"double":case"f64":h=Number(B.HEAP64F[d>>3]);break;case"i64":if(t.bigIntEnabled){h=BigInt(B.HEAP64[d>>3]);break}default:n("Invalid type for peek():",y)}f&&f.push(h)}while(f&&arguments[0].length);return f||h},t.poke=function(c,d,y="i8"){y.endsWith("*")&&(y=r);const B=o.memory&&o.heapSize===o.memory.buffer.byteLength?o:p();for(const f of Array.isArray(c)?c:[c])switch(y){case"i1":case"i8":B.HEAP8[f>>0]=d;continue;case"i16":B.HEAP16[f>>1]=d;continue;case"i32":B.HEAP32[f>>2]=d;continue;case"float":case"f32":B.HEAP32F[f>>2]=d;continue;case"double":case"f64":B.HEAP64F[f>>3]=d;continue;case"i64":if(B.HEAP64){B.HEAP64[f>>3]=BigInt(d);continue}default:n("Invalid type for poke(): "+y)}return this},t.peekPtr=(...c)=>t.peek(c.length===1?c[0]:c,r),t.pokePtr=(c,d=0)=>t.poke(c,d,r),t.peek8=(...c)=>t.peek(c.length===1?c[0]:c,"i8"),t.poke8=(c,d)=>t.poke(c,d,"i8"),t.peek16=(...c)=>t.peek(c.length===1?c[0]:c,"i16"),t.poke16=(c,d)=>t.poke(c,d,"i16"),t.peek32=(...c)=>t.peek(c.length===1?c[0]:c,"i32"),t.poke32=(c,d)=>t.poke(c,d,"i32"),t.peek64=(...c)=>t.peek(c.length===1?c[0]:c,"i64"),t.poke64=(c,d)=>t.poke(c,d,"i64"),t.peek32f=(...c)=>t.peek(c.length===1?c[0]:c,"f32"),t.poke32f=(c,d)=>t.poke(c,d,"f32"),t.peek64f=(...c)=>t.peek(c.length===1?c[0]:c,"f64"),t.poke64f=(c,d)=>t.poke(c,d,"f64"),t.getMemValue=t.peek,t.getPtrValue=t.peekPtr,t.setMemValue=t.poke,t.setPtrValue=t.pokePtr,t.isPtr32=c=>typeof c=="number"&&c===(c|0)&&c>=0,t.isPtr=t.isPtr32,t.cstrlen=function(c){if(!c||!t.isPtr(c))return null;const d=p().HEAP8U;let y=c;for(;d[y]!==0;++y);return y-c};const P=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,R=function(c,d,y){return o.utf8Decoder.decode(c.buffer instanceof P?c.slice(d,y):c.subarray(d,y))};t.cstrToJs=function(c){const d=t.cstrlen(c);return d?R(p().HEAP8U,c,c+d):d===null?d:""},t.jstrlen=function(c){if(typeof c!="string")return null;const d=c.length;let y=0;for(let B=0;B<d;++B){let f=c.charCodeAt(B);f>=55296&&f<=57343&&(f=65536+((f&1023)<<10)|c.charCodeAt(++B)&1023),f<=127?++y:f<=2047?y+=2:f<=65535?y+=3:y+=4}return y},t.jstrcpy=function(c,d,y=0,B=-1,f=!0){if((!d||!(d instanceof Int8Array)&&!(d instanceof Uint8Array))&&n("jstrcpy() target must be an Int8Array or Uint8Array."),B<0&&(B=d.length-y),!(B>0)||!(y>=0))return 0;let h=0,l=c.length;const _=y,u=y+B-(f?1:0);for(;h<l&&y<u;++h){let I=c.charCodeAt(h);if(I>=55296&&I<=57343&&(I=65536+((I&1023)<<10)|c.charCodeAt(++h)&1023),I<=127){if(y>=u)break;d[y++]=I}else if(I<=2047){if(y+1>=u)break;d[y++]=192|I>>6,d[y++]=128|I&63}else if(I<=65535){if(y+2>=u)break;d[y++]=224|I>>12,d[y++]=128|I>>6&63,d[y++]=128|I&63}else{if(y+3>=u)break;d[y++]=240|I>>18,d[y++]=128|I>>12&63,d[y++]=128|I>>6&63,d[y++]=128|I&63}}return f&&(d[y++]=0),y-_},t.cstrncpy=function(c,d,y){if((!c||!d)&&n("cstrncpy() does not accept NULL strings."),y<0)y=t.cstrlen(strPtr)+1;else if(!(y>0))return 0;const B=t.heap8u();let f=0,h;for(;f<y&&(h=B[d+f]);++f)B[c+f]=h;return f<y&&(B[c+f++]=0),f},t.jstrToUintArray=(c,d=!1)=>o.utf8Encoder.encode(d?c+"\0":c);const z=(c,d)=>{(!(c.alloc instanceof Function)||!(c.dealloc instanceof Function))&&n("Object is missing alloc() and/or dealloc() function(s)","required by",d+"().")},Q=function(c,d,y,B){if(z(t,B),typeof c!="string")return null;{const f=o.utf8Encoder.encode(c),h=y(f.length+1),l=p().HEAP8U;return l.set(f,h),l[h+f.length]=0,d?[h,f.length]:h}};t.allocCString=(c,d=!1)=>Q(c,d,t.alloc,"allocCString()"),t.scopedAllocPush=function(){z(t,"scopedAllocPush");const c=[];return o.scopedAlloc.push(c),c},t.scopedAllocPop=function(c){z(t,"scopedAllocPop");const d=arguments.length?o.scopedAlloc.indexOf(c):o.scopedAlloc.length-1;d<0&&n("Invalid state object for scopedAllocPop()."),arguments.length===0&&(c=o.scopedAlloc[d]),o.scopedAlloc.splice(d,1);for(let y;y=c.pop();)t.functionEntry(y)?t.uninstallFunction(y):t.dealloc(y)},t.scopedAlloc=function(c){o.scopedAlloc.length||n("No scopedAllocPush() scope is active.");const d=t.alloc(c);return o.scopedAlloc[o.scopedAlloc.length-1].push(d),d},Object.defineProperty(t.scopedAlloc,"level",{configurable:!1,enumerable:!1,get:()=>o.scopedAlloc.length,set:()=>n("The 'active' property is read-only.")}),t.scopedAllocCString=(c,d=!1)=>Q(c,d,t.scopedAlloc,"scopedAllocCString()");const T=function(c,d){const y=t[c?"scopedAlloc":"alloc"]((d.length+1)*t.ptrSizeof);let B=0;return d.forEach(f=>{t.pokePtr(y+t.ptrSizeof*B++,t[c?"scopedAllocCString":"allocCString"](""+f))}),t.pokePtr(y+t.ptrSizeof*B,0),y};t.scopedAllocMainArgv=c=>T(!0,c),t.allocMainArgv=c=>T(!1,c),t.cArgvToJs=(c,d)=>{const y=[];for(let B=0;B<c;++B){const f=t.peekPtr(d+t.ptrSizeof*B);y.push(f?t.cstrToJs(f):null)}return y},t.scopedAllocCall=function(c){t.scopedAllocPush();try{return c()}finally{t.scopedAllocPop()}};const A=function(c,d,y){z(t,y);const B=d?"i64":r;let f=t[y](c*(d?8:s));if(t.poke(f,0,B),c===1)return f;const h=[f];for(let l=1;l<c;++l)f+=d?8:s,h[l]=f,t.poke(f,0,B);return h};t.allocPtr=(c=1,d=!0)=>A(c,d,"alloc"),t.scopedAllocPtr=(c=1,d=!0)=>A(c,d,"scopedAlloc"),t.xGet=function(c){return t.exports[c]||n("Cannot find exported symbol:",c)};const D=(c,d)=>n(c+"() requires",d,"argument(s).");t.xCall=function(c,...d){const y=c instanceof Function?c:t.xGet(c);return y instanceof Function||n("Exported symbol",c,"is not a function."),y.length!==d.length&&D(y===c?y.name:c,y.length),arguments.length===2&&Array.isArray(arguments[1])?y.apply(null,arguments[1]):y.apply(null,d)},o.xWrap=Object.create(null),o.xWrap.convert=Object.create(null),o.xWrap.convert.arg=new Map,o.xWrap.convert.result=new Map;const q=o.xWrap.convert.arg,w=o.xWrap.convert.result;t.bigIntEnabled&&q.set("i64",c=>BigInt(c));const x=r==="i32"?c=>c|0:c=>BigInt(c)|BigInt(0);q.set("i32",x).set("i16",c=>(c|0)&65535).set("i8",c=>(c|0)&255).set("f32",c=>Number(c).valueOf()).set("float",q.get("f32")).set("f64",q.get("f32")).set("double",q.get("f64")).set("int",q.get("i32")).set("null",c=>c).set(null,q.get("null")).set("**",x).set("*",x),w.set("*",x).set("pointer",x).set("number",c=>Number(c)).set("void",c=>{}).set("null",c=>c).set(null,w.get("null"));{const c=["i8","i16","i32","int","f32","float","f64","double"];t.bigIntEnabled&&c.push("i64");const d=q.get(r);for(const y of c)q.set(y+"*",d),w.set(y+"*",d),w.set(y,q.get(y)||n("Missing arg converter:",y))}const N=function(c){return typeof c=="string"?t.scopedAllocCString(c):c?x(c):null};q.set("string",N).set("utf8",N).set("pointer",N),w.set("string",c=>t.cstrToJs(c)).set("utf8",w.get("string")).set("string:dealloc",c=>{try{return c?t.cstrToJs(c):null}finally{t.dealloc(c)}}).set("utf8:dealloc",w.get("string:dealloc")).set("json",c=>JSON.parse(t.cstrToJs(c))).set("json:dealloc",c=>{try{return c?JSON.parse(t.cstrToJs(c)):null}finally{t.dealloc(c)}});const O=class{constructor(c){this.name=c.name||"unnamed adapter"}convertArg(c,d,y){n("AbstractArgAdapter must be subclassed.")}};q.FuncPtrAdapter=class Te extends O{constructor(d){super(d),q.FuncPtrAdapter.warnOnUse&&console.warn("xArg.FuncPtrAdapter is an internal-only API","and is not intended to be invoked from","client-level code. Invoked with:",d),this.name=d.name||"unnamed",this.signature=d.signature,d.contextKey instanceof Function&&(this.contextKey=d.contextKey,d.bindScope||(d.bindScope="context")),this.bindScope=d.bindScope||n("FuncPtrAdapter options requires a bindScope (explicit or implied)."),Te.bindScopes.indexOf(d.bindScope)<0&&n("Invalid options.bindScope ("+d.bindMod+") for FuncPtrAdapter. Expecting one of: ("+Te.bindScopes.join(", ")+")"),this.isTransient=this.bindScope==="transient",this.isContext=this.bindScope==="context",this.isPermanent=this.bindScope==="permanent",this.singleton=this.bindScope==="singleton"?[]:void 0,this.callProxy=d.callProxy instanceof Function?d.callProxy:void 0}contextKey(d,y){return this}contextMap(d){const y=this.__cmap||(this.__cmap=new Map);let B=y.get(d);return B===void 0&&y.set(d,B=[]),B}convertArg(d,y,B){let f=this.singleton;if(!f&&this.isContext&&(f=this.contextMap(this.contextKey(y,B))),f&&f[0]===d)return f[1];if(d instanceof Function){this.callProxy&&(d=this.callProxy(d));const h=g(d,this.signature,this.isTransient);if(Te.debugFuncInstall&&Te.debugOut("FuncPtrAdapter installed",this,this.contextKey(y,B),"@"+h,d),f){if(f[1]){Te.debugFuncInstall&&Te.debugOut("FuncPtrAdapter uninstalling",this,this.contextKey(y,B),"@"+f[1],d);try{o.scopedAlloc[o.scopedAlloc.length-1].push(f[1])}catch{}}f[0]=d,f[1]=h}return h}else if(t.isPtr(d)||d===null||d===void 0){if(f&&f[1]&&f[1]!==d){Te.debugFuncInstall&&Te.debugOut("FuncPtrAdapter uninstalling",this,this.contextKey(y,B),"@"+f[1],d);try{o.scopedAlloc[o.scopedAlloc.length-1].push(f[1])}catch{}f[0]=f[1]=d|0}return d||0}else throw new TypeError("Invalid FuncPtrAdapter argument type. Expecting a function pointer or a "+(this.name?this.name+" ":"")+"function matching signature "+this.signature+".")}},q.FuncPtrAdapter.warnOnUse=!1,q.FuncPtrAdapter.debugFuncInstall=!1,q.FuncPtrAdapter.debugOut=console.debug.bind(console),q.FuncPtrAdapter.bindScopes=["transient","context","singleton","permanent"];const S=c=>q.get(c)||n("Argument adapter not found:",c),L=c=>w.get(c)||n("Result adapter not found:",c);o.xWrap.convertArg=(c,...d)=>S(c)(...d),o.xWrap.convertArgNoCheck=(c,...d)=>q.get(c)(...d),o.xWrap.convertResult=(c,d)=>c===null?d:c?L(c)(d):void 0,o.xWrap.convertResultNoCheck=(c,d)=>c===null?d:c?w.get(c)(d):void 0,t.xWrap=function(c,d,...y){arguments.length===3&&Array.isArray(arguments[2])&&(y=arguments[2]),t.isPtr(c)&&(c=t.functionEntry(c)||n("Function pointer not found in WASM function table."));const B=c instanceof Function,f=B?c:t.xGet(c);if(B&&(c=f.name||"unnamed function"),y.length!==f.length&&D(c,f.length),d===null&&f.length===0)return f;d!=null&&L(d);for(const l of y)l instanceof O?q.set(l,(..._)=>l.convertArg(..._)):S(l);const h=o.xWrap;return f.length===0?(...l)=>l.length?D(c,f.length):h.convertResult(d,f.call(null)):function(...l){l.length!==f.length&&D(c,f.length);const _=t.scopedAllocPush();try{let u=0;for(;u<l.length;++u)l[u]=h.convertArgNoCheck(y[u],l[u],l,u);return h.convertResultNoCheck(d,f.apply(null,l))}finally{t.scopedAllocPop(_)}}};const $=function(c,d,y,B,f,h){if(typeof y=="string"){if(d===1)return h.get(y);if(d===2){if(B)B instanceof Function||n(f,"requires a function argument.");else return h.delete(y),c;return h.set(y,B),c}}n("Invalid arguments to",f)};return t.xWrap.resultAdapter=function c(d,y){return $(c,arguments.length,d,y,"resultAdapter()",w)},t.xWrap.argAdapter=function c(d,y){return $(c,arguments.length,d,y,"argAdapter()",q)},t.xWrap.FuncPtrAdapter=q.FuncPtrAdapter,t.xCallWrapped=function(c,d,y,...B){return Array.isArray(arguments[3])&&(B=arguments[3]),t.xWrap(c,d,y||[]).apply(null,B||[])},t.xWrap.testConvertArg=o.xWrap.convertArg,t.xWrap.testConvertResult=o.xWrap.convertResult,t},globalThis.WhWasmUtilInstaller.yawl=(function(t){const n=()=>fetch(t.uri,{credentials:"same-origin"}),r=this,s=function(p){if(t.wasmUtilTarget){const g=(...R)=>{throw new Error(R.join(" "))},P=t.wasmUtilTarget;if(P.module=p.module,P.instance=p.instance,P.instance.exports.memory||(P.memory=t.imports&&t.imports.env&&t.imports.env.memory||g("Missing 'memory' object!")),!P.alloc&&p.instance.exports.malloc){const R=p.instance.exports;P.alloc=function(z){return R.malloc(z)||g("Allocation of",z,"bytes failed.")},P.dealloc=function(z){R.free(z)}}r(P)}return t.onload&&t.onload(p,t),p};return WebAssembly.instantiateStreaming?function(){return WebAssembly.instantiateStreaming(n(),t.imports||{}).then(s)}:function(){return n().then(g=>g.arrayBuffer()).then(g=>WebAssembly.instantiate(g,t.imports||{})).then(s)}}).bind(globalThis.WhWasmUtilInstaller),globalThis.Jaccwabyt=function t(n){const r=(...F)=>{throw new Error(F.join(" "))};!(n.heap instanceof WebAssembly.Memory)&&!(n.heap instanceof Function)&&r("config.heap must be WebAssembly.Memory instance or a function."),["alloc","dealloc"].forEach(function(F){n[F]instanceof Function||r("Config option '"+F+"' must be a function.")});const s=t,o=n.heap instanceof Function?n.heap:()=>new Uint8Array(n.heap.buffer),p=n.alloc,g=n.dealloc,P=n.log||console.log.bind(console),R=n.memberPrefix||"",z=n.memberSuffix||"",Q=n.bigIntEnabled===void 0?!!globalThis.BigInt64Array:!!n.bigIntEnabled,T=globalThis.BigInt,A=globalThis.BigInt64Array,D=n.ptrSizeof||4,q=n.ptrIR||"i32";s.debugFlags||(s.__makeDebugFlags=function(F=null){F&&F.__flags&&(F=F.__flags);const V=function K(X){return arguments.length===0?K.__flags:(X<0?(delete K.__flags.getter,delete K.__flags.setter,delete K.__flags.alloc,delete K.__flags.dealloc):(K.__flags.getter=(1&X)!==0,K.__flags.setter=(2&X)!==0,K.__flags.alloc=(4&X)!==0,K.__flags.dealloc=(8&X)!==0),K._flags)};return Object.defineProperty(V,"__flags",{iterable:!1,writable:!1,value:Object.create(F)}),F||V(0),V},s.debugFlags=s.__makeDebugFlags());const w=(function(){const F=new ArrayBuffer(2);return new DataView(F).setInt16(0,256,!0),new Int16Array(F)[0]===256})(),x=F=>F[1]==="(",N=F=>F==="P",O=F=>x(F)?"p":F[0],S=function(F){switch(O(F)){case"c":case"C":return"i8";case"i":return"i32";case"p":case"P":case"s":return q;case"j":return"i64";case"f":return"float";case"d":return"double"}r("Unhandled signature IR:",F)},L=A?()=>!0:()=>r("BigInt64Array is not available."),$=function(F){switch(O(F)){case"p":case"P":case"s":{switch(D){case 4:return"getInt32";case 8:return L()&&"getBigInt64"}break}case"i":return"getInt32";case"c":return"getInt8";case"C":return"getUint8";case"j":return L()&&"getBigInt64";case"f":return"getFloat32";case"d":return"getFloat64"}r("Unhandled DataView getter for signature:",F)},c=function(F){switch(O(F)){case"p":case"P":case"s":{switch(D){case 4:return"setInt32";case 8:return L()&&"setBigInt64"}break}case"i":return"setInt32";case"c":return"setInt8";case"C":return"setUint8";case"j":return L()&&"setBigInt64";case"f":return"setFloat32";case"d":return"setFloat64"}r("Unhandled DataView setter for signature:",F)},d=function(F){switch(O(F)){case"i":case"f":case"c":case"C":case"d":return Number;case"j":return L()&&T;case"p":case"P":case"s":switch(D){case 4:return Number;case 8:return L()&&T}break}r("Unhandled DataView set wrapper for signature:",F)},y=(F,V)=>F+"::"+V,B=function(F,V){return()=>r(y(F,V),"is read-only.")},f=new WeakMap,h="(pointer-is-external)",l=function(F,V,K){if(K||(K=f.get(V)),K){if(f.delete(V),Array.isArray(V.ondispose)){let X;for(;X=V.ondispose.shift();)try{X instanceof Function?X.call(V):X instanceof te?X.dispose():typeof X=="number"&&g(X)}catch(_e){console.warn("ondispose() for",F.structName,"@",K,"threw. NOT propagating it.",_e)}}else if(V.ondispose instanceof Function)try{V.ondispose()}catch(X){console.warn("ondispose() for",F.structName,"@",K,"threw. NOT propagating it.",X)}delete V.ondispose,F.debugFlags.__flags.dealloc&&P("debug.dealloc:",V[h]?"EXTERNAL":"",F.structName,"instance:",F.structInfo.sizeof,"bytes @"+K),V[h]||g(K)}},_=F=>({configurable:!1,writable:!1,iterable:!1,value:F}),u=function(F,V,K){let X=!K;K?Object.defineProperty(V,h,_(K)):(K=p(F.structInfo.sizeof),K||r("Allocation of",F.structName,"structure failed."));try{F.debugFlags.__flags.alloc&&P("debug.alloc:",X?"":"EXTERNAL",F.structName,"instance:",F.structInfo.sizeof,"bytes @"+K),X&&o().fill(0,K,K+F.structInfo.sizeof),f.set(V,K)}catch(_e){throw l(F,V,K),_e}},I=function(){const F=this.pointer;return F?new Uint8Array(o().slice(F,F+this.structInfo.sizeof)):null},ee=_(F=>R+F+z),ne=function(F,V,K=!0){let X=F.members[V];if(!X&&(R||z)){for(const _e of Object.values(F.members))if(_e.key===V){X=_e;break}!X&&K&&r(y(F.name,V),"is not a mapped struct member.")}return X},se=function F(V,K,X=!1){F._||(F._=he=>he.replace(/[^vipPsjrdcC]/g,"").replace(/[pPscC]/g,"i"));const _e=ne(V.structInfo,K,!0);return X?F._(_e.signature):_e.signature},ie={configurable:!1,enumerable:!1,get:function(){return f.get(this)},set:()=>r("Cannot assign the 'pointer' property of a struct.")},j=_(function(){const F=[];for(const V of Object.keys(this.structInfo.members))F.push(this.memberKey(V));return F}),b=new TextDecoder("utf-8"),k=new TextEncoder,W=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,H=function(F,V,K){return b.decode(F.buffer instanceof W?F.slice(V,K):F.subarray(V,K))},Z=function(F,V,K=!1){const X=ne(F.structInfo,V,K);return X&&X.signature.length===1&&X.signature[0]==="s"?X:!1},E=function(F){F.signature!=="s"&&r("Invalid member type signature for C-string value:",JSON.stringify(F))},C=function(V,K){const X=ne(V.structInfo,K,!0);E(X);const _e=V[X.key];if(!_e)return null;let he=_e;const de=o();for(;de[he]!==0;++he);return _e===he?"":H(de,_e,he)},M=function(F,...V){F.ondispose?Array.isArray(F.ondispose)||(F.ondispose=[F.ondispose]):F.ondispose=[],F.ondispose.push(...V)},J=function(F){const V=k.encode(F),K=p(V.length+1);K||r("Allocation error while duplicating string:",F);const X=o();return X.set(V,K),X[K+V.length]=0,K},G=function(F,V,K){const X=ne(F.structInfo,V,!0);E(X);const _e=J(K);return F[X.key]=_e,M(F,_e),F},te=function(V,K){arguments[2]!==_&&r("Do not call the StructType constructor","from client-level code."),Object.defineProperties(this,{structName:_(V),structInfo:_(K)})};te.prototype=Object.create(null,{dispose:_(function(){l(this.constructor,this)}),lookupMember:_(function(F,V=!0){return ne(this.structInfo,F,V)}),memberToJsString:_(function(F){return C(this,F)}),memberIsString:_(function(F,V=!0){return Z(this,F,V)}),memberKey:ee,memberKeys:j,memberSignature:_(function(F,V=!1){return se(this,F,V)}),memoryDump:_(I),pointer:ie,setMemberCString:_(function(F,V){return G(this,F,V)})}),Object.assign(te.prototype,{addOnDispose:function(...F){return M(this,...F),this}}),Object.defineProperties(te,{allocCString:_(J),isA:_(F=>F instanceof te),hasExternalPointer:_(F=>F instanceof te&&!!F[h]),memberKey:ee});const le=F=>Number.isFinite(F)||F instanceof(T||Number),Y=function F(V,K,X){if(!F._){F._={getters:{},setters:{},sw:{}};const ve=["i","c","C","p","P","s","f","d","v()"];Q&&ve.push("j"),ve.forEach(function(Se){F._.getters[Se]=$(Se),F._.setters[Se]=c(Se),F._.sw[Se]=d(Se)});const $n=/^[ipPsjfdcC]$/,Kn=/^[vipPsjfdcC]\([ipPsjfdcC]*\)$/;F.sigCheck=function(Se,Jn,Tt,_t){Object.prototype.hasOwnProperty.call(Se,Tt)&&r(Se.structName,"already has a property named",Tt+"."),$n.test(_t)||Kn.test(_t)||r("Malformed signature for",y(Se.structName,Jn)+":",_t)}}const _e=V.memberKey(K);F.sigCheck(V.prototype,K,_e,X.signature),X.key=_e,X.name=K;const he=O(X.signature),de=y(V.prototype.structName,_e),pe=V.prototype.debugFlags.__flags,We=Object.create(null);We.configurable=!1,We.enumerable=!1,We.get=function(){pe.getter&&P("debug.getter:",F._.getters[he],"for",S(he),de,"@",this.pointer,"+",X.offset,"sz",X.sizeof);let ve=new DataView(o().buffer,this.pointer+X.offset,X.sizeof)[F._.getters[he]](0,w);return pe.getter&&P("debug.getter:",de,"result =",ve),ve},X.readOnly?We.set=B(V.prototype.structName,_e):We.set=function(ve){if(pe.setter&&P("debug.setter:",F._.setters[he],"for",S(he),de,"@",this.pointer,"+",X.offset,"sz",X.sizeof,ve),this.pointer||r("Cannot set struct property on disposed instance."),ve===null)ve=0;else for(;!le(ve);){if(N(X.signature)&&ve instanceof te){ve=ve.pointer||0,pe.setter&&P("debug.setter:",de,"resolved to",ve);break}r("Invalid value for pointer-type",de+".")}new DataView(o().buffer,this.pointer+X.offset,X.sizeof)[F._.setters[he]](0,F._.sw[he](ve),w)},Object.defineProperty(V.prototype,_e,We)},be=function F(V,K){arguments.length===1?(K=V,V=K.name):K.name||(K.name=V),V||r("Struct name is required.");let X=!1;Object.keys(K.members).forEach(de=>{const pe=K.members[de];pe.sizeof?pe.sizeof===1?pe.signature==="c"||pe.signature==="C"||r("Unexpected sizeof==1 member",y(K.name,de),"with signature",pe.signature):(pe.sizeof%4!==0&&(console.warn("Invalid struct member description =",pe,"from",K),r(V,"member",de,"sizeof is not aligned. sizeof="+pe.sizeof)),pe.offset%4!==0&&(console.warn("Invalid struct member description =",pe,"from",K),r(V,"member",de,"offset is not aligned. offset="+pe.offset))):r(V,"member",de,"is missing sizeof."),(!X||X.offset<pe.offset)&&(X=pe)}),X?K.sizeof<X.offset+X.sizeof&&r("Invalid struct config:",V,"max member offset ("+X.offset+") ","extends past end of struct (sizeof="+K.sizeof+")."):r("No member property descriptions found.");const _e=_(s.__makeDebugFlags(F.debugFlags)),he=function de(pe){this instanceof de?arguments.length?((pe!==(pe|0)||pe<=0)&&r("Invalid pointer value for",V,"constructor."),u(de,this,pe)):u(de,this):r("The",V,"constructor may only be called via 'new'.")};return Object.defineProperties(he,{debugFlags:_e,isA:_(de=>de instanceof he),memberKey:ee,memberKeys:j,methodInfoForKey:_(function(de){}),structInfo:_(K),structName:_(V)}),he.prototype=new te(V,K,_),Object.defineProperties(he.prototype,{debugFlags:_e,constructor:_(he)}),Object.keys(K.members).forEach(de=>Y(he,de,K.members[de])),he};return be.StructType=te,be.config=n,be.allocCString=J,be.debugFlags||(be.debugFlags=s.__makeDebugFlags(s.debugFlags)),be},globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=(...q)=>{throw new Error(q.join(" "))};t.SQLite3Error.toss;const r=t.capi,s=t.wasm,o=t.util;if(globalThis.WhWasmUtilInstaller(s),delete globalThis.WhWasmUtilInstaller,s.bindingSignatures=[["sqlite3_aggregate_context","void*","sqlite3_context*","int"],["sqlite3_bind_double","int","sqlite3_stmt*","int","f64"],["sqlite3_bind_int","int","sqlite3_stmt*","int","int"],["sqlite3_bind_null",void 0,"sqlite3_stmt*","int"],["sqlite3_bind_parameter_count","int","sqlite3_stmt*"],["sqlite3_bind_parameter_index","int","sqlite3_stmt*","string"],["sqlite3_bind_parameter_name","string","sqlite3_stmt*","int"],["sqlite3_bind_pointer","int","sqlite3_stmt*","int","*","string:static","*"],["sqlite3_busy_handler","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({signature:"i(pi)",contextKey:(q,w)=>q[0]}),"*"]],["sqlite3_busy_timeout","int","sqlite3*","int"],["sqlite3_changes","int","sqlite3*"],["sqlite3_clear_bindings","int","sqlite3_stmt*"],["sqlite3_collation_needed","int","sqlite3*","*","*"],["sqlite3_column_blob","*","sqlite3_stmt*","int"],["sqlite3_column_bytes","int","sqlite3_stmt*","int"],["sqlite3_column_count","int","sqlite3_stmt*"],["sqlite3_column_decltype","string","sqlite3_stmt*","int"],["sqlite3_column_double","f64","sqlite3_stmt*","int"],["sqlite3_column_int","int","sqlite3_stmt*","int"],["sqlite3_column_name","string","sqlite3_stmt*","int"],["sqlite3_column_text","string","sqlite3_stmt*","int"],["sqlite3_column_type","int","sqlite3_stmt*","int"],["sqlite3_column_value","sqlite3_value*","sqlite3_stmt*","int"],["sqlite3_commit_hook","void*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_commit_hook",signature:"i(p)",contextKey:q=>q[0]}),"*"]],["sqlite3_compileoption_get","string","int"],["sqlite3_compileoption_used","int","string"],["sqlite3_complete","int","string:flexible"],["sqlite3_context_db_handle","sqlite3*","sqlite3_context*"],["sqlite3_data_count","int","sqlite3_stmt*"],["sqlite3_db_filename","string","sqlite3*","string"],["sqlite3_db_handle","sqlite3*","sqlite3_stmt*"],["sqlite3_db_name","string","sqlite3*","int"],["sqlite3_db_readonly","int","sqlite3*","string"],["sqlite3_db_status","int","sqlite3*","int","*","*","int"],["sqlite3_errcode","int","sqlite3*"],["sqlite3_errmsg","string","sqlite3*"],["sqlite3_error_offset","int","sqlite3*"],["sqlite3_errstr","string","int"],["sqlite3_exec","int",["sqlite3*","string:flexible",new s.xWrap.FuncPtrAdapter({signature:"i(pipp)",bindScope:"transient",callProxy:q=>{let w;return(x,N,O,S)=>{try{const L=s.cArgvToJs(N,O);return w||(w=s.cArgvToJs(N,S)),q(L,w)|0}catch(L){return L.resultCode||r.SQLITE_ERROR}}}}),"*","**"]],["sqlite3_expanded_sql","string","sqlite3_stmt*"],["sqlite3_extended_errcode","int","sqlite3*"],["sqlite3_extended_result_codes","int","sqlite3*","int"],["sqlite3_file_control","int","sqlite3*","string","int","*"],["sqlite3_finalize","int","sqlite3_stmt*"],["sqlite3_free",void 0,"*"],["sqlite3_get_autocommit","int","sqlite3*"],["sqlite3_get_auxdata","*","sqlite3_context*","int"],["sqlite3_initialize",void 0],["sqlite3_interrupt",void 0,"sqlite3*"],["sqlite3_is_interrupted","int","sqlite3*"],["sqlite3_keyword_count","int"],["sqlite3_keyword_name","int",["int","**","*"]],["sqlite3_keyword_check","int",["string","int"]],["sqlite3_libversion","string"],["sqlite3_libversion_number","int"],["sqlite3_limit","int",["sqlite3*","int","int"]],["sqlite3_malloc","*","int"],["sqlite3_open","int","string","*"],["sqlite3_open_v2","int","string","*","int","string"],["sqlite3_realloc","*","*","int"],["sqlite3_reset","int","sqlite3_stmt*"],["sqlite3_result_blob",void 0,"sqlite3_context*","*","int","*"],["sqlite3_result_double",void 0,"sqlite3_context*","f64"],["sqlite3_result_error",void 0,"sqlite3_context*","string","int"],["sqlite3_result_error_code",void 0,"sqlite3_context*","int"],["sqlite3_result_error_nomem",void 0,"sqlite3_context*"],["sqlite3_result_error_toobig",void 0,"sqlite3_context*"],["sqlite3_result_int",void 0,"sqlite3_context*","int"],["sqlite3_result_null",void 0,"sqlite3_context*"],["sqlite3_result_pointer",void 0,"sqlite3_context*","*","string:static","*"],["sqlite3_result_subtype",void 0,"sqlite3_value*","int"],["sqlite3_result_text",void 0,"sqlite3_context*","string","int","*"],["sqlite3_result_zeroblob",void 0,"sqlite3_context*","int"],["sqlite3_rollback_hook","void*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_rollback_hook",signature:"v(p)",contextKey:q=>q[0]}),"*"]],["sqlite3_set_auxdata",void 0,["sqlite3_context*","int","*","*"]],["sqlite3_shutdown",void 0],["sqlite3_sourceid","string"],["sqlite3_sql","string","sqlite3_stmt*"],["sqlite3_status","int","int","*","*","int"],["sqlite3_step","int","sqlite3_stmt*"],["sqlite3_stmt_busy","int","sqlite3_stmt*"],["sqlite3_stmt_readonly","int","sqlite3_stmt*"],["sqlite3_stmt_status","int","sqlite3_stmt*","int","int"],["sqlite3_strglob","int","string","string"],["sqlite3_stricmp","int","string","string"],["sqlite3_strlike","int","string","string","int"],["sqlite3_strnicmp","int","string","string","int"],["sqlite3_table_column_metadata","int","sqlite3*","string","string","string","**","**","*","*","*"],["sqlite3_total_changes","int","sqlite3*"],["sqlite3_trace_v2","int",["sqlite3*","int",new s.xWrap.FuncPtrAdapter({name:"sqlite3_trace_v2::callback",signature:"i(ippp)",contextKey:(q,w)=>q[0]}),"*"]],["sqlite3_txn_state","int",["sqlite3*","string"]],["sqlite3_uri_boolean","int","sqlite3_filename","string","int"],["sqlite3_uri_key","string","sqlite3_filename","int"],["sqlite3_uri_parameter","string","sqlite3_filename","string"],["sqlite3_user_data","void*","sqlite3_context*"],["sqlite3_value_blob","*","sqlite3_value*"],["sqlite3_value_bytes","int","sqlite3_value*"],["sqlite3_value_double","f64","sqlite3_value*"],["sqlite3_value_dup","sqlite3_value*","sqlite3_value*"],["sqlite3_value_free",void 0,"sqlite3_value*"],["sqlite3_value_frombind","int","sqlite3_value*"],["sqlite3_value_int","int","sqlite3_value*"],["sqlite3_value_nochange","int","sqlite3_value*"],["sqlite3_value_numeric_type","int","sqlite3_value*"],["sqlite3_value_pointer","*","sqlite3_value*","string:static"],["sqlite3_value_subtype","int","sqlite3_value*"],["sqlite3_value_text","string","sqlite3_value*"],["sqlite3_value_type","int","sqlite3_value*"],["sqlite3_vfs_find","*","string"],["sqlite3_vfs_register","int","sqlite3_vfs*","int"],["sqlite3_vfs_unregister","int","sqlite3_vfs*"]],s.exports.sqlite3_progress_handler&&s.bindingSignatures.push(["sqlite3_progress_handler",void 0,["sqlite3*","int",new s.xWrap.FuncPtrAdapter({name:"xProgressHandler",signature:"i(p)",bindScope:"context",contextKey:(q,w)=>q[0]}),"*"]]),s.exports.sqlite3_stmt_explain&&s.bindingSignatures.push(["sqlite3_stmt_explain","int","sqlite3_stmt*","int"],["sqlite3_stmt_isexplain","int","sqlite3_stmt*"]),s.exports.sqlite3_set_authorizer&&s.bindingSignatures.push(["sqlite3_set_authorizer","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_set_authorizer::xAuth",signature:"i(pissss)",contextKey:(q,w)=>q[0],callProxy:q=>(w,x,N,O,S,L)=>{try{return N=N&&s.cstrToJs(N),O=O&&s.cstrToJs(O),S=S&&s.cstrToJs(S),L=L&&s.cstrToJs(L),q(w,x,N,O,S,L)||0}catch($){return $.resultCode||r.SQLITE_ERROR}}}),"*"]]),s.bindingSignatures.int64=[["sqlite3_bind_int64","int",["sqlite3_stmt*","int","i64"]],["sqlite3_changes64","i64",["sqlite3*"]],["sqlite3_column_int64","i64",["sqlite3_stmt*","int"]],["sqlite3_deserialize","int","sqlite3*","string","*","i64","i64","int"],["sqlite3_last_insert_rowid","i64",["sqlite3*"]],["sqlite3_malloc64","*","i64"],["sqlite3_msize","i64","*"],["sqlite3_overload_function","int",["sqlite3*","string","int"]],["sqlite3_realloc64","*","*","i64"],["sqlite3_result_int64",void 0,"*","i64"],["sqlite3_result_zeroblob64","int","*","i64"],["sqlite3_serialize","*","sqlite3*","string","*","int"],["sqlite3_set_last_insert_rowid",void 0,["sqlite3*","i64"]],["sqlite3_status64","int","int","*","*","int"],["sqlite3_total_changes64","i64",["sqlite3*"]],["sqlite3_update_hook","*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_update_hook",signature:"v(iippj)",contextKey:q=>q[0],callProxy:q=>(w,x,N,O,S)=>{q(w,x,s.cstrToJs(N),s.cstrToJs(O),S)}}),"*"]],["sqlite3_uri_int64","i64",["sqlite3_filename","string","i64"]],["sqlite3_value_int64","i64","sqlite3_value*"]],s.bigIntEnabled&&s.exports.sqlite3_declare_vtab&&s.bindingSignatures.int64.push(["sqlite3_create_module","int",["sqlite3*","string","sqlite3_module*","*"]],["sqlite3_create_module_v2","int",["sqlite3*","string","sqlite3_module*","*","*"]],["sqlite3_declare_vtab","int",["sqlite3*","string:flexible"]],["sqlite3_drop_modules","int",["sqlite3*","**"]],["sqlite3_vtab_collation","string","sqlite3_index_info*","int"],["sqlite3_vtab_distinct","int","sqlite3_index_info*"],["sqlite3_vtab_in","int","sqlite3_index_info*","int","int"],["sqlite3_vtab_in_first","int","sqlite3_value*","**"],["sqlite3_vtab_in_next","int","sqlite3_value*","**"],["sqlite3_vtab_nochange","int","sqlite3_context*"],["sqlite3_vtab_on_conflict","int","sqlite3*"],["sqlite3_vtab_rhs_value","int","sqlite3_index_info*","int","**"]),s.bigIntEnabled&&s.exports.sqlite3_preupdate_hook&&s.bindingSignatures.int64.push(["sqlite3_preupdate_blobwrite","int","sqlite3*"],["sqlite3_preupdate_count","int","sqlite3*"],["sqlite3_preupdate_depth","int","sqlite3*"],["sqlite3_preupdate_hook","*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_preupdate_hook",signature:"v(ppippjj)",contextKey:q=>q[0],callProxy:q=>(w,x,N,O,S,L,$)=>{q(w,x,N,s.cstrToJs(O),s.cstrToJs(S),L,$)}}),"*"]],["sqlite3_preupdate_new","int",["sqlite3*","int","**"]],["sqlite3_preupdate_old","int",["sqlite3*","int","**"]]),s.bigIntEnabled&&s.exports.sqlite3changegroup_add&&s.exports.sqlite3session_create&&s.exports.sqlite3_preupdate_hook){const q={signature:"i(ps)",callProxy:w=>(x,N)=>{try{return w(x,s.cstrToJs(N))|0}catch(O){return O.resultCode||r.SQLITE_ERROR}}};s.bindingSignatures.int64.push(["sqlite3changegroup_add","int",["sqlite3_changegroup*","int","void*"]],["sqlite3changegroup_add_strm","int",["sqlite3_changegroup*",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*"]],["sqlite3changegroup_delete",void 0,["sqlite3_changegroup*"]],["sqlite3changegroup_new","int",["**"]],["sqlite3changegroup_output","int",["sqlite3_changegroup*","int*","**"]],["sqlite3changegroup_output_strm","int",["sqlite3_changegroup*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppi)",bindScope:"transient"}),"void*"]],["sqlite3changeset_apply","int",["sqlite3*","int","void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",bindScope:"transient",...q}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*"]],["sqlite3changeset_apply_strm","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",bindScope:"transient",...q}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*"]],["sqlite3changeset_apply_v2","int",["sqlite3*","int","void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",bindScope:"transient",...q}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*","**","int*","int"]],["sqlite3changeset_apply_v2_strm","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",bindScope:"transient",...q}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*","**","int*","int"]],["sqlite3changeset_concat","int",["int","void*","int","void*","int*","**"]],["sqlite3changeset_concat_strm","int",[new s.xWrap.FuncPtrAdapter({name:"xInputA",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xInputB",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppi)",bindScope:"transient"}),"void*"]],["sqlite3changeset_conflict","int",["sqlite3_changeset_iter*","int","**"]],["sqlite3changeset_finalize","int",["sqlite3_changeset_iter*"]],["sqlite3changeset_fk_conflicts","int",["sqlite3_changeset_iter*","int*"]],["sqlite3changeset_invert","int",["int","void*","int*","**"]],["sqlite3changeset_invert_strm","int",[new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppi)",bindScope:"transient"}),"void*"]],["sqlite3changeset_new","int",["sqlite3_changeset_iter*","int","**"]],["sqlite3changeset_next","int",["sqlite3_changeset_iter*"]],["sqlite3changeset_old","int",["sqlite3_changeset_iter*","int","**"]],["sqlite3changeset_op","int",["sqlite3_changeset_iter*","**","int*","int*","int*"]],["sqlite3changeset_pk","int",["sqlite3_changeset_iter*","**","int*"]],["sqlite3changeset_start","int",["**","int","*"]],["sqlite3changeset_start_strm","int",["**",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*"]],["sqlite3changeset_start_v2","int",["**","int","*","int"]],["sqlite3changeset_start_v2_strm","int",["**",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*","int"]],["sqlite3session_attach","int",["sqlite3_session*","string"]],["sqlite3session_changeset","int",["sqlite3_session*","int*","**"]],["sqlite3session_changeset_size","i64",["sqlite3_session*"]],["sqlite3session_changeset_strm","int",["sqlite3_session*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppp)",bindScope:"transient"}),"void*"]],["sqlite3session_config","int",["int","void*"]],["sqlite3session_create","int",["sqlite3*","string","**"]],["sqlite3session_diff","int",["sqlite3_session*","string","string","**"]],["sqlite3session_enable","int",["sqlite3_session*","int"]],["sqlite3session_indirect","int",["sqlite3_session*","int"]],["sqlite3session_isempty","int",["sqlite3_session*"]],["sqlite3session_memory_used","i64",["sqlite3_session*"]],["sqlite3session_object_config","int",["sqlite3_session*","int","void*"]],["sqlite3session_patchset","int",["sqlite3_session*","*","**"]],["sqlite3session_patchset_strm","int",["sqlite3_session*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppp)",bindScope:"transient"}),"void*"]],["sqlite3session_table_filter",void 0,["sqlite3_session*",new s.xWrap.FuncPtrAdapter({name:"xFilter",...q,contextKey:(w,x)=>w[0]}),"*"]])}s.bindingSignatures.wasmInternal=[["sqlite3__wasm_db_reset","int","sqlite3*"],["sqlite3__wasm_db_vfs","sqlite3_vfs*","sqlite3*","string"],["sqlite3__wasm_vfs_create_file","int","sqlite3_vfs*","string","*","int"],["sqlite3__wasm_posix_create_file","int","string","*","int"],["sqlite3__wasm_vfs_unlink","int","sqlite3_vfs*","string"],["sqlite3__wasm_qfmt_token","string:dealloc","string","int"]],t.StructBinder=globalThis.Jaccwabyt({heap:s.heap8u,alloc:s.alloc,dealloc:s.dealloc,bigIntEnabled:s.bigIntEnabled,memberPrefix:"$"}),delete globalThis.Jaccwabyt;{const q=s.xWrap.argAdapter("string");s.xWrap.argAdapter("string:flexible",S=>q(o.flexibleString(S))),s.xWrap.argAdapter("string:static",(function(S){return s.isPtr(S)?S:(S=""+S,this[S]||(this[S]=s.allocCString(S)))}).bind(Object.create(null)));const w=s.xWrap.argAdapter("*"),x=function(){};s.xWrap.argAdapter("sqlite3_filename",w)("sqlite3_context*",w)("sqlite3_value*",w)("void*",w)("sqlite3_changegroup*",w)("sqlite3_changeset_iter*",w)("sqlite3_session*",w)("sqlite3_stmt*",S=>w(S instanceof(t?.oo1?.Stmt||x)?S.pointer:S))("sqlite3*",S=>w(S instanceof(t?.oo1?.DB||x)?S.pointer:S))("sqlite3_vfs*",S=>typeof S=="string"?r.sqlite3_vfs_find(S)||t.SQLite3Error.toss(r.SQLITE_NOTFOUND,"Unknown sqlite3_vfs name:",S):w(S instanceof(r.sqlite3_vfs||x)?S.pointer:S)),s.exports.sqlite3_declare_vtab&&s.xWrap.argAdapter("sqlite3_index_info*",S=>w(S instanceof(r.sqlite3_index_info||x)?S.pointer:S))("sqlite3_module*",S=>w(S instanceof(r.sqlite3_module||x)?S.pointer:S));const N=s.xWrap.resultAdapter("*");s.xWrap.resultAdapter("sqlite3*",N)("sqlite3_context*",N)("sqlite3_stmt*",N)("sqlite3_value*",N)("sqlite3_vfs*",N)("void*",N),s.exports.sqlite3_step.length===0&&(s.xWrap.doArgcCheck=!1,t.config.warn("Disabling sqlite3.wasm.xWrap.doArgcCheck due to environmental quirks."));for(const S of s.bindingSignatures)r[S[0]]=s.xWrap.apply(null,S);for(const S of s.bindingSignatures.wasmInternal)o[S[0]]=s.xWrap.apply(null,S);const O=function(S){return()=>n(S+"() is unavailable due to lack","of BigInt support in this build.")};for(const S of s.bindingSignatures.int64)r[S[0]]=s.bigIntEnabled?s.xWrap.apply(null,S):O(S[0]);if(delete s.bindingSignatures,s.exports.sqlite3__wasm_db_error){const S=s.xWrap("sqlite3__wasm_db_error","int","sqlite3*","int","string");o.sqlite3__wasm_db_error=function(L,$,c){return $ instanceof t.WasmAllocError?($=r.SQLITE_NOMEM,c=0):$ instanceof Error&&(c=c||""+$,$=$.resultCode||r.SQLITE_ERROR),L?S(L,$,c):$}}else o.sqlite3__wasm_db_error=function(S,L,$){return console.warn("sqlite3__wasm_db_error() is not exported.",arguments),L}}{const q=s.xCall("sqlite3__wasm_enum_json");q||n("Maintenance required: increase sqlite3__wasm_enum_json()'s","static buffer size!"),s.ctype=JSON.parse(s.cstrToJs(q));const w=["access","authorizer","blobFinalizers","changeset","config","dataTypes","dbConfig","dbStatus","encodings","fcntl","flock","ioCap","limits","openFlags","prepareFlags","resultCodes","sqlite3Status","stmtStatus","syncFlags","trace","txnState","udfFlags","version"];s.bigIntEnabled&&w.push("serialize","session","vtab");for(const O of w)for(const S of Object.entries(s.ctype[O]))r[S[0]]=S[1];s.functionEntry(r.SQLITE_WASM_DEALLOC)||n("Internal error: cannot resolve exported function","entry SQLITE_WASM_DEALLOC (=="+r.SQLITE_WASM_DEALLOC+").");const x=Object.create(null);for(const O of["resultCodes"])for(const S of Object.entries(s.ctype[O]))x[S[1]]=S[0];r.sqlite3_js_rc_str=O=>x[O];const N=Object.assign(Object.create(null),{WasmTestStruct:!0,sqlite3_kvvfs_methods:!o.isUIThread(),sqlite3_index_info:!s.bigIntEnabled,sqlite3_index_constraint:!s.bigIntEnabled,sqlite3_index_orderby:!s.bigIntEnabled,sqlite3_index_constraint_usage:!s.bigIntEnabled});for(const O of s.ctype.structs)N[O.name]||(r[O.name]=t.StructBinder(O));if(r.sqlite3_index_info){for(const O of["sqlite3_index_constraint","sqlite3_index_orderby","sqlite3_index_constraint_usage"])r.sqlite3_index_info[O]=r[O],delete r[O];r.sqlite3_vtab_config=s.xWrap("sqlite3__wasm_vtab_config","int",["sqlite3*","int","int"])}}const p=(q,w,x)=>o.sqlite3__wasm_db_error(q,r.SQLITE_MISUSE,w+"() requires "+x+" argument"+(x===1?"":"s")+"."),g=q=>o.sqlite3__wasm_db_error(q,r.SQLITE_FORMAT,"SQLITE_UTF8 is the only supported encoding."),P=q=>s.xWrap.argAdapter("sqlite3*")(q),R=q=>s.isPtr(q)?s.cstrToJs(q):q,z=(function(q,w){q=P(q);let x=this.dbMap.get(q);if(w)!x&&w>0&&this.dbMap.set(q,x=Object.create(null));else return this.dbMap.delete(q),x;return x}).bind(Object.assign(Object.create(null),{dbMap:new Map}));z.addCollation=function(q,w){const x=z(q,1);x.collation||(x.collation=new Set),x.collation.add(R(w).toLowerCase())},z._addUDF=function(q,w,x,N){w=R(w).toLowerCase();let O=N.get(w);O||N.set(w,O=new Set),O.add(x<0?-1:x)},z.addFunction=function(q,w,x){const N=z(q,1);N.udf||(N.udf=new Map),this._addUDF(q,w,x,N.udf)},s.exports.sqlite3_create_window_function&&(z.addWindowFunc=function(q,w,x){const N=z(q,1);N.wudf||(N.wudf=new Map),this._addUDF(q,w,x,N.wudf)}),z.cleanup=function(q){q=P(q);const w=[q];for(const O of["sqlite3_busy_handler","sqlite3_commit_hook","sqlite3_preupdate_hook","sqlite3_progress_handler","sqlite3_rollback_hook","sqlite3_set_authorizer","sqlite3_trace_v2","sqlite3_update_hook"]){const S=s.exports[O];if(S){w.length=S.length;try{r[O](...w)}catch(L){t.config.warn("close-time call of",O+"(",w,") threw:",L)}}}const x=z(q,0);if(!x)return;if(x.collation){for(const O of x.collation)try{r.sqlite3_create_collation_v2(q,O,r.SQLITE_UTF8,0,0,0)}catch{}delete x.collation}let N;for(N=0;N<2;++N){const O=N?x.wudf:x.udf;if(!O)continue;const S=N?r.sqlite3_create_window_function:r.sqlite3_create_function_v2;for(const L of O){const $=L[0],c=L[1],d=[q,$,0,r.SQLITE_UTF8,0,0,0,0,0];N&&d.push(0);for(const y of c)try{d[2]=y,S.apply(null,d)}catch{}c.clear()}O.clear()}delete x.udf,delete x.wudf};{const q=s.xWrap("sqlite3_close_v2","int","sqlite3*");r.sqlite3_close_v2=function(w){if(arguments.length!==1)return p(w,"sqlite3_close_v2",1);if(w)try{z.cleanup(w)}catch{}return q(w)}}if(r.sqlite3session_create){const q=s.xWrap("sqlite3session_delete",void 0,["sqlite3_session*"]);r.sqlite3session_delete=function(w){if(arguments.length!==1)return p(pDb,"sqlite3session_delete",1);w&&r.sqlite3session_table_filter(w,0,0),q(w)}}{const q=(x,N)=>"argv["+N+"]:"+x[0]+":"+s.cstrToJs(x[1]).toLowerCase(),w=s.xWrap("sqlite3_create_collation_v2","int",["sqlite3*","string","int","*",new s.xWrap.FuncPtrAdapter({name:"xCompare",signature:"i(pipip)",contextKey:q}),new s.xWrap.FuncPtrAdapter({name:"xDestroy",signature:"v(p)",contextKey:q})]);r.sqlite3_create_collation_v2=function(x,N,O,S,L,$){if(arguments.length!==6)return p(x,"sqlite3_create_collation_v2",6);if((O&15)===0)O|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(O&15))return g(x);try{const c=w(x,N,O,S,L,$);return c===0&&L instanceof Function&&z.addCollation(x,N),c}catch(c){return o.sqlite3__wasm_db_error(x,c)}},r.sqlite3_create_collation=(x,N,O,S,L)=>arguments.length===5?r.sqlite3_create_collation_v2(x,N,O,S,L,0):p(x,"sqlite3_create_collation",5)}{const q=function(O,S){return O[0]+":"+(O[2]<0?-1:O[2])+":"+S+":"+s.cstrToJs(O[1]).toLowerCase()},w=Object.assign(Object.create(null),{xInverseAndStep:{signature:"v(pip)",contextKey:q,callProxy:O=>(S,L,$)=>{try{O(S,...r.sqlite3_values_to_js(L,$))}catch(c){r.sqlite3_result_error_js(S,c)}}},xFinalAndValue:{signature:"v(p)",contextKey:q,callProxy:O=>S=>{try{r.sqlite3_result_js(S,O(S))}catch(L){r.sqlite3_result_error_js(S,L)}}},xFunc:{signature:"v(pip)",contextKey:q,callProxy:O=>(S,L,$)=>{try{r.sqlite3_result_js(S,O(S,...r.sqlite3_values_to_js(L,$)))}catch(c){r.sqlite3_result_error_js(S,c)}}},xDestroy:{signature:"v(p)",contextKey:q,callProxy:O=>S=>{try{O(S)}catch(L){console.error("UDF xDestroy method threw:",L)}}}}),x=s.xWrap("sqlite3_create_function_v2","int",["sqlite3*","string","int","int","*",new s.xWrap.FuncPtrAdapter({name:"xFunc",...w.xFunc}),new s.xWrap.FuncPtrAdapter({name:"xStep",...w.xInverseAndStep}),new s.xWrap.FuncPtrAdapter({name:"xFinal",...w.xFinalAndValue}),new s.xWrap.FuncPtrAdapter({name:"xDestroy",...w.xDestroy})]),N=s.exports.sqlite3_create_window_function?s.xWrap("sqlite3_create_window_function","int",["sqlite3*","string","int","int","*",new s.xWrap.FuncPtrAdapter({name:"xStep",...w.xInverseAndStep}),new s.xWrap.FuncPtrAdapter({name:"xFinal",...w.xFinalAndValue}),new s.xWrap.FuncPtrAdapter({name:"xValue",...w.xFinalAndValue}),new s.xWrap.FuncPtrAdapter({name:"xInverse",...w.xInverseAndStep}),new s.xWrap.FuncPtrAdapter({name:"xDestroy",...w.xDestroy})]):void 0;r.sqlite3_create_function_v2=function O(S,L,$,c,d,y,B,f,h){if(O.length!==arguments.length)return p(S,"sqlite3_create_function_v2",O.length);if((c&15)===0)c|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(c&15))return g(S);try{const l=x(S,L,$,c,d,y,B,f,h);return l===0&&(y instanceof Function||B instanceof Function||f instanceof Function||h instanceof Function)&&z.addFunction(S,L,$),l}catch(l){return console.error("sqlite3_create_function_v2() setup threw:",l),o.sqlite3__wasm_db_error(S,l,"Creation of UDF threw: "+l)}},r.sqlite3_create_function=function O(S,L,$,c,d,y,B,f){return O.length===arguments.length?r.sqlite3_create_function_v2(S,L,$,c,d,y,B,f,0):p(S,"sqlite3_create_function",O.length)},N?r.sqlite3_create_window_function=function O(S,L,$,c,d,y,B,f,h,l){if(O.length!==arguments.length)return p(S,"sqlite3_create_window_function",O.length);if((c&15)===0)c|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(c&15))return g(S);try{const _=N(S,L,$,c,d,y,B,f,h,l);return _===0&&(y instanceof Function||B instanceof Function||f instanceof Function||h instanceof Function||l instanceof Function)&&z.addWindowFunc(S,L,$),_}catch(_){return console.error("sqlite3_create_window_function() setup threw:",_),o.sqlite3__wasm_db_error(S,_,"Creation of UDF threw: "+_)}}:delete r.sqlite3_create_window_function,r.sqlite3_create_function_v2.udfSetResult=r.sqlite3_create_function.udfSetResult=r.sqlite3_result_js,r.sqlite3_create_window_function&&(r.sqlite3_create_window_function.udfSetResult=r.sqlite3_result_js),r.sqlite3_create_function_v2.udfConvertArgs=r.sqlite3_create_function.udfConvertArgs=r.sqlite3_values_to_js,r.sqlite3_create_window_function&&(r.sqlite3_create_window_function.udfConvertArgs=r.sqlite3_values_to_js),r.sqlite3_create_function_v2.udfSetError=r.sqlite3_create_function.udfSetError=r.sqlite3_result_error_js,r.sqlite3_create_window_function&&(r.sqlite3_create_window_function.udfSetError=r.sqlite3_result_error_js)}{const q=(x,N)=>(typeof x=="string"?N=-1:o.isSQLableTypedArray(x)?(N=x.byteLength,x=o.typedArrayToString(x instanceof ArrayBuffer?new Uint8Array(x):x)):Array.isArray(x)&&(x=x.join(""),N=-1),[x,N]),w={basic:s.xWrap("sqlite3_prepare_v3","int",["sqlite3*","string","int","int","**","**"]),full:s.xWrap("sqlite3_prepare_v3","int",["sqlite3*","*","int","int","**","**"])};r.sqlite3_prepare_v3=function x(N,O,S,L,$,c){if(x.length!==arguments.length)return p(N,"sqlite3_prepare_v3",x.length);const[d,y]=q(O,S);switch(typeof d){case"string":return w.basic(N,d,y,L,$,null);case"number":return w.full(N,d,y,L,$,c);default:return o.sqlite3__wasm_db_error(N,r.SQLITE_MISUSE,"Invalid SQL argument type for sqlite3_prepare_v2/v3().")}},r.sqlite3_prepare_v2=function x(N,O,S,L,$){return x.length===arguments.length?r.sqlite3_prepare_v3(N,O,S,0,L,$):p(N,"sqlite3_prepare_v2",x.length)}}{const q=s.xWrap("sqlite3_bind_text","int",["sqlite3_stmt*","int","string","int","*"]),w=s.xWrap("sqlite3_bind_blob","int",["sqlite3_stmt*","int","*","int","*"]);r.sqlite3_bind_text=function x(N,O,S,L,$){if(x.length!==arguments.length)return p(r.sqlite3_db_handle(N),"sqlite3_bind_text",x.length);if(s.isPtr(S)||S===null)return q(N,O,S,L,$);S instanceof ArrayBuffer?S=new Uint8Array(S):Array.isArray(pMem)&&(S=pMem.join(""));let c,d;try{if(o.isSQLableTypedArray(S))c=s.allocFromTypedArray(S),d=S.byteLength;else if(typeof S=="string")[c,d]=s.allocCString(S);else return o.sqlite3__wasm_db_error(r.sqlite3_db_handle(N),r.SQLITE_MISUSE,"Invalid 3rd argument type for sqlite3_bind_text().");return q(N,O,c,d,r.SQLITE_WASM_DEALLOC)}catch(y){return s.dealloc(c),o.sqlite3__wasm_db_error(r.sqlite3_db_handle(N),y)}},r.sqlite3_bind_blob=function x(N,O,S,L,$){if(x.length!==arguments.length)return p(r.sqlite3_db_handle(N),"sqlite3_bind_blob",x.length);if(s.isPtr(S)||S===null)return w(N,O,S,L,$);S instanceof ArrayBuffer?S=new Uint8Array(S):Array.isArray(S)&&(S=S.join(""));let c,d;try{if(o.isBindableTypedArray(S))c=s.allocFromTypedArray(S),d=L>=0?L:S.byteLength;else if(typeof S=="string")[c,d]=s.allocCString(S);else return o.sqlite3__wasm_db_error(r.sqlite3_db_handle(N),r.SQLITE_MISUSE,"Invalid 3rd argument type for sqlite3_bind_blob().");return w(N,O,c,d,r.SQLITE_WASM_DEALLOC)}catch(y){return s.dealloc(c),o.sqlite3__wasm_db_error(r.sqlite3_db_handle(N),y)}}}r.sqlite3_config=function(q,...w){if(arguments.length<2)return r.SQLITE_MISUSE;switch(q){case r.SQLITE_CONFIG_COVERING_INDEX_SCAN:case r.SQLITE_CONFIG_MEMSTATUS:case r.SQLITE_CONFIG_SMALL_MALLOC:case r.SQLITE_CONFIG_SORTERREF_SIZE:case r.SQLITE_CONFIG_STMTJRNL_SPILL:case r.SQLITE_CONFIG_URI:return s.exports.sqlite3__wasm_config_i(q,w[0]);case r.SQLITE_CONFIG_LOOKASIDE:return s.exports.sqlite3__wasm_config_ii(q,w[0],w[1]);case r.SQLITE_CONFIG_MEMDB_MAXSIZE:return s.exports.sqlite3__wasm_config_j(q,w[0]);case r.SQLITE_CONFIG_GETMALLOC:case r.SQLITE_CONFIG_GETMUTEX:case r.SQLITE_CONFIG_GETPCACHE2:case r.SQLITE_CONFIG_GETPCACHE:case r.SQLITE_CONFIG_HEAP:case r.SQLITE_CONFIG_LOG:case r.SQLITE_CONFIG_MALLOC:case r.SQLITE_CONFIG_MMAP_SIZE:case r.SQLITE_CONFIG_MULTITHREAD:case r.SQLITE_CONFIG_MUTEX:case r.SQLITE_CONFIG_PAGECACHE:case r.SQLITE_CONFIG_PCACHE2:case r.SQLITE_CONFIG_PCACHE:case r.SQLITE_CONFIG_PCACHE_HDRSZ:case r.SQLITE_CONFIG_PMASZ:case r.SQLITE_CONFIG_SERIALIZED:case r.SQLITE_CONFIG_SINGLETHREAD:case r.SQLITE_CONFIG_SQLLOG:case r.SQLITE_CONFIG_WIN32_HEAPSIZE:default:return r.SQLITE_NOTFOUND}};{const q=new Set;r.sqlite3_auto_extension=function(w){if(w instanceof Function)w=s.installFunction("i(ppp)",w);else if(arguments.length!==1||!s.isPtr(w))return r.SQLITE_MISUSE;const x=s.exports.sqlite3_auto_extension(w);return w!==arguments[0]&&(x===0?q.add(w):s.uninstallFunction(w)),x},r.sqlite3_cancel_auto_extension=function(w){return!w||arguments.length!==1||!s.isPtr(w)?0:s.exports.sqlite3_cancel_auto_extension(w)},r.sqlite3_reset_auto_extension=function(){s.exports.sqlite3_reset_auto_extension();for(const w of q)s.uninstallFunction(w);q.clear()}}const Q=r.sqlite3_vfs_find("kvvfs");if(Q)if(o.isUIThread()){const q=new r.sqlite3_kvvfs_methods(s.exports.sqlite3__wasm_kvvfs_methods());delete r.sqlite3_kvvfs_methods;const w=s.exports.sqlite3__wasm_kvvfsMakeKeyOnPstack,x=s.pstack,N=S=>s.peek(S)===115?sessionStorage:localStorage,O={xRead:(S,L,$,c)=>{const d=x.pointer,y=s.scopedAllocPush();try{const B=w(S,L);if(!B)return-3;const f=s.cstrToJs(B),h=N(S).getItem(f);if(!h)return-1;const l=h.length;if(c<=0)return l;if(c===1)return s.poke($,0),l;const _=s.scopedAllocCString(h);return c>l+1&&(c=l+1),s.heap8u().copyWithin($,_,_+c-1),s.poke($+c-1,0),c-1}catch(B){return console.error("kvstorageRead()",B),-2}finally{x.restore(d),s.scopedAllocPop(y)}},xWrite:(S,L,$)=>{const c=x.pointer;try{const d=w(S,L);if(!d)return 1;const y=s.cstrToJs(d);return N(S).setItem(y,s.cstrToJs($)),0}catch(d){return console.error("kvstorageWrite()",d),r.SQLITE_IOERR}finally{x.restore(c)}},xDelete:(S,L)=>{const $=x.pointer;try{const c=w(S,L);return c?(N(S).removeItem(s.cstrToJs(c)),0):1}catch(c){return console.error("kvstorageDelete()",c),r.SQLITE_IOERR}finally{x.restore($)}}};for(const S of Object.keys(O))q[q.memberKey(S)]=s.installFunction(q.memberSignature(S),O[S])}else r.sqlite3_vfs_unregister(Q);s.xWrap.FuncPtrAdapter.warnOnUse=!0;const T=t.StructBinder,A=function q(w,x,N,O=q.installMethodArgcCheck){if(w instanceof T.StructType?!(N instanceof Function)&&!s.isPtr(N)&&n("Usage error: expecting a Function or WASM pointer to one."):n("Usage error: target object is-not-a StructType."),arguments.length===1)return(c,d)=>q(w,c,d,O);q.argcProxy||(q.argcProxy=function(c,d,y,B){return function(...f){return y.length!==arguments.length&&n("Argument mismatch for",c.structInfo.name+"::"+d+": Native signature is:",B),y.apply(this,f)}},q.removeFuncList=function(){this.ondispose.__removeFuncList&&(this.ondispose.__removeFuncList.forEach((c,d)=>{if(typeof c=="number")try{s.uninstallFunction(c)}catch{}}),delete this.ondispose.__removeFuncList)});const S=w.memberSignature(x);S.length<2&&n("Member",x,"does not have a function pointer signature:",S);const L=w.memberKey(x),$=O&&!s.isPtr(N)?q.argcProxy(w,L,N,S):N;if(s.isPtr($))$&&!s.functionEntry($)&&n("Pointer",$,"is not a WASM function table entry."),w[L]=$;else{const c=s.installFunction($,w.memberSignature(x,!0));w[L]=c,(!w.ondispose||!w.ondispose.__removeFuncList)&&(w.addOnDispose("ondispose.__removeFuncList handler",q.removeFuncList),w.ondispose.__removeFuncList=[]),w.ondispose.__removeFuncList.push(L,c)}return(c,d)=>q(w,c,d,O)};A.installMethodArgcCheck=!1;const D=function(q,w,x=A.installMethodArgcCheck){const N=new Map;for(const O of Object.keys(w)){const S=w[O],L=N.get(S);if(L){const $=q.memberKey(O);q[$]=q[q.memberKey(L)]}else A(q,O,S,x),N.set(S,O)}return q};T.StructType.prototype.installMethod=function(w,x,N=A.installMethodArgcCheck){return arguments.length<3&&w&&typeof w=="object"?D(this,...arguments):A(this,...arguments)},T.StructType.prototype.installMethods=function(q,w=A.installMethodArgcCheck){return D(this,q,w)}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){t.version={libVersion:"3.50.4",libVersionNumber:3050004,sourceId:"2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3",downloadVersion:3500400}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=(...f)=>{throw new t.SQLite3Error(...f)},r=t.capi,s=t.wasm,o=t.util,p=new WeakMap,g=new WeakMap,P=(f,h,l)=>{const _=Object.getOwnPropertyDescriptor(f,h);return _?_.value:l},R=function(f,h){return h&&(f instanceof A&&(f=f.pointer),n(h,"sqlite3 result code",h+":",f?r.sqlite3_errmsg(f):r.sqlite3_errstr(h))),arguments[0]},z=s.installFunction("i(ippp)",(function(f,h,l,_){r.SQLITE_TRACE_STMT===f&&console.log("SQL TRACE #"+ ++this.counter+" via sqlite3@"+h+":",s.cstrToJs(_))}).bind({counter:0})),Q=Object.create(null),T=function f(...h){if(!f._name2vfs){f._name2vfs=Object.create(null);const j=typeof importScripts=="function"?b=>n("The VFS for",b,"is only available in the main window thread."):!1;f._name2vfs[":localStorage:"]={vfs:"kvvfs",filename:j||(()=>"local")},f._name2vfs[":sessionStorage:"]={vfs:"kvvfs",filename:j||(()=>"session")}}const l=f.normalizeArgs(...h);let _=l.filename,u=l.vfs,I=l.flags;(typeof _!="string"&&typeof _!="number"||typeof I!="string"||u&&typeof u!="string"&&typeof u!="number")&&(t.config.error("Invalid DB ctor args",l,arguments),n("Invalid arguments for DB constructor."));let U=typeof _=="number"?s.cstrToJs(_):_;const ee=f._name2vfs[U];ee&&(u=ee.vfs,_=U=ee.filename(U));let ne,se=0;I.indexOf("c")>=0&&(se|=r.SQLITE_OPEN_CREATE|r.SQLITE_OPEN_READWRITE),I.indexOf("w")>=0&&(se|=r.SQLITE_OPEN_READWRITE),se===0&&(se|=r.SQLITE_OPEN_READONLY),se|=r.SQLITE_OPEN_EXRESCODE;const ie=s.pstack.pointer;try{const j=s.pstack.allocPtr();let b=r.sqlite3_open_v2(_,j,se,u||0);ne=s.peekPtr(j),R(ne,b),r.sqlite3_extended_result_codes(ne,1),I.indexOf("t")>=0&&r.sqlite3_trace_v2(ne,r.SQLITE_TRACE_STMT,z,ne)}catch(j){throw ne&&r.sqlite3_close_v2(ne),j}finally{s.pstack.restore(ie)}this.filename=U,p.set(this,ne),g.set(this,Object.create(null));try{const j=r.sqlite3_js_db_vfs(ne)||n("Internal error: cannot get VFS for new db handle."),b=Q[j];b&&(b instanceof Function?b(this,t):R(ne,r.sqlite3_exec(ne,b,0,0,0)))}catch(j){throw this.close(),j}};T.setVfsPostOpenCallback=function(f,h){h instanceof Function||n("dbCtorHelper.setVfsPostOpenCallback() should not be used with a non-function argument.",arguments),Q[f]=h},T.normalizeArgs=function(f=":memory:",h="c",l=null){const _={};return arguments.length===1&&arguments[0]&&typeof arguments[0]=="object"?(Object.assign(_,arguments[0]),_.flags===void 0&&(_.flags="c"),_.vfs===void 0&&(_.vfs=null),_.filename===void 0&&(_.filename=":memory:")):(_.filename=f,_.flags=h,_.vfs=l),_};const A=function(...f){T.apply(this,f)};A.dbCtorHelper=T;const D={null:1,number:2,string:3,boolean:4,blob:5};D.undefined==D.null,s.bigIntEnabled&&(D.bigint=D.number);const q=function(){D!==arguments[2]&&n(r.SQLITE_MISUSE,"Do not call the Stmt constructor directly. Use DB.prepare()."),this.db=arguments[0],p.set(this,arguments[1]),this.parameterCount=r.sqlite3_bind_parameter_count(this.pointer)},w=function(f){return f.pointer||n("DB has been closed."),f},x=function(f,h){return(h!==(h|0)||h<0||h>=f.columnCount)&&n("Column index",h,"is out of range."),f},N=function(f,h){const l=Object.create(null);switch(l.opt=Object.create(null),h.length){case 1:typeof h[0]=="string"||o.isSQLableTypedArray(h[0])||Array.isArray(h[0])?l.sql=h[0]:h[0]&&typeof h[0]=="object"&&(l.opt=h[0],l.sql=l.opt.sql);break;case 2:l.sql=h[0],l.opt=h[1];break;default:n("Invalid argument count for exec().")}l.sql=o.flexibleString(l.sql),typeof l.sql!="string"&&n("Missing SQL argument or unsupported SQL value type.");const _=l.opt;switch(_.returnValue){case"resultRows":_.resultRows||(_.resultRows=[]),l.returnVal=()=>_.resultRows;break;case"saveSql":_.saveSql||(_.saveSql=[]),l.returnVal=()=>_.saveSql;break;case void 0:case"this":l.returnVal=()=>f;break;default:n("Invalid returnValue value:",_.returnValue)}if(!_.callback&&!_.returnValue&&_.rowMode!==void 0&&(_.resultRows||(_.resultRows=[]),l.returnVal=()=>_.resultRows),_.callback||_.resultRows)switch(_.rowMode===void 0?"array":_.rowMode){case"object":l.cbArg=(u,I)=>{I.columnNames||(I.columnNames=u.getColumnNames([]));const U=u.get([]),ee=Object.create(null);for(const ne in I.columnNames)ee[I.columnNames[ne]]=U[ne];return ee};break;case"array":l.cbArg=u=>u.get([]);break;case"stmt":Array.isArray(_.resultRows)&&n("exec(): invalid rowMode for a resultRows array: must","be one of 'array', 'object',","a result column number, or column name reference."),l.cbArg=u=>u;break;default:if(o.isInt32(_.rowMode)){l.cbArg=u=>u.get(_.rowMode);break}else if(typeof _.rowMode=="string"&&_.rowMode.length>1&&_.rowMode[0]==="$"){const u=_.rowMode.substr(1);l.cbArg=I=>{const U=I.get(Object.create(null))[u];return U===void 0?n(r.SQLITE_NOTFOUND,"exec(): unknown result column:",u):U};break}n("Invalid rowMode:",_.rowMode)}return l},O=(f,h,l,..._)=>{const u=f.prepare(h);try{const I=u.bind(l).step()?u.get(..._):void 0;return u.reset(),I}finally{u.finalize()}},S=(f,h,l,_)=>f.exec({sql:h,bind:l,rowMode:_,returnValue:"resultRows"});A.checkRc=(f,h)=>R(f,h),A.prototype={isOpen:function(){return!!this.pointer},affirmOpen:function(){return w(this)},close:function(){if(this.pointer){if(this.onclose&&this.onclose.before instanceof Function)try{this.onclose.before(this)}catch{}const f=this.pointer;if(Object.keys(g.get(this)).forEach((h,l)=>{if(l&&l.pointer)try{l.finalize()}catch{}}),p.delete(this),g.delete(this),r.sqlite3_close_v2(f),this.onclose&&this.onclose.after instanceof Function)try{this.onclose.after(this)}catch{}delete this.filename}},changes:function(f=!1,h=!1){const l=w(this).pointer;return f?h?r.sqlite3_total_changes64(l):r.sqlite3_total_changes(l):h?r.sqlite3_changes64(l):r.sqlite3_changes(l)},dbFilename:function(f="main"){return r.sqlite3_db_filename(w(this).pointer,f)},dbName:function(f=0){return r.sqlite3_db_name(w(this).pointer,f)},dbVfsName:function(f=0){let h;const l=r.sqlite3_js_db_vfs(w(this).pointer,f);if(l){const _=new r.sqlite3_vfs(l);try{h=s.cstrToJs(_.$zName)}finally{_.dispose()}}return h},prepare:function(f){w(this);const h=s.pstack.pointer;let l,_;try{l=s.pstack.alloc(8),A.checkRc(this,r.sqlite3_prepare_v2(this.pointer,f,-1,l,null)),_=s.peekPtr(l)}finally{s.pstack.restore(h)}_||n("Cannot prepare empty SQL.");const u=new q(this,_,D);return g.get(this)[_]=u,u},exec:function(){w(this);const f=N(this,arguments);if(!f.sql)return n("exec() requires an SQL string.");const h=f.opt,l=h.callback,_=Array.isArray(h.resultRows)?h.resultRows:void 0;let u,I=h.bind,U=!!(f.cbArg||h.columnNames||_);const ee=s.scopedAllocPush(),ne=Array.isArray(h.saveSql)?h.saveSql:void 0;try{const se=o.isSQLableTypedArray(f.sql);let ie=se?f.sql.byteLength:s.jstrlen(f.sql);const j=s.scopedAlloc(2*s.ptrSizeof+(ie+1)),b=j+s.ptrSizeof;let k=b+s.ptrSizeof;const W=k+ie;for(se?s.heap8().set(f.sql,k):s.jstrcpy(f.sql,s.heap8(),k,ie,!1),s.poke(k+ie,0);k&&s.peek(k,"i8");){s.pokePtr([j,b],0),A.checkRc(this,r.sqlite3_prepare_v3(this.pointer,k,ie,0,j,b));const H=s.peekPtr(j);if(k=s.peekPtr(b),ie=W-k,!!H){if(ne&&ne.push(r.sqlite3_sql(H).trim()),u=new q(this,H,D),I&&u.parameterCount&&(u.bind(I),I=null),U&&u.columnCount){let Z=Array.isArray(h.columnNames)?0:1;if(U=!1,f.cbArg||_){const E=Object.create(null);for(;u.step();u._lockedByExec=!1){Z++===0&&u.getColumnNames(E.columnNames=h.columnNames||[]),u._lockedByExec=!0;const C=f.cbArg(u,E);if(_&&_.push(C),l&&l.call(h,C,u)===!1)break}u._lockedByExec=!1}Z===0&&u.getColumnNames(h.columnNames)}else u.step();u.reset().finalize(),u=null}}}finally{s.scopedAllocPop(ee),u&&(delete u._lockedByExec,u.finalize())}return f.returnVal()},createFunction:function(h,l,_){const u=E=>E instanceof Function;switch(arguments.length){case 1:_=h,h=_.name,l=_.xFunc||0;break;case 2:u(l)||(_=l,l=_.xFunc||0);break}_||(_={}),typeof h!="string"&&n("Invalid arguments: missing function name.");let I=_.xStep||0,U=_.xFinal||0;const ee=_.xValue||0,ne=_.xInverse||0;let se;u(l)?(se=!1,(u(I)||u(U))&&n("Ambiguous arguments: scalar or aggregate?"),I=U=null):u(I)?(u(U)||n("Missing xFinal() callback for aggregate or window UDF."),l=null):u(U)?n("Missing xStep() callback for aggregate or window UDF."):n("Missing function-type properties."),se===!1?(u(ee)||u(ne))&&n("xValue and xInverse are not permitted for non-window UDFs."):u(ee)?(u(ne)||n("xInverse must be provided if xValue is."),se=!0):u(ne)&&n("xValue must be provided if xInverse is.");const ie=_.pApp;ie!=null&&(typeof ie!="number"||!o.isInt32(ie))&&n("Invalid value for pApp property. Must be a legal WASM pointer value.");const j=_.xDestroy||0;j&&!u(j)&&n("xDestroy property must be a function.");let b=0;P(_,"deterministic")&&(b|=r.SQLITE_DETERMINISTIC),P(_,"directOnly")&&(b|=r.SQLITE_DIRECTONLY),P(_,"innocuous")&&(b|=r.SQLITE_INNOCUOUS),h=h.toLowerCase();const k=l||I,W=P(_,"arity"),H=typeof W=="number"?W:k.length?k.length-1:0;let Z;return se?Z=r.sqlite3_create_window_function(this.pointer,h,H,r.SQLITE_UTF8|b,ie||0,I,U,ee,ne,j):Z=r.sqlite3_create_function_v2(this.pointer,h,H,r.SQLITE_UTF8|b,ie||0,l,I,U,j),A.checkRc(this,Z),this},selectValue:function(f,h,l){return O(this,f,h,0,l)},selectValues:function(f,h,l){const _=this.prepare(f),u=[];try{for(_.bind(h);_.step();)u.push(_.get(0,l));_.reset()}finally{_.finalize()}return u},selectArray:function(f,h){return O(this,f,h,[])},selectObject:function(f,h){return O(this,f,h,{})},selectArrays:function(f,h){return S(this,f,h,"array")},selectObjects:function(f,h){return S(this,f,h,"object")},openStatementCount:function(){return this.pointer?Object.keys(g.get(this)).length:0},transaction:function(f){let h="BEGIN";arguments.length>1&&(/[^a-zA-Z]/.test(arguments[0])&&n(r.SQLITE_MISUSE,"Invalid argument for BEGIN qualifier."),h+=" "+arguments[0],f=arguments[1]),w(this).exec(h);try{const l=f(this);return this.exec("COMMIT"),l}catch(l){throw this.exec("ROLLBACK"),l}},savepoint:function(f){w(this).exec("SAVEPOINT oo1");try{const h=f(this);return this.exec("RELEASE oo1"),h}catch(h){throw this.exec("ROLLBACK to SAVEPOINT oo1; RELEASE SAVEPOINT oo1"),h}},checkRc:function(f){return R(this,f)}};const L=function(f){return f.pointer||n("Stmt has been closed."),f},$=function(f){let h=D[f==null?"null":typeof f];switch(h){case D.boolean:case D.null:case D.number:case D.string:return h;case D.bigint:if(s.bigIntEnabled)return h;default:return o.isBindableTypedArray(f)?D.blob:void 0}},c=function(f){return $(f)||n("Unsupported bind() argument type:",typeof f)},d=function(f,h){const l=typeof h=="number"?h:r.sqlite3_bind_parameter_index(f.pointer,h);return l===0||!o.isInt32(l)?n("Invalid bind() parameter name: "+h):(l<1||l>f.parameterCount)&&n("Bind index",h,"is out of range."),l},y=function(f,h){return f._lockedByExec&&n("Operation is illegal when statement is locked:",h),f},B=function f(h,l,_,u){y(L(h),"bind()"),f._||(f._tooBigInt=U=>n("BigInt value is too big to store without precision loss:",U),f._={string:function(U,ee,ne,se){const[ie,j]=s.allocCString(ne,!0);return(se?r.sqlite3_bind_blob:r.sqlite3_bind_text)(U.pointer,ee,ie,j,r.SQLITE_WASM_DEALLOC)}}),c(u),l=d(h,l);let I=0;switch(u==null?D.null:_){case D.null:I=r.sqlite3_bind_null(h.pointer,l);break;case D.string:I=f._.string(h,l,u,!1);break;case D.number:{let U;o.isInt32(u)?U=r.sqlite3_bind_int:typeof u=="bigint"?o.bigIntFits64(u)?s.bigIntEnabled?U=r.sqlite3_bind_int64:o.bigIntFitsDouble(u)?(u=Number(u),U=r.sqlite3_bind_double):f._tooBigInt(u):f._tooBigInt(u):(u=Number(u),s.bigIntEnabled&&Number.isInteger(u)?U=r.sqlite3_bind_int64:U=r.sqlite3_bind_double),I=U(h.pointer,l,u);break}case D.boolean:I=r.sqlite3_bind_int(h.pointer,l,u?1:0);break;case D.blob:{if(typeof u=="string"){I=f._.string(h,l,u,!0);break}else u instanceof ArrayBuffer?u=new Uint8Array(u):o.isBindableTypedArray(u)||n("Binding a value as a blob requires","that it be a string, Uint8Array, Int8Array, or ArrayBuffer.");const U=s.alloc(u.byteLength||1);s.heap8().set(u.byteLength?u:[0],U),I=r.sqlite3_bind_blob(h.pointer,l,U,u.byteLength,r.SQLITE_WASM_DEALLOC);break}default:t.config.warn("Unsupported bind() argument type:",u),n("Unsupported bind() argument type: "+typeof u)}return I&&A.checkRc(h.db.pointer,I),h._mayGet=!1,h};q.prototype={finalize:function(){if(this.pointer){y(this,"finalize()");const f=r.sqlite3_finalize(this.pointer);return delete g.get(this.db)[this.pointer],p.delete(this),delete this._mayGet,delete this.parameterCount,delete this._lockedByExec,delete this.db,f}},clearBindings:function(){return y(L(this),"clearBindings()"),r.sqlite3_clear_bindings(this.pointer),this._mayGet=!1,this},reset:function(f){y(this,"reset()"),f&&this.clearBindings();const h=r.sqlite3_reset(L(this).pointer);return this._mayGet=!1,R(this.db,h),this},bind:function(){L(this);let f,h;switch(arguments.length){case 1:f=1,h=arguments[0];break;case 2:f=arguments[0],h=arguments[1];break;default:n("Invalid bind() arguments.")}return h===void 0?this:(this.parameterCount||n("This statement has no bindable parameters."),this._mayGet=!1,h===null?B(this,f,D.null,h):Array.isArray(h)?(arguments.length!==1&&n("When binding an array, an index argument is not permitted."),h.forEach((l,_)=>B(this,_+1,c(l),l)),this):(h instanceof ArrayBuffer&&(h=new Uint8Array(h)),typeof h=="object"&&!o.isBindableTypedArray(h)?(arguments.length!==1&&n("When binding an object, an index argument is not permitted."),Object.keys(h).forEach(l=>B(this,l,c(h[l]),h[l])),this):B(this,f,c(h),h)))},bindAsBlob:function(f,h){L(this),arguments.length===1&&(h=f,f=1);const l=c(h);return D.string!==l&&D.blob!==l&&D.null!==l&&n("Invalid value type for bindAsBlob()"),B(this,f,D.blob,h)},step:function(){y(this,"step()");const f=r.sqlite3_step(L(this).pointer);switch(f){case r.SQLITE_DONE:return this._mayGet=!1;case r.SQLITE_ROW:return this._mayGet=!0;default:this._mayGet=!1,t.config.warn("sqlite3_step() rc=",f,r.sqlite3_js_rc_str(f),"SQL =",r.sqlite3_sql(this.pointer)),A.checkRc(this.db.pointer,f)}},stepReset:function(){return this.step(),this.reset()},stepFinalize:function(){try{const f=this.step();return this.reset(),f}finally{try{this.finalize()}catch{}}},get:function(f,h){if(L(this)._mayGet||n("Stmt.step() has not (recently) returned true."),Array.isArray(f)){let l=0;const _=this.columnCount;for(;l<_;)f[l]=this.get(l++);return f}else if(f&&typeof f=="object"){let l=0;const _=this.columnCount;for(;l<_;)f[r.sqlite3_column_name(this.pointer,l)]=this.get(l++);return f}switch(x(this,f),h===void 0?r.sqlite3_column_type(this.pointer,f):h){case r.SQLITE_NULL:return null;case r.SQLITE_INTEGER:if(s.bigIntEnabled){const l=r.sqlite3_column_int64(this.pointer,f);return l>=Number.MIN_SAFE_INTEGER&&l<=Number.MAX_SAFE_INTEGER?Number(l).valueOf():l}else{const l=r.sqlite3_column_double(this.pointer,f);return(l>Number.MAX_SAFE_INTEGER||l<Number.MIN_SAFE_INTEGER)&&n("Integer is out of range for JS integer range: "+l),o.isInt32(l)?l|0:l}case r.SQLITE_FLOAT:return r.sqlite3_column_double(this.pointer,f);case r.SQLITE_TEXT:return r.sqlite3_column_text(this.pointer,f);case r.SQLITE_BLOB:{const l=r.sqlite3_column_bytes(this.pointer,f),_=r.sqlite3_column_blob(this.pointer,f),u=new Uint8Array(l);return l&&u.set(s.heap8u().slice(_,_+l),0),l&&this.db._blobXfer instanceof Array&&this.db._blobXfer.push(u.buffer),u}default:n("Don't know how to translate","type of result column #"+f+".")}n("Not reached.")},getInt:function(f){return this.get(f,r.SQLITE_INTEGER)},getFloat:function(f){return this.get(f,r.SQLITE_FLOAT)},getString:function(f){return this.get(f,r.SQLITE_TEXT)},getBlob:function(f){return this.get(f,r.SQLITE_BLOB)},getJSON:function(f){const h=this.get(f,r.SQLITE_STRING);return h===null?h:JSON.parse(h)},getColumnName:function(f){return r.sqlite3_column_name(x(L(this),f).pointer,f)},getColumnNames:function(f=[]){x(L(this),0);const h=this.columnCount;for(let l=0;l<h;++l)f.push(r.sqlite3_column_name(this.pointer,l));return f},getParamIndex:function(f){return L(this).parameterCount?r.sqlite3_bind_parameter_index(this.pointer,f):void 0},getParamName:function(f){return L(this).parameterCount?r.sqlite3_bind_parameter_name(this.pointer,f):void 0},isBusy:function(){return r.sqlite3_stmt_busy(L(this))!==0},isReadOnly:function(){return r.sqlite3_stmt_readonly(L(this))!==0}};{const f={enumerable:!0,get:function(){return p.get(this)},set:()=>n("The pointer property is read-only.")};Object.defineProperty(q.prototype,"pointer",f),Object.defineProperty(A.prototype,"pointer",f)}if(Object.defineProperty(q.prototype,"columnCount",{enumerable:!1,get:function(){return r.sqlite3_column_count(this.pointer)},set:()=>n("The columnCount property is read-only.")}),t.oo1={DB:A,Stmt:q},o.isUIThread()){t.oo1.JsStorageDb=function(h="session"){const l=T.normalizeArgs(...arguments);h=l.filename,h!=="session"&&h!=="local"&&n("JsStorageDb db name must be one of 'session' or 'local'."),l.vfs="kvvfs",T.call(this,l)};const f=t.oo1.JsStorageDb;f.prototype=Object.create(A.prototype),f.clearStorage=r.sqlite3_js_kvvfs_clear,f.prototype.clearStorage=function(){return f.clearStorage(w(this).filename)},f.storageSize=r.sqlite3_js_kvvfs_size,f.prototype.storageSize=function(){return f.storageSize(w(this).filename)}}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=t.util;t.initWorker1API=(function(){const r=(...T)=>{throw new Error(T.join(" "))};globalThis.WorkerGlobalScope instanceof Function||r("initWorker1API() must be run from a Worker thread.");const s=this.sqlite3||r("Missing this.sqlite3 object."),o=s.oo1.DB,p=function(T){let A=g.idMap.get(T);return A||(A="db#"+ ++g.idSeq+"@"+T.pointer,g.idMap.set(T,A),A)},g={dbList:[],idSeq:0,idMap:new WeakMap,xfer:[],open:function(T){const A=new o(T);return this.dbs[p(A)]=A,this.dbList.indexOf(A)<0&&this.dbList.push(A),A},close:function(T,A){if(T){delete this.dbs[p(T)];const D=T.filename,q=n.sqlite3__wasm_db_vfs(T.pointer,0);T.close();const w=this.dbList.indexOf(T);w>=0&&this.dbList.splice(w,1),A&&D&&q&&n.sqlite3__wasm_vfs_unlink(q,D)}},post:function(T,A){A&&A.length?(globalThis.postMessage(T,Array.from(A)),A.length=0):globalThis.postMessage(T)},dbs:Object.create(null),getDb:function(T,A=!0){return this.dbs[T]||(A?r("Unknown (or closed) DB ID:",T):void 0)}},P=function(T=g.dbList[0]){return T&&T.pointer?T:r("DB is not opened.")},R=function(T,A=!0){const D=g.getDb(T.dbId,!1)||g.dbList[0];return A?P(D):D},z=function(){return g.dbList[0]&&p(g.dbList[0])},Q={open:function(T){const A=Object.create(null),D=T.args||Object.create(null);D.simulateError&&r("Throwing because of simulateError flag.");const q=Object.create(null);A.vfs=D.vfs,A.filename=D.filename||"";const w=g.open(A);return q.filename=w.filename,q.persistent=!!s.capi.sqlite3_js_db_uses_vfs(w.pointer,"opfs"),q.dbId=p(w),q.vfs=w.dbVfsName(),q},close:function(T){const A=R(T,!1),D={filename:A&&A.filename};if(A){const q=T.args&&typeof T.args=="object"?!!T.args.unlink:!1;g.close(A,q)}return D},exec:function(T){const A=typeof T.args=="string"?{sql:T.args}:T.args||Object.create(null);A.rowMode==="stmt"?r("Invalid rowMode for 'exec': stmt mode","does not work in the Worker API."):A.sql||r("'exec' requires input SQL.");const D=R(T);(A.callback||Array.isArray(A.resultRows))&&(D._blobXfer=g.xfer);const q=A.callback;let w=0;const x=!!A.columnNames;typeof q=="string"&&(x||(A.columnNames=[]),A.callback=function(N,O){g.post({type:q,columnNames:A.columnNames,rowNumber:++w,row:N},g.xfer)});try{const N=A.countChanges?D.changes(!0,A.countChanges===64):void 0;D.exec(A),N!==void 0&&(A.changeCount=D.changes(!0,A.countChanges===64)-N);const O=A.lastInsertRowId?s.capi.sqlite3_last_insert_rowid(D):void 0;O!==void 0&&(A.lastInsertRowId=O),A.callback instanceof Function&&(A.callback=q,g.post({type:q,columnNames:A.columnNames,rowNumber:null,row:void 0}))}finally{delete D._blobXfer,A.callback&&(A.callback=q)}return A},"config-get":function(){const T=Object.create(null),A=s.config;return["bigIntEnabled"].forEach(function(D){Object.getOwnPropertyDescriptor(A,D)&&(T[D]=A[D])}),T.version=s.version,T.vfsList=s.capi.sqlite3_js_vfs_list(),T},export:function(T){const A=R(T),D={byteArray:s.capi.sqlite3_js_db_export(A.pointer),filename:A.filename,mimetype:"application/x-sqlite3"};return g.xfer.push(D.byteArray.buffer),D},toss:function(T){r("Testing worker exception")}};globalThis.onmessage=async function(T){T=T.data;let A,D=T.dbId,q=T.type;const w=performance.now();try{Q.hasOwnProperty(q)&&Q[q]instanceof Function?A=await Q[q](T):r("Unknown db worker message type:",T.type)}catch(x){q="error",A={operation:T.type,message:x.message,errorClass:x.name,input:T},x.stack&&(A.stack=typeof x.stack=="string"?x.stack.split(/\n\s*/):x.stack)}D||(D=A.dbId||z()),g.post({type:q,dbId:D,messageId:T.messageId,workerReceivedTime:w,workerRespondTime:performance.now(),departureTime:T.departureTime,result:A},g.xfer)},globalThis.postMessage({type:"sqlite3-api",result:"worker1-ready"})}).bind({sqlite3:t})}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=t.wasm,r=t.capi,s=t.util.toss3,o=Object.create(null);t.vfs=o,r.sqlite3_vfs.prototype.registerVfs=function(p=!1){this instanceof t.capi.sqlite3_vfs||s("Expecting a sqlite3_vfs-type argument.");const g=r.sqlite3_vfs_register(this,p?1:0);return g&&s("sqlite3_vfs_register(",this,") failed with rc",g),this.pointer!==r.sqlite3_vfs_find(this.$zName)&&s("BUG: sqlite3_vfs_find(vfs.$zName) failed for just-installed VFS",this),this},o.installVfs=function(p){let g=0;const P=["io","vfs"];for(const R of P){const z=p[R];z&&(++g,z.struct.installMethods(z.methods,!!z.applyArgcCheck),R==="vfs"&&(!z.struct.$zName&&typeof z.name=="string"&&z.struct.addOnDispose(z.struct.$zName=n.allocCString(z.name)),z.struct.registerVfs(!!z.asDefault)))}return g||s("Misuse: installVfs() options object requires at least","one of:",P),this}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){if(!t.wasm.exports.sqlite3_declare_vtab)return;const n=t.wasm,r=t.capi,s=t.util.toss3,o=Object.create(null);t.vtab=o;const p=r.sqlite3_index_info;p.prototype.nthConstraint=function(R,z=!1){if(R<0||R>=this.$nConstraint)return!1;const Q=this.$aConstraint+p.sqlite3_index_constraint.structInfo.sizeof*R;return z?Q:new p.sqlite3_index_constraint(Q)},p.prototype.nthConstraintUsage=function(R,z=!1){if(R<0||R>=this.$nConstraint)return!1;const Q=this.$aConstraintUsage+p.sqlite3_index_constraint_usage.structInfo.sizeof*R;return z?Q:new p.sqlite3_index_constraint_usage(Q)},p.prototype.nthOrderBy=function(R,z=!1){if(R<0||R>=this.$nOrderBy)return!1;const Q=this.$aOrderBy+p.sqlite3_index_orderby.structInfo.sizeof*R;return z?Q:new p.sqlite3_index_orderby(Q)};const g=function(R,z){return(function(Q,T=!1){if(arguments.length===0&&(Q=new z),Q instanceof z)return this.set(Q.pointer,Q),Q;n.isPtr(Q)||t.SQLite3Error.toss("Invalid argument to",R+"()");let A=this.get(Q);return T&&this.delete(Q),A}).bind(new Map)},P=function(R,z){const Q=g(R,z);return Object.assign(Object.create(null),{StructType:z,create:T=>{const A=Q();return n.pokePtr(T,A.pointer),A},get:T=>Q(T),unget:T=>Q(T,!0),dispose:T=>{const A=Q(T,!0);A&&A.dispose()}})};o.xVtab=P("xVtab",r.sqlite3_vtab),o.xCursor=P("xCursor",r.sqlite3_vtab_cursor),o.xIndexInfo=R=>new r.sqlite3_index_info(R),o.xError=function R(z,Q,T){if(R.errorReporter instanceof Function)try{R.errorReporter("sqlite3_module::"+z+"(): "+Q.message)}catch{}let A;return Q instanceof t.WasmAllocError?A=r.SQLITE_NOMEM:arguments.length>2?A=T:Q instanceof t.SQLite3Error&&(A=Q.resultCode),A||r.SQLITE_ERROR},o.xError.errorReporter=console.error.bind(console),o.xRowid=(R,z)=>n.poke(R,z,"i64"),o.setupModule=function(R){let z=!1;const Q=this instanceof r.sqlite3_module?this:R.struct||(z=new r.sqlite3_module);try{const T=R.methods||s("Missing 'methods' object.");for(const A of Object.entries({xConnect:"xCreate",xDisconnect:"xDestroy"})){const D=A[0],q=A[1];T[D]===!0?T[D]=T[q]:T[q]===!0&&(T[q]=T[D])}if(R.catchExceptions){const A=function(w,x){return["xConnect","xCreate"].indexOf(w)>=0?function(N,O,S,L,$,c){try{return x(...arguments)||0}catch(d){return d instanceof t.WasmAllocError||(n.dealloc(n.peekPtr(c)),n.pokePtr(c,n.allocCString(d.message))),o.xError(w,d)}}:function(...N){try{return x(...N)||0}catch(O){return o.xError(w,O)}}},D=["xCreate","xConnect","xBestIndex","xDisconnect","xDestroy","xOpen","xClose","xFilter","xNext","xEof","xColumn","xRowid","xUpdate","xBegin","xSync","xCommit","xRollback","xFindFunction","xRename","xSavepoint","xRelease","xRollbackTo","xShadowName"],q=Object.create(null);for(const w of D){const x=T[w];if(x instanceof Function)w==="xConnect"&&T.xCreate===x?q[w]=T.xCreate:w==="xCreate"&&T.xConnect===x?q[w]=T.xConnect:q[w]=A(w,x);else continue}Q.installMethods(q,!1)}else Q.installMethods(T,!!R.applyArgcCheck);if(Q.$iVersion===0){let A;typeof R.iVersion=="number"?A=R.iVersion:Q.$xShadowName?A=3:Q.$xSavePoint||Q.$xRelease||Q.$xRollbackTo?A=2:A=1,Q.$iVersion=A}}catch(T){throw z&&z.dispose(),T}return Q},r.sqlite3_module.prototype.setupModule=function(R){return o.setupModule.call(this,R)}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=function r(s){if(!globalThis.SharedArrayBuffer||!globalThis.Atomics)return Promise.reject(new Error("Cannot install OPFS: Missing SharedArrayBuffer and/or Atomics. The server must emit the COOP/COEP response headers to enable those. See https://sqlite.org/wasm/doc/trunk/persistence.md#coop-coep"));if(typeof WorkerGlobalScope>"u")return Promise.reject(new Error("The OPFS sqlite3_vfs cannot run in the main thread because it requires Atomics.wait()."));if(!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle||!globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle||!navigator?.storage?.getDirectory)return Promise.reject(new Error("Missing required OPFS APIs."));(!s||typeof s!="object")&&(s=Object.create(null));const o=new URL(globalThis.location.href).searchParams;return o.has("opfs-disable")?Promise.resolve(t):(s.verbose===void 0&&(s.verbose=o.has("opfs-verbose")?+o.get("opfs-verbose")||2:1),s.sanityChecks===void 0&&(s.sanityChecks=o.has("opfs-sanity-check")),s.proxyUri===void 0&&(s.proxyUri=r.defaultProxyUri),typeof s.proxyUri=="function"&&(s.proxyUri=s.proxyUri()),new Promise(function(g,P){const R=[t.config.error,t.config.warn,t.config.log],z=(E,...C)=>{s.verbose>E&&R[E]("OPFS syncer:",...C)},Q=(...E)=>z(2,...E),T=(...E)=>z(1,...E),A=(...E)=>z(0,...E),D=t.util.toss,q=t.capi,w=t.util,x=t.wasm,N=q.sqlite3_vfs,O=q.sqlite3_file,S=q.sqlite3_io_methods,L=Object.create(null),$=()=>globalThis.FileSystemHandle&&globalThis.FileSystemDirectoryHandle&&globalThis.FileSystemFileHandle&&globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle&&navigator?.storage?.getDirectory;L.metrics={dump:function(){let E,C=0,M=0,J=0;for(E in u.opIds){const G=I[E];C+=G.count,M+=G.time,J+=G.wait,G.avgTime=G.count&&G.time?G.time/G.count:0,G.avgWait=G.count&&G.wait?G.wait/G.count:0}t.config.log(globalThis.location.href,"metrics for",globalThis.location.href,":",I,`
|
|
Total of`,C,"op(s) for",M,"ms (incl. "+J+" ms of waiting on the async side)"),t.config.log("Serialization metrics:",I.s11n),h.postMessage({type:"opfs-async-metrics"})},reset:function(){let E;const C=J=>J.count=J.time=J.wait=0;for(E in u.opIds)C(I[E]=Object.create(null));let M=I.s11n=Object.create(null);M=M.serialize=Object.create(null),M.count=M.time=0,M=I.s11n.deserialize=Object.create(null),M.count=M.time=0}};const c=new S,d=new N().addOnDispose(()=>c.dispose());let y;const B=E=>(y=!0,d.dispose(),P(E)),f=()=>(y=!1,g(t)),h=new Worker(new URL(""+new URL("sqlite3-opfs-async-proxy-C_otN2ZJ.js",import.meta.url).href,import.meta.url));setTimeout(()=>{y===void 0&&B(new Error("Timeout while waiting for OPFS async proxy worker."))},4e3),h._originalOnError=h.onerror,h.onerror=function(E){A("Error initializing OPFS asyncer:",E),B(new Error("Loading OPFS async Worker failed for unknown reasons."))};const l=q.sqlite3_vfs_find(null),_=l?new N(l):null;c.$iVersion=1,d.$iVersion=2,d.$szOsFile=q.sqlite3_file.structInfo.sizeof,d.$mxPathname=1024,d.$zName=x.allocCString("opfs"),d.$xDlOpen=d.$xDlError=d.$xDlSym=d.$xDlClose=null,d.addOnDispose("$zName",d.$zName,"cleanup default VFS wrapper",()=>_?_.dispose():null);const u=Object.create(null);u.verbose=s.verbose,u.littleEndian=(()=>{const E=new ArrayBuffer(2);return new DataView(E).setInt16(0,256,!0),new Int16Array(E)[0]===256})(),u.asyncIdleWaitTime=150,u.asyncS11nExceptions=1,u.fileBufferSize=1024*64,u.sabS11nOffset=u.fileBufferSize,u.sabS11nSize=d.$mxPathname*2,u.sabIO=new SharedArrayBuffer(u.fileBufferSize+u.sabS11nSize),u.opIds=Object.create(null);const I=Object.create(null);{let E=0;u.opIds.whichOp=E++,u.opIds.rc=E++,u.opIds.xAccess=E++,u.opIds.xClose=E++,u.opIds.xDelete=E++,u.opIds.xDeleteNoWait=E++,u.opIds.xFileSize=E++,u.opIds.xLock=E++,u.opIds.xOpen=E++,u.opIds.xRead=E++,u.opIds.xSleep=E++,u.opIds.xSync=E++,u.opIds.xTruncate=E++,u.opIds.xUnlock=E++,u.opIds.xWrite=E++,u.opIds.mkdir=E++,u.opIds["opfs-async-metrics"]=E++,u.opIds["opfs-async-shutdown"]=E++,u.opIds.retry=E++,u.sabOP=new SharedArrayBuffer(E*4),L.metrics.reset()}u.sq3Codes=Object.create(null),["SQLITE_ACCESS_EXISTS","SQLITE_ACCESS_READWRITE","SQLITE_BUSY","SQLITE_CANTOPEN","SQLITE_ERROR","SQLITE_IOERR","SQLITE_IOERR_ACCESS","SQLITE_IOERR_CLOSE","SQLITE_IOERR_DELETE","SQLITE_IOERR_FSYNC","SQLITE_IOERR_LOCK","SQLITE_IOERR_READ","SQLITE_IOERR_SHORT_READ","SQLITE_IOERR_TRUNCATE","SQLITE_IOERR_UNLOCK","SQLITE_IOERR_WRITE","SQLITE_LOCK_EXCLUSIVE","SQLITE_LOCK_NONE","SQLITE_LOCK_PENDING","SQLITE_LOCK_RESERVED","SQLITE_LOCK_SHARED","SQLITE_LOCKED","SQLITE_MISUSE","SQLITE_NOTFOUND","SQLITE_OPEN_CREATE","SQLITE_OPEN_DELETEONCLOSE","SQLITE_OPEN_MAIN_DB","SQLITE_OPEN_READONLY"].forEach(E=>{(u.sq3Codes[E]=q[E])===void 0&&D("Maintenance required: not found:",E)}),u.opfsFlags=Object.assign(Object.create(null),{OPFS_UNLOCK_ASAP:1,OPFS_UNLINK_BEFORE_OPEN:2,defaultUnlockAsap:!1});const U=(E,...C)=>{const M=u.opIds[E]||D("Invalid op ID:",E);u.s11n.serialize(...C),Atomics.store(u.sabOPView,u.opIds.rc,-1),Atomics.store(u.sabOPView,u.opIds.whichOp,M),Atomics.notify(u.sabOPView,u.opIds.whichOp);const J=performance.now();for(;Atomics.wait(u.sabOPView,u.opIds.rc,-1)!=="not-equal";);const G=Atomics.load(u.sabOPView,u.opIds.rc);if(I[E].wait+=performance.now()-J,G&&u.asyncS11nExceptions){const te=u.s11n.deserialize();te&&A(E+"() async error:",...te)}return G};L.debug={asyncShutdown:()=>{T("Shutting down OPFS async listener. The OPFS VFS will no longer work."),U("opfs-async-shutdown")},asyncRestart:()=>{T("Attempting to restart OPFS VFS async listener. Might work, might not."),h.postMessage({type:"opfs-async-restart"})}};const ee=()=>{if(u.s11n)return u.s11n;const E=new TextDecoder,C=new TextEncoder("utf-8"),M=new Uint8Array(u.sabIO,u.sabS11nOffset,u.sabS11nSize),J=new DataView(u.sabIO,u.sabS11nOffset,u.sabS11nSize);u.s11n=Object.create(null);const G=Object.create(null);G.number={id:1,size:8,getter:"getFloat64",setter:"setFloat64"},G.bigint={id:2,size:8,getter:"getBigInt64",setter:"setBigInt64"},G.boolean={id:3,size:4,getter:"getInt32",setter:"setInt32"},G.string={id:4};const te=Y=>G[typeof Y]||D("Maintenance required: this value type cannot be serialized.",Y),le=Y=>{switch(Y){case G.number.id:return G.number;case G.bigint.id:return G.bigint;case G.boolean.id:return G.boolean;case G.string.id:return G.string;default:D("Invalid type ID:",Y)}};return u.s11n.deserialize=function(Y=!1){++I.s11n.deserialize.count;const be=performance.now(),F=M[0],V=F?[]:null;if(F){const K=[];let X=1,_e,he,de;for(_e=0;_e<F;++_e,++X)K.push(le(M[X]));for(_e=0;_e<F;++_e){const pe=K[_e];pe.getter?(de=J[pe.getter](X,u.littleEndian),X+=pe.size):(he=J.getInt32(X,u.littleEndian),X+=4,de=E.decode(M.slice(X,X+he)),X+=he),V.push(de)}}return Y&&(M[0]=0),I.s11n.deserialize.time+=performance.now()-be,V},u.s11n.serialize=function(...Y){const be=performance.now();if(++I.s11n.serialize.count,Y.length){const F=[];let V=0,K=1;for(M[0]=Y.length&255;V<Y.length;++V,++K)F.push(te(Y[V])),M[K]=F[V].id;for(V=0;V<Y.length;++V){const X=F[V];if(X.setter)J[X.setter](K,Y[V],u.littleEndian),K+=X.size;else{const _e=C.encode(Y[V]);J.setInt32(K,_e.byteLength,u.littleEndian),K+=4,M.set(_e,K),K+=_e.byteLength}}}else M[0]=0;I.s11n.serialize.time+=performance.now()-be},u.s11n},ne=function E(C=16){E._chars||(E._chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012346789",E._n=E._chars.length);const M=[];let J=0;for(;J<C;++J){const G=Math.random()*(E._n*64)%E._n|0;M[J]=E._chars[G]}return M.join("")},se=Object.create(null),ie=Object.create(null);ie.op=void 0,ie.start=void 0;const j=E=>{ie.start=performance.now(),ie.op=E,++I[E].count},b=()=>I[ie.op].time+=performance.now()-ie.start,k={xCheckReservedLock:function(E,C){return x.poke(C,0,"i32"),0},xClose:function(E){j("xClose");let C=0;const M=se[E];return M&&(delete se[E],C=U("xClose",E),M.sq3File&&M.sq3File.dispose()),b(),C},xDeviceCharacteristics:function(E){return q.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN},xFileControl:function(E,C,M){return q.SQLITE_NOTFOUND},xFileSize:function(E,C){j("xFileSize");let M=U("xFileSize",E);if(M==0)try{const J=u.s11n.deserialize()[0];x.poke(C,J,"i64")}catch(J){A("Unexpected error reading xFileSize() result:",J),M=u.sq3Codes.SQLITE_IOERR}return b(),M},xLock:function(E,C){j("xLock");const M=se[E];let J=0;return M.lockType?M.lockType=C:(J=U("xLock",E,C),J===0&&(M.lockType=C)),b(),J},xRead:function(E,C,M,J){j("xRead");const G=se[E];let te;try{te=U("xRead",E,M,Number(J)),(te===0||q.SQLITE_IOERR_SHORT_READ===te)&&x.heap8u().set(G.sabView.subarray(0,M),C)}catch(le){A("xRead(",arguments,") failed:",le,G),te=q.SQLITE_IOERR_READ}return b(),te},xSync:function(E,C){j("xSync"),++I.xSync.count;const M=U("xSync",E,C);return b(),M},xTruncate:function(E,C){j("xTruncate");const M=U("xTruncate",E,Number(C));return b(),M},xUnlock:function(E,C){j("xUnlock");const M=se[E];let J=0;return q.SQLITE_LOCK_NONE===C&&M.lockType&&(J=U("xUnlock",E,C)),J===0&&(M.lockType=C),b(),J},xWrite:function(E,C,M,J){j("xWrite");const G=se[E];let te;try{G.sabView.set(x.heap8u().subarray(C,C+M)),te=U("xWrite",E,M,Number(J))}catch(le){A("xWrite(",arguments,") failed:",le,G),te=q.SQLITE_IOERR_WRITE}return b(),te}},W={xAccess:function(E,C,M,J){j("xAccess");const G=U("xAccess",x.cstrToJs(C));return x.poke(J,G?0:1,"i32"),b(),0},xCurrentTime:function(E,C){return x.poke(C,24405875e-1+new Date().getTime()/864e5,"double"),0},xCurrentTimeInt64:function(E,C){return x.poke(C,24405875e-1*864e5+new Date().getTime(),"i64"),0},xDelete:function(E,C,M){j("xDelete");const J=U("xDelete",x.cstrToJs(C),M,!1);return b(),J},xFullPathname:function(E,C,M,J){return x.cstrncpy(J,C,M)<M?0:q.SQLITE_CANTOPEN},xGetLastError:function(E,C,M){return T("OPFS xGetLastError() has nothing sensible to return."),0},xOpen:function(C,M,J,G,te){j("xOpen");let le=0;M===0?M=ne():x.isPtr(M)&&(q.sqlite3_uri_boolean(M,"opfs-unlock-asap",0)&&(le|=u.opfsFlags.OPFS_UNLOCK_ASAP),q.sqlite3_uri_boolean(M,"delete-before-open",0)&&(le|=u.opfsFlags.OPFS_UNLINK_BEFORE_OPEN),M=x.cstrToJs(M));const Y=Object.create(null);Y.fid=J,Y.filename=M,Y.sab=new SharedArrayBuffer(u.fileBufferSize),Y.flags=G,Y.readOnly=!(t.SQLITE_OPEN_CREATE&G)&&!!(G&q.SQLITE_OPEN_READONLY);const be=U("xOpen",J,M,G,le);return be||(Y.readOnly&&x.poke(te,q.SQLITE_OPEN_READONLY,"i32"),se[J]=Y,Y.sabView=u.sabFileBufView,Y.sq3File=new O(J),Y.sq3File.$pMethods=c.pointer,Y.lockType=q.SQLITE_LOCK_NONE),b(),be}};_&&(d.$xRandomness=_.$xRandomness,d.$xSleep=_.$xSleep),d.$xRandomness||(W.xRandomness=function(E,C,M){const J=x.heap8u();let G=0;for(;G<C;++G)J[M+G]=Math.random()*255e3&255;return G}),d.$xSleep||(W.xSleep=function(E,C){return Atomics.wait(u.sabOPView,u.opIds.xSleep,0,C),0}),L.getResolvedPath=function(E,C){const M=new URL(E,"file://irrelevant").pathname;return C?M.split("/").filter(J=>!!J):M},L.getDirForFilename=async function(C,M=!1){const J=L.getResolvedPath(C,!0),G=J.pop();let te=L.rootDirectory;for(const le of J)le&&(te=await te.getDirectoryHandle(le,{create:!!M}));return[te,G]},L.mkdir=async function(E){try{return await L.getDirForFilename(E+"/filepart",!0),!0}catch{return!1}},L.entryExists=async function(E){try{const[C,M]=await L.getDirForFilename(E);return await C.getFileHandle(M),!0}catch{return!1}},L.randomFilename=ne,L.treeList=async function(){const E=async function M(J,G){G.name=J.name,G.dirs=[],G.files=[];for await(const te of J.values())if(te.kind==="directory"){const le=Object.create(null);G.dirs.push(le),await M(te,le)}else G.files.push(te.name)},C=Object.create(null);return await E(L.rootDirectory,C),C},L.rmfr=async function(){const E=L.rootDirectory,C={recurse:!0};for await(const M of E.values())E.removeEntry(M.name,C)},L.unlink=async function(E,C=!1,M=!1){try{const[J,G]=await L.getDirForFilename(E,!1);return await J.removeEntry(G,{recursive:C}),!0}catch(J){if(M)throw new Error("unlink(",arguments[0],") failed: "+J.message,{cause:J});return!1}},L.traverse=async function(E){const C={recursive:!0,directory:L.rootDirectory};typeof E=="function"&&(E={callback:E}),E=Object.assign(C,E||{}),async function J(G,te){for await(const le of G.values()){if(E.callback(le,G,te)===!1)return!1;if(E.recursive&&le.kind==="directory"&&await J(le,te+1)===!1)break}}(E.directory,0)};const H=async function(E,C){const[M,J]=await L.getDirForFilename(E,!0);let te=await(await M.getFileHandle(J,{create:!0})).createSyncAccessHandle(),le=0,Y,be=!1;try{for(te.truncate(0);(Y=await C())!==void 0;)Y instanceof ArrayBuffer&&(Y=new Uint8Array(Y)),le===0&&Y.byteLength>=15&&(w.affirmDbHeader(Y),be=!0),te.write(Y,{at:le}),le+=Y.byteLength;if((le<512||le%512!==0)&&D("Input size",le,"is not correct for an SQLite database."),!be){const F=new Uint8Array(20);te.read(F,{at:0}),w.affirmDbHeader(F)}return te.write(new Uint8Array([1,1]),{at:18}),le}catch(F){throw await te.close(),te=void 0,await M.removeEntry(J).catch(()=>{}),F}finally{te&&await te.close()}};if(L.importDb=async function(E,C){if(C instanceof Function)return H(E,C);C instanceof ArrayBuffer&&(C=new Uint8Array(C)),w.affirmIsDb(C);const M=C.byteLength,[J,G]=await L.getDirForFilename(E,!0);let te,le=0;try{return te=await(await J.getFileHandle(G,{create:!0})).createSyncAccessHandle(),te.truncate(0),le=te.write(C,{at:0}),le!=M&&D("Expected to write "+M+" bytes but wrote "+le+"."),te.write(new Uint8Array([1,1]),{at:18}),le}catch(Y){throw te&&(await te.close(),te=void 0),await J.removeEntry(G).catch(()=>{}),Y}finally{te&&await te.close()}},t.oo1){const E=function(...C){const M=t.oo1.DB.dbCtorHelper.normalizeArgs(...C);M.vfs=d.$zName,t.oo1.DB.dbCtorHelper.call(this,M)};E.prototype=Object.create(t.oo1.DB.prototype),t.oo1.OpfsDb=E,E.importDb=L.importDb,t.oo1.DB.dbCtorHelper.setVfsPostOpenCallback(d.pointer,function(C,M){M.capi.sqlite3_busy_timeout(C,1e4)})}const Z=function(){const E=x.scopedAllocPush(),C=new O;try{const M=C.pointer,J=q.SQLITE_OPEN_CREATE|q.SQLITE_OPEN_READWRITE|q.SQLITE_OPEN_MAIN_DB,G=x.scopedAlloc(8),te="/sanity/check/file"+ne(8),le=x.scopedAllocCString(te);let Y;if(u.s11n.serialize("This is ä string."),Y=u.s11n.deserialize(),Q("deserialize() says:",Y),Y[0]!=="This is ä string."&&D("String d13n error."),W.xAccess(d.pointer,le,0,G),Y=x.peek(G,"i32"),Q("xAccess(",te,") exists ?=",Y),Y=W.xOpen(d.pointer,le,M,J,G),Q("open rc =",Y,"state.sabOPView[xOpen] =",u.sabOPView[u.opIds.xOpen]),Y!==0){A("open failed with code",Y);return}W.xAccess(d.pointer,le,0,G),Y=x.peek(G,"i32"),Y||D("xAccess() failed to detect file."),Y=k.xSync(C.pointer,0),Y&&D("sync failed w/ rc",Y),Y=k.xTruncate(C.pointer,1024),Y&&D("truncate failed w/ rc",Y),x.poke(G,0,"i64"),Y=k.xFileSize(C.pointer,G),Y&&D("xFileSize failed w/ rc",Y),Q("xFileSize says:",x.peek(G,"i64")),Y=k.xWrite(C.pointer,le,10,1),Y&&D("xWrite() failed!");const be=x.scopedAlloc(16);Y=k.xRead(C.pointer,be,6,2),x.poke(be+6,0);let F=x.cstrToJs(be);Q("xRead() got:",F),F!=="sanity"&&D("Unexpected xRead() value."),W.xSleep&&(Q("xSleep()ing before close()ing..."),W.xSleep(d.pointer,2e3),Q("waking up from xSleep()")),Y=k.xClose(M),Q("xClose rc =",Y,"sabOPView =",u.sabOPView),Q("Deleting file:",te),W.xDelete(d.pointer,le,4660),W.xAccess(d.pointer,le,0,G),Y=x.peek(G,"i32"),Y&&D("Expecting 0 from xAccess(",te,") after xDelete()."),T("End of OPFS sanity checks.")}finally{C.dispose(),x.scopedAllocPop(E)}};h.onmessage=function({data:E}){switch(E.type){case"opfs-unavailable":B(new Error(E.payload.join(" ")));break;case"opfs-async-loaded":h.postMessage({type:"opfs-async-init",args:u});break;case"opfs-async-inited":{if(y===!0)break;try{t.vfs.installVfs({io:{struct:c,methods:k},vfs:{struct:d,methods:W}}),u.sabOPView=new Int32Array(u.sabOP),u.sabFileBufView=new Uint8Array(u.sabIO,0,u.fileBufferSize),u.sabS11nView=new Uint8Array(u.sabIO,u.sabS11nOffset,u.sabS11nSize),ee(),s.sanityChecks&&(T("Running sanity checks because of opfs-sanity-check URL arg..."),Z()),$()?navigator.storage.getDirectory().then(C=>{h.onerror=h._originalOnError,delete h._originalOnError,t.opfs=L,L.rootDirectory=C,Q("End of OPFS sqlite3_vfs setup.",d),f()}).catch(B):f()}catch(C){A(C),B(C)}break}default:{const C="Unexpected message from the OPFS async worker: "+JSON.stringify(E);A(C),B(new Error(C));break}}}}))};n.defaultProxyUri="sqlite3-opfs-async-proxy.js",globalThis.sqlite3ApiBootstrap.initializersAsync.push(async r=>{try{let s=n.defaultProxyUri;return r.scriptInfo.sqlite3Dir&&(n.defaultProxyUri=r.scriptInfo.sqlite3Dir+s),n().catch(o=>{r.config.warn("Ignoring inability to install OPFS sqlite3_vfs:",o.message)})}catch(s){return r.config.error("installOpfsVfs() exception:",s),Promise.reject(s)}})}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=t.util.toss,r=t.util.toss3,s=Object.create(null),o=t.capi,p=t.util,g=t.wasm,P=4096,R=512,z=4,Q=8,T=R+z,A=R,D=T,q=P,w=o.SQLITE_OPEN_MAIN_DB|o.SQLITE_OPEN_MAIN_JOURNAL|o.SQLITE_OPEN_SUPER_JOURNAL|o.SQLITE_OPEN_WAL,x=o.SQLITE_OPEN_MEMORY,N=".opaque",O=()=>Math.random().toString(36).slice(2),S=new TextDecoder,L=new TextEncoder,$=Object.assign(Object.create(null),{name:"opfs-sahpool",directory:void 0,initialCapacity:6,clearOnInit:!1,verbosity:2,forceReinitIfPreviouslyFailed:!1}),c=[t.config.error,t.config.warn,t.config.log];t.config.log;const d=t.config.warn;t.config.error;const y=new Map,B=j=>y.get(j),f=(j,b)=>{b?y.set(j,b):y.delete(j)},h=new Map,l=j=>h.get(j),_=(j,b)=>{b?h.set(j,b):h.delete(j)},u={xCheckReservedLock:function(j,b){const k=l(j);return k.log("xCheckReservedLock"),k.storeErr(),g.poke32(b,1),0},xClose:function(j){const b=l(j);b.storeErr();const k=b.getOFileForS3File(j);if(k)try{b.log(`xClose ${k.path}`),b.mapS3FileToOFile(j,!1),k.sah.flush(),k.flags&o.SQLITE_OPEN_DELETEONCLOSE&&b.deletePath(k.path)}catch(W){return b.storeErr(W,o.SQLITE_IOERR)}return 0},xDeviceCharacteristics:function(j){return o.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN},xFileControl:function(j,b,k){return o.SQLITE_NOTFOUND},xFileSize:function(j,b){const k=l(j);k.log("xFileSize");const H=k.getOFileForS3File(j).sah.getSize()-q;return g.poke64(b,BigInt(H)),0},xLock:function(j,b){const k=l(j);k.log(`xLock ${b}`),k.storeErr();const W=k.getOFileForS3File(j);return W.lockType=b,0},xRead:function(j,b,k,W){const H=l(j);H.storeErr();const Z=H.getOFileForS3File(j);H.log(`xRead ${Z.path} ${k} @ ${W}`);try{const E=Z.sah.read(g.heap8u().subarray(b,b+k),{at:q+Number(W)});return E<k?(g.heap8u().fill(0,b+E,b+k),o.SQLITE_IOERR_SHORT_READ):0}catch(E){return H.storeErr(E,o.SQLITE_IOERR)}},xSectorSize:function(j){return P},xSync:function(j,b){const k=l(j);k.log(`xSync ${b}`),k.storeErr();const W=k.getOFileForS3File(j);try{return W.sah.flush(),0}catch(H){return k.storeErr(H,o.SQLITE_IOERR)}},xTruncate:function(j,b){const k=l(j);k.log(`xTruncate ${b}`),k.storeErr();const W=k.getOFileForS3File(j);try{return W.sah.truncate(q+Number(b)),0}catch(H){return k.storeErr(H,o.SQLITE_IOERR)}},xUnlock:function(j,b){const k=l(j);k.log("xUnlock");const W=k.getOFileForS3File(j);return W.lockType=b,0},xWrite:function(j,b,k,W){const H=l(j);H.storeErr();const Z=H.getOFileForS3File(j);H.log(`xWrite ${Z.path} ${k} ${W}`);try{const E=Z.sah.write(g.heap8u().subarray(b,b+k),{at:q+Number(W)});return k===E?0:n("Unknown write() failure.")}catch(E){return H.storeErr(E,o.SQLITE_IOERR)}}},I=new o.sqlite3_io_methods;I.$iVersion=1,t.vfs.installVfs({io:{struct:I,methods:u}});const U={xAccess:function(j,b,k,W){const H=B(j);H.storeErr();try{const Z=H.getPath(b);g.poke32(W,H.hasFilename(Z)?1:0)}catch{g.poke32(W,0)}return 0},xCurrentTime:function(j,b){return g.poke(b,24405875e-1+new Date().getTime()/864e5,"double"),0},xCurrentTimeInt64:function(j,b){return g.poke(b,24405875e-1*864e5+new Date().getTime(),"i64"),0},xDelete:function(j,b,k){const W=B(j);W.log(`xDelete ${g.cstrToJs(b)}`),W.storeErr();try{return W.deletePath(W.getPath(b)),0}catch(H){return W.storeErr(H),o.SQLITE_IOERR_DELETE}},xFullPathname:function(j,b,k,W){return g.cstrncpy(W,b,k)<k?0:o.SQLITE_CANTOPEN},xGetLastError:function(j,b,k){const W=B(j),H=W.popErr();if(W.log(`xGetLastError ${b} e =`,H),H){const Z=g.scopedAllocPush();try{const[E,C]=g.scopedAllocCString(H.message,!0);g.cstrncpy(k,E,b),C>b&&g.poke8(k+b-1,0)}catch{return o.SQLITE_NOMEM}finally{g.scopedAllocPop(Z)}}return H?H.sqlite3Rc||o.SQLITE_IOERR:0},xOpen:function(b,k,W,H,Z){const E=B(b);try{H&=~x,E.log(`xOpen ${g.cstrToJs(k)} ${H}`);const C=k&&g.peek8(k)?E.getPath(k):O();let M=E.getSAHForPath(C);!M&&H&o.SQLITE_OPEN_CREATE&&(E.getFileCount()<E.getCapacity()?(M=E.nextAvailableSAH(),E.setAssociatedPath(M,C,H)):n("SAH pool is full. Cannot create file",C)),M||n("file not found:",C);const J={path:C,flags:H,sah:M};E.mapS3FileToOFile(W,J),J.lockType=o.SQLITE_LOCK_NONE;const G=new o.sqlite3_file(W);return G.$pMethods=I.pointer,G.dispose(),g.poke32(Z,H),0}catch(C){return E.storeErr(C),o.SQLITE_CANTOPEN}}},ee=function(j){t.capi.sqlite3_vfs_find(j)&&r("VFS name is already registered:",j);const b=new o.sqlite3_vfs,k=o.sqlite3_vfs_find(null),W=k?new o.sqlite3_vfs(k):null;return b.$iVersion=2,b.$szOsFile=o.sqlite3_file.structInfo.sizeof,b.$mxPathname=R,b.addOnDispose(b.$zName=g.allocCString(j),()=>f(b.pointer,0)),W&&(b.$xRandomness=W.$xRandomness,b.$xSleep=W.$xSleep,W.dispose()),!b.$xRandomness&&!U.xRandomness&&(U.xRandomness=function(H,Z,E){const C=g.heap8u();let M=0;for(;M<Z;++M)C[E+M]=Math.random()*255e3&255;return M}),!b.$xSleep&&!U.xSleep&&(U.xSleep=(H,Z)=>0),t.vfs.installVfs({vfs:{struct:b,methods:U}}),b};class ne{vfsDir;#e;#o;#a;#r=new Map;#t=new Map;#s=new Set;#l=new Map;#n=new Uint8Array(T);#c;#i;#u;constructor(b=Object.create(null)){this.#u=b.verbosity??$.verbosity,this.vfsName=b.name||$.name,this.#i=ee(this.vfsName),f(this.#i.pointer,this),this.vfsDir=b.directory||"."+this.vfsName,this.#c=new DataView(this.#n.buffer,this.#n.byteOffset),this.isReady=this.reset(!!(b.clearOnInit??$.clearOnInit)).then(()=>{if(this.$error)throw this.$error;return this.getCapacity()?Promise.resolve(void 0):this.addCapacity(b.initialCapacity||$.initialCapacity)})}#_(b,...k){this.#u>b&&c[b](this.vfsName+":",...k)}log(...b){this.#_(2,...b)}warn(...b){this.#_(1,...b)}error(...b){this.#_(0,...b)}getVfs(){return this.#i}getCapacity(){return this.#r.size}getFileCount(){return this.#t.size}getFileNames(){const b=[];for(const k of this.#t.keys())b.push(k);return b}async addCapacity(b){for(let k=0;k<b;++k){const W=O(),Z=await(await this.#o.getFileHandle(W,{create:!0})).createSyncAccessHandle();this.#r.set(Z,W),this.setAssociatedPath(Z,"",0)}return this.getCapacity()}async reduceCapacity(b){let k=0;for(const W of Array.from(this.#s)){if(k===b||this.getFileCount()===this.getCapacity())break;const H=this.#r.get(W);W.close(),await this.#o.removeEntry(H),this.#r.delete(W),this.#s.delete(W),++k}return k}releaseAccessHandles(){for(const b of this.#r.keys())b.close();this.#r.clear(),this.#t.clear(),this.#s.clear()}async acquireAccessHandles(b=!1){const k=[];for await(const[W,H]of this.#o)H.kind==="file"&&k.push([W,H]);return Promise.all(k.map(async([W,H])=>{try{const Z=await H.createSyncAccessHandle();if(this.#r.set(Z,W),b)Z.truncate(q),this.setAssociatedPath(Z,"",0);else{const E=this.getAssociatedPath(Z);E?this.#t.set(E,Z):this.#s.add(Z)}}catch(Z){throw this.storeErr(Z),this.releaseAccessHandles(),Z}}))}getAssociatedPath(b){b.read(this.#n,{at:0});const k=this.#c.getUint32(A);if(this.#n[0]&&(k&o.SQLITE_OPEN_DELETEONCLOSE||(k&w)===0))return d(`Removing file with unexpected flags ${k.toString(16)}`,this.#n),this.setAssociatedPath(b,"",0),"";const W=new Uint32Array(Q/4);b.read(W,{at:D});const H=this.computeDigest(this.#n,k);if(W.every((Z,E)=>Z===H[E])){const Z=this.#n.findIndex(E=>E===0);return Z===0&&b.truncate(q),Z?S.decode(this.#n.subarray(0,Z)):""}else return d("Disassociating file with bad digest."),this.setAssociatedPath(b,"",0),""}setAssociatedPath(b,k,W){const H=L.encodeInto(k,this.#n);R<=H.written+1&&n("Path too long:",k),k&&W&&(W|=x),this.#n.fill(0,H.written,R),this.#c.setUint32(A,W);const Z=this.computeDigest(this.#n,W);b.write(this.#n,{at:0}),b.write(Z,{at:D}),b.flush(),k?(this.#t.set(k,b),this.#s.delete(b)):(b.truncate(q),this.#s.add(b))}computeDigest(b,k){if(k&x){let W=3735928559,H=1103547991;for(const Z of b)W=Math.imul(W^Z,2654435761),H=Math.imul(H^Z,104729);return new Uint32Array([W>>>0,H>>>0])}else return new Uint32Array([0,0])}async reset(b){await this.isReady;let k=await navigator.storage.getDirectory(),W;for(const H of this.vfsDir.split("/"))H&&(W=k,k=await k.getDirectoryHandle(H,{create:!0}));return this.#e=k,this.#a=W,this.#o=await this.#e.getDirectoryHandle(N,{create:!0}),this.releaseAccessHandles(),this.acquireAccessHandles(b)}getPath(b){return g.isPtr(b)&&(b=g.cstrToJs(b)),(b instanceof URL?b:new URL(b,"file://localhost/")).pathname}deletePath(b){const k=this.#t.get(b);return k&&(this.#t.delete(b),this.setAssociatedPath(k,"",0)),!!k}storeErr(b,k){return b&&(b.sqlite3Rc=k||o.SQLITE_IOERR,this.error(b)),this.$error=b,k}popErr(){const b=this.$error;return this.$error=void 0,b}nextAvailableSAH(){const[b]=this.#s.keys();return b}getOFileForS3File(b){return this.#l.get(b)}mapS3FileToOFile(b,k){k?(this.#l.set(b,k),_(b,this)):(this.#l.delete(b),_(b,!1))}hasFilename(b){return this.#t.has(b)}getSAHForPath(b){return this.#t.get(b)}async removeVfs(){if(!this.#i.pointer||!this.#o)return!1;o.sqlite3_vfs_unregister(this.#i.pointer),this.#i.dispose(),delete s[this.vfsName];try{this.releaseAccessHandles(),await this.#e.removeEntry(N,{recursive:!0}),this.#o=void 0,await this.#a.removeEntry(this.#e.name,{recursive:!0}),this.#e=this.#a=void 0}catch(b){t.config.error(this.vfsName,"removeVfs() failed with no recovery strategy:",b)}return!0}pauseVfs(){return this.#l.size>0&&t.SQLite3Error.toss(o.SQLITE_MISUSE,"Cannot pause VFS",this.vfsName,"because it has opened files."),this.#r.size>0&&(o.sqlite3_vfs_unregister(this.vfsName),this.releaseAccessHandles()),this}isPaused(){return this.#r.size===0}async unpauseVfs(){return this.#r.size===0?this.acquireAccessHandles(!1).then(()=>o.sqlite3_vfs_register(this.#i,0),this):this}exportFile(b){const k=this.#t.get(b)||n("File not found:",b),W=k.getSize()-q,H=new Uint8Array(W>0?W:0);if(W>0){const Z=k.read(H,{at:q});Z!=W&&n("Expected to read "+W+" bytes but read "+Z+".")}return H}async importDbChunked(b,k){const W=this.#t.get(b)||this.nextAvailableSAH()||n("No available handles to import to.");W.truncate(0);let H=0,Z,E=!1;try{for(;(Z=await k())!==void 0;)Z instanceof ArrayBuffer&&(Z=new Uint8Array(Z)),H===0&&Z.byteLength>=15&&(p.affirmDbHeader(Z),E=!0),W.write(Z,{at:q+H}),H+=Z.byteLength;if((H<512||H%512!==0)&&n("Input size",H,"is not correct for an SQLite database."),!E){const C=new Uint8Array(20);W.read(C,{at:0}),p.affirmDbHeader(C)}W.write(new Uint8Array([1,1]),{at:q+18})}catch(C){throw this.setAssociatedPath(W,"",0),C}return this.setAssociatedPath(W,b,o.SQLITE_OPEN_MAIN_DB),H}importDb(b,k){if(k instanceof ArrayBuffer)k=new Uint8Array(k);else if(k instanceof Function)return this.importDbChunked(b,k);const W=this.#t.get(b)||this.nextAvailableSAH()||n("No available handles to import to."),H=k.byteLength;(H<512||H%512!=0)&&n("Byte array size is invalid for an SQLite db.");const Z="SQLite format 3";for(let C=0;C<Z.length;++C)Z.charCodeAt(C)!==k[C]&&n("Input does not contain an SQLite database header.");const E=W.write(k,{at:q});return E!=H?(this.setAssociatedPath(W,"",0),n("Expected to write "+H+" bytes but wrote "+E+".")):(W.write(new Uint8Array([1,1]),{at:q+18}),this.setAssociatedPath(W,b,o.SQLITE_OPEN_MAIN_DB)),E}}class se{#e;constructor(b){this.#e=b,this.vfsName=b.vfsName}async addCapacity(b){return this.#e.addCapacity(b)}async reduceCapacity(b){return this.#e.reduceCapacity(b)}getCapacity(){return this.#e.getCapacity(this.#e)}getFileCount(){return this.#e.getFileCount()}getFileNames(){return this.#e.getFileNames()}async reserveMinimumCapacity(b){const k=this.#e.getCapacity();return k<b?this.#e.addCapacity(b-k):k}exportFile(b){return this.#e.exportFile(b)}importDb(b,k){return this.#e.importDb(b,k)}async wipeFiles(){return this.#e.reset(!0)}unlink(b){return this.#e.deletePath(b)}async removeVfs(){return this.#e.removeVfs()}pauseVfs(){return this.#e.pauseVfs(),this}async unpauseVfs(){return this.#e.unpauseVfs().then(()=>this)}isPaused(){return this.#e.isPaused()}}const ie=async()=>{const j=await navigator.storage.getDirectory(),b=".opfs-sahpool-sync-check-"+O(),H=(await(await j.getFileHandle(b,{create:!0})).createSyncAccessHandle()).close();return await H,await j.removeEntry(b),H?.then&&n("The local OPFS API is too old for opfs-sahpool:","it has an async FileSystemSyncAccessHandle.close() method."),!0};t.installOpfsSAHPoolVfs=async function(j=Object.create(null)){j=Object.assign(Object.create(null),$,j||{});const b=j.name;if(j.$testThrowPhase1)throw j.$testThrowPhase1;if(s[b])try{return await s[b]}catch(k){if(j.forceReinitIfPreviouslyFailed)delete s[b];else throw k}return!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle||!globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle||!navigator?.storage?.getDirectory?s[b]=Promise.reject(new Error("Missing required OPFS APIs.")):s[b]=ie().then(async function(){if(j.$testThrowPhase2)throw j.$testThrowPhase2;const k=new ne(j);return k.isReady.then(async()=>{const W=new se(k);if(t.oo1){const H=t.oo1,Z=k.getVfs(),E=function(...C){const M=H.DB.dbCtorHelper.normalizeArgs(...C);M.vfs=Z.$zName,H.DB.dbCtorHelper.call(this,M)};E.prototype=Object.create(H.DB.prototype),W.OpfsSAHPoolDb=E}return k.log("VFS initialized."),W}).catch(async W=>{throw await k.removeVfs().catch(()=>{}),W})}).catch(k=>s[b]=Promise.reject(k))}}),typeof i<"u"){const t=Object.assign(Object.create(null),{exports:typeof m>"u"?i.asm:m,memory:i.wasmMemory},globalThis.sqlite3ApiConfig||{});globalThis.sqlite3ApiConfig=t;let n;try{n=globalThis.sqlite3ApiBootstrap()}catch(r){throw console.error("sqlite3ApiBootstrap() error:",r),r}finally{delete globalThis.sqlite3ApiBootstrap,delete globalThis.sqlite3ApiConfig}i.sqlite3=n}else console.warn("This is not running in an Emscripten module context, so","globalThis.sqlite3ApiBootstrap() is _not_ being called due to lack","of config info for the WASM environment.","It must be called manually.")},ge=Ne,ge}})();const Xn=(function(){const qe=Ft;if(!qe)throw new Error("Expecting globalThis.sqlite3InitModule to be defined by the Emscripten build.");const ce=globalThis.sqlite3InitModuleState=Object.assign(Object.create(null),{moduleScript:globalThis?.document?.currentScript,isWorker:typeof WorkerGlobalScope<"u",location:globalThis.location,urlParams:globalThis?.location?.href?new URL(globalThis.location.href).searchParams:new URLSearchParams});if(ce.debugModule=ce.urlParams.has("sqlite3.debugModule")?(...ge)=>console.warn("sqlite3.debugModule:",...ge):()=>{},ce.urlParams.has("sqlite3.dir"))ce.sqlite3Dir=ce.urlParams.get("sqlite3.dir")+"/";else if(ce.moduleScript){const ge=ce.moduleScript.src.split("/");ge.pop(),ce.sqlite3Dir=ge.join("/")+"/"}if(globalThis.sqlite3InitModule=function ge(...i){return qe(...i).then(ye=>{ye.runSQLite3PostLoadInit(ye);const Ee=ye.sqlite3;Ee.scriptInfo=ce,ge.__isUnderTest&&(Ee.__isUnderTest=!0);const Ne=Ee.asyncPostInit;return delete Ee.asyncPostInit,Ne()}).catch(ye=>{throw console.error("Exception loading sqlite3 module:",ye),ye})},globalThis.sqlite3InitModule.ready=qe.ready,globalThis.sqlite3InitModuleState.moduleScript){const ge=globalThis.sqlite3InitModuleState;let i=ge.moduleScript.src.split("/");i.pop(),ge.scriptDir=i.join("/")+"/"}return ce.debugModule("sqlite3InitModuleState =",ce),globalThis.sqlite3InitModule})();Ft=Xn;globalThis.sqlite3Worker1Promiser=function qe(ce=qe.defaultConfig){if(arguments.length===1&&typeof arguments[0]=="function"){const re=ce;ce=Object.assign(Object.create(null),qe.defaultConfig),ce.onready=re}else ce=Object.assign(Object.create(null),qe.defaultConfig,ce);const ge=Object.create(null),i=function(){},ye=ce.onerror||i,Ee=ce.debug||i,Ne=ce.generateMessageId?void 0:Object.create(null),Je=ce.generateMessageId||function(re){return re.type+"#"+(Ne[re.type]=(Ne[re.type]||0)+1)},Oe=(...re)=>{throw new Error(re.join(" "))};ce.worker||(ce.worker=qe.defaultConfig.worker),typeof ce.worker=="function"&&(ce.worker=ce.worker());let Fe,Qe;return ce.worker.onmessage=function(re){re=re.data,Ee("worker1.onmessage",re);let me=ge[re.messageId];if(!me){if(re&&re.type==="sqlite3-api"&&re.result==="worker1-ready"){ce.onready&&ce.onready(Qe);return}if(me=ge[re.type],me&&me.onrow){me.onrow(re);return}ce.onunhandled?ce.onunhandled(arguments[0]):ye("sqlite3Worker1Promiser() unhandled worker message:",re);return}switch(delete ge[re.messageId],re.type){case"error":me.reject(re);return;case"open":Fe||(Fe=re.dbId);break;case"close":re.dbId===Fe&&(Fe=void 0);break}try{me.resolve(re)}catch(Ae){me.reject(Ae)}},Qe=function(){let re;arguments.length===1?re=arguments[0]:arguments.length===2?(re=Object.create(null),re.type=arguments[0],re.args=arguments[1],re.dbId=re.args.dbId):Oe("Invalid arguments for sqlite3Worker1Promiser()-created factory."),!re.dbId&&re.type!=="open"&&(re.dbId=Fe),re.messageId=Je(re),re.departureTime=performance.now();const me=Object.create(null);me.message=re;let Ae;re.type==="exec"&&re.args&&(typeof re.args.callback=="function"?(Ae=re.messageId+":row",me.onrow=re.args.callback,re.args.callback=Ae,ge[Ae]=me):typeof re.args.callback=="string"&&Oe("exec callback may not be a string when using the Promise interface."));let Le=new Promise(function(Me,He){me.resolve=Me,me.reject=He,ge[re.messageId]=me,Ee("Posting",re.type,"message to Worker dbId="+(Fe||"default")+":",re),ce.worker.postMessage(re)});return Ae&&(Le=Le.finally(()=>delete ge[Ae])),Le}};globalThis.sqlite3Worker1Promiser.defaultConfig={worker:function(){return new Worker(new URL(""+new URL("sqlite3-worker1-bundler-friendly-Bv6ABw9v.js",import.meta.url).href,import.meta.url),{type:"module"})},onerror:(...qe)=>console.error("worker1 promiser error",...qe)};sqlite3Worker1Promiser.v2=(function(qe){let ce;typeof qe=="function"?(ce=qe,qe={}):typeof qe?.onready=="function"&&(ce=qe.onready,delete qe.onready);const ge=Object.create(null);qe=Object.assign(qe||Object.create(null),{onready:async function(ye){try{ce&&await ce(ye),ge.resolve(ye)}catch(Ee){ge.reject(Ee)}}});const i=new Promise(function(ye,Ee){ge.resolve=ye,ge.reject=Ee});try{this.original(qe)}catch(ye){ge.reject(ye)}return i}).bind({original:sqlite3Worker1Promiser});sqlite3Worker1Promiser.v2;const er=globalThis.sqlite3Worker1Promiser;export{Ft as default,er as sqlite3Worker1Promiser};
|