diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b7f9a3c..0000000 --- a/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -# Зависимости -node_modules - -# Сборка -dist -dist-ssr - -# Логи -*.log - -# Окружение -.env -.env.* - -# Редактор / ОС -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store \ No newline at end of file diff --git a/dist/assets/index-17GvxYKC.js b/dist/assets/index-17GvxYKC.js new file mode 100644 index 0000000..86ac3e2 --- /dev/null +++ b/dist/assets/index-17GvxYKC.js @@ -0,0 +1,45 @@ +(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))u(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const h of l.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&u(h)}).observe(document,{childList:!0,subtree:!0});function i(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function u(s){if(s.ep)return;s.ep=!0;const l=i(s);fetch(s.href,l)}})();const vt="japanese_app.db";async function wt(){return navigator.storage.getDirectory()}async function gn(r){const i=await(await wt()).getFileHandle(vt,{create:!0}),u=i.createSyncAccessHandle;if(typeof u=="function")try{const l=await u.call(i);try{l.truncate(0),l.write(r,{at:0}),l.flush()}finally{l.close()}return}catch{}const s=await i.createWritable();try{await s.truncate(0);const l=new Uint8Array(r.length);l.set(r),await s.write(l)}finally{await s.close()}}async function vn(){const r=await wt();let n;try{n=await r.getFileHandle(vt)}catch{throw new Error("Локальная база не найдена — сначала скачай сохранение")}const i=await n.getFile();if(i.size===0)throw new Error("Локальная база пуста");return new Uint8Array(await i.arrayBuffer())}async function Se(){try{return(await(await(await wt()).getFileHandle(vt)).getFile()).size>0}catch{return!1}}var wn=ArrayBuffer,L=Uint8Array,Ye=Uint16Array,yn=Int16Array,De=Int32Array,ut=function(r,n,i){if(L.prototype.slice)return L.prototype.slice.call(r,n,i);(n==null||n<0)&&(n=0),(i==null||i>r.length)&&(i=r.length);var u=new L(i-n);return u.set(r.subarray(n,i)),u},$e=function(r,n,i,u){if(L.prototype.fill)return L.prototype.fill.call(r,n,i,u);for((i==null||i<0)&&(i=0),(u==null||u>r.length)&&(u=r.length);ir.length)&&(u=r.length);i2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],I=function(r,n,i){var u=new Error(n||bn[r]);if(u.code=r,Error.captureStackTrace&&Error.captureStackTrace(u,I),!i)throw u;return u},Yt=function(r,n,i){for(var u=0,s=0;u>>0},Cn=function(r,n){var i=r[0]|r[1]<<8|r[2]<<16;if(i==3126568&&r[3]==253){var u=r[4],s=u>>5&1,l=u>>2&1,h=u&3,g=u>>6;u&8&&I(0);var y=6-s,E=h==3?4:h,U=Yt(r,y,E);y+=E;var k=g?1<>3);m=x+(x>>3)*(r[5]&7)}m>2145386496&&I(1);var w=new L((n==1?F||m:n?0:m)+12);return w[0]=1,w[4]=4,w[8]=8,{b:y+k,y:0,l:0,d:U,w:n&&n!=1?n:w.subarray(12),e:m,o:new De(w.buffer,0,3),u:F,c:l,m:Math.min(131072,m)}}else if((i>>4|r[3]<<20)==25481893)return Un(r,4)+8;I(0)},me=function(r){for(var n=0;1<i&&I(3);for(var l=1<0;){var X=me(h+1),J=u>>3,se=(1<>(u&7)&se,b=(1<b&&(R-=V)),F[++g]=--R,R==-1?(h+=R,$[--U]=g):h-=R,!R)do{var te=u>>3;y=(r[te]|r[te+1]<<8)>>(u&7)&3,u+=2,g+=y}while(y==3)}(g>255||h)&&I(0);for(var Y=0,re=(l>>1)+(l>>3)+3,ne=l-1,G=0;G<=g;++G){var N=F[G];if(N<1){m[G]=-N;continue}for(E=0;E=U)}}for(Y&&I(0),E=0;E>3,{b:s,s:$,n:D,t:x}]},Mn=function(r,n){var i=0,u=-1,s=new L(292),l=r[n],h=s.subarray(0,256),g=s.subarray(256,268),y=new Ye(s.buffer,268);if(l<128){var E=Te(r,n+1,6),U=E[0],k=E[1];n+=l;var F=U<<3,m=r[n];m||I(0);for(var x=0,w=0,$=k.b,D=$,X=(++n<<3)-8+me(m);X-=$,!(X>3;if(x+=(r[J]|r[J+1]<<8)>>(X&7)&(1<<$)-1,h[++u]=k.s[x],X-=D,X>3,w+=(r[J]|r[J+1]<<8)>>(X&7)&(1<255&&I(0)}else{for(u=l-127;i>4,h[i+1]=se&15}++n}var R=0;for(i=0;i11&&I(0),R+=b&&1<0;--i){var G=y[i];$e(ne,i,G,y[i-1]=G+g[i]*(1<g&&k>3,m=(r[F]|r[F+1]<<8|r[F+2]<<16)>>(U&7);y=(y<>2,h=l<<1,g=l+h;Pe(r.subarray(u,u+=r[0]|r[1]<<8),n.subarray(0,l),i),Pe(r.subarray(u,u+=r[2]|r[3]<<8),n.subarray(l,h),i),Pe(r.subarray(u,u+=r[4]|r[5]<<8),n.subarray(h,g),i),Pe(r.subarray(u),n.subarray(g),i)},Hn=function(r,n,i){var u,s=n.b,l=r[s],h=l>>1&3;n.l=l&1;var g=l>>3|r[s+1]<<5|r[s+2]<<13,y=(s+=3)+g;if(h==1)return s>=r.length?void 0:(n.b=s+1,i?($e(i,r[s],n.y,n.y+=g),i):$e(new L(g),r[s]));if(!(y>r.length)){if(h==0)return n.b=y,i?(i.set(r.subarray(s,y),n.y),n.y+=g,i):ut(r,s,y);if(h==2){var E=r[s],U=E&3,k=E>>2&3,F=E>>4,m=0,x=0;U<2?k&1?F|=r[++s]<<4|(k&2&&r[++s]<<12):F=E>>3:(x=k,k<2?(F|=(r[++s]&63)<<4,m=r[s]>>6|r[++s]<<2):k==2?(F|=r[++s]<<4|(r[++s]&3)<<12,m=r[s]>>2|r[++s]<<6):(F|=r[++s]<<4|(r[++s]&63)<<12,m=r[s]>>6|r[++s]<<2|r[++s]<<10)),++s;var w=i?i.subarray(n.y,n.y+n.m):new L(n.m),$=w.length-F;if(U==0)w.set(r.subarray(s,s+=F),$);else if(U==1)$e(w,r[s++],$);else{var D=n.h;if(U==2){var X=Mn(r,s);m+=s-(s=X[0]),n.h=D=X[1]}else D||I(0);(x?Nn:Pe)(r.subarray(s,s+=m),w.subarray($),D)}var J=r[s++];if(J){J==255?J=(r[s++]|r[s++]<<8)+32512:J>127&&(J=J-128<<8|r[s++]);var se=r[s++];se&3&&I(0);for(var R=[En,xn,Qn],b=2;b>-1;--b){var V=se>>(b<<1)+2&3;if(V==1){var Z=new L([0,0,r[s++]]);R[b]={s:Z.subarray(2,3),n:Z.subarray(0,1),t:new Ye(Z.buffer,0,1),b:0}}else V==2?(u=Te(r,s,9-(b&1)),s=u[0],R[b]=u[1]):V==3&&(n.t||I(0),R[b]=n.t[b])}var te=n.t=R,Y=te[0],re=te[1],ne=te[2],G=r[y-1];G||I(0);var N=(y<<3)-8+me(G)-ne.b,C=N>>3,S=0,j=(r[C]|r[C+1]<<8)>>(N&7)&(1<>3;var de=(r[C]|r[C+1]<<8)>>(N&7)&(1<>3;var q=(r[C]|r[C+1]<<8)>>(N&7)&(1<>3;var he=1<>>(N&7)&he-1);C=(N-=ft[Ce])>>3;var ae=Fn[Ce]+((r[C]|r[C+1]<<8|r[C+2]<<16)>>(N&7)&(1<>3;var pe=kn[Ue]+((r[C]|r[C+1]<<8|r[C+2]<<16)>>(N&7)&(1<>3,j=ne.t[j]+((r[C]|r[C+1]<<8)>>(N&7)&(1<>3,q=Y.t[q]+((r[C]|r[C+1]<<8)>>(N&7)&(1<>3,de=re.t[de]+((r[C]|r[C+1]<<8)>>(N&7)&(1<3)n.o[2]=n.o[1],n.o[1]=n.o[0],n.o[0]=W-=3;else{var be=W-(pe!=0);be?(W=be==3?n.o[0]-1:n.o[be],be>1&&(n.o[2]=n.o[1]),n.o[1]=n.o[0],n.o[0]=W):W=n.o[0]}for(var b=0;bae&&(A=ae);for(var b=0;b{throw e},u,s=console.log.bind(console),l=console.error.bind(console),h,g=!1,y,E=t=>t.startsWith("file://"),U=!1;function k(){return Ve.buffer}function F(){if(!Z?.buffer?.resizable){var t=k();Z=new Int8Array(t),Re=new Int16Array(t),n.HEAPU8=j=new Uint8Array(t),Ee=new Uint16Array(t),Ke=new Int32Array(t),q=new Uint32Array(t),Pt=new Float32Array(t),$t=new Float64Array(t),bt=new BigInt64Array(t),Ut=new BigUint64Array(t)}}function m(){U=!0,Fe.A()}function x(t){t=`Aborted(${t})`,l(t),g=!0,t+=". Build with -sASSERTIONS for more info.",U&&Rt();var e=new WebAssembly.RuntimeError(t);throw e}var w;let $=()=>"";function D(t){if(t==w&&h)return new Uint8Array(h);throw"both async and sync fetching of the wasm failed"}async function X(t){if(!h)try{var e=await u(t);return new Uint8Array(e)}catch{}return D(t)}async function J(t,e){try{var a=await X(t),o=await WebAssembly.instantiate(a,e);return o}catch(c){l(`failed to asynchronously prepare wasm: ${c}`),x(c)}}async function se(t,e,a){if(!t&&!E(e))try{var o=fetch(e,{credentials:"same-origin"}),c=await WebAssembly.instantiateStreaming(o,a);return c}catch(d){l(`wasm streaming compile failed: ${d}`),l("falling back to ArrayBuffer instantiation")}return J(e,a)}function R(){var t={a:fn};return t}async function b(){function t(d){return Fe=d.exports,pn(Fe),F(),Fe}function e(d){return t(d.instance)}var a=R();w??=$();var o=await se(h,w,a),c=e(o);return c}class V{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var Z,te=()=>Vt,Y=t=>{var e=t.getArg(te(),0);return zt(e)},re=()=>Xt(),ne=t=>Kt(t),G=t=>It(t),N=globalThis.TextDecoder&&new TextDecoder,C=(t,e,a,o)=>{var c=e+a;if(o)return c;for(;t[e]&&!(e>=c);)++e;return e},S=(t,e=0,a,o)=>{var c=C(t,e,a,o);if(c-e>16&&t.buffer&&N)return N.decode(t.subarray(e,c));for(var d="";e>10,56320|M&1023)}}return d},j,de=(t,e,a)=>t?S(j,t,e,a):"",q,Ue=t=>{var e=re(),a=G(4),o=G(4);Ot(t,a,o);var c=q[a>>2],d=q[o>>2],p=de(c);ce(c);var f;return d&&(f=de(d),ce(d)),ne(e),[p,f]},Le=t=>{var e=Y(t);return Ue(e)},Ce=t=>{var e=new WebAssembly.Exception(te(),[t],{traceStack:!0});throw e.message=Le(e),e},Je=()=>x(""),ve={},Me=t=>{for(;t.length;){var e=t.pop(),a=t.pop();a(e)}};function he(t){return this.fromWireType(q[t>>2])}var W={},ae={},pe={};class be extends Error{constructor(e){super(e),this.name="InternalError"}}var ue=t=>{throw new be(t)},A=(t,e,a)=>{t.forEach(f=>pe[f]=e);function o(f){var v=a(f);v.length!==t.length&&ue("Mismatched type converter count");for(var M=0;M{c[f]=ae[v],++p,p===d.length&&o(c)}));d.length===0&&o(c)},Ge=t=>{var e=ve[t];delete ve[t];var a=e.rawConstructor,o=e.rawDestructor,c=e.fields,d=c.map(p=>p.getterReturnType).concat(c.map(p=>p.setterArgumentType));A([t],d,p=>{var f={};for(var[v,M]of c.entries()){let Q=p[v],T=M.getter,P=M.getterContext,_=p[v+c.length],z=M.setter,ee=M.setterContext;f[M.fieldName]={read:O=>Q.fromWireType(T(P,O)),write:(O,K)=>{var ge=[];z(ee,O,_.toWireType(ge,K)),Me(ge)},optional:Q.optional}}return[{name:e.name,fromWireType:Q=>{var T={};for(var P in f)T[P]=f[P].read(Q);return o(Q),T},toWireType:(Q,T)=>{for(var P in f)if(!(P in T)&&!f[P].optional)throw new TypeError(`Missing field: "${P}"`);var _=a();for(P in f)f[P].write(_,T[P]);return Q!==null&&Q.push(o,_),_},readValueFromPointer:he,destructorFunction:o}]})},B=t=>{for(var e="";;){var a=j[t++];if(!a)return e;e+=String.fromCharCode(a)}};class Qe extends Error{constructor(e){super(e),this.name="BindingError"}}var H=t=>{throw new Qe(t)};function nr(t,e,a={}){var o=e.name;if(t||H(`type "${o}" must have a positive integer typeid pointer`),ae.hasOwnProperty(t)){if(a.ignoreDuplicateRegistrations)return;H(`Cannot register type '${o}' twice`)}if(ae[t]=e,delete pe[t],W.hasOwnProperty(t)){var c=W[t];delete W[t],c.forEach(d=>d())}}function le(t,e,a={}){return nr(t,e,a)}var Re,Ee,Ke,bt,Ut,Ct=(t,e,a)=>{switch(e){case 1:return a?o=>Z[o]:o=>j[o];case 2:return a?o=>Re[o>>1]:o=>Ee[o>>1];case 4:return a?o=>Ke[o>>2]:o=>q[o>>2];case 8:return a?o=>bt[o>>3]:o=>Ut[o>>3];default:throw new TypeError(`invalid integer width (${e}): ${t}`)}},ar=(t,e,a,o,c)=>{e=B(e);let d=o===0n,p=f=>f;if(d){let f=a*8;p=v=>BigInt.asUintN(f,v),c=p(c)}le(t,{name:e,fromWireType:p,toWireType:(f,v)=>(typeof v=="number"&&(v=BigInt(v)),v),readValueFromPointer:Ct(e,a,!d),destructorFunction:null})},ir=(t,e,a,o)=>{e=B(e),le(t,{name:e,fromWireType:function(c){return!!c},toWireType:function(c,d){return d?a:o},readValueFromPointer:function(c){return this.fromWireType(j[c])},destructorFunction:null})},or=t=>({count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}),je=t=>{function e(a){return a.$$.ptrType.registeredClass.name}H(e(t)+" instance already deleted")},We=!1,Mt=t=>{},sr=t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)},Qt=t=>{t.count.value-=1;var e=t.count.value===0;e&&sr(t)},xe=t=>globalThis.FinalizationRegistry?(We=new FinalizationRegistry(e=>{Qt(e.$$)}),xe=e=>{var a=e.$$,o=!!a.smartPtr;if(o){var c={$$:a};We.register(e,c,e)}return e},Mt=e=>We.unregister(e),xe(t)):(xe=e=>e,t),ur=()=>{let t=Ie.prototype;Object.assign(t,{isAliasOf(a){if(!(this instanceof Ie)||!(a instanceof Ie))return!1;var o=this.$$.ptrType.registeredClass,c=this.$$.ptr;a.$$=a.$$;for(var d=a.$$.ptrType.registeredClass,p=a.$$.ptr;o.baseClass;)c=o.upcast(c),o=o.baseClass;for(;d.baseClass;)p=d.upcast(p),d=d.baseClass;return o===d&&c===p},clone(){if(this.$$.ptr||je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var a=xe(Object.create(Object.getPrototypeOf(this),{$$:{value:or(this.$$)}}));return a.$$.count.value+=1,a.$$.deleteScheduled=!1,a},delete(){this.$$.ptr||je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&H("Object already scheduled for deletion"),Mt(this),Qt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&H("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});let e=Symbol.dispose;e&&(t[e]=t.delete)};function Ie(){}var Et=(t,e)=>Object.defineProperty(e,"name",{value:t}),xt={},Ae=(t,e,a)=>{if(t[e].overloadTable===void 0){var o=t[e];t[e]=function(...c){return t[e].overloadTable.hasOwnProperty(c.length)||H(`Function '${a}' called with an invalid number of arguments (${c.length}) - expects one of (${t[e].overloadTable})!`),t[e].overloadTable[c.length].apply(this,c)},t[e].overloadTable=[],t[e].overloadTable[o.argCount]=o}},lr=(t,e,a)=>{n.hasOwnProperty(t)?(H(`Cannot register public name '${t}' twice`),Ae(n,t,t),n[t].overloadTable.hasOwnProperty(a)&&H(`Cannot register multiple overloads of a function with the same number of arguments (${a})!`),n[t].overloadTable[a]=e):(n[t]=e,n[t].argCount=a)},cr=48,dr=57,pr=t=>{t=t.replace(/[^a-zA-Z0-9_]/g,"$");var e=t.charCodeAt(0);return e>=cr&&e<=dr?`_${t}`:t};function fr(t,e,a,o,c,d,p,f){this.name=t,this.constructor=e,this.instancePrototype=a,this.rawDestructor=o,this.baseClass=c,this.getActualType=d,this.upcast=p,this.downcast=f,this.pureVirtualFunctions=[]}var et=(t,e,a)=>{for(;e!==a;)e.upcast||H(`Expected null or instance of ${a.name}, got an instance of ${e.name}`),t=e.upcast(t),e=e.baseClass;return t},tt=t=>{if(t===null)return"null";var e=typeof t;return e==="object"||e==="array"||e==="function"?t.toString():""+t};function hr(t,e){if(e===null)return this.isReference&&H(`null is not a valid ${this.name}`),0;e.$$||H(`Cannot pass "${tt(e)}" as a ${this.name}`),e.$$.ptr||H(`Cannot pass deleted object as a pointer of type ${this.name}`);var a=e.$$.ptrType.registeredClass,o=et(e.$$.ptr,a,this.registeredClass);return o}function gr(t,e){var a;if(e===null)return this.isReference&&H(`null is not a valid ${this.name}`),this.isSmartPointer?(a=this.rawConstructor(),t!==null&&t.push(this.rawDestructor,a),a):0;(!e||!e.$$)&&H(`Cannot pass "${tt(e)}" as a ${this.name}`),e.$$.ptr||H(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&e.$$.ptrType.isConst&&H(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);var o=e.$$.ptrType.registeredClass;if(a=et(e.$$.ptr,o,this.registeredClass),this.isSmartPointer)switch(e.$$.smartPtr===void 0&&H("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?a=e.$$.smartPtr:H(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:a=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)a=e.$$.smartPtr;else{var c=e.clone();a=this.rawShare(a,at.toHandle(()=>c.delete())),t!==null&&t.push(this.rawDestructor,a)}break;default:H("Unsupported sharing policy")}return a}function vr(t,e){if(e===null)return this.isReference&&H(`null is not a valid ${this.name}`),0;e.$$||H(`Cannot pass "${tt(e)}" as a ${this.name}`),e.$$.ptr||H(`Cannot pass deleted object as a pointer of type ${this.name}`),e.$$.ptrType.isConst&&H(`Cannot convert argument of type ${e.$$.ptrType.name} to parameter type ${this.name}`);var a=e.$$.ptrType.registeredClass,o=et(e.$$.ptr,a,this.registeredClass);return o}var kt=(t,e,a)=>{if(e===a)return t;if(a.baseClass===void 0)return null;var o=kt(t,e,a.baseClass);return o===null?null:a.downcast(o)},wr={},yr=(t,e)=>{for(e===void 0&&H("ptr should not be undefined");t.baseClass;)e=t.upcast(e),t=t.baseClass;return e},mr=(t,e)=>(e=yr(t,e),wr[e]),Xe=(t,e)=>{(!e.ptrType||!e.ptr)&&ue("makeClassHandle requires ptr and ptrType");var a=!!e.smartPtrType,o=!!e.smartPtr;return a!==o&&ue("Both smartPtrType and smartPtr must be specified"),e.count={value:1},xe(Object.create(t,{$$:{value:e,writable:!0}}))};function br(t){var e=this.getPointee(t);if(!e)return this.destructor(t),null;var a=mr(this.registeredClass,e);if(a!==void 0){if(a.$$.count.value===0)return a.$$.ptr=e,a.$$.smartPtr=t,a.clone();var o=a.clone();return this.destructor(t),o}function c(){return this.isSmartPointer?Xe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:t}):Xe(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var d=this.registeredClass.getActualType(e),p=xt[d];if(!p)return c.call(this);var f;this.isConst?f=p.constPointerType:f=p.pointerType;var v=kt(e,this.registeredClass,f.registeredClass);return v===null?c.call(this):this.isSmartPointer?Xe(f.registeredClass.instancePrototype,{ptrType:f,ptr:v,smartPtrType:this,smartPtr:t}):Xe(f.registeredClass.instancePrototype,{ptrType:f,ptr:v})}var Ur=()=>{Object.assign(ze.prototype,{getPointee(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t},destructor(t){this.rawDestructor?.(t)},readValueFromPointer:he,fromWireType:br})};function ze(t,e,a,o,c,d,p,f,v,M,Q){this.name=t,this.registeredClass=e,this.isReference=a,this.isConst=o,this.isSmartPointer=c,this.pointeeType=d,this.sharingPolicy=p,this.rawGetPointee=f,this.rawConstructor=v,this.rawShare=M,this.rawDestructor=Q,!c&&e.baseClass===void 0?o?(this.toWireType=hr,this.destructorFunction=null):(this.toWireType=vr,this.destructorFunction=null):this.toWireType=gr}var Cr=(t,e,a)=>{n.hasOwnProperty(t)||ue("Replacing nonexistent public symbol"),n[t].overloadTable!==void 0&&a!==void 0?n[t].overloadTable[a]=e:(n[t]=e,n[t].argCount=a)},Mr=t=>Zt.get(t),oe=(t,e,a=!1)=>{t=B(t);function o(){var d=Mr(e);return d}var c=o();return typeof c!="function"&&H(`unknown function pointer with signature ${t}: ${e}`),c};class Qr extends Error{}var Er=t=>{var e=Lt(t),a=B(e);return ce(e),a},Oe=(t,e)=>{var a=[],o={};function c(d){if(!o[d]&&!ae[d]){if(pe[d]){pe[d].forEach(c);return}a.push(d),o[d]=!0}}throw e.forEach(c),new Qr(`${t}: `+a.map(Er).join([", "]))},xr=(t,e,a,o,c,d,p,f,v,M,Q,T,P)=>{Q=B(Q),d=oe(c,d),f&&=oe(p,f),M&&=oe(v,M),P=oe(T,P);var _=pr(Q);lr(_,function(){Oe(`Cannot construct ${Q} due to unbound types`,[o])}),A([t,e,a],o?[o]:[],z=>{z=z[0];var ee,O;o?(ee=z.registeredClass,O=ee.instancePrototype):O=Ie.prototype;var K=Et(Q,function(...st){if(Object.getPrototypeOf(this)!==ge)throw new Qe(`Use 'new' to construct ${Q}`);if(ie.constructor_body===void 0)throw new Qe(`${Q} has no accessible constructor`);var St=ie.constructor_body[st.length];if(St===void 0)throw new Qe(`Tried to invoke ctor of ${Q} with invalid number of parameters (${st.length}) - expected (${Object.keys(ie.constructor_body).toString()}) parameters instead!`);return St.apply(this,st)}),ge=Object.create(O,{constructor:{value:K}});K.prototype=ge;var ie=new fr(Q,K,ge,P,ee,d,f,M);ie.baseClass&&(ie.baseClass.__derivedClasses??=[],ie.baseClass.__derivedClasses.push(ie));var ot=new ze(Q,ie,!0,!1,!1),fe=new ze(Q+"*",ie,!1,!1,!1),Ze=new ze(Q+" const*",ie,!1,!0,!1);return xt[t]={pointerType:fe,constPointerType:Ze},Cr(_,K),[ot,fe,Ze]})};function kr(t){for(var e=1;e{for(var a=[],o=0;o>2]);return a},Ft=t=>{t=t.trim();let e=t.indexOf("(");return e===-1?t:t.slice(0,e)},Fr=(t,e,a,o,c,d,p,f,v)=>{var M=nt(a,o);e=B(e),e=Ft(e),d=oe(c,d,f),A([],[t],Q=>{Q=Q[0];var T=`${Q.name}.${e}`;function P(){Oe(`Cannot call ${T} due to unbound types`,M)}e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var _=Q.registeredClass.constructor;return _[e]===void 0?(P.argCount=a-1,_[e]=P):(Ae(_,e,T),_[e].overloadTable[a-1]=P),A([],M,z=>{var ee=[z[0],null].concat(z.slice(1)),O=rt(T,ee,null,d,p);if(_[e].overloadTable===void 0?(O.argCount=a-1,_[e]=O):_[e].overloadTable[a-1]=O,Q.registeredClass.__derivedClasses)for(let K of Q.registeredClass.__derivedClasses)K.constructor.hasOwnProperty(e)||(K.constructor[e]=O);return[]}),[]})},Nr=(t,e,a,o,c,d)=>{var p=nt(e,a);c=oe(o,c),A([],[t],f=>{f=f[0];var v=`constructor ${f.name}`;if(f.registeredClass.constructor_body===void 0&&(f.registeredClass.constructor_body=[]),f.registeredClass.constructor_body[e-1]!==void 0)throw new Qe(`Cannot register multiple constructors with identical number of parameters (${e-1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return f.registeredClass.constructor_body[e-1]=()=>{Oe(`Cannot construct ${f.name} due to unbound types`,p)},A([],p,M=>(M.splice(1,0,null),f.registeredClass.constructor_body[e-1]=rt(v,M,null,c,d),[])),[]})},Hr=(t,e,a,o,c,d,p,f,v,M)=>{var Q=nt(a,o);e=B(e),e=Ft(e),d=oe(c,d,v),A([],[t],T=>{T=T[0];var P=`${T.name}.${e}`;e.startsWith("@@")&&(e=Symbol[e.substring(2)]),f&&T.registeredClass.pureVirtualFunctions.push(e);function _(){Oe(`Cannot call ${P} due to unbound types`,Q)}var z=T.registeredClass.instancePrototype,ee=z[e];return ee===void 0||ee.overloadTable===void 0&&ee.className!==T.name&&ee.argCount===a-2?(_.argCount=a-2,_.className=T.name,z[e]=_):(Ae(z,e,P),z[e].overloadTable[a-2]=_),A([],Q,O=>{var K=rt(P,O,T,d,p);return z[e].overloadTable===void 0?(K.argCount=a-2,z[e]=K):z[e].overloadTable[a-2]=K,[]}),[]})},Nt=[],we=[0,1,,1,null,1,!0,1,!1,1],Ht=[],Pr=t=>{if(t>9&&--we[t+1]===0){var e=we[t];we[t]=void 0;var a=Ht[t];a&&(Ht[t]=void 0,a(e)),Nt.push(t)}},at={toValue:t=>(t||H(`Cannot use deleted val. handle = ${t}`),we[t]),toHandle:t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let e=Nt.pop()||we.length;return we[e]=t,we[e+1]=1,e}}}},$r={name:"emscripten::val",fromWireType:t=>{var e=at.toValue(t);return Pr(t),e},toWireType:(t,e)=>at.toHandle(e),readValueFromPointer:he,destructorFunction:null},Tr=t=>le(t,$r),Pt,$t,_r=(t,e)=>{switch(e){case 4:return function(a){return this.fromWireType(Pt[a>>2])};case 8:return function(a){return this.fromWireType($t[a>>3])};default:throw new TypeError(`invalid float width (${e}): ${t}`)}},qr=(t,e,a)=>{e=B(e),le(t,{name:e,fromWireType:o=>o,toWireType:(o,c)=>c,readValueFromPointer:_r(e,a),destructorFunction:null})},Lr=(t,e,a,o,c)=>{e=B(e);let d=o===0,p=v=>v;if(d){var f=32-8*a;p=v=>v<>>f,c=p(c)}le(t,{name:e,fromWireType:p,toWireType:(v,M)=>M,readValueFromPointer:Ct(e,a,o!==0),destructorFunction:null})},Jr=(t,e,a)=>{var o=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],c=o[e];function d(p){var f=q[p>>2],v=q[p+4>>2];return new c(Z.buffer,v,f)}a=B(a),le(t,{name:a,fromWireType:d,readValueFromPointer:d},{ignoreDuplicateRegistrations:!0})},Rr=(t,e,a,o)=>{if(!(o>0))return 0;for(var c=a,d=a+o-1,p=0;p=d)break;e[a++]=f}else if(f<=2047){if(a+1>=d)break;e[a++]=192|f>>6,e[a++]=128|f&63}else if(f<=65535){if(a+2>=d)break;e[a++]=224|f>>12,e[a++]=128|f>>6&63,e[a++]=128|f&63}else{if(a+3>=d)break;e[a++]=240|f>>18,e[a++]=128|f>>12&63,e[a++]=128|f>>6&63,e[a++]=128|f&63,p++}}return e[a]=0,a-c},Tt=(t,e,a)=>Rr(t,j,e,a),_t=t=>{for(var e=0,a=0;a=55296&&o<=57343?(e+=4,++a):e+=3}return e},Kr=(t,e)=>{e=B(e),le(t,{name:e,fromWireType(a){var o=q[a>>2],c=a+4,d;return d=de(c,o,!0),ce(a),d},toWireType(a,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var c,d=typeof o=="string";d||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||H("Cannot pass non-string to std::string"),d?c=_t(o):c=o.length;var p=it(4+c+1),f=p+4;return q[p>>2]=c,d?Tt(o,f,c+1):j.set(o,f),a!==null&&a.push(ce,p),p},readValueFromPointer:he,destructorFunction(a){ce(a)}})},qt=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Ir=(t,e,a)=>{var o=t>>1,c=C(Ee,o,e/2,a);if(c-o>16&&qt)return qt.decode(Ee.subarray(o,c));for(var d="",p=o;p{if(a<2)return 0;a-=2;for(var o=e,c=a>1]=p,e+=2}return Re[e>>1]=0,e-o},zr=t=>t.length*2,Or=(t,e,a)=>{for(var o="",c=t>>2,d=0;!(d>=e/4);d++){var p=q[c+d];if(!p&&!a)break;o+=String.fromCodePoint(p)}return o},Vr=(t,e,a=2147483647)=>{if(a<4)return 0;for(var o=e,c=o+a-4,d=0;d65535&&d++,Ke[e>>2]=p,e+=4,e+4>c)break}return Ke[e>>2]=0,e-o},Zr=t=>{for(var e=0,a=0;a65535&&a++,e+=4}return e},Sr=(t,e,a)=>{a=B(a);var o,c,d;e===2?(o=Ir,c=Xr,d=zr):(o=Or,c=Vr,d=Zr),le(t,{name:a,fromWireType:p=>{var f=q[p>>2],v=o(p+4,f*e,!0);return ce(p),v},toWireType:(p,f)=>{typeof f!="string"&&H(`Cannot pass non-string to C++ string type ${a}`);var v=d(f),M=it(4+v+e);return q[M>>2]=v/e,c(f,M+4,v+e),p!==null&&p.push(ce,M),M},readValueFromPointer:he,destructorFunction(p){ce(p)}})},Yr=(t,e,a,o,c,d)=>{ve[t]={name:B(e),rawConstructor:oe(a,o),rawDestructor:oe(c,d),fields:[]}},Br=(t,e,a,o,c,d,p,f,v,M)=>{ve[t].fields.push({fieldName:B(e),getterReturnType:a,getter:oe(o,c),getterContext:d,setterArgumentType:p,setter:oe(f,v),setterContext:M})},Dr=(t,e)=>{e=B(e),le(t,{isVoid:!0,name:e,fromWireType:()=>{},toWireType:(a,o)=>{}})},Gr=()=>{},ke={},jr=t=>{if(t instanceof V||t=="unwind")return y;i(1,t)},Wr=t=>{y=t,i(t,new V(t))},Ar=t=>{if(!g)try{return t()}catch(e){jr(e)}},en=()=>performance.now(),tn=(t,e)=>{if(ke[t]&&(clearTimeout(ke[t].id),delete ke[t]),!e)return 0;var a=setTimeout(()=>{delete ke[t],Ar(()=>Jt(t,en()))},e);return ke[t]={id:a,timeout_ms:e},0},rn=()=>2147483648,nn=(t,e)=>Math.ceil(t/e)*e,an=t=>{var e=Ve.buffer.byteLength,a=(t-e+65535)/65536|0;try{return Ve.grow(a),F(),1}catch{}},on=t=>{var e=j.length;t>>>=0;var a=rn();if(t>a)return!1;for(var o=1;o<=4;o*=2){var c=e*(1+.2/o);c=Math.min(c,t+100663296);var d=Math.min(a,nn(Math.max(t,c),65536)),p=an(d);if(p)return!0}return!1},sn=t=>52;function un(t,e,a,o){return 70}var ln=[null,[],[]],cn=(t,e)=>{var a=ln[t];!e||e===10?((t===1?s:l)(S(a)),a.length=0):a.push(e)},dn=(t,e,a,o)=>{for(var c=0,d=0;d>2],f=q[e+4>>2];e+=8;for(var v=0;v>2]=c,0};ur(),Ur(),n.wasmBinary&&(h=n.wasmBinary),n.UTF8ToString=de,n.stringToUTF8=Tt,n.lengthBytesUTF8=_t;var Lt,it,ce,Jt,Rt,Kt,It,Xt,zt,Ot,Vt,Ve,Zt;function pn(t){Lt=t.B,it=n._malloc=t.C,ce=n._free=t.D,Jt=t.F,Rt=t.G,Kt=t.H,It=t.I,Xt=t.J,zt=t.K,Ot=t.L,Ve=t.z,Zt=t.E,Vt=t.M}var fn={t:Ce,x:Je,f:Ge,i:ar,l:ir,o:xr,b:Fr,n:Nr,d:Hr,y:Tr,h:qr,c:Lr,a:Jr,k:Kr,g:Sr,j:Yr,e:Br,m:Dr,w:Gr,p:tn,u:on,s:sn,q:un,r:dn,v:Wr};async function hn(){!g&&m()}var Fe;return Fe=await b(),await hn(),n}var _n=Tn,qn=new Int8Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,90,63,64,65,66,-1,67,68,69,70,71,-1,72,73,52,53,54,55,56,57,58,59,60,61,74,75,76,77,78,79,80,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,81,-1,82,83,84,85,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,86,87,88,89,-1]);function Ln(r){let n=new Uint8Array(170930),i=0,u=0,s=0,l=-1;for(let h=0,g=r.length;h127)continue;let E=qn[y];if(!(E<0))if(l<0)l=E;else{l+=E*91,u|=l<88?13:14;do n[i++]=u,u>>>=8,s-=8;while(s>7);l=-1}}return l>=0&&(n[i++]=(u|l<""})}function Kn(){ht=void 0}var In=class{_module;constructor(r){this._module=r}malloc(r){let n=this._module._malloc(r);return{ptr:n,size:r,dispose:()=>this.free({ptr:n,size:r,dispose:()=>{}})}}free(r){this._module._free(r.ptr)}dataToHeap(r){let n=this.malloc(r.byteLength);return this._module.HEAPU8.set(r,n.ptr),n}heapView(r){return this._module.HEAPU8.subarray(r.ptr,r.ptr+r.size)}heapToUint8Array(r){return new Uint8Array([...this.heapView(r)])}lengthBytes(r){return this._module.lengthBytesUTF8(r)}stringToHeap(r){let n=this.lengthBytes(r)+1,i=this._module._malloc(n);return this._module.stringToUTF8(r,i,n),{ptr:i,size:n,dispose:()=>this.free({ptr:i,size:n,dispose:()=>{}})}}heapToString(r){return this._module.UTF8ToString(r.ptr,r.size)}hasFilesystem(){let r=this._module;return r.FS_createPath!==void 0&&r.FS_createDataFile!==void 0&&r.FS_preloadFile!==void 0&&r.FS_unlink!==void 0}createPath(r,n=!0,i=!0){return this._module.FS_createPath("/",r,n,i)}createDataFile(r,n,i=!0,u=!0,s=!0){return this._module.FS_createDataFile("/",r,n,i,u,s)}preloadFile(r,n,i=!0,u=!0,s=!1,l=!0,h=!1){return this._module.FS_preloadFile("/",r,n,i,u,s,l,h)}unlink(r){return this._module.FS_unlink(r)}},Ne,Xn=4294967295;function He(r,n){if(!Number.isInteger(r)||r<0||r>Xn)throw new Error(`${n} length ${r} is outside the WASM32-safe range`)}function lt(r){if(r.length===0)return new Uint8Array(0);if(r.length===1)return r[0];let n=0;for(let s of r)n+=s.length;let i=new Uint8Array(n),u=0;for(let s of r)i.set(s,u),u+=s.length;return i}var zn=class Wt{_mainModule;_zstdClass;_zstd;_compressionLevel;_decompressFrameCompleted=!1;_decompressRemaining=0;_decompressSawInput=!1;constructor(n){this._mainModule=new In(n),this._zstdClass=n.zstd,this._zstd=new this._zstdClass,this._compressionLevel=this._zstdClass.defaultCLevel()}static load(){return Ne||(Ne=Rn().then(n=>new Wt(n))),Ne}static unload(){Kn(),Ne?.then(n=>{n?._zstd?.delete()}),Ne=void 0}copyHeap(n){return this._mainModule.heapView(n).slice()}mallocChecked(n,i){He(n,i);let u=this._mainModule.malloc(n);if(!u.ptr)throw this._mainModule.free(u),new Error(`Failed to allocate ${n} bytes for ${i}`);return u}throwStreamError(n,i){throw new Error(`${n} failed: ${i.errorName||"unknown error"}`)}ensureStreamOk(n,i){i.error&&this.throwStreamError(n,i)}version(){return this._zstdClass.version()}reset(){let n=this._zstd.reset();this.ensureStreamOk("reset",n),this._decompressFrameCompleted=!1,this._decompressRemaining=0,this._decompressSawInput=!1}resetCompression(n){n!==void 0&&(this._compressionLevel=n);let i=this._zstd.resetCompression(this._compressionLevel);this.ensureStreamOk("resetCompression",i)}resetDecompression(){let n=this._zstd.resetDecompression();this.ensureStreamOk("resetDecompression",n),this._decompressFrameCompleted=!1,this._decompressRemaining=0,this._decompressSawInput=!1}setCompressionLevel(n){let i=this._zstd.setCompressionLevel(n);this.ensureStreamOk("setCompressionLevel",i),this._compressionLevel=n}compress(n,i=this.defaultCLevel()){He(n.length,"compress input");let u=this._mainModule.dataToHeap(n);try{if(!u.ptr&&n.length>0)throw new Error("Failed to allocate compress input buffer");let s=this._zstdClass.compressBound(n.length),l=this.mallocChecked(s,"compress output");try{if(l.size=this._zstdClass.compress(l.ptr,s,u.ptr,u.size,i),this._zstdClass.isError(l.size))throw new Error(`compress failed: ${this._zstdClass.getErrorName(l.size)}`);return this.copyHeap(l)}finally{this._mainModule.free(l)}}finally{this._mainModule.free(u)}}compressChunk(n){if(He(n.length,"compressChunk input"),n.length===0)return new Uint8Array(0);let i=this._mainModule.dataToHeap(n);try{if(!i.ptr)throw new Error("Failed to allocate compressChunk input buffer");let u=this._zstdClass.CStreamOutSize(),s=[],l=0;for(;l0&&(h.size=g.produced,s.push(this.copyHeap(h)))}finally{this._mainModule.free(h)}}return lt(s)}finally{this._mainModule.free(i)}}compressEnd(){let n=this._zstdClass.CStreamOutSize(),i=[],u=1;for(;u!==0;){let s=this.mallocChecked(n,"compressEnd output");try{let l=this._zstd.compressEnd(s.ptr,n);if(this.ensureStreamOk("compressEnd",l),l.produced===0&&l.remaining!==0)throw new Error("compressEnd failed: no progress while finishing stream");u=l.remaining,l.produced>0&&(s.size=l.produced,i.push(this.copyHeap(s)))}finally{this._mainModule.free(s)}}return lt(i)}frameContentSize(n){return this._zstdClass.getFrameContentSize(n.ptr,n.size)}decompress(n){He(n.length,"decompress input");let i=this._mainModule.dataToHeap(n);try{if(!i.ptr&&n.length>0)throw new Error("Failed to allocate decompress input buffer");let u=this.frameContentSize(i);if(u.error)throw new Error(`Failed to get frame content size: ${u.errorName}`);let s=u.known;if(s){let l=this._zstdClass.findFrameCompressedSize(i.ptr,i.size);if(this._zstdClass.isError(l))throw new Error(`Failed to find frame compressed size: ${this._zstdClass.getErrorName(l)}`);l0?i.ptr+l:0,U=this._zstd.decompressChunk(g.ptr,u,E,y);if(this.ensureStreamOk("decompressChunk",U),U.consumed===0&&U.produced===0){if(y===0){U.remaining>0&&(this._decompressRemaining=U.remaining);break}throw new Error("decompressChunk failed: no progress while consuming input")}l+=U.consumed,h=U.produced===u&&U.remaining!==0,U.produced>0&&(g.size=U.produced,s.push(this.copyHeap(g))),U.remaining===0?(this._decompressFrameCompleted=!0,this._decompressRemaining=0):this._decompressRemaining=U.remaining}finally{this._mainModule.free(g)}}return lt(s)}finally{this._mainModule.free(i)}}decompressEnd(){if(!this._decompressSawInput)throw new Error("decompressEnd failed: empty compressed input is not a completed frame");if(!this._decompressFrameCompleted||this._decompressRemaining!==0)throw new Error("decompressEnd failed: truncated Zstandard input")}defaultCLevel(){return this._zstdClass.defaultCLevel()}minCLevel(){return this._zstdClass.minCLevel()}maxCLevel(){return this._zstdClass.maxCLevel()}};let ct=null;function On(){return ct||(ct=zn.load()),ct}function Vn(r){return r.length>=4&&r[0]===40&&r[1]===181&&r[2]===47&&r[3]===253}function gt(r){const n="SQLite format 3\0";if(r.length +

🏠 Главная

+

Локальное сохранение и повторения — всё работает офлайн.

+
Проверка локальной базы…
+
+ +
+ + + `;const i=r.querySelector("#home-db-status"),u=r.querySelector("#btn-go-sync"),s=r.querySelector("#home-actions"),l=r.querySelector("#btn-start");u.addEventListener("click",()=>n.goSync()),l.addEventListener("click",()=>{i.textContent="Экран повторений — следующий шаг."}),(async()=>{if(!await Se()){i.textContent="Локальной базы нет. Скачай сохранение на странице «Синхронизация».",s.hidden=!0;return}try{const g=await vn(),y=gt(g);i.textContent=y?`Локальная база на месте: ${(g.length/1024).toFixed(1)} КБ, сигнатура SQLite OK.`:"Файл в OPFS есть, но это не похоже на SQLite — перекачай сохранение.",s.hidden=!y}catch(g){i.textContent=`Не удалось прочитать базу: ${g instanceof Error?g.message:String(g)}`,s.hidden=!0}})()}const Bt=24,Yn=/^[A-Za-z0-9]{24}$/,At="japlearn_sync_token";function Dt(r){return r.trim().replace(/\s+/g,"")}function ye(r){return Yn.test(r)}function Bn(){try{return localStorage.getItem(At)??""}catch{return""}}function dt(r){try{localStorage.setItem(At,r)}catch{}}const er="https://learning.micialware.ru";function Dn(r,n=er){return`${n.replace(/\/+$/,"")}/download/${encodeURIComponent(r)}`}async function Gn(r,n,i=er){const u=Dn(r,i);let s;try{s=await fetch(u,{method:"GET",...n})}catch(h){throw new Error(`Нет связи с сервером: ${h instanceof Error?h.message:String(h)}`)}if(!s.ok)throw s.status===404?new Error("Сохранение не найдено (404). Проверь токен."):new Error(`Сервер ответил ${s.status} ${s.statusText}`);const l=await s.arrayBuffer();if(l.byteLength===0)throw new Error("Сервер вернул пустой файл");return new Uint8Array(l)}function jn(r){r.innerHTML=` +
+

📡 Синхронизация

+

Токен сохранения — 24 символа: латинские буквы и цифры.

+ + + +
+ + 0 / 24 +
+ +
+ + +
+ +

Введите токен из 24 символов

+
+ `;const n=r.querySelector("#token-input"),i=r.querySelector("#token-error"),u=r.querySelector("#token-counter"),s=r.querySelector("#btn-download"),l=r.querySelector("#btn-upload"),h=r.querySelector("#status");function g(m){h.textContent=m,console.log(`[JapLearn] ${m}`)}function y(){return Dt(n.value)}function E(m){s.disabled=m||!ye(y()),l.disabled=!0,n.disabled=m,m||Se().then(x=>{!n.disabled&&ye(y())&&(l.disabled=!x)})}function U(){const m=y(),x=m.length;u.textContent=`${x} / ${Bt}`;const w=ye(m),$=x===0;n.classList.toggle("invalid",!$&&!w),n.setAttribute("aria-invalid",String(!$&&!w)),$?i.textContent="":x!==Bt?i.textContent=`Нужно 24 символа, сейчас ${x}`:i.textContent=w?"":"Только латинские буквы и цифры",s.disabled=!w,w?Se().then(D=>{n.disabled||(l.disabled=!D)}):l.disabled=!0}async function k(){const m=y();if(ye(m)){dt(m),E(!0),g("Скачивание сохранения...");try{const x=await Gn(m);g(`Скачано ${(x.length/1024).toFixed(1)} КБ, распаковка...`);const w=await Zn(x);g(`Распаковано ${(w.length/1024).toFixed(1)} КБ, сохранение в OPFS...`),await gn(w),g(`Готово: база ${(w.length/1024).toFixed(1)} КБ сохранена локально (OPFS).`)}catch(x){g(`Ошибка скачивания: ${x instanceof Error?x.message:String(x)}`)}finally{E(!1),U()}}}n.addEventListener("input",()=>{U()}),n.addEventListener("change",()=>{const m=y();n.value=m,ye(m)&&(dt(m),g("Токен сохранён локально. Можно скачивать или выгружать.")),U()}),s.addEventListener("click",()=>{k()}),l.addEventListener("click",()=>{const m=y();ye(m)&&(dt(m),g("Выгрузка — следующий шаг (POST /upload/stream/{id})."))});const F=Bn();F&&(n.value=F),U(),ye(Dt(F))&&Se().then(m=>{g(m?"Токен восстановлен, локальная база на месте.":"Токен восстановлен. Нажми «Скачать», чтобы получить базу."),U()})}const Wn={home:"Главная",sync:"Синхронизация"};function _e(r){const n=document.getElementById(r);if(!n)throw new Error(`[JapLearn] Не найден элемент #${r}`);return n}const tr=_e("burger-btn"),Be=_e("drawer"),rr=_e("drawer-overlay"),An=_e("page-title"),Gt=_e("page");let yt=!1;function qe(r){yt=r,Be.classList.toggle("open",r),rr.hidden=!r,tr.setAttribute("aria-expanded",String(r)),Be.setAttribute("aria-hidden",String(!r)),document.body.classList.toggle("drawer-open",r)}function ea(r){Be.querySelectorAll(".drawer-btn").forEach(n=>{n.classList.toggle("active",n.dataset.page===r)})}function mt(r){An.textContent=Wn[r],ea(r),r==="home"?Sn(Gt,{goSync:()=>mt("sync")}):jn(Gt)}tr.addEventListener("click",()=>{qe(!yt)});rr.addEventListener("click",()=>{qe(!1)});document.addEventListener("keydown",r=>{r.key==="Escape"&&yt&&qe(!1)});Be.querySelectorAll(".drawer-btn").forEach(r=>{r.addEventListener("click",()=>{const n=r.dataset.page;(n==="home"||n==="sync")&&mt(n),qe(!1)})});qe(!1);mt("home");console.log("[JapLearn] crossOriginIsolated =",window.crossOriginIsolated); diff --git a/dist/assets/index-DhXfM6jc.css b/dist/assets/index-DhXfM6jc.css new file mode 100644 index 0000000..acf7f31 --- /dev/null +++ b/dist/assets/index-DhXfM6jc.css @@ -0,0 +1 @@ +:root{font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;line-height:1.5;color:#1e1b2e;background:#f4f1fa}*{box-sizing:border-box}body{margin:0;min-height:100dvh;display:flex;justify-content:center;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}#app{width:100%;max-width:480px;padding:24px 16px 32px;display:flex;flex-direction:column;gap:16px}.app-header h1{margin:0;font-size:1.75rem;letter-spacing:.02em}.app-subtitle{margin:4px 0 0;color:#6d6390}.top-bar{display:flex;align-items:center;gap:12px}.burger-btn{width:44px;height:44px;border:2px solid #d9d2f0;border-radius:12px;background:#fff;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;touch-action:manipulation;flex:none}.burger-btn span{display:block;width:20px;height:2px;border-radius:2px;background:#4c446b}.burger-btn[aria-expanded=true]{border-color:#7c3aed}.top-bar-title h1{margin:0;font-size:1.4rem;line-height:1.2}.top-bar-title p{margin:0;font-size:.9rem;color:#6d6390}.top-bar-spacer{flex:1}.app-content{display:flex;flex-direction:column;gap:16px}.drawer-overlay{position:fixed;inset:0;background:#1e1b2e73;z-index:40}.drawer-overlay[hidden]{display:none}.drawer{position:fixed;top:0;left:0;bottom:0;width:min(300px,85vw);background:#fff;z-index:50;transform:translate(-105%);transition:transform .22s ease;display:flex;flex-direction:column;gap:8px;padding:20px 14px;box-shadow:8px 0 32px #1e1b2e2e}.drawer.open{transform:translate(0)}.drawer-header{padding:4px 8px 14px;border-bottom:1px solid #eee9fb;margin-bottom:8px}.drawer-logo{font-size:1.3rem;font-weight:800;color:#7c3aed}.drawer-subtitle{font-size:.9rem;color:#6d6390}.drawer-btn{border:none;background:transparent;text-align:left;font-size:1.05rem;font-weight:600;color:#1e1b2e;padding:13px 12px;border-radius:12px;cursor:pointer;touch-action:manipulation}.drawer-btn.active{background:#f1eafe;color:#6d28d9}.drawer-btn:active{background:#e9defc}body.drawer-open{overflow:hidden}.card{background:#fff;border-radius:16px;padding:20px 16px;box-shadow:0 8px 24px #7c3aed1f;display:flex;flex-direction:column;gap:12px}.card-title{margin:0;font-size:1.25rem}.card-hint{margin:0;color:#6d6390;font-size:.95rem}.field-label{font-weight:600;font-size:.95rem}.token-input{width:100%;padding:14px 12px;font-size:1.05rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.04em;border:2px solid #d9d2f0;border-radius:12px;outline:none}.token-input:focus{border-color:#7c3aed}.token-input.invalid{border-color:#dc2626;background:#fef2f2}.token-meta{display:flex;justify-content:space-between;align-items:baseline;gap:8px;min-height:1.4em}.token-error{color:#dc2626;font-size:.9rem}.token-counter{color:#6d6390;font-variant-numeric:tabular-nums;white-space:nowrap}.btn-row{display:flex;gap:12px}.btn{flex:1;padding:14px 12px;font-size:1rem;font-weight:600;border-radius:12px;border:2px solid #7c3aed;background:#fff;color:#7c3aed;cursor:pointer;touch-action:manipulation}.btn-primary{background:#7c3aed;color:#fff}.btn:disabled{opacity:.4;cursor:not-allowed}.btn:not(:disabled):active{transform:scale(.98)}.status-bar{margin:0;padding:10px 12px;border-radius:10px;background:#f4f1fa;color:#4c446b;font-size:.95rem;word-break:break-word} diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 0000000..33ae18c --- /dev/null +++ b/dist/index.html @@ -0,0 +1,41 @@ + + + + + + + JapLearn — интервальные повторения + + + + +
+
+ +
+

JapLearn

+

Главная

+
+
+
+ + + + +
+ +
+
+ + diff --git a/index.html b/index.html index 0186332..4c18f70 100644 --- a/index.html +++ b/index.html @@ -2,64 +2,39 @@ - - - + + JapLearn — интервальные повторения -
-
-

JapLearn

-

Интервальные повторения · офлайн-первая

+
+
+ +
+

JapLearn

+

Главная

+
+
-
-

Сохранение

-

- База данных хранится локально на устройстве. Токен связывает её - с копией на сервере — скачивайте и выгружайте файл по мере - необходимости. -

-
-
- - -

- Последовательность из 24 символов: латинские буквы (A–Z) - и цифры (0–9). -

- -
+ + -
- - -
-
-

-

-
- - -
+
+ +
+ - \ No newline at end of file + diff --git a/node_modules/.bin/esbuild b/node_modules/.bin/esbuild new file mode 120000 index 0000000..c83ac07 --- /dev/null +++ b/node_modules/.bin/esbuild @@ -0,0 +1 @@ +../esbuild/bin/esbuild \ No newline at end of file diff --git a/node_modules/.bin/nanoid b/node_modules/.bin/nanoid new file mode 120000 index 0000000..e2be547 --- /dev/null +++ b/node_modules/.bin/nanoid @@ -0,0 +1 @@ +../nanoid/bin/nanoid.cjs \ No newline at end of file diff --git a/node_modules/.bin/rollup b/node_modules/.bin/rollup new file mode 120000 index 0000000..5939621 --- /dev/null +++ b/node_modules/.bin/rollup @@ -0,0 +1 @@ +../rollup/dist/bin/rollup \ No newline at end of file diff --git a/node_modules/.bin/sqlite-wasm b/node_modules/.bin/sqlite-wasm new file mode 120000 index 0000000..c72bbd5 --- /dev/null +++ b/node_modules/.bin/sqlite-wasm @@ -0,0 +1 @@ +../@sqlite.org/sqlite-wasm/bin/index.js \ No newline at end of file diff --git a/node_modules/.bin/tsc b/node_modules/.bin/tsc new file mode 120000 index 0000000..0863208 --- /dev/null +++ b/node_modules/.bin/tsc @@ -0,0 +1 @@ +../typescript/bin/tsc \ No newline at end of file diff --git a/node_modules/.bin/tsserver b/node_modules/.bin/tsserver new file mode 120000 index 0000000..f8f8f1a --- /dev/null +++ b/node_modules/.bin/tsserver @@ -0,0 +1 @@ +../typescript/bin/tsserver \ No newline at end of file diff --git a/node_modules/.bin/vite b/node_modules/.bin/vite new file mode 120000 index 0000000..6d1e3be --- /dev/null +++ b/node_modules/.bin/vite @@ -0,0 +1 @@ +../vite/bin/vite.js \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000..a9a2f29 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,374 @@ +{ + "name": "jap_web", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@hpcc-js/wasm-zstd": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/@hpcc-js/wasm-zstd/-/wasm-zstd-1.16.0.tgz", + "integrity": "sha512-+F+GRnqsbcVvr6vlSivB+YYOYNaDt21CAwfp0ru9mPeYeVPX6YFCu8fZaARuyklZZ9/9uUAs5qymEfnXKBZl8g==", + "license": "Apache-2.0" + }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.63.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.2.tgz", + "integrity": "sha512-bcq2h2pkKmH2po4cZV8VWzO4lL40STyu/nLoFpYMQp9C2tCVNTdcVv86MwSsn3D5s1FBe2Ty1atqvVAUTMimNg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@sqlite.org/sqlite-wasm": { + "version": "3.50.4-build1", + "resolved": "https://registry.npmjs.org/@sqlite.org/sqlite-wasm/-/sqlite-wasm-3.50.4-build1.tgz", + "integrity": "sha512-Qig2Wso7gPkU1PtXwFzndh+CTRzrIFxVGqv6eCetjU7YqxlHItj+GvQYwYTppCRgAPawtRN/4AJcEgB9xDHGug==", + "license": "Apache-2.0", + "bin": { + "sqlite-wasm": "bin/index.js" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/nanoid": { + "version": "3.3.19", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz", + "integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.28", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", + "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.18", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/rollup": { + "version": "4.63.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.63.2.tgz", + "integrity": "sha512-l5eyksV4tPBj6lJyEa37YzIOCSOV7lkZzEHUdpjWZbtD7wTcFYmEYXSgm5bT4vV+dZLb9rBG1W9GROOG4NS4Ew==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@rollup/rollup-android-arm-eabi": "4.63.2", + "@rollup/rollup-android-arm64": "4.63.2", + "@rollup/rollup-darwin-arm64": "4.63.2", + "@rollup/rollup-darwin-x64": "4.63.2", + "@rollup/rollup-freebsd-arm64": "4.63.2", + "@rollup/rollup-freebsd-x64": "4.63.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.63.2", + "@rollup/rollup-linux-arm-musleabihf": "4.63.2", + "@rollup/rollup-linux-arm64-gnu": "4.63.2", + "@rollup/rollup-linux-arm64-musl": "4.63.2", + "@rollup/rollup-linux-loong64-gnu": "4.63.2", + "@rollup/rollup-linux-loong64-musl": "4.63.2", + "@rollup/rollup-linux-ppc64-gnu": "4.63.2", + "@rollup/rollup-linux-ppc64-musl": "4.63.2", + "@rollup/rollup-linux-riscv64-gnu": "4.63.2", + "@rollup/rollup-linux-riscv64-musl": "4.63.2", + "@rollup/rollup-linux-s390x-gnu": "4.63.2", + "@rollup/rollup-linux-x64-gnu": "4.63.2", + "@rollup/rollup-linux-x64-musl": "4.63.2", + "@rollup/rollup-openbsd-x64": "4.63.2", + "@rollup/rollup-openharmony-arm64": "4.63.2", + "@rollup/rollup-win32-arm64-msvc": "4.63.2", + "@rollup/rollup-win32-ia32-msvc": "4.63.2", + "@rollup/rollup-win32-x64-gnu": "4.63.2", + "@rollup/rollup-win32-x64-msvc": "4.63.2", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/vite": { + "version": "7.3.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.6.tgz", + "integrity": "sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.27.0 || ^0.28.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + } + } +} diff --git a/node_modules/.vite/deps/@hpcc-js_wasm-zstd.js b/node_modules/.vite/deps/@hpcc-js_wasm-zstd.js new file mode 100644 index 0000000..534f51e --- /dev/null +++ b/node_modules/.vite/deps/@hpcc-js_wasm-zstd.js @@ -0,0 +1,1283 @@ +// node_modules/@hpcc-js/wasm-zstd/dist/index.js +var mi = ArrayBuffer; +var N = Uint8Array; +var De = Uint16Array; +var _i = Int16Array; +var Ge = Int32Array; +var ur = function(n2, i, s) { + if (N.prototype.slice) return N.prototype.slice.call(n2, i, s); + (i == null || i < 0) && (i = 0), (s == null || s > n2.length) && (s = n2.length); + var c = new N(s - i); + return c.set(n2.subarray(i, s)), c; +}; +var Re = function(n2, i, s, c) { + if (N.prototype.fill) return N.prototype.fill.call(n2, i, s, c); + for ((s == null || s < 0) && (s = 0), (c == null || c > n2.length) && (c = n2.length); s < c; ++s) n2[s] = i; + return n2; +}; +var Ui = function(n2, i, s, c) { + if (N.prototype.copyWithin) return N.prototype.copyWithin.call(n2, i, s, c); + for ((s == null || s < 0) && (s = 0), (c == null || c > n2.length) && (c = n2.length); s < c; ) n2[i++] = n2[s++]; +}; +var bi = ["invalid zstd data", "window size too large (>2046MB)", "invalid block type", "FSE accuracy too high", "match distance too far back", "unexpected EOF"]; +var k = function(n2, i, s) { + var c = new Error(i || bi[n2]); + if (c.code = n2, Error.captureStackTrace && Error.captureStackTrace(c, k), !s) throw c; + return c; +}; +var Lr = function(n2, i, s) { + for (var c = 0, l = 0; c < s; ++c) l |= n2[i++] << (c << 3); + return l; +}; +var Ci = function(n2, i) { + return (n2[i] | n2[i + 1] << 8 | n2[i + 2] << 16 | n2[i + 3] << 24) >>> 0; +}; +var Mi = function(n2, i) { + var s = n2[0] | n2[1] << 8 | n2[2] << 16; + if (s == 3126568 && n2[3] == 253) { + var c = n2[4], l = c >> 5 & 1, p = c >> 2 & 1, h = c & 3, d = c >> 6; + c & 8 && k(0); + var U = 6 - l, C = h == 3 ? 4 : h, M = Lr(n2, U, C); + U += C; + var Q = d ? 1 << d : l, x = Lr(n2, U, Q) + (d == 1 && 256), R = x; + if (!l) { + var Z = 1 << 10 + (n2[5] >> 3); + R = Z + (Z >> 3) * (n2[5] & 7); + } + R > 2145386496 && k(1); + var b = new N((i == 1 ? x || R : i ? 0 : R) + 12); + return b[0] = 1, b[4] = 4, b[8] = 8, { b: U + Q, y: 0, l: 0, d: M, w: i && i != 1 ? i : b.subarray(12), e: R, o: new Ge(b.buffer, 0, 3), u: x, c: p, m: Math.min(131072, R) }; + } else if ((s >> 4 | n2[3] << 20) == 25481893) return Ci(n2, 4) + 8; + k(0); +}; +var me = function(n2) { + for (var i = 0; 1 << i <= n2; ++i) ; + return i - 1; +}; +var $e = function(n2, i, s) { + var c = (i << 3) + 4, l = (n2[i] & 15) + 5; + l > s && k(3); + for (var p = 1 << l, h = p, d = -1, U = -1, C = -1, M = p, Q = new mi(512 + (p << 2)), x = new _i(Q, 0, 256), R = new De(Q, 0, 256), Z = new De(Q, 512, p), b = 512 + (p << 1), q = new N(Q, b, p), te = new N(Q, b + p); d < 255 && h > 0; ) { + var V = me(h + 1), K = c >> 3, ie = (1 << V + 1) - 1, $ = (n2[K] | n2[K + 1] << 8 | n2[K + 2] << 16) >> (c & 7) & ie, y = (1 << V) - 1, L = ie - h - 1, O = $ & y; + if (O < L ? (c += V, $ = O) : (c += V + 1, $ > y && ($ -= L)), x[++d] = --$, $ == -1 ? (h += $, q[--M] = d) : h -= $, !$) do { + var W = c >> 3; + U = (n2[W] | n2[W + 1] << 8) >> (c & 7) & 3, c += 2, d += U; + } while (U == 3); + } + (d > 255 || h) && k(0); + for (var Y = 0, A = (p >> 1) + (p >> 3) + 3, ee = p - 1, D = 0; D <= d; ++D) { + var P = x[D]; + if (P < 1) { + R[D] = -P; + continue; + } + for (C = 0; C < P; ++C) { + q[Y] = D; + do + Y = Y + A & ee; + while (Y >= M); + } + } + for (Y && k(0), C = 0; C < p; ++C) { + var m = R[q[C]]++, S = te[C] = l - me(m); + Z[C] = (m << S) - p; + } + return [c + 7 >> 3, { b: l, s: q, n: te, t: Z }]; +}; +var Pi = function(n2, i) { + var s = 0, c = -1, l = new N(292), p = n2[i], h = l.subarray(0, 256), d = l.subarray(256, 268), U = new De(l.buffer, 268); + if (p < 128) { + var C = $e(n2, i + 1, 6), M = C[0], Q = C[1]; + i += p; + var x = M << 3, R = n2[i]; + R || k(0); + for (var Z = 0, b = 0, q = Q.b, te = q, V = (++i << 3) - 8 + me(R); V -= q, !(V < x); ) { + var K = V >> 3; + if (Z += (n2[K] | n2[K + 1] << 8) >> (V & 7) & (1 << q) - 1, h[++c] = Q.s[Z], V -= te, V < x) break; + K = V >> 3, b += (n2[K] | n2[K + 1] << 8) >> (V & 7) & (1 << te) - 1, h[++c] = Q.s[b], q = Q.n[Z], Z = Q.t[Z], te = Q.n[b], b = Q.t[b]; + } + ++c > 255 && k(0); + } else { + for (c = p - 127; s < c; s += 2) { + var ie = n2[++i]; + h[s] = ie >> 4, h[s + 1] = ie & 15; + } + ++i; + } + var $ = 0; + for (s = 0; s < c; ++s) { + var y = h[s]; + y > 11 && k(0), $ += y && 1 << y - 1; + } + var L = me($) + 1, O = 1 << L, W = O - $; + for (W & W - 1 && k(0), h[c++] = me(W) + 1, s = 0; s < c; ++s) { + var y = h[s]; + ++d[h[s] = y && L + 1 - y]; + } + var Y = new N(O << 1), A = Y.subarray(0, O), ee = Y.subarray(O); + for (U[L] = 0, s = L; s > 0; --s) { + var D = U[s]; + Re(ee, s, D, U[s - 1] = D + d[s] * (1 << L - s)); + } + for (U[0] != O && k(0), s = 0; s < c; ++s) { + var P = h[s]; + if (P) { + var m = U[P]; + Re(A, s, m, U[P] = m + (1 << L - P)); + } + } + return [i, { n: ee, b: L, s: A }]; +}; +var Qi = $e(new N([81, 16, 99, 140, 49, 198, 24, 99, 12, 33, 196, 24, 99, 102, 102, 134, 70, 146, 4]), 0, 6)[1]; +var Fi = $e(new N([33, 20, 196, 24, 99, 140, 33, 132, 16, 66, 8, 33, 132, 16, 66, 8, 33, 68, 68, 68, 68, 68, 68, 68, 68, 36, 9]), 0, 6)[1]; +var Hi = $e(new N([32, 132, 16, 66, 102, 70, 68, 68, 68, 68, 36, 73, 2]), 0, 5)[1]; +var Yr = function(n2, i) { + for (var s = n2.length, c = new Ge(s), l = 0; l < s; ++l) c[l] = i, i += 1 << n2[l]; + return c; +}; +var cr = new N(new Ge([0, 0, 0, 0, 16843009, 50528770, 134678020, 202050057, 269422093]).buffer, 0, 36); +var xi = Yr(cr, 0); +var lr = new N(new Ge([0, 0, 0, 0, 0, 0, 0, 0, 16843009, 50528770, 117769220, 185207048, 252579084, 16]).buffer, 0, 53); +var Ti = Yr(lr, 3); +var qe = function(n2, i, s) { + var c = n2.length, l = i.length, p = n2[c - 1], h = (1 << s.b) - 1, d = -s.b; + p || k(0); + for (var U = 0, C = s.b, M = (c << 3) - 8 + me(p) - C, Q = -1; M > d && Q < l; ) { + var x = M >> 3, R = (n2[x] | n2[x + 1] << 8 | n2[x + 2] << 16) >> (M & 7); + U = (U << C | R) & h, i[++Q] = s.s[U], M -= C = s.n[U]; + } + (M != d || Q + 1 != l) && k(0); +}; +var Ei = function(n2, i, s) { + var c = 6, l = i.length, p = l + 3 >> 2, h = p << 1, d = p + h; + qe(n2.subarray(c, c += n2[0] | n2[1] << 8), i.subarray(0, p), s), qe(n2.subarray(c, c += n2[2] | n2[3] << 8), i.subarray(p, h), s), qe(n2.subarray(c, c += n2[4] | n2[5] << 8), i.subarray(h, d), s), qe(n2.subarray(c), i.subarray(d), s); +}; +var qi = function(n2, i, s) { + var c, l = i.b, p = n2[l], h = p >> 1 & 3; + i.l = p & 1; + var d = p >> 3 | n2[l + 1] << 5 | n2[l + 2] << 13, U = (l += 3) + d; + if (h == 1) return l >= n2.length ? void 0 : (i.b = l + 1, s ? (Re(s, n2[l], i.y, i.y += d), s) : Re(new N(d), n2[l])); + if (!(U > n2.length)) { + if (h == 0) return i.b = U, s ? (s.set(n2.subarray(l, U), i.y), i.y += d, s) : ur(n2, l, U); + if (h == 2) { + var C = n2[l], M = C & 3, Q = C >> 2 & 3, x = C >> 4, R = 0, Z = 0; + M < 2 ? Q & 1 ? x |= n2[++l] << 4 | (Q & 2 && n2[++l] << 12) : x = C >> 3 : (Z = Q, Q < 2 ? (x |= (n2[++l] & 63) << 4, R = n2[l] >> 6 | n2[++l] << 2) : Q == 2 ? (x |= n2[++l] << 4 | (n2[++l] & 3) << 12, R = n2[l] >> 2 | n2[++l] << 6) : (x |= n2[++l] << 4 | (n2[++l] & 63) << 12, R = n2[l] >> 6 | n2[++l] << 2 | n2[++l] << 10)), ++l; + var b = s ? s.subarray(i.y, i.y + i.m) : new N(i.m), q = b.length - x; + if (M == 0) b.set(n2.subarray(l, l += x), q); + else if (M == 1) Re(b, n2[l++], q); + else { + var te = i.h; + if (M == 2) { + var V = Pi(n2, l); + R += l - (l = V[0]), i.h = te = V[1]; + } else te || k(0); + (Z ? Ei : qe)(n2.subarray(l, l += R), b.subarray(q), te); + } + var K = n2[l++]; + if (K) { + K == 255 ? K = (n2[l++] | n2[l++] << 8) + 32512 : K > 127 && (K = K - 128 << 8 | n2[l++]); + var ie = n2[l++]; + ie & 3 && k(0); + for (var $ = [Fi, Hi, Qi], y = 2; y > -1; --y) { + var L = ie >> (y << 1) + 2 & 3; + if (L == 1) { + var O = new N([0, 0, n2[l++]]); + $[y] = { s: O.subarray(2, 3), n: O.subarray(0, 1), t: new De(O.buffer, 0, 1), b: 0 }; + } else L == 2 ? (c = $e(n2, l, 9 - (y & 1)), l = c[0], $[y] = c[1]) : L == 3 && (i.t || k(0), $[y] = i.t[y]); + } + var W = i.t = $, Y = W[0], A = W[1], ee = W[2], D = n2[U - 1]; + D || k(0); + var P = (U << 3) - 8 + me(D) - ee.b, m = P >> 3, S = 0, _e = (n2[m] | n2[m + 1] << 8) >> (P & 7) & (1 << ee.b) - 1; + m = (P -= A.b) >> 3; + var Ue = (n2[m] | n2[m + 1] << 8) >> (P & 7) & (1 << A.b) - 1; + m = (P -= Y.b) >> 3; + var ge = (n2[m] | n2[m + 1] << 8) >> (P & 7) & (1 << Y.b) - 1; + for (++K; --K; ) { + var be = ee.s[_e], Qe = ee.n[_e], Ce = Y.s[ge], G = Y.n[ge], de = A.s[Ue], z = A.n[Ue]; + m = (P -= de) >> 3; + var ke = 1 << de, ue = ke + ((n2[m] | n2[m + 1] << 8 | n2[m + 2] << 16 | n2[m + 3] << 24) >>> (P & 7) & ke - 1); + m = (P -= lr[Ce]) >> 3; + var we = Ti[Ce] + ((n2[m] | n2[m + 1] << 8 | n2[m + 2] << 16) >> (P & 7) & (1 << lr[Ce]) - 1); + m = (P -= cr[be]) >> 3; + var Me = xi[be] + ((n2[m] | n2[m + 1] << 8 | n2[m + 2] << 16) >> (P & 7) & (1 << cr[be]) - 1); + if (m = (P -= Qe) >> 3, _e = ee.t[_e] + ((n2[m] | n2[m + 1] << 8) >> (P & 7) & (1 << Qe) - 1), m = (P -= G) >> 3, ge = Y.t[ge] + ((n2[m] | n2[m + 1] << 8) >> (P & 7) & (1 << G) - 1), m = (P -= z) >> 3, Ue = A.t[Ue] + ((n2[m] | n2[m + 1] << 8) >> (P & 7) & (1 << z) - 1), ue > 3) i.o[2] = i.o[1], i.o[1] = i.o[0], i.o[0] = ue -= 3; + else { + var ce = ue - (Me != 0); + ce ? (ue = ce == 3 ? i.o[0] - 1 : i.o[ce], ce > 1 && (i.o[2] = i.o[1]), i.o[1] = i.o[0], i.o[0] = ue) : ue = i.o[0]; + } + for (var y = 0; y < Me; ++y) b[S + y] = b[q + y]; + S += Me, q += Me; + var fe = S - ue; + if (fe < 0) { + var ne = -fe, ve = i.e + fe; + ne > we && (ne = we); + for (var y = 0; y < ne; ++y) b[S + y] = i.w[ve + y]; + S += ne, we -= ne, fe = 0; + } + for (var y = 0; y < we; ++y) b[S + y] = b[fe + y]; + S += we; + } + if (S != q) for (; q < b.length; ) b[S++] = b[q++]; + else S = b.length; + s ? i.y += S : b = ur(b, 0, S); + } else if (s) { + if (i.y += x, q) for (var y = 0; y < x; ++y) b[y] = b[q + y]; + } else q && (b = ur(b, q)); + return i.b = U, b; + } + k(2); + } +}; +var Ri = function(n2, i) { + if (n2.length == 1) return n2[0]; + for (var s = new N(i), c = 0, l = 0; c < n2.length; ++c) { + var p = n2[c]; + s.set(p, l), l += p.length; + } + return s; +}; +function Sr(n2, i) { + for (var s = [], c = +!i, l = 0, p = 0; n2.length; ) { + var h = Mi(n2, c || i); + if (typeof h == "object") { + for (c ? (i = null, h.w.length == h.u && (s.push(i = h.w), p += h.u)) : (s.push(i), h.e = 0); !h.l; ) { + var d = qi(n2, h, i); + d || k(5), i ? h.e = h.y : (s.push(d), p += d.length, Ui(h.w, 0, d.length), h.w.set(d, h.w.length - d.length)); + } + l = h.b + h.c * 4; + } else l = h; + n2 = n2.subarray(l); + } + return Ri(s, p); +} +async function $i(n2 = {}) { + var i = n2, s = (r, e) => { + throw e; + }, c = "", l = ""; + function p(r) { + return l + r; + } + var h, d, U = console.log.bind(console), C = console.error.bind(console), M, Q = false, x, R = (r) => r.startsWith("file://"), Z = false; + function b() { + return Be.buffer; + } + function q() { + if (!P?.buffer?.resizable) { + var r = b(); + P = new Int8Array(r), Ve = new Int16Array(r), i.HEAPU8 = G = new Uint8Array(r), He = new Uint16Array(r), Xe = new Int32Array(r), z = new Uint32Array(r), Pr = new Float32Array(r), Qr = new Float64Array(r), pr = new BigInt64Array(r), hr = new BigUint64Array(r); + } + } + function te() { + } + function V() { + Z = true, Ee.A(); + } + function K() { + } + function ie(r) { + r = `Aborted(${r})`, C(r), Q = true, r += ". Build with -sASSERTIONS for more info.", Z && Nr(); + var e = new WebAssembly.RuntimeError(r); + throw e; + } + var $; + let y = () => ""; + function L(r) { + if (r == $ && M) return new Uint8Array(M); + if (d) return d(r); + throw "both async and sync fetching of the wasm failed"; + } + async function O(r) { + if (!M) try { + var e = await h(r); + return new Uint8Array(e); + } catch { + } + return L(r); + } + async function W(r, e) { + try { + var t = await O(r), a = await WebAssembly.instantiate(t, e); + return a; + } catch (o) { + C(`failed to asynchronously prepare wasm: ${o}`), ie(o); + } + } + async function Y(r, e, t) { + if (!r && !R(e)) try { + var a = fetch(e, { credentials: "same-origin" }), o = await WebAssembly.instantiateStreaming(a, t); + return o; + } catch (u) { + C(`wasm streaming compile failed: ${u}`), C("falling back to ArrayBuffer instantiation"); + } + return W(e, t); + } + function A() { + var r = { a: wi }; + return r; + } + async function ee() { + function r(u) { + return Ee = u.exports, di(Ee), q(), Ee; + } + function e(u) { + return r(u.instance); + } + var t = A(); + $ ??= y(); + var a = await Y(M, $, t), o = e(a); + return o; + } + class D { + name = "ExitStatus"; + constructor(e) { + this.message = `Program terminated with exit(${e})`, this.status = e; + } + } + var P, m = () => Xr, S = (r) => { + var e = r.getArg(m(), 0); + return zr(e); + }, _e = () => Kr(), Ue = (r) => Jr(r), ge = (r) => kr(r), be = globalThis.TextDecoder && new TextDecoder(), Qe = (r, e, t, a) => { + var o = e + t; + if (a) return o; + for (; r[e] && !(e >= o); ) ++e; + return e; + }, Ce = (r, e = 0, t, a) => { + var o = Qe(r, e, t, a); + if (o - e > 16 && r.buffer && be) return be.decode(r.subarray(e, o)); + for (var u = ""; e < o; ) { + var v = r[e++]; + if (!(v & 128)) { + u += String.fromCharCode(v); + continue; + } + var f = r[e++] & 63; + if ((v & 224) == 192) { + u += String.fromCharCode((v & 31) << 6 | f); + continue; + } + var g = r[e++] & 63; + if ((v & 240) == 224 ? v = (v & 15) << 12 | f << 6 | g : v = (v & 7) << 18 | f << 12 | g << 6 | r[e++] & 63, v < 65536) u += String.fromCharCode(v); + else { + var w = v - 65536; + u += String.fromCharCode(55296 | w >> 10, 56320 | w & 1023); + } + } + return u; + }, G, de = (r, e, t) => r ? Ce(G, r, e, t) : "", z, ke = (r) => { + var e = _e(), t = ge(4), a = ge(4); + Vr(r, t, a); + var o = z[t >> 2], u = z[a >> 2], v = de(o); + se(o); + var f; + return u && (f = de(u), se(u)), Ue(e), [v, f]; + }, ue = (r) => { + var e = S(r); + return ke(e); + }, we = (r) => { + var e = new WebAssembly.Exception(m(), [r], { traceStack: true }); + throw e.message = ue(e), e; + }, Me = () => ie(""), ce = {}, fe = (r) => { + for (; r.length; ) { + var e = r.pop(), t = r.pop(); + t(e); + } + }; + function ne(r) { + return this.fromWireType(z[r >> 2]); + } + var ve = {}, Pe = {}, Ke = {}; + class Wr extends Error { + constructor(e) { + super(e), this.name = "InternalError"; + } + } + var ze = (r) => { + throw new Wr(r); + }, pe = (r, e, t) => { + r.forEach((f) => Ke[f] = e); + function a(f) { + var g = t(f); + g.length !== r.length && ze("Mismatched type converter count"); + for (var w = 0; w < r.length; ++w) oe(r[w], g[w]); + } + var o = new Array(e.length), u = [], v = 0; + for (let [f, g] of e.entries()) Pe.hasOwnProperty(g) ? o[f] = Pe[g] : (u.push(g), ve.hasOwnProperty(g) || (ve[g] = []), ve[g].push(() => { + o[f] = Pe[g], ++v, v === u.length && a(o); + })); + u.length === 0 && a(o); + }, Ar = (r) => { + var e = ce[r]; + delete ce[r]; + var t = e.rawConstructor, a = e.rawDestructor, o = e.fields, u = o.map((v) => v.getterReturnType).concat(o.map((v) => v.setterArgumentType)); + pe([r], u, (v) => { + var f = {}; + for (var [g, w] of o.entries()) { + let _ = v[g], T = w.getter, H = w.getterContext, E = v[g + o.length], X = w.setter, j = w.setterContext; + f[w.fieldName] = { read: (I) => _.fromWireType(T(H, I)), write: (I, J) => { + var he = []; + X(j, I, E.toWireType(he, J)), fe(he); + }, optional: _.optional }; + } + return [{ name: e.name, fromWireType: (_) => { + var T = {}; + for (var H in f) T[H] = f[H].read(_); + return a(_), T; + }, toWireType: (_, T) => { + for (var H in f) if (!(H in T) && !f[H].optional) throw new TypeError(`Missing field: "${H}"`); + var E = t(); + for (H in f) f[H].write(E, T[H]); + return _ !== null && _.push(a, E), E; + }, readValueFromPointer: ne, destructorFunction: a }]; + }); + }, B = (r) => { + for (var e = ""; ; ) { + var t = G[r++]; + if (!t) return e; + e += String.fromCharCode(t); + } + }; + class Fe extends Error { + constructor(e) { + super(e), this.name = "BindingError"; + } + } + var F = (r) => { + throw new Fe(r); + }; + function et(r, e, t = {}) { + var a = e.name; + if (r || F(`type "${a}" must have a positive integer typeid pointer`), Pe.hasOwnProperty(r)) { + if (t.ignoreDuplicateRegistrations) return; + F(`Cannot register type '${a}' twice`); + } + if (Pe[r] = e, delete Ke[r], ve.hasOwnProperty(r)) { + var o = ve[r]; + delete ve[r], o.forEach((u) => u()); + } + } + function oe(r, e, t = {}) { + return et(r, e, t); + } + var Ve, He, Xe, pr, hr, gr = (r, e, t) => { + switch (e) { + case 1: + return t ? (a) => P[a] : (a) => G[a]; + case 2: + return t ? (a) => Ve[a >> 1] : (a) => He[a >> 1]; + case 4: + return t ? (a) => Xe[a >> 2] : (a) => z[a >> 2]; + case 8: + return t ? (a) => pr[a >> 3] : (a) => hr[a >> 3]; + default: + throw new TypeError(`invalid integer width (${e}): ${r}`); + } + }, rt = (r, e, t, a, o) => { + e = B(e); + let u = a === 0n, v = (f) => f; + if (u) { + let f = t * 8; + v = (g) => BigInt.asUintN(f, g), o = v(o); + } + oe(r, { name: e, fromWireType: v, toWireType: (f, g) => (typeof g == "number" && (g = BigInt(g)), g), readValueFromPointer: gr(e, t, !u), destructorFunction: null }); + }, tt = (r, e, t, a) => { + e = B(e), oe(r, { name: e, fromWireType: function(o) { + return !!o; + }, toWireType: function(o, u) { + return u ? t : a; + }, readValueFromPointer: function(o) { + return this.fromWireType(G[o]); + }, destructorFunction: null }); + }, it = (r) => ({ count: r.count, deleteScheduled: r.deleteScheduled, preservePointerOnDelete: r.preservePointerOnDelete, ptr: r.ptr, ptrType: r.ptrType, smartPtr: r.smartPtr, smartPtrType: r.smartPtrType }), je = (r) => { + function e(t) { + return t.$$.ptrType.registeredClass.name; + } + F(e(r) + " instance already deleted"); + }, We = false, dr = (r) => { + }, nt = (r) => { + r.smartPtr ? r.smartPtrType.rawDestructor(r.smartPtr) : r.ptrType.registeredClass.rawDestructor(r.ptr); + }, wr = (r) => { + r.count.value -= 1; + var e = r.count.value === 0; + e && nt(r); + }, xe = (r) => globalThis.FinalizationRegistry ? (We = new FinalizationRegistry((e) => { + wr(e.$$); + }), xe = (e) => { + var t = e.$$, a = !!t.smartPtr; + if (a) { + var o = { $$: t }; + We.register(e, o, e); + } + return e; + }, dr = (e) => We.unregister(e), xe(r)) : (xe = (e) => e, r), Ie = [], at = () => { + for (; Ie.length; ) { + var r = Ie.pop(); + r.$$.deleteScheduled = false, r.delete(); + } + }, yr, st = () => { + let r = Ze.prototype; + Object.assign(r, { isAliasOf(t) { + if (!(this instanceof Ze) || !(t instanceof Ze)) return false; + var a = this.$$.ptrType.registeredClass, o = this.$$.ptr; + t.$$ = t.$$; + for (var u = t.$$.ptrType.registeredClass, v = t.$$.ptr; a.baseClass; ) o = a.upcast(o), a = a.baseClass; + for (; u.baseClass; ) v = u.upcast(v), u = u.baseClass; + return a === u && o === v; + }, clone() { + if (this.$$.ptr || je(this), this.$$.preservePointerOnDelete) return this.$$.count.value += 1, this; + var t = xe(Object.create(Object.getPrototypeOf(this), { $$: { value: it(this.$$) } })); + return t.$$.count.value += 1, t.$$.deleteScheduled = false, t; + }, delete() { + this.$$.ptr || je(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && F("Object already scheduled for deletion"), dr(this), wr(this.$$), this.$$.preservePointerOnDelete || (this.$$.smartPtr = void 0, this.$$.ptr = void 0); + }, isDeleted() { + return !this.$$.ptr; + }, deleteLater() { + return this.$$.ptr || je(this), this.$$.deleteScheduled && !this.$$.preservePointerOnDelete && F("Object already scheduled for deletion"), Ie.push(this), Ie.length === 1 && yr && yr(at), this.$$.deleteScheduled = true, this; + } }); + let e = Symbol.dispose; + e && (r[e] = r.delete); + }; + function Ze() { + } + var mr = (r, e) => Object.defineProperty(e, "name", { value: r }), _r = {}, Ae = (r, e, t) => { + if (r[e].overloadTable === void 0) { + var a = r[e]; + r[e] = function(...o) { + return r[e].overloadTable.hasOwnProperty(o.length) || F(`Function '${t}' called with an invalid number of arguments (${o.length}) - expects one of (${r[e].overloadTable})!`), r[e].overloadTable[o.length].apply(this, o); + }, r[e].overloadTable = [], r[e].overloadTable[a.argCount] = a; + } + }, ot = (r, e, t) => { + i.hasOwnProperty(r) ? ((t === void 0 || i[r].overloadTable !== void 0 && i[r].overloadTable[t] !== void 0) && F(`Cannot register public name '${r}' twice`), Ae(i, r, r), i[r].overloadTable.hasOwnProperty(t) && F(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`), i[r].overloadTable[t] = e) : (i[r] = e, i[r].argCount = t); + }, ut = 48, ct = 57, lt = (r) => { + r = r.replace(/[^a-zA-Z0-9_]/g, "$"); + var e = r.charCodeAt(0); + return e >= ut && e <= ct ? `_${r}` : r; + }; + function ft(r, e, t, a, o, u, v, f) { + this.name = r, this.constructor = e, this.instancePrototype = t, this.rawDestructor = a, this.baseClass = o, this.getActualType = u, this.upcast = v, this.downcast = f, this.pureVirtualFunctions = []; + } + var er = (r, e, t) => { + for (; e !== t; ) e.upcast || F(`Expected null or instance of ${t.name}, got an instance of ${e.name}`), r = e.upcast(r), e = e.baseClass; + return r; + }, rr = (r) => { + if (r === null) return "null"; + var e = typeof r; + return e === "object" || e === "array" || e === "function" ? r.toString() : "" + r; + }; + function vt(r, e) { + if (e === null) return this.isReference && F(`null is not a valid ${this.name}`), 0; + e.$$ || F(`Cannot pass "${rr(e)}" as a ${this.name}`), e.$$.ptr || F(`Cannot pass deleted object as a pointer of type ${this.name}`); + var t = e.$$.ptrType.registeredClass, a = er(e.$$.ptr, t, this.registeredClass); + return a; + } + function pt(r, e) { + var t; + if (e === null) return this.isReference && F(`null is not a valid ${this.name}`), this.isSmartPointer ? (t = this.rawConstructor(), r !== null && r.push(this.rawDestructor, t), t) : 0; + (!e || !e.$$) && F(`Cannot pass "${rr(e)}" as a ${this.name}`), e.$$.ptr || F(`Cannot pass deleted object as a pointer of type ${this.name}`), !this.isConst && e.$$.ptrType.isConst && F(`Cannot convert argument of type ${e.$$.smartPtrType ? e.$$.smartPtrType.name : e.$$.ptrType.name} to parameter type ${this.name}`); + var a = e.$$.ptrType.registeredClass; + if (t = er(e.$$.ptr, a, this.registeredClass), this.isSmartPointer) switch (e.$$.smartPtr === void 0 && F("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) { + case 0: + e.$$.smartPtrType === this ? t = e.$$.smartPtr : F(`Cannot convert argument of type ${e.$$.smartPtrType ? e.$$.smartPtrType.name : e.$$.ptrType.name} to parameter type ${this.name}`); + break; + case 1: + t = e.$$.smartPtr; + break; + case 2: + if (e.$$.smartPtrType === this) t = e.$$.smartPtr; + else { + var o = e.clone(); + t = this.rawShare(t, nr.toHandle(() => o.delete())), r !== null && r.push(this.rawDestructor, t); + } + break; + default: + F("Unsupported sharing policy"); + } + return t; + } + function ht(r, e) { + if (e === null) return this.isReference && F(`null is not a valid ${this.name}`), 0; + e.$$ || F(`Cannot pass "${rr(e)}" as a ${this.name}`), e.$$.ptr || F(`Cannot pass deleted object as a pointer of type ${this.name}`), e.$$.ptrType.isConst && F(`Cannot convert argument of type ${e.$$.ptrType.name} to parameter type ${this.name}`); + var t = e.$$.ptrType.registeredClass, a = er(e.$$.ptr, t, this.registeredClass); + return a; + } + var Ur = (r, e, t) => { + if (e === t) return r; + if (t.baseClass === void 0) return null; + var a = Ur(r, e, t.baseClass); + return a === null ? null : t.downcast(a); + }, gt = {}, dt = (r, e) => { + for (e === void 0 && F("ptr should not be undefined"); r.baseClass; ) e = r.upcast(e), r = r.baseClass; + return e; + }, wt = (r, e) => (e = dt(r, e), gt[e]), Le = (r, e) => { + (!e.ptrType || !e.ptr) && ze("makeClassHandle requires ptr and ptrType"); + var t = !!e.smartPtrType, a = !!e.smartPtr; + return t !== a && ze("Both smartPtrType and smartPtr must be specified"), e.count = { value: 1 }, xe(Object.create(r, { $$: { value: e, writable: true } })); + }; + function yt(r) { + var e = this.getPointee(r); + if (!e) return this.destructor(r), null; + var t = wt(this.registeredClass, e); + if (t !== void 0) { + if (t.$$.count.value === 0) return t.$$.ptr = e, t.$$.smartPtr = r, t.clone(); + var a = t.clone(); + return this.destructor(r), a; + } + function o() { + return this.isSmartPointer ? Le(this.registeredClass.instancePrototype, { ptrType: this.pointeeType, ptr: e, smartPtrType: this, smartPtr: r }) : Le(this.registeredClass.instancePrototype, { ptrType: this, ptr: r }); + } + var u = this.registeredClass.getActualType(e), v = _r[u]; + if (!v) return o.call(this); + var f; + this.isConst ? f = v.constPointerType : f = v.pointerType; + var g = Ur(e, this.registeredClass, f.registeredClass); + return g === null ? o.call(this) : this.isSmartPointer ? Le(f.registeredClass.instancePrototype, { ptrType: f, ptr: g, smartPtrType: this, smartPtr: r }) : Le(f.registeredClass.instancePrototype, { ptrType: f, ptr: g }); + } + var mt = () => { + Object.assign(Ye.prototype, { getPointee(r) { + return this.rawGetPointee && (r = this.rawGetPointee(r)), r; + }, destructor(r) { + this.rawDestructor?.(r); + }, readValueFromPointer: ne, fromWireType: yt }); + }; + function Ye(r, e, t, a, o, u, v, f, g, w, _) { + this.name = r, this.registeredClass = e, this.isReference = t, this.isConst = a, this.isSmartPointer = o, this.pointeeType = u, this.sharingPolicy = v, this.rawGetPointee = f, this.rawConstructor = g, this.rawShare = w, this.rawDestructor = _, !o && e.baseClass === void 0 ? a ? (this.toWireType = vt, this.destructorFunction = null) : (this.toWireType = ht, this.destructorFunction = null) : this.toWireType = pt; + } + var _t = (r, e, t) => { + i.hasOwnProperty(r) || ze("Replacing nonexistent public symbol"), i[r].overloadTable !== void 0 && t !== void 0 ? i[r].overloadTable[t] = e : (i[r] = e, i[r].argCount = t); + }, Ut = (r) => Ir.get(r), ae = (r, e, t = false) => { + r = B(r); + function a() { + var u = Ut(e); + return u; + } + var o = a(); + return typeof o != "function" && F(`unknown function pointer with signature ${r}: ${e}`), o; + }; + class bt extends Error { + } + var Ct = (r) => { + var e = Rr(r), t = B(e); + return se(e), t; + }, Se = (r, e) => { + var t = [], a = {}; + function o(u) { + if (!a[u] && !Pe[u]) { + if (Ke[u]) { + Ke[u].forEach(o); + return; + } + t.push(u), a[u] = true; + } + } + throw e.forEach(o), new bt(`${r}: ` + t.map(Ct).join([", "])); + }, Mt = (r, e, t, a, o, u, v, f, g, w, _, T, H) => { + _ = B(_), u = ae(o, u), f &&= ae(v, f), w &&= ae(g, w), H = ae(T, H); + var E = lt(_); + ot(E, function() { + Se(`Cannot construct ${_} due to unbound types`, [a]); + }), pe([r, e, t], a ? [a] : [], (X) => { + X = X[0]; + var j, I; + a ? (j = X.registeredClass, I = j.instancePrototype) : I = Ze.prototype; + var J = mr(_, function(...or) { + if (Object.getPrototypeOf(this) !== he) throw new Fe(`Use 'new' to construct ${_}`); + if (re.constructor_body === void 0) throw new Fe(`${_} has no accessible constructor`); + var Zr = re.constructor_body[or.length]; + if (Zr === void 0) throw new Fe(`Tried to invoke ctor of ${_} with invalid number of parameters (${or.length}) - expected (${Object.keys(re.constructor_body).toString()}) parameters instead!`); + return Zr.apply(this, or); + }), he = Object.create(I, { constructor: { value: J } }); + J.prototype = he; + var re = new ft(_, J, he, H, j, u, f, w); + re.baseClass && (re.baseClass.__derivedClasses ??= [], re.baseClass.__derivedClasses.push(re)); + var sr = new Ye(_, re, true, false, false), le = new Ye(_ + "*", re, false, false, false), Oe = new Ye(_ + " const*", re, false, true, false); + return _r[r] = { pointerType: le, constPointerType: Oe }, _t(E, J), [sr, le, Oe]; + }); + }; + function Pt(r) { + for (var e = 1; e < r.length; ++e) if (r[e] !== null && r[e].destructorFunction === void 0) return true; + return false; + } + function tr(r, e, t, a, o, u) { + var v = e.length; + v < 2 && F("argTypes array size mismatch! Must at least get return value and receiver (this) types!"); + var f = e[1] !== null && t !== null, g = Pt(e), w = !e[0].isVoid, _ = v - 2, T = new Array(_), H = [], E = [], X = function(...j) { + E.length = 0; + var I; + H.length = f ? 2 : 1, H[0] = o, f && (I = e[1].toWireType(E, this), H[1] = I); + for (var J = 0; J < _; ++J) T[J] = e[J + 2].toWireType(E, j[J]), H.push(T[J]); + var he = a(...H); + function re(sr) { + if (g) fe(E); + else for (var le = f ? 1 : 2; le < e.length; le++) { + var Oe = le === 1 ? I : T[le - 2]; + e[le].destructorFunction !== null && e[le].destructorFunction(Oe); + } + if (w) return e[0].fromWireType(sr); + } + return re(he); + }; + return mr(r, X); + } + var ir = (r, e) => { + for (var t = [], a = 0; a < r; a++) t.push(z[e + a * 4 >> 2]); + return t; + }, br = (r) => { + r = r.trim(); + let e = r.indexOf("("); + return e === -1 ? r : r.slice(0, e); + }, Qt = (r, e, t, a, o, u, v, f, g) => { + var w = ir(t, a); + e = B(e), e = br(e), u = ae(o, u, f), pe([], [r], (_) => { + _ = _[0]; + var T = `${_.name}.${e}`; + function H() { + Se(`Cannot call ${T} due to unbound types`, w); + } + e.startsWith("@@") && (e = Symbol[e.substring(2)]); + var E = _.registeredClass.constructor; + return E[e] === void 0 ? (H.argCount = t - 1, E[e] = H) : (Ae(E, e, T), E[e].overloadTable[t - 1] = H), pe([], w, (X) => { + var j = [X[0], null].concat(X.slice(1)), I = tr(T, j, null, u, v, f); + if (E[e].overloadTable === void 0 ? (I.argCount = t - 1, E[e] = I) : E[e].overloadTable[t - 1] = I, _.registeredClass.__derivedClasses) for (let J of _.registeredClass.__derivedClasses) J.constructor.hasOwnProperty(e) || (J.constructor[e] = I); + return []; + }), []; + }); + }, Ft = (r, e, t, a, o, u) => { + var v = ir(e, t); + o = ae(a, o), pe([], [r], (f) => { + f = f[0]; + var g = `constructor ${f.name}`; + if (f.registeredClass.constructor_body === void 0 && (f.registeredClass.constructor_body = []), f.registeredClass.constructor_body[e - 1] !== void 0) throw new Fe(`Cannot register multiple constructors with identical number of parameters (${e - 1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`); + return f.registeredClass.constructor_body[e - 1] = () => { + Se(`Cannot construct ${f.name} due to unbound types`, v); + }, pe([], v, (w) => (w.splice(1, 0, null), f.registeredClass.constructor_body[e - 1] = tr(g, w, null, o, u), [])), []; + }); + }, Ht = (r, e, t, a, o, u, v, f, g, w) => { + var _ = ir(t, a); + e = B(e), e = br(e), u = ae(o, u, g), pe([], [r], (T) => { + T = T[0]; + var H = `${T.name}.${e}`; + e.startsWith("@@") && (e = Symbol[e.substring(2)]), f && T.registeredClass.pureVirtualFunctions.push(e); + function E() { + Se(`Cannot call ${H} due to unbound types`, _); + } + var X = T.registeredClass.instancePrototype, j = X[e]; + return j === void 0 || j.overloadTable === void 0 && j.className !== T.name && j.argCount === t - 2 ? (E.argCount = t - 2, E.className = T.name, X[e] = E) : (Ae(X, e, H), X[e].overloadTable[t - 2] = E), pe([], _, (I) => { + var J = tr(H, I, T, u, v, g); + return X[e].overloadTable === void 0 ? (J.argCount = t - 2, X[e] = J) : X[e].overloadTable[t - 2] = J, []; + }), []; + }); + }, Cr = [], ye = [0, 1, , 1, null, 1, true, 1, false, 1], Mr = [], xt = (r) => { + if (r > 9 && --ye[r + 1] === 0) { + var e = ye[r]; + ye[r] = void 0; + var t = Mr[r]; + t && (Mr[r] = void 0, t(e)), Cr.push(r); + } + }, nr = { toValue: (r) => (r || F(`Cannot use deleted val. handle = ${r}`), ye[r]), toHandle: (r) => { + switch (r) { + case void 0: + return 2; + case null: + return 4; + case true: + return 6; + case false: + return 8; + default: { + let e = Cr.pop() || ye.length; + return ye[e] = r, ye[e + 1] = 1, e; + } + } + } }, Tt = { name: "emscripten::val", fromWireType: (r) => { + var e = nr.toValue(r); + return xt(r), e; + }, toWireType: (r, e) => nr.toHandle(e), readValueFromPointer: ne, destructorFunction: null }, Et = (r) => oe(r, Tt), Pr, Qr, qt = (r, e) => { + switch (e) { + case 4: + return function(t) { + return this.fromWireType(Pr[t >> 2]); + }; + case 8: + return function(t) { + return this.fromWireType(Qr[t >> 3]); + }; + default: + throw new TypeError(`invalid float width (${e}): ${r}`); + } + }, Rt = (r, e, t) => { + e = B(e), oe(r, { name: e, fromWireType: (a) => a, toWireType: (a, o) => o, readValueFromPointer: qt(e, t), destructorFunction: null }); + }, $t = (r, e, t, a, o) => { + e = B(e); + let u = a === 0, v = (g) => g; + if (u) { + var f = 32 - 8 * t; + v = (g) => g << f >>> f, o = v(o); + } + oe(r, { name: e, fromWireType: v, toWireType: (g, w) => w, readValueFromPointer: gr(e, t, a !== 0), destructorFunction: null }); + }, Nt = (r, e, t) => { + var a = [Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, BigInt64Array, BigUint64Array], o = a[e]; + function u(v) { + var f = z[v >> 2], g = z[v + 4 >> 2]; + return new o(P.buffer, g, f); + } + t = B(t), oe(r, { name: t, fromWireType: u, readValueFromPointer: u }, { ignoreDuplicateRegistrations: true }); + }, Jt = (r, e, t, a) => { + if (!(a > 0)) return 0; + for (var o = t, u = t + a - 1, v = 0; v < r.length; ++v) { + var f = r.codePointAt(v); + if (f <= 127) { + if (t >= u) break; + e[t++] = f; + } else if (f <= 2047) { + if (t + 1 >= u) break; + e[t++] = 192 | f >> 6, e[t++] = 128 | f & 63; + } else if (f <= 65535) { + if (t + 2 >= u) break; + e[t++] = 224 | f >> 12, e[t++] = 128 | f >> 6 & 63, e[t++] = 128 | f & 63; + } else { + if (t + 3 >= u) break; + e[t++] = 240 | f >> 18, e[t++] = 128 | f >> 12 & 63, e[t++] = 128 | f >> 6 & 63, e[t++] = 128 | f & 63, v++; + } + } + return e[t] = 0, t - o; + }, Fr = (r, e, t) => Jt(r, G, e, t), Hr = (r) => { + for (var e = 0, t = 0; t < r.length; ++t) { + var a = r.charCodeAt(t); + a <= 127 ? e++ : a <= 2047 ? e += 2 : a >= 55296 && a <= 57343 ? (e += 4, ++t) : e += 3; + } + return e; + }, kt = (r, e) => { + e = B(e); + var t = true; + oe(r, { name: e, fromWireType(a) { + var o = z[a >> 2], u = a + 4, v; + if (t) v = de(u, o, true); + else { + v = ""; + for (var f = 0; f < o; ++f) v += String.fromCharCode(G[u + f]); + } + return se(a), v; + }, toWireType(a, o) { + o instanceof ArrayBuffer && (o = new Uint8Array(o)); + var u, v = typeof o == "string"; + v || ArrayBuffer.isView(o) && o.BYTES_PER_ELEMENT == 1 || F("Cannot pass non-string to std::string"), t && v ? u = Hr(o) : u = o.length; + var f = ar(4 + u + 1), g = f + 4; + if (z[f >> 2] = u, v) if (t) Fr(o, g, u + 1); + else for (var w = 0; w < u; ++w) { + var _ = o.charCodeAt(w); + _ > 255 && (se(f), F("String has UTF-16 code units that do not fit in 8 bits")), G[g + w] = _; + } + else G.set(o, g); + return a !== null && a.push(se, f), f; + }, readValueFromPointer: ne, destructorFunction(a) { + se(a); + } }); + }, xr = globalThis.TextDecoder ? new TextDecoder("utf-16le") : void 0, Kt = (r, e, t) => { + var a = r >> 1, o = Qe(He, a, e / 2, t); + if (o - a > 16 && xr) return xr.decode(He.subarray(a, o)); + for (var u = "", v = a; v < o; ++v) { + var f = He[v]; + u += String.fromCharCode(f); + } + return u; + }, zt = (r, e, t = 2147483647) => { + if (t < 2) return 0; + t -= 2; + for (var a = e, o = t < r.length * 2 ? t / 2 : r.length, u = 0; u < o; ++u) { + var v = r.charCodeAt(u); + Ve[e >> 1] = v, e += 2; + } + return Ve[e >> 1] = 0, e - a; + }, Vt = (r) => r.length * 2, Xt = (r, e, t) => { + for (var a = "", o = r >> 2, u = 0; !(u >= e / 4); u++) { + var v = z[o + u]; + if (!v && !t) break; + a += String.fromCodePoint(v); + } + return a; + }, It = (r, e, t = 2147483647) => { + if (t < 4) return 0; + for (var a = e, o = a + t - 4, u = 0; u < r.length; ++u) { + var v = r.codePointAt(u); + if (v > 65535 && u++, Xe[e >> 2] = v, e += 4, e + 4 > o) break; + } + return Xe[e >> 2] = 0, e - a; + }, Zt = (r) => { + for (var e = 0, t = 0; t < r.length; ++t) { + var a = r.codePointAt(t); + a > 65535 && t++, e += 4; + } + return e; + }, Lt = (r, e, t) => { + t = B(t); + var a, o, u; + e === 2 ? (a = Kt, o = zt, u = Vt) : (a = Xt, o = It, u = Zt), oe(r, { name: t, fromWireType: (v) => { + var f = z[v >> 2], g = a(v + 4, f * e, true); + return se(v), g; + }, toWireType: (v, f) => { + typeof f != "string" && F(`Cannot pass non-string to C++ string type ${t}`); + var g = u(f), w = ar(4 + g + e); + return z[w >> 2] = g / e, o(f, w + 4, g + e), v !== null && v.push(se, w), w; + }, readValueFromPointer: ne, destructorFunction(v) { + se(v); + } }); + }, Yt = (r, e, t, a, o, u) => { + ce[r] = { name: B(e), rawConstructor: ae(t, a), rawDestructor: ae(o, u), fields: [] }; + }, St = (r, e, t, a, o, u, v, f, g, w) => { + ce[r].fields.push({ fieldName: B(e), getterReturnType: t, getter: ae(a, o), getterContext: u, setterArgumentType: v, setter: ae(f, g), setterContext: w }); + }, Bt = (r, e) => { + e = B(e), oe(r, { isVoid: true, name: e, fromWireType: () => { + }, toWireType: (t, a) => { + } }); + }, Ot = 0, Dt = () => { + Ot = 0; + }, Te = {}, Tr = (r) => { + if (r instanceof D || r == "unwind") return x; + s(1, r); + }, Er = () => true, qr = (r) => { + x = r, Er() || (Q = true), s(r, new D(r)); + }, Gt = (r, e) => { + x = r, qr(r); + }, jt = Gt, Wt = () => { + if (!Er()) try { + jt(x); + } catch (r) { + Tr(r); + } + }, At = (r) => { + if (!Q) try { + return r(); + } catch (e) { + Tr(e); + } finally { + Wt(); + } + }, ei = () => performance.now(), ri = (r, e) => { + if (Te[r] && (clearTimeout(Te[r].id), delete Te[r]), !e) return 0; + var t = setTimeout(() => { + delete Te[r], At(() => $r(r, ei())); + }, e); + return Te[r] = { id: t, timeout_ms: e }, 0; + }, ti = () => 2147483648, ii = (r, e) => Math.ceil(r / e) * e, ni = (r) => { + var e = Be.buffer.byteLength, t = (r - e + 65535) / 65536 | 0; + try { + return Be.grow(t), q(), 1; + } catch { + } + }, ai = (r) => { + var e = G.length; + r >>>= 0; + var t = ti(); + if (r > t) return false; + for (var a = 1; a <= 4; a *= 2) { + var o = e * (1 + 0.2 / a); + o = Math.min(o, r + 100663296); + var u = Math.min(t, ii(Math.max(r, o), 65536)), v = ni(u); + if (v) return true; + } + return false; + }, si = (r) => 52, oi = 9007199254740992, ui = -9007199254740992, ci = (r) => r < ui || r > oi ? NaN : Number(r); + function li(r, e, t, a) { + return e = ci(e), 70; + } + var fi = [null, [], []], vi = (r, e) => { + var t = fi[r]; + !e || e === 10 ? ((r === 1 ? U : C)(Ce(t)), t.length = 0) : t.push(e); + }, pi = (r, e, t, a) => { + for (var o = 0, u = 0; u < t; u++) { + var v = z[e >> 2], f = z[e + 4 >> 2]; + e += 8; + for (var g = 0; g < f; g++) vi(r, G[v + g]); + o += f; + } + return z[a >> 2] = o, 0; + }; + st(), mt(), i.wasmBinary && (M = i.wasmBinary), i.UTF8ToString = de, i.stringToUTF8 = Fr, i.lengthBytesUTF8 = Hr; + var Rr, ar, se, $r, Nr, Jr, kr, Kr, zr, Vr, hi, gi, Xr, Be, Ir; + function di(r) { + Rr = r.B, ar = i._malloc = r.C, se = i._free = r.D, $r = r.F, Nr = r.G, Jr = r.H, kr = r.I, Kr = r.J, zr = r.K, Vr = r.L, hi = Be = r.z, gi = Ir = r.E, Xr = r.M; + } + var wi = { t: we, x: Me, f: Ar, i: rt, l: tt, o: Mt, b: Qt, n: Ft, d: Ht, y: Et, h: Rt, c: $t, a: Nt, k: kt, g: Lt, j: Yt, e: St, m: Bt, w: Dt, p: ri, u: ai, s: si, q: li, r: pi, v: qr }; + async function yi() { + !Q && (V(), void 0); + } + var Ee; + return Ee = await ee(), await yi(), i; +} +var Br = $i; +var Ni = new Int8Array([-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, 90, 63, 64, 65, 66, -1, 67, 68, 69, 70, 71, -1, 72, 73, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 74, 75, 76, 77, 78, 79, 80, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 81, -1, 82, 83, 84, 85, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 86, 87, 88, 89, -1]); +function Ji(n2) { + let i = new Uint8Array(170930), s = 0, c = 0, l = 0, p = -1; + for (let h = 0, d = n2.length; h < d; h++) { + let U = n2.charCodeAt(h); + if (U > 127) continue; + let C = Ni[U]; + if (!(C < 0)) if (p < 0) p = C; + else { + p += C * 91, c |= p << l, l += (p & 8191) > 88 ? 13 : 14; + do + i[s++] = c, c >>>= 8, l -= 8; + while (l > 7); + p = -1; + } + } + return p >= 0 && (i[s++] = (c | p << l) & 255), i; +} +var ki = 'v7#a#A&ip?h=9a``^J`)5x"o{!v]XzI=DUUZ(C>s3buuP)js,;OtmfQ{Mv[CUC9l[8rB.MDwE?hp@bTlY<@[&X4FTLX(s#ZXlDf>yry,`IGK!<{!mg.0!~)Dy9*,Q.RM;#pM`s]ypDS[L3$QcrVv]TqBPOfvif$1&y]`l8aFJvQC=O;R>9bI!f@+IXy!ow[[^H8Vm|a}sj#={!.73f_N>[fkyO|=(7z;]oG4{se6~k<70q#}ZA7f?Epp$LoOzj0d1Q/K.e{q.0&0.8:WE54/!@#4q(pPw;:5k)vs@;QSa{K+Q_X:mw}Syr<=C^``75TC&InElrIeZpC}?*R8Ds;l)g+E+Yqz!wCjQ:d)dwEp$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Nz#7Iao2YZ8ds&Ww,i9i*emHMk/|fwtB!Xpn$dXfin%g6"PKo:VN_6#VRjzld)|bP@*d8s7;;O<|u._e<^.:#Wy8ajohkqD"](a8nyx]0t!qyiusW8DutiNfq^3;t@KYiEfcL@T:xQ&Ok{#/o(`k47K0y!(n7}^OM~Nb&~51V6Ia!Qehp.lPh5(=yW8)>D6T:QEC)^0$wAWJk]UCI(;}V:m.Gto#12ZBwR$I.H,.8ECc48Z[/[Da`$Yt{h4!r=.s%)R"e?TBOc)9&d~7)"j1IO8:3EF_bkJUBPsO2jGGS]EqxSdEKlFrbov[r/G68D@ALz,4(W^=KK1j@;Sc:g>kg8TxaE%oc03IqD%RRS!@?#r^A4Q3wuR&0JML_79}=HK?F6fm@7WG;/.9Dhb}iI%W%s@k[fHzr{qZT}Bhj<7IMxVM|DrZ6s+bmngI/vC|;k2WcVQoNTB0JSLA;YoL1Fa1M0I0>QV0Py5/|t5L(.8ONW|!8p?_@I$K1A7@k@trkVX]Rer8H=6isTg#QU_R<<=_;(gx%?}8c3kvyC)#AgFLdkL9T!h+o*5b9Bf%/2B:&&k|ka/r/1;Ke:OL3RJdm5VMOXQ+aU:i~Nz=a:.oo$_TG~jh|JxuX:Aw$]pd?n.*bX~;NEsa{}puiP3ro"FhGxbKqYQ!k!SUJHwgot6j(WI?_NRu0lnqD?okE^0$Cjif,~uTMxfpxpaP>w6s4jouXRT`KfVb29VP}OMnvN5Wq0zX&p1y~yGA4;&Hs;d>9!q:VSbLA9ljDPI=x:t0%]&==kE"GwTlPzV@ID[_0#mV:EsGQ:|Kf8Qtg^BZi=[eV:C1o8I}#:I?of+|?XZa?+#c"l[}=pth=?^[.WUCEh+qIWE5B'; +var fr; +function Or() { + return fr ??= Sr(Ji(ki)), Br({ wasmBinary: fr, locateFile: () => "" }); +} +function Dr() { + fr = void 0; +} +var Gr = class { + _module; + constructor(n2) { + this._module = n2; + } + malloc(n2) { + let i = this._module._malloc(n2); + return { ptr: i, size: n2, dispose: () => this.free({ ptr: i, size: n2, dispose: () => { + } }) }; + } + free(n2) { + this._module._free(n2.ptr); + } + dataToHeap(n2) { + let i = this.malloc(n2.byteLength); + return this._module.HEAPU8.set(n2, i.ptr), i; + } + heapView(n2) { + return this._module.HEAPU8.subarray(n2.ptr, n2.ptr + n2.size); + } + heapToUint8Array(n2) { + return new Uint8Array([...this.heapView(n2)]); + } + lengthBytes(n2) { + return this._module.lengthBytesUTF8(n2); + } + stringToHeap(n2) { + let i = this.lengthBytes(n2) + 1, s = this._module._malloc(i); + return this._module.stringToUTF8(n2, s, i), { ptr: s, size: i, dispose: () => this.free({ ptr: s, size: i, dispose: () => { + } }) }; + } + heapToString(n2) { + return this._module.UTF8ToString(n2.ptr, n2.size); + } + hasFilesystem() { + let n2 = this._module; + return n2.FS_createPath !== void 0 && n2.FS_createDataFile !== void 0 && n2.FS_preloadFile !== void 0 && n2.FS_unlink !== void 0; + } + createPath(n2, i = true, s = true) { + return this._module.FS_createPath("/", n2, i, s); + } + createDataFile(n2, i, s = true, c = true, l = true) { + return this._module.FS_createDataFile("/", n2, i, s, c, l); + } + preloadFile(n2, i, s = true, c = true, l = false, p = true, h = false) { + return this._module.FS_preloadFile("/", n2, i, s, c, l, p, h); + } + unlink(n2) { + return this._module.FS_unlink(n2); + } +}; +var Ne; +var Ki = 4294967295; +function Je(n2, i) { + if (!Number.isInteger(n2) || n2 < 0 || n2 > Ki) throw new Error(`${i} length ${n2} is outside the WASM32-safe range`); +} +function vr(n2) { + if (n2.length === 0) return new Uint8Array(0); + if (n2.length === 1) return n2[0]; + let i = 0; + for (let l of n2) i += l.length; + let s = new Uint8Array(i), c = 0; + for (let l of n2) s.set(l, c), c += l.length; + return s; +} +var jr = class n { + _mainModule; + _zstdClass; + _zstd; + _compressionLevel; + _decompressFrameCompleted = false; + _decompressRemaining = 0; + _decompressSawInput = false; + constructor(i) { + this._mainModule = new Gr(i), this._zstdClass = i.zstd, this._zstd = new this._zstdClass(), this._compressionLevel = this._zstdClass.defaultCLevel(); + } + static load() { + return Ne || (Ne = Or().then((i) => new n(i))), Ne; + } + static unload() { + Dr(), Ne?.then((i) => { + i?._zstd?.delete(); + }), Ne = void 0; + } + copyHeap(i) { + return this._mainModule.heapView(i).slice(); + } + mallocChecked(i, s) { + Je(i, s); + let c = this._mainModule.malloc(i); + if (!c.ptr) throw this._mainModule.free(c), new Error(`Failed to allocate ${i} bytes for ${s}`); + return c; + } + throwStreamError(i, s) { + throw new Error(`${i} failed: ${s.errorName || "unknown error"}`); + } + ensureStreamOk(i, s) { + s.error && this.throwStreamError(i, s); + } + version() { + return this._zstdClass.version(); + } + reset() { + let i = this._zstd.reset(); + this.ensureStreamOk("reset", i), this._decompressFrameCompleted = false, this._decompressRemaining = 0, this._decompressSawInput = false; + } + resetCompression(i) { + i !== void 0 && (this._compressionLevel = i); + let s = this._zstd.resetCompression(this._compressionLevel); + this.ensureStreamOk("resetCompression", s); + } + resetDecompression() { + let i = this._zstd.resetDecompression(); + this.ensureStreamOk("resetDecompression", i), this._decompressFrameCompleted = false, this._decompressRemaining = 0, this._decompressSawInput = false; + } + setCompressionLevel(i) { + let s = this._zstd.setCompressionLevel(i); + this.ensureStreamOk("setCompressionLevel", s), this._compressionLevel = i; + } + compress(i, s = this.defaultCLevel()) { + Je(i.length, "compress input"); + let c = this._mainModule.dataToHeap(i); + try { + if (!c.ptr && i.length > 0) throw new Error("Failed to allocate compress input buffer"); + let l = this._zstdClass.compressBound(i.length), p = this.mallocChecked(l, "compress output"); + try { + if (p.size = this._zstdClass.compress(p.ptr, l, c.ptr, c.size, s), this._zstdClass.isError(p.size)) throw new Error(`compress failed: ${this._zstdClass.getErrorName(p.size)}`); + return this.copyHeap(p); + } finally { + this._mainModule.free(p); + } + } finally { + this._mainModule.free(c); + } + } + compressChunk(i) { + if (Je(i.length, "compressChunk input"), i.length === 0) return new Uint8Array(0); + let s = this._mainModule.dataToHeap(i); + try { + if (!s.ptr) throw new Error("Failed to allocate compressChunk input buffer"); + let c = this._zstdClass.CStreamOutSize(), l = [], p = 0; + for (; p < i.length; ) { + let h = this.mallocChecked(c, "compressChunk output"); + try { + let d = this._zstd.compressChunk(h.ptr, c, s.ptr + p, i.length - p); + if (this.ensureStreamOk("compressChunk", d), d.consumed === 0 && d.produced === 0) throw new Error("compressChunk failed: no progress while consuming input"); + p += d.consumed, d.produced > 0 && (h.size = d.produced, l.push(this.copyHeap(h))); + } finally { + this._mainModule.free(h); + } + } + return vr(l); + } finally { + this._mainModule.free(s); + } + } + compressEnd() { + let i = this._zstdClass.CStreamOutSize(), s = [], c = 1; + for (; c !== 0; ) { + let l = this.mallocChecked(i, "compressEnd output"); + try { + let p = this._zstd.compressEnd(l.ptr, i); + if (this.ensureStreamOk("compressEnd", p), p.produced === 0 && p.remaining !== 0) throw new Error("compressEnd failed: no progress while finishing stream"); + c = p.remaining, p.produced > 0 && (l.size = p.produced, s.push(this.copyHeap(l))); + } finally { + this._mainModule.free(l); + } + } + return vr(s); + } + frameContentSize(i) { + return this._zstdClass.getFrameContentSize(i.ptr, i.size); + } + decompress(i) { + Je(i.length, "decompress input"); + let s = this._mainModule.dataToHeap(i); + try { + if (!s.ptr && i.length > 0) throw new Error("Failed to allocate decompress input buffer"); + let c = this.frameContentSize(s); + if (c.error) throw new Error(`Failed to get frame content size: ${c.errorName}`); + let l = c.known; + if (l) { + let p = this._zstdClass.findFrameCompressedSize(s.ptr, s.size); + if (this._zstdClass.isError(p)) throw new Error(`Failed to find frame compressed size: ${this._zstdClass.getErrorName(p)}`); + p < s.size && (l = false); + } + if (l) { + let p = this.mallocChecked(c.size, "decompress output"); + try { + if (p.size = this._zstdClass.decompress(p.ptr, c.size, s.ptr, s.size), this._zstdClass.isError(p.size)) throw new Error(`decompress failed: ${this._zstdClass.getErrorName(p.size)}`); + return this.copyHeap(p); + } finally { + this._mainModule.free(p); + } + } + } finally { + this._mainModule.free(s); + } + return this.decompressViaStreaming(i); + } + decompressViaStreaming(i) { + this.resetDecompression(); + let s = this.decompressChunk(i); + return this.decompressEnd(), s; + } + decompressChunk(i) { + if (Je(i.length, "decompressChunk input"), i.length === 0) return new Uint8Array(0); + this._decompressSawInput = true; + let s = this._mainModule.dataToHeap(i); + try { + if (!s.ptr) throw new Error("Failed to allocate decompressChunk input buffer"); + let c = this._zstdClass.DStreamOutSize(), l = [], p = 0, h = false; + for (; p < i.length || h; ) { + let d = this.mallocChecked(c, "decompressChunk output"); + try { + let U = p < i.length ? i.length - p : 0, C = U > 0 ? s.ptr + p : 0, M = this._zstd.decompressChunk(d.ptr, c, C, U); + if (this.ensureStreamOk("decompressChunk", M), M.consumed === 0 && M.produced === 0) { + if (U === 0) { + M.remaining > 0 && (this._decompressRemaining = M.remaining); + break; + } + throw new Error("decompressChunk failed: no progress while consuming input"); + } + p += M.consumed, h = M.produced === c && M.remaining !== 0, M.produced > 0 && (d.size = M.produced, l.push(this.copyHeap(d))), M.remaining === 0 ? (this._decompressFrameCompleted = true, this._decompressRemaining = 0) : this._decompressRemaining = M.remaining; + } finally { + this._mainModule.free(d); + } + } + return vr(l); + } finally { + this._mainModule.free(s); + } + } + decompressEnd() { + if (!this._decompressSawInput) throw new Error("decompressEnd failed: empty compressed input is not a completed frame"); + if (!this._decompressFrameCompleted || this._decompressRemaining !== 0) throw new Error("decompressEnd failed: truncated Zstandard input"); + } + defaultCLevel() { + return this._zstdClass.defaultCLevel(); + } + minCLevel() { + return this._zstdClass.minCLevel(); + } + maxCLevel() { + return this._zstdClass.maxCLevel(); + } +}; +export { + jr as Zstd +}; +//# sourceMappingURL=@hpcc-js_wasm-zstd.js.map diff --git a/node_modules/.vite/deps/@hpcc-js_wasm-zstd.js.map b/node_modules/.vite/deps/@hpcc-js_wasm-zstd.js.map new file mode 100644 index 0000000..4de8369 --- /dev/null +++ b/node_modules/.vite/deps/@hpcc-js_wasm-zstd.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../node_modules/fzstd/esm/index.mjs", "../../build/packages/zstd/zstdlib.js", "../../build/packages/zstd/zstdlib.wasm", "../../@hpcc-js/util/src/wasm-library.ts", "../../@hpcc-js/wasm-zstd/src/zstd.ts"], + "sourcesContent": ["// Some numerical data is initialized as -1 even when it doesn't need initialization to help the JIT infer types\n// aliases for shorter compressed code (most minifers don't do this)\nvar ab = ArrayBuffer, u8 = Uint8Array, u16 = Uint16Array, i16 = Int16Array, u32 = Uint32Array, i32 = Int32Array;\nvar slc = function (v, s, e) {\n if (u8.prototype.slice)\n return u8.prototype.slice.call(v, s, e);\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n var n = new u8(e - s);\n n.set(v.subarray(s, e));\n return n;\n};\nvar fill = function (v, n, s, e) {\n if (u8.prototype.fill)\n return u8.prototype.fill.call(v, n, s, e);\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n for (; s < e; ++s)\n v[s] = n;\n return v;\n};\nvar cpw = function (v, t, s, e) {\n if (u8.prototype.copyWithin)\n return u8.prototype.copyWithin.call(v, t, s, e);\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n while (s < e) {\n v[t++] = v[s++];\n }\n};\n/**\n * Codes for errors generated within this library\n */\nexport var ZstdErrorCode = {\n InvalidData: 0,\n WindowSizeTooLarge: 1,\n InvalidBlockType: 2,\n FSEAccuracyTooHigh: 3,\n DistanceTooFarBack: 4,\n UnexpectedEOF: 5\n};\n// error codes\nvar ec = [\n 'invalid zstd data',\n 'window size too large (>2046MB)',\n 'invalid block type',\n 'FSE accuracy too high',\n 'match distance too far back',\n 'unexpected EOF'\n];\nvar err = function (ind, msg, nt) {\n var e = new Error(msg || ec[ind]);\n e.code = ind;\n if (Error.captureStackTrace)\n Error.captureStackTrace(e, err);\n if (!nt)\n throw e;\n return e;\n};\nvar rb = function (d, b, n) {\n var i = 0, o = 0;\n for (; i < n; ++i)\n o |= d[b++] << (i << 3);\n return o;\n};\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };\n// read Zstandard frame header\nvar rzfh = function (dat, w) {\n var n3 = dat[0] | (dat[1] << 8) | (dat[2] << 16);\n if (n3 == 0x2FB528 && dat[3] == 253) {\n // Zstandard\n var flg = dat[4];\n // single segment checksum dict flag frame content flag\n var ss = (flg >> 5) & 1, cc = (flg >> 2) & 1, df = flg & 3, fcf = flg >> 6;\n if (flg & 8)\n err(0);\n // byte\n var bt = 6 - ss;\n // dict bytes\n var db = df == 3 ? 4 : df;\n // dictionary id\n var di = rb(dat, bt, db);\n bt += db;\n // frame size bytes\n var fsb = fcf ? (1 << fcf) : ss;\n // frame source size\n var fss = rb(dat, bt, fsb) + ((fcf == 1) && 256);\n // window size\n var ws = fss;\n if (!ss) {\n // window descriptor\n var wb = 1 << (10 + (dat[5] >> 3));\n ws = wb + (wb >> 3) * (dat[5] & 7);\n }\n if (ws > 2145386496)\n err(1);\n var buf = new u8((w == 1 ? (fss || ws) : w ? 0 : ws) + 12);\n buf[0] = 1, buf[4] = 4, buf[8] = 8;\n return {\n b: bt + fsb,\n y: 0,\n l: 0,\n d: di,\n w: (w && w != 1) ? w : buf.subarray(12),\n e: ws,\n o: new i32(buf.buffer, 0, 3),\n u: fss,\n c: cc,\n m: Math.min(131072, ws)\n };\n }\n else if (((n3 >> 4) | (dat[3] << 20)) == 0x184D2A5) {\n // skippable\n return b4(dat, 4) + 8;\n }\n err(0);\n};\n// most significant bit for nonzero\nvar msb = function (val) {\n var bits = 0;\n for (; (1 << bits) <= val; ++bits)\n ;\n return bits - 1;\n};\n// read finite state entropy\nvar rfse = function (dat, bt, mal) {\n // table pos\n var tpos = (bt << 3) + 4;\n // accuracy log\n var al = (dat[bt] & 15) + 5;\n if (al > mal)\n err(3);\n // size\n var sz = 1 << al;\n // probabilities symbols repeat index high threshold\n var probs = sz, sym = -1, re = -1, i = -1, ht = sz;\n // optimization: single allocation is much faster\n var buf = new ab(512 + (sz << 2));\n var freq = new i16(buf, 0, 256);\n // same view as freq\n var dstate = new u16(buf, 0, 256);\n var nstate = new u16(buf, 512, sz);\n var bb1 = 512 + (sz << 1);\n var syms = new u8(buf, bb1, sz);\n var nbits = new u8(buf, bb1 + sz);\n while (sym < 255 && probs > 0) {\n var bits = msb(probs + 1);\n var cbt = tpos >> 3;\n // mask\n var msk = (1 << (bits + 1)) - 1;\n var val = ((dat[cbt] | (dat[cbt + 1] << 8) | (dat[cbt + 2] << 16)) >> (tpos & 7)) & msk;\n // mask (1 fewer bit)\n var msk1fb = (1 << bits) - 1;\n // max small value\n var msv = msk - probs - 1;\n // small value\n var sval = val & msk1fb;\n if (sval < msv)\n tpos += bits, val = sval;\n else {\n tpos += bits + 1;\n if (val > msk1fb)\n val -= msv;\n }\n freq[++sym] = --val;\n if (val == -1) {\n probs += val;\n syms[--ht] = sym;\n }\n else\n probs -= val;\n if (!val) {\n do {\n // repeat byte\n var rbt = tpos >> 3;\n re = ((dat[rbt] | (dat[rbt + 1] << 8)) >> (tpos & 7)) & 3;\n tpos += 2;\n sym += re;\n } while (re == 3);\n }\n }\n if (sym > 255 || probs)\n err(0);\n var sympos = 0;\n // sym step (coprime with sz - formula from zstd source)\n var sstep = (sz >> 1) + (sz >> 3) + 3;\n // sym mask\n var smask = sz - 1;\n for (var s = 0; s <= sym; ++s) {\n var sf = freq[s];\n if (sf < 1) {\n dstate[s] = -sf;\n continue;\n }\n // This is split into two loops in zstd to avoid branching, but as JS is higher-level that is unnecessary\n for (i = 0; i < sf; ++i) {\n syms[sympos] = s;\n do {\n sympos = (sympos + sstep) & smask;\n } while (sympos >= ht);\n }\n }\n // After spreading symbols, should be zero again\n if (sympos)\n err(0);\n for (i = 0; i < sz; ++i) {\n // next state\n var ns = dstate[syms[i]]++;\n // num bits\n var nb = nbits[i] = al - msb(ns);\n nstate[i] = (ns << nb) - sz;\n }\n return [(tpos + 7) >> 3, {\n b: al,\n s: syms,\n n: nbits,\n t: nstate\n }];\n};\n// read huffman\nvar rhu = function (dat, bt) {\n // index weight count\n var i = 0, wc = -1;\n // buffer header byte\n var buf = new u8(292), hb = dat[bt];\n // huffman weights\n var hw = buf.subarray(0, 256);\n // rank count\n var rc = buf.subarray(256, 268);\n // rank index\n var ri = new u16(buf.buffer, 268);\n // NOTE: at this point bt is 1 less than expected\n if (hb < 128) {\n // end byte, fse decode table\n var _a = rfse(dat, bt + 1, 6), ebt = _a[0], fdt = _a[1];\n bt += hb;\n var epos = ebt << 3;\n // last byte\n var lb = dat[bt];\n if (!lb)\n err(0);\n // state1 state2 state1 bits state2 bits\n var st1 = 0, st2 = 0, btr1 = fdt.b, btr2 = btr1;\n // fse pos\n // pre-increment to account for original deficit of 1\n var fpos = (++bt << 3) - 8 + msb(lb);\n for (;;) {\n fpos -= btr1;\n if (fpos < epos)\n break;\n var cbt = fpos >> 3;\n st1 += ((dat[cbt] | (dat[cbt + 1] << 8)) >> (fpos & 7)) & ((1 << btr1) - 1);\n hw[++wc] = fdt.s[st1];\n fpos -= btr2;\n if (fpos < epos)\n break;\n cbt = fpos >> 3;\n st2 += ((dat[cbt] | (dat[cbt + 1] << 8)) >> (fpos & 7)) & ((1 << btr2) - 1);\n hw[++wc] = fdt.s[st2];\n btr1 = fdt.n[st1];\n st1 = fdt.t[st1];\n btr2 = fdt.n[st2];\n st2 = fdt.t[st2];\n }\n if (++wc > 255)\n err(0);\n }\n else {\n wc = hb - 127;\n for (; i < wc; i += 2) {\n var byte = dat[++bt];\n hw[i] = byte >> 4;\n hw[i + 1] = byte & 15;\n }\n ++bt;\n }\n // weight exponential sum\n var wes = 0;\n for (i = 0; i < wc; ++i) {\n var wt = hw[i];\n // bits must be at most 11, same as weight\n if (wt > 11)\n err(0);\n wes += wt && (1 << (wt - 1));\n }\n // max bits\n var mb = msb(wes) + 1;\n // table size\n var ts = 1 << mb;\n // remaining sum\n var rem = ts - wes;\n // must be power of 2\n if (rem & (rem - 1))\n err(0);\n hw[wc++] = msb(rem) + 1;\n for (i = 0; i < wc; ++i) {\n var wt = hw[i];\n ++rc[hw[i] = wt && (mb + 1 - wt)];\n }\n // huf buf\n var hbuf = new u8(ts << 1);\n // symbols num bits\n var syms = hbuf.subarray(0, ts), nb = hbuf.subarray(ts);\n ri[mb] = 0;\n for (i = mb; i > 0; --i) {\n var pv = ri[i];\n fill(nb, i, pv, ri[i - 1] = pv + rc[i] * (1 << (mb - i)));\n }\n if (ri[0] != ts)\n err(0);\n for (i = 0; i < wc; ++i) {\n var bits = hw[i];\n if (bits) {\n var code = ri[bits];\n fill(syms, i, code, ri[bits] = code + (1 << (mb - bits)));\n }\n }\n return [bt, {\n n: nb,\n b: mb,\n s: syms\n }];\n};\n// Tables generated using this:\n// https://gist.github.com/101arrowz/a979452d4355992cbf8f257cbffc9edd\n// default literal length table\nvar dllt = /*#__PURE__*/ rfse(/*#__PURE__*/ new u8([\n 81, 16, 99, 140, 49, 198, 24, 99, 12, 33, 196, 24, 99, 102, 102, 134, 70, 146, 4\n]), 0, 6)[1];\n// default match length table\nvar dmlt = /*#__PURE__*/ rfse(/*#__PURE__*/ new u8([\n 33, 20, 196, 24, 99, 140, 33, 132, 16, 66, 8, 33, 132, 16, 66, 8, 33, 68, 68, 68, 68, 68, 68, 68, 68, 36, 9\n]), 0, 6)[1];\n// default offset code table\nvar doct = /*#__PURE__ */ rfse(/*#__PURE__*/ new u8([\n 32, 132, 16, 66, 102, 70, 68, 68, 68, 68, 36, 73, 2\n]), 0, 5)[1];\n// bits to baseline\nvar b2bl = function (b, s) {\n var len = b.length, bl = new i32(len);\n for (var i = 0; i < len; ++i) {\n bl[i] = s;\n s += 1 << b[i];\n }\n return bl;\n};\n// literal length bits\nvar llb = /*#__PURE__ */ new u8(( /*#__PURE__ */new i32([\n 0, 0, 0, 0, 16843009, 50528770, 134678020, 202050057, 269422093\n])).buffer, 0, 36);\n// literal length baseline\nvar llbl = /*#__PURE__ */ b2bl(llb, 0);\n// match length bits\nvar mlb = /*#__PURE__ */ new u8(( /*#__PURE__ */new i32([\n 0, 0, 0, 0, 0, 0, 0, 0, 16843009, 50528770, 117769220, 185207048, 252579084, 16\n])).buffer, 0, 53);\n// match length baseline\nvar mlbl = /*#__PURE__ */ b2bl(mlb, 3);\n// decode huffman stream\nvar dhu = function (dat, out, hu) {\n var len = dat.length, ss = out.length, lb = dat[len - 1], msk = (1 << hu.b) - 1, eb = -hu.b;\n if (!lb)\n err(0);\n var st = 0, btr = hu.b, pos = (len << 3) - 8 + msb(lb) - btr, i = -1;\n for (; pos > eb && i < ss;) {\n var cbt = pos >> 3;\n var val = (dat[cbt] | (dat[cbt + 1] << 8) | (dat[cbt + 2] << 16)) >> (pos & 7);\n st = ((st << btr) | val) & msk;\n out[++i] = hu.s[st];\n pos -= (btr = hu.n[st]);\n }\n if (pos != eb || i + 1 != ss)\n err(0);\n};\n// decode huffman stream 4x\n// TODO: use workers to parallelize\nvar dhu4 = function (dat, out, hu) {\n var bt = 6;\n var ss = out.length, sz1 = (ss + 3) >> 2, sz2 = sz1 << 1, sz3 = sz1 + sz2;\n dhu(dat.subarray(bt, bt += dat[0] | (dat[1] << 8)), out.subarray(0, sz1), hu);\n dhu(dat.subarray(bt, bt += dat[2] | (dat[3] << 8)), out.subarray(sz1, sz2), hu);\n dhu(dat.subarray(bt, bt += dat[4] | (dat[5] << 8)), out.subarray(sz2, sz3), hu);\n dhu(dat.subarray(bt), out.subarray(sz3), hu);\n};\n// read Zstandard block\nvar rzb = function (dat, st, out) {\n var _a;\n var bt = st.b;\n // byte 0 block type\n var b0 = dat[bt], btype = (b0 >> 1) & 3;\n st.l = b0 & 1;\n var sz = (b0 >> 3) | (dat[bt + 1] << 5) | (dat[bt + 2] << 13);\n // end byte for block\n var ebt = (bt += 3) + sz;\n if (btype == 1) {\n if (bt >= dat.length)\n return;\n st.b = bt + 1;\n if (out) {\n fill(out, dat[bt], st.y, st.y += sz);\n return out;\n }\n return fill(new u8(sz), dat[bt]);\n }\n if (ebt > dat.length)\n return;\n if (btype == 0) {\n st.b = ebt;\n if (out) {\n out.set(dat.subarray(bt, ebt), st.y);\n st.y += sz;\n return out;\n }\n return slc(dat, bt, ebt);\n }\n if (btype == 2) {\n // byte 3 lit btype size format\n var b3 = dat[bt], lbt = b3 & 3, sf = (b3 >> 2) & 3;\n // lit src size lit cmp sz 4 streams\n var lss = b3 >> 4, lcs = 0, s4 = 0;\n if (lbt < 2) {\n if (sf & 1)\n lss |= (dat[++bt] << 4) | ((sf & 2) && (dat[++bt] << 12));\n else\n lss = b3 >> 3;\n }\n else {\n s4 = sf;\n if (sf < 2)\n lss |= ((dat[++bt] & 63) << 4), lcs = (dat[bt] >> 6) | (dat[++bt] << 2);\n else if (sf == 2)\n lss |= (dat[++bt] << 4) | ((dat[++bt] & 3) << 12), lcs = (dat[bt] >> 2) | (dat[++bt] << 6);\n else\n lss |= (dat[++bt] << 4) | ((dat[++bt] & 63) << 12), lcs = (dat[bt] >> 6) | (dat[++bt] << 2) | (dat[++bt] << 10);\n }\n ++bt;\n // add literals to end - can never overlap with backreferences because unused literals always appended\n var buf = out ? out.subarray(st.y, st.y + st.m) : new u8(st.m);\n // starting point for literals\n var spl = buf.length - lss;\n if (lbt == 0)\n buf.set(dat.subarray(bt, bt += lss), spl);\n else if (lbt == 1)\n fill(buf, dat[bt++], spl);\n else {\n // huffman table\n var hu = st.h;\n if (lbt == 2) {\n var hud = rhu(dat, bt);\n // subtract description length\n lcs += bt - (bt = hud[0]);\n st.h = hu = hud[1];\n }\n else if (!hu)\n err(0);\n (s4 ? dhu4 : dhu)(dat.subarray(bt, bt += lcs), buf.subarray(spl), hu);\n }\n // num sequences\n var ns = dat[bt++];\n if (ns) {\n if (ns == 255)\n ns = (dat[bt++] | (dat[bt++] << 8)) + 0x7F00;\n else if (ns > 127)\n ns = ((ns - 128) << 8) | dat[bt++];\n // symbol compression modes\n var scm = dat[bt++];\n if (scm & 3)\n err(0);\n var dts = [dmlt, doct, dllt];\n for (var i = 2; i > -1; --i) {\n var md = (scm >> ((i << 1) + 2)) & 3;\n if (md == 1) {\n // rle buf\n var rbuf = new u8([0, 0, dat[bt++]]);\n dts[i] = {\n s: rbuf.subarray(2, 3),\n n: rbuf.subarray(0, 1),\n t: new u16(rbuf.buffer, 0, 1),\n b: 0\n };\n }\n else if (md == 2) {\n // accuracy log 8 for offsets, 9 for others\n _a = rfse(dat, bt, 9 - (i & 1)), bt = _a[0], dts[i] = _a[1];\n }\n else if (md == 3) {\n if (!st.t)\n err(0);\n dts[i] = st.t[i];\n }\n }\n var _b = st.t = dts, mlt = _b[0], oct = _b[1], llt = _b[2];\n var lb = dat[ebt - 1];\n if (!lb)\n err(0);\n var spos = (ebt << 3) - 8 + msb(lb) - llt.b, cbt = spos >> 3, oubt = 0;\n var lst = ((dat[cbt] | (dat[cbt + 1] << 8)) >> (spos & 7)) & ((1 << llt.b) - 1);\n cbt = (spos -= oct.b) >> 3;\n var ost = ((dat[cbt] | (dat[cbt + 1] << 8)) >> (spos & 7)) & ((1 << oct.b) - 1);\n cbt = (spos -= mlt.b) >> 3;\n var mst = ((dat[cbt] | (dat[cbt + 1] << 8)) >> (spos & 7)) & ((1 << mlt.b) - 1);\n for (++ns; --ns;) {\n var llc = llt.s[lst];\n var lbtr = llt.n[lst];\n var mlc = mlt.s[mst];\n var mbtr = mlt.n[mst];\n var ofc = oct.s[ost];\n var obtr = oct.n[ost];\n cbt = (spos -= ofc) >> 3;\n var ofp = 1 << ofc;\n var off = ofp + (((dat[cbt] | (dat[cbt + 1] << 8) | (dat[cbt + 2] << 16) | (dat[cbt + 3] << 24)) >>> (spos & 7)) & (ofp - 1));\n cbt = (spos -= mlb[mlc]) >> 3;\n var ml = mlbl[mlc] + (((dat[cbt] | (dat[cbt + 1] << 8) | (dat[cbt + 2] << 16)) >> (spos & 7)) & ((1 << mlb[mlc]) - 1));\n cbt = (spos -= llb[llc]) >> 3;\n var ll = llbl[llc] + (((dat[cbt] | (dat[cbt + 1] << 8) | (dat[cbt + 2] << 16)) >> (spos & 7)) & ((1 << llb[llc]) - 1));\n cbt = (spos -= lbtr) >> 3;\n lst = llt.t[lst] + (((dat[cbt] | (dat[cbt + 1] << 8)) >> (spos & 7)) & ((1 << lbtr) - 1));\n cbt = (spos -= mbtr) >> 3;\n mst = mlt.t[mst] + (((dat[cbt] | (dat[cbt + 1] << 8)) >> (spos & 7)) & ((1 << mbtr) - 1));\n cbt = (spos -= obtr) >> 3;\n ost = oct.t[ost] + (((dat[cbt] | (dat[cbt + 1] << 8)) >> (spos & 7)) & ((1 << obtr) - 1));\n if (off > 3) {\n st.o[2] = st.o[1];\n st.o[1] = st.o[0];\n st.o[0] = off -= 3;\n }\n else {\n var idx = off - (ll != 0);\n if (idx) {\n off = idx == 3 ? st.o[0] - 1 : st.o[idx];\n if (idx > 1)\n st.o[2] = st.o[1];\n st.o[1] = st.o[0];\n st.o[0] = off;\n }\n else\n off = st.o[0];\n }\n for (var i = 0; i < ll; ++i) {\n buf[oubt + i] = buf[spl + i];\n }\n oubt += ll, spl += ll;\n var stin = oubt - off;\n if (stin < 0) {\n var len = -stin;\n var bs = st.e + stin;\n if (len > ml)\n len = ml;\n for (var i = 0; i < len; ++i) {\n buf[oubt + i] = st.w[bs + i];\n }\n oubt += len, ml -= len, stin = 0;\n }\n for (var i = 0; i < ml; ++i) {\n buf[oubt + i] = buf[stin + i];\n }\n oubt += ml;\n }\n if (oubt != spl) {\n while (spl < buf.length) {\n buf[oubt++] = buf[spl++];\n }\n }\n else\n oubt = buf.length;\n if (out)\n st.y += oubt;\n else\n buf = slc(buf, 0, oubt);\n }\n else if (out) {\n st.y += lss;\n if (spl) {\n for (var i = 0; i < lss; ++i) {\n buf[i] = buf[spl + i];\n }\n }\n }\n else if (spl)\n buf = slc(buf, spl);\n st.b = ebt;\n return buf;\n }\n err(2);\n};\n// concat\nvar cct = function (bufs, ol) {\n if (bufs.length == 1)\n return bufs[0];\n var buf = new u8(ol);\n for (var i = 0, b = 0; i < bufs.length; ++i) {\n var chk = bufs[i];\n buf.set(chk, b);\n b += chk.length;\n }\n return buf;\n};\n/**\n * Decompresses Zstandard data\n * @param dat The input data\n * @param buf The output buffer. If unspecified, the function will allocate\n * exactly enough memory to fit the decompressed data. If your\n * data has multiple frames and you know the output size, specifying\n * it will yield better performance.\n * @returns The decompressed data\n */\nexport function decompress(dat, buf) {\n var bufs = [], nb = +!buf;\n var bt = 0, ol = 0;\n for (; dat.length;) {\n var st = rzfh(dat, nb || buf);\n if (typeof st == 'object') {\n if (nb) {\n buf = null;\n if (st.w.length == st.u) {\n bufs.push(buf = st.w);\n ol += st.u;\n }\n }\n else {\n bufs.push(buf);\n st.e = 0;\n }\n for (; !st.l;) {\n var blk = rzb(dat, st, buf);\n if (!blk)\n err(5);\n if (buf)\n st.e = st.y;\n else {\n bufs.push(blk);\n ol += blk.length;\n cpw(st.w, 0, blk.length);\n st.w.set(blk, st.w.length - blk.length);\n }\n }\n bt = st.b + (st.c * 4);\n }\n else\n bt = st;\n dat = dat.subarray(bt);\n }\n return cct(bufs, ol);\n}\n/**\n * Decompressor for Zstandard streamed data\n */\nvar Decompress = /*#__PURE__*/ (function () {\n /**\n * Creates a Zstandard decompressor\n * @param ondata The handler for stream data\n */\n function Decompress(ondata) {\n this.ondata = ondata;\n this.c = [];\n this.l = 0;\n this.z = 0;\n }\n /**\n * Pushes data to be decompressed\n * @param chunk The chunk of data to push\n * @param final Whether or not this is the last chunk in the stream\n */\n Decompress.prototype.push = function (chunk, final) {\n if (typeof this.s == 'number') {\n var sub = Math.min(chunk.length, this.s);\n chunk = chunk.subarray(sub);\n this.s -= sub;\n }\n var sl = chunk.length;\n var ncs = sl + this.l;\n if (!this.s) {\n if (final) {\n if (!ncs) {\n this.ondata(new u8(0), true);\n return;\n }\n // min for frame + one block\n if (ncs < 5)\n err(5);\n }\n else if (ncs < 18) {\n this.c.push(chunk);\n this.l = ncs;\n return;\n }\n if (this.l) {\n this.c.push(chunk);\n chunk = cct(this.c, ncs);\n this.c = [];\n this.l = 0;\n }\n if (typeof (this.s = rzfh(chunk)) == 'number')\n return this.push(chunk, final);\n }\n if (typeof this.s != 'number') {\n if (ncs < (this.z || 3)) {\n if (final)\n err(5);\n this.c.push(chunk);\n this.l = ncs;\n return;\n }\n if (this.l) {\n this.c.push(chunk);\n chunk = cct(this.c, ncs);\n this.c = [];\n this.l = 0;\n }\n if (!this.z && ncs < (this.z = (chunk[this.s.b] & 2) ? 4 : 3 + ((chunk[this.s.b] >> 3) | (chunk[this.s.b + 1] << 5) | (chunk[this.s.b + 2] << 13)))) {\n if (final)\n err(5);\n this.c.push(chunk);\n this.l = ncs;\n return;\n }\n else\n this.z = 0;\n for (;;) {\n var blk = rzb(chunk, this.s);\n if (!blk) {\n if (final)\n err(5);\n var adc = chunk.subarray(this.s.b);\n this.s.b = 0;\n this.c.push(adc), this.l += adc.length;\n return;\n }\n else {\n this.ondata(blk, false);\n cpw(this.s.w, 0, blk.length);\n this.s.w.set(blk, this.s.w.length - blk.length);\n }\n if (this.s.l) {\n var rest = chunk.subarray(this.s.b);\n this.s = this.s.c * 4;\n this.push(rest, final);\n return;\n }\n }\n }\n else if (final)\n err(5);\n };\n return Decompress;\n}());\nexport { Decompress };\n", "async function cpp(moduleArg={}){var Module=moduleArg;var quit_=(status,toThrow)=>{throw toThrow};var _scriptName='';var scriptDirectory=\"\";function locateFile(path){return scriptDirectory+path}var readAsync,readBinary;{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith(\"file://\");var runtimeInitialized=false;function getMemoryBuffer(){return wasmMemory.buffer}function updateMemoryViews(){if(HEAP8?.buffer?.resizable)return;var b=getMemoryBuffer();HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){}function initRuntime(){runtimeInitialized=true;wasmExports[\"A\"]()}function postRun(){}function abort(what){what=`Aborted(${what})`;err(what);ABORT=true;what+=\". Build with -sASSERTIONS for more info.\";if(runtimeInitialized){___trap()}var e=new WebAssembly.RuntimeError(what);throw e}var wasmBinaryFile;const findWasmBinary=()=>\"\";function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw\"both async and sync fetching of the wasm failed\"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!isFileURI(binaryFile)){try{var response=fetch(binaryFile,{credentials:\"same-origin\"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err(\"falling back to ArrayBuffer instantiation\")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result[\"instance\"])}var info=getWasmImports();wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name=\"ExitStatus\";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var HEAP8;var getCppExceptionTag=()=>___cpp_exception;var getCppExceptionThrownObjectFromWebAssemblyException=ex=>{var unwind_header=ex.getArg(getCppExceptionTag(),0);return ___thrown_object_from_unwind_exception(unwind_header)};var stackSave=()=>_emscripten_stack_get_current();var stackRestore=val=>__emscripten_stack_restore(val);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str=\"\";while(idx>10,56320|ch&1023)}}return str};var HEAPU8;var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):\"\";var HEAPU32;var getExceptionMessageCommon=ptr=>{var sp=stackSave();var type_addr_addr=stackAlloc(4);var message_addr_addr=stackAlloc(4);___get_exception_message(ptr,type_addr_addr,message_addr_addr);var type_addr=HEAPU32[type_addr_addr>>2];var message_addr=HEAPU32[message_addr_addr>>2];var type=UTF8ToString(type_addr);_free(type_addr);var message;if(message_addr){message=UTF8ToString(message_addr);_free(message_addr)}stackRestore(sp);return[type,message]};var getExceptionMessage=ex=>{var ptr=getCppExceptionThrownObjectFromWebAssemblyException(ex);return getExceptionMessageCommon(ptr)};var ___throw_exception_with_stack_trace=ex=>{var e=new WebAssembly.Exception(getCppExceptionTag(),[ex],{traceStack:true});e.message=getExceptionMessage(e);throw e};var __abort_js=()=>abort(\"\");var structRegistrations={};var runDestructors=destructors=>{while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}};function readPointer(pointer){return this.fromWireType(HEAPU32[pointer>>2])}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};class InternalError extends Error{constructor(message){super(message);this.name=\"InternalError\"}}var throwInternalError=message=>{throw new InternalError(message)};var whenDependentTypesAreResolved=(myTypes,dependentTypes,getTypeConverters)=>{myTypes.forEach(type=>typeDependencies[type]=dependentTypes);function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError(\"Mismatched type converter count\")}for(var i=0;i{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}}if(0===unregisteredTypes.length){onComplete(typeConverters)}};var __embind_finalize_value_object=structType=>{var reg=structRegistrations[structType];delete structRegistrations[structType];var rawConstructor=reg.rawConstructor;var rawDestructor=reg.rawDestructor;var fieldRecords=reg.fields;var fieldTypes=fieldRecords.map(field=>field.getterReturnType).concat(fieldRecords.map(field=>field.setterArgumentType));whenDependentTypesAreResolved([structType],fieldTypes,fieldTypes=>{var fields={};for(var[i,field]of fieldRecords.entries()){const getterReturnType=fieldTypes[i];const getter=field.getter;const getterContext=field.getterContext;const setterArgumentType=fieldTypes[i+fieldRecords.length];const setter=field.setter;const setterContext=field.setterContext;fields[field.fieldName]={read:ptr=>getterReturnType.fromWireType(getter(getterContext,ptr)),write:(ptr,o)=>{var destructors=[];setter(setterContext,ptr,setterArgumentType.toWireType(destructors,o));runDestructors(destructors)},optional:getterReturnType.optional}}return[{name:reg.name,fromWireType:ptr=>{var rv={};for(var i in fields){rv[i]=fields[i].read(ptr)}rawDestructor(ptr);return rv},toWireType:(destructors,o)=>{for(var fieldName in fields){if(!(fieldName in o)&&!fields[fieldName].optional){throw new TypeError(`Missing field: \"${fieldName}\"`)}}var ptr=rawConstructor();for(fieldName in fields){fields[fieldName].write(ptr,o[fieldName])}if(destructors!==null){destructors.push(rawDestructor,ptr)}return ptr},readValueFromPointer:readPointer,destructorFunction:rawDestructor}]})};var AsciiToString=ptr=>{var str=\"\";while(1){var ch=HEAPU8[ptr++];if(!ch)return str;str+=String.fromCharCode(ch)}};class BindingError extends Error{constructor(message){super(message);this.name=\"BindingError\"}}var throwBindingError=message=>{throw new BindingError(message)};function sharedRegisterType(rawType,registeredInstance,options={}){var name=registeredInstance.name;if(!rawType){throwBindingError(`type \"${name}\" must have a positive integer typeid pointer`)}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError(`Cannot register type '${name}' twice`)}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function registerType(rawType,registeredInstance,options={}){return sharedRegisterType(rawType,registeredInstance,options)}var HEAP16;var HEAPU16;var HEAP32;var HEAP64;var HEAPU64;var integerReadValueFromPointer=(name,width,signed)=>{switch(width){case 1:return signed?pointer=>HEAP8[pointer]:pointer=>HEAPU8[pointer];case 2:return signed?pointer=>HEAP16[pointer>>1]:pointer=>HEAPU16[pointer>>1];case 4:return signed?pointer=>HEAP32[pointer>>2]:pointer=>HEAPU32[pointer>>2];case 8:return signed?pointer=>HEAP64[pointer>>3]:pointer=>HEAPU64[pointer>>3];default:throw new TypeError(`invalid integer width (${width}): ${name}`)}};var __embind_register_bigint=(primitiveType,name,size,minRange,maxRange)=>{name=AsciiToString(name);const isUnsignedType=minRange===0n;let fromWireType=value=>value;if(isUnsignedType){const bitSize=size*8;fromWireType=value=>BigInt.asUintN(bitSize,value);maxRange=fromWireType(maxRange)}registerType(primitiveType,{name,fromWireType,toWireType:(destructors,value)=>{if(typeof value==\"number\"){value=BigInt(value)}return value},readValueFromPointer:integerReadValueFromPointer(name,size,!isUnsignedType),destructorFunction:null})};var __embind_register_bool=(rawType,name,trueValue,falseValue)=>{name=AsciiToString(name);registerType(rawType,{name,fromWireType:function(wt){return!!wt},toWireType:function(destructors,o){return o?trueValue:falseValue},readValueFromPointer:function(pointer){return this.fromWireType(HEAPU8[pointer])},destructorFunction:null})};var shallowCopyInternalPointer=o=>({count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType});var throwInstanceAlreadyDeleted=obj=>{function getInstanceTypeName(handle){return handle.$$.ptrType.registeredClass.name}throwBindingError(getInstanceTypeName(obj)+\" instance already deleted\")};var finalizationRegistry=false;var detachFinalizer=handle=>{};var runDestructor=$$=>{if($$.smartPtr){$$.smartPtrType.rawDestructor($$.smartPtr)}else{$$.ptrType.registeredClass.rawDestructor($$.ptr)}};var releaseClassHandle=$$=>{$$.count.value-=1;var toDelete=0===$$.count.value;if(toDelete){runDestructor($$)}};var attachFinalizer=handle=>{if(!globalThis.FinalizationRegistry){attachFinalizer=handle=>handle;return handle}finalizationRegistry=new FinalizationRegistry(info=>{releaseClassHandle(info.$$)});attachFinalizer=handle=>{var $$=handle.$$;var hasSmartPtr=!!$$.smartPtr;if(hasSmartPtr){var info={$$};finalizationRegistry.register(handle,info,handle)}return handle};detachFinalizer=handle=>finalizationRegistry.unregister(handle);return attachFinalizer(handle)};var deletionQueue=[];var flushPendingDeletes=()=>{while(deletionQueue.length){var obj=deletionQueue.pop();obj.$$.deleteScheduled=false;obj[\"delete\"]()}};var delayFunction;var init_ClassHandle=()=>{let proto=ClassHandle.prototype;Object.assign(proto,{isAliasOf(other){if(!(this instanceof ClassHandle)){return false}if(!(other instanceof ClassHandle)){return false}var leftClass=this.$$.ptrType.registeredClass;var left=this.$$.ptr;other.$$=other.$$;var rightClass=other.$$.ptrType.registeredClass;var right=other.$$.ptr;while(leftClass.baseClass){left=leftClass.upcast(left);leftClass=leftClass.baseClass}while(rightClass.baseClass){right=rightClass.upcast(right);rightClass=rightClass.baseClass}return leftClass===rightClass&&left===right},clone(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.preservePointerOnDelete){this.$$.count.value+=1;return this}else{var clone=attachFinalizer(Object.create(Object.getPrototypeOf(this),{$$:{value:shallowCopyInternalPointer(this.$$)}}));clone.$$.count.value+=1;clone.$$.deleteScheduled=false;return clone}},delete(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError(\"Object already scheduled for deletion\")}detachFinalizer(this);releaseClassHandle(this.$$);if(!this.$$.preservePointerOnDelete){this.$$.smartPtr=undefined;this.$$.ptr=undefined}},isDeleted(){return!this.$$.ptr},deleteLater(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError(\"Object already scheduled for deletion\")}deletionQueue.push(this);if(deletionQueue.length===1&&delayFunction){delayFunction(flushPendingDeletes)}this.$$.deleteScheduled=true;return this}});const symbolDispose=Symbol.dispose;if(symbolDispose){proto[symbolDispose]=proto[\"delete\"]}};function ClassHandle(){}var createNamedFunction=(name,func)=>Object.defineProperty(func,\"name\",{value:name});var registeredPointers={};var ensureOverloadTable=(proto,methodName,humanName)=>{if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(...args){if(!proto[methodName].overloadTable.hasOwnProperty(args.length)){throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${args.length}) - expects one of (${proto[methodName].overloadTable})!`)}return proto[methodName].overloadTable[args.length].apply(this,args)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}};var exposePublicSymbol=(name,value,numArguments)=>{if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError(`Cannot register public name '${name}' twice`)}ensureOverloadTable(Module,name,name);if(Module[name].overloadTable.hasOwnProperty(numArguments)){throwBindingError(`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`)}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var char_0=48;var char_9=57;var makeLegalFunctionName=name=>{name=name.replace(/[^a-zA-Z0-9_]/g,\"$\");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return`_${name}`}return name};function RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast){this.name=name;this.constructor=constructor;this.instancePrototype=instancePrototype;this.rawDestructor=rawDestructor;this.baseClass=baseClass;this.getActualType=getActualType;this.upcast=upcast;this.downcast=downcast;this.pureVirtualFunctions=[]}var upcastPointer=(ptr,ptrClass,desiredClass)=>{while(ptrClass!==desiredClass){if(!ptrClass.upcast){throwBindingError(`Expected null or instance of ${desiredClass.name}, got an instance of ${ptrClass.name}`)}ptr=ptrClass.upcast(ptr);ptrClass=ptrClass.baseClass}return ptr};var embindRepr=v=>{if(v===null){return\"null\"}var t=typeof v;if(t===\"object\"||t===\"array\"||t===\"function\"){return v.toString()}else{return\"\"+v}};function constNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError(`null is not a valid ${this.name}`)}return 0}if(!handle.$$){throwBindingError(`Cannot pass \"${embindRepr(handle)}\" as a ${this.name}`)}if(!handle.$$.ptr){throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function genericPointerToWireType(destructors,handle){var ptr;if(handle===null){if(this.isReference){throwBindingError(`null is not a valid ${this.name}`)}if(this.isSmartPointer){ptr=this.rawConstructor();if(destructors!==null){destructors.push(this.rawDestructor,ptr)}return ptr}else{return 0}}if(!handle||!handle.$$){throwBindingError(`Cannot pass \"${embindRepr(handle)}\" as a ${this.name}`)}if(!handle.$$.ptr){throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`)}if(!this.isConst&&handle.$$.ptrType.isConst){throwBindingError(`Cannot convert argument of type ${handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name} to parameter type ${this.name}`)}var handleClass=handle.$$.ptrType.registeredClass;ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);if(this.isSmartPointer){if(undefined===handle.$$.smartPtr){throwBindingError(\"Passing raw pointer to smart pointer is illegal\")}switch(this.sharingPolicy){case 0:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{throwBindingError(`Cannot convert argument of type ${handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name} to parameter type ${this.name}`)}break;case 1:ptr=handle.$$.smartPtr;break;case 2:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{var clonedHandle=handle[\"clone\"]();ptr=this.rawShare(ptr,Emval.toHandle(()=>clonedHandle[\"delete\"]()));if(destructors!==null){destructors.push(this.rawDestructor,ptr)}}break;default:throwBindingError(\"Unsupported sharing policy\")}}return ptr}function nonConstNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError(`null is not a valid ${this.name}`)}return 0}if(!handle.$$){throwBindingError(`Cannot pass \"${embindRepr(handle)}\" as a ${this.name}`)}if(!handle.$$.ptr){throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`)}if(handle.$$.ptrType.isConst){throwBindingError(`Cannot convert argument of type ${handle.$$.ptrType.name} to parameter type ${this.name}`)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}var downcastPointer=(ptr,ptrClass,desiredClass)=>{if(ptrClass===desiredClass){return ptr}if(undefined===desiredClass.baseClass){return null}var rv=downcastPointer(ptr,ptrClass,desiredClass.baseClass);if(rv===null){return null}return desiredClass.downcast(rv)};var registeredInstances={};var getBasestPointer=(class_,ptr)=>{if(ptr===undefined){throwBindingError(\"ptr should not be undefined\")}while(class_.baseClass){ptr=class_.upcast(ptr);class_=class_.baseClass}return ptr};var getInheritedInstance=(class_,ptr)=>{ptr=getBasestPointer(class_,ptr);return registeredInstances[ptr]};var makeClassHandle=(prototype,record)=>{if(!record.ptrType||!record.ptr){throwInternalError(\"makeClassHandle requires ptr and ptrType\")}var hasSmartPtrType=!!record.smartPtrType;var hasSmartPtr=!!record.smartPtr;if(hasSmartPtrType!==hasSmartPtr){throwInternalError(\"Both smartPtrType and smartPtr must be specified\")}record.count={value:1};return attachFinalizer(Object.create(prototype,{$$:{value:record,writable:true}}))};function RegisteredPointer_fromWireType(ptr){var rawPointer=this.getPointee(ptr);if(!rawPointer){this.destructor(ptr);return null}var registeredInstance=getInheritedInstance(this.registeredClass,rawPointer);if(undefined!==registeredInstance){if(0===registeredInstance.$$.count.value){registeredInstance.$$.ptr=rawPointer;registeredInstance.$$.smartPtr=ptr;return registeredInstance[\"clone\"]()}else{var rv=registeredInstance[\"clone\"]();this.destructor(ptr);return rv}}function makeDefaultHandle(){if(this.isSmartPointer){return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:rawPointer,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this,ptr})}}var actualType=this.registeredClass.getActualType(rawPointer);var registeredPointerRecord=registeredPointers[actualType];if(!registeredPointerRecord){return makeDefaultHandle.call(this)}var toType;if(this.isConst){toType=registeredPointerRecord.constPointerType}else{toType=registeredPointerRecord.pointerType}var dp=downcastPointer(rawPointer,this.registeredClass,toType.registeredClass);if(dp===null){return makeDefaultHandle.call(this)}if(this.isSmartPointer){return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp})}}var init_RegisteredPointer=()=>{Object.assign(RegisteredPointer.prototype,{getPointee(ptr){if(this.rawGetPointee){ptr=this.rawGetPointee(ptr)}return ptr},destructor(ptr){this.rawDestructor?.(ptr)},readValueFromPointer:readPointer,fromWireType:RegisteredPointer_fromWireType})};function RegisteredPointer(name,registeredClass,isReference,isConst,isSmartPointer,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor){this.name=name;this.registeredClass=registeredClass;this.isReference=isReference;this.isConst=isConst;this.isSmartPointer=isSmartPointer;this.pointeeType=pointeeType;this.sharingPolicy=sharingPolicy;this.rawGetPointee=rawGetPointee;this.rawConstructor=rawConstructor;this.rawShare=rawShare;this.rawDestructor=rawDestructor;if(!isSmartPointer&®isteredClass.baseClass===undefined){if(isConst){this.toWireType=constNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else{this.toWireType=nonConstNoSmartPtrRawPointerToWireType;this.destructorFunction=null}}else{this.toWireType=genericPointerToWireType}}var replacePublicSymbol=(name,value,numArguments)=>{if(!Module.hasOwnProperty(name)){throwInternalError(\"Replacing nonexistent public symbol\")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var getWasmTableEntry=funcPtr=>wasmTable.get(funcPtr);var embind__requireFunction=(signature,rawFunction,isAsync=false)=>{signature=AsciiToString(signature);function makeDynCaller(){var rtn=getWasmTableEntry(rawFunction);return rtn}var fp=makeDynCaller();if(typeof fp!=\"function\"){throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`)}return fp};class UnboundTypeError extends Error{}var getTypeName=type=>{var ptr=___getTypeName(type);var rv=AsciiToString(ptr);_free(ptr);return rv};var throwUnboundTypeError=(message,types)=>{var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(`${message}: `+unboundTypes.map(getTypeName).join([\", \"]))};var __embind_register_class=(rawType,rawPointerType,rawConstPointerType,baseClassRawType,getActualTypeSignature,getActualType,upcastSignature,upcast,downcastSignature,downcast,name,destructorSignature,rawDestructor)=>{name=AsciiToString(name);getActualType=embind__requireFunction(getActualTypeSignature,getActualType);upcast&&=embind__requireFunction(upcastSignature,upcast);downcast&&=embind__requireFunction(downcastSignature,downcast);rawDestructor=embind__requireFunction(destructorSignature,rawDestructor);var legalFunctionName=makeLegalFunctionName(name);exposePublicSymbol(legalFunctionName,function(){throwUnboundTypeError(`Cannot construct ${name} due to unbound types`,[baseClassRawType])});whenDependentTypesAreResolved([rawType,rawPointerType,rawConstPointerType],baseClassRawType?[baseClassRawType]:[],base=>{base=base[0];var baseClass;var basePrototype;if(baseClassRawType){baseClass=base.registeredClass;basePrototype=baseClass.instancePrototype}else{basePrototype=ClassHandle.prototype}var constructor=createNamedFunction(name,function(...args){if(Object.getPrototypeOf(this)!==instancePrototype){throw new BindingError(`Use 'new' to construct ${name}`)}if(undefined===registeredClass.constructor_body){throw new BindingError(`${name} has no accessible constructor`)}var body=registeredClass.constructor_body[args.length];if(undefined===body){throw new BindingError(`Tried to invoke ctor of ${name} with invalid number of parameters (${args.length}) - expected (${Object.keys(registeredClass.constructor_body).toString()}) parameters instead!`)}return body.apply(this,args)});var instancePrototype=Object.create(basePrototype,{constructor:{value:constructor}});constructor.prototype=instancePrototype;var registeredClass=new RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast);if(registeredClass.baseClass){registeredClass.baseClass.__derivedClasses??=[];registeredClass.baseClass.__derivedClasses.push(registeredClass)}var referenceConverter=new RegisteredPointer(name,registeredClass,true,false,false);var pointerConverter=new RegisteredPointer(name+\"*\",registeredClass,false,false,false);var constPointerConverter=new RegisteredPointer(name+\" const*\",registeredClass,false,true,false);registeredPointers[rawType]={pointerType:pointerConverter,constPointerType:constPointerConverter};replacePublicSymbol(legalFunctionName,constructor);return[referenceConverter,pointerConverter,constPointerConverter]})};function usesDestructorStack(argTypes){for(var i=1;i{var array=[];for(var i=0;i>2])}return array};var getFunctionName=signature=>{signature=signature.trim();const argsIndex=signature.indexOf(\"(\");if(argsIndex===-1)return signature;return signature.slice(0,argsIndex)};var __embind_register_class_class_function=(rawClassType,methodName,argCount,rawArgTypesAddr,invokerSignature,rawInvoker,fn,isAsync,isNonnullReturn)=>{var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);methodName=AsciiToString(methodName);methodName=getFunctionName(methodName);rawInvoker=embind__requireFunction(invokerSignature,rawInvoker,isAsync);whenDependentTypesAreResolved([],[rawClassType],classType=>{classType=classType[0];var humanName=`${classType.name}.${methodName}`;function unboundTypesHandler(){throwUnboundTypeError(`Cannot call ${humanName} due to unbound types`,rawArgTypes)}if(methodName.startsWith(\"@@\")){methodName=Symbol[methodName.substring(2)]}var proto=classType.registeredClass.constructor;if(undefined===proto[methodName]){unboundTypesHandler.argCount=argCount-1;proto[methodName]=unboundTypesHandler}else{ensureOverloadTable(proto,methodName,humanName);proto[methodName].overloadTable[argCount-1]=unboundTypesHandler}whenDependentTypesAreResolved([],rawArgTypes,argTypes=>{var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));var func=craftInvokerFunction(humanName,invokerArgsArray,null,rawInvoker,fn,isAsync);if(undefined===proto[methodName].overloadTable){func.argCount=argCount-1;proto[methodName]=func}else{proto[methodName].overloadTable[argCount-1]=func}if(classType.registeredClass.__derivedClasses){for(const derivedClass of classType.registeredClass.__derivedClasses){if(!derivedClass.constructor.hasOwnProperty(methodName)){derivedClass.constructor[methodName]=func}}}return[]});return[]})};var __embind_register_class_constructor=(rawClassType,argCount,rawArgTypesAddr,invokerSignature,invoker,rawConstructor)=>{var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=embind__requireFunction(invokerSignature,invoker);whenDependentTypesAreResolved([],[rawClassType],classType=>{classType=classType[0];var humanName=`constructor ${classType.name}`;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError(`Cannot register multiple constructors with identical number of parameters (${argCount-1}) for class '${classType.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`)}classType.registeredClass.constructor_body[argCount-1]=()=>{throwUnboundTypeError(`Cannot construct ${classType.name} due to unbound types`,rawArgTypes)};whenDependentTypesAreResolved([],rawArgTypes,argTypes=>{argTypes.splice(1,0,null);classType.registeredClass.constructor_body[argCount-1]=craftInvokerFunction(humanName,argTypes,null,invoker,rawConstructor);return[]});return[]})};var __embind_register_class_function=(rawClassType,methodName,argCount,rawArgTypesAddr,invokerSignature,rawInvoker,context,isPureVirtual,isAsync,isNonnullReturn)=>{var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);methodName=AsciiToString(methodName);methodName=getFunctionName(methodName);rawInvoker=embind__requireFunction(invokerSignature,rawInvoker,isAsync);whenDependentTypesAreResolved([],[rawClassType],classType=>{classType=classType[0];var humanName=`${classType.name}.${methodName}`;if(methodName.startsWith(\"@@\")){methodName=Symbol[methodName.substring(2)]}if(isPureVirtual){classType.registeredClass.pureVirtualFunctions.push(methodName)}function unboundTypesHandler(){throwUnboundTypeError(`Cannot call ${humanName} due to unbound types`,rawArgTypes)}var proto=classType.registeredClass.instancePrototype;var method=proto[methodName];if(undefined===method||undefined===method.overloadTable&&method.className!==classType.name&&method.argCount===argCount-2){unboundTypesHandler.argCount=argCount-2;unboundTypesHandler.className=classType.name;proto[methodName]=unboundTypesHandler}else{ensureOverloadTable(proto,methodName,humanName);proto[methodName].overloadTable[argCount-2]=unboundTypesHandler}whenDependentTypesAreResolved([],rawArgTypes,argTypes=>{var memberFunction=craftInvokerFunction(humanName,argTypes,classType,rawInvoker,context,isAsync);if(undefined===proto[methodName].overloadTable){memberFunction.argCount=argCount-2;proto[methodName]=memberFunction}else{proto[methodName].overloadTable[argCount-2]=memberFunction}return[]});return[]})};var emval_freelist=[];var emval_handles=[0,1,,1,null,1,true,1,false,1];var emval_exception_decrefs=[];var __emval_decref=handle=>{if(handle>9&&0===--emval_handles[handle+1]){var value=emval_handles[handle];emval_handles[handle]=undefined;var destructor=emval_exception_decrefs[handle];if(destructor){emval_exception_decrefs[handle]=undefined;destructor(value)}emval_freelist.push(handle)}};var Emval={toValue:handle=>{if(!handle){throwBindingError(`Cannot use deleted val. handle = ${handle}`)}return emval_handles[handle]},toHandle:value=>{switch(value){case undefined:return 2;case null:return 4;case true:return 6;case false:return 8;default:{const handle=emval_freelist.pop()||emval_handles.length;emval_handles[handle]=value;emval_handles[handle+1]=1;return handle}}}};var EmValType={name:\"emscripten::val\",fromWireType:handle=>{var rv=Emval.toValue(handle);__emval_decref(handle);return rv},toWireType:(destructors,value)=>Emval.toHandle(value),readValueFromPointer:readPointer,destructorFunction:null};var __embind_register_emval=rawType=>registerType(rawType,EmValType);var HEAPF32;var HEAPF64;var floatReadValueFromPointer=(name,width)=>{switch(width){case 4:return function(pointer){return this.fromWireType(HEAPF32[pointer>>2])};case 8:return function(pointer){return this.fromWireType(HEAPF64[pointer>>3])};default:throw new TypeError(`invalid float width (${width}): ${name}`)}};var __embind_register_float=(rawType,name,size)=>{name=AsciiToString(name);registerType(rawType,{name,fromWireType:value=>value,toWireType:(destructors,value)=>value,readValueFromPointer:floatReadValueFromPointer(name,size),destructorFunction:null})};var __embind_register_integer=(primitiveType,name,size,minRange,maxRange)=>{name=AsciiToString(name);const isUnsignedType=minRange===0;let fromWireType=value=>value;if(isUnsignedType){var bitshift=32-8*size;fromWireType=value=>value<>>bitshift;maxRange=fromWireType(maxRange)}registerType(primitiveType,{name,fromWireType,toWireType:(destructors,value)=>value,readValueFromPointer:integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null})};var __embind_register_memory_view=(rawType,dataTypeIndex,name)=>{var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size)}name=AsciiToString(name);registerType(rawType,{name,fromWireType:decodeMemoryView,readValueFromPointer:decodeMemoryView},{ignoreDuplicateRegistrations:true})};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var lengthBytesUTF8=str=>{var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var __embind_register_std_string=(rawType,name)=>{name=AsciiToString(name);var stdStringIsUTF8=true;registerType(rawType,{name,fromWireType(value){var length=HEAPU32[value>>2];var payload=value+4;var str;if(stdStringIsUTF8){str=UTF8ToString(payload,length,true)}else{str=\"\";for(var i=0;i>2]=length;if(valueIsOfTypeString){if(stdStringIsUTF8){stringToUTF8(value,ptr,length+1)}else{for(var i=0;i255){_free(base);throwBindingError(\"String has UTF-16 code units that do not fit in 8 bits\")}HEAPU8[ptr+i]=charCode}}}else{HEAPU8.set(value,ptr)}if(destructors!==null){destructors.push(_free,base)}return base},readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var UTF16Decoder=globalThis.TextDecoder?new TextDecoder(\"utf-16le\"):undefined;var UTF16ToString=(ptr,maxBytesToRead,ignoreNul)=>{var idx=ptr>>1;var endIdx=findStringEnd(HEAPU16,idx,maxBytesToRead/2,ignoreNul);if(endIdx-idx>16&&UTF16Decoder)return UTF16Decoder.decode(HEAPU16.subarray(idx,endIdx));var str=\"\";for(var i=idx;i{if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr};var lengthBytesUTF16=str=>str.length*2;var UTF32ToString=(ptr,maxBytesToRead,ignoreNul)=>{var str=\"\";var startIdx=ptr>>2;for(var i=0;!(i>=maxBytesToRead/4);i++){var utf32=HEAPU32[startIdx+i];if(!utf32&&!ignoreNul)break;str+=String.fromCodePoint(utf32)}return str};var stringToUTF32=(str,outPtr,maxBytesToWrite=2147483647)=>{if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i65535){i++}HEAP32[outPtr>>2]=codePoint;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr};var lengthBytesUTF32=str=>{var len=0;for(var i=0;i65535){i++}len+=4}return len};var __embind_register_std_wstring=(rawType,charSize,name)=>{name=AsciiToString(name);var decodeString,encodeString,lengthBytesUTF;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16}else{decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32}registerType(rawType,{name,fromWireType:value=>{var length=HEAPU32[value>>2];var str=decodeString(value+4,length*charSize,true);_free(value);return str},toWireType:(destructors,value)=>{if(!(typeof value==\"string\")){throwBindingError(`Cannot pass non-string to C++ string type ${name}`)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length/charSize;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var __embind_register_value_object=(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor)=>{structRegistrations[rawType]={name:AsciiToString(name),rawConstructor:embind__requireFunction(constructorSignature,rawConstructor),rawDestructor:embind__requireFunction(destructorSignature,rawDestructor),fields:[]}};var __embind_register_value_object_field=(structType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext)=>{structRegistrations[structType].fields.push({fieldName:AsciiToString(fieldName),getterReturnType,getter:embind__requireFunction(getterSignature,getter),getterContext,setterArgumentType,setter:embind__requireFunction(setterSignature,setter),setterContext})};var __embind_register_void=(rawType,name)=>{name=AsciiToString(name);registerType(rawType,{isVoid:true,name,fromWireType:()=>undefined,toWireType:(destructors,o)=>undefined})};var runtimeKeepaliveCounter=0;var __emscripten_runtime_keepalive_clear=()=>{runtimeKeepaliveCounter=0};var timers={};var handleException=e=>{if(e instanceof ExitStatus||e==\"unwind\"){return EXITSTATUS}quit_(1,e)};var keepRuntimeAlive=()=>true;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{return func()}catch(e){handleException(e)}finally{maybeExit()}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which]}if(!timeout_ms)return 0;var id=setTimeout(()=>{delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()))},timeout_ms);timers[which]={id,timeout_ms};return 0};var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var _fd_close=fd=>52;var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>numINT53_MAX?NaN:Number(num);function _fd_seek(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);return 70}var printCharBuffers=[null,[],[]];var printChar=(stream,curr)=>{var buffer=printCharBuffers[stream];if(!curr||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer));buffer.length=0}else{buffer.push(curr)}};var _fd_write=(fd,iov,iovcnt,pnum)=>{var num=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j>2]=num;return 0};init_ClassHandle();init_RegisteredPointer();{if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"]}Module[\"UTF8ToString\"]=UTF8ToString;Module[\"stringToUTF8\"]=stringToUTF8;Module[\"lengthBytesUTF8\"]=lengthBytesUTF8;var ___getTypeName,_malloc,_free,__emscripten_timeout,___trap,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___thrown_object_from_unwind_exception,___get_exception_message,memory,__indirect_function_table,___cpp_exception,wasmMemory,wasmTable;function assignWasmExports(wasmExports){___getTypeName=wasmExports[\"B\"];_malloc=Module[\"_malloc\"]=wasmExports[\"C\"];_free=Module[\"_free\"]=wasmExports[\"D\"];__emscripten_timeout=wasmExports[\"F\"];___trap=wasmExports[\"G\"];__emscripten_stack_restore=wasmExports[\"H\"];__emscripten_stack_alloc=wasmExports[\"I\"];_emscripten_stack_get_current=wasmExports[\"J\"];___thrown_object_from_unwind_exception=wasmExports[\"K\"];___get_exception_message=wasmExports[\"L\"];memory=wasmMemory=wasmExports[\"z\"];__indirect_function_table=wasmTable=wasmExports[\"E\"];___cpp_exception=wasmExports[\"M\"]}var wasmImports={t:___throw_exception_with_stack_trace,x:__abort_js,f:__embind_finalize_value_object,i:__embind_register_bigint,l:__embind_register_bool,o:__embind_register_class,b:__embind_register_class_class_function,n:__embind_register_class_constructor,d:__embind_register_class_function,y:__embind_register_emval,h:__embind_register_float,c:__embind_register_integer,a:__embind_register_memory_view,k:__embind_register_std_string,g:__embind_register_std_wstring,j:__embind_register_value_object,e:__embind_register_value_object_field,m:__embind_register_void,w:__emscripten_runtime_keepalive_clear,p:__setitimer_js,u:_emscripten_resize_heap,s:_fd_close,q:_fd_seek,r:_fd_write,v:_proc_exit};async function run(){preRun();if(ABORT)return;initRuntime();postRun()}var wasmExports;wasmExports=await createWasm();await run();\n;return Module}export default cpp;\n", "import { decompress } from \"fzstd\";\nimport wrapper from \"/home/runner/work/hpcc-js-wasm/hpcc-js-wasm/build/packages/zstd/zstdlib.js\";\n\nconst D = new Int8Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,90,63,64,65,66,-1,67,68,69,70,71,-1,72,73,52,53,54,55,56,57,58,59,60,61,74,75,76,77,78,79,80,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,81,-1,82,83,84,85,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,86,87,88,89,-1]);\n\nfunction decode(s: string): Uint8Array {\n const out = new Uint8Array(170930);\n let pos = 0, b = 0, n = 0, v = -1;\n\n for (let i = 0, len = s.length; i < len; i++) {\n const c = s.charCodeAt(i);\n if (c > 127) continue;\n const p = D[c];\n if (p < 0) continue;\n if (v < 0) {\n v = p;\n } else {\n v += p * 91;\n b |= v << n;\n n += (v & 8191) > 88 ? 13 : 14;\n do {\n out[pos++] = b;\n b >>>= 8;\n n -= 8;\n } while (n > 7);\n v = -1;\n }\n }\n\n if (v >= 0) out[pos++] = (b | v << n) & 0xff;\n\n return out;\n}\n\nconst blobStr = 'v7#a#A&ip?h=9a``^J`)5x\"o{!v]XzI=DUUZ(C>s3buuP)js,;OtmfQ{Mv[CUC9l[8rB.MDwE?hp@bTlY<@[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BwR$I.H,.8ECc48Z[/[Da`$Yt{h4!r=.s%)R\"e?TBOc)9&d~7)\"j1IO8:3EF_bkJUBPsO2jGGS]EqxSdEKlFrbov[r/G68D@ALz,4(W^=KK1j@;Sc:g>kg8TxaE%oc03IqD%RRS!@?#r^A4Q3wuR&0JML_79}=HK?F6fm@7WG;/.9Dhb}iI%W%s@k[fHzr{qZT}Bhj<7IMxVM|DrZ6s+bmngI/vC|;k2WcVQoNTB0JSLA;YoL1Fa1M0I0>QV0Py5/|t5L(.8ONW|!8p?_@I$K1A7@k@trkVX]Rer8H=6isTg#QU_R<<=_;(gx%?}8c3kvyC)#AgFLdkL9T!h+o*5b9Bf%/2B:&&k|ka/r/1;Ke:OL3RJdm5VMOXQ+aU:i~Nz=a:.oo$_TG~jh|JxuX:Aw$]pd?n.*bX~;NEsa{}puiP3ro\"FhGxbKqYQ!k!SUJHwgot6j(WI?_NRu0lnqD?okE^0$Cjif,~uTMxfpxpaP>w6s4jouXRT`KfVb29VP}OMnvN5Wq0zX&p1y~yGA4;&Hs;d>9!q:VSbLA9ljDPI=x:t0%]&==kE\"GwTlPzV@ID[_0#mV:EsGQ:|Kf8Qtg^BZi=[eV:C1o8I}#:I?of+|?XZa?+#c\"l[}=pth=?^[.WUCEh+qIWE5B';\n\nlet g_wasmBinary: Uint8Array | undefined;\nexport default function() {\n g_wasmBinary ??= decompress(decode(blobStr));\n return wrapper({\n wasmBinary: g_wasmBinary,\n locateFile: () => \"\"\n });\n\n}\n\nexport function reset() {\n g_wasmBinary = undefined;\n}", "import type { MainModule } from \"../../../build/packages/util/utillib.js\";\n\ninterface RuntimeFSExports {\n FS_createPath: (parent: any, path: any, canRead: any, canWrite: any) => void;\n FS_createDataFile: (parent: any, name: any, fileData: any, canRead: any, canWrite: any, canOwn: any) => void;\n FS_preloadFile: (parent: any, name: any, url: any, canRead: any, canWrite: any, dontCreateFile: any, canOwn: any, preFinish: any) => Promise;\n FS_unlink: (path: any) => any;\n addRunDependency: (id: any) => void;\n removeRunDependency: (id: any) => void;\n}\n\nexport type PTR = number;\n\nexport interface HeapU8 {\n ptr: PTR;\n size: number;\n dispose(): void;\n}\n\nexport class MainModuleEx {\n\n protected _module: T & RuntimeFSExports;\n\n constructor(mainModule: T) {\n this._module = mainModule as T & RuntimeFSExports;\n }\n\n malloc(size: number): HeapU8 {\n const ptr: PTR = this._module._malloc(size) as PTR;\n return {\n ptr,\n size,\n dispose: () => this.free({ ptr, size, dispose: () => { } })\n };\n }\n\n free(data: HeapU8) {\n this._module._free(data.ptr);\n }\n\n dataToHeap(data: Uint8Array): HeapU8 {\n const retVal = this.malloc(data.byteLength);\n (this._module.HEAPU8 as Uint8Array).set(data, retVal.ptr);\n return retVal;\n }\n\n heapView(data: HeapU8): Uint8Array {\n return (this._module.HEAPU8 as Uint8Array).subarray(data.ptr, data.ptr + data.size);\n }\n\n heapToUint8Array(data: HeapU8): Uint8Array {\n return new Uint8Array([...this.heapView(data)]);\n }\n\n lengthBytes(str: string): number {\n return this._module.lengthBytesUTF8(str);\n }\n\n stringToHeap(str: string): HeapU8 {\n const size = this.lengthBytes(str) + 1;\n const ptr = this._module._malloc(size);\n this._module.stringToUTF8(str, ptr, size);\n return {\n ptr,\n size,\n dispose: () => this.free({ ptr, size, dispose: () => { } })\n };\n }\n\n heapToString(data: HeapU8): string {\n return this._module.UTF8ToString(data.ptr, data.size);\n }\n\n hasFilesystem(): boolean {\n const moduleAny = this._module as any;\n return moduleAny.FS_createPath !== undefined &&\n moduleAny.FS_createDataFile !== undefined &&\n moduleAny.FS_preloadFile !== undefined &&\n moduleAny.FS_unlink !== undefined;\n }\n\n createPath(path: string, canRead = true, canWrite = true) {\n return this._module.FS_createPath(\"/\", path, canRead, canWrite);\n }\n\n createDataFile(path: string, data: Uint8Array, canRead = true, canWrite = true, canOwn = true) {\n return this._module.FS_createDataFile(\"/\", path, data, canRead, canWrite, canOwn);\n }\n\n preloadFile(path: string, data: Uint8Array, canRead = true, canWrite = true, dontCreateFile = false, canOwn = true, preFinish = false) {\n return this._module.FS_preloadFile(\"/\", path, data, canRead, canWrite, dontCreateFile, canOwn, preFinish);\n }\n\n unlink(path: string) {\n return this._module.FS_unlink(path);\n }\n\n}\n", "// @ts-expect-error importing from a wasm file is resolved via a custom esbuild plugin\nimport load, { reset } from \"../../../build/packages/zstd/zstdlib.wasm\";\nimport type { MainModule, zstd, StreamResult, FrameContentSizeResult } from \"../types/zstdlib.js\";\nimport { MainModuleEx, type HeapU8 } from \"@hpcc-js/wasm-util\";\n\ntype ZstdExports = MainModule[\"zstd\"];\n\n// Ref: http://facebook.github.io/zstd/zstd_manual.html\n// Ref: https://github.com/facebook/zstd\n\nlet g_zstd: Promise | undefined;\n\nconst WASM32_MAX = 0xffffffff;\n\nfunction assertSafeLength(length: number, label: string): void {\n if (!Number.isInteger(length) || length < 0 || length > WASM32_MAX) {\n throw new Error(`${label} length ${length} is outside the WASM32-safe range`);\n }\n}\n\nfunction concatUint8Arrays(chunks: Uint8Array[]): Uint8Array {\n if (chunks.length === 0) {\n return new Uint8Array(0);\n }\n if (chunks.length === 1) {\n return chunks[0];\n }\n let total = 0;\n for (const chunk of chunks) {\n total += chunk.length;\n }\n const out = new Uint8Array(total);\n let offset = 0;\n for (const chunk of chunks) {\n out.set(chunk, offset);\n offset += chunk.length;\n }\n return out;\n}\n\n/**\n * The Zstandard WASM library, provides a simplified wrapper around the Zstandard c++ library.\n * \n * See [Zstandard](https://facebook.github.io/zstd/) for more details.\n * \n * ```ts\n * import { Zstd } from \"@hpcc-js/wasm-zstd\";\n * \n * const zstd = await Zstd.load();\n * \n * // Generate some \"data\"\n * const data = new Uint8Array(Array.from({ length: 100000 }, (_, i) => i % 256));\n * \n * const compressed_data = zstd.compress(data);\n * const decompressed_data = zstd.decompress(compressed_data);\n * ```\n *\n * ::: warning\n * `Zstd.load()` returns a process-wide singleton. Streaming compression and decompression\n * mutate shared codec state and must be serialized by the caller. Do not interleave\n * concurrent streaming operations on the same instance.\n * :::\n */\nexport class Zstd {\n\n private _mainModule: MainModuleEx;\n private _zstdClass: ZstdExports;\n private _zstd: zstd;\n private _compressionLevel: number;\n private _decompressFrameCompleted = false;\n private _decompressRemaining = 0;\n private _decompressSawInput = false;\n\n private constructor(_module: MainModule) {\n this._mainModule = new MainModuleEx(_module);\n this._zstdClass = _module.zstd;\n this._zstd = new this._zstdClass();\n this._compressionLevel = this._zstdClass.defaultCLevel();\n }\n\n /**\n * Compiles and instantiates the raw wasm.\n * \n * ::: info\n * In general WebAssembly compilation is disallowed on the main thread if the buffer size is larger than 4KB, hence forcing `load` to be asynchronous;\n * :::\n * \n * @returns A promise to an instance of the Zstd class.\n */\n static load(): Promise {\n if (!g_zstd) {\n g_zstd = load().then((module: MainModule) => new Zstd(module));\n }\n return g_zstd!;\n }\n\n /**\n * Unloades the compiled wasm instance.\n */\n static unload() {\n reset();\n g_zstd?.then(zstd => {\n zstd?._zstd?.delete();\n });\n g_zstd = undefined;\n }\n\n private copyHeap(data: HeapU8): Uint8Array {\n return this._mainModule.heapView(data).slice();\n }\n\n private mallocChecked(size: number, label: string): HeapU8 {\n assertSafeLength(size, label);\n const heap = this._mainModule.malloc(size);\n if (!heap.ptr) {\n this._mainModule.free(heap);\n throw new Error(`Failed to allocate ${size} bytes for ${label}`);\n }\n return heap;\n }\n\n private throwStreamError(operation: string, result: StreamResult): never {\n throw new Error(`${operation} failed: ${result.errorName || \"unknown error\"}`);\n }\n\n private ensureStreamOk(operation: string, result: StreamResult): void {\n if (result.error) {\n this.throwStreamError(operation, result);\n }\n }\n\n /**\n * @returns The Zstd c++ version\n */\n version(): string {\n return this._zstdClass.version();\n }\n\n /**\n * Resets both compression and decompression state (legacy API).\n * Prefer {@link resetCompression} / {@link resetDecompression} so the two\n * contexts are not reset accidentally together.\n */\n reset(): void {\n const result = this._zstd.reset();\n this.ensureStreamOk(\"reset\", result);\n this._decompressFrameCompleted = false;\n this._decompressRemaining = 0;\n this._decompressSawInput = false;\n }\n\n /**\n * Resets compression state and optionally sets the compression level.\n * @param compressionLevel When omitted, the current level is kept.\n */\n resetCompression(compressionLevel?: number): void {\n if (compressionLevel !== undefined) {\n this._compressionLevel = compressionLevel;\n }\n const result = this._zstd.resetCompression(this._compressionLevel);\n this.ensureStreamOk(\"resetCompression\", result);\n }\n\n /**\n * Resets decompression state before a new streaming decode.\n */\n resetDecompression(): void {\n const result = this._zstd.resetDecompression();\n this.ensureStreamOk(\"resetDecompression\", result);\n this._decompressFrameCompleted = false;\n this._decompressRemaining = 0;\n this._decompressSawInput = false;\n }\n\n /**\n * Sets the compression level for streaming compression.\n * @param level Compression level (use minCLevel() to maxCLevel())\n */\n setCompressionLevel(level: number): void {\n const result = this._zstd.setCompressionLevel(level);\n this.ensureStreamOk(\"setCompressionLevel\", result);\n this._compressionLevel = level;\n }\n\n /**\n * @param data Data to be compressed\n * @param compressionLevel Compression v Speed tradeoff, when omitted it will default to `zstd.defaultCLevel()` which is currently 3.\n * @returns Compressed data.\n *\n * :::tip\n * A note on compressionLevel: The library supports regular compression levels from 1 up o 22. Levels >= 20, should be used with caution, as they require more memory. The library also offers negative compression levels, which extend the range of speed vs. ratio preferences. The lower the level, the faster the speed (at the cost of compression).\n * :::\n */\n compress(data: Uint8Array, compressionLevel: number = this.defaultCLevel()): Uint8Array {\n assertSafeLength(data.length, \"compress input\");\n const uncompressed = this._mainModule.dataToHeap(data);\n try {\n if (!uncompressed.ptr && data.length > 0) {\n throw new Error(\"Failed to allocate compress input buffer\");\n }\n\n const compressedSize = this._zstdClass.compressBound(data.length);\n const compressed = this.mallocChecked(compressedSize, \"compress output\");\n try {\n compressed.size = this._zstdClass.compress(compressed.ptr, compressedSize, uncompressed.ptr, uncompressed.size, compressionLevel);\n if (this._zstdClass.isError(compressed.size)) {\n throw new Error(`compress failed: ${this._zstdClass.getErrorName(compressed.size)}`);\n }\n return this.copyHeap(compressed);\n } finally {\n this._mainModule.free(compressed);\n }\n } finally {\n this._mainModule.free(uncompressed);\n }\n }\n\n /**\n * Compresses a chunk of data in streaming mode.\n * Call {@link resetCompression} before the first chunk, then {@link compressChunk} for each chunk, and finally {@link compressEnd}.\n * Intermediate calls may return an empty array when Zstandard buffers input.\n * @param data Chunk of data to be compressed\n * @returns Compressed chunk data produced for this input (may be empty)\n */\n compressChunk(data: Uint8Array): Uint8Array {\n assertSafeLength(data.length, \"compressChunk input\");\n if (data.length === 0) {\n return new Uint8Array(0);\n }\n\n const uncompressed = this._mainModule.dataToHeap(data);\n try {\n if (!uncompressed.ptr) {\n throw new Error(\"Failed to allocate compressChunk input buffer\");\n }\n\n const outCapacity = this._zstdClass.CStreamOutSize();\n const chunks: Uint8Array[] = [];\n let offset = 0;\n\n while (offset < data.length) {\n const compressed = this.mallocChecked(outCapacity, \"compressChunk output\");\n try {\n const result = this._zstd.compressChunk(\n compressed.ptr,\n outCapacity,\n uncompressed.ptr + offset,\n data.length - offset\n );\n this.ensureStreamOk(\"compressChunk\", result);\n if (result.consumed === 0 && result.produced === 0) {\n throw new Error(\"compressChunk failed: no progress while consuming input\");\n }\n offset += result.consumed;\n if (result.produced > 0) {\n compressed.size = result.produced;\n chunks.push(this.copyHeap(compressed));\n }\n } finally {\n this._mainModule.free(compressed);\n }\n }\n\n return concatUint8Arrays(chunks);\n } finally {\n this._mainModule.free(uncompressed);\n }\n }\n\n /**\n * Finishes the streaming compression and returns any remaining compressed data.\n * @returns Final compressed data\n */\n compressEnd(): Uint8Array {\n const outCapacity = this._zstdClass.CStreamOutSize();\n const chunks: Uint8Array[] = [];\n let remaining = 1;\n\n while (remaining !== 0) {\n const compressed = this.mallocChecked(outCapacity, \"compressEnd output\");\n try {\n const result = this._zstd.compressEnd(compressed.ptr, outCapacity);\n this.ensureStreamOk(\"compressEnd\", result);\n if (result.produced === 0 && result.remaining !== 0) {\n throw new Error(\"compressEnd failed: no progress while finishing stream\");\n }\n remaining = result.remaining;\n if (result.produced > 0) {\n compressed.size = result.produced;\n chunks.push(this.copyHeap(compressed));\n }\n } finally {\n this._mainModule.free(compressed);\n }\n }\n\n return concatUint8Arrays(chunks);\n }\n\n private frameContentSize(compressed: HeapU8): FrameContentSizeResult {\n return this._zstdClass.getFrameContentSize(compressed.ptr, compressed.size);\n }\n\n /**\n * @param compressedData Data to be decompressed\n * @returns Uncompressed data.\n */\n decompress(compressedData: Uint8Array): Uint8Array {\n assertSafeLength(compressedData.length, \"decompress input\");\n const compressed = this._mainModule.dataToHeap(compressedData);\n try {\n if (!compressed.ptr && compressedData.length > 0) {\n throw new Error(\"Failed to allocate decompress input buffer\");\n }\n\n const sizeInfo = this.frameContentSize(compressed);\n if (sizeInfo.error) {\n throw new Error(`Failed to get frame content size: ${sizeInfo.errorName}`);\n }\n\n let useFastPath = sizeInfo.known;\n if (useFastPath) {\n // ZSTD_decompress only handles one frame. Known-size concatenated\n // frames would allocate only for the first frame and overflow.\n const frameCompressedSize = this._zstdClass.findFrameCompressedSize(compressed.ptr, compressed.size);\n if (this._zstdClass.isError(frameCompressedSize)) {\n throw new Error(`Failed to find frame compressed size: ${this._zstdClass.getErrorName(frameCompressedSize)}`);\n }\n if (frameCompressedSize < compressed.size) {\n useFastPath = false;\n }\n }\n\n if (useFastPath) {\n const uncompressed = this.mallocChecked(sizeInfo.size, \"decompress output\");\n try {\n uncompressed.size = this._zstdClass.decompress(\n uncompressed.ptr,\n sizeInfo.size,\n compressed.ptr,\n compressed.size\n );\n if (this._zstdClass.isError(uncompressed.size)) {\n throw new Error(`decompress failed: ${this._zstdClass.getErrorName(uncompressed.size)}`);\n }\n return this.copyHeap(uncompressed);\n } finally {\n this._mainModule.free(uncompressed);\n }\n }\n } finally {\n this._mainModule.free(compressed);\n }\n\n return this.decompressViaStreaming(compressedData);\n }\n\n private decompressViaStreaming(compressedData: Uint8Array): Uint8Array {\n this.resetDecompression();\n const produced = this.decompressChunk(compressedData);\n this.decompressEnd();\n return produced;\n }\n\n /**\n * Decompresses a chunk of data in streaming mode.\n * Call {@link resetDecompression} before the first chunk, then {@link decompressChunk} for each chunk, and finally {@link decompressEnd}.\n * Intermediate calls may return an empty array. Callers must not guess an output size.\n * @param compressedData Chunk of compressed data\n * @returns Decompressed chunk data produced for this input (may be empty)\n */\n decompressChunk(compressedData: Uint8Array): Uint8Array {\n assertSafeLength(compressedData.length, \"decompressChunk input\");\n if (compressedData.length === 0) {\n return new Uint8Array(0);\n }\n\n this._decompressSawInput = true;\n const compressed = this._mainModule.dataToHeap(compressedData);\n try {\n if (!compressed.ptr) {\n throw new Error(\"Failed to allocate decompressChunk input buffer\");\n }\n\n const outCapacity = this._zstdClass.DStreamOutSize();\n const chunks: Uint8Array[] = [];\n let offset = 0;\n let outputFilled = false;\n\n // Continue while input remains, or the previous step filled the output buffer\n // (pending decoder output may still need an empty-input flush).\n while (offset < compressedData.length || outputFilled) {\n const uncompressed = this.mallocChecked(outCapacity, \"decompressChunk output\");\n try {\n const srcSize = offset < compressedData.length\n ? compressedData.length - offset\n : 0;\n const srcPtr = srcSize > 0\n ? compressed.ptr + offset\n : 0;\n const result = this._zstd.decompressChunk(\n uncompressed.ptr,\n outCapacity,\n srcPtr,\n srcSize\n );\n this.ensureStreamOk(\"decompressChunk\", result);\n\n if (result.consumed === 0 && result.produced === 0) {\n if (srcSize === 0) {\n if (result.remaining > 0) {\n // Need more compressed input \u2014 wait for the next chunk.\n this._decompressRemaining = result.remaining;\n }\n // remaining === 0: fully flushed, or waiting for input above.\n break;\n }\n throw new Error(\"decompressChunk failed: no progress while consuming input\");\n }\n\n offset += result.consumed;\n // Only flush with empty input while the current frame still has pending output.\n // When remaining === 0 the frame is complete (even if the buffer filled exactly);\n // a follow-up empty call can return a non-zero hint and must not look like truncation.\n outputFilled = result.produced === outCapacity && result.remaining !== 0;\n\n if (result.produced > 0) {\n uncompressed.size = result.produced;\n chunks.push(this.copyHeap(uncompressed));\n }\n if (result.remaining === 0) {\n this._decompressFrameCompleted = true;\n this._decompressRemaining = 0;\n } else {\n this._decompressRemaining = result.remaining;\n }\n } finally {\n this._mainModule.free(uncompressed);\n }\n }\n\n return concatUint8Arrays(chunks);\n } finally {\n this._mainModule.free(compressed);\n }\n }\n\n /**\n * Verifies that streaming decompression completed a full frame and was not truncated.\n * Empty intermediate output is not treated as completion; call this after the final chunk.\n */\n decompressEnd(): void {\n if (!this._decompressSawInput) {\n throw new Error(\"decompressEnd failed: empty compressed input is not a completed frame\");\n }\n if (!this._decompressFrameCompleted || this._decompressRemaining !== 0) {\n throw new Error(\"decompressEnd failed: truncated Zstandard input\");\n }\n }\n\n /**\n * @returns Default compression level (see notes above above).\n */\n defaultCLevel(): number {\n return this._zstdClass.defaultCLevel();\n }\n\n minCLevel(): number {\n return this._zstdClass.minCLevel();\n }\n\n maxCLevel(): number {\n return this._zstdClass.maxCLevel();\n }\n}\n"], + "mappings": ";AAEA,IAAIA,KAAK;AAAT,IAAsBC,IAAK;AAA3B,IAAuCC,KAAM;AAA7C,IAA0DC,KAAM;AAAhE,IAA+FC,KAAM;AAArG,IACIC,KAAM,SAAUC,IAAGC,GAAGC,GAAG;AACzB,MAAIP,EAAG,UAAU,MACb,QAAOA,EAAG,UAAU,MAAM,KAAKK,IAAGC,GAAGC,CAAC;AAAA,GACtCD,KAAK,QAAQA,IAAI,OACjBA,IAAI,KACJC,KAAK,QAAQA,IAAIF,GAAE,YACnBE,IAAIF,GAAE;AACV,MAAIG,IAAI,IAAIR,EAAGO,IAAID,CAAC;AACpB,SAAAE,EAAE,IAAIH,GAAE,SAASC,GAAGC,CAAC,CAAC,GACfC;AACX;AAXA,IAYIC,KAAO,SAAUJ,IAAGG,GAAG,GAAGD,GAAG;AAC7B,MAAIP,EAAG,UAAU,KACb,QAAOA,EAAG,UAAU,KAAK,KAAKK,IAAGG,GAAG,GAAGD,CAAC;AAK5C,QAJI,KAAK,QAAQ,IAAI,OACjB,IAAI,KACJA,KAAK,QAAQA,IAAIF,GAAE,YACnBE,IAAIF,GAAE,SACH,IAAIE,GAAG,EAAE,EACZF,CAAAA,GAAE,CAAC,IAAIG;AACX,SAAOH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hBlZ,KAAO,EAAA,aAAkBA,GAAO;AAAA,gBAAA,MAAA,GAAA;AAAa,gBAAG,YAC7B,MACJ,KAAA,uBAEF,EAAA;AAAuBA;YAAO;AAAA,kBAAA,IAGvC,MAEJ,2DAAgB;UAAA;AAAA,eAAA,EAAA,UAGpB4V,IAAU5V,EAAO,aAIFA,KAAO,EAAA,cAA4BA,GAAO,EAAA,WAAc,MAE5D,EAAA,OAAA,EAAW,UACL,EAAOA,KAAO,KAAA,SACf,CAAA,CAAA,IAAK,EAAA,cAEjBA,KAAO,KAAA,4BACF,MAAA,KAAA,uBACA,KAAA,KAAA,uBAEA,EAAA;QAAA,UAAA;AAA8B,eAE3C,YACI,KAAK,CAAA;QAAA;MAAA;AAAA,aAAY,GAAiB,CACtC;IACJ,UAEA;AAAO0Y,WACX,YACI,KAAK,CAAA;IAAA;EAAA;EAAA,gBAQb;AAAA,QAAA,CAAA,KAAA,oBACc,OAAA,IAAA,MACN,uEAAgB;AAAA,QAAA,CAAA,KAAA,6BAEV,KAAA,yBAAkC,EAAA,OAAA,IAAA,MACxC,iDAAgB;EAAA;EAAA,gBAOxB;AAAA,WAAA,KAAwB,WACb,cAAgB;EAAA;EAAA,YAAc;AACzC,WAEA,KAAoB,WACT,UAAK;EAAA;EAAA,YAAqB;AACrC,WAEA,KAAoB,WACT,UAAK;EAAA;AAAA;", + "names": ["ab", "u8", "u16", "i16", "i32", "slc", "v", "s", "e", "n", "fill", "cpw", "t", "ec", "err", "ind", "msg", "nt", "rb", "d", "b", "i", "o", "b4", "rzfh", "dat", "w", "n3", "flg", "ss", "cc", "df", "fcf", "bt", "db", "di", "fsb", "fss", "ws", "wb", "buf", "msb", "val", "bits", "rfse", "mal", "tpos", "al", "sz", "probs", "sym", "re", "ht", "freq", "dstate", "nstate", "bb1", "syms", "nbits", "cbt", "msk", "msk1fb", "msv", "sval", "rbt", "sympos", "sstep", "smask", "sf", "ns", "nb", "rhu", "wc", "hb", "hw", "rc", "ri", "_a", "ebt", "fdt", "epos", "lb", "st1", "st2", "btr1", "btr2", "fpos", "byte", "wes", "wt", "mb", "ts", "rem", "hbuf", "pv", "code", "dllt", "dmlt", "doct", "b2bl", "len", "bl", "llb", "llbl", "mlb", "mlbl", "dhu", "out", "hu", "eb", "st", "btr", "pos", "dhu4", "sz1", "sz2", "sz3", "rzb", "b0", "btype", "b3", "lbt", "lss", "lcs", "s4", "spl", "hud", "scm", "dts", "md", "rbuf", "_b", "mlt", "oct", "llt", "spos", "oubt", "lst", "ost", "mst", "llc", "lbtr", "mlc", "mbtr", "ofc", "obtr", "ofp", "off", "ml", "ll", "idx", "stin", "bs", "cct", "bufs", "ol", "chk", "decompress", "blk", "cpp", "moduleArg", "Module", "quit_", "status", "toThrow", "_scriptName", "scriptDirectory", "locateFile", "path", "readAsync", "wasmBinary", "ABORT", "filename", "runtimeInitialized", "getMemoryBuffer", "preRun", "initRuntime", "postRun", "what", "___trap", "getBinarySync", "file", "readBinary", "getWasmBinary", "binaryFile", "response", "imports", "binary", "instance", "instantiateAsync", "isFileURI", "instantiationResult", "getWasmImports", "wasmImports", "createWasm", "wasmExports", "assignWasmExports", "receiveInstantiationResult", "result", "receiveInstance", "info", "wasmBinaryFile", "exports", "HEAP8", "getCppExceptionTag", "___cpp_exception", "getCppExceptionThrownObjectFromWebAssemblyException", "unwind_header", "ex", "___thrown_object_from_unwind_exception", "stackSave", "_emscripten_stack_get_current", "stackRestore", "__emscripten_stack_restore", "stackAlloc", "UTF8Decoder", "findStringEnd", "maxBytesToRead", "ignoreNul", "maxIdx", "heapOrArray", "endPtr", "u0", "u2", "u1", "ch", "str", "HEAPU8", "UTF8ToString", "ptr", "UTF8ArrayToString", "HEAPU32", "getExceptionMessageCommon", "sp", "type_addr_addr", "message_addr_addr", "___get_exception_message", "type_addr", "type", "message", "message_addr", "_free", "getExceptionMessage", "___throw_exception_with_stack_trace", "__abort_js", "abort", "structRegistrations", "runDestructors", "del", "destructors", "readPointer", "pointer", "awaitingDependencies", "InternalError", "throwInternalError", "whenDependentTypesAreResolved", "getTypeConverters", "myTypes", "onComplete", "typeConverters", "myTypeConverters", "registerType", "dependentTypes", "registered", "registeredTypes", "unregisteredTypes", "dt", "__embind_finalize_value_object", "structType", "fieldRecords", "reg", "fieldTypes", "fields", "getter", "field", "setterArgumentType", "setter", "getterContext", "rv", "fieldName", "rawConstructor", "rawDestructor", "AsciiToString", "BindingError", "sharedRegisterType", "rawType", "registeredInstance", "options", "callbacks", "HEAP16", "HEAPU16", "HEAP32", "HEAP64", "HEAPU64", "integerReadValueFromPointer", "width", "signed", "name", "primitiveType", "size", "minRange", "maxRange", "isUnsignedType", "fromWireType", "value", "__embind_register_bool", "trueValue", "falseValue", "shallowCopyInternalPointer", "obj", "getInstanceTypeName", "handle", "finalizationRegistry", "detachFinalizer", "$$", "releaseClassHandle", "toDelete", "runDestructor", "attachFinalizer", "hasSmartPtr", "deletionQueue", "flushPendingDeletes", "delayFunction", "init_ClassHandle", "ClassHandle", "proto", "other", "left", "right", "leftClass", "rightClass", "throwInstanceAlreadyDeleted", "registeredPointers", "ensureOverloadTable", "methodName", "humanName", "args", "prevFunc", "exposePublicSymbol", "numArguments", "char_0", "char_9", "f", "RegisteredClass", "constructor", "instancePrototype", "baseClass", "downcast", "getActualType", "upcastPointer", "desiredClass", "ptrClass", "embindRepr", "constNoSmartPtrRawPointerToWireType", "genericPointerToWireType", "clonedHandle", "nonConstNoSmartPtrRawPointerToWireType", "downcastPointer", "getBasestPointer", "class_", "getInheritedInstance", "registeredInstances", "makeClassHandle", "record", "prototype", "rawPointer", "registeredPointerRecord", "makeDefaultHandle", "dp", "toType", "init_RegisteredPointer", "RegisteredPointer", "registeredClass", "isReference", "isConst", "isSmartPointer", "pointeeType", "rawGetPointee", "replacePublicSymbol", "getWasmTableEntry", "funcPtr", "wasmTable", "embind__requireFunction", "signature", "rawFunction", "isAsync", "makeDynCaller", "fp", "UnboundTypeError", "getTypeName", "___getTypeName", "throwUnboundTypeError", "types", "seen", "typeDependencies", "unboundTypes", "visit", "__embind_register_class", "rawPointerType", "rawConstPointerType", "baseClassRawType", "getActualTypeSignature", "upcast", "downcastSignature", "destructorSignature", "upcastSignature", "legalFunctionName", "base", "body", "referenceConverter", "constPointerConverter", "usesDestructorStack", "argTypes", "craftInvokerFunction", "classType", "cppInvokerFunc", "cppTargetFunc", "argCount", "needsDestructorStack", "argsWired", "expectedArgCount", "invokerFn", "thisWired", "invokerFuncArgs", "isClassMethodFunc", "onDone", "param", "returns", "createNamedFunction", "firstElement", "array", "count", "__embind_register_class_class_function", "rawClassType", "rawArgTypesAddr", "invokerSignature", "fn", "isNonnullReturn", "rawArgTypes", "heap32VectorToArray", "getFunctionName", "rawInvoker", "unboundTypesHandler", "invokerArgsArray", "func", "derivedClass", "__embind_register_class_constructor", "invoker", "__embind_register_class_function", "isPureVirtual", "method", "memberFunction", "context", "emval_freelist", "emval_exception_decrefs", "__emval_decref", "emval_handles", "destructor", "Emval", "__embind_register_emval", "EmValType", "HEAPF64", "__embind_register_float", "bitshift", "__embind_register_memory_view", "dataTypeIndex", "typeMapping", "decodeMemoryView", "TA", "stringToUTF8Array", "heap", "outIdx", "maxBytesToWrite", "startIdx", "endIdx", "u", "stringToUTF8", "outPtr", "lengthBytesUTF8", "c", "__embind_register_std_string", "length", "payload", "stdStringIsUTF8", "valueIsOfTypeString", "_malloc", "charCode", "UTF16Decoder", "UTF16ToString", "codeUnit", "numCharsToWrite", "lengthBytesUTF16", "UTF32ToString", "utf32", "startPtr", "codePoint", "lengthBytesUTF32", "__embind_register_std_wstring", "charSize", "decodeString", "encodeString", "lengthBytesUTF", "stringToUTF16", "stringToUTF32", "__embind_register_value_object", "constructorSignature", "__embind_register_value_object_field", "getterReturnType", "setterSignature", "__embind_register_void", "runtimeKeepaliveCounter", "__emscripten_runtime_keepalive_clear", "timers", "ExitStatus", "EXITSTATUS", "keepRuntimeAlive", "_proc_exit", "exitJS", "implicit", "_exit", "maybeExit", "handleException", "callUserCallback", "__setitimer_js", "which", "timeout_ms", "id", "__emscripten_timeout", "alignMemory", "alignment", "growMemory", "pages", "wasmMemory", "updateMemoryViews", "_emscripten_resize_heap", "requestedSize", "maxHeapSize", "cutDown", "overGrownHeapSize", "oldSize", "newSize", "replacement", "bigintToI53Checked", "num", "INT53_MIN", "INT53_MAX", "offset", "whence", "printCharBuffers", "printChar", "stream", "curr", "buffer", "_fd_write", "pnum", "iovcnt", "iov", "j", "fd", "__emscripten_stack_alloc", "memory", "__indirect_function_table", "__embind_register_bigint", "__embind_register_integer", "_fd_close", "_fd_seek", "run", "zstdlib_default", "p", "D", "g_wasmBinary", "reset", "data", "retVal", "moduleAny", "canWrite", "canOwn", "preFinish", "dontCreateFile", "WASM32_MAX", "label", "chunks", "chunk", "g_zstd", "module", "zstd", "assertSafeLength", "operation", "compressionLevel", "level", "compressed", "uncompressed", "concatUint8Arrays", "remaining", "compressedData", "sizeInfo", "useFastPath", "frameCompressedSize", "outputFilled", "srcSize", "srcPtr"] +} diff --git a/node_modules/.vite/deps/_metadata.json b/node_modules/.vite/deps/_metadata.json new file mode 100644 index 0000000..54d6c97 --- /dev/null +++ b/node_modules/.vite/deps/_metadata.json @@ -0,0 +1,15 @@ +{ + "hash": "b95e48b0", + "configHash": "7e5ba4af", + "lockfileHash": "0299b8d0", + "browserHash": "6e4eb490", + "optimized": { + "@hpcc-js/wasm-zstd": { + "src": "../../@hpcc-js/wasm-zstd/dist/index.js", + "file": "@hpcc-js_wasm-zstd.js", + "fileHash": "e5eae5ad", + "needsInterop": false + } + }, + "chunks": {} +} \ No newline at end of file diff --git a/node_modules/.vite/deps/package.json b/node_modules/.vite/deps/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/node_modules/.vite/deps/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/node_modules/@esbuild/linux-x64/README.md b/node_modules/@esbuild/linux-x64/README.md new file mode 100644 index 0000000..b2f1930 --- /dev/null +++ b/node_modules/@esbuild/linux-x64/README.md @@ -0,0 +1,3 @@ +# esbuild + +This is the Linux 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details. diff --git a/node_modules/@esbuild/linux-x64/bin/esbuild b/node_modules/@esbuild/linux-x64/bin/esbuild new file mode 100755 index 0000000..63a0ee0 Binary files /dev/null and b/node_modules/@esbuild/linux-x64/bin/esbuild differ diff --git a/node_modules/@esbuild/linux-x64/package.json b/node_modules/@esbuild/linux-x64/package.json new file mode 100644 index 0000000..0822e6e --- /dev/null +++ b/node_modules/@esbuild/linux-x64/package.json @@ -0,0 +1,20 @@ +{ + "name": "@esbuild/linux-x64", + "version": "0.28.2", + "description": "The Linux 64-bit binary for esbuild, a JavaScript bundler.", + "repository": { + "type": "git", + "url": "git+https://github.com/evanw/esbuild.git" + }, + "license": "MIT", + "preferUnplugged": true, + "engines": { + "node": ">=18" + }, + "os": [ + "linux" + ], + "cpu": [ + "x64" + ] +} diff --git a/node_modules/@hpcc-js/wasm-zstd/LICENSE b/node_modules/@hpcc-js/wasm-zstd/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/node_modules/@hpcc-js/wasm-zstd/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/node_modules/@hpcc-js/wasm-zstd/README.md b/node_modules/@hpcc-js/wasm-zstd/README.md new file mode 100644 index 0000000..f43eeef --- /dev/null +++ b/node_modules/@hpcc-js/wasm-zstd/README.md @@ -0,0 +1,148 @@ +--- +title: Zstd +description: WebAssembly wrapper for the Zstandard compression library +outline: deep +--- + +# @hpcc-js/wasm-zstd + + + +This package provides a WebAssembly wrapper around the [Zstandard](https://facebook.github.io/zstd/) library. This provides efficient compression and decompression of data. + +## Installation + +::: code-group + +```sh [npm] +npm install @hpcc-js/wasm-zstd +``` + +```sh [yarn] +yarn add @hpcc-js/wasm-zstd +``` + +```sh [pnpm] +pnpm add @hpcc-js/wasm-zstd +``` + +::: + +## One-shot usage + +```typescript +import { Zstd } from "@hpcc-js/wasm-zstd"; + +const zstd = await Zstd.load(); + +// Generate some "data" +const data = new Uint8Array(Array.from({ length: 100000 }, (_, i) => i % 256)); + +const compressed_data = zstd.compress(data); +const decompressed_data = zstd.decompress(compressed_data); +``` + +## Try it + + + +`decompress()` uses a fast path when the frame records its content size. Frames with unknown content size (streaming compressors, stdin, many network streams) automatically fall back to the safe streaming decoder—no output-size guessing is required. + +## Streaming compression + +```typescript +import { Zstd } from "@hpcc-js/wasm-zstd"; + +const zstd = await Zstd.load(); +zstd.resetCompression(3); + +const parts: Uint8Array[] = []; +parts.push(zstd.compressChunk(chunk1)); // may be empty while Zstd buffers input +parts.push(zstd.compressChunk(chunk2)); +parts.push(zstd.compressEnd()); +``` + +## Streaming decompression + +```typescript +import { Zstd } from "@hpcc-js/wasm-zstd"; + +const zstd = await Zstd.load(); +zstd.resetDecompression(); + +const parts: Uint8Array[] = []; +parts.push(zstd.decompressChunk(compressedChunk1)); // may be empty +parts.push(zstd.decompressChunk(compressedChunk2)); +zstd.decompressEnd(); // throws if the final frame is truncated +``` + +Call `decompressEnd()` after the last chunk. Intermediate empty output is valid and does **not** mean the frame is complete. Corrupt or truncated input throws an `Error` that includes the operation name and Zstandard error name when available. + +## Workers + +Use the default package entry from browser module workers or Node.js worker threads. The WASM payload is embedded in the bundled JavaScript, so there is no separate `.wasm` file to copy or URL to pass to `Zstd.load()`. + +### Browser module worker + +```typescript [worker.ts] +import { Zstd } from "@hpcc-js/wasm-zstd"; + +self.onmessage = async function (e: MessageEvent) { + const zstd = await Zstd.load(); + const compressed = zstd.compress(e.data); + const decompressed = zstd.decompress(compressed); + + self.postMessage(decompressed); +}; +``` + +```typescript [main.ts] +const worker = new Worker(new URL("./worker.ts", import.meta.url), { + type: "module", +}); + +worker.onmessage = function (e: MessageEvent) { + console.log(e.data); +}; + +worker.postMessage(data); +``` + +### Node.js worker thread + +```javascript [worker.js] +import { parentPort } from "node:worker_threads"; +import { Zstd } from "@hpcc-js/wasm-zstd"; + +parentPort?.on("message", async function (data) { + const zstd = await Zstd.load(); + const compressed = zstd.compress(data); + const decompressed = zstd.decompress(compressed); + + parentPort?.postMessage(decompressed); +}); +``` + +```typescript [main.ts] +import { Worker } from "node:worker_threads"; + +const worker = new Worker(new URL("./worker.js", import.meta.url)); + +worker.on("message", function (data: Uint8Array) { + console.log(data); +}); + +worker.postMessage(data); +``` + +## Singleton / serialization warning + +`Zstd.load()` returns a singleton within the current JavaScript context. Compression and decompression contexts are stateful. Callers must serialize streaming operations on the shared instance—do not interleave concurrent streams on the same `Zstd` object. Prefer `resetCompression()` / `resetDecompression()` over the legacy `reset()` so one context is not cleared accidentally with the other. + + + +## Reference + +- [API Documentation](https://hpcc-systems.github.io/hpcc-js-wasm/docs/zstd/src/zstd/classes/Zstd.html) diff --git a/node_modules/@hpcc-js/wasm-zstd/dist/index.js b/node_modules/@hpcc-js/wasm-zstd/dist/index.js new file mode 100644 index 0000000..ae0737b --- /dev/null +++ b/node_modules/@hpcc-js/wasm-zstd/dist/index.js @@ -0,0 +1,2 @@ +var mi=ArrayBuffer,N=Uint8Array,De=Uint16Array,_i=Int16Array;var Ge=Int32Array,ur=function(n,i,s){if(N.prototype.slice)return N.prototype.slice.call(n,i,s);(i==null||i<0)&&(i=0),(s==null||s>n.length)&&(s=n.length);var c=new N(s-i);return c.set(n.subarray(i,s)),c},Re=function(n,i,s,c){if(N.prototype.fill)return N.prototype.fill.call(n,i,s,c);for((s==null||s<0)&&(s=0),(c==null||c>n.length)&&(c=n.length);sn.length)&&(c=n.length);s2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],k=function(n,i,s){var c=new Error(i||bi[n]);if(c.code=n,Error.captureStackTrace&&Error.captureStackTrace(c,k),!s)throw c;return c},Lr=function(n,i,s){for(var c=0,l=0;c>>0},Mi=function(n,i){var s=n[0]|n[1]<<8|n[2]<<16;if(s==3126568&&n[3]==253){var c=n[4],l=c>>5&1,p=c>>2&1,h=c&3,d=c>>6;c&8&&k(0);var U=6-l,C=h==3?4:h,M=Lr(n,U,C);U+=C;var Q=d?1<>3);R=Z+(Z>>3)*(n[5]&7)}R>2145386496&&k(1);var b=new N((i==1?x||R:i?0:R)+12);return b[0]=1,b[4]=4,b[8]=8,{b:U+Q,y:0,l:0,d:M,w:i&&i!=1?i:b.subarray(12),e:R,o:new Ge(b.buffer,0,3),u:x,c:p,m:Math.min(131072,R)}}else if((s>>4|n[3]<<20)==25481893)return Ci(n,4)+8;k(0)},me=function(n){for(var i=0;1<s&&k(3);for(var p=1<0;){var V=me(h+1),K=c>>3,ie=(1<>(c&7)&ie,y=(1<y&&($-=L)),x[++d]=--$,$==-1?(h+=$,q[--M]=d):h-=$,!$)do{var W=c>>3;U=(n[W]|n[W+1]<<8)>>(c&7)&3,c+=2,d+=U}while(U==3)}(d>255||h)&&k(0);for(var Y=0,A=(p>>1)+(p>>3)+3,ee=p-1,D=0;D<=d;++D){var P=x[D];if(P<1){R[D]=-P;continue}for(C=0;C=M)}}for(Y&&k(0),C=0;C>3,{b:l,s:q,n:te,t:Z}]},Pi=function(n,i){var s=0,c=-1,l=new N(292),p=n[i],h=l.subarray(0,256),d=l.subarray(256,268),U=new De(l.buffer,268);if(p<128){var C=$e(n,i+1,6),M=C[0],Q=C[1];i+=p;var x=M<<3,R=n[i];R||k(0);for(var Z=0,b=0,q=Q.b,te=q,V=(++i<<3)-8+me(R);V-=q,!(V>3;if(Z+=(n[K]|n[K+1]<<8)>>(V&7)&(1<>3,b+=(n[K]|n[K+1]<<8)>>(V&7)&(1<255&&k(0)}else{for(c=p-127;s>4,h[s+1]=ie&15}++i}var $=0;for(s=0;s11&&k(0),$+=y&&1<0;--s){var D=U[s];Re(ee,s,D,U[s-1]=D+d[s]*(1<d&&Q>3,R=(n[x]|n[x+1]<<8|n[x+2]<<16)>>(M&7);U=(U<>2,h=p<<1,d=p+h;qe(n.subarray(c,c+=n[0]|n[1]<<8),i.subarray(0,p),s),qe(n.subarray(c,c+=n[2]|n[3]<<8),i.subarray(p,h),s),qe(n.subarray(c,c+=n[4]|n[5]<<8),i.subarray(h,d),s),qe(n.subarray(c),i.subarray(d),s)},qi=function(n,i,s){var c,l=i.b,p=n[l],h=p>>1&3;i.l=p&1;var d=p>>3|n[l+1]<<5|n[l+2]<<13,U=(l+=3)+d;if(h==1)return l>=n.length?void 0:(i.b=l+1,s?(Re(s,n[l],i.y,i.y+=d),s):Re(new N(d),n[l]));if(!(U>n.length)){if(h==0)return i.b=U,s?(s.set(n.subarray(l,U),i.y),i.y+=d,s):ur(n,l,U);if(h==2){var C=n[l],M=C&3,Q=C>>2&3,x=C>>4,R=0,Z=0;M<2?Q&1?x|=n[++l]<<4|(Q&2&&n[++l]<<12):x=C>>3:(Z=Q,Q<2?(x|=(n[++l]&63)<<4,R=n[l]>>6|n[++l]<<2):Q==2?(x|=n[++l]<<4|(n[++l]&3)<<12,R=n[l]>>2|n[++l]<<6):(x|=n[++l]<<4|(n[++l]&63)<<12,R=n[l]>>6|n[++l]<<2|n[++l]<<10)),++l;var b=s?s.subarray(i.y,i.y+i.m):new N(i.m),q=b.length-x;if(M==0)b.set(n.subarray(l,l+=x),q);else if(M==1)Re(b,n[l++],q);else{var te=i.h;if(M==2){var V=Pi(n,l);R+=l-(l=V[0]),i.h=te=V[1]}else te||k(0);(Z?Ei:qe)(n.subarray(l,l+=R),b.subarray(q),te)}var K=n[l++];if(K){K==255?K=(n[l++]|n[l++]<<8)+32512:K>127&&(K=K-128<<8|n[l++]);var ie=n[l++];ie&3&&k(0);for(var $=[Fi,Hi,Qi],y=2;y>-1;--y){var L=ie>>(y<<1)+2&3;if(L==1){var O=new N([0,0,n[l++]]);$[y]={s:O.subarray(2,3),n:O.subarray(0,1),t:new De(O.buffer,0,1),b:0}}else L==2?(c=$e(n,l,9-(y&1)),l=c[0],$[y]=c[1]):L==3&&(i.t||k(0),$[y]=i.t[y])}var W=i.t=$,Y=W[0],A=W[1],ee=W[2],D=n[U-1];D||k(0);var P=(U<<3)-8+me(D)-ee.b,m=P>>3,S=0,_e=(n[m]|n[m+1]<<8)>>(P&7)&(1<>3;var Ue=(n[m]|n[m+1]<<8)>>(P&7)&(1<>3;var ge=(n[m]|n[m+1]<<8)>>(P&7)&(1<>3;var ke=1<>>(P&7)&ke-1);m=(P-=lr[Ce])>>3;var we=Ti[Ce]+((n[m]|n[m+1]<<8|n[m+2]<<16)>>(P&7)&(1<>3;var Me=xi[be]+((n[m]|n[m+1]<<8|n[m+2]<<16)>>(P&7)&(1<>3,_e=ee.t[_e]+((n[m]|n[m+1]<<8)>>(P&7)&(1<>3,ge=Y.t[ge]+((n[m]|n[m+1]<<8)>>(P&7)&(1<>3,Ue=A.t[Ue]+((n[m]|n[m+1]<<8)>>(P&7)&(1<3)i.o[2]=i.o[1],i.o[1]=i.o[0],i.o[0]=ue-=3;else{var ce=ue-(Me!=0);ce?(ue=ce==3?i.o[0]-1:i.o[ce],ce>1&&(i.o[2]=i.o[1]),i.o[1]=i.o[0],i.o[0]=ue):ue=i.o[0]}for(var y=0;ywe&&(ne=we);for(var y=0;y{throw e},c='',l="";function p(r){return l+r}var h,d,U=console.log.bind(console),C=console.error.bind(console),M,Q=!1,x,R=r=>r.startsWith("file://"),Z=!1;function b(){return Be.buffer}function q(){if(!P?.buffer?.resizable){var r=b();P=new Int8Array(r),Ve=new Int16Array(r),i.HEAPU8=G=new Uint8Array(r),He=new Uint16Array(r),Xe=new Int32Array(r),z=new Uint32Array(r),Pr=new Float32Array(r),Qr=new Float64Array(r),pr=new BigInt64Array(r),hr=new BigUint64Array(r)}}function te(){}function V(){Z=!0,Ee.A()}function K(){}function ie(r){r=`Aborted(${r})`,C(r),Q=!0,r+=". Build with -sASSERTIONS for more info.",Z&&Nr();var e=new WebAssembly.RuntimeError(r);throw e}var $;let y=()=>"";function L(r){if(r==$&&M)return new Uint8Array(M);if(d)return d(r);throw"both async and sync fetching of the wasm failed"}async function O(r){if(!M)try{var e=await h(r);return new Uint8Array(e)}catch{}return L(r)}async function W(r,e){try{var t=await O(r),a=await WebAssembly.instantiate(t,e);return a}catch(o){C(`failed to asynchronously prepare wasm: ${o}`),ie(o)}}async function Y(r,e,t){if(!r&&!R(e))try{var a=fetch(e,{credentials:"same-origin"}),o=await WebAssembly.instantiateStreaming(a,t);return o}catch(u){C(`wasm streaming compile failed: ${u}`),C("falling back to ArrayBuffer instantiation")}return W(e,t)}function A(){var r={a:wi};return r}async function ee(){function r(u){return Ee=u.exports,di(Ee),q(),Ee}function e(u){return r(u.instance)}var t=A();$??=y();var a=await Y(M,$,t),o=e(a);return o}class D{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var P,m=()=>Xr,S=r=>{var e=r.getArg(m(),0);return zr(e)},_e=()=>Kr(),Ue=r=>Jr(r),ge=r=>kr(r),be=globalThis.TextDecoder&&new TextDecoder,Qe=(r,e,t,a)=>{var o=e+t;if(a)return o;for(;r[e]&&!(e>=o);)++e;return e},Ce=(r,e=0,t,a)=>{var o=Qe(r,e,t,a);if(o-e>16&&r.buffer&&be)return be.decode(r.subarray(e,o));for(var u="";e>10,56320|w&1023)}}return u},G,de=(r,e,t)=>r?Ce(G,r,e,t):"",z,ke=r=>{var e=_e(),t=ge(4),a=ge(4);Vr(r,t,a);var o=z[t>>2],u=z[a>>2],v=de(o);se(o);var f;return u&&(f=de(u),se(u)),Ue(e),[v,f]},ue=r=>{var e=S(r);return ke(e)},we=r=>{var e=new WebAssembly.Exception(m(),[r],{traceStack:!0});throw e.message=ue(e),e},Me=()=>ie(""),ce={},fe=r=>{for(;r.length;){var e=r.pop(),t=r.pop();t(e)}};function ne(r){return this.fromWireType(z[r>>2])}var ve={},Pe={},Ke={};class Wr extends Error{constructor(e){super(e),this.name="InternalError"}}var ze=r=>{throw new Wr(r)},pe=(r,e,t)=>{r.forEach(f=>Ke[f]=e);function a(f){var g=t(f);g.length!==r.length&&ze("Mismatched type converter count");for(var w=0;w{o[f]=Pe[g],++v,v===u.length&&a(o)}));u.length===0&&a(o)},Ar=r=>{var e=ce[r];delete ce[r];var t=e.rawConstructor,a=e.rawDestructor,o=e.fields,u=o.map(v=>v.getterReturnType).concat(o.map(v=>v.setterArgumentType));pe([r],u,v=>{var f={};for(var[g,w]of o.entries()){let _=v[g],T=w.getter,H=w.getterContext,E=v[g+o.length],X=w.setter,j=w.setterContext;f[w.fieldName]={read:I=>_.fromWireType(T(H,I)),write:(I,J)=>{var he=[];X(j,I,E.toWireType(he,J)),fe(he)},optional:_.optional}}return[{name:e.name,fromWireType:_=>{var T={};for(var H in f)T[H]=f[H].read(_);return a(_),T},toWireType:(_,T)=>{for(var H in f)if(!(H in T)&&!f[H].optional)throw new TypeError(`Missing field: "${H}"`);var E=t();for(H in f)f[H].write(E,T[H]);return _!==null&&_.push(a,E),E},readValueFromPointer:ne,destructorFunction:a}]})},B=r=>{for(var e="";;){var t=G[r++];if(!t)return e;e+=String.fromCharCode(t)}};class Fe extends Error{constructor(e){super(e),this.name="BindingError"}}var F=r=>{throw new Fe(r)};function et(r,e,t={}){var a=e.name;if(r||F(`type "${a}" must have a positive integer typeid pointer`),Pe.hasOwnProperty(r)){if(t.ignoreDuplicateRegistrations)return;F(`Cannot register type '${a}' twice`)}if(Pe[r]=e,delete Ke[r],ve.hasOwnProperty(r)){var o=ve[r];delete ve[r],o.forEach(u=>u())}}function oe(r,e,t={}){return et(r,e,t)}var Ve,He,Xe,pr,hr,gr=(r,e,t)=>{switch(e){case 1:return t?a=>P[a]:a=>G[a];case 2:return t?a=>Ve[a>>1]:a=>He[a>>1];case 4:return t?a=>Xe[a>>2]:a=>z[a>>2];case 8:return t?a=>pr[a>>3]:a=>hr[a>>3];default:throw new TypeError(`invalid integer width (${e}): ${r}`)}},rt=(r,e,t,a,o)=>{e=B(e);let u=a===0n,v=f=>f;if(u){let f=t*8;v=g=>BigInt.asUintN(f,g),o=v(o)}oe(r,{name:e,fromWireType:v,toWireType:(f,g)=>(typeof g=="number"&&(g=BigInt(g)),g),readValueFromPointer:gr(e,t,!u),destructorFunction:null})},tt=(r,e,t,a)=>{e=B(e),oe(r,{name:e,fromWireType:function(o){return!!o},toWireType:function(o,u){return u?t:a},readValueFromPointer:function(o){return this.fromWireType(G[o])},destructorFunction:null})},it=r=>({count:r.count,deleteScheduled:r.deleteScheduled,preservePointerOnDelete:r.preservePointerOnDelete,ptr:r.ptr,ptrType:r.ptrType,smartPtr:r.smartPtr,smartPtrType:r.smartPtrType}),je=r=>{function e(t){return t.$$.ptrType.registeredClass.name}F(e(r)+" instance already deleted")},We=!1,dr=r=>{},nt=r=>{r.smartPtr?r.smartPtrType.rawDestructor(r.smartPtr):r.ptrType.registeredClass.rawDestructor(r.ptr)},wr=r=>{r.count.value-=1;var e=r.count.value===0;e&&nt(r)},xe=r=>globalThis.FinalizationRegistry?(We=new FinalizationRegistry(e=>{wr(e.$$)}),xe=e=>{var t=e.$$,a=!!t.smartPtr;if(a){var o={$$:t};We.register(e,o,e)}return e},dr=e=>We.unregister(e),xe(r)):(xe=e=>e,r),Ie=[],at=()=>{for(;Ie.length;){var r=Ie.pop();r.$$.deleteScheduled=!1,r.delete()}},yr,st=()=>{let r=Ze.prototype;Object.assign(r,{isAliasOf(t){if(!(this instanceof Ze)||!(t instanceof Ze))return!1;var a=this.$$.ptrType.registeredClass,o=this.$$.ptr;t.$$=t.$$;for(var u=t.$$.ptrType.registeredClass,v=t.$$.ptr;a.baseClass;)o=a.upcast(o),a=a.baseClass;for(;u.baseClass;)v=u.upcast(v),u=u.baseClass;return a===u&&o===v},clone(){if(this.$$.ptr||je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var t=xe(Object.create(Object.getPrototypeOf(this),{$$:{value:it(this.$$)}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&F("Object already scheduled for deletion"),dr(this),wr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&F("Object already scheduled for deletion"),Ie.push(this),Ie.length===1&&yr&&yr(at),this.$$.deleteScheduled=!0,this}});let e=Symbol.dispose;e&&(r[e]=r.delete)};function Ze(){}var mr=(r,e)=>Object.defineProperty(e,"name",{value:r}),_r={},Ae=(r,e,t)=>{if(r[e].overloadTable===void 0){var a=r[e];r[e]=function(...o){return r[e].overloadTable.hasOwnProperty(o.length)||F(`Function '${t}' called with an invalid number of arguments (${o.length}) - expects one of (${r[e].overloadTable})!`),r[e].overloadTable[o.length].apply(this,o)},r[e].overloadTable=[],r[e].overloadTable[a.argCount]=a}},ot=(r,e,t)=>{i.hasOwnProperty(r)?((t===void 0||i[r].overloadTable!==void 0&&i[r].overloadTable[t]!==void 0)&&F(`Cannot register public name '${r}' twice`),Ae(i,r,r),i[r].overloadTable.hasOwnProperty(t)&&F(`Cannot register multiple overloads of a function with the same number of arguments (${t})!`),i[r].overloadTable[t]=e):(i[r]=e,i[r].argCount=t)},ut=48,ct=57,lt=r=>{r=r.replace(/[^a-zA-Z0-9_]/g,"$");var e=r.charCodeAt(0);return e>=ut&&e<=ct?`_${r}`:r};function ft(r,e,t,a,o,u,v,f){this.name=r,this.constructor=e,this.instancePrototype=t,this.rawDestructor=a,this.baseClass=o,this.getActualType=u,this.upcast=v,this.downcast=f,this.pureVirtualFunctions=[]}var er=(r,e,t)=>{for(;e!==t;)e.upcast||F(`Expected null or instance of ${t.name}, got an instance of ${e.name}`),r=e.upcast(r),e=e.baseClass;return r},rr=r=>{if(r===null)return"null";var e=typeof r;return e==="object"||e==="array"||e==="function"?r.toString():""+r};function vt(r,e){if(e===null)return this.isReference&&F(`null is not a valid ${this.name}`),0;e.$$||F(`Cannot pass "${rr(e)}" as a ${this.name}`),e.$$.ptr||F(`Cannot pass deleted object as a pointer of type ${this.name}`);var t=e.$$.ptrType.registeredClass,a=er(e.$$.ptr,t,this.registeredClass);return a}function pt(r,e){var t;if(e===null)return this.isReference&&F(`null is not a valid ${this.name}`),this.isSmartPointer?(t=this.rawConstructor(),r!==null&&r.push(this.rawDestructor,t),t):0;(!e||!e.$$)&&F(`Cannot pass "${rr(e)}" as a ${this.name}`),e.$$.ptr||F(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&e.$$.ptrType.isConst&&F(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);var a=e.$$.ptrType.registeredClass;if(t=er(e.$$.ptr,a,this.registeredClass),this.isSmartPointer)switch(e.$$.smartPtr===void 0&&F("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?t=e.$$.smartPtr:F(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:t=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)t=e.$$.smartPtr;else{var o=e.clone();t=this.rawShare(t,nr.toHandle(()=>o.delete())),r!==null&&r.push(this.rawDestructor,t)}break;default:F("Unsupported sharing policy")}return t}function ht(r,e){if(e===null)return this.isReference&&F(`null is not a valid ${this.name}`),0;e.$$||F(`Cannot pass "${rr(e)}" as a ${this.name}`),e.$$.ptr||F(`Cannot pass deleted object as a pointer of type ${this.name}`),e.$$.ptrType.isConst&&F(`Cannot convert argument of type ${e.$$.ptrType.name} to parameter type ${this.name}`);var t=e.$$.ptrType.registeredClass,a=er(e.$$.ptr,t,this.registeredClass);return a}var Ur=(r,e,t)=>{if(e===t)return r;if(t.baseClass===void 0)return null;var a=Ur(r,e,t.baseClass);return a===null?null:t.downcast(a)},gt={},dt=(r,e)=>{for(e===void 0&&F("ptr should not be undefined");r.baseClass;)e=r.upcast(e),r=r.baseClass;return e},wt=(r,e)=>(e=dt(r,e),gt[e]),Le=(r,e)=>{(!e.ptrType||!e.ptr)&&ze("makeClassHandle requires ptr and ptrType");var t=!!e.smartPtrType,a=!!e.smartPtr;return t!==a&&ze("Both smartPtrType and smartPtr must be specified"),e.count={value:1},xe(Object.create(r,{$$:{value:e,writable:!0}}))};function yt(r){var e=this.getPointee(r);if(!e)return this.destructor(r),null;var t=wt(this.registeredClass,e);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=e,t.$$.smartPtr=r,t.clone();var a=t.clone();return this.destructor(r),a}function o(){return this.isSmartPointer?Le(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:r}):Le(this.registeredClass.instancePrototype,{ptrType:this,ptr:r})}var u=this.registeredClass.getActualType(e),v=_r[u];if(!v)return o.call(this);var f;this.isConst?f=v.constPointerType:f=v.pointerType;var g=Ur(e,this.registeredClass,f.registeredClass);return g===null?o.call(this):this.isSmartPointer?Le(f.registeredClass.instancePrototype,{ptrType:f,ptr:g,smartPtrType:this,smartPtr:r}):Le(f.registeredClass.instancePrototype,{ptrType:f,ptr:g})}var mt=()=>{Object.assign(Ye.prototype,{getPointee(r){return this.rawGetPointee&&(r=this.rawGetPointee(r)),r},destructor(r){this.rawDestructor?.(r)},readValueFromPointer:ne,fromWireType:yt})};function Ye(r,e,t,a,o,u,v,f,g,w,_){this.name=r,this.registeredClass=e,this.isReference=t,this.isConst=a,this.isSmartPointer=o,this.pointeeType=u,this.sharingPolicy=v,this.rawGetPointee=f,this.rawConstructor=g,this.rawShare=w,this.rawDestructor=_,!o&&e.baseClass===void 0?a?(this.toWireType=vt,this.destructorFunction=null):(this.toWireType=ht,this.destructorFunction=null):this.toWireType=pt}var _t=(r,e,t)=>{i.hasOwnProperty(r)||ze("Replacing nonexistent public symbol"),i[r].overloadTable!==void 0&&t!==void 0?i[r].overloadTable[t]=e:(i[r]=e,i[r].argCount=t)},Ut=r=>Ir.get(r),ae=(r,e,t=!1)=>{r=B(r);function a(){var u=Ut(e);return u}var o=a();return typeof o!="function"&&F(`unknown function pointer with signature ${r}: ${e}`),o};class bt extends Error{}var Ct=r=>{var e=Rr(r),t=B(e);return se(e),t},Se=(r,e)=>{var t=[],a={};function o(u){if(!a[u]&&!Pe[u]){if(Ke[u]){Ke[u].forEach(o);return}t.push(u),a[u]=!0}}throw e.forEach(o),new bt(`${r}: `+t.map(Ct).join([", "]))},Mt=(r,e,t,a,o,u,v,f,g,w,_,T,H)=>{_=B(_),u=ae(o,u),f&&=ae(v,f),w&&=ae(g,w),H=ae(T,H);var E=lt(_);ot(E,function(){Se(`Cannot construct ${_} due to unbound types`,[a])}),pe([r,e,t],a?[a]:[],X=>{X=X[0];var j,I;a?(j=X.registeredClass,I=j.instancePrototype):I=Ze.prototype;var J=mr(_,function(...or){if(Object.getPrototypeOf(this)!==he)throw new Fe(`Use 'new' to construct ${_}`);if(re.constructor_body===void 0)throw new Fe(`${_} has no accessible constructor`);var Zr=re.constructor_body[or.length];if(Zr===void 0)throw new Fe(`Tried to invoke ctor of ${_} with invalid number of parameters (${or.length}) - expected (${Object.keys(re.constructor_body).toString()}) parameters instead!`);return Zr.apply(this,or)}),he=Object.create(I,{constructor:{value:J}});J.prototype=he;var re=new ft(_,J,he,H,j,u,f,w);re.baseClass&&(re.baseClass.__derivedClasses??=[],re.baseClass.__derivedClasses.push(re));var sr=new Ye(_,re,!0,!1,!1),le=new Ye(_+"*",re,!1,!1,!1),Oe=new Ye(_+" const*",re,!1,!0,!1);return _r[r]={pointerType:le,constPointerType:Oe},_t(E,J),[sr,le,Oe]})};function Pt(r){for(var e=1;e{for(var t=[],a=0;a>2]);return t},br=r=>{r=r.trim();let e=r.indexOf("(");return e===-1?r:r.slice(0,e)},Qt=(r,e,t,a,o,u,v,f,g)=>{var w=ir(t,a);e=B(e),e=br(e),u=ae(o,u,f),pe([],[r],_=>{_=_[0];var T=`${_.name}.${e}`;function H(){Se(`Cannot call ${T} due to unbound types`,w)}e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var E=_.registeredClass.constructor;return E[e]===void 0?(H.argCount=t-1,E[e]=H):(Ae(E,e,T),E[e].overloadTable[t-1]=H),pe([],w,X=>{var j=[X[0],null].concat(X.slice(1)),I=tr(T,j,null,u,v,f);if(E[e].overloadTable===void 0?(I.argCount=t-1,E[e]=I):E[e].overloadTable[t-1]=I,_.registeredClass.__derivedClasses)for(let J of _.registeredClass.__derivedClasses)J.constructor.hasOwnProperty(e)||(J.constructor[e]=I);return[]}),[]})},Ft=(r,e,t,a,o,u)=>{var v=ir(e,t);o=ae(a,o),pe([],[r],f=>{f=f[0];var g=`constructor ${f.name}`;if(f.registeredClass.constructor_body===void 0&&(f.registeredClass.constructor_body=[]),f.registeredClass.constructor_body[e-1]!==void 0)throw new Fe(`Cannot register multiple constructors with identical number of parameters (${e-1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return f.registeredClass.constructor_body[e-1]=()=>{Se(`Cannot construct ${f.name} due to unbound types`,v)},pe([],v,w=>(w.splice(1,0,null),f.registeredClass.constructor_body[e-1]=tr(g,w,null,o,u),[])),[]})},Ht=(r,e,t,a,o,u,v,f,g,w)=>{var _=ir(t,a);e=B(e),e=br(e),u=ae(o,u,g),pe([],[r],T=>{T=T[0];var H=`${T.name}.${e}`;e.startsWith("@@")&&(e=Symbol[e.substring(2)]),f&&T.registeredClass.pureVirtualFunctions.push(e);function E(){Se(`Cannot call ${H} due to unbound types`,_)}var X=T.registeredClass.instancePrototype,j=X[e];return j===void 0||j.overloadTable===void 0&&j.className!==T.name&&j.argCount===t-2?(E.argCount=t-2,E.className=T.name,X[e]=E):(Ae(X,e,H),X[e].overloadTable[t-2]=E),pe([],_,I=>{var J=tr(H,I,T,u,v,g);return X[e].overloadTable===void 0?(J.argCount=t-2,X[e]=J):X[e].overloadTable[t-2]=J,[]}),[]})},Cr=[],ye=[0,1,,1,null,1,!0,1,!1,1],Mr=[],xt=r=>{if(r>9&&--ye[r+1]===0){var e=ye[r];ye[r]=void 0;var t=Mr[r];t&&(Mr[r]=void 0,t(e)),Cr.push(r)}},nr={toValue:r=>(r||F(`Cannot use deleted val. handle = ${r}`),ye[r]),toHandle:r=>{switch(r){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let e=Cr.pop()||ye.length;return ye[e]=r,ye[e+1]=1,e}}}},Tt={name:"emscripten::val",fromWireType:r=>{var e=nr.toValue(r);return xt(r),e},toWireType:(r,e)=>nr.toHandle(e),readValueFromPointer:ne,destructorFunction:null},Et=r=>oe(r,Tt),Pr,Qr,qt=(r,e)=>{switch(e){case 4:return function(t){return this.fromWireType(Pr[t>>2])};case 8:return function(t){return this.fromWireType(Qr[t>>3])};default:throw new TypeError(`invalid float width (${e}): ${r}`)}},Rt=(r,e,t)=>{e=B(e),oe(r,{name:e,fromWireType:a=>a,toWireType:(a,o)=>o,readValueFromPointer:qt(e,t),destructorFunction:null})},$t=(r,e,t,a,o)=>{e=B(e);let u=a===0,v=g=>g;if(u){var f=32-8*t;v=g=>g<>>f,o=v(o)}oe(r,{name:e,fromWireType:v,toWireType:(g,w)=>w,readValueFromPointer:gr(e,t,a!==0),destructorFunction:null})},Nt=(r,e,t)=>{var a=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],o=a[e];function u(v){var f=z[v>>2],g=z[v+4>>2];return new o(P.buffer,g,f)}t=B(t),oe(r,{name:t,fromWireType:u,readValueFromPointer:u},{ignoreDuplicateRegistrations:!0})},Jt=(r,e,t,a)=>{if(!(a>0))return 0;for(var o=t,u=t+a-1,v=0;v=u)break;e[t++]=f}else if(f<=2047){if(t+1>=u)break;e[t++]=192|f>>6,e[t++]=128|f&63}else if(f<=65535){if(t+2>=u)break;e[t++]=224|f>>12,e[t++]=128|f>>6&63,e[t++]=128|f&63}else{if(t+3>=u)break;e[t++]=240|f>>18,e[t++]=128|f>>12&63,e[t++]=128|f>>6&63,e[t++]=128|f&63,v++}}return e[t]=0,t-o},Fr=(r,e,t)=>Jt(r,G,e,t),Hr=r=>{for(var e=0,t=0;t=55296&&a<=57343?(e+=4,++t):e+=3}return e},kt=(r,e)=>{e=B(e);var t=!0;oe(r,{name:e,fromWireType(a){var o=z[a>>2],u=a+4,v;if(t)v=de(u,o,!0);else{v="";for(var f=0;f>2]=u,v)if(t)Fr(o,g,u+1);else for(var w=0;w255&&(se(f),F("String has UTF-16 code units that do not fit in 8 bits")),G[g+w]=_}else G.set(o,g);return a!==null&&a.push(se,f),f},readValueFromPointer:ne,destructorFunction(a){se(a)}})},xr=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Kt=(r,e,t)=>{var a=r>>1,o=Qe(He,a,e/2,t);if(o-a>16&&xr)return xr.decode(He.subarray(a,o));for(var u="",v=a;v{if(t<2)return 0;t-=2;for(var a=e,o=t>1]=v,e+=2}return Ve[e>>1]=0,e-a},Vt=r=>r.length*2,Xt=(r,e,t)=>{for(var a="",o=r>>2,u=0;!(u>=e/4);u++){var v=z[o+u];if(!v&&!t)break;a+=String.fromCodePoint(v)}return a},It=(r,e,t=2147483647)=>{if(t<4)return 0;for(var a=e,o=a+t-4,u=0;u65535&&u++,Xe[e>>2]=v,e+=4,e+4>o)break}return Xe[e>>2]=0,e-a},Zt=r=>{for(var e=0,t=0;t65535&&t++,e+=4}return e},Lt=(r,e,t)=>{t=B(t);var a,o,u;e===2?(a=Kt,o=zt,u=Vt):(a=Xt,o=It,u=Zt),oe(r,{name:t,fromWireType:v=>{var f=z[v>>2],g=a(v+4,f*e,!0);return se(v),g},toWireType:(v,f)=>{typeof f!="string"&&F(`Cannot pass non-string to C++ string type ${t}`);var g=u(f),w=ar(4+g+e);return z[w>>2]=g/e,o(f,w+4,g+e),v!==null&&v.push(se,w),w},readValueFromPointer:ne,destructorFunction(v){se(v)}})},Yt=(r,e,t,a,o,u)=>{ce[r]={name:B(e),rawConstructor:ae(t,a),rawDestructor:ae(o,u),fields:[]}},St=(r,e,t,a,o,u,v,f,g,w)=>{ce[r].fields.push({fieldName:B(e),getterReturnType:t,getter:ae(a,o),getterContext:u,setterArgumentType:v,setter:ae(f,g),setterContext:w})},Bt=(r,e)=>{e=B(e),oe(r,{isVoid:!0,name:e,fromWireType:()=>{},toWireType:(t,a)=>{}})},Ot=0,Dt=()=>{Ot=0},Te={},Tr=r=>{if(r instanceof D||r=="unwind")return x;s(1,r)},Er=()=>!0,qr=r=>{x=r,Er()||(Q=!0),s(r,new D(r))},Gt=(r,e)=>{x=r,qr(r)},jt=Gt,Wt=()=>{if(!Er())try{jt(x)}catch(r){Tr(r)}},At=r=>{if(!Q)try{return r()}catch(e){Tr(e)}finally{Wt()}},ei=()=>performance.now(),ri=(r,e)=>{if(Te[r]&&(clearTimeout(Te[r].id),delete Te[r]),!e)return 0;var t=setTimeout(()=>{delete Te[r],At(()=>$r(r,ei()))},e);return Te[r]={id:t,timeout_ms:e},0},ti=()=>2147483648,ii=(r,e)=>Math.ceil(r/e)*e,ni=r=>{var e=Be.buffer.byteLength,t=(r-e+65535)/65536|0;try{return Be.grow(t),q(),1}catch{}},ai=r=>{var e=G.length;r>>>=0;var t=ti();if(r>t)return!1;for(var a=1;a<=4;a*=2){var o=e*(1+.2/a);o=Math.min(o,r+100663296);var u=Math.min(t,ii(Math.max(r,o),65536)),v=ni(u);if(v)return!0}return!1},si=r=>52,oi=9007199254740992,ui=-9007199254740992,ci=r=>roi?NaN:Number(r);function li(r,e,t,a){return e=ci(e),70}var fi=[null,[],[]],vi=(r,e)=>{var t=fi[r];!e||e===10?((r===1?U:C)(Ce(t)),t.length=0):t.push(e)},pi=(r,e,t,a)=>{for(var o=0,u=0;u>2],f=z[e+4>>2];e+=8;for(var g=0;g>2]=o,0};st(),mt(),i.wasmBinary&&(M=i.wasmBinary),i.UTF8ToString=de,i.stringToUTF8=Fr,i.lengthBytesUTF8=Hr;var Rr,ar,se,$r,Nr,Jr,kr,Kr,zr,Vr,hi,gi,Xr,Be,Ir;function di(r){Rr=r.B,ar=i._malloc=r.C,se=i._free=r.D,$r=r.F,Nr=r.G,Jr=r.H,kr=r.I,Kr=r.J,zr=r.K,Vr=r.L,hi=Be=r.z,gi=Ir=r.E,Xr=r.M}var wi={t:we,x:Me,f:Ar,i:rt,l:tt,o:Mt,b:Qt,n:Ft,d:Ht,y:Et,h:Rt,c:$t,a:Nt,k:kt,g:Lt,j:Yt,e:St,m:Bt,w:Dt,p:ri,u:ai,s:si,q:li,r:pi,v:qr};async function yi(){!Q&&(V(),void 0)}var Ee;return Ee=await ee(),await yi(),i}var Br=$i;var Ni=new Int8Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,90,63,64,65,66,-1,67,68,69,70,71,-1,72,73,52,53,54,55,56,57,58,59,60,61,74,75,76,77,78,79,80,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,81,-1,82,83,84,85,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,86,87,88,89,-1]);function Ji(n){let i=new Uint8Array(170930),s=0,c=0,l=0,p=-1;for(let h=0,d=n.length;h127)continue;let C=Ni[U];if(!(C<0))if(p<0)p=C;else{p+=C*91,c|=p<88?13:14;do i[s++]=c,c>>>=8,l-=8;while(l>7);p=-1}}return p>=0&&(i[s++]=(c|p<""})}function Dr(){fr=void 0}var Gr=class{_module;constructor(n){this._module=n}malloc(n){let i=this._module._malloc(n);return{ptr:i,size:n,dispose:()=>this.free({ptr:i,size:n,dispose:()=>{}})}}free(n){this._module._free(n.ptr)}dataToHeap(n){let i=this.malloc(n.byteLength);return this._module.HEAPU8.set(n,i.ptr),i}heapView(n){return this._module.HEAPU8.subarray(n.ptr,n.ptr+n.size)}heapToUint8Array(n){return new Uint8Array([...this.heapView(n)])}lengthBytes(n){return this._module.lengthBytesUTF8(n)}stringToHeap(n){let i=this.lengthBytes(n)+1,s=this._module._malloc(i);return this._module.stringToUTF8(n,s,i),{ptr:s,size:i,dispose:()=>this.free({ptr:s,size:i,dispose:()=>{}})}}heapToString(n){return this._module.UTF8ToString(n.ptr,n.size)}hasFilesystem(){let n=this._module;return n.FS_createPath!==void 0&&n.FS_createDataFile!==void 0&&n.FS_preloadFile!==void 0&&n.FS_unlink!==void 0}createPath(n,i=!0,s=!0){return this._module.FS_createPath("/",n,i,s)}createDataFile(n,i,s=!0,c=!0,l=!0){return this._module.FS_createDataFile("/",n,i,s,c,l)}preloadFile(n,i,s=!0,c=!0,l=!1,p=!0,h=!1){return this._module.FS_preloadFile("/",n,i,s,c,l,p,h)}unlink(n){return this._module.FS_unlink(n)}};var Ne,Ki=4294967295;function Je(n,i){if(!Number.isInteger(n)||n<0||n>Ki)throw new Error(`${i} length ${n} is outside the WASM32-safe range`)}function vr(n){if(n.length===0)return new Uint8Array(0);if(n.length===1)return n[0];let i=0;for(let l of n)i+=l.length;let s=new Uint8Array(i),c=0;for(let l of n)s.set(l,c),c+=l.length;return s}var jr=class n{_mainModule;_zstdClass;_zstd;_compressionLevel;_decompressFrameCompleted=!1;_decompressRemaining=0;_decompressSawInput=!1;constructor(i){this._mainModule=new Gr(i),this._zstdClass=i.zstd,this._zstd=new this._zstdClass,this._compressionLevel=this._zstdClass.defaultCLevel()}static load(){return Ne||(Ne=Or().then(i=>new n(i))),Ne}static unload(){Dr(),Ne?.then(i=>{i?._zstd?.delete()}),Ne=void 0}copyHeap(i){return this._mainModule.heapView(i).slice()}mallocChecked(i,s){Je(i,s);let c=this._mainModule.malloc(i);if(!c.ptr)throw this._mainModule.free(c),new Error(`Failed to allocate ${i} bytes for ${s}`);return c}throwStreamError(i,s){throw new Error(`${i} failed: ${s.errorName||"unknown error"}`)}ensureStreamOk(i,s){s.error&&this.throwStreamError(i,s)}version(){return this._zstdClass.version()}reset(){let i=this._zstd.reset();this.ensureStreamOk("reset",i),this._decompressFrameCompleted=!1,this._decompressRemaining=0,this._decompressSawInput=!1}resetCompression(i){i!==void 0&&(this._compressionLevel=i);let s=this._zstd.resetCompression(this._compressionLevel);this.ensureStreamOk("resetCompression",s)}resetDecompression(){let i=this._zstd.resetDecompression();this.ensureStreamOk("resetDecompression",i),this._decompressFrameCompleted=!1,this._decompressRemaining=0,this._decompressSawInput=!1}setCompressionLevel(i){let s=this._zstd.setCompressionLevel(i);this.ensureStreamOk("setCompressionLevel",s),this._compressionLevel=i}compress(i,s=this.defaultCLevel()){Je(i.length,"compress input");let c=this._mainModule.dataToHeap(i);try{if(!c.ptr&&i.length>0)throw new Error("Failed to allocate compress input buffer");let l=this._zstdClass.compressBound(i.length),p=this.mallocChecked(l,"compress output");try{if(p.size=this._zstdClass.compress(p.ptr,l,c.ptr,c.size,s),this._zstdClass.isError(p.size))throw new Error(`compress failed: ${this._zstdClass.getErrorName(p.size)}`);return this.copyHeap(p)}finally{this._mainModule.free(p)}}finally{this._mainModule.free(c)}}compressChunk(i){if(Je(i.length,"compressChunk input"),i.length===0)return new Uint8Array(0);let s=this._mainModule.dataToHeap(i);try{if(!s.ptr)throw new Error("Failed to allocate compressChunk input buffer");let c=this._zstdClass.CStreamOutSize(),l=[],p=0;for(;p0&&(h.size=d.produced,l.push(this.copyHeap(h)))}finally{this._mainModule.free(h)}}return vr(l)}finally{this._mainModule.free(s)}}compressEnd(){let i=this._zstdClass.CStreamOutSize(),s=[],c=1;for(;c!==0;){let l=this.mallocChecked(i,"compressEnd output");try{let p=this._zstd.compressEnd(l.ptr,i);if(this.ensureStreamOk("compressEnd",p),p.produced===0&&p.remaining!==0)throw new Error("compressEnd failed: no progress while finishing stream");c=p.remaining,p.produced>0&&(l.size=p.produced,s.push(this.copyHeap(l)))}finally{this._mainModule.free(l)}}return vr(s)}frameContentSize(i){return this._zstdClass.getFrameContentSize(i.ptr,i.size)}decompress(i){Je(i.length,"decompress input");let s=this._mainModule.dataToHeap(i);try{if(!s.ptr&&i.length>0)throw new Error("Failed to allocate decompress input buffer");let c=this.frameContentSize(s);if(c.error)throw new Error(`Failed to get frame content size: ${c.errorName}`);let l=c.known;if(l){let p=this._zstdClass.findFrameCompressedSize(s.ptr,s.size);if(this._zstdClass.isError(p))throw new Error(`Failed to find frame compressed size: ${this._zstdClass.getErrorName(p)}`);p0?s.ptr+p:0,M=this._zstd.decompressChunk(d.ptr,c,C,U);if(this.ensureStreamOk("decompressChunk",M),M.consumed===0&&M.produced===0){if(U===0){M.remaining>0&&(this._decompressRemaining=M.remaining);break}throw new Error("decompressChunk failed: no progress while consuming input")}p+=M.consumed,h=M.produced===c&&M.remaining!==0,M.produced>0&&(d.size=M.produced,l.push(this.copyHeap(d))),M.remaining===0?(this._decompressFrameCompleted=!0,this._decompressRemaining=0):this._decompressRemaining=M.remaining}finally{this._mainModule.free(d)}}return vr(l)}finally{this._mainModule.free(s)}}decompressEnd(){if(!this._decompressSawInput)throw new Error("decompressEnd failed: empty compressed input is not a completed frame");if(!this._decompressFrameCompleted||this._decompressRemaining!==0)throw new Error("decompressEnd failed: truncated Zstandard input")}defaultCLevel(){return this._zstdClass.defaultCLevel()}minCLevel(){return this._zstdClass.minCLevel()}maxCLevel(){return this._zstdClass.maxCLevel()}};export{jr as Zstd}; +//# sourceMappingURL=index.js.map diff --git a/node_modules/@hpcc-js/wasm-zstd/dist/index.js.map b/node_modules/@hpcc-js/wasm-zstd/dist/index.js.map new file mode 100644 index 0000000..a92a051 --- /dev/null +++ b/node_modules/@hpcc-js/wasm-zstd/dist/index.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../../../node_modules/fzstd/esm/index.mjs", "../../../build/packages/zstd/zstdlib.js", "../../../build/packages/zstd/zstdlib.wasm", "../../util/src/wasm-library.ts", "../src/zstd.ts"], + "sourcesContent": ["// Some numerical data is initialized as -1 even when it doesn't need initialization to help the JIT infer types\n// aliases for shorter compressed code (most minifers don't do this)\nvar ab = ArrayBuffer, u8 = Uint8Array, u16 = Uint16Array, i16 = Int16Array, u32 = Uint32Array, i32 = Int32Array;\nvar slc = function (v, s, e) {\n if (u8.prototype.slice)\n return u8.prototype.slice.call(v, s, e);\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n var n = new u8(e - s);\n n.set(v.subarray(s, e));\n return n;\n};\nvar fill = function (v, n, s, e) {\n if (u8.prototype.fill)\n return u8.prototype.fill.call(v, n, s, e);\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n for (; s < e; ++s)\n v[s] = n;\n return v;\n};\nvar cpw = function (v, t, s, e) {\n if (u8.prototype.copyWithin)\n return u8.prototype.copyWithin.call(v, t, s, e);\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n while (s < e) {\n v[t++] = v[s++];\n }\n};\n/**\n * Codes for errors generated within this library\n */\nexport var ZstdErrorCode = {\n InvalidData: 0,\n WindowSizeTooLarge: 1,\n InvalidBlockType: 2,\n FSEAccuracyTooHigh: 3,\n DistanceTooFarBack: 4,\n UnexpectedEOF: 5\n};\n// error codes\nvar ec = [\n 'invalid zstd data',\n 'window size too large (>2046MB)',\n 'invalid block type',\n 'FSE accuracy too high',\n 'match distance too far back',\n 'unexpected EOF'\n];\nvar err = function (ind, msg, nt) {\n var e = new Error(msg || ec[ind]);\n e.code = ind;\n if (Error.captureStackTrace)\n Error.captureStackTrace(e, err);\n if (!nt)\n throw e;\n return e;\n};\nvar rb = function (d, b, n) {\n var i = 0, o = 0;\n for (; i < n; ++i)\n o |= d[b++] << (i << 3);\n return o;\n};\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };\n// read Zstandard frame header\nvar rzfh = function (dat, w) {\n var n3 = dat[0] | (dat[1] << 8) | (dat[2] << 16);\n if (n3 == 0x2FB528 && dat[3] == 253) {\n // Zstandard\n var flg = dat[4];\n // single segment checksum dict flag frame content flag\n var ss = (flg >> 5) & 1, cc = (flg >> 2) & 1, df = flg & 3, fcf = flg >> 6;\n if (flg & 8)\n err(0);\n // byte\n var bt = 6 - ss;\n // dict bytes\n var db = df == 3 ? 4 : df;\n // dictionary id\n var di = rb(dat, bt, db);\n bt += db;\n // frame size bytes\n var fsb = fcf ? (1 << fcf) : ss;\n // frame source size\n var fss = rb(dat, bt, fsb) + ((fcf == 1) && 256);\n // window size\n var ws = fss;\n if (!ss) {\n // window descriptor\n var wb = 1 << (10 + (dat[5] >> 3));\n ws = wb + (wb >> 3) * (dat[5] & 7);\n }\n if (ws > 2145386496)\n err(1);\n var buf = new u8((w == 1 ? (fss || ws) : w ? 0 : ws) + 12);\n buf[0] = 1, buf[4] = 4, buf[8] = 8;\n return {\n b: bt + fsb,\n y: 0,\n l: 0,\n d: di,\n w: (w && w != 1) ? w : buf.subarray(12),\n e: ws,\n o: new i32(buf.buffer, 0, 3),\n u: fss,\n c: cc,\n m: Math.min(131072, ws)\n };\n }\n else if (((n3 >> 4) | (dat[3] << 20)) == 0x184D2A5) {\n // skippable\n return b4(dat, 4) + 8;\n }\n err(0);\n};\n// most significant bit for nonzero\nvar msb = function (val) {\n var bits = 0;\n for (; (1 << bits) <= val; ++bits)\n ;\n return bits - 1;\n};\n// read finite state entropy\nvar rfse = function (dat, bt, mal) {\n // table pos\n var tpos = (bt << 3) + 4;\n // accuracy log\n var al = (dat[bt] & 15) + 5;\n if (al > mal)\n err(3);\n // size\n var sz = 1 << al;\n // probabilities symbols repeat index high threshold\n var probs = sz, sym = -1, re = -1, i = -1, ht = sz;\n // optimization: single allocation is much faster\n var buf = new ab(512 + (sz << 2));\n var freq = new i16(buf, 0, 256);\n // same view as freq\n var dstate = new u16(buf, 0, 256);\n var nstate = new u16(buf, 512, sz);\n var bb1 = 512 + (sz << 1);\n var syms = new u8(buf, bb1, sz);\n var nbits = new u8(buf, bb1 + sz);\n while (sym < 255 && probs > 0) {\n var bits = msb(probs + 1);\n var cbt = tpos >> 3;\n // mask\n var msk = (1 << (bits + 1)) - 1;\n var val = ((dat[cbt] | (dat[cbt + 1] << 8) | (dat[cbt + 2] << 16)) >> (tpos & 7)) & msk;\n // mask (1 fewer bit)\n var msk1fb = (1 << bits) - 1;\n // max small value\n var msv = msk - probs - 1;\n // small value\n var sval = val & msk1fb;\n if (sval < msv)\n tpos += bits, val = sval;\n else {\n tpos += bits + 1;\n if (val > msk1fb)\n val -= msv;\n }\n freq[++sym] = --val;\n if (val == -1) {\n probs += val;\n syms[--ht] = sym;\n }\n else\n probs -= val;\n if (!val) {\n do {\n // repeat byte\n var rbt = tpos >> 3;\n re = ((dat[rbt] | (dat[rbt + 1] << 8)) >> (tpos & 7)) & 3;\n tpos += 2;\n sym += re;\n } while (re == 3);\n }\n }\n if (sym > 255 || probs)\n err(0);\n var sympos = 0;\n // sym step (coprime with sz - formula from zstd source)\n var sstep = (sz >> 1) + (sz >> 3) + 3;\n // sym mask\n var smask = sz - 1;\n for (var s = 0; s <= sym; ++s) {\n var sf = freq[s];\n if (sf < 1) {\n dstate[s] = -sf;\n continue;\n }\n // This is split into two loops in zstd to avoid branching, but as JS is higher-level that is unnecessary\n for (i = 0; i < sf; ++i) {\n syms[sympos] = s;\n do {\n sympos = (sympos + sstep) & smask;\n } while (sympos >= ht);\n }\n }\n // After spreading symbols, should be zero again\n if (sympos)\n err(0);\n for (i = 0; i < sz; ++i) {\n // next state\n var ns = dstate[syms[i]]++;\n // num bits\n var nb = nbits[i] = al - msb(ns);\n nstate[i] = (ns << nb) - sz;\n }\n return [(tpos + 7) >> 3, {\n b: al,\n s: syms,\n n: nbits,\n t: nstate\n }];\n};\n// read huffman\nvar rhu = function (dat, bt) {\n // index weight count\n var i = 0, wc = -1;\n // buffer header byte\n var buf = new u8(292), hb = dat[bt];\n // huffman weights\n var hw = buf.subarray(0, 256);\n // rank count\n var rc = buf.subarray(256, 268);\n // rank index\n var ri = new u16(buf.buffer, 268);\n // NOTE: at this point bt is 1 less than expected\n if (hb < 128) {\n // end byte, fse decode table\n var _a = rfse(dat, bt + 1, 6), ebt = _a[0], fdt = _a[1];\n bt += hb;\n var epos = ebt << 3;\n // last byte\n var lb = dat[bt];\n if (!lb)\n err(0);\n // state1 state2 state1 bits state2 bits\n var st1 = 0, st2 = 0, btr1 = fdt.b, btr2 = btr1;\n // fse pos\n // pre-increment to account for original deficit of 1\n var fpos = (++bt << 3) - 8 + msb(lb);\n for (;;) {\n fpos -= btr1;\n if (fpos < epos)\n break;\n var cbt = fpos >> 3;\n st1 += ((dat[cbt] | (dat[cbt + 1] << 8)) >> (fpos & 7)) & ((1 << btr1) - 1);\n hw[++wc] = fdt.s[st1];\n fpos -= btr2;\n if (fpos < epos)\n break;\n cbt = fpos >> 3;\n st2 += ((dat[cbt] | (dat[cbt + 1] << 8)) >> (fpos & 7)) & ((1 << btr2) - 1);\n hw[++wc] = fdt.s[st2];\n btr1 = fdt.n[st1];\n st1 = fdt.t[st1];\n btr2 = fdt.n[st2];\n st2 = fdt.t[st2];\n }\n if (++wc > 255)\n err(0);\n }\n else {\n wc = hb - 127;\n for (; i < wc; i += 2) {\n var byte = dat[++bt];\n hw[i] = byte >> 4;\n hw[i + 1] = byte & 15;\n }\n ++bt;\n }\n // weight exponential sum\n var wes = 0;\n for (i = 0; i < wc; ++i) {\n var wt = hw[i];\n // bits must be at most 11, same as weight\n if (wt > 11)\n err(0);\n wes += wt && (1 << (wt - 1));\n }\n // max bits\n var mb = msb(wes) + 1;\n // table size\n var ts = 1 << mb;\n // remaining sum\n var rem = ts - wes;\n // must be power of 2\n if (rem & (rem - 1))\n err(0);\n hw[wc++] = msb(rem) + 1;\n for (i = 0; i < wc; ++i) {\n var wt = hw[i];\n ++rc[hw[i] = wt && (mb + 1 - wt)];\n }\n // huf buf\n var hbuf = new u8(ts << 1);\n // symbols num bits\n var syms = hbuf.subarray(0, ts), nb = hbuf.subarray(ts);\n ri[mb] = 0;\n for (i = mb; i > 0; --i) {\n var pv = ri[i];\n fill(nb, i, pv, ri[i - 1] = pv + rc[i] * (1 << (mb - i)));\n }\n if (ri[0] != ts)\n err(0);\n for (i = 0; i < wc; ++i) {\n var bits = hw[i];\n if (bits) {\n var code = ri[bits];\n fill(syms, i, code, ri[bits] = code + (1 << (mb - bits)));\n }\n }\n return [bt, {\n n: nb,\n b: mb,\n s: syms\n }];\n};\n// Tables generated using this:\n// https://gist.github.com/101arrowz/a979452d4355992cbf8f257cbffc9edd\n// default literal length table\nvar dllt = /*#__PURE__*/ rfse(/*#__PURE__*/ new u8([\n 81, 16, 99, 140, 49, 198, 24, 99, 12, 33, 196, 24, 99, 102, 102, 134, 70, 146, 4\n]), 0, 6)[1];\n// default match length table\nvar dmlt = /*#__PURE__*/ rfse(/*#__PURE__*/ new u8([\n 33, 20, 196, 24, 99, 140, 33, 132, 16, 66, 8, 33, 132, 16, 66, 8, 33, 68, 68, 68, 68, 68, 68, 68, 68, 36, 9\n]), 0, 6)[1];\n// default offset code table\nvar doct = /*#__PURE__ */ rfse(/*#__PURE__*/ new u8([\n 32, 132, 16, 66, 102, 70, 68, 68, 68, 68, 36, 73, 2\n]), 0, 5)[1];\n// bits to baseline\nvar b2bl = function (b, s) {\n var len = b.length, bl = new i32(len);\n for (var i = 0; i < len; ++i) {\n bl[i] = s;\n s += 1 << b[i];\n }\n return bl;\n};\n// literal length bits\nvar llb = /*#__PURE__ */ new u8(( /*#__PURE__ */new i32([\n 0, 0, 0, 0, 16843009, 50528770, 134678020, 202050057, 269422093\n])).buffer, 0, 36);\n// literal length baseline\nvar llbl = /*#__PURE__ */ b2bl(llb, 0);\n// match length bits\nvar mlb = /*#__PURE__ */ new u8(( /*#__PURE__ */new i32([\n 0, 0, 0, 0, 0, 0, 0, 0, 16843009, 50528770, 117769220, 185207048, 252579084, 16\n])).buffer, 0, 53);\n// match length baseline\nvar mlbl = /*#__PURE__ */ b2bl(mlb, 3);\n// decode huffman stream\nvar dhu = function (dat, out, hu) {\n var len = dat.length, ss = out.length, lb = dat[len - 1], msk = (1 << hu.b) - 1, eb = -hu.b;\n if (!lb)\n err(0);\n var st = 0, btr = hu.b, pos = (len << 3) - 8 + msb(lb) - btr, i = -1;\n for (; pos > eb && i < ss;) {\n var cbt = pos >> 3;\n var val = (dat[cbt] | (dat[cbt + 1] << 8) | (dat[cbt + 2] << 16)) >> (pos & 7);\n st = ((st << btr) | val) & msk;\n out[++i] = hu.s[st];\n pos -= (btr = hu.n[st]);\n }\n if (pos != eb || i + 1 != ss)\n err(0);\n};\n// decode huffman stream 4x\n// TODO: use workers to parallelize\nvar dhu4 = function (dat, out, hu) {\n var bt = 6;\n var ss = out.length, sz1 = (ss + 3) >> 2, sz2 = sz1 << 1, sz3 = sz1 + sz2;\n dhu(dat.subarray(bt, bt += dat[0] | (dat[1] << 8)), out.subarray(0, sz1), hu);\n dhu(dat.subarray(bt, bt += dat[2] | (dat[3] << 8)), out.subarray(sz1, sz2), hu);\n dhu(dat.subarray(bt, bt += dat[4] | (dat[5] << 8)), out.subarray(sz2, sz3), hu);\n dhu(dat.subarray(bt), out.subarray(sz3), hu);\n};\n// read Zstandard block\nvar rzb = function (dat, st, out) {\n var _a;\n var bt = st.b;\n // byte 0 block type\n var b0 = dat[bt], btype = (b0 >> 1) & 3;\n st.l = b0 & 1;\n var sz = (b0 >> 3) | (dat[bt + 1] << 5) | (dat[bt + 2] << 13);\n // end byte for block\n var ebt = (bt += 3) + sz;\n if (btype == 1) {\n if (bt >= dat.length)\n return;\n st.b = bt + 1;\n if (out) {\n fill(out, dat[bt], st.y, st.y += sz);\n return out;\n }\n return fill(new u8(sz), dat[bt]);\n }\n if (ebt > dat.length)\n return;\n if (btype == 0) {\n st.b = ebt;\n if (out) {\n out.set(dat.subarray(bt, ebt), st.y);\n st.y += sz;\n return out;\n }\n return slc(dat, bt, ebt);\n }\n if (btype == 2) {\n // byte 3 lit btype size format\n var b3 = dat[bt], lbt = b3 & 3, sf = (b3 >> 2) & 3;\n // lit src size lit cmp sz 4 streams\n var lss = b3 >> 4, lcs = 0, s4 = 0;\n if (lbt < 2) {\n if (sf & 1)\n lss |= (dat[++bt] << 4) | ((sf & 2) && (dat[++bt] << 12));\n else\n lss = b3 >> 3;\n }\n else {\n s4 = sf;\n if (sf < 2)\n lss |= ((dat[++bt] & 63) << 4), lcs = (dat[bt] >> 6) | (dat[++bt] << 2);\n else if (sf == 2)\n lss |= (dat[++bt] << 4) | ((dat[++bt] & 3) << 12), lcs = (dat[bt] >> 2) | (dat[++bt] << 6);\n else\n lss |= (dat[++bt] << 4) | ((dat[++bt] & 63) << 12), lcs = (dat[bt] >> 6) | (dat[++bt] << 2) | (dat[++bt] << 10);\n }\n ++bt;\n // add literals to end - can never overlap with backreferences because unused literals always appended\n var buf = out ? out.subarray(st.y, st.y + st.m) : new u8(st.m);\n // starting point for literals\n var spl = buf.length - lss;\n if (lbt == 0)\n buf.set(dat.subarray(bt, bt += lss), spl);\n else if (lbt == 1)\n fill(buf, dat[bt++], spl);\n else {\n // huffman table\n var hu = st.h;\n if (lbt == 2) {\n var hud = rhu(dat, bt);\n // subtract description length\n lcs += bt - (bt = hud[0]);\n st.h = hu = hud[1];\n }\n else if (!hu)\n err(0);\n (s4 ? dhu4 : dhu)(dat.subarray(bt, bt += lcs), buf.subarray(spl), hu);\n }\n // num sequences\n var ns = dat[bt++];\n if (ns) {\n if (ns == 255)\n ns = (dat[bt++] | (dat[bt++] << 8)) + 0x7F00;\n else if (ns > 127)\n ns = ((ns - 128) << 8) | dat[bt++];\n // symbol compression modes\n var scm = dat[bt++];\n if (scm & 3)\n err(0);\n var dts = [dmlt, doct, dllt];\n for (var i = 2; i > -1; --i) {\n var md = (scm >> ((i << 1) + 2)) & 3;\n if (md == 1) {\n // rle buf\n var rbuf = new u8([0, 0, dat[bt++]]);\n dts[i] = {\n s: rbuf.subarray(2, 3),\n n: rbuf.subarray(0, 1),\n t: new u16(rbuf.buffer, 0, 1),\n b: 0\n };\n }\n else if (md == 2) {\n // accuracy log 8 for offsets, 9 for others\n _a = rfse(dat, bt, 9 - (i & 1)), bt = _a[0], dts[i] = _a[1];\n }\n else if (md == 3) {\n if (!st.t)\n err(0);\n dts[i] = st.t[i];\n }\n }\n var _b = st.t = dts, mlt = _b[0], oct = _b[1], llt = _b[2];\n var lb = dat[ebt - 1];\n if (!lb)\n err(0);\n var spos = (ebt << 3) - 8 + msb(lb) - llt.b, cbt = spos >> 3, oubt = 0;\n var lst = ((dat[cbt] | (dat[cbt + 1] << 8)) >> (spos & 7)) & ((1 << llt.b) - 1);\n cbt = (spos -= oct.b) >> 3;\n var ost = ((dat[cbt] | (dat[cbt + 1] << 8)) >> (spos & 7)) & ((1 << oct.b) - 1);\n cbt = (spos -= mlt.b) >> 3;\n var mst = ((dat[cbt] | (dat[cbt + 1] << 8)) >> (spos & 7)) & ((1 << mlt.b) - 1);\n for (++ns; --ns;) {\n var llc = llt.s[lst];\n var lbtr = llt.n[lst];\n var mlc = mlt.s[mst];\n var mbtr = mlt.n[mst];\n var ofc = oct.s[ost];\n var obtr = oct.n[ost];\n cbt = (spos -= ofc) >> 3;\n var ofp = 1 << ofc;\n var off = ofp + (((dat[cbt] | (dat[cbt + 1] << 8) | (dat[cbt + 2] << 16) | (dat[cbt + 3] << 24)) >>> (spos & 7)) & (ofp - 1));\n cbt = (spos -= mlb[mlc]) >> 3;\n var ml = mlbl[mlc] + (((dat[cbt] | (dat[cbt + 1] << 8) | (dat[cbt + 2] << 16)) >> (spos & 7)) & ((1 << mlb[mlc]) - 1));\n cbt = (spos -= llb[llc]) >> 3;\n var ll = llbl[llc] + (((dat[cbt] | (dat[cbt + 1] << 8) | (dat[cbt + 2] << 16)) >> (spos & 7)) & ((1 << llb[llc]) - 1));\n cbt = (spos -= lbtr) >> 3;\n lst = llt.t[lst] + (((dat[cbt] | (dat[cbt + 1] << 8)) >> (spos & 7)) & ((1 << lbtr) - 1));\n cbt = (spos -= mbtr) >> 3;\n mst = mlt.t[mst] + (((dat[cbt] | (dat[cbt + 1] << 8)) >> (spos & 7)) & ((1 << mbtr) - 1));\n cbt = (spos -= obtr) >> 3;\n ost = oct.t[ost] + (((dat[cbt] | (dat[cbt + 1] << 8)) >> (spos & 7)) & ((1 << obtr) - 1));\n if (off > 3) {\n st.o[2] = st.o[1];\n st.o[1] = st.o[0];\n st.o[0] = off -= 3;\n }\n else {\n var idx = off - (ll != 0);\n if (idx) {\n off = idx == 3 ? st.o[0] - 1 : st.o[idx];\n if (idx > 1)\n st.o[2] = st.o[1];\n st.o[1] = st.o[0];\n st.o[0] = off;\n }\n else\n off = st.o[0];\n }\n for (var i = 0; i < ll; ++i) {\n buf[oubt + i] = buf[spl + i];\n }\n oubt += ll, spl += ll;\n var stin = oubt - off;\n if (stin < 0) {\n var len = -stin;\n var bs = st.e + stin;\n if (len > ml)\n len = ml;\n for (var i = 0; i < len; ++i) {\n buf[oubt + i] = st.w[bs + i];\n }\n oubt += len, ml -= len, stin = 0;\n }\n for (var i = 0; i < ml; ++i) {\n buf[oubt + i] = buf[stin + i];\n }\n oubt += ml;\n }\n if (oubt != spl) {\n while (spl < buf.length) {\n buf[oubt++] = buf[spl++];\n }\n }\n else\n oubt = buf.length;\n if (out)\n st.y += oubt;\n else\n buf = slc(buf, 0, oubt);\n }\n else if (out) {\n st.y += lss;\n if (spl) {\n for (var i = 0; i < lss; ++i) {\n buf[i] = buf[spl + i];\n }\n }\n }\n else if (spl)\n buf = slc(buf, spl);\n st.b = ebt;\n return buf;\n }\n err(2);\n};\n// concat\nvar cct = function (bufs, ol) {\n if (bufs.length == 1)\n return bufs[0];\n var buf = new u8(ol);\n for (var i = 0, b = 0; i < bufs.length; ++i) {\n var chk = bufs[i];\n buf.set(chk, b);\n b += chk.length;\n }\n return buf;\n};\n/**\n * Decompresses Zstandard data\n * @param dat The input data\n * @param buf The output buffer. If unspecified, the function will allocate\n * exactly enough memory to fit the decompressed data. If your\n * data has multiple frames and you know the output size, specifying\n * it will yield better performance.\n * @returns The decompressed data\n */\nexport function decompress(dat, buf) {\n var bufs = [], nb = +!buf;\n var bt = 0, ol = 0;\n for (; dat.length;) {\n var st = rzfh(dat, nb || buf);\n if (typeof st == 'object') {\n if (nb) {\n buf = null;\n if (st.w.length == st.u) {\n bufs.push(buf = st.w);\n ol += st.u;\n }\n }\n else {\n bufs.push(buf);\n st.e = 0;\n }\n for (; !st.l;) {\n var blk = rzb(dat, st, buf);\n if (!blk)\n err(5);\n if (buf)\n st.e = st.y;\n else {\n bufs.push(blk);\n ol += blk.length;\n cpw(st.w, 0, blk.length);\n st.w.set(blk, st.w.length - blk.length);\n }\n }\n bt = st.b + (st.c * 4);\n }\n else\n bt = st;\n dat = dat.subarray(bt);\n }\n return cct(bufs, ol);\n}\n/**\n * Decompressor for Zstandard streamed data\n */\nvar Decompress = /*#__PURE__*/ (function () {\n /**\n * Creates a Zstandard decompressor\n * @param ondata The handler for stream data\n */\n function Decompress(ondata) {\n this.ondata = ondata;\n this.c = [];\n this.l = 0;\n this.z = 0;\n }\n /**\n * Pushes data to be decompressed\n * @param chunk The chunk of data to push\n * @param final Whether or not this is the last chunk in the stream\n */\n Decompress.prototype.push = function (chunk, final) {\n if (typeof this.s == 'number') {\n var sub = Math.min(chunk.length, this.s);\n chunk = chunk.subarray(sub);\n this.s -= sub;\n }\n var sl = chunk.length;\n var ncs = sl + this.l;\n if (!this.s) {\n if (final) {\n if (!ncs) {\n this.ondata(new u8(0), true);\n return;\n }\n // min for frame + one block\n if (ncs < 5)\n err(5);\n }\n else if (ncs < 18) {\n this.c.push(chunk);\n this.l = ncs;\n return;\n }\n if (this.l) {\n this.c.push(chunk);\n chunk = cct(this.c, ncs);\n this.c = [];\n this.l = 0;\n }\n if (typeof (this.s = rzfh(chunk)) == 'number')\n return this.push(chunk, final);\n }\n if (typeof this.s != 'number') {\n if (ncs < (this.z || 3)) {\n if (final)\n err(5);\n this.c.push(chunk);\n this.l = ncs;\n return;\n }\n if (this.l) {\n this.c.push(chunk);\n chunk = cct(this.c, ncs);\n this.c = [];\n this.l = 0;\n }\n if (!this.z && ncs < (this.z = (chunk[this.s.b] & 2) ? 4 : 3 + ((chunk[this.s.b] >> 3) | (chunk[this.s.b + 1] << 5) | (chunk[this.s.b + 2] << 13)))) {\n if (final)\n err(5);\n this.c.push(chunk);\n this.l = ncs;\n return;\n }\n else\n this.z = 0;\n for (;;) {\n var blk = rzb(chunk, this.s);\n if (!blk) {\n if (final)\n err(5);\n var adc = chunk.subarray(this.s.b);\n this.s.b = 0;\n this.c.push(adc), this.l += adc.length;\n return;\n }\n else {\n this.ondata(blk, false);\n cpw(this.s.w, 0, blk.length);\n this.s.w.set(blk, this.s.w.length - blk.length);\n }\n if (this.s.l) {\n var rest = chunk.subarray(this.s.b);\n this.s = this.s.c * 4;\n this.push(rest, final);\n return;\n }\n }\n }\n else if (final)\n err(5);\n };\n return Decompress;\n}());\nexport { Decompress };\n", "async function cpp(moduleArg={}){var Module=moduleArg;var quit_=(status,toThrow)=>{throw toThrow};var _scriptName='';var scriptDirectory=\"\";function locateFile(path){return scriptDirectory+path}var readAsync,readBinary;{}var out=console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith(\"file://\");var runtimeInitialized=false;function getMemoryBuffer(){return wasmMemory.buffer}function updateMemoryViews(){if(HEAP8?.buffer?.resizable)return;var b=getMemoryBuffer();HEAP8=new Int8Array(b);HEAP16=new Int16Array(b);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(b);HEAPU16=new Uint16Array(b);HEAP32=new Int32Array(b);HEAPU32=new Uint32Array(b);HEAPF32=new Float32Array(b);HEAPF64=new Float64Array(b);HEAP64=new BigInt64Array(b);HEAPU64=new BigUint64Array(b)}function preRun(){}function initRuntime(){runtimeInitialized=true;wasmExports[\"A\"]()}function postRun(){}function abort(what){what=`Aborted(${what})`;err(what);ABORT=true;what+=\". Build with -sASSERTIONS for more info.\";if(runtimeInitialized){___trap()}var e=new WebAssembly.RuntimeError(what);throw e}var wasmBinaryFile;const findWasmBinary=()=>\"\";function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw\"both async and sync fetching of the wasm failed\"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason)}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!isFileURI(binaryFile)){try{var response=fetch(binaryFile,{credentials:\"same-origin\"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err(\"falling back to ArrayBuffer instantiation\")}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){var imports={a:wasmImports};return imports}async function createWasm(){function receiveInstance(instance){wasmExports=instance.exports;assignWasmExports(wasmExports);updateMemoryViews();return wasmExports}function receiveInstantiationResult(result){return receiveInstance(result[\"instance\"])}var info=getWasmImports();wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name=\"ExitStatus\";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status}}var HEAP8;var getCppExceptionTag=()=>___cpp_exception;var getCppExceptionThrownObjectFromWebAssemblyException=ex=>{var unwind_header=ex.getArg(getCppExceptionTag(),0);return ___thrown_object_from_unwind_exception(unwind_header)};var stackSave=()=>_emscripten_stack_get_current();var stackRestore=val=>__emscripten_stack_restore(val);var stackAlloc=sz=>__emscripten_stack_alloc(sz);var UTF8Decoder=globalThis.TextDecoder&&new TextDecoder;var findStringEnd=(heapOrArray,idx,maxBytesToRead,ignoreNul)=>{var maxIdx=idx+maxBytesToRead;if(ignoreNul)return maxIdx;while(heapOrArray[idx]&&!(idx>=maxIdx))++idx;return idx};var UTF8ArrayToString=(heapOrArray,idx=0,maxBytesToRead,ignoreNul)=>{var endPtr=findStringEnd(heapOrArray,idx,maxBytesToRead,ignoreNul);if(endPtr-idx>16&&heapOrArray.buffer&&UTF8Decoder){return UTF8Decoder.decode(heapOrArray.subarray(idx,endPtr))}var str=\"\";while(idx>10,56320|ch&1023)}}return str};var HEAPU8;var UTF8ToString=(ptr,maxBytesToRead,ignoreNul)=>ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead,ignoreNul):\"\";var HEAPU32;var getExceptionMessageCommon=ptr=>{var sp=stackSave();var type_addr_addr=stackAlloc(4);var message_addr_addr=stackAlloc(4);___get_exception_message(ptr,type_addr_addr,message_addr_addr);var type_addr=HEAPU32[type_addr_addr>>2];var message_addr=HEAPU32[message_addr_addr>>2];var type=UTF8ToString(type_addr);_free(type_addr);var message;if(message_addr){message=UTF8ToString(message_addr);_free(message_addr)}stackRestore(sp);return[type,message]};var getExceptionMessage=ex=>{var ptr=getCppExceptionThrownObjectFromWebAssemblyException(ex);return getExceptionMessageCommon(ptr)};var ___throw_exception_with_stack_trace=ex=>{var e=new WebAssembly.Exception(getCppExceptionTag(),[ex],{traceStack:true});e.message=getExceptionMessage(e);throw e};var __abort_js=()=>abort(\"\");var structRegistrations={};var runDestructors=destructors=>{while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}};function readPointer(pointer){return this.fromWireType(HEAPU32[pointer>>2])}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};class InternalError extends Error{constructor(message){super(message);this.name=\"InternalError\"}}var throwInternalError=message=>{throw new InternalError(message)};var whenDependentTypesAreResolved=(myTypes,dependentTypes,getTypeConverters)=>{myTypes.forEach(type=>typeDependencies[type]=dependentTypes);function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError(\"Mismatched type converter count\")}for(var i=0;i{typeConverters[i]=registeredTypes[dt];++registered;if(registered===unregisteredTypes.length){onComplete(typeConverters)}})}}if(0===unregisteredTypes.length){onComplete(typeConverters)}};var __embind_finalize_value_object=structType=>{var reg=structRegistrations[structType];delete structRegistrations[structType];var rawConstructor=reg.rawConstructor;var rawDestructor=reg.rawDestructor;var fieldRecords=reg.fields;var fieldTypes=fieldRecords.map(field=>field.getterReturnType).concat(fieldRecords.map(field=>field.setterArgumentType));whenDependentTypesAreResolved([structType],fieldTypes,fieldTypes=>{var fields={};for(var[i,field]of fieldRecords.entries()){const getterReturnType=fieldTypes[i];const getter=field.getter;const getterContext=field.getterContext;const setterArgumentType=fieldTypes[i+fieldRecords.length];const setter=field.setter;const setterContext=field.setterContext;fields[field.fieldName]={read:ptr=>getterReturnType.fromWireType(getter(getterContext,ptr)),write:(ptr,o)=>{var destructors=[];setter(setterContext,ptr,setterArgumentType.toWireType(destructors,o));runDestructors(destructors)},optional:getterReturnType.optional}}return[{name:reg.name,fromWireType:ptr=>{var rv={};for(var i in fields){rv[i]=fields[i].read(ptr)}rawDestructor(ptr);return rv},toWireType:(destructors,o)=>{for(var fieldName in fields){if(!(fieldName in o)&&!fields[fieldName].optional){throw new TypeError(`Missing field: \"${fieldName}\"`)}}var ptr=rawConstructor();for(fieldName in fields){fields[fieldName].write(ptr,o[fieldName])}if(destructors!==null){destructors.push(rawDestructor,ptr)}return ptr},readValueFromPointer:readPointer,destructorFunction:rawDestructor}]})};var AsciiToString=ptr=>{var str=\"\";while(1){var ch=HEAPU8[ptr++];if(!ch)return str;str+=String.fromCharCode(ch)}};class BindingError extends Error{constructor(message){super(message);this.name=\"BindingError\"}}var throwBindingError=message=>{throw new BindingError(message)};function sharedRegisterType(rawType,registeredInstance,options={}){var name=registeredInstance.name;if(!rawType){throwBindingError(`type \"${name}\" must have a positive integer typeid pointer`)}if(registeredTypes.hasOwnProperty(rawType)){if(options.ignoreDuplicateRegistrations){return}else{throwBindingError(`Cannot register type '${name}' twice`)}}registeredTypes[rawType]=registeredInstance;delete typeDependencies[rawType];if(awaitingDependencies.hasOwnProperty(rawType)){var callbacks=awaitingDependencies[rawType];delete awaitingDependencies[rawType];callbacks.forEach(cb=>cb())}}function registerType(rawType,registeredInstance,options={}){return sharedRegisterType(rawType,registeredInstance,options)}var HEAP16;var HEAPU16;var HEAP32;var HEAP64;var HEAPU64;var integerReadValueFromPointer=(name,width,signed)=>{switch(width){case 1:return signed?pointer=>HEAP8[pointer]:pointer=>HEAPU8[pointer];case 2:return signed?pointer=>HEAP16[pointer>>1]:pointer=>HEAPU16[pointer>>1];case 4:return signed?pointer=>HEAP32[pointer>>2]:pointer=>HEAPU32[pointer>>2];case 8:return signed?pointer=>HEAP64[pointer>>3]:pointer=>HEAPU64[pointer>>3];default:throw new TypeError(`invalid integer width (${width}): ${name}`)}};var __embind_register_bigint=(primitiveType,name,size,minRange,maxRange)=>{name=AsciiToString(name);const isUnsignedType=minRange===0n;let fromWireType=value=>value;if(isUnsignedType){const bitSize=size*8;fromWireType=value=>BigInt.asUintN(bitSize,value);maxRange=fromWireType(maxRange)}registerType(primitiveType,{name,fromWireType,toWireType:(destructors,value)=>{if(typeof value==\"number\"){value=BigInt(value)}return value},readValueFromPointer:integerReadValueFromPointer(name,size,!isUnsignedType),destructorFunction:null})};var __embind_register_bool=(rawType,name,trueValue,falseValue)=>{name=AsciiToString(name);registerType(rawType,{name,fromWireType:function(wt){return!!wt},toWireType:function(destructors,o){return o?trueValue:falseValue},readValueFromPointer:function(pointer){return this.fromWireType(HEAPU8[pointer])},destructorFunction:null})};var shallowCopyInternalPointer=o=>({count:o.count,deleteScheduled:o.deleteScheduled,preservePointerOnDelete:o.preservePointerOnDelete,ptr:o.ptr,ptrType:o.ptrType,smartPtr:o.smartPtr,smartPtrType:o.smartPtrType});var throwInstanceAlreadyDeleted=obj=>{function getInstanceTypeName(handle){return handle.$$.ptrType.registeredClass.name}throwBindingError(getInstanceTypeName(obj)+\" instance already deleted\")};var finalizationRegistry=false;var detachFinalizer=handle=>{};var runDestructor=$$=>{if($$.smartPtr){$$.smartPtrType.rawDestructor($$.smartPtr)}else{$$.ptrType.registeredClass.rawDestructor($$.ptr)}};var releaseClassHandle=$$=>{$$.count.value-=1;var toDelete=0===$$.count.value;if(toDelete){runDestructor($$)}};var attachFinalizer=handle=>{if(!globalThis.FinalizationRegistry){attachFinalizer=handle=>handle;return handle}finalizationRegistry=new FinalizationRegistry(info=>{releaseClassHandle(info.$$)});attachFinalizer=handle=>{var $$=handle.$$;var hasSmartPtr=!!$$.smartPtr;if(hasSmartPtr){var info={$$};finalizationRegistry.register(handle,info,handle)}return handle};detachFinalizer=handle=>finalizationRegistry.unregister(handle);return attachFinalizer(handle)};var deletionQueue=[];var flushPendingDeletes=()=>{while(deletionQueue.length){var obj=deletionQueue.pop();obj.$$.deleteScheduled=false;obj[\"delete\"]()}};var delayFunction;var init_ClassHandle=()=>{let proto=ClassHandle.prototype;Object.assign(proto,{isAliasOf(other){if(!(this instanceof ClassHandle)){return false}if(!(other instanceof ClassHandle)){return false}var leftClass=this.$$.ptrType.registeredClass;var left=this.$$.ptr;other.$$=other.$$;var rightClass=other.$$.ptrType.registeredClass;var right=other.$$.ptr;while(leftClass.baseClass){left=leftClass.upcast(left);leftClass=leftClass.baseClass}while(rightClass.baseClass){right=rightClass.upcast(right);rightClass=rightClass.baseClass}return leftClass===rightClass&&left===right},clone(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.preservePointerOnDelete){this.$$.count.value+=1;return this}else{var clone=attachFinalizer(Object.create(Object.getPrototypeOf(this),{$$:{value:shallowCopyInternalPointer(this.$$)}}));clone.$$.count.value+=1;clone.$$.deleteScheduled=false;return clone}},delete(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError(\"Object already scheduled for deletion\")}detachFinalizer(this);releaseClassHandle(this.$$);if(!this.$$.preservePointerOnDelete){this.$$.smartPtr=undefined;this.$$.ptr=undefined}},isDeleted(){return!this.$$.ptr},deleteLater(){if(!this.$$.ptr){throwInstanceAlreadyDeleted(this)}if(this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete){throwBindingError(\"Object already scheduled for deletion\")}deletionQueue.push(this);if(deletionQueue.length===1&&delayFunction){delayFunction(flushPendingDeletes)}this.$$.deleteScheduled=true;return this}});const symbolDispose=Symbol.dispose;if(symbolDispose){proto[symbolDispose]=proto[\"delete\"]}};function ClassHandle(){}var createNamedFunction=(name,func)=>Object.defineProperty(func,\"name\",{value:name});var registeredPointers={};var ensureOverloadTable=(proto,methodName,humanName)=>{if(undefined===proto[methodName].overloadTable){var prevFunc=proto[methodName];proto[methodName]=function(...args){if(!proto[methodName].overloadTable.hasOwnProperty(args.length)){throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${args.length}) - expects one of (${proto[methodName].overloadTable})!`)}return proto[methodName].overloadTable[args.length].apply(this,args)};proto[methodName].overloadTable=[];proto[methodName].overloadTable[prevFunc.argCount]=prevFunc}};var exposePublicSymbol=(name,value,numArguments)=>{if(Module.hasOwnProperty(name)){if(undefined===numArguments||undefined!==Module[name].overloadTable&&undefined!==Module[name].overloadTable[numArguments]){throwBindingError(`Cannot register public name '${name}' twice`)}ensureOverloadTable(Module,name,name);if(Module[name].overloadTable.hasOwnProperty(numArguments)){throwBindingError(`Cannot register multiple overloads of a function with the same number of arguments (${numArguments})!`)}Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var char_0=48;var char_9=57;var makeLegalFunctionName=name=>{name=name.replace(/[^a-zA-Z0-9_]/g,\"$\");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return`_${name}`}return name};function RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast){this.name=name;this.constructor=constructor;this.instancePrototype=instancePrototype;this.rawDestructor=rawDestructor;this.baseClass=baseClass;this.getActualType=getActualType;this.upcast=upcast;this.downcast=downcast;this.pureVirtualFunctions=[]}var upcastPointer=(ptr,ptrClass,desiredClass)=>{while(ptrClass!==desiredClass){if(!ptrClass.upcast){throwBindingError(`Expected null or instance of ${desiredClass.name}, got an instance of ${ptrClass.name}`)}ptr=ptrClass.upcast(ptr);ptrClass=ptrClass.baseClass}return ptr};var embindRepr=v=>{if(v===null){return\"null\"}var t=typeof v;if(t===\"object\"||t===\"array\"||t===\"function\"){return v.toString()}else{return\"\"+v}};function constNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError(`null is not a valid ${this.name}`)}return 0}if(!handle.$$){throwBindingError(`Cannot pass \"${embindRepr(handle)}\" as a ${this.name}`)}if(!handle.$$.ptr){throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}function genericPointerToWireType(destructors,handle){var ptr;if(handle===null){if(this.isReference){throwBindingError(`null is not a valid ${this.name}`)}if(this.isSmartPointer){ptr=this.rawConstructor();if(destructors!==null){destructors.push(this.rawDestructor,ptr)}return ptr}else{return 0}}if(!handle||!handle.$$){throwBindingError(`Cannot pass \"${embindRepr(handle)}\" as a ${this.name}`)}if(!handle.$$.ptr){throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`)}if(!this.isConst&&handle.$$.ptrType.isConst){throwBindingError(`Cannot convert argument of type ${handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name} to parameter type ${this.name}`)}var handleClass=handle.$$.ptrType.registeredClass;ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);if(this.isSmartPointer){if(undefined===handle.$$.smartPtr){throwBindingError(\"Passing raw pointer to smart pointer is illegal\")}switch(this.sharingPolicy){case 0:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{throwBindingError(`Cannot convert argument of type ${handle.$$.smartPtrType?handle.$$.smartPtrType.name:handle.$$.ptrType.name} to parameter type ${this.name}`)}break;case 1:ptr=handle.$$.smartPtr;break;case 2:if(handle.$$.smartPtrType===this){ptr=handle.$$.smartPtr}else{var clonedHandle=handle[\"clone\"]();ptr=this.rawShare(ptr,Emval.toHandle(()=>clonedHandle[\"delete\"]()));if(destructors!==null){destructors.push(this.rawDestructor,ptr)}}break;default:throwBindingError(\"Unsupported sharing policy\")}}return ptr}function nonConstNoSmartPtrRawPointerToWireType(destructors,handle){if(handle===null){if(this.isReference){throwBindingError(`null is not a valid ${this.name}`)}return 0}if(!handle.$$){throwBindingError(`Cannot pass \"${embindRepr(handle)}\" as a ${this.name}`)}if(!handle.$$.ptr){throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`)}if(handle.$$.ptrType.isConst){throwBindingError(`Cannot convert argument of type ${handle.$$.ptrType.name} to parameter type ${this.name}`)}var handleClass=handle.$$.ptrType.registeredClass;var ptr=upcastPointer(handle.$$.ptr,handleClass,this.registeredClass);return ptr}var downcastPointer=(ptr,ptrClass,desiredClass)=>{if(ptrClass===desiredClass){return ptr}if(undefined===desiredClass.baseClass){return null}var rv=downcastPointer(ptr,ptrClass,desiredClass.baseClass);if(rv===null){return null}return desiredClass.downcast(rv)};var registeredInstances={};var getBasestPointer=(class_,ptr)=>{if(ptr===undefined){throwBindingError(\"ptr should not be undefined\")}while(class_.baseClass){ptr=class_.upcast(ptr);class_=class_.baseClass}return ptr};var getInheritedInstance=(class_,ptr)=>{ptr=getBasestPointer(class_,ptr);return registeredInstances[ptr]};var makeClassHandle=(prototype,record)=>{if(!record.ptrType||!record.ptr){throwInternalError(\"makeClassHandle requires ptr and ptrType\")}var hasSmartPtrType=!!record.smartPtrType;var hasSmartPtr=!!record.smartPtr;if(hasSmartPtrType!==hasSmartPtr){throwInternalError(\"Both smartPtrType and smartPtr must be specified\")}record.count={value:1};return attachFinalizer(Object.create(prototype,{$$:{value:record,writable:true}}))};function RegisteredPointer_fromWireType(ptr){var rawPointer=this.getPointee(ptr);if(!rawPointer){this.destructor(ptr);return null}var registeredInstance=getInheritedInstance(this.registeredClass,rawPointer);if(undefined!==registeredInstance){if(0===registeredInstance.$$.count.value){registeredInstance.$$.ptr=rawPointer;registeredInstance.$$.smartPtr=ptr;return registeredInstance[\"clone\"]()}else{var rv=registeredInstance[\"clone\"]();this.destructor(ptr);return rv}}function makeDefaultHandle(){if(this.isSmartPointer){return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:rawPointer,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(this.registeredClass.instancePrototype,{ptrType:this,ptr})}}var actualType=this.registeredClass.getActualType(rawPointer);var registeredPointerRecord=registeredPointers[actualType];if(!registeredPointerRecord){return makeDefaultHandle.call(this)}var toType;if(this.isConst){toType=registeredPointerRecord.constPointerType}else{toType=registeredPointerRecord.pointerType}var dp=downcastPointer(rawPointer,this.registeredClass,toType.registeredClass);if(dp===null){return makeDefaultHandle.call(this)}if(this.isSmartPointer){return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp,smartPtrType:this,smartPtr:ptr})}else{return makeClassHandle(toType.registeredClass.instancePrototype,{ptrType:toType,ptr:dp})}}var init_RegisteredPointer=()=>{Object.assign(RegisteredPointer.prototype,{getPointee(ptr){if(this.rawGetPointee){ptr=this.rawGetPointee(ptr)}return ptr},destructor(ptr){this.rawDestructor?.(ptr)},readValueFromPointer:readPointer,fromWireType:RegisteredPointer_fromWireType})};function RegisteredPointer(name,registeredClass,isReference,isConst,isSmartPointer,pointeeType,sharingPolicy,rawGetPointee,rawConstructor,rawShare,rawDestructor){this.name=name;this.registeredClass=registeredClass;this.isReference=isReference;this.isConst=isConst;this.isSmartPointer=isSmartPointer;this.pointeeType=pointeeType;this.sharingPolicy=sharingPolicy;this.rawGetPointee=rawGetPointee;this.rawConstructor=rawConstructor;this.rawShare=rawShare;this.rawDestructor=rawDestructor;if(!isSmartPointer&®isteredClass.baseClass===undefined){if(isConst){this.toWireType=constNoSmartPtrRawPointerToWireType;this.destructorFunction=null}else{this.toWireType=nonConstNoSmartPtrRawPointerToWireType;this.destructorFunction=null}}else{this.toWireType=genericPointerToWireType}}var replacePublicSymbol=(name,value,numArguments)=>{if(!Module.hasOwnProperty(name)){throwInternalError(\"Replacing nonexistent public symbol\")}if(undefined!==Module[name].overloadTable&&undefined!==numArguments){Module[name].overloadTable[numArguments]=value}else{Module[name]=value;Module[name].argCount=numArguments}};var getWasmTableEntry=funcPtr=>wasmTable.get(funcPtr);var embind__requireFunction=(signature,rawFunction,isAsync=false)=>{signature=AsciiToString(signature);function makeDynCaller(){var rtn=getWasmTableEntry(rawFunction);return rtn}var fp=makeDynCaller();if(typeof fp!=\"function\"){throwBindingError(`unknown function pointer with signature ${signature}: ${rawFunction}`)}return fp};class UnboundTypeError extends Error{}var getTypeName=type=>{var ptr=___getTypeName(type);var rv=AsciiToString(ptr);_free(ptr);return rv};var throwUnboundTypeError=(message,types)=>{var unboundTypes=[];var seen={};function visit(type){if(seen[type]){return}if(registeredTypes[type]){return}if(typeDependencies[type]){typeDependencies[type].forEach(visit);return}unboundTypes.push(type);seen[type]=true}types.forEach(visit);throw new UnboundTypeError(`${message}: `+unboundTypes.map(getTypeName).join([\", \"]))};var __embind_register_class=(rawType,rawPointerType,rawConstPointerType,baseClassRawType,getActualTypeSignature,getActualType,upcastSignature,upcast,downcastSignature,downcast,name,destructorSignature,rawDestructor)=>{name=AsciiToString(name);getActualType=embind__requireFunction(getActualTypeSignature,getActualType);upcast&&=embind__requireFunction(upcastSignature,upcast);downcast&&=embind__requireFunction(downcastSignature,downcast);rawDestructor=embind__requireFunction(destructorSignature,rawDestructor);var legalFunctionName=makeLegalFunctionName(name);exposePublicSymbol(legalFunctionName,function(){throwUnboundTypeError(`Cannot construct ${name} due to unbound types`,[baseClassRawType])});whenDependentTypesAreResolved([rawType,rawPointerType,rawConstPointerType],baseClassRawType?[baseClassRawType]:[],base=>{base=base[0];var baseClass;var basePrototype;if(baseClassRawType){baseClass=base.registeredClass;basePrototype=baseClass.instancePrototype}else{basePrototype=ClassHandle.prototype}var constructor=createNamedFunction(name,function(...args){if(Object.getPrototypeOf(this)!==instancePrototype){throw new BindingError(`Use 'new' to construct ${name}`)}if(undefined===registeredClass.constructor_body){throw new BindingError(`${name} has no accessible constructor`)}var body=registeredClass.constructor_body[args.length];if(undefined===body){throw new BindingError(`Tried to invoke ctor of ${name} with invalid number of parameters (${args.length}) - expected (${Object.keys(registeredClass.constructor_body).toString()}) parameters instead!`)}return body.apply(this,args)});var instancePrototype=Object.create(basePrototype,{constructor:{value:constructor}});constructor.prototype=instancePrototype;var registeredClass=new RegisteredClass(name,constructor,instancePrototype,rawDestructor,baseClass,getActualType,upcast,downcast);if(registeredClass.baseClass){registeredClass.baseClass.__derivedClasses??=[];registeredClass.baseClass.__derivedClasses.push(registeredClass)}var referenceConverter=new RegisteredPointer(name,registeredClass,true,false,false);var pointerConverter=new RegisteredPointer(name+\"*\",registeredClass,false,false,false);var constPointerConverter=new RegisteredPointer(name+\" const*\",registeredClass,false,true,false);registeredPointers[rawType]={pointerType:pointerConverter,constPointerType:constPointerConverter};replacePublicSymbol(legalFunctionName,constructor);return[referenceConverter,pointerConverter,constPointerConverter]})};function usesDestructorStack(argTypes){for(var i=1;i{var array=[];for(var i=0;i>2])}return array};var getFunctionName=signature=>{signature=signature.trim();const argsIndex=signature.indexOf(\"(\");if(argsIndex===-1)return signature;return signature.slice(0,argsIndex)};var __embind_register_class_class_function=(rawClassType,methodName,argCount,rawArgTypesAddr,invokerSignature,rawInvoker,fn,isAsync,isNonnullReturn)=>{var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);methodName=AsciiToString(methodName);methodName=getFunctionName(methodName);rawInvoker=embind__requireFunction(invokerSignature,rawInvoker,isAsync);whenDependentTypesAreResolved([],[rawClassType],classType=>{classType=classType[0];var humanName=`${classType.name}.${methodName}`;function unboundTypesHandler(){throwUnboundTypeError(`Cannot call ${humanName} due to unbound types`,rawArgTypes)}if(methodName.startsWith(\"@@\")){methodName=Symbol[methodName.substring(2)]}var proto=classType.registeredClass.constructor;if(undefined===proto[methodName]){unboundTypesHandler.argCount=argCount-1;proto[methodName]=unboundTypesHandler}else{ensureOverloadTable(proto,methodName,humanName);proto[methodName].overloadTable[argCount-1]=unboundTypesHandler}whenDependentTypesAreResolved([],rawArgTypes,argTypes=>{var invokerArgsArray=[argTypes[0],null].concat(argTypes.slice(1));var func=craftInvokerFunction(humanName,invokerArgsArray,null,rawInvoker,fn,isAsync);if(undefined===proto[methodName].overloadTable){func.argCount=argCount-1;proto[methodName]=func}else{proto[methodName].overloadTable[argCount-1]=func}if(classType.registeredClass.__derivedClasses){for(const derivedClass of classType.registeredClass.__derivedClasses){if(!derivedClass.constructor.hasOwnProperty(methodName)){derivedClass.constructor[methodName]=func}}}return[]});return[]})};var __embind_register_class_constructor=(rawClassType,argCount,rawArgTypesAddr,invokerSignature,invoker,rawConstructor)=>{var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=embind__requireFunction(invokerSignature,invoker);whenDependentTypesAreResolved([],[rawClassType],classType=>{classType=classType[0];var humanName=`constructor ${classType.name}`;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError(`Cannot register multiple constructors with identical number of parameters (${argCount-1}) for class '${classType.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`)}classType.registeredClass.constructor_body[argCount-1]=()=>{throwUnboundTypeError(`Cannot construct ${classType.name} due to unbound types`,rawArgTypes)};whenDependentTypesAreResolved([],rawArgTypes,argTypes=>{argTypes.splice(1,0,null);classType.registeredClass.constructor_body[argCount-1]=craftInvokerFunction(humanName,argTypes,null,invoker,rawConstructor);return[]});return[]})};var __embind_register_class_function=(rawClassType,methodName,argCount,rawArgTypesAddr,invokerSignature,rawInvoker,context,isPureVirtual,isAsync,isNonnullReturn)=>{var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);methodName=AsciiToString(methodName);methodName=getFunctionName(methodName);rawInvoker=embind__requireFunction(invokerSignature,rawInvoker,isAsync);whenDependentTypesAreResolved([],[rawClassType],classType=>{classType=classType[0];var humanName=`${classType.name}.${methodName}`;if(methodName.startsWith(\"@@\")){methodName=Symbol[methodName.substring(2)]}if(isPureVirtual){classType.registeredClass.pureVirtualFunctions.push(methodName)}function unboundTypesHandler(){throwUnboundTypeError(`Cannot call ${humanName} due to unbound types`,rawArgTypes)}var proto=classType.registeredClass.instancePrototype;var method=proto[methodName];if(undefined===method||undefined===method.overloadTable&&method.className!==classType.name&&method.argCount===argCount-2){unboundTypesHandler.argCount=argCount-2;unboundTypesHandler.className=classType.name;proto[methodName]=unboundTypesHandler}else{ensureOverloadTable(proto,methodName,humanName);proto[methodName].overloadTable[argCount-2]=unboundTypesHandler}whenDependentTypesAreResolved([],rawArgTypes,argTypes=>{var memberFunction=craftInvokerFunction(humanName,argTypes,classType,rawInvoker,context,isAsync);if(undefined===proto[methodName].overloadTable){memberFunction.argCount=argCount-2;proto[methodName]=memberFunction}else{proto[methodName].overloadTable[argCount-2]=memberFunction}return[]});return[]})};var emval_freelist=[];var emval_handles=[0,1,,1,null,1,true,1,false,1];var emval_exception_decrefs=[];var __emval_decref=handle=>{if(handle>9&&0===--emval_handles[handle+1]){var value=emval_handles[handle];emval_handles[handle]=undefined;var destructor=emval_exception_decrefs[handle];if(destructor){emval_exception_decrefs[handle]=undefined;destructor(value)}emval_freelist.push(handle)}};var Emval={toValue:handle=>{if(!handle){throwBindingError(`Cannot use deleted val. handle = ${handle}`)}return emval_handles[handle]},toHandle:value=>{switch(value){case undefined:return 2;case null:return 4;case true:return 6;case false:return 8;default:{const handle=emval_freelist.pop()||emval_handles.length;emval_handles[handle]=value;emval_handles[handle+1]=1;return handle}}}};var EmValType={name:\"emscripten::val\",fromWireType:handle=>{var rv=Emval.toValue(handle);__emval_decref(handle);return rv},toWireType:(destructors,value)=>Emval.toHandle(value),readValueFromPointer:readPointer,destructorFunction:null};var __embind_register_emval=rawType=>registerType(rawType,EmValType);var HEAPF32;var HEAPF64;var floatReadValueFromPointer=(name,width)=>{switch(width){case 4:return function(pointer){return this.fromWireType(HEAPF32[pointer>>2])};case 8:return function(pointer){return this.fromWireType(HEAPF64[pointer>>3])};default:throw new TypeError(`invalid float width (${width}): ${name}`)}};var __embind_register_float=(rawType,name,size)=>{name=AsciiToString(name);registerType(rawType,{name,fromWireType:value=>value,toWireType:(destructors,value)=>value,readValueFromPointer:floatReadValueFromPointer(name,size),destructorFunction:null})};var __embind_register_integer=(primitiveType,name,size,minRange,maxRange)=>{name=AsciiToString(name);const isUnsignedType=minRange===0;let fromWireType=value=>value;if(isUnsignedType){var bitshift=32-8*size;fromWireType=value=>value<>>bitshift;maxRange=fromWireType(maxRange)}registerType(primitiveType,{name,fromWireType,toWireType:(destructors,value)=>value,readValueFromPointer:integerReadValueFromPointer(name,size,minRange!==0),destructorFunction:null})};var __embind_register_memory_view=(rawType,dataTypeIndex,name)=>{var typeMapping=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array];var TA=typeMapping[dataTypeIndex];function decodeMemoryView(handle){var size=HEAPU32[handle>>2];var data=HEAPU32[handle+4>>2];return new TA(HEAP8.buffer,data,size)}name=AsciiToString(name);registerType(rawType,{name,fromWireType:decodeMemoryView,readValueFromPointer:decodeMemoryView},{ignoreDuplicateRegistrations:true})};var stringToUTF8Array=(str,heap,outIdx,maxBytesToWrite)=>{if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=endIdx)break;heap[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;heap[outIdx++]=192|u>>6;heap[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;heap[outIdx++]=224|u>>12;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;heap[outIdx++]=240|u>>18;heap[outIdx++]=128|u>>12&63;heap[outIdx++]=128|u>>6&63;heap[outIdx++]=128|u&63;i++}}heap[outIdx]=0;return outIdx-startIdx};var stringToUTF8=(str,outPtr,maxBytesToWrite)=>stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite);var lengthBytesUTF8=str=>{var len=0;for(var i=0;i=55296&&c<=57343){len+=4;++i}else{len+=3}}return len};var __embind_register_std_string=(rawType,name)=>{name=AsciiToString(name);var stdStringIsUTF8=true;registerType(rawType,{name,fromWireType(value){var length=HEAPU32[value>>2];var payload=value+4;var str;if(stdStringIsUTF8){str=UTF8ToString(payload,length,true)}else{str=\"\";for(var i=0;i>2]=length;if(valueIsOfTypeString){if(stdStringIsUTF8){stringToUTF8(value,ptr,length+1)}else{for(var i=0;i255){_free(base);throwBindingError(\"String has UTF-16 code units that do not fit in 8 bits\")}HEAPU8[ptr+i]=charCode}}}else{HEAPU8.set(value,ptr)}if(destructors!==null){destructors.push(_free,base)}return base},readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var UTF16Decoder=globalThis.TextDecoder?new TextDecoder(\"utf-16le\"):undefined;var UTF16ToString=(ptr,maxBytesToRead,ignoreNul)=>{var idx=ptr>>1;var endIdx=findStringEnd(HEAPU16,idx,maxBytesToRead/2,ignoreNul);if(endIdx-idx>16&&UTF16Decoder)return UTF16Decoder.decode(HEAPU16.subarray(idx,endIdx));var str=\"\";for(var i=idx;i{if(maxBytesToWrite<2)return 0;maxBytesToWrite-=2;var startPtr=outPtr;var numCharsToWrite=maxBytesToWrite>1]=codeUnit;outPtr+=2}HEAP16[outPtr>>1]=0;return outPtr-startPtr};var lengthBytesUTF16=str=>str.length*2;var UTF32ToString=(ptr,maxBytesToRead,ignoreNul)=>{var str=\"\";var startIdx=ptr>>2;for(var i=0;!(i>=maxBytesToRead/4);i++){var utf32=HEAPU32[startIdx+i];if(!utf32&&!ignoreNul)break;str+=String.fromCodePoint(utf32)}return str};var stringToUTF32=(str,outPtr,maxBytesToWrite=2147483647)=>{if(maxBytesToWrite<4)return 0;var startPtr=outPtr;var endPtr=startPtr+maxBytesToWrite-4;for(var i=0;i65535){i++}HEAP32[outPtr>>2]=codePoint;outPtr+=4;if(outPtr+4>endPtr)break}HEAP32[outPtr>>2]=0;return outPtr-startPtr};var lengthBytesUTF32=str=>{var len=0;for(var i=0;i65535){i++}len+=4}return len};var __embind_register_std_wstring=(rawType,charSize,name)=>{name=AsciiToString(name);var decodeString,encodeString,lengthBytesUTF;if(charSize===2){decodeString=UTF16ToString;encodeString=stringToUTF16;lengthBytesUTF=lengthBytesUTF16}else{decodeString=UTF32ToString;encodeString=stringToUTF32;lengthBytesUTF=lengthBytesUTF32}registerType(rawType,{name,fromWireType:value=>{var length=HEAPU32[value>>2];var str=decodeString(value+4,length*charSize,true);_free(value);return str},toWireType:(destructors,value)=>{if(!(typeof value==\"string\")){throwBindingError(`Cannot pass non-string to C++ string type ${name}`)}var length=lengthBytesUTF(value);var ptr=_malloc(4+length+charSize);HEAPU32[ptr>>2]=length/charSize;encodeString(value,ptr+4,length+charSize);if(destructors!==null){destructors.push(_free,ptr)}return ptr},readValueFromPointer:readPointer,destructorFunction(ptr){_free(ptr)}})};var __embind_register_value_object=(rawType,name,constructorSignature,rawConstructor,destructorSignature,rawDestructor)=>{structRegistrations[rawType]={name:AsciiToString(name),rawConstructor:embind__requireFunction(constructorSignature,rawConstructor),rawDestructor:embind__requireFunction(destructorSignature,rawDestructor),fields:[]}};var __embind_register_value_object_field=(structType,fieldName,getterReturnType,getterSignature,getter,getterContext,setterArgumentType,setterSignature,setter,setterContext)=>{structRegistrations[structType].fields.push({fieldName:AsciiToString(fieldName),getterReturnType,getter:embind__requireFunction(getterSignature,getter),getterContext,setterArgumentType,setter:embind__requireFunction(setterSignature,setter),setterContext})};var __embind_register_void=(rawType,name)=>{name=AsciiToString(name);registerType(rawType,{isVoid:true,name,fromWireType:()=>undefined,toWireType:(destructors,o)=>undefined})};var runtimeKeepaliveCounter=0;var __emscripten_runtime_keepalive_clear=()=>{runtimeKeepaliveCounter=0};var timers={};var handleException=e=>{if(e instanceof ExitStatus||e==\"unwind\"){return EXITSTATUS}quit_(1,e)};var keepRuntimeAlive=()=>true;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){ABORT=true}quit_(code,new ExitStatus(code))};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status)};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS)}catch(e){handleException(e)}}};var callUserCallback=func=>{if(ABORT){return}try{return func()}catch(e){handleException(e)}finally{maybeExit()}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which]}if(!timeout_ms)return 0;var id=setTimeout(()=>{delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()))},timeout_ms);timers[which]={id,timeout_ms};return 0};var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var _fd_close=fd=>52;var INT53_MAX=9007199254740992;var INT53_MIN=-9007199254740992;var bigintToI53Checked=num=>numINT53_MAX?NaN:Number(num);function _fd_seek(fd,offset,whence,newOffset){offset=bigintToI53Checked(offset);return 70}var printCharBuffers=[null,[],[]];var printChar=(stream,curr)=>{var buffer=printCharBuffers[stream];if(!curr||curr===10){(stream===1?out:err)(UTF8ArrayToString(buffer));buffer.length=0}else{buffer.push(curr)}};var _fd_write=(fd,iov,iovcnt,pnum)=>{var num=0;for(var i=0;i>2];var len=HEAPU32[iov+4>>2];iov+=8;for(var j=0;j>2]=num;return 0};init_ClassHandle();init_RegisteredPointer();{if(Module[\"wasmBinary\"])wasmBinary=Module[\"wasmBinary\"]}Module[\"UTF8ToString\"]=UTF8ToString;Module[\"stringToUTF8\"]=stringToUTF8;Module[\"lengthBytesUTF8\"]=lengthBytesUTF8;var ___getTypeName,_malloc,_free,__emscripten_timeout,___trap,__emscripten_stack_restore,__emscripten_stack_alloc,_emscripten_stack_get_current,___thrown_object_from_unwind_exception,___get_exception_message,memory,__indirect_function_table,___cpp_exception,wasmMemory,wasmTable;function assignWasmExports(wasmExports){___getTypeName=wasmExports[\"B\"];_malloc=Module[\"_malloc\"]=wasmExports[\"C\"];_free=Module[\"_free\"]=wasmExports[\"D\"];__emscripten_timeout=wasmExports[\"F\"];___trap=wasmExports[\"G\"];__emscripten_stack_restore=wasmExports[\"H\"];__emscripten_stack_alloc=wasmExports[\"I\"];_emscripten_stack_get_current=wasmExports[\"J\"];___thrown_object_from_unwind_exception=wasmExports[\"K\"];___get_exception_message=wasmExports[\"L\"];memory=wasmMemory=wasmExports[\"z\"];__indirect_function_table=wasmTable=wasmExports[\"E\"];___cpp_exception=wasmExports[\"M\"]}var wasmImports={t:___throw_exception_with_stack_trace,x:__abort_js,f:__embind_finalize_value_object,i:__embind_register_bigint,l:__embind_register_bool,o:__embind_register_class,b:__embind_register_class_class_function,n:__embind_register_class_constructor,d:__embind_register_class_function,y:__embind_register_emval,h:__embind_register_float,c:__embind_register_integer,a:__embind_register_memory_view,k:__embind_register_std_string,g:__embind_register_std_wstring,j:__embind_register_value_object,e:__embind_register_value_object_field,m:__embind_register_void,w:__emscripten_runtime_keepalive_clear,p:__setitimer_js,u:_emscripten_resize_heap,s:_fd_close,q:_fd_seek,r:_fd_write,v:_proc_exit};async function run(){preRun();if(ABORT)return;initRuntime();postRun()}var wasmExports;wasmExports=await createWasm();await run();\n;return Module}export default cpp;\n", "import { decompress } from \"fzstd\";\nimport wrapper from \"/home/runner/work/hpcc-js-wasm/hpcc-js-wasm/build/packages/zstd/zstdlib.js\";\n\nconst D = new Int8Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,90,63,64,65,66,-1,67,68,69,70,71,-1,72,73,52,53,54,55,56,57,58,59,60,61,74,75,76,77,78,79,80,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,81,-1,82,83,84,85,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,86,87,88,89,-1]);\n\nfunction decode(s: string): Uint8Array {\n const out = new Uint8Array(170930);\n let pos = 0, b = 0, n = 0, v = -1;\n\n for (let i = 0, len = s.length; i < len; i++) {\n const c = s.charCodeAt(i);\n if (c > 127) continue;\n const p = D[c];\n if (p < 0) continue;\n if (v < 0) {\n v = p;\n } else {\n v += p * 91;\n b |= v << n;\n n += (v & 8191) > 88 ? 13 : 14;\n do {\n out[pos++] = b;\n b >>>= 8;\n n -= 8;\n } while (n > 7);\n v = -1;\n }\n }\n\n if (v >= 0) out[pos++] = (b | v << n) & 0xff;\n\n return out;\n}\n\nconst blobStr = 'v7#a#A&ip?h=9a``^J`)5x\"o{!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&~51V6Ia!Qehp.lPh5(=yW8)>D6T:QEC)^0$wAWJk]UCI(;}V:m.Gto#12ZBwR$I.H,.8ECc48Z[/[Da`$Yt{h4!r=.s%)R\"e?TBOc)9&d~7)\"j1IO8:3EF_bkJUBPsO2jGGS]EqxSdEKlFrbov[r/G68D@ALz,4(W^=KK1j@;Sc:g>kg8TxaE%oc03IqD%RRS!@?#r^A4Q3wuR&0JML_79}=HK?F6fm@7WG;/.9Dhb}iI%W%s@k[fHzr{qZT}Bhj<7IMxVM|DrZ6s+bmngI/vC|;k2WcVQoNTB0JSLA;YoL1Fa1M0I0>QV0Py5/|t5L(.8ONW|!8p?_@I$K1A7@k@trkVX]Rer8H=6isTg#QU_R<<=_;(gx%?}8c3kvyC)#AgFLdkL9T!h+o*5b9Bf%/2B:&&k|ka/r/1;Ke:OL3RJdm5VMOXQ+aU:i~Nz=a:.oo$_TG~jh|JxuX:Aw$]pd?n.*bX~;NEsa{}puiP3ro\"FhGxbKqYQ!k!SUJHwgot6j(WI?_NRu0lnqD?okE^0$Cjif,~uTMxfpxpaP>w6s4jouXRT`KfVb29VP}OMnvN5Wq0zX&p1y~yGA4;&Hs;d>9!q:VSbLA9ljDPI=x:t0%]&==kE\"GwTlPzV@ID[_0#mV:EsGQ:|Kf8Qtg^BZi=[eV:C1o8I}#:I?of+|?XZa?+#c\"l[}=pth=?^[.WUCEh+qIWE5B';\n\nlet g_wasmBinary: Uint8Array | undefined;\nexport default function() {\n g_wasmBinary ??= decompress(decode(blobStr));\n return wrapper({\n wasmBinary: g_wasmBinary,\n locateFile: () => \"\"\n });\n\n}\n\nexport function reset() {\n g_wasmBinary = undefined;\n}", "import type { MainModule } from \"../../../build/packages/util/utillib.js\";\n\ninterface RuntimeFSExports {\n FS_createPath: (parent: any, path: any, canRead: any, canWrite: any) => void;\n FS_createDataFile: (parent: any, name: any, fileData: any, canRead: any, canWrite: any, canOwn: any) => void;\n FS_preloadFile: (parent: any, name: any, url: any, canRead: any, canWrite: any, dontCreateFile: any, canOwn: any, preFinish: any) => Promise;\n FS_unlink: (path: any) => any;\n addRunDependency: (id: any) => void;\n removeRunDependency: (id: any) => void;\n}\n\nexport type PTR = number;\n\nexport interface HeapU8 {\n ptr: PTR;\n size: number;\n dispose(): void;\n}\n\nexport class MainModuleEx {\n\n protected _module: T & RuntimeFSExports;\n\n constructor(mainModule: T) {\n this._module = mainModule as T & RuntimeFSExports;\n }\n\n malloc(size: number): HeapU8 {\n const ptr: PTR = this._module._malloc(size) as PTR;\n return {\n ptr,\n size,\n dispose: () => this.free({ ptr, size, dispose: () => { } })\n };\n }\n\n free(data: HeapU8) {\n this._module._free(data.ptr);\n }\n\n dataToHeap(data: Uint8Array): HeapU8 {\n const retVal = this.malloc(data.byteLength);\n (this._module.HEAPU8 as Uint8Array).set(data, retVal.ptr);\n return retVal;\n }\n\n heapView(data: HeapU8): Uint8Array {\n return (this._module.HEAPU8 as Uint8Array).subarray(data.ptr, data.ptr + data.size);\n }\n\n heapToUint8Array(data: HeapU8): Uint8Array {\n return new Uint8Array([...this.heapView(data)]);\n }\n\n lengthBytes(str: string): number {\n return this._module.lengthBytesUTF8(str);\n }\n\n stringToHeap(str: string): HeapU8 {\n const size = this.lengthBytes(str) + 1;\n const ptr = this._module._malloc(size);\n this._module.stringToUTF8(str, ptr, size);\n return {\n ptr,\n size,\n dispose: () => this.free({ ptr, size, dispose: () => { } })\n };\n }\n\n heapToString(data: HeapU8): string {\n return this._module.UTF8ToString(data.ptr, data.size);\n }\n\n hasFilesystem(): boolean {\n const moduleAny = this._module as any;\n return moduleAny.FS_createPath !== undefined &&\n moduleAny.FS_createDataFile !== undefined &&\n moduleAny.FS_preloadFile !== undefined &&\n moduleAny.FS_unlink !== undefined;\n }\n\n createPath(path: string, canRead = true, canWrite = true) {\n return this._module.FS_createPath(\"/\", path, canRead, canWrite);\n }\n\n createDataFile(path: string, data: Uint8Array, canRead = true, canWrite = true, canOwn = true) {\n return this._module.FS_createDataFile(\"/\", path, data, canRead, canWrite, canOwn);\n }\n\n preloadFile(path: string, data: Uint8Array, canRead = true, canWrite = true, dontCreateFile = false, canOwn = true, preFinish = false) {\n return this._module.FS_preloadFile(\"/\", path, data, canRead, canWrite, dontCreateFile, canOwn, preFinish);\n }\n\n unlink(path: string) {\n return this._module.FS_unlink(path);\n }\n\n}\n", "// @ts-expect-error importing from a wasm file is resolved via a custom esbuild plugin\nimport load, { reset } from \"../../../build/packages/zstd/zstdlib.wasm\";\nimport type { MainModule, zstd, StreamResult, FrameContentSizeResult } from \"../types/zstdlib.js\";\nimport { MainModuleEx, type HeapU8 } from \"@hpcc-js/wasm-util\";\n\ntype ZstdExports = MainModule[\"zstd\"];\n\n// Ref: http://facebook.github.io/zstd/zstd_manual.html\n// Ref: https://github.com/facebook/zstd\n\nlet g_zstd: Promise | undefined;\n\nconst WASM32_MAX = 0xffffffff;\n\nfunction assertSafeLength(length: number, label: string): void {\n if (!Number.isInteger(length) || length < 0 || length > WASM32_MAX) {\n throw new Error(`${label} length ${length} is outside the WASM32-safe range`);\n }\n}\n\nfunction concatUint8Arrays(chunks: Uint8Array[]): Uint8Array {\n if (chunks.length === 0) {\n return new Uint8Array(0);\n }\n if (chunks.length === 1) {\n return chunks[0];\n }\n let total = 0;\n for (const chunk of chunks) {\n total += chunk.length;\n }\n const out = new Uint8Array(total);\n let offset = 0;\n for (const chunk of chunks) {\n out.set(chunk, offset);\n offset += chunk.length;\n }\n return out;\n}\n\n/**\n * The Zstandard WASM library, provides a simplified wrapper around the Zstandard c++ library.\n * \n * See [Zstandard](https://facebook.github.io/zstd/) for more details.\n * \n * ```ts\n * import { Zstd } from \"@hpcc-js/wasm-zstd\";\n * \n * const zstd = await Zstd.load();\n * \n * // Generate some \"data\"\n * const data = new Uint8Array(Array.from({ length: 100000 }, (_, i) => i % 256));\n * \n * const compressed_data = zstd.compress(data);\n * const decompressed_data = zstd.decompress(compressed_data);\n * ```\n *\n * ::: warning\n * `Zstd.load()` returns a process-wide singleton. Streaming compression and decompression\n * mutate shared codec state and must be serialized by the caller. Do not interleave\n * concurrent streaming operations on the same instance.\n * :::\n */\nexport class Zstd {\n\n private _mainModule: MainModuleEx;\n private _zstdClass: ZstdExports;\n private _zstd: zstd;\n private _compressionLevel: number;\n private _decompressFrameCompleted = false;\n private _decompressRemaining = 0;\n private _decompressSawInput = false;\n\n private constructor(_module: MainModule) {\n this._mainModule = new MainModuleEx(_module);\n this._zstdClass = _module.zstd;\n this._zstd = new this._zstdClass();\n this._compressionLevel = this._zstdClass.defaultCLevel();\n }\n\n /**\n * Compiles and instantiates the raw wasm.\n * \n * ::: info\n * In general WebAssembly compilation is disallowed on the main thread if the buffer size is larger than 4KB, hence forcing `load` to be asynchronous;\n * :::\n * \n * @returns A promise to an instance of the Zstd class.\n */\n static load(): Promise {\n if (!g_zstd) {\n g_zstd = load().then((module: MainModule) => new Zstd(module));\n }\n return g_zstd!;\n }\n\n /**\n * Unloades the compiled wasm instance.\n */\n static unload() {\n reset();\n g_zstd?.then(zstd => {\n zstd?._zstd?.delete();\n });\n g_zstd = undefined;\n }\n\n private copyHeap(data: HeapU8): Uint8Array {\n return this._mainModule.heapView(data).slice();\n }\n\n private mallocChecked(size: number, label: string): HeapU8 {\n assertSafeLength(size, label);\n const heap = this._mainModule.malloc(size);\n if (!heap.ptr) {\n this._mainModule.free(heap);\n throw new Error(`Failed to allocate ${size} bytes for ${label}`);\n }\n return heap;\n }\n\n private throwStreamError(operation: string, result: StreamResult): never {\n throw new Error(`${operation} failed: ${result.errorName || \"unknown error\"}`);\n }\n\n private ensureStreamOk(operation: string, result: StreamResult): void {\n if (result.error) {\n this.throwStreamError(operation, result);\n }\n }\n\n /**\n * @returns The Zstd c++ version\n */\n version(): string {\n return this._zstdClass.version();\n }\n\n /**\n * Resets both compression and decompression state (legacy API).\n * Prefer {@link resetCompression} / {@link resetDecompression} so the two\n * contexts are not reset accidentally together.\n */\n reset(): void {\n const result = this._zstd.reset();\n this.ensureStreamOk(\"reset\", result);\n this._decompressFrameCompleted = false;\n this._decompressRemaining = 0;\n this._decompressSawInput = false;\n }\n\n /**\n * Resets compression state and optionally sets the compression level.\n * @param compressionLevel When omitted, the current level is kept.\n */\n resetCompression(compressionLevel?: number): void {\n if (compressionLevel !== undefined) {\n this._compressionLevel = compressionLevel;\n }\n const result = this._zstd.resetCompression(this._compressionLevel);\n this.ensureStreamOk(\"resetCompression\", result);\n }\n\n /**\n * Resets decompression state before a new streaming decode.\n */\n resetDecompression(): void {\n const result = this._zstd.resetDecompression();\n this.ensureStreamOk(\"resetDecompression\", result);\n this._decompressFrameCompleted = false;\n this._decompressRemaining = 0;\n this._decompressSawInput = false;\n }\n\n /**\n * Sets the compression level for streaming compression.\n * @param level Compression level (use minCLevel() to maxCLevel())\n */\n setCompressionLevel(level: number): void {\n const result = this._zstd.setCompressionLevel(level);\n this.ensureStreamOk(\"setCompressionLevel\", result);\n this._compressionLevel = level;\n }\n\n /**\n * @param data Data to be compressed\n * @param compressionLevel Compression v Speed tradeoff, when omitted it will default to `zstd.defaultCLevel()` which is currently 3.\n * @returns Compressed data.\n *\n * :::tip\n * A note on compressionLevel: The library supports regular compression levels from 1 up o 22. Levels >= 20, should be used with caution, as they require more memory. The library also offers negative compression levels, which extend the range of speed vs. ratio preferences. The lower the level, the faster the speed (at the cost of compression).\n * :::\n */\n compress(data: Uint8Array, compressionLevel: number = this.defaultCLevel()): Uint8Array {\n assertSafeLength(data.length, \"compress input\");\n const uncompressed = this._mainModule.dataToHeap(data);\n try {\n if (!uncompressed.ptr && data.length > 0) {\n throw new Error(\"Failed to allocate compress input buffer\");\n }\n\n const compressedSize = this._zstdClass.compressBound(data.length);\n const compressed = this.mallocChecked(compressedSize, \"compress output\");\n try {\n compressed.size = this._zstdClass.compress(compressed.ptr, compressedSize, uncompressed.ptr, uncompressed.size, compressionLevel);\n if (this._zstdClass.isError(compressed.size)) {\n throw new Error(`compress failed: ${this._zstdClass.getErrorName(compressed.size)}`);\n }\n return this.copyHeap(compressed);\n } finally {\n this._mainModule.free(compressed);\n }\n } finally {\n this._mainModule.free(uncompressed);\n }\n }\n\n /**\n * Compresses a chunk of data in streaming mode.\n * Call {@link resetCompression} before the first chunk, then {@link compressChunk} for each chunk, and finally {@link compressEnd}.\n * Intermediate calls may return an empty array when Zstandard buffers input.\n * @param data Chunk of data to be compressed\n * @returns Compressed chunk data produced for this input (may be empty)\n */\n compressChunk(data: Uint8Array): Uint8Array {\n assertSafeLength(data.length, \"compressChunk input\");\n if (data.length === 0) {\n return new Uint8Array(0);\n }\n\n const uncompressed = this._mainModule.dataToHeap(data);\n try {\n if (!uncompressed.ptr) {\n throw new Error(\"Failed to allocate compressChunk input buffer\");\n }\n\n const outCapacity = this._zstdClass.CStreamOutSize();\n const chunks: Uint8Array[] = [];\n let offset = 0;\n\n while (offset < data.length) {\n const compressed = this.mallocChecked(outCapacity, \"compressChunk output\");\n try {\n const result = this._zstd.compressChunk(\n compressed.ptr,\n outCapacity,\n uncompressed.ptr + offset,\n data.length - offset\n );\n this.ensureStreamOk(\"compressChunk\", result);\n if (result.consumed === 0 && result.produced === 0) {\n throw new Error(\"compressChunk failed: no progress while consuming input\");\n }\n offset += result.consumed;\n if (result.produced > 0) {\n compressed.size = result.produced;\n chunks.push(this.copyHeap(compressed));\n }\n } finally {\n this._mainModule.free(compressed);\n }\n }\n\n return concatUint8Arrays(chunks);\n } finally {\n this._mainModule.free(uncompressed);\n }\n }\n\n /**\n * Finishes the streaming compression and returns any remaining compressed data.\n * @returns Final compressed data\n */\n compressEnd(): Uint8Array {\n const outCapacity = this._zstdClass.CStreamOutSize();\n const chunks: Uint8Array[] = [];\n let remaining = 1;\n\n while (remaining !== 0) {\n const compressed = this.mallocChecked(outCapacity, \"compressEnd output\");\n try {\n const result = this._zstd.compressEnd(compressed.ptr, outCapacity);\n this.ensureStreamOk(\"compressEnd\", result);\n if (result.produced === 0 && result.remaining !== 0) {\n throw new Error(\"compressEnd failed: no progress while finishing stream\");\n }\n remaining = result.remaining;\n if (result.produced > 0) {\n compressed.size = result.produced;\n chunks.push(this.copyHeap(compressed));\n }\n } finally {\n this._mainModule.free(compressed);\n }\n }\n\n return concatUint8Arrays(chunks);\n }\n\n private frameContentSize(compressed: HeapU8): FrameContentSizeResult {\n return this._zstdClass.getFrameContentSize(compressed.ptr, compressed.size);\n }\n\n /**\n * @param compressedData Data to be decompressed\n * @returns Uncompressed data.\n */\n decompress(compressedData: Uint8Array): Uint8Array {\n assertSafeLength(compressedData.length, \"decompress input\");\n const compressed = this._mainModule.dataToHeap(compressedData);\n try {\n if (!compressed.ptr && compressedData.length > 0) {\n throw new Error(\"Failed to allocate decompress input buffer\");\n }\n\n const sizeInfo = this.frameContentSize(compressed);\n if (sizeInfo.error) {\n throw new Error(`Failed to get frame content size: ${sizeInfo.errorName}`);\n }\n\n let useFastPath = sizeInfo.known;\n if (useFastPath) {\n // ZSTD_decompress only handles one frame. Known-size concatenated\n // frames would allocate only for the first frame and overflow.\n const frameCompressedSize = this._zstdClass.findFrameCompressedSize(compressed.ptr, compressed.size);\n if (this._zstdClass.isError(frameCompressedSize)) {\n throw new Error(`Failed to find frame compressed size: ${this._zstdClass.getErrorName(frameCompressedSize)}`);\n }\n if (frameCompressedSize < compressed.size) {\n useFastPath = false;\n }\n }\n\n if (useFastPath) {\n const uncompressed = this.mallocChecked(sizeInfo.size, \"decompress output\");\n try {\n uncompressed.size = this._zstdClass.decompress(\n uncompressed.ptr,\n sizeInfo.size,\n compressed.ptr,\n compressed.size\n );\n if (this._zstdClass.isError(uncompressed.size)) {\n throw new Error(`decompress failed: ${this._zstdClass.getErrorName(uncompressed.size)}`);\n }\n return this.copyHeap(uncompressed);\n } finally {\n this._mainModule.free(uncompressed);\n }\n }\n } finally {\n this._mainModule.free(compressed);\n }\n\n return this.decompressViaStreaming(compressedData);\n }\n\n private decompressViaStreaming(compressedData: Uint8Array): Uint8Array {\n this.resetDecompression();\n const produced = this.decompressChunk(compressedData);\n this.decompressEnd();\n return produced;\n }\n\n /**\n * Decompresses a chunk of data in streaming mode.\n * Call {@link resetDecompression} before the first chunk, then {@link decompressChunk} for each chunk, and finally {@link decompressEnd}.\n * Intermediate calls may return an empty array. Callers must not guess an output size.\n * @param compressedData Chunk of compressed data\n * @returns Decompressed chunk data produced for this input (may be empty)\n */\n decompressChunk(compressedData: Uint8Array): Uint8Array {\n assertSafeLength(compressedData.length, \"decompressChunk input\");\n if (compressedData.length === 0) {\n return new Uint8Array(0);\n }\n\n this._decompressSawInput = true;\n const compressed = this._mainModule.dataToHeap(compressedData);\n try {\n if (!compressed.ptr) {\n throw new Error(\"Failed to allocate decompressChunk input buffer\");\n }\n\n const outCapacity = this._zstdClass.DStreamOutSize();\n const chunks: Uint8Array[] = [];\n let offset = 0;\n let outputFilled = false;\n\n // Continue while input remains, or the previous step filled the output buffer\n // (pending decoder output may still need an empty-input flush).\n while (offset < compressedData.length || outputFilled) {\n const uncompressed = this.mallocChecked(outCapacity, \"decompressChunk output\");\n try {\n const srcSize = offset < compressedData.length\n ? compressedData.length - offset\n : 0;\n const srcPtr = srcSize > 0\n ? compressed.ptr + offset\n : 0;\n const result = this._zstd.decompressChunk(\n uncompressed.ptr,\n outCapacity,\n srcPtr,\n srcSize\n );\n this.ensureStreamOk(\"decompressChunk\", result);\n\n if (result.consumed === 0 && result.produced === 0) {\n if (srcSize === 0) {\n if (result.remaining > 0) {\n // Need more compressed input \u2014 wait for the next chunk.\n this._decompressRemaining = result.remaining;\n }\n // remaining === 0: fully flushed, or waiting for input above.\n break;\n }\n throw new Error(\"decompressChunk failed: no progress while consuming input\");\n }\n\n offset += result.consumed;\n // Only flush with empty input while the current frame still has pending output.\n // When remaining === 0 the frame is complete (even if the buffer filled exactly);\n // a follow-up empty call can return a non-zero hint and must not look like truncation.\n outputFilled = result.produced === outCapacity && result.remaining !== 0;\n\n if (result.produced > 0) {\n uncompressed.size = result.produced;\n chunks.push(this.copyHeap(uncompressed));\n }\n if (result.remaining === 0) {\n this._decompressFrameCompleted = true;\n this._decompressRemaining = 0;\n } else {\n this._decompressRemaining = result.remaining;\n }\n } finally {\n this._mainModule.free(uncompressed);\n }\n }\n\n return concatUint8Arrays(chunks);\n } finally {\n this._mainModule.free(compressed);\n }\n }\n\n /**\n * Verifies that streaming decompression completed a full frame and was not truncated.\n * Empty intermediate output is not treated as completion; call this after the final chunk.\n */\n decompressEnd(): void {\n if (!this._decompressSawInput) {\n throw new Error(\"decompressEnd failed: empty compressed input is not a completed frame\");\n }\n if (!this._decompressFrameCompleted || this._decompressRemaining !== 0) {\n throw new Error(\"decompressEnd failed: truncated Zstandard input\");\n }\n }\n\n /**\n * @returns Default compression level (see notes above above).\n */\n defaultCLevel(): number {\n return this._zstdClass.defaultCLevel();\n }\n\n minCLevel(): number {\n return this._zstdClass.minCLevel();\n }\n\n maxCLevel(): number {\n return this._zstdClass.maxCLevel();\n }\n}\n"], + "mappings": "AAEA,IAAIA,GAAK,YAAaC,EAAK,WAAYC,GAAM,YAAaC,GAAM,WAAhE,IAA+FC,GAAM,WACjGC,GAAM,SAAUC,EAAGC,EAAGC,EAAG,CACzB,GAAIC,EAAG,UAAU,MACb,OAAOA,EAAG,UAAU,MAAM,KAAKH,EAAGC,EAAGC,CAAC,GACtCD,GAAK,MAAQA,EAAI,KACjBA,EAAI,IACJC,GAAK,MAAQA,EAAIF,EAAE,UACnBE,EAAIF,EAAE,QACV,IAAII,EAAI,IAAID,EAAGD,EAAID,CAAC,EACpB,OAAAG,EAAE,IAAIJ,EAAE,SAASC,EAAGC,CAAC,CAAC,EACfE,CACX,EACIC,GAAO,SAAUL,EAAGI,EAAG,EAAGF,EAAG,CAC7B,GAAIC,EAAG,UAAU,KACb,OAAOA,EAAG,UAAU,KAAK,KAAKH,EAAGI,EAAG,EAAGF,CAAC,EAK5C,KAJI,GAAK,MAAQ,EAAI,KACjB,EAAI,IACJA,GAAK,MAAQA,EAAIF,EAAE,UACnBE,EAAIF,EAAE,QACH,EAAIE,EAAG,EAAE,EACZF,EAAE,CAAC,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AuB,GAE5B,KAAK,qBAAuBA,EAAO,SAE3C,QAAE,CACE,KAAK,YAAY,KAAKG,CAAY,CACtC,CACJ,CAEA,OAAOrB,GAAkBC,CAAM,CACnC,QAAE,CACE,KAAK,YAAY,KAAKsB,CAAU,CACpC,CACJ,CAMA,eAAsB,CAClB,GAAI,CAAC,KAAK,oBACN,MAAM,IAAI,MAAM,uEAAuE,EAE3F,GAAI,CAAC,KAAK,2BAA6B,KAAK,uBAAyB,EACjE,MAAM,IAAI,MAAM,iDAAiD,CAEzE,CAKA,eAAwB,CACpB,OAAO,KAAK,WAAW,cAAc,CACzC,CAEA,WAAoB,CAChB,OAAO,KAAK,WAAW,UAAU,CACrC,CAEA,WAAoB,CAChB,OAAO,KAAK,WAAW,UAAU,CACrC,CACJ", + "names": ["ab", "u8", "u16", "i16", "i32", "slc", "v", "s", "e", "u8", "n", "fill", "cpw", "t", "ec", "err", "ind", "msg", "nt", "e", "rb", "d", "b", "n", "i", "o", "b4", "rzfh", "dat", "w", "n3", "flg", "ss", "cc", "df", "fcf", "bt", "db", "di", "fsb", "fss", "ws", "wb", "buf", "u8", "i32", "msb", "val", "bits", "rfse", "mal", "tpos", "al", "sz", "probs", "sym", "re", "ht", "ab", "freq", "i16", "dstate", "u16", "nstate", "bb1", "syms", "nbits", "cbt", "msk", "msk1fb", "msv", "sval", "rbt", "sympos", "sstep", "smask", "s", "sf", "ns", "nb", "rhu", "wc", "hb", "hw", "rc", "ri", "_a", "ebt", "fdt", "epos", "lb", "st1", "st2", "btr1", "btr2", "fpos", "byte", "wes", "wt", "mb", "ts", "rem", "hbuf", "pv", "fill", "code", "dllt", "dmlt", "doct", "b2bl", "len", "bl", "llb", "llbl", "mlb", "mlbl", "dhu", "out", "hu", "eb", "st", "btr", "pos", "dhu4", "sz1", "sz2", "sz3", "rzb", "b0", "btype", "slc", "b3", "lbt", "lss", "lcs", "s4", "spl", "hud", "scm", "dts", "md", "rbuf", "_b", "mlt", "oct", "llt", "spos", "oubt", "lst", "ost", "mst", "llc", "lbtr", "mlc", "mbtr", "ofc", "obtr", "ofp", "off", "ml", "ll", "idx", "stin", "bs", "cct", "bufs", "ol", "chk", "decompress", "blk", "cpw", "cpp", "moduleArg", "Module", "quit_", "status", "toThrow", "_scriptName", "scriptDirectory", "locateFile", "path", "readAsync", "readBinary", "out", "err", "wasmBinary", "ABORT", "EXITSTATUS", "isFileURI", "filename", "runtimeInitialized", "getMemoryBuffer", "wasmMemory", "updateMemoryViews", "HEAP8", "b", "HEAP16", "HEAPU8", "HEAPU16", "HEAP32", "HEAPU32", "HEAPF32", "HEAPF64", "HEAP64", "HEAPU64", "preRun", "initRuntime", "wasmExports", "postRun", "abort", "what", "___trap", "wasmBinaryFile", "findWasmBinary", "getBinarySync", "file", "getWasmBinary", "binaryFile", "response", "instantiateArrayBuffer", "imports", "binary", "instance", "reason", "instantiateAsync", "instantiationResult", "getWasmImports", "wasmImports", "createWasm", "receiveInstance", "assignWasmExports", "receiveInstantiationResult", "result", "info", "exports", "ExitStatus", "getCppExceptionTag", "___cpp_exception", "getCppExceptionThrownObjectFromWebAssemblyException", "ex", "unwind_header", "___thrown_object_from_unwind_exception", "stackSave", "_emscripten_stack_get_current", "stackRestore", "val", "__emscripten_stack_restore", "stackAlloc", "sz", "__emscripten_stack_alloc", "UTF8Decoder", "findStringEnd", "heapOrArray", "idx", "maxBytesToRead", "ignoreNul", "maxIdx", "UTF8ArrayToString", "endPtr", "str", "u0", "u1", "u2", "ch", "UTF8ToString", "ptr", "getExceptionMessageCommon", "sp", "type_addr_addr", "message_addr_addr", "___get_exception_message", "type_addr", "message_addr", "type", "_free", "message", "getExceptionMessage", "___throw_exception_with_stack_trace", "__abort_js", "structRegistrations", "runDestructors", "destructors", "del", "readPointer", "pointer", "awaitingDependencies", "registeredTypes", "typeDependencies", "InternalError", "throwInternalError", "whenDependentTypesAreResolved", "myTypes", "dependentTypes", "getTypeConverters", "onComplete", "typeConverters", "myTypeConverters", "i", "registerType", "unregisteredTypes", "registered", "dt", "__embind_finalize_value_object", "structType", "reg", "rawConstructor", "rawDestructor", "fieldRecords", "fieldTypes", "field", "fields", "getterReturnType", "getter", "getterContext", "setterArgumentType", "setter", "setterContext", "o", "rv", "fieldName", "AsciiToString", "BindingError", "throwBindingError", "sharedRegisterType", "rawType", "registeredInstance", "options", "name", "callbacks", "cb", "integerReadValueFromPointer", "width", "signed", "__embind_register_bigint", "primitiveType", "size", "minRange", "maxRange", "isUnsignedType", "fromWireType", "value", "bitSize", "__embind_register_bool", "trueValue", "falseValue", "wt", "shallowCopyInternalPointer", "throwInstanceAlreadyDeleted", "obj", "getInstanceTypeName", "handle", "finalizationRegistry", "detachFinalizer", "runDestructor", "$$", "releaseClassHandle", "toDelete", "attachFinalizer", "hasSmartPtr", "deletionQueue", "flushPendingDeletes", "delayFunction", "init_ClassHandle", "proto", "ClassHandle", "other", "leftClass", "left", "rightClass", "right", "clone", "symbolDispose", "createNamedFunction", "func", "registeredPointers", "ensureOverloadTable", "methodName", "humanName", "prevFunc", "args", "exposePublicSymbol", "numArguments", "char_0", "char_9", "makeLegalFunctionName", "f", "RegisteredClass", "constructor", "instancePrototype", "baseClass", "getActualType", "upcast", "downcast", "upcastPointer", "ptrClass", "desiredClass", "embindRepr", "v", "t", "constNoSmartPtrRawPointerToWireType", "handleClass", "genericPointerToWireType", "clonedHandle", "Emval", "nonConstNoSmartPtrRawPointerToWireType", "downcastPointer", "registeredInstances", "getBasestPointer", "class_", "getInheritedInstance", "makeClassHandle", "prototype", "record", "hasSmartPtrType", "RegisteredPointer_fromWireType", "rawPointer", "makeDefaultHandle", "actualType", "registeredPointerRecord", "toType", "dp", "init_RegisteredPointer", "RegisteredPointer", "registeredClass", "isReference", "isConst", "isSmartPointer", "pointeeType", "sharingPolicy", "rawGetPointee", "rawShare", "replacePublicSymbol", "getWasmTableEntry", "funcPtr", "wasmTable", "embind__requireFunction", "signature", "rawFunction", "isAsync", "makeDynCaller", "rtn", "fp", "UnboundTypeError", "getTypeName", "___getTypeName", "throwUnboundTypeError", "types", "unboundTypes", "seen", "visit", "__embind_register_class", "rawPointerType", "rawConstPointerType", "baseClassRawType", "getActualTypeSignature", "upcastSignature", "downcastSignature", "destructorSignature", "legalFunctionName", "base", "basePrototype", "body", "referenceConverter", "pointerConverter", "constPointerConverter", "usesDestructorStack", "argTypes", "craftInvokerFunction", "classType", "cppInvokerFunc", "cppTargetFunc", "argCount", "isClassMethodFunc", "needsDestructorStack", "returns", "expectedArgCount", "argsWired", "invokerFuncArgs", "invokerFn", "thisWired", "onDone", "param", "heap32VectorToArray", "count", "firstElement", "array", "getFunctionName", "argsIndex", "__embind_register_class_class_function", "rawClassType", "rawArgTypesAddr", "invokerSignature", "rawInvoker", "fn", "isNonnullReturn", "rawArgTypes", "unboundTypesHandler", "invokerArgsArray", "derivedClass", "__embind_register_class_constructor", "invoker", "__embind_register_class_function", "context", "isPureVirtual", "method", "memberFunction", "emval_freelist", "emval_handles", "emval_exception_decrefs", "__emval_decref", "destructor", "EmValType", "__embind_register_emval", "floatReadValueFromPointer", "__embind_register_float", "__embind_register_integer", "bitshift", "__embind_register_memory_view", "dataTypeIndex", "typeMapping", "TA", "decodeMemoryView", "data", "stringToUTF8Array", "heap", "outIdx", "maxBytesToWrite", "startIdx", "endIdx", "u", "stringToUTF8", "outPtr", "lengthBytesUTF8", "len", "c", "__embind_register_std_string", "stdStringIsUTF8", "length", "payload", "valueIsOfTypeString", "_malloc", "charCode", "UTF16Decoder", "UTF16ToString", "codeUnit", "stringToUTF16", "startPtr", "numCharsToWrite", "lengthBytesUTF16", "UTF32ToString", "utf32", "stringToUTF32", "codePoint", "lengthBytesUTF32", "__embind_register_std_wstring", "charSize", "decodeString", "encodeString", "lengthBytesUTF", "__embind_register_value_object", "constructorSignature", "__embind_register_value_object_field", "getterSignature", "setterSignature", "__embind_register_void", "runtimeKeepaliveCounter", "__emscripten_runtime_keepalive_clear", "timers", "handleException", "e", "keepRuntimeAlive", "_proc_exit", "code", "exitJS", "implicit", "_exit", "maybeExit", "callUserCallback", "_emscripten_get_now", "__setitimer_js", "which", "timeout_ms", "id", "__emscripten_timeout", "getHeapMax", "alignMemory", "alignment", "growMemory", "oldHeapSize", "pages", "_emscripten_resize_heap", "requestedSize", "oldSize", "maxHeapSize", "cutDown", "overGrownHeapSize", "newSize", "replacement", "_fd_close", "fd", "INT53_MAX", "INT53_MIN", "bigintToI53Checked", "num", "_fd_seek", "offset", "whence", "newOffset", "printCharBuffers", "printChar", "stream", "curr", "buffer", "_fd_write", "iov", "iovcnt", "pnum", "j", "memory", "__indirect_function_table", "run", "zstdlib_default", "D", "decode", "s", "out", "pos", "b", "n", "v", "i", "len", "c", "p", "blobStr", "g_wasmBinary", "zstdlib_default", "decompress", "reset", "MainModuleEx", "mainModule", "size", "ptr", "data", "retVal", "str", "moduleAny", "path", "canRead", "canWrite", "canOwn", "dontCreateFile", "preFinish", "g_zstd", "WASM32_MAX", "assertSafeLength", "length", "label", "concatUint8Arrays", "chunks", "total", "chunk", "out", "offset", "Zstd", "_Zstd", "_module", "i", "zstdlib_default", "module", "reset", "zstd", "data", "size", "heap", "operation", "result", "compressionLevel", "level", "uncompressed", "compressedSize", "compressed", "outCapacity", "remaining", "compressedData", "sizeInfo", "useFastPath", "frameCompressedSize", "produced", "outputFilled", "srcSize", "srcPtr"] +} diff --git a/node_modules/@hpcc-js/wasm-zstd/package.json b/node_modules/@hpcc-js/wasm-zstd/package.json new file mode 100644 index 0000000..bdd05f3 --- /dev/null +++ b/node_modules/@hpcc-js/wasm-zstd/package.json @@ -0,0 +1,65 @@ +{ + "name": "@hpcc-js/wasm-zstd", + "version": "1.16.0", + "description": "hpcc-js - WASM zstd", + "type": "module", + "exports": { + ".": { + "types": "./types/index.d.ts", + "default": "./dist/index.js" + } + }, + "main": "./dist/index.js", + "types": "./types/index.d.ts", + "publishConfig": { + "access": "public" + }, + "files": [ + "dist/**/*", + "src/**/*", + "types/**/*" + ], + "scripts": { + "clean": "rimraf coverage dist dist-test types .nyc_output", + "build-cpp": "cmake --build ../../build --target zstdlib", + "build-cpp-watch": "chokidar 'src-cpp/**.*' -c 'npm run build-cpp'", + "gen-types": "tsc --project tsconfig.json --emitDeclarationOnly", + "gen-types-watch": "npm run gen-types -- --watch", + "bundle": "node esbuild.js", + "bundle-dev": "npm run bundle -- --development", + "bundle-watch": "npm run bundle-dev -- --watch", + "build-dev": "run-p gen-types bundle-dev", + "build": "run-p gen-types bundle", + "lint-skypack": "npx -y @skypack/package-check", + "lint-eslint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\"", + "lint": "run-p lint-eslint", + "test-browser": "vitest run --project browser", + "test-node": "vitest run --project node", + "test": "vitest run", + "coverage": "vitest run --coverage", + "update": "npx -y npm-check-updates -u -t minor", + "update-major": "npx -y npm-check-updates -u" + }, + "dependencies": {}, + "devDependencies": { + "@hpcc-js/esbuild-plugins": "1.12.0", + "@hpcc-js/wasm-util": "1.0.0" + }, + "keywords": [ + "graphviz", + "typescript", + "webassembly", + "wasm", + "dot", + "neato", + "twopi" + ], + "author": "hpcc-systems", + "repository": { + "type": "git", + "url": "git+https://github.com/hpcc-systems/hpcc-js-wasm.git" + }, + "homepage": "https://hpcc-systems.github.io/hpcc-js-wasm/", + "license": "Apache-2.0", + "gitHead": "8f570c863d34cb7d08aa7bc54f48558f9bd3bcba" +} diff --git a/node_modules/@hpcc-js/wasm-zstd/src/__package__.ts b/node_modules/@hpcc-js/wasm-zstd/src/__package__.ts new file mode 100644 index 0000000..fd92823 --- /dev/null +++ b/node_modules/@hpcc-js/wasm-zstd/src/__package__.ts @@ -0,0 +1,3 @@ +export const PKG_NAME = "@hpcc-js/wasm-zstd"; +export const PKG_VERSION = "1.7.0"; +export const BUILD_VERSION = "4.0.0"; diff --git a/node_modules/@hpcc-js/wasm-zstd/src/index.ts b/node_modules/@hpcc-js/wasm-zstd/src/index.ts new file mode 100755 index 0000000..11b64f8 --- /dev/null +++ b/node_modules/@hpcc-js/wasm-zstd/src/index.ts @@ -0,0 +1 @@ +export * from "./zstd.ts"; \ No newline at end of file diff --git a/node_modules/@hpcc-js/wasm-zstd/src/zstd.ts b/node_modules/@hpcc-js/wasm-zstd/src/zstd.ts new file mode 100644 index 0000000..0a2e5a1 --- /dev/null +++ b/node_modules/@hpcc-js/wasm-zstd/src/zstd.ts @@ -0,0 +1,475 @@ +// @ts-expect-error importing from a wasm file is resolved via a custom esbuild plugin +import load, { reset } from "../../../build/packages/zstd/zstdlib.wasm"; +import type { MainModule, zstd, StreamResult, FrameContentSizeResult } from "../types/zstdlib.js"; +import { MainModuleEx, type HeapU8 } from "@hpcc-js/wasm-util"; + +type ZstdExports = MainModule["zstd"]; + +// Ref: http://facebook.github.io/zstd/zstd_manual.html +// Ref: https://github.com/facebook/zstd + +let g_zstd: Promise | undefined; + +const WASM32_MAX = 0xffffffff; + +function assertSafeLength(length: number, label: string): void { + if (!Number.isInteger(length) || length < 0 || length > WASM32_MAX) { + throw new Error(`${label} length ${length} is outside the WASM32-safe range`); + } +} + +function concatUint8Arrays(chunks: Uint8Array[]): Uint8Array { + if (chunks.length === 0) { + return new Uint8Array(0); + } + if (chunks.length === 1) { + return chunks[0]; + } + let total = 0; + for (const chunk of chunks) { + total += chunk.length; + } + const out = new Uint8Array(total); + let offset = 0; + for (const chunk of chunks) { + out.set(chunk, offset); + offset += chunk.length; + } + return out; +} + +/** + * The Zstandard WASM library, provides a simplified wrapper around the Zstandard c++ library. + * + * See [Zstandard](https://facebook.github.io/zstd/) for more details. + * + * ```ts + * import { Zstd } from "@hpcc-js/wasm-zstd"; + * + * const zstd = await Zstd.load(); + * + * // Generate some "data" + * const data = new Uint8Array(Array.from({ length: 100000 }, (_, i) => i % 256)); + * + * const compressed_data = zstd.compress(data); + * const decompressed_data = zstd.decompress(compressed_data); + * ``` + * + * ::: warning + * `Zstd.load()` returns a process-wide singleton. Streaming compression and decompression + * mutate shared codec state and must be serialized by the caller. Do not interleave + * concurrent streaming operations on the same instance. + * ::: + */ +export class Zstd { + + private _mainModule: MainModuleEx; + private _zstdClass: ZstdExports; + private _zstd: zstd; + private _compressionLevel: number; + private _decompressFrameCompleted = false; + private _decompressRemaining = 0; + private _decompressSawInput = false; + + private constructor(_module: MainModule) { + this._mainModule = new MainModuleEx(_module); + this._zstdClass = _module.zstd; + this._zstd = new this._zstdClass(); + this._compressionLevel = this._zstdClass.defaultCLevel(); + } + + /** + * Compiles and instantiates the raw wasm. + * + * ::: info + * In general WebAssembly compilation is disallowed on the main thread if the buffer size is larger than 4KB, hence forcing `load` to be asynchronous; + * ::: + * + * @returns A promise to an instance of the Zstd class. + */ + static load(): Promise { + if (!g_zstd) { + g_zstd = load().then((module: MainModule) => new Zstd(module)); + } + return g_zstd!; + } + + /** + * Unloades the compiled wasm instance. + */ + static unload() { + reset(); + g_zstd?.then(zstd => { + zstd?._zstd?.delete(); + }); + g_zstd = undefined; + } + + private copyHeap(data: HeapU8): Uint8Array { + return this._mainModule.heapView(data).slice(); + } + + private mallocChecked(size: number, label: string): HeapU8 { + assertSafeLength(size, label); + const heap = this._mainModule.malloc(size); + if (!heap.ptr) { + this._mainModule.free(heap); + throw new Error(`Failed to allocate ${size} bytes for ${label}`); + } + return heap; + } + + private throwStreamError(operation: string, result: StreamResult): never { + throw new Error(`${operation} failed: ${result.errorName || "unknown error"}`); + } + + private ensureStreamOk(operation: string, result: StreamResult): void { + if (result.error) { + this.throwStreamError(operation, result); + } + } + + /** + * @returns The Zstd c++ version + */ + version(): string { + return this._zstdClass.version(); + } + + /** + * Resets both compression and decompression state (legacy API). + * Prefer {@link resetCompression} / {@link resetDecompression} so the two + * contexts are not reset accidentally together. + */ + reset(): void { + const result = this._zstd.reset(); + this.ensureStreamOk("reset", result); + this._decompressFrameCompleted = false; + this._decompressRemaining = 0; + this._decompressSawInput = false; + } + + /** + * Resets compression state and optionally sets the compression level. + * @param compressionLevel When omitted, the current level is kept. + */ + resetCompression(compressionLevel?: number): void { + if (compressionLevel !== undefined) { + this._compressionLevel = compressionLevel; + } + const result = this._zstd.resetCompression(this._compressionLevel); + this.ensureStreamOk("resetCompression", result); + } + + /** + * Resets decompression state before a new streaming decode. + */ + resetDecompression(): void { + const result = this._zstd.resetDecompression(); + this.ensureStreamOk("resetDecompression", result); + this._decompressFrameCompleted = false; + this._decompressRemaining = 0; + this._decompressSawInput = false; + } + + /** + * Sets the compression level for streaming compression. + * @param level Compression level (use minCLevel() to maxCLevel()) + */ + setCompressionLevel(level: number): void { + const result = this._zstd.setCompressionLevel(level); + this.ensureStreamOk("setCompressionLevel", result); + this._compressionLevel = level; + } + + /** + * @param data Data to be compressed + * @param compressionLevel Compression v Speed tradeoff, when omitted it will default to `zstd.defaultCLevel()` which is currently 3. + * @returns Compressed data. + * + * :::tip + * A note on compressionLevel: The library supports regular compression levels from 1 up o 22. Levels >= 20, should be used with caution, as they require more memory. The library also offers negative compression levels, which extend the range of speed vs. ratio preferences. The lower the level, the faster the speed (at the cost of compression). + * ::: + */ + compress(data: Uint8Array, compressionLevel: number = this.defaultCLevel()): Uint8Array { + assertSafeLength(data.length, "compress input"); + const uncompressed = this._mainModule.dataToHeap(data); + try { + if (!uncompressed.ptr && data.length > 0) { + throw new Error("Failed to allocate compress input buffer"); + } + + const compressedSize = this._zstdClass.compressBound(data.length); + const compressed = this.mallocChecked(compressedSize, "compress output"); + try { + compressed.size = this._zstdClass.compress(compressed.ptr, compressedSize, uncompressed.ptr, uncompressed.size, compressionLevel); + if (this._zstdClass.isError(compressed.size)) { + throw new Error(`compress failed: ${this._zstdClass.getErrorName(compressed.size)}`); + } + return this.copyHeap(compressed); + } finally { + this._mainModule.free(compressed); + } + } finally { + this._mainModule.free(uncompressed); + } + } + + /** + * Compresses a chunk of data in streaming mode. + * Call {@link resetCompression} before the first chunk, then {@link compressChunk} for each chunk, and finally {@link compressEnd}. + * Intermediate calls may return an empty array when Zstandard buffers input. + * @param data Chunk of data to be compressed + * @returns Compressed chunk data produced for this input (may be empty) + */ + compressChunk(data: Uint8Array): Uint8Array { + assertSafeLength(data.length, "compressChunk input"); + if (data.length === 0) { + return new Uint8Array(0); + } + + const uncompressed = this._mainModule.dataToHeap(data); + try { + if (!uncompressed.ptr) { + throw new Error("Failed to allocate compressChunk input buffer"); + } + + const outCapacity = this._zstdClass.CStreamOutSize(); + const chunks: Uint8Array[] = []; + let offset = 0; + + while (offset < data.length) { + const compressed = this.mallocChecked(outCapacity, "compressChunk output"); + try { + const result = this._zstd.compressChunk( + compressed.ptr, + outCapacity, + uncompressed.ptr + offset, + data.length - offset + ); + this.ensureStreamOk("compressChunk", result); + if (result.consumed === 0 && result.produced === 0) { + throw new Error("compressChunk failed: no progress while consuming input"); + } + offset += result.consumed; + if (result.produced > 0) { + compressed.size = result.produced; + chunks.push(this.copyHeap(compressed)); + } + } finally { + this._mainModule.free(compressed); + } + } + + return concatUint8Arrays(chunks); + } finally { + this._mainModule.free(uncompressed); + } + } + + /** + * Finishes the streaming compression and returns any remaining compressed data. + * @returns Final compressed data + */ + compressEnd(): Uint8Array { + const outCapacity = this._zstdClass.CStreamOutSize(); + const chunks: Uint8Array[] = []; + let remaining = 1; + + while (remaining !== 0) { + const compressed = this.mallocChecked(outCapacity, "compressEnd output"); + try { + const result = this._zstd.compressEnd(compressed.ptr, outCapacity); + this.ensureStreamOk("compressEnd", result); + if (result.produced === 0 && result.remaining !== 0) { + throw new Error("compressEnd failed: no progress while finishing stream"); + } + remaining = result.remaining; + if (result.produced > 0) { + compressed.size = result.produced; + chunks.push(this.copyHeap(compressed)); + } + } finally { + this._mainModule.free(compressed); + } + } + + return concatUint8Arrays(chunks); + } + + private frameContentSize(compressed: HeapU8): FrameContentSizeResult { + return this._zstdClass.getFrameContentSize(compressed.ptr, compressed.size); + } + + /** + * @param compressedData Data to be decompressed + * @returns Uncompressed data. + */ + decompress(compressedData: Uint8Array): Uint8Array { + assertSafeLength(compressedData.length, "decompress input"); + const compressed = this._mainModule.dataToHeap(compressedData); + try { + if (!compressed.ptr && compressedData.length > 0) { + throw new Error("Failed to allocate decompress input buffer"); + } + + const sizeInfo = this.frameContentSize(compressed); + if (sizeInfo.error) { + throw new Error(`Failed to get frame content size: ${sizeInfo.errorName}`); + } + + let useFastPath = sizeInfo.known; + if (useFastPath) { + // ZSTD_decompress only handles one frame. Known-size concatenated + // frames would allocate only for the first frame and overflow. + const frameCompressedSize = this._zstdClass.findFrameCompressedSize(compressed.ptr, compressed.size); + if (this._zstdClass.isError(frameCompressedSize)) { + throw new Error(`Failed to find frame compressed size: ${this._zstdClass.getErrorName(frameCompressedSize)}`); + } + if (frameCompressedSize < compressed.size) { + useFastPath = false; + } + } + + if (useFastPath) { + const uncompressed = this.mallocChecked(sizeInfo.size, "decompress output"); + try { + uncompressed.size = this._zstdClass.decompress( + uncompressed.ptr, + sizeInfo.size, + compressed.ptr, + compressed.size + ); + if (this._zstdClass.isError(uncompressed.size)) { + throw new Error(`decompress failed: ${this._zstdClass.getErrorName(uncompressed.size)}`); + } + return this.copyHeap(uncompressed); + } finally { + this._mainModule.free(uncompressed); + } + } + } finally { + this._mainModule.free(compressed); + } + + return this.decompressViaStreaming(compressedData); + } + + private decompressViaStreaming(compressedData: Uint8Array): Uint8Array { + this.resetDecompression(); + const produced = this.decompressChunk(compressedData); + this.decompressEnd(); + return produced; + } + + /** + * Decompresses a chunk of data in streaming mode. + * Call {@link resetDecompression} before the first chunk, then {@link decompressChunk} for each chunk, and finally {@link decompressEnd}. + * Intermediate calls may return an empty array. Callers must not guess an output size. + * @param compressedData Chunk of compressed data + * @returns Decompressed chunk data produced for this input (may be empty) + */ + decompressChunk(compressedData: Uint8Array): Uint8Array { + assertSafeLength(compressedData.length, "decompressChunk input"); + if (compressedData.length === 0) { + return new Uint8Array(0); + } + + this._decompressSawInput = true; + const compressed = this._mainModule.dataToHeap(compressedData); + try { + if (!compressed.ptr) { + throw new Error("Failed to allocate decompressChunk input buffer"); + } + + const outCapacity = this._zstdClass.DStreamOutSize(); + const chunks: Uint8Array[] = []; + let offset = 0; + let outputFilled = false; + + // Continue while input remains, or the previous step filled the output buffer + // (pending decoder output may still need an empty-input flush). + while (offset < compressedData.length || outputFilled) { + const uncompressed = this.mallocChecked(outCapacity, "decompressChunk output"); + try { + const srcSize = offset < compressedData.length + ? compressedData.length - offset + : 0; + const srcPtr = srcSize > 0 + ? compressed.ptr + offset + : 0; + const result = this._zstd.decompressChunk( + uncompressed.ptr, + outCapacity, + srcPtr, + srcSize + ); + this.ensureStreamOk("decompressChunk", result); + + if (result.consumed === 0 && result.produced === 0) { + if (srcSize === 0) { + if (result.remaining > 0) { + // Need more compressed input — wait for the next chunk. + this._decompressRemaining = result.remaining; + } + // remaining === 0: fully flushed, or waiting for input above. + break; + } + throw new Error("decompressChunk failed: no progress while consuming input"); + } + + offset += result.consumed; + // Only flush with empty input while the current frame still has pending output. + // When remaining === 0 the frame is complete (even if the buffer filled exactly); + // a follow-up empty call can return a non-zero hint and must not look like truncation. + outputFilled = result.produced === outCapacity && result.remaining !== 0; + + if (result.produced > 0) { + uncompressed.size = result.produced; + chunks.push(this.copyHeap(uncompressed)); + } + if (result.remaining === 0) { + this._decompressFrameCompleted = true; + this._decompressRemaining = 0; + } else { + this._decompressRemaining = result.remaining; + } + } finally { + this._mainModule.free(uncompressed); + } + } + + return concatUint8Arrays(chunks); + } finally { + this._mainModule.free(compressed); + } + } + + /** + * Verifies that streaming decompression completed a full frame and was not truncated. + * Empty intermediate output is not treated as completion; call this after the final chunk. + */ + decompressEnd(): void { + if (!this._decompressSawInput) { + throw new Error("decompressEnd failed: empty compressed input is not a completed frame"); + } + if (!this._decompressFrameCompleted || this._decompressRemaining !== 0) { + throw new Error("decompressEnd failed: truncated Zstandard input"); + } + } + + /** + * @returns Default compression level (see notes above above). + */ + defaultCLevel(): number { + return this._zstdClass.defaultCLevel(); + } + + minCLevel(): number { + return this._zstdClass.minCLevel(); + } + + maxCLevel(): number { + return this._zstdClass.maxCLevel(); + } +} diff --git a/node_modules/@hpcc-js/wasm-zstd/types/__package__.d.ts b/node_modules/@hpcc-js/wasm-zstd/types/__package__.d.ts new file mode 100644 index 0000000..c00d2f6 --- /dev/null +++ b/node_modules/@hpcc-js/wasm-zstd/types/__package__.d.ts @@ -0,0 +1,3 @@ +export declare const PKG_NAME = "@hpcc-js/wasm-zstd"; +export declare const PKG_VERSION = "1.7.0"; +export declare const BUILD_VERSION = "4.0.0"; diff --git a/node_modules/@hpcc-js/wasm-zstd/types/index.d.ts b/node_modules/@hpcc-js/wasm-zstd/types/index.d.ts new file mode 100644 index 0000000..840e33a --- /dev/null +++ b/node_modules/@hpcc-js/wasm-zstd/types/index.d.ts @@ -0,0 +1 @@ +export * from "./zstd.ts"; diff --git a/node_modules/@hpcc-js/wasm-zstd/types/zstd.d.ts b/node_modules/@hpcc-js/wasm-zstd/types/zstd.d.ts new file mode 100644 index 0000000..23cc0d3 --- /dev/null +++ b/node_modules/@hpcc-js/wasm-zstd/types/zstd.d.ts @@ -0,0 +1,124 @@ +/** + * The Zstandard WASM library, provides a simplified wrapper around the Zstandard c++ library. + * + * See [Zstandard](https://facebook.github.io/zstd/) for more details. + * + * ```ts + * import { Zstd } from "@hpcc-js/wasm-zstd"; + * + * const zstd = await Zstd.load(); + * + * // Generate some "data" + * const data = new Uint8Array(Array.from({ length: 100000 }, (_, i) => i % 256)); + * + * const compressed_data = zstd.compress(data); + * const decompressed_data = zstd.decompress(compressed_data); + * ``` + * + * ::: warning + * `Zstd.load()` returns a process-wide singleton. Streaming compression and decompression + * mutate shared codec state and must be serialized by the caller. Do not interleave + * concurrent streaming operations on the same instance. + * ::: + */ +export declare class Zstd { + private _mainModule; + private _zstdClass; + private _zstd; + private _compressionLevel; + private _decompressFrameCompleted; + private _decompressRemaining; + private _decompressSawInput; + private constructor(); + /** + * Compiles and instantiates the raw wasm. + * + * ::: info + * In general WebAssembly compilation is disallowed on the main thread if the buffer size is larger than 4KB, hence forcing `load` to be asynchronous; + * ::: + * + * @returns A promise to an instance of the Zstd class. + */ + static load(): Promise; + /** + * Unloades the compiled wasm instance. + */ + static unload(): void; + private copyHeap; + private mallocChecked; + private throwStreamError; + private ensureStreamOk; + /** + * @returns The Zstd c++ version + */ + version(): string; + /** + * Resets both compression and decompression state (legacy API). + * Prefer {@link resetCompression} / {@link resetDecompression} so the two + * contexts are not reset accidentally together. + */ + reset(): void; + /** + * Resets compression state and optionally sets the compression level. + * @param compressionLevel When omitted, the current level is kept. + */ + resetCompression(compressionLevel?: number): void; + /** + * Resets decompression state before a new streaming decode. + */ + resetDecompression(): void; + /** + * Sets the compression level for streaming compression. + * @param level Compression level (use minCLevel() to maxCLevel()) + */ + setCompressionLevel(level: number): void; + /** + * @param data Data to be compressed + * @param compressionLevel Compression v Speed tradeoff, when omitted it will default to `zstd.defaultCLevel()` which is currently 3. + * @returns Compressed data. + * + * :::tip + * A note on compressionLevel: The library supports regular compression levels from 1 up o 22. Levels >= 20, should be used with caution, as they require more memory. The library also offers negative compression levels, which extend the range of speed vs. ratio preferences. The lower the level, the faster the speed (at the cost of compression). + * ::: + */ + compress(data: Uint8Array, compressionLevel?: number): Uint8Array; + /** + * Compresses a chunk of data in streaming mode. + * Call {@link resetCompression} before the first chunk, then {@link compressChunk} for each chunk, and finally {@link compressEnd}. + * Intermediate calls may return an empty array when Zstandard buffers input. + * @param data Chunk of data to be compressed + * @returns Compressed chunk data produced for this input (may be empty) + */ + compressChunk(data: Uint8Array): Uint8Array; + /** + * Finishes the streaming compression and returns any remaining compressed data. + * @returns Final compressed data + */ + compressEnd(): Uint8Array; + private frameContentSize; + /** + * @param compressedData Data to be decompressed + * @returns Uncompressed data. + */ + decompress(compressedData: Uint8Array): Uint8Array; + private decompressViaStreaming; + /** + * Decompresses a chunk of data in streaming mode. + * Call {@link resetDecompression} before the first chunk, then {@link decompressChunk} for each chunk, and finally {@link decompressEnd}. + * Intermediate calls may return an empty array. Callers must not guess an output size. + * @param compressedData Chunk of compressed data + * @returns Decompressed chunk data produced for this input (may be empty) + */ + decompressChunk(compressedData: Uint8Array): Uint8Array; + /** + * Verifies that streaming decompression completed a full frame and was not truncated. + * Empty intermediate output is not treated as completion; call this after the final chunk. + */ + decompressEnd(): void; + /** + * @returns Default compression level (see notes above above). + */ + defaultCLevel(): number; + minCLevel(): number; + maxCLevel(): number; +} diff --git a/node_modules/@hpcc-js/wasm-zstd/types/zstdlib.d.ts b/node_modules/@hpcc-js/wasm-zstd/types/zstdlib.d.ts new file mode 100644 index 0000000..de047a3 --- /dev/null +++ b/node_modules/@hpcc-js/wasm-zstd/types/zstdlib.d.ts @@ -0,0 +1,84 @@ +// TypeScript bindings for emscripten-generated code. Automatically generated at compile time. +declare var RuntimeExports: { + /** + * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the + * emscripten HEAP, returns a copy of that string as a Javascript String object. + * + * @param {number} ptr + * @param {number=} maxBytesToRead - An optional length that specifies the + * maximum number of bytes to read. You can omit this parameter to scan the + * string until the first 0 byte. If maxBytesToRead is passed, and the string + * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the + * string will cut short at that byte index. + * @param {boolean=} ignoreNul - If true, the function will not stop on a NUL character. + * @return {string} + */ + UTF8ToString: (ptr: number, maxBytesToRead?: number | undefined, ignoreNul?: boolean | undefined) => string; + lengthBytesUTF8: (str: any) => number; + stringToUTF8: (str: any, outPtr: any, maxBytesToWrite: any) => any; + /** @type {!Uint8Array} */ + HEAPU8: Uint8Array; +}; +interface WasmModule { + _malloc(_0: number): number; + _free(_0: number): void; +} + +type EmbindString = ArrayBuffer|Uint8Array|Uint8ClampedArray|Int8Array|string; +export interface ClassHandle { + isAliasOf(other: ClassHandle): boolean; + delete(): void; + deleteLater(): this; + isDeleted(): boolean; + // @ts-ignore - If targeting lower than ESNext, this symbol might not exist. + [Symbol.dispose](): void; + clone(): this; +} +export interface zstd extends ClassHandle { + reset(): StreamResult; + resetCompression(_0: number): StreamResult; + resetDecompression(): StreamResult; + setCompressionLevel(_0: number): StreamResult; + compressChunk(_0: number, _1: number, _2: number, _3: number): StreamResult; + compressEnd(_0: number, _1: number): StreamResult; + decompressChunk(_0: number, _1: number, _2: number, _3: number): StreamResult; +} + +export type StreamResult = { + consumed: number, + produced: number, + remaining: number, + error: boolean, + errorName: EmbindString +}; + +export type FrameContentSizeResult = { + known: boolean, + error: boolean, + size: number, + errorName: EmbindString +}; + +interface EmbindModule { + zstd: { + new(): zstd; + minCLevel(): number; + maxCLevel(): number; + defaultCLevel(): number; + malloc(_0: number): number; + free(_0: number): void; + compress(_0: number, _1: number, _2: number, _3: number, _4: number): number; + decompress(_0: number, _1: number, _2: number, _3: number): number; + findFrameCompressedSize(_0: number, _1: number): number; + compressBound(_0: number): number; + CStreamOutSize(): number; + DStreamOutSize(): number; + isError(_0: number): number; + getFrameContentSize(_0: number, _1: number): FrameContentSizeResult; + version(): string; + getErrorName(_0: number): string; + }; +} + +export type MainModule = WasmModule & typeof RuntimeExports & EmbindModule; +export default function MainModuleFactory (options?: unknown): Promise; diff --git a/node_modules/@napi-rs/lzma-linux-x64-gnu/README.md b/node_modules/@napi-rs/lzma-linux-x64-gnu/README.md new file mode 100644 index 0000000..e58d486 --- /dev/null +++ b/node_modules/@napi-rs/lzma-linux-x64-gnu/README.md @@ -0,0 +1,3 @@ +# `@napi-rs/lzma-linux-x64-gnu` + +This is the **x86_64-unknown-linux-gnu** binary for `@napi-rs/lzma` diff --git a/node_modules/@napi-rs/lzma-linux-x64-gnu/lzma.linux-x64-gnu.node b/node_modules/@napi-rs/lzma-linux-x64-gnu/lzma.linux-x64-gnu.node new file mode 100644 index 0000000..d55cf0a Binary files /dev/null and b/node_modules/@napi-rs/lzma-linux-x64-gnu/lzma.linux-x64-gnu.node differ diff --git a/node_modules/@napi-rs/lzma-linux-x64-gnu/package.json b/node_modules/@napi-rs/lzma-linux-x64-gnu/package.json new file mode 100644 index 0000000..2c46667 --- /dev/null +++ b/node_modules/@napi-rs/lzma-linux-x64-gnu/package.json @@ -0,0 +1,39 @@ +{ + "name": "@napi-rs/lzma-linux-x64-gnu", + "version": "1.5.1", + "cpu": [ + "x64" + ], + "main": "lzma.linux-x64-gnu.node", + "files": [ + "lzma.linux-x64-gnu.node" + ], + "description": "lzma / lzma2 / xz compression for Node.js and the browser, backed by pure-Rust lzma-rust2 via https://napi.rs", + "keywords": [ + "Node-API", + "napi", + "lzma", + "compress", + "decompress", + "xz", + "napi-rs" + ], + "license": "MIT", + "engines": { + "node": "^22.20 || ^24.12 || >=25" + }, + "repository": { + "url": "git+https://github.com/Brooooooklyn/lzma.git", + "type": "git" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public" + }, + "os": [ + "linux" + ], + "libc": [ + "glibc" + ] +} \ No newline at end of file diff --git a/node_modules/@rollup/rollup-linux-x64-gnu/README.md b/node_modules/@rollup/rollup-linux-x64-gnu/README.md new file mode 100644 index 0000000..cabe280 --- /dev/null +++ b/node_modules/@rollup/rollup-linux-x64-gnu/README.md @@ -0,0 +1,3 @@ +# `@rollup/rollup-linux-x64-gnu` + +This is the **x86_64-unknown-linux-gnu** binary for `rollup` diff --git a/node_modules/@rollup/rollup-linux-x64-gnu/package.json b/node_modules/@rollup/rollup-linux-x64-gnu/package.json new file mode 100644 index 0000000..90462ce --- /dev/null +++ b/node_modules/@rollup/rollup-linux-x64-gnu/package.json @@ -0,0 +1,25 @@ +{ + "name": "@rollup/rollup-linux-x64-gnu", + "version": "4.63.2", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "files": [ + "rollup.linux-x64-gnu.node" + ], + "description": "Native bindings for Rollup", + "author": "Lukas Taegert-Atkinson", + "homepage": "https://rollupjs.org/", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/rollup/rollup.git" + }, + "libc": [ + "glibc" + ], + "main": "./rollup.linux-x64-gnu.node" +} \ No newline at end of file diff --git a/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node b/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node new file mode 100644 index 0000000..152ee80 Binary files /dev/null and b/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node differ diff --git a/node_modules/@sqlite.org/sqlite-wasm/README.md b/node_modules/@sqlite.org/sqlite-wasm/README.md new file mode 100644 index 0000000..a33c57e --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/README.md @@ -0,0 +1,243 @@ +# SQLite Wasm + +SQLite Wasm conveniently wrapped as an ES Module. + +## Bug reports + +> [!Warning] +> +> This project wraps the code of +> [SQLite Wasm](https://sqlite.org/wasm/doc/trunk/index.md) with _no_ changes, +> apart from added TypeScript types. Please do _not_ file issues or feature +> requests regarding the underlying SQLite Wasm code here. Instead, please +> follow the +> [SQLite bug filing instructions](https://www.sqlite.org/src/wiki?name=Bug+Reports). +> Filing TypeScript type related issues and feature requests is fine. + +## Node.js support + +> [!Warning] +> +> Node.js is currently only supported for in-memory databases without +> persistence. + +## Installation + +```bash +npm install @sqlite.org/sqlite-wasm +``` + +## Usage + +There are three ways to use SQLite Wasm: + +- [in the main thread with a wrapped worker](#in-a-wrapped-worker-with-opfs-if-available) + (🏆 preferred option) +- [in a worker](#in-a-worker-with-opfs-if-available) +- [in the main thread](#in-the-main-thread-without-opfs) + +Only the worker versions allow you to use the origin private file system (OPFS) +storage back-end. + +### In a wrapped worker (with OPFS if available): + +> [!Warning] +> +> For this to work, you need to set the following headers on your server: +> +> `Cross-Origin-Opener-Policy: same-origin` +> +> `Cross-Origin-Embedder-Policy: require-corp` + +```js +import { sqlite3Worker1Promiser } from '@sqlite.org/sqlite-wasm'; + +const log = console.log; +const error = console.error; + +const initializeSQLite = async () => { + try { + log('Loading and initializing SQLite3 module...'); + + const promiser = await new Promise((resolve) => { + const _promiser = sqlite3Worker1Promiser({ + onready: () => resolve(_promiser), + }); + }); + + log('Done initializing. Running demo...'); + + const configResponse = await promiser('config-get', {}); + log('Running SQLite3 version', configResponse.result.version.libVersion); + + const openResponse = await promiser('open', { + filename: 'file:mydb.sqlite3?vfs=opfs', + }); + const { dbId } = openResponse; + log( + 'OPFS is available, created persisted database at', + openResponse.result.filename.replace(/^file:(.*?)\?vfs=opfs$/, '$1'), + ); + // Your SQLite code here. + } catch (err) { + if (!(err instanceof Error)) { + err = new Error(err.result.message); + } + error(err.name, err.message); + } +}; + +initializeSQLite(); +``` + +The `promiser` object above implements the +[Worker1 API](https://sqlite.org/wasm/doc/trunk/api-worker1.md#worker1-methods). + +### In a worker (with OPFS if available): + +> [!Warning] +> +> For this to work, you need to set the following headers on your server: +> +> `Cross-Origin-Opener-Policy: same-origin` +> +> `Cross-Origin-Embedder-Policy: require-corp` + +```js +// In `main.js`. +const worker = new Worker('worker.js', { type: 'module' }); +``` + +```js +// In `worker.js`. +import sqlite3InitModule from '@sqlite.org/sqlite-wasm'; + +const log = console.log; +const error = console.error; + +const start = (sqlite3) => { + log('Running SQLite3 version', sqlite3.version.libVersion); + const db = + 'opfs' in sqlite3 + ? new sqlite3.oo1.OpfsDb('/mydb.sqlite3') + : new sqlite3.oo1.DB('/mydb.sqlite3', 'ct'); + log( + 'opfs' in sqlite3 + ? `OPFS is available, created persisted database at ${db.filename}` + : `OPFS is not available, created transient database ${db.filename}`, + ); + // Your SQLite code here. +}; + +const initializeSQLite = async () => { + try { + log('Loading and initializing SQLite3 module...'); + const sqlite3 = await sqlite3InitModule({ print: log, printErr: error }); + log('Done initializing. Running demo...'); + start(sqlite3); + } catch (err) { + error('Initialization error:', err.name, err.message); + } +}; + +initializeSQLite(); +``` + +The `db` object above implements the +[Object Oriented API #1](https://sqlite.org/wasm/doc/trunk/api-oo1.md). + +### In the main thread (without OPFS): + +```js +import sqlite3InitModule from '@sqlite.org/sqlite-wasm'; + +const log = console.log; +const error = console.error; + +const start = (sqlite3) => { + log('Running SQLite3 version', sqlite3.version.libVersion); + const db = new sqlite3.oo1.DB('/mydb.sqlite3', 'ct'); + // Your SQLite code here. +}; + +const initializeSQLite = async () => { + try { + log('Loading and initializing SQLite3 module...'); + const sqlite3 = await sqlite3InitModule({ + print: log, + printErr: error, + }); + log('Done initializing. Running demo...'); + start(sqlite3); + } catch (err) { + error('Initialization error:', err.name, err.message); + } +}; + +initializeSQLite(); +``` + +The `db` object above implements the +[Object Oriented API #1](https://sqlite.org/wasm/doc/trunk/api-oo1.md). + +## Usage with vite + +If you are using [vite](https://vitejs.dev/), you need to add the following +config option in `vite.config.js`: + +```js +import { defineConfig } from 'vite'; + +export default defineConfig({ + server: { + headers: { + 'Cross-Origin-Opener-Policy': 'same-origin', + 'Cross-Origin-Embedder-Policy': 'require-corp', + }, + }, + optimizeDeps: { + exclude: ['@sqlite.org/sqlite-wasm'], + }, +}); +``` + +Check out a +[sample project](https://stackblitz.com/edit/vitejs-vite-ttrbwh?file=main.js) +that shows this in action. + +## Demo + +See the [demo](https://github.com/sqlite/sqlite-wasm/tree/main/demo) folder for +examples of how to use this in the main thread and in a worker. (Note that the +worker variant requires special HTTP headers, so it can't be hosted on GitHub +Pages.) An example that shows how to use this with vite is available on +[StackBlitz](https://stackblitz.com/edit/vitejs-vite-ttrbwh?file=main.js). + +## Projects using this package + +See the list of +[npm dependents](https://www.npmjs.com/browse/depended/@sqlite.org/sqlite-wasm) +for this package. + +## Deploying a new version + +(These steps can only be executed by maintainers.) + +1. Update the version number in `package.json` reflecting the current + [SQLite version number](https://sqlite.org/download.html) and add a build + identifier suffix like `-build1`. The complete version number should read + something like `3.41.2-build1`. +1. Run `npm run build` to build the ES Module. This downloads the latest SQLite + Wasm binary and builds the ES Module. +1. Run `npm run deploy` to commit the changes, push to GitHub, and publish the + new version to npm. + +## License + +Apache 2.0. + +## Acknowledgements + +This project is based on [SQLite Wasm](https://sqlite.org/wasm), which it +conveniently wraps as an ES Module and publishes to npm as +[`@sqlite.org/sqlite-wasm`](https://www.npmjs.com/package/@sqlite.org/sqlite-wasm). diff --git a/node_modules/@sqlite.org/sqlite-wasm/bin/index.js b/node_modules/@sqlite.org/sqlite-wasm/bin/index.js new file mode 100755 index 0000000..8a7b8d6 --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/bin/index.js @@ -0,0 +1,62 @@ +#!/usr/bin/env node +import fs from 'fs'; +import fetch from 'node-fetch'; +import decompress from 'decompress'; + +async function getSqliteWasmDownloadLink() { + const response = await fetch('https://sqlite.org/download.html'); + const html = await response.text(); + const sqliteWasmLink = + 'https://sqlite.org/' + + html + .replace( + /^.*?.*?$/gms, + '$1', + ) + .split(/\n/) + .filter((row) => /sqlite-wasm/.test(row))[0] + .split(/,/)[2]; + console.log(`Found SQLite Wasm download link: ${sqliteWasmLink}`); + return sqliteWasmLink; +} + +async function downloadAndUnzipSqliteWasm(sqliteWasmDownloadLink) { + if (!sqliteWasmDownloadLink) { + throw new Error('Unable to find SQLite Wasm download link'); + } + console.log('Downloading and unzipping SQLite Wasm...'); + const response = await fetch(sqliteWasmDownloadLink); + if (!response.ok || response.status !== 200) { + throw new Error( + `Unable to download SQLite Wasm from ${sqliteWasmDownloadLink}`, + ); + } + const buffer = await response.arrayBuffer(); + fs.writeFileSync('sqlite-wasm.zip', Buffer.from(buffer)); + const files = await decompress('sqlite-wasm.zip', 'sqlite-wasm', { + strip: 1, + filter: (file) => + /jswasm/.test(file.path) && /(\.mjs|\.wasm|\.js)$/.test(file.path), + }); + console.log( + `Downloaded and unzipped:\n${files + .map((file) => (/\//.test(file.path) ? '‣ ' + file.path + '\n' : '')) + .join('')}`, + ); + fs.rmSync('sqlite-wasm.zip'); +} + +async function main() { + try { + const sqliteWasmLink = await getSqliteWasmDownloadLink(); + await downloadAndUnzipSqliteWasm(sqliteWasmLink); + fs.copyFileSync( + './node_modules/module-workers-polyfill/module-workers-polyfill.min.js', + './demo/module-workers-polyfill.min.js', + ); + } catch (err) { + console.error(err.name, err.message); + } +} + +main(); diff --git a/node_modules/@sqlite.org/sqlite-wasm/index.d.ts b/node_modules/@sqlite.org/sqlite-wasm/index.d.ts new file mode 100644 index 0000000..2a34aa4 --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/index.d.ts @@ -0,0 +1,8118 @@ +/** Types of values that can be passed to/retrieved from SQLite. */ +declare type SqlValue = + | string + | number + | null + | bigint + | Uint8Array + | Int8Array + | ArrayBuffer; + +/** Types of values that can be passed to SQLite. */ +declare type BindableValue = + | SqlValue + /** Converted to NULL */ + | undefined + /** Converted to INTEGER */ + | boolean; + +/** Internal data types supported by SQLite3. */ +declare type SQLiteDataType = + | CAPI['SQLITE_INTEGER'] + | CAPI['SQLITE_FLOAT'] + | CAPI['SQLITE_TEXT'] + | CAPI['SQLITE_BLOB'] + | CAPI['SQLITE_NULL']; + +/** Specifies parameter bindings. */ +declare type BindingSpec = + | readonly BindableValue[] + | { [paramName: string]: BindableValue } + /** Assumed to have binding index `1` */ + | (SqlValue | boolean); + +/** + * Certain WASM-bound APIs, where explicitly noted, have additional string-type + * argument conversions colloquially known as "flexible strings." This support + * is generally reserved for arguments which expect SQL strings, as such strings + * are often large and frequently come from external sources, e.g. byte arrays + * loaded from local files, over XHR requests, or using `fetch()`. Functions + * which take filename strings, and simlilar "small" strings, do not use this + * feature. + */ +declare type FlexibleString = + | string + /** WASM C-string pointer, passed on to WASM as-is. */ + | WasmPointer + /** Assumed to hold UTF-8 encoded text, converted to `string` */ + | Uint8Array + | Int8Array + | ArrayBuffer + /** + * Gets converted to a string using `theArray.join('')` (i.e. concatenated + * as-is, with no space between each entry). Though JS supports multi-line + * string literals with the backtick syntax, it is frequently convenient to + * write out longer SQL constructs as arrays. + */ + | readonly string[]; + +/** + * Prepared statements are created solely through the {@link Database#prepare} + * method. Calling the constructor directly will trigger an exception. + * + * It is important that statements be finalized in a timely manner, else clients + * risk introducing locking errors later on in their apps. + * + * By and large, clients can avoid statement lifetime issues by using the + * {@link Database#exec} method. For cases when more control or flexibility is + * needed, however, clients will need to {@link Database#prepare} statements and + * then ensure that their lifetimes are properly managed. The simplest way to do + * this is with a `try`/`finally` block, as in this example: + * + * @example + * const stmt = myDb.prepare("..."); + * try { + * ... use the stmt object ... + * } finally { + * stmt.finalize(); + * } + */ +declare class PreparedStatement { + /** Binds one more values to its bindable parameters. */ + bind(binding: BindingSpec): this; + + /** + * Binds a value to a bindable parameter. + * + * @param idx The index of the bindable parameter to bind to, **ACHTUNG**: + * 1-based! + */ + bind(idx: number, binding: SqlValue): this; + + /** + * Special case of {@link PreparedStatement#bind} which binds the given value + * using the `BLOB` binding mechanism instead of the default selected one for + * the value. Index can be the index number (**ACHTUNG**: 1-based!) or the + * string corresponding to a named parameter. + */ + bindAsBlob( + value: string | null | undefined | Uint8Array | Int8Array | ArrayBuffer, + ): this; + bindAsBlob( + idx: number | string, + value: string | null | undefined | Uint8Array | Int8Array | ArrayBuffer, + ): this; + + /** Clears all bound values. */ + clearBindings(): this; + + /** + * "Finalizes" this statement. This is a no-op if the statement has already + * been finalized. Returns the value of the underlying `sqlite3_finalize()` + * call (0 on success, non-0 on error) or `undefined` if the statement has + * already been finalized. It does not throw if `sqlite3_finalize()` returns + * non-0 because this function is effectively a destructor and "destructors do + * not throw." This function will throw if it is called while the statement is + * in active use via a {@link Database#exec} callback. + */ + finalize(): number | undefined; + + /** + * Fetches the value from the given 0-based column index of the current data + * row, throwing if index is out of range. + * + * Requires that {@link PreparedStatement#step} has just returned a truthy + * value, else an exception is thrown. + * + * By default it will determine the data type of the result automatically. If + * passed a second arugment, it must be one of the enumeration values for + * sqlite3 types, which are defined as members of the sqlite3 namespace: + * `SQLITE_INTEGER`, `SQLITE_FLOAT`, `SQLITE_TEXT`, `SQLITE_BLOB`. Any other + * value, except for `undefined`, will trigger an exception. Passing + * `undefined` is the same as not passing a value. It is legal to, e.g., fetch + * an integer value as a string, in which case sqlite3 will convert the value + * to a string. + * + * If the index is an array, this function behaves a differently: it assigns + * the indexes of the array, from 0 to the number of result columns, to the + * values of the corresponding result column, and returns that array: + * + * const values = stmt.get([]); + * + * This will return an array which contains one entry for each result column + * of the statement's current row.. + * + * If the index is a plain object, this function behaves even differentlier: + * it assigns the properties of the object to the values of their + * corresponding result columns: + * + * const values = stmt.get({}); + * + * This returns an object with properties named after the columns of the + * result set. Be aware that the ordering of the properties is undefined. If + * their order is important, use the array form instead. + * + * Blobs are returned as `Uint8Array` instances. + * + * Special case handling of 64-bit integers: the `Number` type is used for + * both floating point numbers and integers which are small enough to fit into + * it without loss of precision. If a larger integer is fetched, it is + * returned as a `BigInt` if that support is enabled, else it will throw an + * exception. The range of integers supported by the Number class is defined + * as: + * + * - `Number.MIN_SAFE_INTEGER = -9007199254740991` + * - `Number.MAX_SAFE_INTEGER = 9007199254740991` + */ + get(ndx: number, asType?: SQLiteDataType): SqlValue; + get(ndx: SqlValue[]): SqlValue[]; + get(ndx: { [columnName: string]: SqlValue }): { + [columnName: string]: SqlValue; + }; + + /** + * Equivalent to {@link PreparedStatement#get(ndx)} but coerces the result to a + * `Uint8Array`. + */ + getBlob(ndx: number): Uint8Array | null; + + /** + * Returns the result column name of the given index, or throws if index is + * out of bounds or this statement has been finalized. This may be used + * without having run {@link PreparedStatement#step()} first. + */ + getColumnName(ndx: number): string; + + /** + * If this statement potentially has result columns, this function returns an + * array of all such names. If passed an array, it is used as the target and + * all names are appended to it. Returns the target array. Throws if this + * statement cannot have result columns. `this.columnCount`, set with the + * statement is prepared, holds the number of columns. + */ + getColumnNames(target?: string[]): string[]; + + /** + * Equivalent to {@link PreparedStatement#get(ndx)} but coerces the result to a + * number. + */ + getFloat(ndx: number): number | null; + + /** + * Equivalent to {@link PreparedStatement#get(ndx)} but coerces the result to + * an integral number. + */ + getInt(ndx: number): number | null; + + /** + * Equivalent to {@link PreparedStatement#getString(ndx)} but returns passes + * the result of passing the fetched string string through `JSON.parse()`. If + * JSON parsing throws, that exception is propagated. + */ + getJSON(ndx: number): any; + + /** + * If this statement has named bindable parameters and the given name matches + * one, its 1-based bind index is returned. If no match is found, 0 is + * returned. If it has no bindable parameters, the undefined value is + * returned. + */ + getParamIndex(name: string): number | undefined; + + /** + * Equivalent to {@link PreparedStatement#get(ndx)} but coerces the result to a + * string. + */ + getString(ndx: number): string | null; + + /** + * Resets this statement so that it may be `step()`ed again from the + * beginning. Returns `this`. Throws if this statement has been finalized, if + * it may not legally be reset because it is currently being used from a + * {@link Database#exec} callback, or (as of versions 3.42.1 and 3.43) if the + * underlying call to `sqlite3_reset()` returns non-0. + * + * If passed a truthy argument then {@link PreparedStatement#clearBindings} is + * also called, otherwise any existing bindings, along with any memory + * allocated for them, are retained. + * + * In versions 3.42.0 and earlier, this function did not throw if + * `sqlite3_reset()` returns non-0, but it was discovered that throwing (or + * significant extra client-side code) is necessary in order to avoid certain + * silent failure scenarios + */ + reset(alsoClearBinds?: boolean): this; + + /** + * Steps the statement one time. If the result indicates that a row of data is + * available, a truthy value is returned. If no row of data is available, a + * falsy value is returned. Throws on error. + */ + step(): boolean; + + /** + * Functions like {@link PreparedStatement#step} except that it calls + * {@link PreparedStatement#finalize} on this statement immediately after + * stepping unless the `step()` throws. + * + * On success, it returns true if the step indicated that a row of data was + * available, else it returns false. + * + * This is intended to simplify use cases such as: + * + * ADb.prepare('INSERT INTO foo(a) VALUES(?)').bind(123).stepFinalize(); + */ + stepFinalize(): boolean; + + /** + * Functions exactly like {@link PreparedStatement#step} except that... + * + * On success, it calls {@link PreparedStatement#reset} and returns this + * object. On error, it throws and does not call reset(). + * + * This is intended to simplify constructs like: + * + * For(...) { stmt.bind(...).stepReset(); } + * + * Note that the {@link PreparedStatement#reset} call makes it illegal to call + * {@link PreparedStatement#get} after the step. + */ + stepReset(): this; + + /** + * The number of result columns this statement has, or 0 for statements which + * do not have result columns. + * + * _Minor achtung:_ for all releases > 3.42.0 this is a property interceptor + * which invokes `sqlite3_column_count`, so its use should be avoided in loops + * because of the call overhead. In versions <= 3.42.0 this value is collected + * and cached when the statement is created, but that can lead to misbehavior + * if changes are made to the database schema while this statement is active. + */ + columnCount: number; + + /** The number of bindable parameters this statement has. */ + parameterCount: number; + + /** + * WASM pointer rwhich resolves to the `sqlite3_stmt*` which this object + * wraps. This value may be passed to any WASM-bound functions which accept an + * `sqlite3_stmt*` argument. It resolves to `undefined` after this statement + * is {@link PreparedStatement#finalize}d. + */ + pointer: WasmPointer | undefined; +} + +declare type ExecOptions = { + /** + * The SQL to run (unless it's provided as the first argument). The SQL may + * contain any number of statements. + */ + sql?: FlexibleString; + + /** + * A single value valid as an argument for {@link PreparedStatement#bind}. This + * is only applied to the first non-empty statement in the SQL which has any + * bindable parameters. (Empty statements are skipped entirely.) + */ + bind?: BindingSpec; + + /** + * If set, the SQL of each executed statement is appended to this array before + * the statement is executed (but after it is prepared - we don't have the + * string until after that). Empty SQL statements are elided. + */ + saveSql?: string[]; + + /** + * A string specifying what this function should return: The default value is + * (usually) `"this"`. The exceptions is if the caller passes neither of + * `callback` nor `returnValue` but does pass an explicit `rowMode` then the + * default returnValue is `"resultRows"`, described below. The options are: + * + * - `"this"` menas that the DB object itself should be returned. + * - `"resultRows"` means to return the value of the `resultRows` option. If + * `resultRows` is not set, this function behaves as if it were set to an + * empty array. + * - `"saveSql"` means to return the value of the `saveSql` option. If `saveSql` + * is not set, this function behaves as if it were set to an empty array. + */ + returnValue?: 'this' | 'resultRows' | 'saveSql'; + + /** + * A function which gets called for each row of the result set (see `rowMode`, + * below), but only if that statement has any result rows. The callback's + * `this` is the `options` object, noting that this function will synthesize + * one if the caller does not provide one. The second argument passed to the + * callback is always the current {@link PreparedStatement} object, as it's + * needed if the caller wants to fetch the column names or some such (noting + * that they could also be fetched via `this.columnNames`, if the client + * provides the `columnNames` option). If the callback returns a literal + * `false` (as opposed to any other falsy value, e.g. an implicit undefined + * return), any ongoing statement-`step()` iteration stops without an error. + * The return value of the callback is otherwise ignored. + * + * Applies only to the first statement which has a non-zero result column + * count, regardless of whether the statement actually produces any result + * rows. + * + * **ACHTUNG:** the callback **MUST NOT** modify the {@link PreparedStatement} + * object. Calling any of the {@link PreparedStatement#get} variants, + * {@link PreparedStatement#getColumnName}, or similar, is legal, but calling + * {@link PreparedStatement#step} or {@link PreparedStatement#finalize} is not. + * Member methods which are illegal in this context will trigger an exception, + * but clients must also refrain from using any lower-level (C-style) APIs + * which might modify the statement. + */ + callback?: ( + row: + | SqlValue[] + | { [columnName: string]: SqlValue } + | PreparedStatement + | SqlValue, + stmt: PreparedStatement, + ) => void | false; + + /** + * If this is an array, the column names of the result set are stored in this + * array before the `callback` (if any) is triggered (regardless of whether + * the query produces any result rows). If no statement has result columns, + * this value is unchanged. + * + * Applies only to the first statement which has a non-zero result column + * count, regardless of whether the statement actually produces any result + * rows. + * + * **Achtung:** an SQL result may have multiple columns with identical names. + */ + columnNames?: string[]; + + /** + * If this is an array, it functions similarly to the `callback` option: each + * row of the result set (if any), with the exception that the `rowMode` + * `'stmt'` is not legal. It is legal to use both `resultRows` and callback, + * but `resultRows` is likely much simpler to use for small data sets and can + * be used over a WebWorker-style message interface. `exec()` throws if + * `resultRows` is set and rowMode is `'stmt'`. + * + * Applies only to the first statement which has a non-zero result column + * count, regardless of whether the statement actually produces any result + * rows. + */ + resultRows?: (SqlValue[] | { [columnName: string]: SqlValue } | SqlValue)[]; + + /** + * Specifies the type of he `callback`'s first argument and the type of the + * `resultRows` array entries. + */ + rowMode?: 'array' | 'object' | 'stmt' | number | string; +}; + +/** + * Derivate type of ExecOptions to be used as base mixin for method overloads on + * `exec` + */ +declare type ExecBaseOptions = Omit< + ExecOptions, + 'callback' | 'resultRows' | 'rowMode' | 'returnValue' | 'sql' +>; + +declare type ExecReturnThisOptions = { + returnValue?: 'this'; +}; + +declare type ExecReturnResultRowsOptions = { + returnValue: 'resultRows'; +}; + +declare type ExecReturnSaveSqlOptions = { + returnValue: 'saveSql'; +}; + +declare type ExecRowModeArrayOptions = { + callback?: (row: SqlValue[]) => void | false; + resultRows?: SqlValue[][]; + rowMode?: 'array'; +}; + +declare type ExecRowModeObjectOptions = { + callback?: (row: { [columnName: string]: SqlValue }) => void | false; + resultRows?: { [columnName: string]: SqlValue }[]; + rowMode: 'object'; +}; + +declare type ExecRowModeStmtOptions = { + callback?: (row: PreparedStatement) => void | false; + resultRows?: undefined; + rowMode: 'stmt'; +}; + +declare type ExecRowModeScalarOptions = { + callback?: (row: SqlValue) => void | false; + resultRows?: SqlValue[]; + + /** + * For number values: indicates a zero-based column in the result row. Only + * that one single value will be passed on. If string. For string values: A + * string with a minimum length of 2 and leading character of `$` will fetch + * the row as an object, extract that one field, and pass that field's value + * to the `callback`. Note that these keys are case-sensitive so must match + * the case used in the SQL. e.g. `"select a A from t"` with a `rowMode` of + * `'$A'` would work but `'$a'` would not. A reference to a column not in the + * result set will trigger an exception on the first row (as the check is not + * performed until rows are fetched). + */ + rowMode: number | Exclude; +}; + +/** Options for creating a user-defined function that can be called from SQL. */ +declare type FunctionOptions = { + /** + * Number of arguments which SQL calls to this function expect or require. The + * default value is `X.length` MINUS 1, where X is either `xFunc` or `xStep`, + * depending on the type of function being created. As a special case, if + * `X.length` is 0, its arity is also 0 instead of -1. A negative arity value + * means that the function is variadic and may accept any number of arguments, + * up to sqlite3's compile-time limits. sqlite3 will enforce the argument + * count if is zero or greater. The callback always receives a pointer to an + * `sqlite3_context` object as its first argument. Any arguments after that + * are from SQL code. The leading context argument does not count towards the + * function's arity. See the docs for `sqlite3_create_function()` for why that + * argument is required in the interface. + */ + arity?: number; + + /** + * Corresponds to the `SQLITE_DETERMINISTIC` flag. Setting it means that the + * new function always gives the same output when the input parameters are the + * same. The `abs()` function is deterministic, for example, but + * `randomblob()` is not. Functions must be deterministic in order to be used + * in certain contexts such as with the `WHERE` clause of partial indexes or + * in generated columns. SQLite might also optimize deterministic functions by + * factoring them out of inner loops. + */ + deterministic?: boolean; + + /** + * Corresponds to the `SQLITE_DIRECTONLY` flag. + * + * Setting it means that the function may only be invoked from top-level SQL, + * and cannot be used in `VIEW`s or `TRIGGER`s nor in schema structures such + * as `CHECK` constraints, `DEFAULT` clauses, expression indexes, partial + * indexes, or generated columns. + * + * The flag is recommended for any application-defined SQL function that has + * side-effects or that could potentially leak sensitive information. This + * will prevent attacks in which an application is tricked into using a + * database file that has had its schema surreptiously modified to invoke the + * application-defined function in ways that are harmful. + * + * Some people say it is good practice to set the flag on all + * application-defined SQL functions, regardless of whether or not they are + * security sensitive, as doing so prevents those functions from being used + * inside of the database schema, and thus ensures that the database can be + * inspected and modified using generic tools (such as the CLI) that do not + * have access to the application-defined functions. + */ + directOnly?: boolean; + + /** + * Corresponds to the `SQLITE_INNOCUOUS` flag. + * + * Setting it means that the function is unlikely to cause problems even if + * misused. An innocuous function should have no side effects and should not + * depend on any values other than its input parameters. The `abs()` function + * is an example of an innocuous function. The `load_extension()` SQL function + * is not innocuous because of its side effects. The flag is similar to + * {@link FunctionOptions#directOnly}, but is not exactly the same. The + * `random()` function is an example of a function that is innocuous but not + * deterministic. + * + * Some heightened security settings (`SQLITE_DBCONFIG_TRUSTED_SCHEMA` and + * `PRAGMA trusted_schema=OFF`) disable the use of SQL functions inside views + * and triggers and in schema structures such as `CHECK` constraints, + * `DEFAULT` clauses, expression indexes, partial indexes, and generated + * columns unless the function is tagged with `SQLITE_INNOCUOUS`. Most + * built-in functions are innocuous. Developers are advised to avoid using the + * `SQLITE_INNOCUOUS` flag for application-defined functions unless the + * function has been carefully audited and found to be free of potentially + * security-adverse side-effects and information-leaks. + */ + innocuous?: boolean; + + /** Name of the user-defined function. */ + name?: string; + + /** + * The options object may optionally have an xDestroy function-type property, + * as per `sqlite3_create_function_v2()`. Its argument will be the + * WASM-pointer-type value of the pApp property, and this function will throw + * if pApp is defined but is not null, undefined, or a numeric (WASM pointer) + * value. i.e. pApp, if set, must be value suitable for use as a WASM pointer + * argument, noting that null or undefined will translate to 0 for that + * purpose. + */ + xDestroy?: (pAppPtr: WasmPointer) => void; +}; + +declare type ScalarFunctionOptions = FunctionOptions & { + /** Scalar function to be defined. */ + xFunc: (ctxPtr: number, ...args: SqlValue[]) => SqlValue; +}; + +declare type AggregateFunctionOptions = FunctionOptions & { + /** + * 'Step' callback for an aggregate function. + * + * It is invoked to add a row to the current aggregate value. The function + * arguments, if any, corresponding to the row being added are passed to the + * implementation of {@link AggregateFunctionOptions#xStep}. + */ + xStep: (ctxPtr: number, ...rowValues: SqlValue[]) => void; + + /** + * 'Final' callback for an aggregate function. + * + * It is invoked to return the current value of the aggregate, and to free any + * resources allocated by earlier calls to + * {@link AggregateFunctionOptions#xStep}. + */ + xFinal: (ctxPtr: number) => SqlValue; +}; + +declare type WindowFunctionOptions = FunctionOptions & { + /** + * 'Step' callback for a window function. + * + * It is invoked to add a row to the current window. The function arguments, + * if any, corresponding to the row being added are passed to the + * implementation of {@link WindowFunctionOptions#xStep}. + */ + xStep: (ctxPtr: number, ...args: any[]) => void; + + /** + * 'Final' callback for a window function. + * + * It is invoked to return the current value of the aggregate (determined by + * the contents of the current window), and to free any resources allocated by + * earlier calls to {@link WindowFunctionOptions#xStep}. + */ + xFinal: (ctxPtr: number) => SqlValue; + + /** + * 'Value' callback for a window function. This method is invoked to return + * the current value of the aggregate. Unlike + * {@link WindowFunctionOptions#xFinal}, the implementation should not delete + * any context. + */ + xValue: (ctxPtr: number) => SqlValue; + + /** + * 'Inverse' callback for a window function. + * + * It is invoked to remove the oldest presently aggregated result of + * {@link WindowFunctionOptions#xStep} from the current window. The function + * arguments, if any, are those passed to {@link WindowFunctionOptions#xStep} + * for the row being removed. + */ + xInverse: (ctxPtr: number, ...args: any[]) => void; +}; + +/** + * An instance of an implementing class corresponds to one `sqlite3*` created + * using `sqlite3_open` or equivalent. + * + * @example + * ```typescript + * const db = new sqlite3.DB(); + * try { + * db.exec([ + * "create table t(a);", + * "insert into t(a) values(10),(20),(30)" + * ]); + * } finally { + * db.close(); + * } + * ```; + */ +declare class Database { + /** + * Creates a connection to the given file, optionally creating it if needed. + * + * @param options The options to use when opening the database file. + * @param options.filename The filename to open. Must be resolvable using + * whatever filesystem layer (virtual or otherwise) is set up for the + * default sqlite3 VFS. Note that the special sqlite3 db names `":memory:"` + * and `""` (temporary db) have their normal special meanings here. + * @param options.flags The flags to use when opening the file. It must be a + * string containing a sequence of letters (in any order, but case + * sensitive) specifying the mode: + * + * - `c`: create if it does not exist, else fail if it does not exist. Implies + * the `w` flag. + * - `w`: write. Implies `r`: a db cannot be write-only. + * - `r`: read-only if neither `w` nor `c` are provided, else it is ignored. + * - `t`: enable tracing of SQL executed on this database handle, sending it to + * `console.log()`. To disable it later, call + * `sqlite3.capi.sqlite3_trace_v2(thisDb.pointer, 0, 0, 0)`. If `w` is + * not provided, the db is implicitly read-only, noting that `rc` is + * meaningless. Any other letters are currently ignored. The default is + * `c`. These modes are ignored for the special `":memory:"` and `""` + * names and may be ignored by specific VFSes. + */ + constructor(options?: { filename?: string; flags?: string; vfs?: string }); // ✓ + + /** + * Creates a connection to the given file, optionally creating it if needed. + * + * @param filename The filename to open. Must be resolvable using whatever + * filesystem layer (virtual or otherwise) is set up for the default sqlite3 + * VFS. Note that the special sqlite3 db names `":memory:"` and `""` + * (temporary db) have their normal special meanings here. + * @param flags The flags to use when opening the file. It must be a string + * containing a sequence of letters (in any order, but case sensitive) + * specifying the mode: + * + * - `c`: create if it does not exist, else fail if it does not exist. Implies + * the `w` flag. + * - `w`: write. Implies `r`: a db cannot be write-only. + * - `r`: read-only if neither `w` nor `c` are provided, else it is ignored. + * - `t`: enable tracing of SQL executed on this database handle, sending it to + * `console.log()`. To disable it later, call + * `sqlite3.capi.sqlite3_trace_v2(thisDb.pointer, 0, 0, 0)`. If `w` is + * not provided, the db is implicitly read-only, noting that `rc` is + * meaningless. Any other letters are currently ignored. The default is + * `c`. These modes are ignored for the special `":memory:"` and `""` + * names and may be ignored by specific VFSes. + */ + constructor(filename?: string, flags?: string, vfs?: string); // ✓ + + /** Filename which was passed to the constructor. */ + filename: string; // ✓ + + /** + * Resolves to the `sqlite3*` which this object wraps. This value may be + * passed to any WASM-bound functions which accept an `sqlite3*` argument. It + * resolves to `undefined` after this object is `close()`d. + */ + pointer?: WasmPointer; // ✓ + + /** Callbacks called immediately before/after database is closed. */ + onclose?: { + before?: (db: Database) => void; + after?: (db: Database) => void; + }; // ✓ + + /** + * Executes SQL statements and optionally collects query results and/or calls + * a callback for each result row. + * + * _LOTS_ of overloads on this one one, depending on: + * + * - `sql` as parameter or as option + * - `returnValue`: + * + * - `"this"`: default, return database instance, use for fluent calls + * - `"resultRows"`: return values of `resultRows` array (set to empty array if + * not set by user) + * - `"saveSql"`: return values of `saveSql` option (set to empty array if not + * set by user) + * - `resultRows`: + * + * - `"array"`: Array of column values for every result row + * - `"object"`: Object mapping column names to values for every result row + * - `"stmt"`: Only for use with `callback` option, pass + * {@link PreparedStatement} object for every row. + * - `number`: Extract column with (zero-based) index from every result row + * - `string`: Extract column with name from every result row, must have format + * `$`, with `column` having at least two characters. + * + * ⚠️**ACHTUNG**⚠️: The combination of `returnValue: "resultRows"` and + * `rowMode: "stmt"` type checks fine, but will lead to a runtime error. This + * is due to a limitation in TypeScript's type system which does not allow + * restrictions on `string` types. + */ + exec( + sql: FlexibleString, + opts?: (ExecBaseOptions & + ExecRowModeArrayOptions & + ExecReturnThisOptions) & { + sql?: undefined; + }, + ): this; + exec( + opts: (ExecBaseOptions & + ExecRowModeArrayOptions & + ExecReturnThisOptions) & { sql: FlexibleString }, + ): this; + exec( + sql: FlexibleString, + opts: ExecBaseOptions & + ExecRowModeObjectOptions & + ExecReturnThisOptions & { + sql?: undefined; + }, + ): this; + exec( + opts: ExecBaseOptions & + ExecRowModeObjectOptions & + ExecReturnThisOptions & { + sql: FlexibleString; + }, + ): this; + exec( + sql: FlexibleString, + opts: ExecBaseOptions & + ExecRowModeStmtOptions & + ExecReturnThisOptions & { + sql?: undefined; + }, + ): this; + exec( + opts: ExecBaseOptions & + ExecRowModeStmtOptions & + ExecReturnThisOptions & { + sql: FlexibleString; + }, + ): this; + exec( + sql: FlexibleString, + opts: ExecBaseOptions & + ExecRowModeScalarOptions & + ExecReturnThisOptions & { + sql?: undefined; + }, + ): this; + exec( + opts: ExecBaseOptions & + ExecRowModeScalarOptions & + ExecReturnThisOptions & { + sql: FlexibleString; + }, + ): this; + exec( + sql: FlexibleString, + opts: ExecBaseOptions & + ExecRowModeArrayOptions & + ExecReturnResultRowsOptions & { + sql?: undefined; + }, + ): SqlValue[][]; + exec( + opts: ExecBaseOptions & + ExecRowModeArrayOptions & + ExecReturnResultRowsOptions & { + sql: FlexibleString; + }, + ): SqlValue[][]; + exec( + sql: FlexibleString, + opts: ExecBaseOptions & + ExecRowModeObjectOptions & + ExecReturnResultRowsOptions & { + sql?: undefined; + }, + ): { [columnName: string]: SqlValue }[]; + exec( + opts: ExecBaseOptions & + ExecRowModeObjectOptions & + ExecReturnResultRowsOptions & { + sql: FlexibleString; + }, + ): { [columnName: string]: SqlValue }[]; + exec( + sql: FlexibleString, + opts: ExecBaseOptions & + ExecRowModeScalarOptions & + ExecReturnResultRowsOptions & { + sql?: undefined; + }, + ): SqlValue[]; + exec( + opts: ExecBaseOptions & + ExecRowModeScalarOptions & + ExecReturnResultRowsOptions & { + sql: FlexibleString; + }, + ): SqlValue[]; + exec( + sql: FlexibleString, + opts: ExecBaseOptions & + ExecRowModeArrayOptions & + ExecReturnSaveSqlOptions & { + sql?: undefined; + }, + ): string[]; + exec( + opts: ExecBaseOptions & + ExecRowModeArrayOptions & + ExecReturnSaveSqlOptions & { + sql: FlexibleString; + }, + ): string[]; + exec( + sql: FlexibleString, + opts: ExecBaseOptions & + ExecRowModeObjectOptions & + ExecReturnSaveSqlOptions & { + sql?: undefined; + }, + ): string[]; + exec( + opts: ExecBaseOptions & + ExecRowModeObjectOptions & + ExecReturnSaveSqlOptions & { + sql: FlexibleString; + }, + ): string[]; + exec( + sql: FlexibleString, + opts: ExecBaseOptions & + ExecRowModeStmtOptions & + ExecReturnSaveSqlOptions & { + sql?: undefined; + }, + ): string[]; + exec( + opts: ExecBaseOptions & + ExecRowModeStmtOptions & + ExecReturnSaveSqlOptions & { + sql: FlexibleString; + }, + ): string[]; + exec( + sql: FlexibleString, + opts: ExecBaseOptions & + ExecRowModeScalarOptions & + ExecReturnSaveSqlOptions & { + sql?: undefined; + }, + ): string[]; + exec( + opts: ExecBaseOptions & + ExecRowModeScalarOptions & + ExecReturnSaveSqlOptions & { + sql: FlexibleString; + }, + ): string[]; + + /** + * Compiles the given SQL and returns a {@link PreparedStatement}. This is the + * only way to create new {@link PreparedStatement} objects. Throws on error. + */ + prepare(sql: FlexibleString): PreparedStatement; + + /** Returns true if the database handle is open, else false. */ + isOpen(): boolean; + + /** Throws if the given DB has been closed. */ + affirmOpen(): this; + + /** + * Finalizes all still-open statements which were opened by this object and + * closes this database connection. This is a no-op if the db has already been + * closed. After calling `close()`, {@link pointer} will resolve to + * `undefined`, so that can be used to check whether the db instance is still + * opened. + * + * If {@link onclose.before} is a function then it is called before any + * close-related cleanup. If {@link onclose.after} is a function then it is + * called after the db is closed but before auxiliary state like this.filename + * is cleared. + * + * Both onclose handlers are passed this object as their only argument. If + * this db is not opened, neither of the handlers are called. Any exceptions + * the handlers throw are ignored because "destructors must not throw." + * + * Note that garbage collection of a db handle, if it happens at all, will + * never trigger `close()`, so {@link onclose} handlers are not a reliable way + * to implement close-time cleanup or maintenance of a db. + */ + close(): void; // ✓ + + /** + * Returns the number of changes, as per `sqlite3_changes()` (if the first + * argument is `false`) or `sqlite3_total_changes()` (if it's `true`). If the + * 2nd argument is `true`, it uses `sqlite3_changes64()` or + * `sqlite3_total_changes64()`, which will trigger an exception if this build + * does not have `BigInt` support enabled. + */ + changes(total?: boolean, sixtyFour?: boolean): number; + + /** + * Returns the filename associated with the given database name. Defaults to + * `main`. Throws if this database is `close()`d. + */ + dbFilename(dbName?: string): string | null; + + /** + * Returns the name of the given 0-based db number. Defaults to `0`. Throws if + * this database is `close()`d. + */ + dbName(dbIndex?: number): string | null; + + /** + * Returns the name of the sqlite_vfs for the given database. Defaults to + * `main`. Throws if this database is `close()`d. + */ + dbVfsName(dbName?: string | number): string | undefined; + + /** + * Creates a new scalar, aggregate, or window function which is accessible via + * SQL code. + * + * When called from SQL, arguments to the UDF, and its result, will be + * converted between JS and SQL with as much fidelity as is feasible, + * triggering an exception if a type conversion cannot be determined. Some + * freedom is afforded to numeric conversions due to friction between the JS + * and C worlds: integers which are larger than 32 bits will be treated as + * doubles or `BigInt` values. + * + * UDFs cannot currently be removed from a DB handle after they're added. More + * correctly, they can be removed as documented for + * `sqlite3_create_function_v2()`, but doing so will "leak" the JS-created + * WASM binding of those functions. + * + * The first two call forms can only be used for creating scalar functions. + * Creating an aggregate or window function requires the options-object form, + * as described below. + */ + createFunction( + name: string, + func: (ctxPtr: number, ...values: SqlValue[]) => SqlValue, + ): this; + createFunction( + name: string, + func: (ctxPtr: number, ...values: SqlValue[]) => void, + options: FunctionOptions, + ): this; + createFunction( + name: string, + options: + | ScalarFunctionOptions + | AggregateFunctionOptions + | WindowFunctionOptions, + ): this; + createFunction( + options: ( + | ScalarFunctionOptions + | AggregateFunctionOptions + | WindowFunctionOptions + ) & { name: string }, + ): this; + + /** + * Prepares the given SQL, `step()`s it one time, and returns an array + * containing the values of the first result row. If it has no results, + * `undefined` is returned. If passed a second argument other than + * `undefined`, it is treated like an argument to + * {@link PreparedStatement#bind}, so may be any type supported by that + * function. Throws on error. + */ + selectArray(sql: FlexibleString, bind?: BindingSpec): SqlValue[] | undefined; + + /** + * Runs the given SQL and returns an array of all results, with each row + * represented as an array, as per the `'array'` `rowMode` option to + * {@link Database#exec}. An empty result set resolves to an empty array. The + * second argument, if any, is treated as the `bind` option to a call to + * `exec()`. Throws on error. + */ + selectArrays(sql: FlexibleString, bind?: BindingSpec): SqlValue[][]; + + /** + * Prepares the given SQL, `step()`s it one time, and returns an object + * containing the key/value pairs of the first result row. If it has no + * results, `undefined` is returned. Note that the order of returned object's + * keys is not guaranteed to be the same as the order of the fields in the + * query string. If passed a second argument other than undefined, it is + * treated like an argument to Stmt.bind(), so may be any type supported by + * that function. Throws on error. + */ + selectObject( + sql: FlexibleString, + bind?: BindingSpec, + ): { [columnName: string]: SqlValue } | undefined; + + /** + * Works identically to {@link Database#selectArrays} except that each value in + * the returned array is an object, as per the `"object"` rowMode option to + * {@link Database#exec}. + */ + selectObjects( + sql: FlexibleString, + bind?: BindingSpec, + ): { [columnName: string]: SqlValue }[]; + + /** + * Prepares the given SQL, `step()`s the resulting {@link PreparedStatement} + * one time, and returns the value of the first result column. If it has no + * results, `undefined` is returned. If passed a second argument, it is + * treated like an argument to {@link PreparedStatement#bind}, so may be any + * type supported by that function. Passing the `undefined` value is the same + * as passing no value, which is useful when... If passed a 3rd argument, it + * is expected to be one of the `SQLITE_{typename}` constants. Passing the + * `undefined` value is the same as not passing a value. Throws on error (e.g. + * malformed SQL). + */ + selectValue( + sql: FlexibleString, + bind: BindingSpec | undefined, + asType: CAPI['SQLITE_INTEGER'] | CAPI['SQLITE_FLOAT'], + ): number | undefined; + selectValue( + sql: FlexibleString, + bind: BindingSpec | undefined, + asType: CAPI['SQLITE_TEXT'], + ): string | undefined; + selectValue( + sql: FlexibleString, + bind: BindingSpec | undefined, + asType: CAPI['SQLITE_BLOB'], + ): Uint8Array | undefined; + selectValue( + sql: FlexibleString, + bind: BindingSpec | undefined, + asType: CAPI['SQLITE_NULL'], + ): null | undefined; + selectValue(sql: FlexibleString, bind?: BindingSpec): SqlValue | undefined; + + /** + * Runs the given query and returns an array of the values from the first + * result column of each row of the result set. The 2nd argument is an + * optional value for use in a single-argument call to + * {@link PreparedStatement#bind}. The 3rd argument may be any value suitable + * for use as the 2nd argument to {@link PreparedStatement#get}. If a 3rd + * argument is desired but no bind data are needed, pass `undefined` for the + * 2nd argument. If there are no result rows, an empty array is returned. + */ + selectValues( + sql: FlexibleString, + bind?: BindingSpec, + asType?: SQLiteDataType, + ): SqlValue[]; + + /** + * Returns the number of currently-opened {@link PreparedStatement} handles for + * this db handle, or 0 if this object is `close()`d. Note that only handles + * prepared via {@link Database#prepare} are counted, and not handles prepared + * using `capi.sqlite3_prepare_v3()` (or equivalent). + */ + openStatementCount(): number; + + /** + * Starts a transaction, calls the given `callback`, and then either rolls + * back or commits the transaction, depending on whether the `callback` + * throws. The `callback` is passed this object as its only argument. On + * success, returns the result of the callback. Throws on error. + * + * Note that transactions may not be nested, so this will throw if it is + * called recursively. For nested transactions, use the + * {@link Database#savepoint} method or manually manage `SAVEPOINT`s using + * {@link Database#exec}. + * + * If called with 2 arguments, the first must be a keyword which is legal + * immediately after a `BEGIN` statement, e.g. one of `"DEFERRED"`, + * `"IMMEDIATE"`, or `"EXCLUSIVE"`. Though the exact list of supported + * keywords is not hard-coded here, in order to be future-compatible, if the + * argument does not look like a single keyword then an exception is triggered + * with a description of the problem. + */ + transaction(callback: (db: this) => T): T; + transaction( + beginQualifier: 'DEFERRED' | 'IMMEDIATE' | 'EXCLUSIVE', + callback: (db: this) => T, + ): T; + + /** + * This works similarly to {@link Database#transaction} but uses sqlite3's + * `SAVEPOINT` feature. This function starts a savepoint (with an unspecified + * name) and calls the given callback function, passing it this db object. If + * the callback returns, the savepoint is released (committed). If the + * callback throws, the savepoint is rolled back. If it does not throw, it + * returns the result of the callback. + */ + savepoint(callback: (db: this) => T): T; + + /** + * Expects to be given a `DatabaseApi` instance or an `sqlite3*` pointer (may + * be `null`) and an sqlite3 API result code. If the result code is not falsy, + * this function throws an `SQLite3Error` with an error message from + * `sqlite3_errmsg()`, using the given db handle, or `sqlite3_errstr()` if the + * db handle is falsy or is a `close()`ed DB instance. Note that if it's + * passed a non-error code like `SQLITE_ROW` or `SQLITE_DONE`, it will still + * throw but the error string might be `"Not an error."` The various non-0 + * non-error codes need to be checked for in client code where they are + * expected. If it does not throw, it returns its `db` argument (`this`, if + * called as a member function). + */ + static checkRc: ( + db: Database | number | null, + resultCode: number, + ) => Database; + + /** Instance method version of {@link checkRc()}. */ + checkRc: (resultCode: number) => this; +} + +/** + * SQLite3 database backed by `localStorage` or `sessionStorage`. + * + * When the sqlite3 API is installed in the main thread, the this class is + * added, which simplifies usage of the kvvfs. + */ +declare class JsStorageDb extends Database { + /** Create a new kvvfs-backed database in local or session storage. */ + constructor(options?: { filename?: 'local' | 'session'; flags?: string }); + constructor(mode: 'local' | 'session'); + + /** Returns an _estimate_ of how many bytes of storage are used by the kvvfs. */ + storageSize(): number; + + /** + * Clears all kvvfs-owned state and returns the number of records it deleted + * (one record per database page). + */ + clearStorage(): number; +} + +/** + * SQLite3 database backed by the Origin Private File System API. + * + * Installed in the namespace only if OPFS VFS support is active. + * + * This support is only available when sqlite3.js is loaded from a Worker + * thread, whether it's loaded in its own dedicated worker or in a worker + * together with client code. This OPFS wrapper implements an `sqlite3_vfs` + * wrapper entirely in JavaScript. + * + * This feature is activated automatically if the browser appears to have the + * necessary APIs to support it. It can be tested for in JS code using one of: + * + * If(sqlite3.capi.sqlite3_vfs_find("opfs")){ ... OPFS VFS is available ... } + * // Alternately: if(sqlite3.oo1.OpfsDb){ ... OPFS VFS is available ... } + * + * If it is available, the VFS named `"opfs"` can be used with any sqlite3 APIs + * which accept a VFS name, such as `sqlite3_vfs_find()`, + * `sqlite3_db_open_v2()`, and the `sqlite3.oo1.DB` constructor, noting that + * {@link OpfsDb} is a convenience subclass of {@link Database} which + * automatically uses this VFS. For URI-style names, use `file:my.db?vfs=opfs`. + * + * ## ⚠️Achtung: Safari versions < 17: + * + * Safari versions less than version 17 are incompatible with the current OPFS + * VFS implementation because of a bug in storage handling from sub-workers. + * There is no workaround for that - supporting it will require a separate VFS + * implementation and we do not, as of July 2023, have an expected time frame + * for its release. Both the `SharedAccessHandle` pool VFS and the WASMFS + * support offers alternatives which should work with Safari versions 16.4 or + * higher. + * + * ## ⚠️Achtung: COOP and COEP HTTP Headers + * + * In order to offer some level of transparent concurrent-db-access support, + * JavaScript's SharedArrayBuffer type is required for the OPFS VFS, and that + * class is only available if the web server includes the so-called COOP and + * COEP response headers when delivering scripts: + * + * Cross-Origin-Embedder-Policy: require-corp + * Cross-Origin-Opener-Policy: same-origin + * + * Without these headers, the `SharedArrayBuffer` will not be available, so the + * OPFS VFS will not load. That class is required in order to coordinate + * communication between the synchronous and asynchronous parts of the + * `sqlite3_vfs` OPFS proxy. + * + * The COEP header may also have a value of `credentialless`, but whether or not + * that will work in the context of any given application depends on how it uses + * other remote assets. + * + * How to emit those headers depends on the underlying web server. + */ +declare class OpfsDatabase extends Database { + /** + * Creates a connection to the given file, optionally creating it if needed. + * + * @param filename The filename to open. Must be resolvable using whatever + * filesystem layer (virtual or otherwise) is set up for the default sqlite3 + * VFS. Note that the special sqlite3 db names `":memory:"` and `""` + * (temporary db) have their normal special meanings here. + * @param flags The flags to use when opening the file. It must be a string + * containing a sequence of letters (in any order, but case sensitive) + * specifying the mode: + * + * - `c`: create if it does not exist, else fail if it does not exist. Implies + * the `w` flag. Will create all directorries leading up to the file. + * - `w`: write. Implies `r`: a db cannot be write-only. + * - `r`: read-only if neither `w` nor `c` are provided, else it is ignored. + * - `t`: enable tracing of SQL executed on this database handle, sending it to + * `console.log()`. To disable it later, call + * `sqlite3.capi.sqlite3_trace_v2(thisDb.pointer, 0, 0, 0)`. If `w` is + * not provided, the db is implicitly read-only, noting that `rc` is + * meaningless. Any other letters are currently ignored. The default is + * `c`. These modes are ignored for the special `":memory:"` and `""` + * names and may be ignored by specific VFSes. + */ + constructor(filename: string, flags?: string); + + /** + * Import a database into OPFS storage. It only works with database files and + * will throw if passed a different file type. + */ + static importDb( + filename: string, + data: + | Uint8Array + | ArrayBuffer + | (() => Uint8Array | ArrayBuffer | undefined) + | (() => Promise), + ): Promise; +} + +declare class OpfsSAHPoolDatabase extends OpfsDatabase { + constructor(filename: string); +} + +type SAHPoolUtil = { + OpfsSAHPoolDb: typeof OpfsSAHPoolDatabase; + + /** + * Adds `numEntries` entries to the current pool. + * + * This change is persistent across sessions so should not be called + * automatically at each app startup (but see `reserveMinimumCapacity()`). Its + * returned Promise resolves to the new capacity. Because this operation is + * necessarily asynchronous, the C-level VFS API cannot call this on its own + * as needed. + */ + addCapacity: (numEntries: number) => Promise; + + /** + * Synchronously reads the contents of the given file into a `Uint8Array` and + * returns it. + * + * This will throw if the given name is not currently in active use or on I/O + * error. Note that the given name is not visible directly in OPFS (or, if it + * is, it's not from this VFS). The reason for that is that this VFS manages + * name-to-file mappings in a roundabout way in order to maintain its list of + * SAHs. + */ + exportFile: (filename: string) => Promise; + + /** + * Returns the number of files currently contained in the SAH pool. + * + * The default capacity is only large enough for one or two databases and + * their associated temp files. + */ + getCapacity: () => number; + + /** + * Returns the number of files from the pool currently allocated to VFS slots. + * + * This is not the same as the files being "opened". + */ + getFileCount: () => number; + + /** + * Returns an array of the names of the files currently allocated to VFS + * slots. + * + * This list is the same length as `getFileCount()`. + */ + getFileNames: () => string[]; + + /** + * Imports the contents of an SQLite database, provided as a byte array or + * ArrayBuffer, under the given name, overwriting any existing content. + * + * Throws if the pool has no available file slots, on I/O error, or if the + * input does not appear to be a database. In the latter case, only a cursory + * examination is made. + * + * Note that this routine is only for importing database files, not arbitrary + * files, the reason being that this VFS will automatically clean up any + * non-database files so importing them is pointless. + * + * If passed a function for its second argument, its behavior changes to + * asynchronous, and it imports its data in chunks fed to it by the given + * callback function. It calls the callback (which may be async) repeatedly, + * expecting either a Uint8Array or ArrayBuffer (to denote new input) or + * undefined (to denote EOF). + * + * For so long as the callback continues to return non-undefined, it will + * append incoming data to the given VFS-hosted database file. The result of + * the resolved Promise when called this way is the size of the resulting + * database. + * + * On success, the number of bytes written is returned. On success this + * routine rewrites the database header bytes in the output file (not the + * input array) to force disabling of WAL mode. + * + * On a write error, the handle is removed from the pool and made available + * for re-use. + */ + importDb: ( + name: string, + data: + | Uint8Array + | ArrayBuffer + | (() => Uint8Array | ArrayBuffer | undefined) + | (() => Promise), + ) => Promise; + + /** + * Removes up to `numEntries` entries from the pool, with the caveat that it + * can only remove currently-unused entries. + * + * It returns a Promise which resolves to the number of entries actually + * removed. + */ + reduceCapacity: (numEntries: number) => Promise; + + /** + * Unregisters the VFS and removes its directory from OPFS (which means all + * client content is destroyed). After calling this, the VFS may no longer be + * used and there is currently no way to re-add it aside from reloading the + * current JavaScript context. + * + * Results are undefined if a database is currently in use with this VFS. + * + * The returned Promise resolves to true if it performed the removal and false + * if the VFS was not installed. + * + * If the VFS has a multi-level directory, e.g. "/foo/bar/baz", only the + * bottom-most directory is removed because this VFS cannot know for certain + * whether the higher-level directories contain data which should be removed. + */ + removeVfs: () => Promise; + + /** + * If the current capacity is less than `minCapacity`, the capacity is + * increased to `minCapacity`, else this returns with no side effects. + * + * The resulting Promise resolves to the new capacity. + */ + reserveMinimumCapacity: (minCapacity: number) => Promise; + + /** + * If a virtual file exists with the given name, disassociates it from the + * pool and returns true, else returns false without side effects. Results are + * undefined if the file is currently in active use. Recall that names need to + * use absolute paths (starting with a slash). + */ + unlink: (filename: string) => boolean; + + /** The SQLite VFS name under which this pool's VFS is registered. */ + vfsName: string; + + /** + * Clears all client-defined state of all SAHs and makes all of them available + * for re-use by the pool. Results are undefined if any such handles are + * currently in use, e.g. by an sqlite3 db. + */ + wipeFiles: () => Promise; + + /** + * Unregister this VFS and release file access handles, without clearing + * files. The database must be closed before calling this. + */ + pauseVfs: () => SAHPoolUtil; + + /** Returns `true` if this VFS pool is paused */ + isPaused: () => boolean; + + /** + * Re-register this VFS and re-acquire file access handles. Any previously + * open databases will have to be re-opened after calling this. + */ + unpauseVfs: () => Promise; +}; + +/** Exception class for reporting WASM-side allocation errors. */ +declare class WasmAllocError extends Error { + constructor(message: string); + toss: any; +} + +/** Exception class used primarily by the oo1 API. */ +declare class SQLite3Error extends Error { + constructor(message: string); + resultCode: number; +} + +/** A pointer to a location in WASM heap memory. */ +declare type WasmPointer = number; + +declare type NullPointer = 0 | null | undefined; + +declare type StructPtrMapper = { + StructType: T; + /** + * Creates a new StructType object, writes its `pointer` value to the given + * output pointer, and returns that object. Its intended usage depends on + * StructType: + * + * - `sqlite3_vtab`: to be called from `sqlite3_module::xConnect()` or + * `xCreate()` implementations. + * - `sqlite3_vtab_cursor`: to be called from 1xOpen()`. + * + * This will throw if allocation of the `StructType` instance fails or if + * `ppOut` is not a pointer-type value. + */ + create: (ptr: WasmPointer) => T; + + /** + * Returns the StructType object previously mapped to the given pointer using + * `create()`. Its intended usage depends on `StructType`: + * + * - `sqlite3_vtab`: to be called from sqlite3_module methods which take a + * `(sqlite3_vtab*)` pointer _except_ for `xDestroy()`/`xDisconnect()`, in + * which case `unget()` or `dispose()`. + * - `sqlite3_vtab_cursor`: to be called from any `sqlite3_module` methods which + * take a `sqlite3_vtab_cursor*` argument except `xClose()`, in which case + * use `unget()` or `dispose()`. + * + * Rule to remember: _never_ call `dispose()` on an instance returned by this + * function. + */ + get: (ptr: WasmPointer) => T; + + /** + * Identical to get() but also disconnects the mapping between the given + * pointer and the returned StructType object, such that future calls to this + * function or get() with the same pointer will return the undefined value. + * Its intended usage depends on StructType: + * + * - `sqlite3_vtab`: to be called from `sqlite3_module::xDisconnect()` or + * `xDestroy()` implementations or in error handling of a failed `xCreate()` + * or `xConnect()`. + * - `sqlite3_vtab_cursor`: to be called from `xClose()` or during cleanup in a + * failed `xOpen()`. + * + * Calling this method obligates the caller to call `dispose()` on the + * returned object when they're done with it. + */ + unget: (ptr: WasmPointer, val: T) => void; + + /** Works like `unget()` plus it calls `dispose()` on the `StructType` object. */ + dispose: (ptr: WasmPointer) => void; +}; + +declare class SQLiteStruct { + /** + * Calling a constructor with no arguments creates a new instance in the WASM + * heap in order to connect it to C. In this case, client JavaScript code owns + * the memory for the instance unless some API explicitly takes it over. + * + * Passing a WASM pointer to the constructor creates a JS-level wrapper for an + * existing instance of the struct (whether it comes from C or JS) without + * taking over ownership of that memory. This permits JS to manipulate + * instances created in C without taking over their memory. + * + * Both uses are fairly common, and they differ only in how they manage (or + * not) the struct's memory. + * + * So long as a struct instance is active, its pointer property resolves to + * its WASM heap memory address. That value can be passed to any C routines + * which take pointers of that type. For example: + * + * const m = new MyStruct(); + * functionTakingMyStructPointers(m.pointer); + */ + constructor(pointer?: WasmPointer); + + /** The WASM pointer to the struct. */ + pointer: WasmPointer; + + /** + * When client code is finished with an instance, and no C-level code is using + * its memory, the struct instance must be cleaned up by calling + * theStruct.dispose(). Calling dispose() multiple times is harmless - calls + * after the first are no-ops. Calling dipose() is not strictly required for + * wrapped instances, as their WASM heap memory is owned elsewhere, but it is + * good practice to call it because each instance may own memory other than + * the struct memory. + */ + dispose(): void; + + /** + * If a given JS-side struct instance has a property named `ondispose`, that + * property is used when `dispose()` is called in order to free up any + * additional resources which may be associated with the struct (e.g. + * C-allocated strings or other struct instances). + * + * `ondispose` is not set by default but may be set by the client to one of + * the following: + * + * - If it's a function, it is called with no arguments and the being-disposed + * object as its this. It may perform arbitrary cleanup. + * - If it's an array, each entry of the array may be any of: + * + * - A function is called as described above. + * - Any JS-bound struct instance has its dispose() method called. + * - A number is assumed to be a WASM pointer, which gets freed using + * sqlite3.wasm.dealloc(). + * - Any other value type is ignored. It is sometimes convenient to annotate the + * array with string entries to assist in understanding the code. For + * example: + * + * X.ondispose = ['Wrapper for this.$next:', y]; + * + * Any exceptions thrown by ondispose callbacks are ignored but may induce a + * warning in the console. + */ + ondispose?: + | (() => void) + | ((() => void) | SQLiteStruct | WasmPointer | string)[]; + + /** + * Client code may call `aStructInstance.addOnDispose()` to push one or more + * arguments onto the disposal list. That function will create an `ondispose` + * array if needed, or move a non-array `ondispose` value into a newly-created + * `ondispose` array. It returns its `this`. + */ + addOnDispose(val: (() => void) | SQLiteStruct | WasmPointer | string): this; + + /** + * Overwrites (without freeing) any existing value in that member, replaces it + * with a newly-allocated C-string, and stores that C-string in the instance's + * ondispose state for cleanup when `dispose()` is called. The struct cannot + * know whether it is safe to free such strings when overwriting them, so + * instead adds each string set this way to the ondispose list. + */ + setMemberCString(memberName: string, jsString: string): void; + + /** + * Fetches the member's value. If it's `NULL`, `null` is returned, else it is + * assumed to be a valid C-style string and a copy of it is returned as a JS + * string. + */ + memberToJsString(memberName: string): string | null; + + /** Returns true if the given member name is specifically tagged as a string. */ + memberIsString(memberName: string): boolean; + + /** + * Installs a StructBinder-bound function pointer member of the given name and + * function in this object. + * + * It creates a WASM proxy for the given function and arranges for that proxy + * to be cleaned up when `this.dispose()` is called. Throws on the slightest + * hint of error, e.g., the given name does not map to a struct-bound member. + * + * As a special case, if the given function is a pointer, then + * `wasm.functionEntry()` is used to validate that it is a known function. If + * so, it is used as-is with no extra level of proxying or cleanup, else an + * exception is thrown. It is legal to pass a value of 0, indicating a `NULL` + * pointer, with the caveat that 0 is a legal function pointer in WASM but it + * will not be accepted as such here. (Justification: the function at address + * zero must be one which initially came from the WASM module, not a method we + * want to bind to client-level extension code.) + * + * This function returns a proxy for itself which is bound to `this` and takes + * 2 args `(name,func)`. That function returns the same thing as this one, + * permitting calls to be chained. + * + * If called with only 1 arg, it has no side effects but returns a func with + * the same signature as described above. + * + * **⚠ACHTUNG:⚠** because we cannot generically know how to transform JS + * exceptions into result codes, the installed functions do no automatic + * catching of exceptions. It is critical, to avoid undefined behavior in the + * C layer, that methods mapped via this function do not throw. The exception, + * as it were, to that rule is... + * + * If `applyArgcCheck` is true then each JS function (as opposed to function + * pointers) gets wrapped in a proxy which asserts that it is passed the + * expected number of arguments, throwing if the argument count does not match + * expectations. That is only intended for dev-time usage for sanity checking, + * as exceptions passing through such methods will leave the C environment in + * an undefined state. + */ + installMethod( + name: string, + func: Function | WasmPointer, + applyArgcCheck?: boolean, + ): (name: string, func: Function | WasmPointer) => this; + + /** Behaves exactly like {@link SQLiteStruct#installMethods}. */ + installMethod( + methodsObject: { [methodName: string]: Function }, + applyArgcCheck?: boolean, + ): this; + + /** + * Installs methods into this StructType-type instance. Each entry in the + * given methods object must map to a known member of the given StructType, + * else an exception will be triggered. See `installMethod()` for more + * details, including the semantics of the second argument. + * + * As an exception to the above, if any two or more methods in the methods + * object are the exact same function, `installMethod()` is not called for the + * 2nd and subsequent instances, and instead those instances get assigned the + * same method pointer which is created for the first instance. This + * optimization is primarily to accommodate special handling of + * `sqlite3_module::xConnect` and `xCreate` methods. + * + * On success, returns this object. Throws on error. + */ + installMethods( + methodsObject: { [methodName: string]: Function }, + applyArgcCheck?: boolean, + ): this; +} + +declare class sqlite3_vfs extends SQLiteStruct { + $iVersion: number; + $szOsFile: number; + $mxPathname: number; + pNext: WasmPointer; + $zName: WasmPointer; + pAppData: WasmPointer; + + constructor(pointer?: WasmPointer); + xOpen: ( + vfsPtr: WasmPointer, + zName: WasmPointer, + file: WasmPointer, + flags: number, + pOutputFlags: WasmPointer, + ) => number; + xDelete: (vfsPtr: WasmPointer, zName: WasmPointer, syncDir: number) => number; + xAccess: ( + vfsPtr: WasmPointer, + zName: WasmPointer, + flags: number, + pResOut: WasmPointer, + ) => number; + xFullPathname: ( + vfsPtr: WasmPointer, + zName: WasmPointer, + nOut: number, + zOut: WasmPointer, + ) => number; + xDlOpen: (vfsPtr: WasmPointer, zFilename: WasmPointer) => WasmPointer; + xDlError: (vfsPtr: WasmPointer, nByte: number, zErrMsg: WasmPointer) => void; + xDlSym: ( + vfsPtr: WasmPointer, + pHandle: WasmPointer, + zSymbol: WasmPointer, + ) => WasmPointer; + xDlClose: (vfsPtr: WasmPointer, pHandle: WasmPointer) => void; + xRandomness: ( + vfsPtr: WasmPointer, + nByte: number, + zOut: WasmPointer, + ) => number; + xSleep: (vfsPtr: WasmPointer, microseconds: number) => number; + xCurrentTime: (vfsPtr: WasmPointer, pTimeOut: WasmPointer) => number; + xGetLastError: (vfsPtr: WasmPointer, nBuf: number, zBuf: WasmPointer) => void; + xCurrentTimeInt64: (vfsPtr: WasmPointer, pTimeOut: WasmPointer) => number; + xSetSystemCall: ( + vfsPtr: WasmPointer, + zName: WasmPointer, + pCall: WasmPointer, + ) => number; + xGetSystemCall: ( + vfsPtr: WasmPointer, + zName: WasmPointer, + pCall: WasmPointer, + ) => WasmPointer; + xNextSystemCall: (vfsPtr: WasmPointer, zName: WasmPointer) => WasmPointer; +} + +declare class sqlite3_io_methods extends SQLiteStruct { + iVersion: number; + + constructor(pointer?: WasmPointer); + xClose: (file: WasmPointer) => number; + xRead: ( + file: WasmPointer, + buf: WasmPointer, + iAmt: number, + iOfst: number, + ) => number; + xWrite: ( + file: WasmPointer, + buf: WasmPointer, + iAmt: number, + iOfst: number, + ) => number; + xTruncate: (file: WasmPointer, size: number) => number; + xSync: (file: WasmPointer, flags: number) => number; + xFileSize: (file: WasmPointer, pSize: WasmPointer) => number; + xLock: (file: WasmPointer, lockType: number) => number; + xUnlock: (file: WasmPointer, lockType: number) => number; + xCheckReservedLock: (file: WasmPointer, pResOut: WasmPointer) => number; + xFileControl: (file: WasmPointer, op: number, pArg: WasmPointer) => number; + xSectorSize: (file: WasmPointer) => number; + xDeviceCharacteristics: (file: WasmPointer) => number; + xShmMap: ( + file: WasmPointer, + iPg: number, + pgsz: number, + bExtend: number, + pp: WasmPointer, + ) => number; + xShmLock: ( + file: WasmPointer, + offset: number, + n: number, + flags: number, + ) => number; + xShmBarrier: (file: WasmPointer) => void; + xShmUnmap: (file: WasmPointer, deleteFlag: number) => number; + xFetch: ( + file: WasmPointer, + iOfst: number, + iAmt: number, + pp: WasmPointer, + ) => number; + xUnfetch: (file: WasmPointer, iOfst: number, p: WasmPointer) => number; +} + +declare class sqlite3_file extends SQLiteStruct { + $pMethods: WasmPointer; + structInfo: { + sizeof: number; + name: string; + members: { + [memberName: string]: { + offset: number; + signature: string; + sizeof: number; + name: string; + key: string; + }; + }; + }; + + constructor(pointer?: WasmPointer); +} + +declare class sqlite3_vtab extends SQLiteStruct { + pModule: WasmPointer; + nRef: number; + zErrMsg: WasmPointer; + + constructor(pointer?: WasmPointer); +} + +declare class sqlite3_vtab_cursor extends SQLiteStruct { + pVtab: WasmPointer; + + constructor(pointer?: WasmPointer); +} + +declare class sqlite3_module extends SQLiteStruct { + iVersion: number; + + constructor(pointer?: WasmPointer); + xCreate: ( + db: WasmPointer, + pAux: WasmPointer, + argc: number, + argv: WasmPointer, + ppVtab: WasmPointer, + pzErr: WasmPointer, + ) => number; + xConnect: ( + db: WasmPointer, + pAux: WasmPointer, + argc: number, + argv: WasmPointer, + ppVtab: WasmPointer, + pzErr: WasmPointer, + ) => number; + xBestIndex: ( + pVtab: WasmPointer, + pIndexInfo: WasmPointer, + pp: WasmPointer, + pCost: WasmPointer, + ) => number; + xDisconnect: (pVtab: WasmPointer) => number; + xDestroy: (pVtab: WasmPointer) => number; + xOpen: (pVtab: WasmPointer, ppCursor: WasmPointer) => number; + xClose: (pCursor: WasmPointer) => number; + xFilter: ( + pCursor: WasmPointer, + idxNum: number, + idxStr: WasmPointer, + argc: number, + argv: WasmPointer, + ) => number; + xNext: (pCursor: WasmPointer) => number; + xEof: (pCursor: WasmPointer) => number; + xColumn: (pCursor: WasmPointer, pContext: WasmPointer, i: number) => number; + xRowid: (pCursor: WasmPointer, pRowid: WasmPointer) => number; + xUpdate: ( + pVtab: WasmPointer, + argc: number, + argv: WasmPointer, + pRowid: WasmPointer, + ) => number; + xBegin: (pVtab: WasmPointer) => number; + xSync: (pVtab: WasmPointer) => number; + xCommit: (pVtab: WasmPointer) => number; + xRollback: (pVtab: WasmPointer) => number; + xFindFunction: ( + pVtab: WasmPointer, + nArg: number, + zName: WasmPointer, + pxFunc: WasmPointer, + ppArg: WasmPointer, + ) => number; + xRename: (pVtab: WasmPointer, zNew: WasmPointer) => number; + xSavepoint: (pVtab: WasmPointer, iSavepoint: number) => number; + xRelease: (pVtab: WasmPointer, iSavepoint: number) => number; + xRollbackTo: (pVtab: WasmPointer, iSavepoint: number) => number; + xShadowName: (tableName: WasmPointer) => number; +} + +declare class sqlite3_index_constraint extends SQLiteStruct { + iColumn: number; + op: number; + usable: number; + iTermOffset: number; + + constructor(pointer?: WasmPointer); +} + +declare class sqlite3_index_constraint_usage extends SQLiteStruct { + argvIndex: number; + omit: number; + + constructor(pointer?: WasmPointer); +} + +declare class sqlite3_index_orderby extends SQLiteStruct { + iColumn: number; + desc: number; + + constructor(pointer?: WasmPointer); +} + +declare class sqlite3_index_info extends SQLiteStruct { + nConstraint: number; + aConstraint: WasmPointer; + nOrderBy: number; + aOrderBy: WasmPointer; + aConstraintUsage: WasmPointer; + idxNum: number; + idxStr: WasmPointer; + needToFreeIdxStr: number; + orderByConsumed: number; + estimatedCost: number; + estimatedRows: bigint; + idxFlags: number; + colUsed: bigint; + sqlite3_index_constraint: sqlite3_index_constraint; + sqlite3_index_orderby: sqlite3_index_orderby; + sqlite3_index_constraint_usage: sqlite3_index_constraint_usage; + + constructor(pointer?: WasmPointer); +} + +declare type Sqlite3Static = { + /** The namespace for the C-style APIs. */ + capi: CAPI; + + /** + * WASM-specific utilities, abstracted to be independent of, and configurable + * for use with, arbitrary WASM runtime environments. + */ + wasm: WASM_API; + + /** The OO API #1. */ + oo1: { + OpfsDb: typeof OpfsDatabase; + JsStorageDb: typeof JsStorageDb; + DB: typeof Database; + }; + + /** Version numbers */ + version: { + libVersion: string; + libVersionNumber: number; + sourceId: string; + downloadVersion: number; + }; + + /** + * Initializes the Worker API. + * + * Required to to permit this API to be loaded in Worker threads without + * automatically registering onmessage handlers + * + * If this function is called from a non-worker thread then it throws an + * exception. It must only be called once per Worker. + */ + initWorker1API(): void; + + installOpfsSAHPoolVfs(opts: { + /** + * If truthy (default=false) contents and filename mapping are removed from + * each SAH it is acquired during initalization of the VFS, leaving the + * VFS's storage in a pristine state. Use this only for databases which need + * not survive a page reload. + */ + clearOnInit?: boolean; + + /** + * (default=6) Specifies the default capacity of the VFS. + * + * This should not be set unduly high because the VFS has to open (and keep + * open) a file for each entry in the pool. This setting only has an effect + * when the pool is initially empty. It does not have any effect if a pool + * already exists. Note that this number needs to be at least twice the + * number of expected database files (to account for journal files) and may + * need to be even higher than three times the number of databases plus one, + * depending on the value of the `TEMP_STORE` pragma and how the databases + * are used. + */ + initialCapacity?: number; + + /** + * (default="."+options.name) Specifies the OPFS directory name in which to + * store metadata for the VFS. + * + * Only one instance of this VFS can use the same directory concurrently. + * Using a different directory name for each application enables different + * engines in the same HTTP origin to co-exist, but their data are invisible + * to each other. Changing this name will effectively orphan any databases + * stored under previous names. This option may contain multiple path + * elements, e.g. "/foo/bar/baz", and they are created automatically. In + * practice there should be no driving need to change this. + * + * **ACHTUNG:** all files in this directory are assumed to be managed by the + * VFS. Do not place other files in this directory, as they may be deleted + * or otherwise modified by the VFS. + */ + directory?: string; + + /** + * (default="opfs-sahpool") sets the name to register this VFS under. + * + * Normally this should not be changed, but it is possible to register this + * VFS under multiple names so long as each has its own separate directory + * to work from. The storage for each is invisible to all others. The name + * must be a string compatible with `sqlite3_vfs_register()` and friends and + * suitable for use in URI-style database file names. + * + * **ACHTUNG:** if a custom name is provided, a custom directory must also + * be provided if any other instance is registered with the default + * directory. No two instances may use the same directory. If no directory + * is explicitly provided then a directory name is synthesized from the name + * option. + */ + name?: string; + }): Promise; + + WasmAllocError: typeof WasmAllocError; + + SQLite3Error: typeof SQLite3Error; + + /** + * The options with which the API was configured. Whether or not modifying + * them after the bootstrapping process will have any useful effect is + * unspecified and may change with any given version. Clients must not rely on + * that capability. + */ + config: { + exports: any; + memory: WebAssembly.Memory; + bigIntEnabled: boolean; + debug: typeof console.debug; + warn: typeof console.warn; + error: typeof console.error; + log: typeof console.log; + wasmOpfsDir: string; + useStdAlloc: boolean; + allocExportName: string; + deallocExportName: string; + reallocExportName: string; + }; + + /** + * The library reserves this property for client-side use and promises to + * never define a property with this name nor to ever rely on specific + * contents of it. It makes no such guarantees for other properties. + */ + client: any; + + /* Utility code for creating sqlite3_vfs's. */ + vfs: { + /** + * A wrapper for installMethods() or registerVfs() to reduce installation of + * a VFS and/or its I/O methods to a single call. + * + * Accepts an object which contains the properties `"io"` and/or `"vfs"`, + * each of which is itself an object with following properties: + * + * - `struct`: an `sqlite3.StructType`-type struct. This must be a populated + * (except for the methods) object of type `sqlite3_io_methods` (for the + * `"io"` entry) or `sqlite3_vfs` (for the `"vfs"` entry). + * - `methods`: an object mapping `sqlite3_io_methods` method names (e.g. + * `'xClose'`) to JS implementations of those methods. The JS + * implementations must be call-compatible with their native + * counterparts. + * + * For each of those object, this function passes its (`struct`, `methods`, + * (optional) `applyArgcCheck`) properties to `installMethods()`. + * + * If the `vfs` entry is set then: + * + * - Its `struct` property's `registerVfs()` is called. The `vfs` entry may + * optionally have an `asDefault` property, which gets passed as the + * argument to `registerVfs()`. + * - If `struct.$zName` is falsy and the entry has a string-type `name` + * property, `struct.$zName` is set to the C-string form of that `name` + * value before `registerVfs()` is called. That string gets added to the + * on-dispose state of the struct. + * + * On success returns this object. Throws on error. + */ + installVfs: (obj: { + io?: { + struct: sqlite3_io_methods; + methods: { + [K in keyof sqlite3_io_methods as K extends `x${string}` + ? K + : never]?: sqlite3_io_methods[K]; + }; + applyArgcCheck?: boolean; + }; + vfs?: { + struct: sqlite3_vfs; + methods: { + [K in keyof sqlite3_vfs as K extends `x${string}` + ? K + : never]?: sqlite3_vfs[K]; + }; + applyArgcCheck?: boolean; + name?: string; + asDefault?: boolean; + }; + }) => Sqlite3Static['vfs']; + }; + + /** Utility code for creating virtual table implementations. */ + vtab: { + /** + * A lifetime-management object for mapping `sqlite3_vtab*` instances in + * `sqlite3_module` methods to `capi.sqlite3_vtab` objects. + */ + xVtab: StructPtrMapper; + + /** + * A lifetime-management object for mapping `sqlite3_vtab_cursor*` instances + * in sqlite3_module methods to `capi.sqlite3_vtab_cursor` objects. + */ + xCursor: StructPtrMapper; + + /** + * Convenience form of creating an `sqlite3_index_info` wrapper, intended + * for use in `xBestIndex` implementations. Note that the caller is expected + * to call `dispose()` on the returned object before returning. Though not + * _strictly_ required, as that object does not own the `pIdxInfo` memory, + * it is nonetheless good form. + */ + xIndexInfo: (pIdxInfo: WasmPointer) => sqlite3_index_info; + + /** + * Given an `sqlite3_module` method name and error object, this function + * returns `sqlite3.capi.SQLITE_NOMEM` if `(e instanceof + * sqlite3.WasmAllocError)`, else it returns its second argument. Its + * intended usage is in the methods of a `sqlite3_vfs` or `sqlite3_module`: + * + * try{ + * let rc = ... + * return rc; + * }catch(e){ + * return sqlite3.vtab.xError( + * 'xColumn', e, sqlite3.capi.SQLITE_XYZ); + * // where SQLITE_XYZ is some call-appropriate result code. + * } + * + * If no 3rd argument is provided, its default depends on the error type: + * + * - An `sqlite3.WasmAllocError` always resolves to `capi.SQLITE_NOMEM`. + * - If `err` is an SQLite3Error then its `resultCode` property is used. + * - If all else fails, `capi.SQLITE_ERROR` is used. + * + * If `xError.errorReporter` is a function, it is called in order to report + * the error, else the error is not reported. If that function throws, that + * exception is ignored. + */ + xError: ((methodName: string, err: Error, defaultRc: number) => number) & { + errorReporter?: (errorStr: string) => void; + }; + + /** + * A helper for `sqlite3_vtab::xRowid()` and `xUpdate()` implementations. It + * must be passed the final argument to one of those methods (an output + * pointer to an int64 row ID) and the value to store at the output + * pointer's address. Returns the same as `wasm.poke()` and will throw if + * the 1st or 2nd arguments are invalid for that function. + * + * Example `xRowid` impl: + * + * const xRowid = (pCursor, ppRowid64) => { + * const c = vtab.xCursor(pCursor); + * vtab.xRowid(ppRowid64, c.myRowId); + * return 0; + * }; + */ + xRowid: (ppRowId64: WasmPointer, value: number) => WASM_API; + + /** + * A helper to initialize and set up an `sqlite3_module` object for later + * installation into individual databases using `sqlite3_create_module()`. + * + * If `catchExceptions` is false, it is up to the client to ensure that no + * exceptions escape the methods, as doing so would move them through the C + * API, leading to undefined behavior. (vtab.xError() is intended to assist + * in reporting such exceptions.) + * + * This is to facilitate creation of those methods inline in the passed-in + * object without requiring the client to explicitly get a reference to one + * of them in order to assign it to the other one. + * + * The `catchExceptions`-installed handlers will account for identical + * references to the above functions and will install the same wrapper + * function for both. + * + * The given methods are expected to return integer values, as expected by + * the C API. If `catchExceptions` is truthy, the return value of the + * wrapped function will be used as-is and will be translated to 0 if the + * function returns a falsy value (e.g. if it does not have an explicit + * return). If `catchExceptions` is _not_ active, the method implementations + * must explicitly return integer values. + * + * Throws on error. On success, returns the sqlite3_module object (`this` or + * `opt.struct` or a new sqlite3_module instance, depending on how it's + * called). + */ + setupModule: { + /** + * An object containing a mapping of properties with the C-side names of + * the sqlite3_module methods, e.g. `xCreate`, `xBestIndex`, etc., to JS + * implementations for those functions. + * + * Certain methods may refer to the same implementation. To simplify the + * definition of such methods: + * + * - If `methods.xConnect` is `true` then the value of `methods.xCreate` is + * used in its place, and vice versa. sqlite treats xConnect/xCreate + * functions specially if they are exactly the same function (same + * pointer value). + * - If `methods.xDisconnect` is true then the value of `methods.xDestroy` + * is used in its place, and vice versa. + */ + methods: Omit & + ( + | { + xConnect: undefined; + } + | { xCreate: undefined } + ) & + ( + | { + xDisconnect: undefined; + } + | { xDestroy: undefined } + ); + + /** + * (default=false): if truthy, the given methods are not mapped as-is, but + * are instead wrapped inside wrappers which translate exceptions into + * result codes of SQLITE_ERROR or SQLITE_NOMEM, depending on whether the + * exception is an sqlite3.WasmAllocError. In the case of the xConnect and + * xCreate methods, the exception handler also sets the output error + * string to the exception's error string. + */ + catchExceptions?: boolean; + + /** + * A `sqlite3.capi.sqlite3_module()` instance. If not set, one will be + * created automatically. If the current `"this"` is-a `sqlite3_module` + * then it is unconditionally used in place of `struct`. + */ + struct?: sqlite3_module; + + /** + * If set, it must be an integer value and it gets assigned to the + * `$iVersion` member of the struct object. If it's _not_ set, and the + * passed-in `struct` object's `$iVersion` is 0 (the default) then this + * function attempts to define a value for that property based on the list + * of methods it has. + */ + iVersion?: number; + }; + }; +}; + +declare type InitOptions = { + locateFile?: (path: string, prefix: string) => string; + print?: (msg: string) => void; + printErr?: (msg: string) => void; +}; + +/** + * A function installed by Emscripten to load and initialize the module. It + * accepts an optional object to act as the so-called Emscripten Module, with + * which the client may be notified of loading progress an errors. + * + * See the [Emscripten docs on the topic][1] for full details. + * + * Note that this project has no influence over those options and the Emscripten + * project may change them at any time, so we neither document nor support them. + * Note, also, that this project may attempt to internally override any specific + * option, potentially leading to undesired side effects if client code does the + * same. + * + * [1] https://emscripten.org/docs/api_reference/module.html + */ +export default function init(opts?: InitOptions): Promise; + +declare type ListLike = { + length: number; + forEach: (cb: (val: T) => void) => void; +}; + +declare type WASM_API = { + /** + * The `sqlite3.wasm.exports` namespace object is a WASM-standard part of the + * WASM module file and contains all "exported" C functions which are built + * into the WASM module, as well as certain non-function values which are part + * of the WASM module. The functions which live in this object are as + * low-level as it gets, in terms of JS/C bindings. They perform no automatic + * type conversions on their arguments or result values and many, perhaps + * most, are cumbersome to use from JS because of that. This level of the API + * is not generally recommended for client use but is available for those who + * want to make use of it. The functions in this object which are intended for + * client-side use are re-exported into the {@link CAPI} namespace and have + * automatic type conversions applied to them (where applicable). Some small + * handful of the functions get re-exported into the {@link WASM_API} + * namespace. + */ + exports: any; + + /* ========================================================================== + * Memory Management + * ========================================================================== + * Just like in C, WASM offers a memory "heap," and transfering values + * between JS and WASM often requires manipulation of that memory, including + * low-level allocation and deallocation of it. The following subsections + * describe the various memory management APIs. + */ + + /* -------------------------------------------------------------------------- + * Low-level Management + * -------------------------------------------------------------------------- + * The lowest-level memory management works like C's standard `malloc()`, + * `realloc()`, and `free()`, the one difference being that exceptions are used + * for reporting out-of-memory conditions. In order to avoid certain API + * misuses caused by mixing different allocators, the canonical sqlite3.js + * builds wrap `sqlite3_malloc()`, `sqlite3_realloc()`, and `sqlite3_free()` + * instead of `malloc()`, `realloc()`, and `free()`, but the semantics of both + * pairs are effectively identical. + */ + + /** + * Allocates n bytes of memory from the WASM heap and returns the address of + * the first byte in the block. `alloc()` throws a {@link WasmAllocError} if + * allocation fails. If non-thowing allocation is required, use + * {@link WASM_API#alloc.impl}, which returns a WASM NULL pointer (the integer + * 0) if allocation fails. + * + * Note that memory allocated this way is not automatically zeroed out. In + * practice that has not proven to be a problem (in JS, at least) because + * memory is only explicitly allocated when it has a specific use and will be + * populated by the code which allocates it. + */ + alloc: ((numBytes: number) => WasmPointer) & { + impl: (numBytes: number) => WasmPointer; + }; + + /** + * Uses {@link WASM_API#alloc} to allocate enough memory for the byte-length of + * the given JS string, plus 1 (for a `NUL` terminator), copies the given JS + * string to that memory using `jstrcpy()`, `NUL`-terminates it, and returns + * the pointer to that C-string. Ownership of the pointer is transfered to the + * caller, who must eventually pass the pointer to {@link WASM_API#dealloc} to + * free it. + * + * If passed a truthy 2nd argument then its return semantics change: it + * returns `[ptr,n]`, where `ptr` is the C-string's pointer and n is its + * cstrlen(). + */ + allocCString( + jsString: string, + returnPtrAndLength: undefined | false, + ): WasmPointer; + allocCString( + jsString: string, + returnPtrAndLength: true, + ): [WasmPointer, number]; + + /** + * Creates a C-style array, using `alloc()`, suitable for passing to a C-level + * `main()` routine. The input is a collection with a `length` property and a + * `forEach()` method. A block of memory `list.length` entries long is + * allocated and each pointer-sized block of that memory is populated with the + * `allocCString()` conversion of the `(''+value)` of each element. Returns a + * pointer to the start of the list, suitable for passing as the 2nd argument + * to a C-style `main()` function. + * + * Throws if `list.length` is falsy. + * + * Note that the returned value is troublesome to deallocate but it is + * intended for use with calling a C-level `main()` function, where the + * strings must live as long as the application. See `scopedAllocMainArgv()` + * for a variant which is trivial to deallocate. + */ + allocMainArgv: (list: ListLike<{ toString(): string }>) => WasmPointer; + + /** + * Allocates one or more pointers as a single chunk of memory and zeroes them + * out. + * + * The first argument is the number of pointers to allocate. The second + * specifies whether they should use a "safe" pointer size (8 bytes) or + * whether they may use the default pointer size (typically 4 but also + * possibly 8). + * + * How the result is returned depends on its first argument: if passed 1, it + * returns the allocated memory address. If passed more than one then an array + * of pointer addresses is returned, which can optionally be used with + * "destructuring assignment" like this: + * + * Const[(p1, p2, p3)] = allocPtr(3); + * + * **ACHTUNG:** when freeing the memory, pass only the first result value to + * `dealloc()`. The others are part of the same memory chunk and must not be + * freed separately. + * + * The reason for the 2nd argument is... + * + * When one of the returned pointers will refer to a 64-bit value, e.g. a + * `double` or `int64`, and that value must be written or fetched, e.g. using + * `poke()` or `peek()`, it is important that the pointer in question be + * aligned to an 8-byte boundary or else it will not be fetched or written + * properly and will corrupt or read neighboring memory. It is only safe to + * pass false when the client code is certain that it will only get/fetch + * 4-byte values (or smaller). + */ + allocPtr(howMany: 1 | undefined, safePtrSize?: boolean): WasmPointer; + allocPtr(howMany: number, safePtrSize?: boolean): WasmPointer[]; + + /** + * Frees memory returned by `alloc()`. Results are undefined if it is passed + * any value other than a value returned by `alloc()` or + * `null`/`undefined`/`0` (all of which are no-ops). + */ + dealloc: (ptr: WasmPointer) => void; + + /** + * Semantically equivalent to `realloc(3)` or `sqlite3_realloc()`, this + * routine reallocates memory allocated via this routine or `alloc()`. Its + * first argument is either 0 or a pointer returned by this routine or + * `alloc()`. Its second argument is the number of bytes to (re)allocate, or 0 + * to free the memory specified in the first argument. On allocation error, + * `realloc()` throws a `WasmAllocError`, whereas `realloc.impl()` will return + * `0` on allocation error. + * + * Beware that reassigning the return value of `realloc.impl()` is poor + * practice and can lead to leaks of heap memory: + * + * Let m = wasm.realloc(0, 10); // allocate 10 bytes m = + * wasm.realloc.impl(m, 20); // grow m to 20 bytes + * + * If that reallocation fails, it will return 0, overwriting `m` and + * effectively leaking the first allocation. + */ + realloc: ((ptr: WasmPointer, numBytes: number) => WasmPointer) & { + impl: (ptr: WasmPointer, numBytes: number) => WasmPointer; + }; + + /** + * For the given IR-like string in the set ('i8', 'i16', 'i32', 'f32', + * 'float', 'i64', 'f64', 'double', '_'), or any string value ending in '_', + * returns the sizeof for that value (wasm.ptrSizeof in the latter case). For + * any other value, it returns the undefined value. + * + * Some allocation routines use this enable callers to pass them an IR value + * instead of an integer. + */ + sizeofIR: ( + irStr: + | 'i8' + | 'i16' + | 'i32' + | 'f32' + | 'float' + | 'i64' + | 'f64' + | 'double' + | '_' + | string, + ) => number; + + /* -------------------------------------------------------------------------- + * "Scoped" Allocation Management + * -------------------------------------------------------------------------- + * + * It is often convenient to manage allocations in such a way that all + * allocations made in a particular block are "automatically" cleaned up + * when that block exits. This API provides "scoped" allocation routines + * which work this way. + */ + + /** + * Opens a new "scope" for allocations. All allocations made via the + * `scopedAllocXyz()` APIs will store their results into the current (most + * recently pushed) allocation scope for later cleanup. The returned value + * must be retained for passing to `scopedAllocPop()`. + * + * Any number of scopes may be active at once, but they must be popped in + * reverse order of their creation. i.e. they must nest in a manner equivalent + * to C-style scopes. + * + * **Warnings:** + * + * - All of the other `scopedAllocXyz()` routines will throw if no scope is + * active. + * - It is never legal to pass the result of a scoped allocation to `dealloc()`, + * and doing so will cause a double-free when the scope is closed with + * `scopedAllocPop()`. + * + * This function and its relatives have only a single intended usage pattern: + * + * Const scope = wasm.scopedAllocPush(); + * try { + * ... use scopedAllocXyz() routines ... + * // It is perfectly legal to use non-scoped allocations here, + * // they just won't be cleaned up when... + * } finally { + * wasm.scopedAllocPop(scope); + * } + */ + scopedAllocPush: () => WasmPointer; + + /** + * Works just like `alloc(n)` but stores the result of the allocation in the + * current scope. + * + * This function's read-only `level` property resolves to the current + * allocation scope dep + */ + scopedAlloc: ((numBytes: number) => WasmPointer) & { level: number }; + + /** + * This functions exactly like `allocMainArgv()` but is scoped to the current + * allocation scope and its contents will be freed when the current allocation + * scoped is popped. + */ + scopedAllocMainArgv: (list: ListLike<{ toString(): string }>) => WasmPointer; + + /** + * Calls `scopedAllocPush()`, calls the given `callback`, and then calls + * `scopedAllocPop()`, propagating any exception from the callback or + * returning its result. This is essentially a convenience form of: + * + * const scope = wasm.scopedAllocPush(); + * try { + * return callback(); + * } finally { + * wasm.scopedAllocPop(scope); + * } + */ + scopedAllocCall: (callback: () => T) => T; + + /** + * Works just like `allocCString()` but stores the result of the allocation in + * the current scope. + */ + scopedAllocCString( + jsString: string, + returnWithLength: undefined | false, + ): WasmPointer; + scopedAllocCString( + jsString: string, + returnPtrAndLength: true, + ): [WasmPointer, number]; + + /** + * Works just like `allocPtr()` but stores the result of the allocation in the + * current scope. + */ + scopedAllocPt(howMany: 1 | undefined, safePtrSize?: boolean): WasmPointer; + scopedAllocPtr(howMany: number, safePtrSize?: boolean): WasmPointer[]; + + /** + * Given a value returned from `scopedAllocPush()`, this "pops" that + * allocation scope and frees all memory allocated in that scope by the + * `scopedAllocXyz()` family of APIs. + * + * It is technically legal to call this without any argument, but passing an + * argument allows the allocator to perform sanity checking to ensure that + * scopes are pushed and popped in the proper order (it throws if they are + * not). Failing to pass an argument is not illegal but will make that sanity + * check impossible. + */ + scopedAllocPop: (opaque: WasmPointer) => void; + + /* -------------------------------------------------------------------------- + * "PStack" Allocation + * -------------------------------------------------------------------------- + * The "pstack" (pseudo-stack) API is a special-purpose allocator intended + * solely for use with allocating small amounts of memory such as that + * needed for output pointers. It is more efficient than the scoped + * allocation API, and covers many of the use cases for that API, but it has + * a tiny static memory limit (with an unspecified total size no less than + * 4kb). + + * The pstack API is typically used like: + * + * const pstack = sqlite3.wasm.pstack; + * const stackPtr = pstack.pointer; + * try { + * const ptr = pstack.alloc(8); + * // ==> pstack.pointer === ptr + * const otherPtr = pstack.alloc(8); + * // ==> pstack.pointer === otherPtr + * ... + * } finally { + * pstack.restore(stackPtr); + * // ==> pstack.pointer === stackPtr + * } + */ + pstack: { + /** + * Attempts to allocate the given number of bytes from the pstack. On + * success, it zeroes out a block of memory of the given size, adjusts the + * pstack pointer, and returns a pointer to the memory. On error, returns + * throws a `WasmAllocError`. The memory must eventually be released using + * `pstack.restore()`. + * + * The `n` may be a string accepted by `wasm.sizeofIR()`, and any string + * value not accepted by that function will trigger a `WasmAllocError` + * exception. + * + * This method always adjusts the given value to be a multiple of 8 bytes + * because failing to do so can lead to incorrect results when reading and + * writing 64-bit values from/to the WASM heap. Similarly, the returned + * address is always 8-byte aligned. + */ + alloc: (n: number | string) => WasmPointer; + + /** + * `Alloc()`'s `n` chunks, each `sz` bytes, as a single memory block and + * returns the addresses as an array of `n` element, each holding the + * address of one chunk. + * + * The `sz` argument may be a string value accepted by `wasm.sizeofIR()`, + * and any string value not accepted by that function will trigger a + * `WasmAllocError` exception. + * + * Throws a `WasmAllocError` if allocation fails. + * + * Example: + * + * Const[(p1, p2, p3)] = pstack.allocChunks(3, 4); + */ + allocChunks: (n: number, sz: number | string) => WasmPointer[]; + + /** + * A convenience wrapper for `allocChunks()` which sizes each chunk as + * either 8 bytes (`safePtrSize` is truthy) or `wasm.ptrSizeof` (if + * `safePtrSize` is falsy). + * + * How it returns its result differs depending on its first argument: if + * it's 1, it returns a single pointer value. If it's more than 1, it + * returns the same as `allocChunks()`. + * + * When any returned pointers will refer to a 64-bit value, e.g. a double or + * int64, and that value must be written or fetched, e.g. using + * `wasm.poke()` or `wasm.peek()`, it is important that the pointer in + * question be aligned to an 8-byte boundary or else it will not be fetched + * or written properly and will corrupt or read neighboring memory. + * + * However, when all pointers involved point to "small" data, it is safe to + * pass a falsy value to save a tiny bit of memory. + */ + allocPtr(howMany?: 1 | undefined, safePtrSize?: boolean): WasmPointer; + allocPtr(howMany: number, safePtrSize?: boolean): WasmPointer[]; + + /** + * This property resolves to the current pstack position pointer. This value + * is intended only to be saved for passing to `restore()`. Writing to this + * memory, without first reserving it via `pstack.alloc()` (or equivalent) + * leads to undefined results. + */ + pointer: WasmPointer; + + /** + * This property resolves to the total number of bytes available in the + * pstack, including any space which is currently allocated. This value is a + * compile-time constant.unknown + */ + quota: number; + + /** This property resolves to the amount of space remaining in the pstack. */ + remaining: number; + + /** + * Sets the current pstack position to the given pointer. Results are + * `undefined` if the passed-in value did not come from `pstack.pointer` or + * if memory allocated in the space before the given pointer are used after + * this call. + */ + restore: (pstackptr: WasmPointer) => void; + }; + + /* -------------------------------------------------------------------------- + * Getting/Setting Memory Values + * -------------------------------------------------------------------------- + * + * The WASM memory heap is exposed to JS as a byte array of memory which is + * made to appear contiguous (though it's really allocated in chunks). Given + * a byte-oriented view of the heap, it is possible to read and write + * individual bytes of the heap, just like in C: + * + * const X = wasm.heap8u(); // a uint8-oriented view of the heap + * X[someAddress] = 0x2a; + * console.log( X[someAddress] ); // ==> 42 + * + * Obviously, writing arbitrary addresses can corrupt the WASM heap, just like in + * C, so one has to be careful with the memory addresses the work with (just like + * in C!). + * + * Tip: it is important never to hold on to objects returned from methods + * like `heap8u()` long-term, as they may be invalidated if the heap grows. + * It is acceptable to hold the reference for a brief series of calls, so + * long as those calls are guaranteed not to allocate memory on the WASM + * heap, but it should never be cached for later use. + * + * Before describing the routines for manipulating the heap, we first need + * to look at data type descriptors, sometimes referred to as "IR" (internal + * representation). These are short strings which identify the specific data + * types supported by WASM and/or the JS/WASM glue code: + * + * - `i8`: 8-bit signed integer + * - `i16`: 16-bit signed integer + * - `i32`: 32-bit signed integer. Aliases: `int`, `*`, `**` (noting that + * `*` and `**` may be remapped dynamically to to i64 when WASM environments + * gain 64-bit pointer capabilities). + * - `i64`: 64-bit signed integer. APIs which use this require that the + * application has been built with BigInt support, and will throw if that is + * not the case. + * - `f32`: 32-bit floating point value. Alias: float + * - `f64`: 64-bit floating point value. Alias: double + * + * These are used extensively by the memory accessor APIs and need to be + * committed to memory. + */ + + /** + * The first form fetches a single value from memory. The second form fetches + * the value from each pointer in the given array and returns the array of + * values. The heap view used for reading the memory is specified by the + * second argument, defaulting to byte-oriented view. + * + * If the 2nd argument ends with `"*"` then the pointer-sized representation + * is always used (currently always 32 bits). + */ + peek(addr: WasmPointer, representation?: string): number; + peek(addrs: WasmPointer[], representation?: string): number[]; + + /** + * Equivalent to `peek(X,'*')`. Most frequently used for fetching output + * pointer values. + */ + peekPtr: (addr: WasmPointer) => number; + + /** Equivalent to peek(X,'i8') */ + peek8: (addr: WasmPointer) => number; + + /** Equivalent to peek(X,'i16') */ + peek16: (addr: WasmPointer) => number; + + /** Equivalent to peek(X,'i32') */ + peek32: (addr: WasmPointer) => number; + + /** + * Equivalent to peek(X,'i64'). Will throw if the environment is not + * configured with BigInt support. + */ + peek64: (addr: WasmPointer) => bigint; + + /** Equivalent to peek(X,'f32') */ + peek32f: (addr: WasmPointer) => number; + + /** Equivalent to peek(X,'f64') */ + peek64f: (addr: WasmPointer) => number; + + /** + * Requires `n` to be one of: + * + * - Integer 8, 16, or 32. + * - A integer-type TypedArray constructor: `Int8Array`, `Int16Array`, + * `Int32Array`, or their `Uint` counterparts. + * + * If `BigInt` support is enabled, it also accepts the value 64 or a + * `BigInt64Array`/`BigUint64Array`, else it throws if passed 64 or one of + * those constructors. + * + * Returns an integer-based `TypedArray` view of the WASM heap memory buffer + * associated with the given block size. If passed an integer as the first + * argument and unsigned is truthy then the `"U"` (unsigned) variant of that + * view is returned, else the signed variant is returned. If passed a + * `TypedArray` value, the 2nd argument is ignored. Note that `Float32Array` + * and `Float64Array` views are not supported by this function. + * + * Be aware that growth of the heap may invalidate any references to this + * heap, so do not hold a reference longer than needed and do not use a + * reference after any operation which may allocate. Instead, re-fetch the + * reference by calling this function again, which automatically refreshes the + * view if need. + * + * Throws if passed an invalid `n`. + * + * Use of this function in client code is very rare. In practice, one of the + * (faster) convenience forms is used. + */ + heapForSize(n: 8, unsigned: false | undefined): Int8Array; + heapForSize(n: 8, unsigned: true): Uint8Array; + heapForSize(n: typeof Int8Array): Int8Array; + heapForSize(n: typeof Uint8Array): Uint8Array; + heapForSize(n: 16, unsigned: false | undefined): Int16Array; + heapForSize(n: 16, unsigned: true): Uint16Array; + heapForSize(n: typeof Int16Array): Int16Array; + heapForSize(n: typeof Uint16Array): Uint16Array; + heapForSize(n: 32, unsigned: false | undefined): Int32Array; + heapForSize(n: 32, unsigned: true): Uint32Array; + heapForSize(n: typeof Int32Array): Int32Array; + heapForSize(n: typeof Uint32Array): Uint32Array; + heapForSize(n: 64, unsigned: false | undefined): BigInt64Array; + heapForSize(n: 64, unsigned: true): BigUint64Array; + heapForSize(n: typeof Int32Array): BigInt64Array; + heapForSize(n: typeof Uint32Array): BigUint64Array; + + /** Faster convenience method to get a Int8Array view of the WASM heap. */ + heap8: () => Int8Array; + + /** Faster convenience method to get a UInt8Array view of the WASM heap. */ + heap8u: () => Uint8Array; + + /** Faster convenience method to get a Int16Array view of the WASM heap. */ + heap16: () => Int16Array; + + /** Faster convenience method to get a UInt16Array view of the WASM heap. */ + heap16u: () => Uint16Array; + + /** Faster convenience method to get a Int32Array view of the WASM heap. */ + heap32: () => Int32Array; + + /** Faster convenience method to get a UInt32Array view of the WASM heap. */ + heap32u: () => Uint32Array; + + /** Faster convenience method to get a BigInt64Array view of the WASM heap. */ + heap64: () => BigInt64Array; + + /** Faster convenience method to get a BigUint64Array view of the WASM heap. */ + heap64u: () => BigUint64Array; + + /** + * Fetches the `heapForSize()` for the given representation then writes the + * given numeric value to it. Only numbers may be written this way, and + * passing a non-number might trigger an exception. If passed an array of + * pointers, it writes the given value to all of them. + * + * Returns this. + */ + poke(addr: WasmPointer, value: number, representation?: string): WASM_API; + poke(addrs: WasmPointer[], value: number, representation?: string): WASM_API; + + /** + * Equivalent to `poke(X,Y,'*')`. Most frequently used for clearing output + * pointer values. + */ + pokePtr: (addr: WasmPointer, value: number) => WASM_API; + + /** Equivalent to poke(X,Y,'i8') */ + poke8: (addr: WasmPointer, value: number) => WASM_API; + + /** Equivalent to poke(X,Y,'i16') */ + poke16: (addr: WasmPointer, value: number) => WASM_API; + + /** Equivalent to poke(X,Y,'i32') */ + poke32: (addr: WasmPointer, value: number) => WASM_API; + + /** Equivalent to poke(X,Y,'i64') */ + poke64: (addr: WasmPointer, value: number | bigint) => WASM_API; + + /** Equivalent to poke(X,Y,'f32') */ + poke32f: (addr: WasmPointer, value: number) => WASM_API; + + /** Equivalent to poke(X,Y,'f64') */ + poke64f: (addr: WasmPointer, value: number) => WASM_API; + + /* -------------------------------------------------------------------------- + * String Conversion and Utilities + * -------------------------------------------------------------------------- + * Passing strings into and out of WASM is frequently required, but how JS + * and C code represent strings varies significantly. The following routines + * are available for conversion of strings and related algorithms. + */ + + /** + * Expects to be given a C-style string array and its length. It returns a JS + * array of strings and/or null values: any entry in the `pArgv` array which + * is `NULL` results in a null entry in the result array. If `argc` is 0 then + * an empty array is returned. + * + * Results are `undefined` if any entry in the first `argc` entries of `pArgv` + * are neither `0` (`NULL`) nor legal UTF-format C strings. + * + * To be clear, the expected C-style arguments to be passed to this function + * are `(int, char **)` (optionally const-qualified). + */ + cArgvToJs: ( + argc: number, + pArgv: WasmPointer, + ) => (string | null)[] | undefined; + + /** + * Expects its argument to be a pointer into the WASM heap memory which refers + * to a NUL-terminated C-style string encoded as UTF-8. This function counts + * its byte length using `cstrlen()` then returns a JS-format string + * representing its contents. As a special case, if the argument is falsy, + * `null` is returned. + */ + cstrToJs: (ptr: WasmPointer) => string | null; + + /** + * Expects its argument to be a pointer into the WASM heap memory which refers + * to a NUL-terminated C-style string encoded as UTF-8. Returns the length, in + * bytes, of the string, as for `strlen(3)`. As a special case, if the + * argument is falsy then it it returns null. Throws if the argument is out of + * range for `wasm.heap8u()`. + */ + cstrlen: (ptr: WasmPointer) => number | null; + + /** + * Works similarly to C's `strncpy(3)`, copying, at most, `n` bytes (not + * characters) from `srcPtr` to `tgtPtr`. It copies until `n` bytes have been + * copied or a `0` byte is reached in `src`. Unlike `strncpy()`, it returns + * the number of bytes it assigns in `tgtPtr`, including the NUL byte (if + * any). If `n` is reached before a NUL byte in `srcPtr`, `tgtPtr` will not be + * NUL-terminated. If a NUL byte is reached before `n` bytes are copied, + * `tgtPtr` will be NUL-terminated. + * + * If `n` is negative, `cstrlen(srcPtr)+1` is used to calculate it, the `+1` + * being for the NUL byte. + * + * Throws if `tgtPtr` or `srcPtr` are falsy. Results are `undefined` if: + * + * - Either is not a pointer into the WASM heap or + * - `srcPtr` is not NUL-terminated AND `n` is less than `srcPtr`'s logical + * length. + * + * **ACHTUNG:** when passing in a non-negative `n` value, it is possible to + * copy partial multi-byte characters this way, and converting such strings + * back to JS strings will have undefined results. + */ + cstrncpy: (tgtPtr: WasmPointer, srcPtr: WasmPointer, n: number) => number; + + /** + * Forewarning: this API is somewhat complicated and is, in practice, never + * needed from client code. + * + * Encodes the given JS string as UTF-8 into the given `TypedArray` `tgt` + * (which must be a `Int8Array` or `Uint8Array`), starting at the given offset + * and writing, at most, `maxBytes` bytes (including the NUL terminator if + * `addNul` is true, else no NUL is added). If it writes any bytes at all and + * `addNul` is true, it always NUL-terminates the output, even if doing so + * means that the NUL byte is all that it writes. + * + * If `maxBytes` is negative (the default) then it is treated as the remaining + * length of `tgt`, starting at the given offset. + * + * If writing the last character would surpass the `maxBytes` count because + * the character is multi-byte, that character will not be written (as opposed + * to writing a truncated multi-byte character). This can lead to it writing + * as many as 3 fewer bytes than `maxBytes` specifies. + * + * Returns the number of bytes written to the target, including the NUL + * terminator (if any). If it returns 0, it wrote nothing at all, which can + * happen if: + * + * jsString is empty and addNul is false. + * offset < 0. + * maxBytes === 0. + * maxBytes is less than the byte length of a multi-byte jsString[0]. + * + * Throws if `tgt` is not an `Int8Array` or `Uint8Array`. + */ + jstrcpy: ( + jsString: string, + tgt: Int8Array | Uint8Array, + offset?: number, + maxBytes?: number, + addNul?: boolean, + ) => number; + + /** + * Given a JS string, this function returns its UTF-8 length in bytes. Returns + * `null` if its argument is not a string. This is a relatively expensive + * calculation and should be avoided when not necessary. + */ + jstrlen: (jsString: string) => number | null; + + /** + * For the given JS string, returns a `Uint8Array` of its contents encoded as + * UTF-8. If `addNul` is true, the returned array will have a trailing 0 + * entry, else it will not. + * + * Trivia: this was written before JS's TextEncoder was known to this code's + * author. The same functionality, sans the trailing NUL option, can be + * achieved with new TextEncoder().encode(str). + */ + jstrToUintArray: (jsString: string, addNul?: boolean) => Uint8Array; + + /* -------------------------------------------------------------------------- + * String Conversion and Utilities + * -------------------------------------------------------------------------- + */ + + /** + * `wasm.alloc()`'s `srcTypedArray.byteLength` bytes, populates them with the + * values from the source `TypedArray`, and returns the pointer to that + * memory. The returned pointer must eventually be passed to `wasm.dealloc()` + * to clean it up. + * + * The argument may be a `Uint8Array`, `Int8Array`, or `ArrayBuffer`, and it + * throws if passed any other type. + * + * As a special case, to avoid further special cases where this routine is + * used, if `srcTypedArray.byteLength` is 0, it allocates a single byte and + * sets it to the value 0. Even in such cases, calls must behave as if the + * allocated memory has exactly `srcTypedArray.byteLength` usable bytes. + */ + allocFromTypedArray: ( + srcTypedArray: Uint8Array | Int8Array | ArrayBuffer, + ) => WasmPointer; + + /* ========================================================================== + * Bridging JS/WASM Functions + * ========================================================================== + * This section documents the helper APIs related to bridging the gap + * between JavaScript and WebAssembly functions. + * + * A WASM module exposes all exported functions to the user, but they are in + * "raw" form. That is, they perform no argument or result type conversion and only + * support data types supported by WASM (i.e. only numeric types). That's fine + * for functions which only accept and return numbers, but is generally less + * helpful for functions which take or return strings or have output pointers. + * For usability reasons, it's desirable to reduce the JS/C friction by + * automatically performing mundane tasks such as the allocation and + * deallocation of memory needed for converting strings between JS and WASM. + * + * Additionally, it's often useful to add new functions to the WASM runtime + * from JS, which requires compiling binary WASM code on the fly. A common + * example of this is creating user-defined SQL functions. For the most + * part, the JS bindings of the sqlite3 API take care of such conversions + * for the user, but there are cases where client code will need to, or want + * to, perform such conversions itself. + */ + + /* -------------------------------------------------------------------------- + * WASM Function Table + * -------------------------------------------------------------------------- + * + * WASM-exported functions, as well as JavaScript functions which have been + * bound to WASM at runtime, are exposed to clients via a `WebAssembly.Table` + * instance. The following APIs are available for working with that. + */ + + /** + * Given a function pointer, returns the WASM function table entry if found, + * else returns a falsy value. + */ + functionEntry: (fnPtr: WasmPointer) => Function | undefined; + + /** Returns the WASM module's indirect function table. */ + functionTable: () => WebAssembly.Table; + + /* -------------------------------------------------------------------------- + * Calling and Wrapping Functions + * -------------------------------------------------------------------------- + */ + + /** + * Calls a WASM-exported function by name, passing on all supplied arguments + * (which may optionally be supplied as an array). If throws if the function + * is not exported or if the argument count does not match. This routine does + * no type conversion and is essentially equivalent to: + * + * const rc = wasm.exports.some_func(...args); + * + * With the exception that `xCall()` throws if the argument count does not + * match that of the WASM-exported function. + */ + xCall(fn: string | Function, ...args: any[]): any; + xCall(fn: string | Function, args: any[]): any; + + /** + * Functions like `xCall()` but performs argument and result type conversions + * as for `xWrap()`. + * + * The first argument is the name of the exported function to call. The 2nd + * its the name of its result type, as documented for `xWrap()`. The 3rd is an + * array of argument type names, as documented for `xWrap()`. The 4th+ + * arguments are arguments for the call, with the special case that if the 4th + * argument is an array, it is used as the arguments for the call. + * + * Returns the converted result of the call. + * + * This is just a thin wrapper around `xWrap()`. If the given function is to + * be called more than once, it's more efficient to use `xWrap()` to create a + * wrapper, then to call that wrapper as many times as needed. For one-shot + * calls, however, this variant is arguably more efficient because it will + * hypothetically free the wrapper function quickly. + */ + xCallWrapped( + functionName: string, + resultType: string, + argTypes: readonly string[], + ...args: any[] + ): any; + xCallWrapped( + functionName: string, + resultType: string, + argTypes: readonly string[], + args: any[], + ): any; + + /** + * Returns a WASM-exported function by name, or throws if the function is not + * found. + */ + xGet: (functionName: string) => Function; + + /** + * `xWrap()` creates a JS function which calls a WASM-exported function, as + * described for `xCall(`). + * + * Creates a wrapper for the WASM-exported function `fname`. It uses `xGet()` + * to fetch the exported function (which throws on error) and returns either + * that function or a wrapper for that function which converts the JS-side + * argument types into WASM-side types and converts the result type. If the + * function takes no arguments and `resultType` is null then the function is + * returned as-is, else a wrapper is created for it to adapt its arguments and + * result value, as described below. + * + * This function's arguments are: + * + * - `functionName`: the exported function's name. `xGet()` is used to fetch + * this, so will throw if no exported function is found with that name. + * - `resultType`: the name of the result type. A literal `null` means to return + * the original function's value as-is (mnemonic: there is "null" conversion + * going on). Literal `undefined` or the string `"void"` mean to ignore the + * function's result and return `undefined`. Aside from those two special + * cases, it may be one of the values described below or any mapping + * installed by the client using `xWrap.resultAdapter()`. + * + * If passed 3 arguments and the final one is an array, that array must + * contain a list of type names (see below) for adapting the arguments from JS + * to WASM. If passed 2 arguments, more than 3, or the 3rd is not an array, + * all arguments after the 2nd (if any) are treated as type names. In other + * words, the following usages are equivalent: + * + * xWrap('funcname', 'i32', 'string', 'f64'); + * xWrap('funcname', 'i32', ['string', 'f64']); + * + * As are: + * + * xWrap('funcname', 'i32'); // no arguments + * xWrap('funcname', 'i32', []); + * + * Type names are symbolic names which map the function's result and arguments + * to an adapter function to convert, if needed, the value before passing it + * on to WASM or to convert a return result from WASM. + * + * **The list of built-in names.** + * + * The following lists describe each, noting that some apply only to arguments + * or return results, the two often having different semantics: + * + * - `i8`, `i16`, `i32` (args and results): all integer conversions which + * convert their argument to an integer and truncate it to the given bit + * length. + * - `N*` (args): a type name in the form `N*`, where N is a numeric type name, + * is treated the same as WASM pointer. + * - `*` and `pointer` (args): are assumed to be opaque WASM pointers and are + * treated like the current WASM pointer numeric type. Non-numbers will + * coerce to a value of 0 and out-of-range numbers will have `undefined` + * results (as with any pointer misuse). + * - `*` and `pointer` (results): are aliases for the current WASM pointer + * numeric type. + * - `**` (args): is simply a descriptive alias for `'*'`. It's primarily + * intended to mark output-pointer arguments. + * - `i64` (args and results): passes the value to `BigInt()` to convert it to + * an `int64`. Only available if `BigInt` support is enabled. + * - `f32` (float), `f64` (double) (args and results): pass their argument to + * `Number()`. i.e. the adapter does not currently distinguish between the + * two types of floating-point numbers. + * - `number` (results): converts the result to a JS Number using + * `Number(theValue).valueOf()`. Note that this is for result conversions + * only, as it's not possible to generically know which type of number to + * convert arguments to. + * + * Non-numeric conversions include: + * + * - `string` or `utf8` (args): has two different semantics in order to + * accommodate various uses of certain C APIs... + * + * - If the arg is a JS string, a temporary C-string, UTF-8 encoded, is created + * to pass to the exported function, which gets cleaned up before the + * wrapper returns. If a long-lived C-string pointer is required, + * client-side code is required to create the string, then pass its + * pointer to the function. + * - Else the arg is assumed to be a pointer to a string the client has already + * allocated and it's passed on as a WASM pointer. + * - `string` or `utf8` (results): treats the result value as a const C-string, + * encoded as UTF-8, copies it to a JS string, and returns that JS string. + * - `string:dealloc` or `utf8:dealloc` (results): treats the result value as a + * non-const C-string, encoded as UTF-8, ownership of which has just been + * transfered to the caller. It copies the C-string to a JS string, frees + * the C-string using `dealloc()`, and returns the JS string. If such a + * result value is NULL, the JS result is null. **Achtung:** when using an + * API which returns results from a specific allocator, this conversion is + * not legal. Instead, an equivalent conversion which uses the appropriate + * deallocator is required. An example of such is provided in the next + * section. + * - `string:flexible` (args): are an expanded version of `string` described in + * the C-style API docs. These are widely used for SQL string inputs in the + * library. + * - `string:static` (args): if passed a pointer, returns it as is. Anything + * else: gets coerced to a JS string for use as a map key. If a matching + * entry is found (as described next), it is returned, else + * `wasm.allocCString()` is used to create a a new string, map its pointer + * to `(''+v)` for the remainder of the application's life, and returns that + * pointer value for this call and all future calls which are passed a + * string-equivalent argument. This conversion is intended for cases which + * require static/long-lived string arguments, e.g. `sqlite3_bind_pointer()` + * and `sqlite3_result_pointer()`. + * - `json` (results): treats the result as a const C-string and returns the + * result of passing the converted-to-JS string to `JSON.parse()`. Returns + * `null` if the C-string is a NULL pointer. Propagates any exception from + * `JSON.parse()`. + * - `json:dealloc` (results): works exactly like `string:dealloc` but returns + * the same thing as the json adapter. Note the warning in `string:dealloc` + * about the allocator and deallocator. + * + * The type names for results and arguments are validated when `xWrap()` is + * called and any unknown names will trigger an exception. + * + * Clients may map their own result and argument adapters using + * `xWrap.resultAdapter()` and `xWrap.argAdaptor()`, noting that not all type + * conversions are valid for both arguments and result types as they often + * have different memory ownership requirements. That topic is covered in the + * next section... + * + * **Argument and Result Value Type Conversions** + * + * When `xWrap()` is called and evaluates function call signatures, it looks + * up the argument and result type adapters for a match. It is possible to + * install custom adapters for arguments and result values using the methods + * listed below. + * + * `xWrap()` has two methods with identical signatures: + * + * xWrap.argAdapter(string, function) + * xWrap.resultAdapter(string, function) + * + * Each one expects a type name string, such as the ones described for + * `xWrap()`, and a function which is passed a single value and must return + * that value, a conversion of that value, or throw an exception. Each of + * those functions returns itself so that calls may be chained. + * + * For example's sake, let's assume we have a C-bound function which returns a + * C-style string allocated using a non-default allocator, `my_str_alloc()`. + * The returned memory is owned by the caller and must be freed, but needs to + * be freed using the allocator's deallocation counterpart, `my_str_free()`. + * We can create such a result value adapter with: + * + * wasm.xWrap.resultAdaptor('my_str_alloc*', (v)=>{ + * try { return v ? target.cstrToJs(v) : null } + * finally{ wasm.exports.my_str_free(v) } + * }; + * + * With that in place, we can make calls like: + * + * const f = wasm.xWrap('my_function', 'my_str_alloc*', [ + * 'i32', + * 'string', + * ]); + * const str = f(17, 'hello, world'); + * // ^^^ the memory allocated for the result using my_str_alloc() + * // is freed using my_str_free() before f() returns. + * + * Similarly, let's assume that we have a custom JS class which has a member + * property named `pointer` which refers to C-side memory of a struct which + * this JS class represents. We can then make it legal to pass such objects on + * to the C APIs with something like: + * + * const argPointer = wasm.xWrap.argAdapter('*'); // default pointer-type adapter + * wasm.xWrap.argAdaptor('MyType', (v) => { + * if (v instanceof MyType) v = v.pointer; + * if (wasm.isPtr(v)) return argPointer(v); + * throw new Error('Invalid value for MyType argument.'); + * }); + * + * With that in place we can wrap one of our functions like: + * + * const f = wasm.xWrap('MyType_method', undefined, ['MyType', 'i32']); + * const my = new MyType(...); + * // ^^^ assume this allocates WASM memory referenced via my.pointer. + * f( my, // will use my.pointer + * 17 ); + * + * Similar conversions can be done for result values, though how to do so for + * result values depends entirely on client-side semantics of memory + * management. + */ + xWrap( + functionName: string, + resultType: string | undefined, + ...argTypes: readonly string[] + ): Function; + xWrap( + functionName: string, + resultType: string | undefined, + argTypes: readonly string[], + ): Function; + + /* -------------------------------------------------------------------------- + * (Un)Installing WASM Functions + * -------------------------------------------------------------------------- + * When using C APIs which take callback function pointers, one cannot + * simply pass JS functions to them. Instead, the JS function has to be + * proxied into WASM environment and that proxy has to be passed to C. That + * is done by compiling, on the fly, a small amount of binary WASM code + * which describes the function's signature in WASM terms, forwards its + * arguments to the provided JS function, and returns the result of that JS + * function. The details are ugly, but usage is simple... + */ + + /** + * Expects a JS function and signature, exactly as for `wasm.jsFuncToWasm()`. + * It uses that function to create a WASM-exported function, installs that + * function to the next available slot of `wasm.functionTable()`, and returns + * the function's index in that table (which acts as a pointer to that + * function). The returned pointer can be passed to `wasm.uninstallFunction()` + * to uninstall it and free up the table slot for reuse. + * + * As a special case, if the passed-in function is a WASM-exported function + * then the signature argument is ignored and `func` is installed as-is, + * without requiring re-compilation/re-wrapping. + * + * This function will propagate an exception if `WebAssembly.Table.grow()` + * throws or `wasm.jsFuncToWasm()` throws. The former case can happen in an + * Emscripten-compiled environment when building without Emscripten's + * `-sALLOW_TABLE_GROWTH` flag. + */ + installFunction(func: Function, signature: string): WasmPointer; + installFunction(signature: string, func: Function): WasmPointer; + + /** + * Creates a WASM function which wraps the given JS function and returns the + * JS binding of that WASM function. The function signature string must be in + * the form used by jaccwabyt or Emscripten's `addFunction()`. In short: in + * may have one of the following formats: + * + * - Emscripten: `"x..."`, where the first `x` is a letter representing the + * result type and subsequent letters represent the argument types. See + * below. Functions with no arguments have only a single letter. + * - Jaccwabyt: `"x(...)"` where x is the letter representing the result type + * and letters in the parens (if any) represent the argument types. + * Functions with no arguments use `x()`. See below. + * + * Supported letters: + * + * - `i` = `int32` + * - `p` = `int32` ("pointer") + * - `j` = `int64` + * - `f` = `float32` + * - `d` = `float64` + * - `v` = `void`, only legal for use as the result type + * + * It throws if an invalid signature letter is used. + * + * Jaccwabyt-format signatures support some additional letters which have no + * special meaning here but (in this context) act as aliases for other + * letters: + * + * - `s`, `P`: same as `p` + */ + jsFuncToWasm(func: Function, signature: string): Function; + jsFuncToWasm(signature: string, func: Function): Function; + + /** + * This works exactly like `installFunction()` except that the installation is + * scoped to the current allocation scope and is uninstalled when the current + * allocation scope is popped. It will throw if no allocation scope is + * active. + */ + scopedInstallFunction(func: Function, signature: string): WasmPointer; + scopedInstallFunction(signature: string, func: Function): WasmPointer; + + /** + * Requires a pointer value previously returned from `wasm.installFunction()`. + * Removes that function from the WASM function table, marks its table slot as + * free for re-use, and returns that function. It is illegal to call this + * before `installFunction()` has been called and results are undefined if the + * argument was not returned by that function. The returned function may be + * passed back to `installFunction()` to reinstall it. + */ + uninstallFunction: (fnPtr: WasmPointer) => Function; + + /* ========================================================================== + * Generic Utility Functions + * ========================================================================== + */ + + /** + * Returns true if its value is a WASM pointer type. That is, it's a a 32-bit + * integer greater than or equal to zero. + * + * Sidebar: `isPtr()` is an alias for `isPtr32()`. If/when 64-bit WASM pointer + * support becomes widespread, it will become an alias for either `isPtr32()` + * or the as-yet-hypothetical `isPtr64()`, depending on a configuration + * option. + */ + isPtr: (v: unknown) => v is WasmPointer; + + /** See {@link WASM_API#isPtr} */ + isPtr32: (v: unknown) => v is WasmPointer; + + /** Size of a WASM pointer in bytes. */ + ptrSizeof: number; +}; + +// generated by Object.keys(sqlite3.capi).map(k => `${k}: any;`).join('\n') +declare type CAPI = { + sqlite3_vfs: typeof sqlite3_vfs; + sqlite3_io_methods: typeof sqlite3_io_methods; + sqlite3_file: typeof sqlite3_file; + sqlite3_vtab: typeof sqlite3_vtab; + sqlite3_vtab_cursor: typeof sqlite3_vtab_cursor; + sqlite3_module: typeof sqlite3_module; + sqlite3_index_info: typeof sqlite3_index_info; + + /** + * Returns a string corresponding to the {@link CAPI#SQLITE_VERSION} macro. + * This function is provided for use in DLLs. + * + * C Signature: + * + * const char *sqlite3_libversion(void) + * + * See https://www.sqlite.org/c3ref/libversion.html + */ + sqlite3_libversion: () => string; + + /** + * Returns returns a string constant whose value is the same as the + * `SQLITE_SOURCE_ID` C preprocessor macro. Except if SQLite is built using an + * edited copy of the amalgamation, then the last four characters of the hash + * might be different from `SQLITE_SOURCE_ID`. + * + * C Signature: + * + * const char *sqlite3_sourceid(void) + * + * See https://www.sqlite.org/c3ref/libversion.html + */ + sqlite3_sourceid: () => string; + + /** + * Returns an integer equal to {@link CAPI#SQLITE_VERSION_NUMBER}. + * + * C Signature: + * + * int sqlite3_libversion_number(void) + * + * See https://www.sqlite.org/c3ref/libversion.html + */ + sqlite3_libversion_number: () => number; + + /** + * Allows iterating over the list of options that were defined at compile time + * by returning the `idx`-th compile time option string. If `idx` is out of + * range, returns null. + * + * C Signature: + * + * const char *sqlite3_compileoption_get(int N) + * + * See https://www.sqlite.org/c3ref/compileoption_get.html + */ + sqlite3_compileoption_get: (idx: number) => string; + + /** + * Returns 0 or 1 indicating whether the specified option `optName` was + * defined at compile time. + * + * C Signature: + * + * int sqlite3_compileoption_used(const char *zOptName) + * + * See https://www.sqlite.org/c3ref/compileoption_get.html + */ + sqlite3_compileoption_used: (optName: string) => number; + + /** + * Destructor for the `sqlite3` object. + * + * C Signature: + * + * int sqlite3_close_v2(sqlite3*); + * + * See https://www.sqlite.org/c3ref/close.html + */ + + sqlite3_close_v2: (db: Database | WasmPointer) => number; + + /** + * A convenience wrapper around `sqlite3_prepare_v2()`, `sqlite3_step()`, and + * `sqlite3_finalize()`, that allows an application to run multiple statements + * of SQL without having to use a lot of C code. + * + * C Signature: + * + * int sqlite3_exec( + * sqlite3*, + * const char *sql, + * int (*callback)(void*,int,char**,char**), + * void *, + * char **errmsg + * ) + * + * See https://www.sqlite.org/c3ref/exec.html + */ + sqlite3_exec: ( + db: Database | WasmPointer, + sql: FlexibleString, + callback: ((values: SqlValue[], names: string[]) => number) | WasmPointer, + pCbArg: WasmPointer, + pzErrMsg: WasmPointer, + ) => number; + + /** + * Initializes the SQLite library. + * + * C Signature: + * + * int sqlite3_initialize(void); + * + * See https://www.sqlite.org/c3ref/initialize.html + */ + sqlite3_initialize: () => number; + + /** + * Deallocates any resources that were allocated by `sqlite3_initialize()`. + * + * C Signature: + * + * int sqlite3_shutdown(void); + * + * See https://www.sqlite.org/c3ref/initialize.html + */ + sqlite3_shutdown: () => number; + + /** + * Used to make global configuration changes to SQLite in order to tune SQLite + * to the specific needs of the application. The default configuration is + * recommended for most applications and so this routine is usually not + * necessary. It is provided to support rare applications with unusual needs. + * + * C Signature: + * + * int sqlite3_config(int, ...); + * + * See https://www.sqlite.org/c3ref/config.html + */ + sqlite3_config( + op: + | CAPI['SQLITE_CONFIG_COVERING_INDEX_SCAN'] + | CAPI['SQLITE_CONFIG_MEMSTATUS'] + | CAPI['SQLITE_CONFIG_SMALL_MALLOC'] + | CAPI['SQLITE_CONFIG_SORTERREF_SIZE'] + | CAPI['SQLITE_CONFIG_STMTJRNL_SPILL'] + | CAPI['SQLITE_CONFIG_URI'], + arg: number, + ): number; + sqlite3_config( + op: CAPI['SQLITE_CONFIG_LOOKASIDE'], + arg1: number, + arg2: number, + ): number; + sqlite3_config(op: CAPI['SQLITE_CONFIG_MEMDB_MAXSIZE'], arg: bigint): number; + + /** + * Used to make configuration changes to a database connection. The interface + * is similar to `sqlite3_config()` except that the changes apply to a single + * database connection (specified in the first argument). + * + * C Signature: + * + * int sqlite3_db_config(sqlite3*, int op, ...); + * + * See https://www.sqlite.org/c3ref/db_config.html + */ + // TODO: Type out the arguments for every option via overloading + sqlite3_db_config: ( + db: Database | WasmPointer, + op: + | CAPI['SQLITE_DBCONFIG_LOOKASIDE'] + | CAPI['SQLITE_DBCONFIG_ENABLE_FKEY'] + | CAPI['SQLITE_DBCONFIG_ENABLE_TRIGGER'] + | CAPI['SQLITE_DBCONFIG_ENABLE_VIEW'] + | CAPI['SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER'] + | CAPI['SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION'] + | CAPI['SQLITE_DBCONFIG_MAINDBNAME'] + | CAPI['SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE'] + | CAPI['SQLITE_DBCONFIG_ENABLE_QPSG'] + | CAPI['SQLITE_DBCONFIG_TRIGGER_EQP'] + | CAPI['SQLITE_DBCONFIG_RESET_DATABASE'] + | CAPI['SQLITE_DBCONFIG_DEFENSIVE'] + | CAPI['SQLITE_DBCONFIG_WRITABLE_SCHEMA'] + | CAPI['SQLITE_DBCONFIG_LEGACY_ALTER_TABLE'] + | CAPI['SQLITE_DBCONFIG_DQS_DML'] + | CAPI['SQLITE_DBCONFIG_DQS_DDL'] + | CAPI['SQLITE_DBCONFIG_TRUSTED_SCHEMA'] + | CAPI['SQLITE_DBCONFIG_LEGACY_FILE_FORMAT'], + ...args: number[] + ) => number; + + /** + * Enables or disables the `extended result codes` feature of SQLite. The + * extended result codes are disabled by default for historical + * compatibility. + * + * C Signature: + * + * int sqlite3_extended_result_codes(sqlite3*, int onoff); + * + * See https://www.sqlite.org/c3ref/extended_result_codes.html + */ + sqlite3_extended_result_codes: ( + db: Database | WasmPointer, + onoff: number, + ) => number; + + /** + * Usually returns the `rowid` of the most recent successful `INSERT` into a + * rowid table or virtual table on database connection `db`. Inserts into + * `WITHOUT ROWID` tables are not recorded. If no successful `INSERT`s into + * rowid tables have ever occurred on the database connection `db`, then + * `sqlite3_last_insert_rowid(db)` returns zero + * + * C Signature: + * + * sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); + * + * See https://www.sqlite.org/c3ref/last_insert_rowid.html + */ + sqlite3_last_insert_rowid: (db: Database | WasmPointer) => bigint; + + /** + * Allows the application to set the value returned by calling + * `sqlite3_last_insert_rowid(db)` to `rowid` without inserting a row into the + * database. + * + * C Signature: + * + * void sqlite3_set_last_insert_rowid(sqlite3*, sqlite3_int64); + * + * See https://www.sqlite.org/c3ref/set_last_insert_rowid.html + */ + sqlite3_set_last_insert_rowid: ( + db: Database | WasmPointer, + rowid: bigint, + ) => void; + + /** + * Returns the number of rows modified, inserted or deleted by the most + * recently completed `INSERT`, `UPDATE` or `DELETE` statement on the database + * connection specified by the only parameter. Executing any other type of SQL + * statement does not modify the value returned by these functions. REturn + * value is undefined if the number of changes is bigger than 32 bits. Use + * `sqlite3_changes64()` instead in these cases. + * + * C Signature: + * + * int sqlite3_changes(sqlite3*); + * + * See https://www.sqlite.org/c3ref/changes.html + */ + sqlite3_changes: (db: Database | WasmPointer) => number; + + /** + * Returns the number of rows modified, inserted or deleted by the most + * recently completed `INSERT`, `UPDATE` or `DELETE` statement on the database + * connection specified by the only parameter. Executing any other type of SQL + * statement does not modify the value returned by these functions. + * + * C Signature: + * + * sqlite3_int64 sqlite3_changes(sqlite3*); + * + * See https://www.sqlite.org/c3ref/changes.html + */ + sqlite3_changes64: (db: Database | WasmPointer) => bigint; + + /** + * Return the total number of rows inserted, modified or deleted by all + * `INSERT`, `UPDATE` or `DELETE` statements completed since the database + * connection was opened, including those executed as part of trigger + * programs. Executing any other type of SQL statement does not affect the + * value returned by `sqlite3_total_changes()`. Return value is undefined if + * the number of changes is bigger than 32 bits. Use + * `sqlite3_total_changes64()` instead in these cases. + * + * C Signature: + * + * int sqlite3_total_changes(sqlite3*); + * + * See https://www.sqlite.org/c3ref/total_changes.html + */ + sqlite3_total_changes: (db: Database | WasmPointer) => number; + + /** + * Return the total number of rows inserted, modified or deleted by all + * `INSERT`, `UPDATE` or `DELETE` statements completed since the database + * connection was opened, including those executed as part of trigger + * programs. Executing any other type of SQL statement does not affect the + * value returned by `sqlite3_total_changes()`. + * + * C Signature: + * + * sqlite_int64 sqlite3_total_changes64(sqlite3*); + * + * See https://www.sqlite.org/c3ref/total_changes.html + */ + sqlite3_total_changes64: (db: Database | WasmPointer) => bigint; + + /** + * Useful during command-line input to determine if the currently entered text + * seems to form a complete SQL statement or if additional input is needed + * before sending the text into SQLite for parsing. + * + * C Signature: + * + * int sqlite3_complete(const char *sql); + * + * See https://www.sqlite.org/c3ref/complete.html + * + * @returns 1 if the input string appears to be a complete SQL statement, or 0 + */ + sqlite3_complete: (sql: string | WasmPointer) => number; + + /** + * Register A Callback To Handle `SQLITE_BUSY` Errors. + * + * The `sqlite3_busy_handler(db, callback, cbArg)` routine sets a callback + * function `callback` that might be invoked with argument `cbArg` whenever an + * attempt is made to access a database table associated with database + * connection `db` when another thread or process has the table locked. The + * `sqlite3_busy_handler()` interface is used to implement + * `sqlite3_busy_timeout()` and `PRAGMA busy_timeout`. + * + * C API: + * + * int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*); + * + * See https://www.sqlite.org/c3ref/busy_handler.html + */ + sqlite3_busy_handler: ( + db: Database | WasmPointer, + callback: ((cbArg: WasmPointer, nTries: number) => number) | WasmPointer, + cbArg: WasmPointer, + ) => number; + + /** + * Set A Busy Timeout. + * + * Sets a `sqlite3_busy_handler` that sleeps for a specified amount of time + * when a table is locked. The handler will sleep multiple times until at + * least `ms` milliseconds of sleeping have accumulated. After at least `ms` + * milliseconds of sleeping, the handler returns 0 which causes + * `sqlite3_step()` to return `SQLITE_BUSY`. + * + * C API: + * + * int sqlite3_busy_timeout(sqlite3*, int ms); + * + * See https://www.sqlite.org/c3ref/busy_timeout.html + */ + sqlite3_busy_timeout: (db: Database | WasmPointer, ms: number) => number; + + /** + * Returns a pointer to a block of memory at least `size` bytes in length. ^If + * `sqlite3_malloc()` is unable to obtain sufficient free memory, it throws a + * `WasmAllocError`. + * + * C Signature: + * + * void *sqlite3_malloc(int); + * + * See https://www.sqlite.org/c3ref/free.html + */ + sqlite3_malloc: (size: number) => WasmPointer; + + /** + * Returns a pointer to a block of memory at least `size` bytes in length. ^If + * `sqlite3_malloc()` is unable to obtain sufficient free memory, it throws a + * `WasmAllocError`. + * + * C Signature: + * + * void *sqlite3_malloc(sqlite_uint64); + * + * See https://www.sqlite.org/c3ref/free.html + */ + sqlite3_malloc64: (numBytes: bigint) => WasmPointer; + + /** + * Attempts to resize a prior memory allocation X to be at least N bytes. + * + * If the `size` parameter to `sqlite3_realloc(ptr, size)` is a NULL pointer + * then its behavior is identical to calling `sqlite3_malloc(size)`. + * + * If the `size` parameter to `sqlite3_realloc(ptr, size)` is zero or negative + * then the behavior is exactly the same as calling `sqlite3_free(ptr)`. + * + * `sqlite3_realloc(ptr, size)` returns a pointer to a memory allocation of at + * least `size` bytes in size or NULL if insufficient memory is available. + * + * C Signature: + * + * void *sqlite3_realloc(void*, int); + * + * See https://www.sqlite.org/c3ref/free.html + */ + sqlite3_realloc: (ptr: WasmPointer, size: number) => WasmPointer; + + /** + * Attempts to resize a prior memory allocation X to be at least N bytes. + * + * If the `size` parameter to `sqlite3_realloc(ptr, size)` is a NULL pointer + * then its behavior is identical to calling `sqlite3_malloc(size)`. + * + * If the `size` parameter to `sqlite3_realloc(ptr, size)` is zero or negative + * then the behavior is exactly the same as calling `sqlite3_free(ptr)`. + * + * `sqlite3_realloc(ptr, size)` returns a pointer to a memory allocation of at + * least `size` bytes in size or NULL if insufficient memory is available. + * + * C Signature: + * + * void *sqlite3_realloc(void*, sqlite_uint64); + * + * See https://www.sqlite.org/c3ref/free.html + */ + sqlite3_realloc64: (ptr: WasmPointer, numBytes: bigint) => WasmPointer; + + /** + * Calling `sqlite3_free()` with a pointer previously returned by + * `sqlite3_malloc()` or `sqlite3_realloc()` releases that memory so that it + * might be reused. + * + * The `sqlite3_free()` routine is a no-op if is called with a NULL pointer. + * Passing a NULL pointer to `sqlite3_free()` is harmless. After being freed, + * memory should neither be read nor written. Even reading previously freed + * memory might result in a segmentation fault or other severe error. Memory + * corruption, a segmentation fault, or other severe error might result if + * `sqlite3_free()` is called with a non-NULL pointer that was not obtained + * from `sqlite3_malloc()` or `sqlite3_realloc()`. + * + * C Signature: + * + * void sqlite3_free(void*); + * + * See https://www.sqlite.org/c3ref/free.html + */ + sqlite3_free: (ptr: WasmPointer) => void; + + /** + * If `ptr` is a memory allocation previously obtained from + * `sqlite3_malloc()`, `sqlite3_malloc64()`, `sqlite3_realloc()`, or + * `sqlite3_realloc64()`, then `sqlite3_msize(ptr)` returns the size of that + * memory allocation in bytes. + * + * C Signature: + * + * sqlite3_uint64 sqlite3_msize(void*); + * + * See https://www.sqlite.org/c3ref/free.html + */ + sqlite3_msize: (ptr: WasmPointer) => bigint; + + /** + * Pseudo-Random Number Generator + * + * A call to this routine stores `N` bytes of randomness into buffer `P` or + * array `arr`. + * + * C Signature: + * + * void sqlite3_randomness(int N, void *P); + * + * See https://www.sqlite.org/c3ref/randomness.html + */ + sqlite3_randomness(N: number, P: WasmPointer): void; + sqlite3_randomness(arr: T): T; + + /** + * This routine registers an authorizer callback with a particular database + * connection, supplied in the first argument. The authorizer callback is + * invoked as SQL statements are being compiled by `sqlite3_prepare()` or its + * variants `sqlite3_prepare_v2()`, `sqlite3_prepare_v3()`, + * `sqlite3_prepare16()`, `sqlite3_prepare16_v2()`, and + * `sqlite3_prepare16_v3()`. + * + * At various points during the compilation process, as logic is being created + * to perform various actions, the authorizer callback is invoked to see if + * those actions are allowed. + * + * The authorizer callback should return `SQLITE_OK` to allow the action, + * `SQLITE_IGNORE` to disallow the specific action but allow the SQL statement + * to continue to be compiled, or `SQLITE_DENY` to cause the entire SQL + * statement to be rejected with an error. + * + * C Signature: + * + * int sqlite3_set_authorizer( + * sqlite3*, + * int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), + * void *pUserData + * ); + * + * See https://www.sqlite.org/c3ref/set_authorizer.html + */ + sqlite3_set_authorizer: ( + db: Database | WasmPointer, + xAuth: ( + cbArg: WasmPointer, + actionCode: number, + arg1: string | 0, + arg2: string | 0, + arg3: string | 0, + arg4: string | 0, + ) => number, + cbArg: WasmPointer, + ) => number; + + /** + * Registers a trace callback function `xCallback` against database connection + * `db`, using property mask `mask` and context pointer `cbArg`. If the + * `xCallback` callback is NULL or if the `mask` is zero, then tracing is + * disabled. The `mask argument should be the bitwise OR-ed combination of + * zero or more `SQLITE_TRACE`constants. The`xCallback`callback is invoked + * whenever any of the events identified by mask`mask occur. + * + * C Signature: + * + * int sqlite3_trace_v2( + * sqlite3*, + * unsigned uMask, + * int(*xCallback)(unsigned,void*,void*,void*), + * void *pCtx + * ); + * + * See https://www.sqlite.org/c3ref/trace_v2.html + */ + sqlite3_trace_v2: ( + db: Database | WasmPointer, + mask: number, + xCallback: ( + reason: number, + cbArg: WasmPointer, + arg1: WasmPointer, + arg2: WasmPointer, + ) => number, + ) => number; + + /** + * Causes the callback function `callback` to be invoked periodically during + * long running calls to `sqlite3_step()` and `sqlite3_prepare()` and similar + * for database connection `db`. An example use for this interface is to keep + * a GUI updated during a large query. + * + * C Signature: + * + * void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); + * + * See https://www.sqlite.org/c3ref/progress_handler.html + */ + sqlite3_progress_handler: ( + db: Database | WasmPointer, + nOps: number, + callback: ((cbArg: WasmPointer) => number) | WasmPointer, + cbArg: WasmPointer, + ) => void; + + /** + * Open an SQLite database file as specified by the `filename` argument + * + * C Signature: + * + * int sqlite3_open( + * const char *filename, // Database filename (UTF-8) + * sqlite3 **ppDb // OUT: SQLite db handle + * ); + * + * See https://www.sqlite.org/c3ref/open.html + */ + sqlite3_open: (filename: string | WasmPointer, ppDb: WasmPointer) => number; + + /** + * Open an SQLite database file as specified by the `filename` argument + * + * C Signature: + * + * int sqlite3_open_v2( + * const char *filename, // Database filename (UTF-8) + * sqlite3 **ppDb, // OUT: SQLite db handle + * int flags, // Flags + * const char *zVfs // Name of VFS module to use + * ); + * + * See https://www.sqlite.org/c3ref/open.html + */ + sqlite3_open_v2: ( + filename: string | WasmPointer, + ppDb: WasmPointer, + flags: number, + vfs: string | WasmPointer, + ) => number; + + /** + * Checks if a database file `uri` was a URI that contained a specific query + * parameter `param`, and if so obtains the value of that query parameter. + * + * C Signature: + * + * const char *sqlite3_uri_parameter(sqlite3_filename z, const char *zParam) + * + * See https://www.sqlite.org/c3ref/uri_parameter.html + */ + sqlite3_uri_parameter: ( + uri: string | WasmPointer, + param: string | WasmPointer, + ) => string | null; + + /** + * Assumes that `param` is a boolean parameter and returns true (1) or false + * (0) according to the value of `param`. + * + * C Signature: + * + * int sqlite3_uri_boolean(sqlite3_filename z, const char *zParam, int bDefault) + * + * See https://www.sqlite.org/c3ref/uri_boolean.html + */ + sqlite3_uri_boolean: ( + uri: string | WasmPointer, + param: string | WasmPointer, + dflt: number, + ) => number; + + /** + * Converts the value of `paramName` into a 64-bit signed integer and returns + * that integer, or `defaultVal` if `paramName` does not exist. If the value + * of `paramName` is something other than an integer, then zero is returned. + * + * C Signature: + * + * sqlite3_int64 sqlite3_uri_int64(sqlite3_filename, const char*, sqlite3_int64); + * + * See https://www.sqlite.org/c3ref/uri_boolean.html + */ + sqlite3_uri_int64: ( + uri: string | WasmPointer, + paramName: string | WasmPointer, + defaultVal: bigint, + ) => bigint; + + /** + * Returns a pointer to the name (not the value) of the `idx`-th query + * parameter for filename `uri`. + * + * C Signature: + * + * const char *sqlite3_uri_key(sqlite3_filename z, int N) + * + * See https://www.sqlite.org/c3ref/uri_boolean.html + */ + sqlite3_uri_key: (uri: string | WasmPointer, idx: number) => string | null; + + /** + * If the most recent `sqlite3_*` API call associated with database connection + * `db` failed, then the `sqlite3_errcode(db)` interface returns the numeric + * result code or extended result code for that API call. + * + * C Signature: + * + * int sqlite3_errcode(sqlite3 *db); + * + * See https://www.sqlite.org/c3ref/errcode.html + */ + sqlite3_errcode: (db: Database | WasmPointer) => number; + + /** + * If the most recent `sqlite3_*` API call associated with database connection + * `db` failed, then the `sqlite3_extended_errcode(db)` interface returns the + * extended result code for that API call, even when extended result codes are + * disabled. + * + * C Signature: + * + * int sqlite3_extended_errcode(sqlite3 *db); + * + * See https://www.sqlite.org/c3ref/errcode.html + */ + sqlite3_extended_errcode: (db: Database | WasmPointer) => number; + + /** + * If the most recent `sqlite3_*` API call associated with database connection + * `db` failed, then the `sqlite3_errmsg(db)` interface returns English- + * language text that describes the error. + * + * C Signature: + * + * const char *sqlite3_errmsg(sqlite3*); + * + * See https://www.sqlite.org/c3ref/errcode.html + */ + sqlite3_errmsg: (db: Database | WasmPointer) => string; + + /** + * Returns the English-language text that describes the result code, + * + * C Signature: + * + * const char *sqlite3_errstr(int); + * + * See https://www.sqlite.org/c3ref/errcode.html + */ + sqlite3_errstr: (rc: number) => string; + + /** + * If the most recent error references a specific token in the input SQL, the + * `sqlite3_error_offset()` interface returns the byte offset of the start of + * that token. The byte offset returned by `sqlite3_error_offset()` assumes + * that the input SQL is UTF8. + * + * If the most recent error does not reference a specific token in the input + * SQL, then the sqlite3_error_offset() function returns -1. + * + * C Signature: + * + * int sqlite3_error_offset(sqlite3 *db); + * + * See https://www.sqlite.org/c3ref/errcode.html + */ + sqlite3_error_offset: (db: Database | WasmPointer) => number; + + /** + * This interface allows the size of various constructs to be limited on a + * connection by connection basis. The first parameter is the database + * connection whose limit is to be set or queried. The second parameter is one + * of the limit categories that define a class of constructs to be size + * limited. The third parameter is the new limit for that construct. + * + * C Signature: + * + * int sqlite3_limit(sqlite3*, int id, int newVal); + * + * See https://www.sqlite.org/c3ref/limit.html + */ + sqlite3_limit: ( + db: Database | WasmPointer, + id: + | CAPI['SQLITE_LIMIT_LENGTH'] + | CAPI['SQLITE_LIMIT_SQL_LENGTH'] + | CAPI['SQLITE_LIMIT_COLUMN'] + | CAPI['SQLITE_LIMIT_EXPR_DEPTH'] + | CAPI['SQLITE_LIMIT_COMPOUND_SELECT'] + | CAPI['SQLITE_LIMIT_VDBE_OP'] + | CAPI['SQLITE_LIMIT_FUNCTION_ARG'] + | CAPI['SQLITE_LIMIT_ATTACHED'] + | CAPI['SQLITE_LIMIT_LIKE_PATTERN_LENGTH'] + | CAPI['SQLITE_LIMIT_VARIABLE_NUMBER'] + | CAPI['SQLITE_LIMIT_TRIGGER_DEPTH'] + | CAPI['SQLITE_LIMIT_WORKER_THREADS'], + newVal: number, + ) => number; + + /** + * Compiles a prepared statement. + * + * C Signature: + * + * int sqlite3_prepare_v2( + * sqlite3 *db, + * const char *zSql, + * int nByte, + * sqlite3_stmt **ppStmt, + * const char **pzTail + * ); + * + * See https://www.sqlite.org/c3ref/prepare.html + * + * @param db Database handle + * @param sql SQL statement + * @param nByte Number of bytes in SQL statement (-1 for null terminated) + * @param ppStmt OUT: Statement handle + * @param pzTail OUT: Pointer to unused portion of SQL statement + */ + sqlite3_prepare_v2: ( + db: Database | WasmPointer, + sql: string | WasmPointer, + nByte: number, + ppStmt: WasmPointer, + pzTail: WasmPointer, + ) => number; + + /** + * Compiles a prepared statement. + * + * C Signature: + * + * int sqlite3_prepare_v2( + * sqlite3 *db, + * const char *zSql, + * int nByte, + * unsigned int prepFlags, + * sqlite3_stmt **ppStmt, + * const char **pzTail + * ); + * + * See https://www.sqlite.org/c3ref/prepare.html + * + * @param db Database handle + * @param sql SQL statement + * @param nByte Number of bytes in SQL statement (-1 for null terminated) + * @param prepFlags Zero or more SQLITE_PREPARE_* flags + * @param ppStmt OUT: Statement handle + * @param pzTail OUT: Pointer to unused portion of SQL statement + */ + sqlite3_prepare_v3( + db: Database | WasmPointer, + sql: Exclude, + nByte: -1, + prepFlags: number, + ppStmt: WasmPointer, + pzTail: null, + ): number; + sqlite3_prepare_v3( + db: Database | WasmPointer, + sql: WasmPointer, + nByte: number, + prepFlags: number, + ppStmt: WasmPointer, + pzTail: WasmPointer, + ): number; + + /** + * Returns a pointer to a copy of the UTF-8 SQL text used to create prepared + * statement `stmt` if `stmt` was created by `sqlite3_prepare_v2()` or + * `sqlite3_prepare_v3()`. + * + * C Signature: + * + * const char *sqlite3_sql(sqlite3_stmt *pStmt); + * + * See https://www.sqlite.org/c3ref/sql.html + */ + sqlite3_sql: (stmt: PreparedStatement | WasmPointer) => string; + + /** + * Returns a pointer to a UTF-8 string containing the SQL text of prepared + * statement `stmt` with bound parameters expanded. + * + * C Signature: + * + * const char *sqlite3_expanded_sql(sqlite3_stmt *pStmt); + * + * See https://www.sqlite.org/c3ref/expanded_sql.html + */ + sqlite3_expanded_sql: (stmt: PreparedStatement | WasmPointer) => string; + + /** + * Returns true (non-zero) if and only if the prepared statement `stmt` makes + * no direct changes to the content of the database file. + * + * C Signature: + * + * int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); + * + * See https://www.sqlite.org/c3ref/stmt_readonly.html + */ + sqlite3_stmt_readonly: (stmt: PreparedStatement | WasmPointer) => number; + + /** + * Returns 1 if the prepared statement `stmt` is an `EXPLAIN` statement, or 2 + * if the statement `stmt` is an `EXPLAIN QUERY PLAN`. Returns 0 if `stmt` is + * an ordinary statement or a NULL pointer + * + * C Signature: + * + * int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt); + * + * See https://www.sqlite.org/c3ref/stmt_isexplain.html + */ + sqlite3_stmt_isexplain: (stmt: PreparedStatement | WasmPointer) => 0 | 1 | 2; + + /** + * Bind a `BLOB` value to a parameter in a prepared statement. + * + * C Signature: + * + * int sqlite3_bind_blob( + * sqlite3_stmt*, + * int, + * const void*, + * int n, + * void(*)(void*) + * + * ); + * + * See https://www.sqlite.org/c3ref/bind_blob.html + */ + sqlite3_bind_blob: ( + stmt: PreparedStatement | WasmPointer, + idx: number, + blob: + | WasmPointer + | string + | readonly string[] + | Int8Array + | Uint8Array + | ArrayBuffer, + n: number, + dtor: + | (() => void) + | WasmPointer + | CAPI['SQLITE_STATIC'] + | CAPI['SQLITE_TRANSIENT'] + | CAPI['SQLITE_WASM_DEALLOC'], + ) => number; + + /** + * Bind a double precision floating point number to a parameter in a prepared + * statement. + * + * C Signature: + * + * int sqlite3_bind_double(sqlite3_stmt*, int, double); + * + * See https://www.sqlite.org/c3ref/bind_blob.html + */ + sqlite3_bind_double: ( + stmt: PreparedStatement | WasmPointer, + idx: number, + value: number, + ) => number; + + /** + * Bind an integer number to a parameter in a prepared statement. + * + * C Signature: + * + * int sqlite3_bind_int(sqlite3_stmt*, int, int); + * + * See https://www.sqlite.org/c3ref/bind_blob.html + */ + sqlite3_bind_int: ( + stmt: PreparedStatement | WasmPointer, + idx: number, + value: number, + ) => number; + + /** + * Bind a 64 bit integer number to a parameter in a prepared statement. + * + * C Signature: + * + * int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64); + * + * See https://www.sqlite.org/c3ref/bind_blob.html + */ + sqlite3_bind_int64: (stmt: WasmPointer, idx: number, value: bigint) => number; + + /** + * Bind a `NULL` value to a parameter in a prepared statement. + * + * C Signature: + * + * int sqlite3_bind_null(sqlite3_stmt*, int); + * + * See https://www.sqlite.org/c3ref/bind_blob.html + */ + sqlite3_bind_null: ( + stmt: PreparedStatement | WasmPointer, + idx: number, + ) => number; + + /** + * Bind a `TEXT` value to a parameter in a prepared statement. + * + * C Signature: + * + * int sqlite3_bind_text( + * sqlite3_stmt*, + * int, + * const char*, + * int n, + * void(*)(void*) + * + * ); + * + * See https://www.sqlite.org/c3ref/bind_blob.html + */ + sqlite3_bind_text: ( + stmt: PreparedStatement | WasmPointer, + idx: number, + text: + | string + | WasmPointer + | readonly string[] + | Int8Array + | Uint8Array + | ArrayBuffer, + n: number, + dtor: + | (() => void) + | WasmPointer + | CAPI['SQLITE_STATIC'] + | CAPI['SQLITE_TRANSIENT'] + | CAPI['SQLITE_WASM_DEALLOC'], + ) => number; + + /** + * Causes the `idx`-th parameter in prepared statement `stmt` to have an SQL + * value of `NULL`, but to also be associated with the pointer `ptr` of type + * `type`. `dtor` is either a `NULL pointer` or a pointer to a destructor + * function for `ptr`. SQLite will invoke the destructor `dtor` with a single + * argument of `ptr` when it is finished using `ptr`. The `type` parameter + * should be a static string, preferably a string literal. + * + * C Signature: + * + * int sqlite3_bind_pointer( + * sqlite3_stmt*, + * int, + * void*, + * const char*, + * void(*)(void*) + * ); + * + * See https://www.sqlite.org/c3ref/bind_blob.html + */ + sqlite3_bind_pointer: ( + stmt: PreparedStatement | WasmPointer, + idx: number, + ptr: WasmPointer, + type: string | WasmPointer, + dtor: + | (() => void) + | WasmPointer + | CAPI['SQLITE_STATIC'] + | CAPI['SQLITE_TRANSIENT'] + | CAPI['SQLITE_WASM_DEALLOC'], + ) => number; + + /** + * Used to find the number of SQL parameters in a prepared statement. SQL + * parameters are tokens of the form `?`, `?NNN`, `:AAA`, `$AAA`, or `@AAA` + * that serve as placeholders for values that are bound to the parameters at a + * later time. + * + * C Signature: + * + * int sqlite3_bind_parameter_count(sqlite3_stmt*); + * + * See https://www.sqlite.org/c3ref/bind_parameter_count.html + */ + sqlite3_bind_parameter_count: ( + stmt: PreparedStatement | WasmPointer, + ) => number; + + /** + * Return the index of an SQL parameter given its name. The index value + * returned is suitable for use as the second parameter to `sqlite3_bind()`. A + * zero is returned if no matching parameter is found. + * + * C Signature: + * + * int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName); + * + * See https://www.sqlite.org/c3ref/bind_parameter_index.html + */ + sqlite3_bind_parameter_index: ( + stmt: PreparedStatement | WasmPointer, + name: string | WasmPointer, + ) => number; + + /** + * Use this routine to reset all host parameters to NULL. + * + * C Signature: + * + * int sqlite3_clear_bindings(sqlite3_stmt*); + * + * See https://www.sqlite.org/c3ref/clear_bindings.html + */ + sqlite3_clear_bindings: (db: Database | WasmPointer) => number; + + /** + * Returns the number of columns in the result set returned by the prepared + * statement. + * + * C Signature: + * + * int sqlite3_column_count(sqlite3_stmt *pStmt); + * + * See https://www.sqlite.org/c3ref/column_count.html + */ + sqlite3_column_count: (stmt: PreparedStatement | WasmPointer) => number; + + /** + * Returns the name assigned to a particular column in the result set of a + * `SELECT statement`. + * + * C Signature: + * + * const char *sqlite3_column_name(sqlite3_stmt*, int N); + * + * See https://www.sqlite.org/c3ref/column_name.html + */ + sqlite3_column_name: ( + stmt: PreparedStatement | WasmPointer, + colIdx: number, + ) => string; + + /** + * Returns the result of passing the result of + * `sqlite3_column_value(pStmt,iCol)` to `sqlite3_value_to_js()`. The 3rd + * argument of this function is ignored by this function except to pass it on + * as the second argument of `sqlite3_value_to_js()`. If the + * `sqlite3_column_value()` returns `NULL` (e.g. because the column index is + * out of range), this function returns `undefined`, regardless of the 3rd + * argument. If the 3rd argument is falsy and conversion fails, `undefined` + * will be returned. + */ + sqlite3_column_js( + stmt: PreparedStatement | WasmPointer, + colIdx: number, + throwIfCannotConvert?: true, + ): SqlValue | undefined; + sqlite3_column_js( + stmt: PreparedStatement | WasmPointer, + colIdx: number, + throwIfCannotConvert: false, + ): SqlValue | undefined; + + /** + * After a prepared statement has been prepared using any of + * `sqlite3_prepare_v2()`, `sqlite3_prepare_v3()`, `sqlite3_prepare16_v2()`, + * or `sqlite3_prepare16_v3()` or one of the legacy interfaces + * `sqlite3_prepare()` or `sqlite3_prepare16()`, this function must be called + * one or more times to evaluate the statement. + * + * C Signature: + * + * int sqlite3_step(sqlite3_stmt*); + * + * See https://www.sqlite.org/c3ref/step.html + */ + sqlite3_step: (stmt: PreparedStatement | WasmPointer) => number; + + /** + * Returns the number of columns in the current row of the result set of + * prepared statement `stmt`. + * + * C Signature: + * + * int sqlite3_data_count(sqlite3_stmt *pStmt); + * + * See https://www.sqlite.org/c3ref/data_count.html + */ + sqlite3_data_count: (stmt: PreparedStatement | WasmPointer) => number; + + /** + * Get a BLOB result value from a column in the current result row. + * + * C Signature: + * + * const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); + * + * See https://www.sqlite.org/c3ref/column_blob.html + */ + sqlite3_column_blob: ( + stmt: PreparedStatement | WasmPointer, + colIdx: number, + ) => WasmPointer; + + /** + * Get a double precision floating point result value from a column in the + * current result row. + * + * C Signature: + * + * double sqlite3_column_blob(sqlite3_stmt*, int iCol); + * + * See https://www.sqlite.org/c3ref/column_blob.html + */ + sqlite3_column_double: ( + stmt: PreparedStatement | WasmPointer, + colIdx: number, + ) => number; + + /** + * Get an integer result value from a column in the current result row. + * + * C Signature: + * + * int sqlite3_column_int(sqlite3_stmt*, int iCol); + * + * See https://www.sqlite.org/c3ref/column_blob.html + */ + sqlite3_column_int: ( + stmt: PreparedStatement | WasmPointer, + colIdx: number, + ) => number; + + /** + * Get a 64bit integer result value from a column in the current result row. + * + * C Signature: + * + * sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); + * + * See https://www.sqlite.org/c3ref/column_blob.html + */ + sqlite3_column_int64: (db: Database | WasmPointer, colIdx: number) => bigint; + + /** + * Get a TEXT result value from a column in the current result row. + * + * C Signature: + * + * const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); + * + * See https://www.sqlite.org/c3ref/column_blob.html + */ + sqlite3_column_text: ( + stmt: PreparedStatement | WasmPointer, + colIdx: number, + ) => string; + + /** + * Get a `sql_value*` result value from a column in the current result row. + * + * C Signature: + * + * const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); + * + * See https://www.sqlite.org/c3ref/column_blob.html + */ + sqlite3_column_value: ( + stmt: PreparedStatement | WasmPointer, + colIdx: number, + ) => WasmPointer; + + /** + * Returns the initial data type of the result column in the current result + * row. + * + * C Signature: + * + * int sqlite3_column_bytes(sqlite3_stmt*, int iCol); + * + * See https://www.sqlite.org/c3ref/column_blob.html + */ + sqlite3_column_bytes: ( + stmt: PreparedStatement | WasmPointer, + colIdx: number, + ) => number; + + /** + * Get the length in bytes of a BLOB or TEXT column in the current result row. + * + * C Signature: + * + * int sqlite3_column_type(sqlite3_stmt*, int iCol); + * + * See https://www.sqlite.org/c3ref/column_blob.html + */ + sqlite3_column_type: ( + stmt: PreparedStatement | WasmPointer, + colIdx: number, + ) => number; + + /** + * The `sqlite3_finalize()` function is called to delete a prepared statement. + * If the most recent evaluation of the statement encountered no errors or if + * the statement is never been evaluated, then `sqlite3_finalize()` returns + * `SQLITE_OK`. If the most recent evaluation of statement `stmt` failed, then + * `sqlite3_finalize(stmt)` returns the appropriate error code or extended + * error code. + * + * C Signature: + * + * int sqlite3_finalize(sqlite3_stmt *pStmt); + * + * See https://www.sqlite.org/c3ref/finalize.html + */ + sqlite3_finalize: (stmt: PreparedStatement | WasmPointer) => number; + + /** + * Called to reset a [prepared statement] object back to its initial state, + * ready to be re-executed. Any SQL statement variables that had values bound + * to them using the `sqlite3_bind_*()` API retain their values. Use + * `sqlite3_clear_bindings()` to reset the bindings. + * + * C Signature: + * + * int sqlite3_reset(sqlite3_stmt *pStmt); + * + * See https://www.sqlite.org/c3ref/reset.html + */ + sqlite3_reset: (stmt: PreparedStatement | WasmPointer) => number; + + /** + * Add SQL function or aggregation or redefine the behavior of an existing SQL + * function or aggregation. + * + * C Signature: + * + * int sqlite3_create_function( + * sqlite3 *db, + * const char *zFunctionName, + * int nArg, + * int eTextRep, + * void *pApp, + * void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + * void (*xStep)(sqlite3_context*,int,sqlite3_value**), + * void (*xFinal)(sqlite3_context*) + * ); + * + * See https://www.sqlite.org/c3ref/create_function.html + */ + sqlite3_create_function: ( + db: Database | WasmPointer, + functionName: string | WasmPointer, + nArg: number, + eTextRep: CAPI['SQLITE_UTF8'], + pApp: WasmPointer, + xFunc: + | ((ctx: WasmPointer, ...values: SqlValue[]) => SqlValue) + | WasmPointer, + xStep: ((ctx: WasmPointer, ...values: SqlValue[]) => void) | WasmPointer, + xFinal: ((ctx: WasmPointer) => SqlValue) | WasmPointer, + ) => number; + + /** + * Add SQL function or aggregation or redefine the behavior of an existing SQL + * function or aggregation. + * + * C Signature: + * + * int sqlite3_create_function_v2( + * sqlite3 *db, + * const char *zFunctionName, + * int nArg, + * int eTextRep, + * void *pApp, + * void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + * void (*xStep)(sqlite3_context*,int,sqlite3_value**), + * void (*xFinal)(sqlite3_context*), + * void(*xDestroy)(void*) + * ); + * + * See https://www.sqlite.org/c3ref/create_function.html + */ + sqlite3_create_function_v2: ( + db: Database | WasmPointer, + functionName: string | WasmPointer, + nArg: number, + eTextRep: CAPI['SQLITE_UTF8'], + pApp: WasmPointer, + xFunc: + | ((ctx: WasmPointer, ...values: SqlValue[]) => SqlValue) + | WasmPointer, + xStep: ((ctx: WasmPointer, ...values: SqlValue[]) => void) | WasmPointer, + xFinal: ((ctx: WasmPointer) => SqlValue) | WasmPointer, + xDestroy: (() => void) | WasmPointer, + ) => number; + + /** + * Add SQL aggregate window function or redefine the behavior of an existing + * SQL aggregate window function. + * + * C Signature: + * + * int sqlite3_create_window_function( + * sqlite3 *db, + * const char *zFunctionName, + * int nArg, + * int eTextRep, + * void *pApp, + * void (*xStep)(sqlite3_context*,int,sqlite3_value**), + * void (*xFinal)(sqlite3_context*), + * void (*xValue)(sqlite3_context*), + * void (*xInverse)(sqlite3_context*,int,sqlite3_value**), + * void(*xDestroy)(void*) + * ); + * + * See https://www.sqlite.org/c3ref/create_function.html + */ + sqlite3_create_window_function: ( + db: Database | WasmPointer, + functionName: string | WasmPointer, + nArg: number, + eTextRep: CAPI['SQLITE_UTF8'], + pApp: WasmPointer, + xStep: + | ((ctx: WasmPointer, ...values: SqlValue[]) => SqlValue) + | WasmPointer, + xFinal: ((ctx: WasmPointer) => SqlValue) | WasmPointer, + xValue: ((ctx: WasmPointer) => void) | WasmPointer, + xInverse: ((ctx: WasmPointer, ...values: SqlValue[]) => void) | WasmPointer, + xDestroy: (() => void) | WasmPointer, + ) => number; + + /** + * Extract a `BLOB` value from a protected `sqlite3_value` object. + * + * **Achtung:** The pointer returned from this function can be invalidated by + * subsequent calls to `sqlite3_value_bytes` or `sqlite3_value_text()`! + * + * C Signature: + * + * const void *sqlite3_value_blob(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_blob.html + */ + sqlite3_value_blob: (sqliteValue: WasmPointer) => WasmPointer; + + /** + * Extract a `REAL` value from a protected `sqlite3_value` object. + * + * C Signature: + * + * double sqlite3_value_double(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_blob.html + */ + sqlite3_value_double: (sqliteValue: WasmPointer) => number; + + /** + * Extract a `INTEGER` value from a protected `sqlite3_value` object. + * + * C Signature: + * + * int sqlite3_value_int(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_blob.html + */ + sqlite3_value_int: (sqliteValue: WasmPointer) => number; + + /** + * Extract a 64-bit `INTEGER` value from a protected `sqlite3_value` object. + * + * C Signature: + * + * sqlite3_int64 sqlite3_value_int64(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_blob.html + */ + sqlite3_value_int64: (sqliteValue: WasmPointer) => bigint; + + /** + * Extract a pointer value from a protected `sqlite3_value` object. If the + * object was not initialized using `sqlite3_bind_pointer` or + * `sqlite3_result_pointer`, then this routine returns a NULL pointer. + * + * C Signature: + * + * void *sqlite3_value_pointer(sqlite3_value*, const char*); + * + * See https://www.sqlite.org/c3ref/value_blob.html + */ + sqlite3_value_pointer: ( + sqliteValue: WasmPointer, + type: string | WasmPointer, + ) => WasmPointer; + + /** + * Extract a `TEXT` value from a protected `sqlite3_value` object. + * + * **Achtung:** The pointer returned from this function can be invalidated by + * subsequent calls to `sqlite3_value_bytes()` or `sqlite3_value_text()`! + * + * C Signature: + * + * const unsigned char *sqlite3_value_text(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_blob.html + */ + sqlite3_value_text: (sqliteValue: WasmPointer) => string; + + /** + * Get the size of a `BLOB` or `TEXT` value in bytes from a protected + * `sqlite3_value` object. + * + * C Signature: + * + * int sqlite3_value_bytes(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_blob.html + */ + sqlite3_value_bytes: (sqliteValue: WasmPointer) => number; + + /** + * Get the default datatype of the value from a protected `sqlite3_value` + * object. + * + * C Signature: + * + * int sqlite3_value_type(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_blob.html + */ + sqlite3_value_type: (sqliteValue: WasmPointer) => number; + + /** + * Get the best numeric datatype of the value from a protected `sqlite3_value` + * object. + * + * C Signature: + * + * int sqlite3_value_numeric_type(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_blob.html + */ + sqlite3_value_numeric_type: (sqliteValue: WasmPointer) => number; + + /** + * Within the `xUpdate` method of a virtual table, the + * `sqlite3_value_nochange(sqliteValue)` interface returns true if and only if + * the column corresponding to `sqliteValue` is unchanged by the `UPDATE` + * operation that the `xUpdate` method call was invoked to implement and if + * and the prior `xColumn` method call that was invoked to extracted the value + * for that column returned without setting a result (probably because it + * queried `sqlite3_vtab_nochange()` and found that the column was + * unchanging). + * + * C Signature: + * + * int sqlite3_value_nochange(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_blob.html + */ + sqlite3_value_nochange: (sqliteValue: WasmPointer) => number; + + /** + * Returns non-zero if the value `sqliteValue` originated from one of the + * `sqlite3_bind()` interfaces. If `sqliteValue` comes from an SQL literal + * value, or a table column, or an expression, then + * `sqlite3_value_frombind(sqliteValue)` returns zero. + * + * C Signature: + * + * int sqlite3_value_frombind(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_blob.html + */ + sqlite3_value_frombind: (sqliteValue: WasmPointer) => number; + + /** + * Returns the subtype for an application-defined SQL function argument + * `sqliteValue`. The subtype information can be used to pass a limited amount + * of context from one SQL function to another. Use the + * `sqlite3_result_subtype()` routine to set the subtype for the return value + * of an SQL function. + * + * C Signature: + * + * int sqlite3_value_subtype(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_subtype.html + */ + sqlite3_value_subtype: (sqliteValue: WasmPointer) => number; + + /** + * Makes a copy of the `sqlite3_value` object `sqliteValue` and returns a + * pointer to that copy. The `sqlite3_value` returned is a protected + * `sqlite3_value` object even if the input is not. If `sqliteValue is a + * pointer value, then the result is a NULL value. + * + * C Signature: + * + * sqlite3_value *sqlite3_value_dup(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_dup.html + */ + sqlite3_value_dup: (sqliteValue: WasmPointer) => WasmPointer; + + /** + * Frees an `sqlite3_value` object previously obtained from + * `sqlite3_value_dup()`. + * + * C Signature: + * + * void sqlite3_value_free(sqlite3_value*); + * + * See https://www.sqlite.org/c3ref/value_dup.html + */ + sqlite3_value_free: (sqliteValue: WasmPointer) => void; + + /** + * Implementations of aggregate SQL functions use this routine to allocate + * memory for storing their state. + * + * C Signature: + * + * void *sqlite3_aggregate_context(sqlite3_context*, int nBytes); + * + * See https://www.sqlite.org/c3ref/aggregate_context.html + */ + sqlite3_aggregate_context: (ctx: WasmPointer, nBytes: number) => WasmPointer; + + /** + * A thin wrapper around `sqlite3_aggregate_context()` which behaves the same + * except that if that function returns 0 and `nBytes` is truthy, it throws a + * `WasmAllocError`. If `nBytes` is falsy, it simply returns 0 if that + * function returns 0. That behavior is intended to assist in developing + * `xFinal()` implementations. + * + * See + * https://sqlite.org/wasm/doc/trunk/api-c-style.md#sqlite3_js_aggregate_context + */ + sqlite3_js_aggregate_context: ( + ctx: WasmPointer, + nBytes: number, + ) => WasmPointer; + + /** + * Returns a copy of the pointer that was the `pUserData` parameter (the 5th + * parameter) of the `sqlite3_create_function()` routine that originally + * registered the application defined function. + * + * C Signature: + * + * void *sqlite3_user_data(sqlite3_context*); + * + * See https://www.sqlite.org/c3ref/user_data.html + */ + sqlite3_user_data: (ctx: WasmPointer) => WasmPointer; + + /** + * Returns a copy of the pointer to the database connection (the 1st + * parameter) of the `sqlite3_create_function()` routine that originally + * registered the application defined function. + * + * C Signature: + * + * sqlite3 *sqlite3_context_db_handle(sqlite3_context*); + * + * See https://www.sqlite.org/c3ref/context_db_handle.html + */ + sqlite3_context_db_handle: (ctx: WasmPointer) => WasmPointer; + + /** + * Returns a pointer to the metadata associated by the + * `sqlite3_set_auxdata(ctx, n , pAux, xDelete)` function with the `n`th + * argument value to the application-defined function. `n` is zero for the + * left-most function argument. + * + * C Signature: + * + * void *sqlite3_get_auxdata(sqlite3_context*, int N); + * + * See https://www.sqlite.org/c3ref/get_auxdata.html + */ + sqlite3_get_auxdata: (ctx: WasmPointer, n: number) => WasmPointer; + + /** + * Saves `pAux` as metadata for the `n`-th argument of the application-defined + * function. + * + * C Signature: + * + * void sqlite3_set_auxdata( + * sqlite3_context*, + * int N, + * void*, + * void (*)(void*) + * ); + * + * See https://www.sqlite.org/c3ref/get_auxdata.html + */ + sqlite3_set_auxdata: ( + ctx: WasmPointer, + n: number, + pAux: WasmPointer, + xDelete: (() => void) | WasmPointer, + ) => void; + + /** + * Sets the result from an application-defined function to be the `BLOB` whose + * content is pointed to by the second parameter and which is `blobLen` bytes + * long. + * + * C Signature: + * + * void sqlite3_result_blob( + * sqlite3_context*, + * const void*, + * int, + * void(*)(void*) + * ); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_blob: ( + ctx: WasmPointer, + blob: WasmPointer, + blobLen: number, + dtor: + | (() => void) + | WasmPointer + | CAPI['SQLITE_STATIC'] + | CAPI['SQLITE_TRANSIENT'] + | CAPI['SQLITE_WASM_DEALLOC'], + ) => void; + + /** + * Sets the result from an application-defined function to be a floating point + * value specified by its 2nd argument. + * + * C Signature: + * + * void sqlite3_result_double(sqlite3_context*, double); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_double: (ctx: WasmPointer, value: number) => void; + + /** + * Cause the implemented SQL function to throw an exception. + * + * SQLite uses the string pointed to by the 2nd parameter as the text of an + * error message. + * + * C Signature: + * + * void sqlite3_result_error(sqlite3_context*, const char*, int); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_error: ( + ctx: WasmPointer, + msg: string | WasmPointer, + msgLen: number, + ) => void; + + /** + * Causes SQLite to throw an error indicating that a string or BLOB is too + * long to represent. + * + * C Signature: + * + * void sqlite3_result_error_toobig(sqlite3_context*); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_error_toobig: (ctx: WasmPointer) => void; + + /** + * Causes SQLite to throw an + * + * - Error indicating that a memory allocation failed. + * + * C Signature: + * + * void sqlite3_result_error_nomem(sqlite3_context*); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_error_nomem: (ctx: WasmPointer) => void; + + /** + * Changes the error code returned by SQLite as a result of an error in a + * function. By default, the error code is `SQLITE_ERROR`. A subsequent call + * to `sqlite3_result_error()` resets the error code to `SQLITE_ERROR`. + * + * C Signature: + * + * void sqlite3_result_error_code(sqlite3_context*, int); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_error_code: (ctx: WasmPointer, code: number) => void; + + /** + * Calls either `sqlite3_result_error_nomem()`, if `err` is-a + * `WasmAllocError`, or `sqlite3_result_error()`. In the latter case, the + * second arugment is coerced to a string to create the error message. + * + * See + * https://sqlite.org/wasm/doc/trunk/api-c-style.md#sqlite3_result_error_js + */ + sqlite3_result_error_js: (ctx: WasmPointer, err: Error) => void; + + /** + * Sets the return value of the application-defined function to be the 32-bit + * signed integer value given in the 2nd argument. + * + * C Signature: + * + * void sqlite3_result_int(sqlite3_context*, int); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_int: (ctx: WasmPointer, value: number) => void; + + /** + * Sets the return value of the application-defined function to be the 64-bit + * signed integer value given in the 2nd argument. + * + * C Signature: + * + * void sqlite3_result_int64(sqlite3_context*, sqlite3_int64); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_int64: (ctx: WasmPointer, value: bigint) => void; + + /** + * Sets the return value of the application-defined function to be `NULL`. + * + * C Signature: + * + * void sqlite3_result_null(sqlite3_context*); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_null: (ctx: WasmPointer) => void; + + /** + * Set the return value of the application-defined function to be a text + * string + * + * C Signature: + * + * void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*)); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_text: ( + ctx: WasmPointer, + text: string | WasmPointer, + textLen: number, + dtor: + | (() => void) + | WasmPointer + | CAPI['SQLITE_STATIC'] + | CAPI['SQLITE_TRANSIENT'] + | CAPI['SQLITE_WASM_DEALLOC'], + ) => void; + + /** + * Sets the result to an SQL `NULL` value, just like + * `sqlite3_result_null(ctx)`, except that it also associates the + * host-language pointer `value` or `type` with that `NULL` value such that + * the pointer can be retrieved within an application-defined SQL function + * using `sqlite3_value_pointer()`. + * + * C Signature: + * + * void sqlite3_result_pointer(sqlite3_context*, void*,const char*,void(*)(void*)); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_pointer: ( + ctx: WasmPointer, + value: WasmPointer, + type: string | WasmPointer, + dtor: + | (() => void) + | WasmPointer + | CAPI['SQLITE_STATIC'] + | CAPI['SQLITE_TRANSIENT'] + | CAPI['SQLITE_WASM_DEALLOC'], + ) => void; + + /** + * Set the result of the application-defined function to be a `BLOB` + * containing all zero bytes and `blobLen` bytes in size. + * + * C Signature: + * + * void sqlite3_result_zeroblob(sqlite3_context*, int n); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_zeroblob: (ctx: WasmPointer, blobLen: number) => void; + + /** + * Set the result of the application-defined function to be a `BLOB` + * containing all zero bytes and `blobLen` bytes in size. + * + * C Signature: + * + * void sqlite3_result_zeroblob(sqlite3_context*, int n); + * + * See https://www.sqlite.org/c3ref/result_blob.html + */ + sqlite3_result_zeroblob64: (ctx: WasmPointer, blobLen: bigint) => void; + + /** + * Causes the subtype of the result from the application-defined SQL function + * with `sqlite3_context` `ctx` to be the value `subtype`. Only the lower 8 + * bits of the `subtype` are preserved in current versions of SQLite; higher + * order bits are discarded. + * + * C Signature: + * + * void sqlite3_result_subtype(sqlite3_context*,unsigned int); + * + * See https://www.sqlite.org/c3ref/result_subtype.html + */ + sqlite3_result_subtype: (ctx: WasmPointer, subtype: number) => void; + + /** + * This acts as a proxy for one of the other `sqlite3_result_...()` routines, + * depending on the type of its 2nd argument: + * + * - If `(val instanceof Error)`, this function passes it to + * `sqlite3_result_error_js()`. + * - `null`: `sqlite3_result_null()` + * - `boolean`: `sqlite3_result_int()` with a value of 0 or 1. `- `number`: + * `sqlite3_result_int()`, `sqlite3_result_int64()`, or + * `sqlite3_result_double()`, depending on the range of the number and + * whether or not `int64` support is enabled. + * - `BigInt`: similar to number but will trigger an error if the value is too + * big to store in an `int64`. + * - `string`: `sqlite3_result_text() + * - `Uint8Array` or `Int8Array`: `sqlite3_result_blob()` + * - `undefined`: is a no-op provided to simplify certain use cases. + * + * On error, it calls `sqlite3_result_error()` with a description of the + * problem. + * + * See https://sqlite.org/wasm/doc/trunk/api-c-style.md#sqlite3_result_js + */ + sqlite3_result_js: ( + ctx: WasmPointer, + val: + | Error + | null + | boolean + | number + | bigint + | string + | Uint8Array + | Int8Array + | undefined, + ) => void; + + /** + * Add a collation to a database connection. + * + * C Signature: + * + * int sqlite3_create_collation( + * sqlite3*, + * const char *zName, + * int eTextRep, + * void *pArg, + * int(*xCompare)(void*,int,const void*,int,const void*) + * ); + * + * See https://www.sqlite.org/c3ref/create_collation.html + */ + sqlite3_create_collation: ( + db: Database | WasmPointer, + zName: string, + eTextRep: CAPI['SQLITE_UTF8'], + pArg: WasmPointer, + xCompare: + | (( + pCtx: WasmPointer, + len1: number, + p1: WasmPointer, + len2: number, + p2: WasmPointer, + ) => number) + | WasmPointer, + ) => number; + + /** + * Add a collation to a database connection. + * + * C Signature: + * + * int sqlite3_create_collation_v2( + * sqlite3*, + * const char *zName, + * int eTextRep, + * void *pArg, + * int(*xCompare)(void*,int,const void*,int,const void*), + * void(*xDestroy)(void*) + * ); + * + * See https://www.sqlite.org/c3ref/create_collation.html + */ + sqlite3_create_collation_v2: ( + db: Database | WasmPointer, + zName: string, + eTextRep: CAPI['SQLITE_UTF8'], + pArg: WasmPointer, + xCompare: + | (( + pCtx: WasmPointer, + len1: number, + p1: WasmPointer, + len2: number, + p2: WasmPointer, + ) => number) + | WasmPointer, + xDestroy: ((pCtx: WasmPointer) => void) | WasmPointer, + ) => number; + + /** + * To avoid having to register all collation sequences before a database can + * be used, a single callback function may be registered with the database + * connection to be invoked whenever an undefined collation sequence is + * required. + * + * C Signature: + * + * int sqlite3_collation_needed( + * sqlite3*, + * void*, + * void(*)(void*,sqlite3*,int eTextRep,const char*) + * ); + * + * See https://www.sqlite.org/c3ref/collation_needed.html + */ + sqlite3_collation_needed: ( + db: Database | WasmPointer, + cbArg: WasmPointer, + callback: + | (( + cbArg: WasmPointer, + db: Database | WasmPointer, + eTextRep: number, + name: string | WasmPointer, + ) => void) + | WasmPointer, + ) => number; + + /** + * Returns the database connection handle to which a prepared statement + * belongs. The database connection returned by `sqlite3_db_handle` is the + * same database connection that was the first argument to the + * `sqlite3_prepare_v2()` call (or its variants) that was used to create the + * statement in the first place. + * + * C Signature: + * + * sqlite3 *sqlite3_db_handle(sqlite3_stmt*); + * + * See https://www.sqlite.org/c3ref/db_handle.html + */ + sqlite3_db_handle: (stmt: PreparedStatement | WasmPointer) => WasmPointer; + + /** + * Return The Schema Name For A Database Connection + * + * C Signature: + * + * const char *sqlite3_db_name(sqlite3 *db, const char *zDbName); + * + * See https://www.sqlite.org/c3ref/db_name.html + */ + sqlite3_db_name: (db: Database | WasmPointer, dbIdx: number) => string; + + /** + * Return The Filename For A Database Connection + * + * C Signature: + * + * sqlite3_filename sqlite3_db_filename(sqlite3 *db, const char *zDbName); + * + * See https://www.sqlite.org/c3ref/db_filename.html + */ + sqlite3_db_filename: ( + db: Database | WasmPointer, + dbName: string | WasmPointer, + ) => string; + + /** + * Determine the transaction state of a database + * + * C Signature: + * + * int sqlite3_txn_state(sqlite3*,const char *zSchema); + * + * See https://www.sqlite.org/c3ref/txn_state.html + */ + sqlite3_txn_state: ( + db: Database | WasmPointer, + schema: string | WasmPointer, + ) => + | CAPI['SQLITE_TXN_NONE'] + | CAPI['SQLITE_TXN_READ'] + | CAPI['SQLITE_TXN_WRITE'] + | -1; + + /** + * Registers a callback function to be invoked whenever a transaction is + * committed. Any callback set by a previous call to `sqlite3_commit_hook()` + * for the same database connection is overridden. + * + * C Signature: + * + * void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); + * + * See https://www.sqlite.org/c3ref/commit_hook.html + */ + sqlite3_commit_hook: ( + db: Database | WasmPointer, + hook: ((cbArg: WasmPointer) => number) | WasmPointer, + cbArg: WasmPointer, + ) => WasmPointer; + + /** + * The `sqlite3_rollback_hook()` interface registers a callback function to be + * invoked whenever a transaction is rolled back. Any callback set by a + * previous call to `sqlite3_rollback_hook()` for the same database connection + * is overridden. + * + * C Signature: + * + * void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); + * + * See https://www.sqlite.org/c3ref/commit_hook.html + */ + sqlite3_rollback_hook: ( + db: Database | WasmPointer, + hook: ((cbArg: WasmPointer) => number) | WasmPointer, + cbArg: WasmPointer, + ) => WasmPointer; + + /** + * Registers a callback function with the database connection identified by + * the first argument to be invoked whenever a row is updated, inserted or + * deleted in a rowid table. Any callback set by a previous call to this + * function for the same database connection is overridden. + * + * C Signature: + * + * void *sqlite3_update_hook( + * sqlite3*, + * void(*)(void *,int ,char const *,char const *,sqlite3_int64), + * void* + * ); + * + * See https://www.sqlite.org/c3ref/update_hook.html + */ + sqlite3_update_hook: ( + db: Database | WasmPointer, + xUpdate: ( + userCtx: WasmPointer, + op: CAPI['SQLITE_UPDATE'] | CAPI['SQLITE_DELETE'] | CAPI['SQLITE_INSERT'], + dbName: string, + tableName: string, + newRowId: bigint, + ) => void, + userCtx: WasmPointer, + ) => WasmPointer; + + /** + * Returns information about column `colName` of table `tblName` in database + * `dbName` on database connection `db`. The `sqlite3_table_column_metadata()` + * interface returns `SQLITE_OK` and fills in the non-NULL pointers in the + * final five arguments with appropriate values if the specified column + * exists. The `sqlite3_table_column_metadata()` interface returns + * `SQLITE_ERROR` if the specified column does not exist. + * + * C Signature: + * + * int sqlite3_table_column_metadata( + * sqlite3 *db, + * const char *zDbName, + * const char *zTableName, + * const char *zColumnName, + * char const **pzDataType, + * char const **pzCollSeq, + * int *pNotNull, + * int *pPrimaryKey, + * int *pAutoinc + * ); + * + * See https://www.sqlite.org/c3ref/table_column_metadata.html + * + * @param db Connection handle + * @param dbname Database name or NULL + * @param tblName Table name + * @param colName Column name + * @param pDataType OUTPUT: Declared data type + * @param pCollSeq OUTPUT: Collation sequence name + * @param pNotNull OUTPUT: True if NOT NULL constraint exists + * @param pPrimaryKey OUTPUT: True if column part of PK + * @param pAutoinc OUTPUT: True if column is auto-increment + */ + sqlite3_table_column_metadata: ( + db: Database | WasmPointer, + dbName: string | WasmPointer, + tblName: string | WasmPointer, + colName: string | WasmPointer, + pDataType: WasmPointer, + pCollSeq: WasmPointer, + pNotNull: WasmPointer, + pPrimaryKey: WasmPointer, + pAutoinc: WasmPointer, + ) => number; + + /** + * Automatically Load Statically Linked Extensions + * + * Causes the `xEntryPoint()` function to be invoked for each new database + * connection that is created. The idea here is that `xEntryPoint()` is the + * entry point for a statically linked SQLite extension that is to be + * automatically loaded into all new database connections. + * + * Even though the function prototype shows that `xEntryPoint()` takes no + * arguments and returns `void`, SQLite invokes `xEntryPoint()` with three + * arguments and expects an integer result as if the signature of the entry + * point where as follows: + * + * int xEntryPoint( + * sqlite3 *db, + * const char **pzErrMsg, + * const struct sqlite3_api_routines *pThunk + * ); + * + * C Signature: + * + * int sqlite3_auto_extension(void(*xEntryPoint)(void)); + * + * See https://www.sqlite.org/c3ref/auto_extension.html + */ + sqlite3_auto_extension: ( + xEntryPoint: + | (( + db: Database | WasmPointer, + pzErrMsg: WasmPointer, + pThunk: WasmPointer, + ) => number) + | WasmPointer, + ) => number; + + /** + * Cancel Automatic Extension Loading + * + * Unregisters the initialization routine `xEntryPoint` that was registered + * using a prior call to `sqlite3_auto_extension(xEntryPoint)`. + * + * C Signature: + * + * int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void)); + * + * See https://www.sqlite.org/c3ref/cancel_auto_extension.html + */ + sqlite3_cancel_auto_extension: (xEntryPoint: WasmPointer) => number; + + /** + * Reset Automatic Extension Loading + * + * Disables all automatic extensions previously registered using + * `sqlite3_auto_extension()`. + * + * C Signature: + * + * void sqlite3_reset_auto_extension(void); + * + * See https://www.sqlite.org/c3ref/reset_auto_extension.html + */ + sqlite3_reset_auto_extension: () => void; + + /** + * Register A Virtual Table Implementation + * + * Used to register a new virtual table module name. Module names must be + * registered before creating a new virtual table using the module and before + * using a preexisting virtual table for the module. + * + * C Signature: + * + * int sqlite3_create_module( + * sqlite3 *db, + * const char *zName, + * const sqlite3_module *p, + * void *pClientData + * ); + * + * See https://www.sqlite.org/c3ref/create_module.html + */ + sqlite3_create_module: ( + db: Database | WasmPointer, + name: string, + module: WasmPointer | sqlite3_module, + clientData: WasmPointer, + ) => number; + + /** + * Register A Virtual Table Implementation + * + * Used to register a new virtual table module name. Module names must be + * registered before creating a new virtual table using the module and before + * using a preexisting virtual table for the module. + * + * C Signature: + * + * int sqlite3_create_module_v2( + * sqlite3 *db, + * const char *zName, + * const sqlite3_module *p, + * void *pClientData, + * void(*xDestroy)(void*) + * ); + * + * See https://www.sqlite.org/c3ref/create_module.html + */ + sqlite3_create_module_v2: ( + db: Database | WasmPointer, + name: string, + module: WasmPointer | sqlite3_module, + clientData: WasmPointer, + destroy?: () => void, + ) => number; + + /** + * Remove Unnecessary Virtual Table Implementations + * + * Removes all virtual table modules from database connection `db` except + * those named on list `azKeep`. The `azKeepp` parameter must be either NULL + * or a pointer to an array of pointers to strings where the array is + * terminated by a single NULL pointer. If the `azKeep` parameter is NULL, + * then all virtual table modules are removed. + * + * C Signature: + * + * int sqlite3_drop_modules( + * sqlite3 *db, + * const char **azKeep + * ); + * + * See https://www.sqlite.org/c3ref/drop_modules.html + */ + sqlite3_drop_modules: ( + db: Database | WasmPointer, + azKeep: WasmPointer, + ) => number; + + /** + * Declare The Schema Of A Virtual Table + * + * The `xCreate` and `xConnect` methods of a virtual table module call this + * interface to declare the format (the names and datatypes of the columns) of + * the virtual tables they implement. + * + * C Signature: + * + * int sqlite3_declare_vtab(sqlite3*, const char *zSQL); + * + * See https://www.sqlite.org/c3ref/declare_vtab.html + */ + sqlite3_declare_vtab: ( + db: Database | WasmPointer, + sql: string | WasmPointer, + ) => number; + + /** + * Overload A Function For A Virtual Table + * + * Virtual tables can provide alternative implementations of functions using + * the `xFindFunction` method of the virtual table module. But global versions + * of those functions must exist in order to be overloaded. + * + * This API makes sure a global version of a function with a particular name + * and number of parameters exists. If no such function exists before this API + * is called, a new function is created. The implementation of the new + * function always causes an exception to be thrown. So the new function is + * not good for anything by itself. Its only purpose is to be a placeholder + * function that can be overloaded by a virtual table. + * + * C Signature: + * + * int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg); + * + * See https://www.sqlite.org/c3ref/overload_function.html + */ + sqlite3_overload_function: ( + db: Database | WasmPointer, + funcName: string, + nArgs: number, + ) => number; + + /** + * Returns a pointer to a VFS given its name. Names are case sensitive. + * + * C Signature: + * + * sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName); + * + * See https://www.sqlite.org/c3ref/vfs_find.html + */ + sqlite3_vfs_find: (vfsName: string | null) => WasmPointer; + + /** + * Register a new VFS. Becomes the default if the makeDflt parameter is set. + * + * C Signature: + * + * int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt); + * + * See https://www.sqlite.org/c3ref/vfs_find.html + */ + sqlite3_vfs_register: ( + vfs: sqlite3_vfs | WasmPointer | string, + makeDflt: number, + ) => number; + + /** + * Unregister a VFS. If it is the default, another VFS is chosen as the + * default. + * + * C Signature: + * + * int sqlite3_vfs_unregister(sqlite3_vfs*); + * + * See https://www.sqlite.org/c3ref/vfs_find.html + */ + sqlite3_vfs_unregister: (vfs: sqlite3_vfs | WasmPointer | string) => number; + + /** + * Low-Level Control Of Database Files + * + * Makes a direct call to the `xFileControl` method for the + * `sqlite3_io_methods` object associated with a particular database + * identified by the second argument. The name of the database is `"main"` for + * the main database or `"temp"` for the `TEMP` database, or the name that + * appears after the `AS` keyword for databases that are added using the + * `ATTACH` SQL command. + * + * C Signature: + * + * int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*); + * + * See https://www.sqlite.org/c3ref/file_control.html + */ + sqlite3_file_control: ( + db: Database | WasmPointer, + dbName: string | WasmPointer, + op: + | CAPI['SQLITE_FCNTL_BEGIN_ATOMIC_WRITE'] + | CAPI['SQLITE_FCNTL_LOCKSTATE'] + | CAPI['SQLITE_FCNTL_GET_LOCKPROXYFILE'] + | CAPI['SQLITE_FCNTL_SET_LOCKPROXYFILE'] + | CAPI['SQLITE_FCNTL_LAST_ERRNO'] + | CAPI['SQLITE_FCNTL_SIZE_HINT'] + | CAPI['SQLITE_FCNTL_CHUNK_SIZE'] + | CAPI['SQLITE_FCNTL_FILE_POINTER'] + | CAPI['SQLITE_FCNTL_SYNC_OMITTED'] + | CAPI['SQLITE_FCNTL_WIN32_AV_RETRY'] + | CAPI['SQLITE_FCNTL_PERSIST_WAL'] + | CAPI['SQLITE_FCNTL_OVERWRITE'] + | CAPI['SQLITE_FCNTL_VFSNAME'] + | CAPI['SQLITE_FCNTL_POWERSAFE_OVERWRITE'] + | CAPI['SQLITE_FCNTL_PRAGMA'] + | CAPI['SQLITE_FCNTL_BUSYHANDLER'] + | CAPI['SQLITE_FCNTL_TEMPFILENAME'] + | CAPI['SQLITE_FCNTL_MMAP_SIZE'] + | CAPI['SQLITE_FCNTL_TRACE'] + | CAPI['SQLITE_FCNTL_HAS_MOVED'] + | CAPI['SQLITE_FCNTL_SYNC'] + | CAPI['SQLITE_FCNTL_COMMIT_PHASETWO'] + | CAPI['SQLITE_FCNTL_WIN32_SET_HANDLE'] + | CAPI['SQLITE_FCNTL_WAL_BLOCK'] + | CAPI['SQLITE_FCNTL_ZIPVFS'] + | CAPI['SQLITE_FCNTL_RBU'] + | CAPI['SQLITE_FCNTL_VFS_POINTER'] + | CAPI['SQLITE_FCNTL_JOURNAL_POINTER'] + | CAPI['SQLITE_FCNTL_WIN32_GET_HANDLE'] + | CAPI['SQLITE_FCNTL_PDB'] + | CAPI['SQLITE_FCNTL_BEGIN_ATOMIC_WRITE'] + | CAPI['SQLITE_FCNTL_COMMIT_ATOMIC_WRITE'] + | CAPI['SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE'] + | CAPI['SQLITE_FCNTL_LOCK_TIMEOUT'] + | CAPI['SQLITE_FCNTL_DATA_VERSION'] + | CAPI['SQLITE_FCNTL_SIZE_LIMIT'] + | CAPI['SQLITE_FCNTL_CKPT_DONE'] + | CAPI['SQLITE_FCNTL_RESERVE_BYTES'] + | CAPI['SQLITE_FCNTL_CKPT_START'] + | CAPI['SQLITE_FCNTL_EXTERNAL_READER'] + | CAPI['SQLITE_FCNTL_CKSM_FILE'], + arg: WasmPointer, + ) => number; + + /** + * Returns the number of distinct keywords understood by SQLite. + * + * C Signature: + * + * int sqlite3_keyword_count(void); + * + * See https://www.sqlite.org/c3ref/keyword_count.html + */ + sqlite3_keyword_count: () => number; + + /** + * Finds the `i`-th keyword and makes `*pOut` point to that keyword expressed + * as UTF8 and writes the number of bytes in the keyword into `*pOutLen`. The + * string that `*pOut` points to is not zero-terminated. The + * `sqlite3_keyword_name(i, pOut, pOutLen)` routine returns `SQLITE_OK` if + * `pOutLen` is within bounds and `SQLITE_ERROR` if not. If either`pOut` or + * `pOutLen` are `NULL` or invalid pointers then calls to + * `sqlite3_keyword_name(i, pOut, pOutLen)` result in undefined behavior. + * + * C Signature: + * + * int sqlite3_keyword_name(int i, const char **pOut, int *pOutLen); + * + * See https://www.sqlite.org/c3ref/keyword_count.html + */ + sqlite3_keyword_name: ( + i: number, + pOut: WasmPointer, + pOutLen: WasmPointer, + ) => number; + + /** + * Checks to see whether or not the `n`-byte UTF8 identifier that `name` + * points to is a keyword, returning non-zero if it is and zero if not. + * + * C Signature: + * + * int sqlite3_keyword_check(const char *zName, int nName); + * + * See https://www.sqlite.org/c3ref/keyword_count.html + */ + sqlite3_keyword_check: (name: string | WasmPointer, n: number) => number; + + /** + * Used to retrieve runtime status information about the performance of + * SQLite, and optionally to reset various highwater marks. + * + * C Signature: + * + * int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag); + * + * See https://www.sqlite.org/c3ref/status.html + */ + sqlite3_status: ( + op: + | CAPI['SQLITE_STATUS_MEMORY_USED'] + | CAPI['SQLITE_STATUS_MALLOC_SIZE'] + | CAPI['SQLITE_STATUS_MALLOC_COUNT'] + | CAPI['SQLITE_STATUS_PAGECACHE_USED'] + | CAPI['SQLITE_STATUS_PAGECACHE_OVERFLOW'] + | CAPI['SQLITE_STATUS_PAGECACHE_SIZE'], + pCurrent: WasmPointer, + pHighwater: WasmPointer, + resetFlag: number, + ) => number; + + /** + * Used to retrieve runtime status information about the performance of + * SQLite, and optionally to reset various highwater marks. + * + * C Signature: + * + * int sqlite3_status( + * int op, + * sqlite3_int64 *pCurrent, + * sqlite3_int64 *pHighwater, + * int resetFlag + * ); + * + * See https://www.sqlite.org/c3ref/status.html + */ + sqlite3_status64: ( + op: + | CAPI['SQLITE_STATUS_MALLOC_COUNT'] + | CAPI['SQLITE_STATUS_MALLOC_SIZE'] + | CAPI['SQLITE_STATUS_PARSER_STACK'] + | CAPI['SQLITE_STATUS_PAGECACHE_USED'] + | CAPI['SQLITE_STATUS_PAGECACHE_OVERFLOW'] + | CAPI['SQLITE_STATUS_PAGECACHE_SIZE'] + | CAPI['SQLITE_STATUS_MEMORY_USED'], + pCurrent: WasmPointer, + pHighwater: WasmPointer, + resetFlag: number, + ) => number; + + /** + * Used to retrieve runtime status information about a single database + * connection. + * + * C Signature: + * + * int sqlite3_db_status( + * sqlite3*, + * int op, + * int *pCur, + * int *pHiwtr, + * int resetFlg + * ); + * + * See https://www.sqlite.org/c3ref/db_status.html + */ + sqlite3_db_status: ( + db: Database | WasmPointer, + op: + | CAPI['SQLITE_DBSTATUS_LOOKASIDE_USED'] + | CAPI['SQLITE_DBSTATUS_CACHE_USED'] + | CAPI['SQLITE_DBSTATUS_SCHEMA_USED'] + | CAPI['SQLITE_DBSTATUS_STMT_USED'] + | CAPI['SQLITE_DBSTATUS_LOOKASIDE_HIT'] + | CAPI['SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE'] + | CAPI['SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL'] + | CAPI['SQLITE_DBSTATUS_CACHE_HIT'] + | CAPI['SQLITE_DBSTATUS_CACHE_MISS'] + | CAPI['SQLITE_DBSTATUS_CACHE_WRITE'] + | CAPI['SQLITE_DBSTATUS_DEFERRED_FKS'] + | CAPI['SQLITE_DBSTATUS_CACHE_USED_SHARED'] + | CAPI['SQLITE_DBSTATUS_CACHE_SPILL'] + | CAPI['SQLITE_DBSTATUS_MAX'], + pCur: WasmPointer, + pHighWater: WasmPointer, + resetFlag: number, + ) => number; + + /** + * Retrieve and reset counter values from a prepared statement. + * + * C Signature: + * + * int sqlite3_stmt_status(sqlite3_stmt*, int op, int resetFlg); + * + * See https://www.sqlite.org/c3ref/stmt_status.html + */ + sqlite3_stmt_status: ( + stmt: PreparedStatement | WasmPointer, + op: + | CAPI['SQLITE_STMTSTATUS_FULLSCAN_STEP'] + | CAPI['SQLITE_STMTSTATUS_SORT'] + | CAPI['SQLITE_STMTSTATUS_AUTOINDEX'] + | CAPI['SQLITE_STMTSTATUS_VM_STEP'] + | CAPI['SQLITE_STMTSTATUS_REPREPARE'] + | CAPI['SQLITE_STMTSTATUS_RUN'] + | CAPI['SQLITE_STMTSTATUS_FILTER_MISS'] + | CAPI['SQLITE_STMTSTATUS_FILTER_HIT'] + | CAPI['SQLITE_STMTSTATUS_MEMUSED'], + resetFlag: number, + ) => number; + + /** + * Compare the contents of two buffers containing UTF-8 strings in a + * case-independent fashion, using the same definition of "case independence" + * that SQLite uses internally when comparing identifiers. + * + * C Signature: + * + * int sqlite3_stricmp(const char *, const char *); + * + * See https://www.sqlite.org/c3ref/stricmp.html + */ + sqlite3_stricmp: ( + str1: string | WasmPointer, + str2: string | WasmPointer, + ) => number; + + /** + * Compare the contents of two buffers containing UTF-8 strings in a + * case-independent fashion, using the same definition of "case independence" + * that SQLite uses internally when comparing identifiers. + * + * C Signature: + * + * int sqlite3_strnicmp(const char *, const char *, int); + * + * See https://www.sqlite.org/c3ref/stricmp.html + */ + sqlite3_strnicmp: ( + str1: string | WasmPointer, + str2: string | WasmPointer, + n: number, + ) => number; + + /** + * Returns zero if and only if string `str` matches the `GLOB` pattern `glob`. + * The definition of `GLOB` pattern matching used in `sqlite3_strglob(glob, + * str)` is the same as for the `str GLOB glob` operator in the SQL dialect + * understood by SQLite. The function is case sensitive. + * + * C Signature: + * + * int sqlite3_strglob(const char *zGlob, const char *zStr); + * + * See https://www.sqlite.org/c3ref/strglob.html + */ + sqlite3_strglob: ( + glob: string | WasmPointer, + str: string | WasmPointer, + ) => number; + + /** + * Returns zero if and only if string `str` matches the `LIKE` pattern + * `likePat` with escape character `esc`. The definition of `LIKE` pattern + * matching used in `sqlite3_strlike(like, str, esc)` is the same as for the + * `X LIKE P ESCAPE E` operator in the SQL dialect understood by SQLite. For + * `X LIKE P` without the `ESCAPE` clause, set the `esc` parameter to 0. As + * with the `LIKE` operator, the function is case insensitive. + * + * C Signature: + * + * int sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc); + * + * See https://www.sqlite.org/c3ref/strlike.html + */ + sqlite3_strlike: ( + likePat: string | WasmPointer, + str: string | WasmPointer, + esc: number, + ) => number; + + /** + * Determine The Virtual Table Conflict Policy + * + * This function may only be called from within a call to the `xUpdate` method + * of a virtual table implementation for an `INSERT` or `UPDATE` operation. + * The value returned is one of `SQLITE_ROLLBACK`, `SQLITE_IGNORE`, + * `SQLITE_FAIL`, `SQLITE_ABORT`, or `SQLITE_REPLACE`, according to the `ON + * CONFLICT` mode of the SQL statement that triggered the call to the + * `xUpdate` method of the virtual table. + * + * C Signature: + * + * int sqlite3_vtab_on_conflict(sqlite3*); + * + * See https://www.sqlite.org/c3ref/vtab_on_conflict.html + */ + sqlite3_vtab_on_conflict: ( + db: Database | WasmPointer, + ) => + | CAPI['SQLITE_ROLLBACK'] + | CAPI['SQLITE_IGNORE'] + | CAPI['SQLITE_FAIL'] + | CAPI['SQLITE_ABORT'] + | CAPI['SQLITE_REPLACE']; + + /** + * Determine If Virtual Table Column Access Is For `UPDATE` + * + * If the routine is called within the `xColumn` method of a virtual table, + * then it might return true if the column is being fetched as part of an + * `UPDATE` operation during which the column value will not change. The + * virtual table implementation can use this hint as permission to substitute + * a return value that is less expensive to compute and that the corresponding + * `xUpdate` method understands as a "no-change" value. + * + * C Signature: + * + * int sqlite3_vtab_nochange(sqlite3_context*); + * + * See https://www.sqlite.org/c3ref/vtab_nochange.html + */ + sqlite3_vtab_nochange: (ctx: WasmPointer) => number; + + /** + * Determine The Collation For a Virtual Table Constraint + * + * This function may only be called from within a call to the `xBestIndex` + * method of a virtual table. This function returns a pointer to a string that + * is the name of the appropriate collation sequence to use for text + * comparisons on the constraint identified by its arguments. + * + * C Signature: + * + * const char *sqlite3_vtab_collation(sqlite3_index_info*, int); + * + * See https://www.sqlite.org/c3ref/vtab_collation.html + */ + sqlite3_vtab_collation: ( + indexInfo: sqlite3_index_info | WasmPointer, + constraintIdx: number, + ) => string; + + /** + * Determine if a virtual table query is DISTINCT + * + * This API may only be used from within an `xBestIndex method` of a virtual + * table implementation. The result of calling this interface from outside of + * `xBestIndex()` is undefined and probably harmful. + * + * C Signature: + * + * int sqlite3_vtab_distinct(sqlite3_index_info*); + * + * See https://www.sqlite.org/c3ref/vtab_distinct.html + */ + sqlite3_vtab_distinct: ( + indexInfo: sqlite3_index_info | WasmPointer, + ) => number; + + /** + * Identify and handle `IN` constraints in `xBestIndex`. + * + * This interface may only be used from within an `xBestIndex()` method of a + * virtual table implementation. The result of invoking this interface from + * any other context is undefined and probably harmful. + * + * C Signature: + * + * int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle); + * + * See https://www.sqlite.org/c3ref/vtab_in.html + */ + sqlite3_vtab_in: ( + indexInfo: sqlite3_index_info | WasmPointer, + iCons: number, + bhandle: number, + ) => number; + + /** + * Find all elements on the right-hand side of an IN constraint. + * + * On success, sets `ppOut` to point to the first value on the RHS of the IN + * constraint. + * + * This interface may only be used from within an `xBestIndex()` method of a + * virtual table implementation. The result of invoking this interface from + * any other context is undefined and probably harmful. + * + * C Signature: + * + * int sqlite3_vtab_in_first(sqlite3_value *pVal, sqlite3_value **ppOut); + * + * See https://www.sqlite.org/c3ref/vtab_in_first.html + */ + sqlite3_vtab_in_first: (sqlValue: WasmPointer, ppOut: WasmPointer) => number; + + /** + * Find all elements on the right-hand side of an IN constraint. + * + * On success, sets `ppOut` to point to the next value on the RHS of the IN + * constraint. + * + * This interface may only be used from within an `xBestIndex()` method of a + * virtual table implementation. The result of invoking this interface from + * any other context is undefined and probably harmful. + * + * C Signature: + * + * int sqlite3_vtab_in_first(sqlite3_value *pVal, sqlite3_value **ppOut); + * + * See https://www.sqlite.org/c3ref/vtab_in_first.html + */ + sqlite3_vtab_in_next: (sqlValue: WasmPointer, ppOut: WasmPointer) => number; + + /** + * Constraint values in `xBestIndex()` + * + * ^When the function is invoked from within the `xBestIndex` method of a + * virtual table implementation, with `indexInfo` being a copy of the + * `sqlite3_index_info` object pointer passed into `xBestIndex` and + * `constraintIdx` being a 0-based index into `indexInfo->aConstraint[]`, then + * this routine attempts to set `*ppOut` to the value of the right-hand + * operand of that constraint if the right-hand operand is known. + * + * This interface may only be used from within an `xBestIndex()` method of a + * virtual table implementation. The result of invoking this interface from + * any other context is undefined and probably harmful. + * + * C Signature: + * + * int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **ppVal); + * + * See https://www.sqlite.org/c3ref/vtab_rhs_value.html + */ + sqlite3_vtab_rhs_value: ( + indexInfo: sqlite3_index_info | WasmPointer, + constraintIdx: number, + ppOut: WasmPointer, + ) => number; + + /** + * Registers a callback function hat is invoked prior to each `INSERT`, + * `UPDATE`, and `DELETE` operation on a database table. + * + * C Signature: + * + * void *sqlite3_preupdate_hook( + * sqlite3 *db, + * void(*xPreUpdate)( + * void *pCtx, + * sqlite3 *db, + * int op, + * char const *zDb, + * char const *zName, + * sqlite3_int64 iKey1, + * sqlite3_int64 iKey2 + * ), + * void* + * ); + * + * See https://www.sqlite.org/c3ref/preupdate_hook.html + */ + sqlite3_preupdate_hook: ( + db: Database | WasmPointer, + xPreUpdate: ( + ctx: WasmPointer, + db: WasmPointer, + op: CAPI['SQLITE_UPDATE'] | CAPI['SQLITE_DELETE'] | CAPI['SQLITE_INSERT'], + dbName: string, + tableName: string, + oldRowid: bigint, + newRowid: bigint, + ) => void, + ) => void; + + /** + * Writes into `sqlValue` a pointer to a protected `sqlite3_value` that + * contains the value of the `colIdx`th column of the table row before it is + * updated. The `colIdx` parameter must be between 0 and one less than the + * number of columns or the behavior will be undefined. This must only be used + * within `SQLITE_UPDATE` and `SQLITE_DELETE` preupdate callbacks; if it is + * used by an `SQLITE_INSERT` callback then the behavior is undefined. The + * `sqlite3_value` that `sqlValue` points to will be destroyed when the + * preupdate callback returns. + * + * C Signature: + * + * int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **); + * + * See https://www.sqlite.org/c3ref/preupdate_hook.html + */ + sqlite3_preupdate_old: ( + db: Database | WasmPointer, + colIdx: number, + sqlValue: WasmPointer, + ) => number; + + /** + * Thin wrapper around `sqlite3_preupdate_old()` , which fetch the + * `sqlite3_value*` from the column specified by the 2nd argument and then + * returns the result of passing it to `sqlite3_value_to_js()`. Throws on + * error, including when the underlying functions return non-0. + * + * See https://sqlite.org/wasm/doc/trunk/api-c-style.md#pre-update-ext + */ + sqlite3_preupdate_old_js: ( + db: Database | WasmPointer, + colIdx: number, + ) => SqlValue; + + /** + * Returns the number of columns in the row that is being inserted, updated, + * or deleted. + * + * C Signature: + * + * int sqlite3_preupdate_count(sqlite3 *); + * + * See https://www.sqlite.org/c3ref/preupdate_hook.html + */ + sqlite3_preupdate_count: (db: Database | WasmPointer) => number; + + /** + * Returns 0 if the preupdate callback was invoked as a result of a direct + * insert, update, or delete operation; or 1 for inserts, updates, or deletes + * invoked by top-level triggers; or 2 for changes resulting from triggers + * called by top-level triggers; and so forth. + * + * C Signature: + * + * int sqlite3_preupdate_depth(sqlite3 *); + * + * See https://www.sqlite.org/c3ref/preupdate_hook.html + */ + sqlite3_preupdate_depth: (db: Database | WasmPointer) => number; + + /** + * Writes into `sqlValue` a pointer to a protected `sqlite3_value` that + * contains the value of the `colIdx`th column of the table row after it is + * updated. The `colidx` parameter must be between 0 and one less than the + * number of columns or the behavior will be undefined. This must only be used + * within `SQLITE_INSERT` and `SQLITE_UPDATE` preupdate callbacks; if it is + * used by an `SQLITE_DELETE` callback then the behavior is undefined. The + * `sqlite3_value` that `sqlValue` points to will be destroyed when the + * preupdate callback returns. + * + * C Signature: + * + * int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **); + * + * See https://www.sqlite.org/c3ref/preupdate_hook.html + */ + sqlite3_preupdate_new: ( + db: Database | WasmPointer, + colIdx: number, + sqlValues: WasmPointer, + ) => number; + + /** + * Thin wrapper around `sqlite3_preupdate_new()` , which fetch the + * `sqlite3_value*` from the column specified by the 2nd argument and then + * returns the result of passing it to `sqlite3_value_to_js()`. Throws on + * error, including when the underlying functions return non-0. + * + * See https://sqlite.org/wasm/doc/trunk/api-c-style.md#pre-update-ext + */ + sqlite3_preupdate_new_js: ( + db: Database | WasmPointer, + colIdx: number, + ) => SqlValue; + + /** + * When the `sqlite3_blob_write()` API is used to update a blob column, the + * pre-update hook is invoked with `SQLITE_DELETE`. This is because the in + * this case the new values are not available. In this case, when a callback + * made with `op==SQLITE_DELETE` is actually a write using the + * `sqlite3_blob_write()` API, the `sqlite3_preupdate_blobwrite()` returns the + * index of the column being written. In other cases, where the pre-update + * hook is being invoked for some other reason, including a regular `DELETE`, + * `sqlite3_preupdate_blobwrite()` returns -1. + * + * C Signature: + * + * int sqlite3_preupdate_blobwrite(sqlite3 *); + * + * See https://www.sqlite.org/c3ref/preupdate_hook.html + */ + sqlite3_preupdate_blobwrite: (db: Database | WasmPointer) => number; + + /** + * Returns a pointer to memory that is a serialization of the `schema` + * database on database connection `db`. If `piSize` is not a NULL pointer, + * then the size of the database in bytes is written into `*piSize`. + * + * For an ordinary on-disk database file, the serialization is just a copy of + * the disk file. For an in-memory database or a `"TEMP"` database, the + * serialization is the same sequence of bytes which would be written to disk + * if that database where backed up to disk. + * + * C Signature: + * + * unsigned char *sqlite3_serialize( + * sqlite3 *db, + * const char *zSchema, + * sqlite3_int64 *piSize, + * unsigned int mFlags + * ); + * + * See https://www.sqlite.org/c3ref/serialize.html + */ + sqlite3_serialize: ( + db: Database | WasmPointer, + schema: string | WasmPointer, + piSize: WasmPointer, + flags: 0 | CAPI['SQLITE_SERIALIZE_NOCOPY'], + ) => WasmPointer; + + /** + * Causes the database connection `db` to disconnect from database `schema` + * and then reopen `schema` as an in-memory database based on the + * serialization contained in `data`. The serialized database `data` is + * `dbSize` bytes in size. `bufferSize` is the size of the buffer `data`, + * which might be larger than `dbSize`. If `bufferSize` is larger than + * `dbSize`, and the `SQLITE_DESERIALIZE_READONLY` bit is not set in `flags`, + * then SQLite is permitted to add content to the in-memory database as long + * as the total size does not exceed `bufferSize` bytes. + * + * **ACHTUNG:** There are severe caveats regarding memory allocations when + * using this function in JavaScript. See + * https://sqlite.org/wasm/doc/trunk/api-c-style.md#sqlite3_deserialize for + * more details + * + * C Signature: + * + * int sqlite3_deserialize( + * sqlite3 *db, + * const char *zSchema, + * unsigned char *pData, + * sqlite3_int64 szDb, + * sqlite3_int64 szBuf, + * unsigned mFlags + * ); + * + * See https://www.sqlite.org/c3ref/deserialize.html + */ + sqlite3_deserialize: ( + db: Database | WasmPointer, + schema: string | WasmPointer, + data: WasmPointer, + dbSize: number, + bufferSize: number, + flags: number, + ) => number; + + /** + * Create a new session object attached to database handle `db`. If + * successful, a pointer to the new object is written to `*ppSession` and + * `SQLITE_OK` is returned. If an error occurs, `*ppSession` is set to NULL + * and an SQLite error code (e.g. `SQLITE_NOMEM`) is returned. + * + * C Signature: + * + * int sqlite3session_create( + * sqlite3 *db, + * const char *zDb, + * sqlite3_session **ppSession + * ); + * + * See https://www.sqlite.org/session/sqlite3session_create.html + */ + sqlite3session_create: ( + db: Database | WasmPointer, + dbName: string, + ppSession: WasmPointer, + ) => number; + + /** + * Delete a session object previously allocated using + * `sqlite3session_create()`. Once a session object has been deleted, the + * results of attempting to use `pSession` with any other session module + * function are undefined. + * + * C Signature: + * + * void sqlite3session_delete(sqlite3_session * pSession); + * + * See https://www.sqlite.org/session/sqlite3session_delete.html + */ + sqlite3session_delete: (pSession: WasmPointer) => number; + + /** + * This method is used to configure a session object after it has been + * created. At present the only valid values for the second parameter are + * `SQLITE_SESSION_OBJCONFIG_SIZE` and `SQLITE_SESSION_OBJCONFIG_ROWID`. + * + * C Signature: + * + * int sqlite3session_object_config(sqlite3_session*, int op, void *pArg); + * + * See https://www.sqlite.org/session/sqlite3session_object_config.html + */ + sqlite3session_object_config: (pSession: WasmPointer, op: number) => number; + + /** + * Enable or disable the recording of changes by a session object. When + * enabled, a session object records changes made to the database. When + * disabled - it does not. A newly created session object is enabled. + * + * C Signature: + * + * int sqlite3session_enable(sqlite3_session *pSession, int bEnable); + * + * See https://www.sqlite.org/session/sqlite3session_enable.html + */ + sqlite3session_enable: (pSession: WasmPointer, bEnable: number) => number; + + /** + * Set Or Clear the Indirect Change Flag + * + * Each change recorded by a session object is marked as either direct or + * indirect. A change is marked as indirect if either: + * + * - The session object "indirect" flag is set when the change is made, or + * - The change is made by an SQL trigger or foreign key action instead of + * directly as a result of a users SQL statement. + * + * If a single row is affected by more than one operation within a session, + * then the change is considered indirect if all operations meet the criteria + * for an indirect change above, or direct otherwise. + * + * This function is used to set, clear or query the session object indirect + * flag. If the second argument passed to this function is zero, then the + * indirect flag is cleared. If it is greater than zero, the indirect flag is + * set. Passing a value less than zero does not modify the current value of + * the indirect flag, and may be used to query the current state of the + * indirect flag for the specified session object. + * + * C Signature: + * + * int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect); + * + * See https://www.sqlite.org/session/sqlite3session_indirect.html + */ + sqlite3session_indirect: (pSession: WasmPointer, bIndirect: number) => number; + + /** + * Attach A Table To A Session Object + * + * If argument `tableName` is not NULL, then it is the name of a table to + * attach to the session object passed as the first argument. All subsequent + * changes made to the table while the session object is enabled will be + * recorded. See documentation for `sqlite3session_changeset()` for further + * details. + * + * C Signature: + * + * int sqlite3session_attach( + * sqlite3_session *pSession, + * const char *zTab + * ); + * + * See https://www.sqlite.org/session/sqlite3session_attach.html + */ + sqlite3session_attach: ( + pSession: WasmPointer, + tableName: string | NullPointer, + ) => number; + + /** + * Set a table filter on a Session Object. + * + * The second argument `xFilter` is the "filter callback". For changes to rows + * in tables that are not attached to the Session object, the filter is called + * to determine whether changes to the table's rows should be tracked or not. + * If `xFilter` returns 0, changes are not tracked. Note that once a table is + * attached, `xFilter` will not be called again. + * + * C Signature: + * + * int sqlite3session_table_filter( + * sqlite3_session *pSession, + * int(*xFilter)(void *pCtx, const char *zTab), + * void *pCtx + * ); + * + * See https://www.sqlite.org/session/sqlite3session_table_filter.html + */ + sqlite3session_table_filter: ( + pSession: WasmPointer, + xFilter: ((pCtx: WasmPointer, tableName: string) => number) | WasmPointer, + pCtx: WasmPointer, + ) => void; + + /** + * Generate A Changeset From A Session Object + * + * Obtain a changeset containing changes to the tables attached to the session + * object passed as the first argument. If successful, set `*ppChangeset` to + * point to a buffer containing the changeset and `*pnChangeset` to the size + * of the changeset in bytes before returning `SQLITE_OK`. If an error occurs, + * set both `*ppChangeset` and `*pnChangeset` to zero and return an SQLite + * error code. + * + * C Signature: + * + * int sqlite3session_changeset( + * sqlite3_session *pSession, + * int *pnChangeset, + * void **ppChangeset + * ); + * + * See https://www.sqlite.org/session/sqlite3session_changeset.html + */ + sqlite3session_changeset: ( + pSession: WasmPointer, + pnChangeset: WasmPointer, + ppChangeset: WasmPointer, + ) => number; + + /** + * Return An Upper-limit For The Size Of The Changeset. + * + * By default, this function always returns 0. For it to return a useful + * result, the `sqlite3_session` object must have been configured to enable + * this API using `sqlite3session_object_config()` with the + * `SQLITE_SESSION_OBJCONFIG_SIZE` verb. + * + * C Signature: + * + * int sqlite3session_changeset_size(sqlite3_session *pSession); + * + * See https://www.sqlite.org/session/sqlite3session_changeset_size.html + */ + sqlite3session_changeset_size: (pSession: WasmPointer) => number; + + /** + * Load The Difference Between Tables Into A Session + * + * If it is not already attached to the session object passed as the first + * argument, this function attaches table `zTbl` in the same manner as the + * `sqlite3session_attach()` function. If `zTbl` does not exist, or if it does + * not have a primary key, this function is a no-op (but does not return an + * error). + * + * C Signature: + * + * int sqlite3session_diff( + * sqlite3_session *pSession, + * const char *zFromDb, + * const char *zTbl + * char **pzErrMsg + * ); + * + * See https://www.sqlite.org/session/sqlite3session_diff.html + */ + sqlite3session_diff: ( + pSession: WasmPointer, + fromDb: string, + tableName: string, + pzErrMsg: WasmPointer, + ) => number; + + /** + * Generate A Patchset From A Session Object + * + * The differences between a patchset and a changeset are that: + * + * - `DELETE` records consist of the primary key fields only. The original + * values of other fields are omitted. + * - The original values of any modified fields are omitted from `UPDATE` + * records. + * + * A patchset blob may be used with up to date versions of all + * `sqlite3changeset_xxx` API functions except for + * `sqlite3changeset_invert()`, which returns `SQLITE_CORRUPT` if it is passed + * a patchset. Similarly, attempting to use a patchset blob with old versions + * of the `sqlite3changeset_xxx` APIs also provokes an `SQLITE_CORRUPT` + * error. + * + * C Signature: + * + * int sqlite3session_patchset( + * sqlite3_session *pSession, + * int *pnPatchset, + * void **ppPatchset + * ); + * + * See https://www.sqlite.org/session/sqlite3session_patchset.html + */ + sqlite3session_patchset: ( + pSession: WasmPointer, + pnPatchset: WasmPointer, + ppPatchset: WasmPointer, + ) => number; + + /** + * Test if a changeset has recorded any changes. + * + * Return non-zero if no changes to attached tables have been recorded by the + * session object passed as the first argument. Otherwise, if one or more + * changes have been recorded, return zero. + * + * C Signature: + * + * int sqlite3session_isempty(sqlite3_session *pSession); + * + * See https://www.sqlite.org/session/sqlite3session_isempty.html + */ + sqlite3session_isempty: (pSession: WasmPointer) => number; + + /** + * Query for the amount of heap memory used by a session object. + * + * This API returns the total amount of heap memory in bytes currently used by + * the session object passed as the only argument. + * + * C Signature: + * + * int sqlite3session_memory_used(sqlite3_session *); + * + * See https://www.sqlite.org/session/sqlite3session_memory_used.html + */ + sqlite3session_memory_used: (pSession: WasmPointer) => number; + + /** + * Create an iterator used to iterate through the contents of a changeset. If + * successful, `*ppIter` is set to point to the iterator handle and + * `SQLITE_OK` is returned. Otherwise, if an error occurs, `*ppIter` is set to + * zero and an SQLite error code is returned. + * + * C Signature: + * + * int sqlite3changeset_start( + * sqlite3_changeset_iter **ppIter, + * int nChangeset, + * void *pChangeset + * ); + * + * See https://www.sqlite.org/c3ref/changeset_start.html + * + * @param ppIter OUT: new changeset iterator handle + * @param nChangeSet Size of changeset blob in bytes + * @param pChangeset Pointer to blob containing changeset + */ + sqlite3changeset_start: ( + ppIter: WasmPointer, + nChangeset: number, + pChangeset: WasmPointer, + ) => number; + + /** + * Create an iterator used to iterate through the contents of a changeset. If + * successful, `*ppIter` is set to point to the iterator handle and + * `SQLITE_OK` is returned. Otherwise, if an error occurs, `*ppIter` is set to + * zero and an SQLite error code is returned. + * + * C Signature: + * + * int sqlite3changeset_start_v2( + * sqlite3_changeset_iter **ppIter, + * int nChangeset, + * void *pChangeset, + * int flags + * ); + * + * See https://www.sqlite.org/c3ref/changeset_start.html + * + * @param ppIter OUT: new changeset iterator handle + * @param nChangeSet Size of changeset blob in bytes + * @param pChangeset Pointer to blob containing changeset + * @param flags `SESSION_CHANGESTART_*` flags + */ + sqlite3changeset_start_v2: ( + ppIter: WasmPointer, + nChangeset: number, + pChangeset: WasmPointer, + flags: number, + ) => number; + + /** + * Advance A Changeset Iterator + * + * This function may only be used with iterators created by the function + * `sqlite3changeset_start()`. If it is called on an iterator passed to a + * conflict-handler callback by `sqlite3changeset_apply()`, `SQLITE_MISUSE` is + * returned and the call has no effect. + * + * C Signature: + * + * int sqlite3changeset_next(sqlite3_changeset_iter *pIter); + * + * See https://www.sqlite.org/c3ref/changeset_next.html + */ + sqlite3changeset_next: (pIter: WasmPointer) => number; + + /** + * Obtain The Current Operation From A Changeset Iterator + * + * C Signature: + * + * int sqlite3changeset_op( + * sqlite3_changeset_iter *pIter, + * const char **pzTab, + * int *pnCol, + * int *pOp, + * int *pbIndirect + * ); + * + * @param pIter Iterator object + * @param pzTab OUT: Pointer to table name + * @param pnCol OUT: Pointer to number of columns in table + * @param pOp OUT: Pointer to operation code (SQLITE_INSERT, SQLITE_DELETE or + * SQLITE_UPDATE) + * @param pbIndirect OUT: True for an 'indirect' change + */ + sqlite3changeset_op: ( + pIter: WasmPointer, + pzTab: WasmPointer, + pnCol: WasmPointer, + pOp: WasmPointer, + pbIndirect: WasmPointer, + ) => number; + + /** + * Obtain The Primary Key Definition Of A Table + * + * For each modified table, a changeset includes the following: + * + * - The number of columns in the table, and + * - Which of those columns make up the tables `PRIMARY KEY`. + * + * This function is used to find which columns comprise the `PRIMARY KEY` of + * the table modified by the change that iterator pIter currently points to. + * + * C Signature: + * + * int sqlite3changeset_pk( + * sqlite3_changeset_iter *pIter, + * const char **pabPK, + * int *pnCol + * ); + * + * See https://www.sqlite.org/c3ref/changeset_pk.html + * + * @param pIter Iterator object + * @param pabPK Array of boolean - true for PK cols + * @param pnCol Number of entries in output array + */ + sqlite3changeset_pk: ( + pIter: WasmPointer, + pabPK: WasmPointer, + pnCol: WasmPointer, + ) => number; + + /** + * Obtain old.* Values From A Changeset Iterator + * + * C Signature: + * + * int sqlite3changeset_old( + * sqlite3_changeset_iter *pIter, + * int iVal, + * sqlite3_value **ppValue + * ); + * + * See https://www.sqlite.org/c3ref/changeset_old.html + * + * @param pIter Changeset iterator + * @param colNum Column number + * @param ppValue OUT: Old value (or NULL pointer) + */ + sqlite3changeset_old: ( + pIter: WasmPointer, + colNum: number, + ppValue: WasmPointer, + ) => number; + + /** + * Thin wrapper around `sqlite3changeset_old()`, which fetches the + * `sqlite3_value*` from the column specified by the 2nd argument and then + * return the result of passing it to `sqlite3_value_to_js()`. Throws on + * error, including when the underlying function returns non-0. + * + * See https://sqlite.org/wasm/doc/trunk/api-c-style.md#session-api-ext + */ + sqlite3changeset_old_js: ( + pChangeSetIter: WasmPointer, + colIdx: number, + ) => SqlValue; + + /** + * Obtain new.* Values From A Changeset Iterator + * + * C Signature: + * + * int sqlite3changeset_new( + * sqlite3_changeset_iter *pIter, + * int iVal, + * sqlite3_value **ppValue + * ); + * + * See https://www.sqlite.org/c3ref/changeset_new.html + * + * @param pIter Changeset iterator + * @param colNum Column number + * @param ppValue OUT: New value (or NULL pointer) + */ + sqlite3changeset_new: ( + pIter: WasmPointer, + colNum: number, + ppValue: WasmPointer, + ) => number; + + /** + * Thin wrapper around `sqlite3changeset_new()`, which fetches the + * `sqlite3_value*` from the column specified by the 2nd argument and then + * return the result of passing it to `sqlite3_value_to_js()`. Throws on + * error, including when the underlying function returns non-0. If + * `sqlite3changeset_new()` returns 0 but sets the output value to NULL, this + * function returns the undefined value, which is never a valid conversion + * from an `sqlite3_value`, so is unambiguous. + * + * See https://sqlite.org/wasm/doc/trunk/api-c-style.md#session-api-ext + */ + sqlite3changeset_new_js: ( + pChangeSetIter: WasmPointer, + colIdx: number, + ) => SqlValue | undefined; + + /** + * Obtain Conflicting Row Values From A Changeset Iterator + * + * C Signature: + * + * int sqlite3changeset_conflict( + * sqlite3_changeset_iter *pIter, + * int iVal, + * sqlite3_value **ppValue + * ); + * + * See https://www.sqlite.org/c3ref/changeset_conflict.html + * + * @param pIter Changeset iterator + * @param colNum Column number + * @param ppValue OUT: Value from conflicting row + */ + sqlite3changeset_conflict: ( + pIter: WasmPointer, + colNum: number, + ppValue: WasmPointer, + ) => number; + + /** + * Determine The Number Of Foreign Key Constraint Violations + * + * C Signature: + * + * int sqlite3changeset_fk_conflicts( + * sqlite3_changeset_iter *pIter, + * int *pnOut + * ); + * + * See https://www.sqlite.org/c3ref/changeset_fk_conflicts.html + * + * @param pIter Changeset iterator + * @param pnOut OUT: Number of FK constraint violations + */ + sqlite3changeset_fk_conflicts: ( + pIter: WasmPointer, + pnOut: WasmPointer, + ) => number; + + /** + * This function is used to finalize an iterator allocated with + * `sqlite3changeset_start()`. + * + * C Signature: + * + * int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter); + * + * See https://www.sqlite.org/c3ref/changeset_finalize.html + */ + sqlite3changeset_finalize: (pIter: WasmPointer) => number; + + /** + * This function is used to "invert" a changeset object. Applying an inverted + * changeset to a database reverses the effects of applying the uninverted + * changeset. Specifically: + * + * - Each `DELETE` change is changed to an `INSERT`, and + * - Each `INSERT` change is changed to a `DELETE`, and + * - For each `UPDATE` change, the `old.*` and `new.*` values are exchanged. + * + * This function does not change the order in which changes appear within the + * changeset. It merely reverses the sense of each individual change. + * + * If successful, a pointer to a buffer containing the inverted changeset is + * stored in `*ppOut`, the size of the same buffer is stored in `*pnOut`, and + * `SQLITE_OK` is returned. If an error occurs, both `*pnOut` and `*ppOut` are + * zeroed and an SQLite error code returned. + * + * C Signature: + * + * int sqlite3changeset_invert( + * int nIn, + * void *pIn, + * int *pnOut, + * void **ppOut + * ); + * + * See https://www.sqlite.org/c3ref/changeset_invert.html + * + * @param nIn Size of input changeset blob in bytes + * @param pIn Pointer to input changeset blob + * @param pnOut OUT: Size of output changeset blob in bytes + * @param ppOut OUT: Pointer to output changeset blob + */ + sqlite3changeset_invert: ( + nIn: number, + pIn: WasmPointer, + pnOut: WasmPointer, + ppOut: WasmPointer, + ) => number; + + /** + * Concatenate Two Changeset Objects + * + * This function is used to concatenate two changesets, A and B, into a single + * changeset. The result is a changeset equivalent to applying changeset A + * followed by changeset B. * This function combines the two input changesets + * using an `sqlite3_changegroup` object. + * + * C Signature: + * + * int sqlite3changeset_concat( + * int nA, + * void *pA, + * int nB, + * void *pB, + * int *pnOut, + * void **ppOut + * ); + * + * See https://www.sqlite.org/c3ref/changeset_concat.html + * + * @param nA Number of bytes in buffer pA + * @param pA Pointer to buffer containing changeset A + * @param nB Number of bytes in buffer pB + * @param pB Pointer to buffer containing changeset B + * @param pnOut OUT: Size of output changeset blob in bytes + * @param ppOut OUT: Pointer to output changeset blob + */ + sqlite3changeset_concat: ( + nA: number, + pA: WasmPointer, + nB: number, + pB: WasmPointer, + pnOut: WasmPointer, + ppOut: WasmPointer, + ) => number; + + /** + * Create A New Changegroup Object + * + * C Signature: + * + * int sqlite3changegroup_new(sqlite3_changegroup **ppOut); + * + * See https://www.sqlite.org/c3ref/changegroup_new.html + */ + sqlite3changegroup_new: (ppOut: WasmPointer) => number; + + /** + * Add all changes within the changeset (or patchset) in buffer `pData` (size + * `nData` bytes) to the changegroup. + * + * C Signature: + * + * int sqlite3changegroup_add( + * sqlite3_changegroup *p, + * int nData, + * void *pData + * ); + * + * See https://www.sqlite.org/c3ref/changegroup_add.html + */ + sqlite3changegroup_add: ( + changeGrp: WasmPointer, + nData: number, + pData: WasmPointer, + ) => number; + + /** + * Obtain a buffer containing a changeset (or patchset) representing the + * current contents of the changegroup. If the inputs to the changegroup were + * themselves changesets, the output is a changeset. Or, if the inputs were + * patchsets, the output is also a patchset. + * + * C Signature: + * + * int sqlite3changegroup_output( + * sqlite3_changegroup *p, + * int *pnData, + * void **ppData + * ); + * + * See https://www.sqlite.org/c3ref/changegroup_output.html + */ + sqlite3changegroup_output: ( + changeGrp: WasmPointer, + pnData: WasmPointer, + ppData: WasmPointer, + ) => number; + + /** + * Delete a Changegroup Object + * + * C Signature: + * + * void sqlite3changegroup_delete(sqlite3_changegroup * p); + * + * See https://www.sqlite.org/c3ref/changegroup_delete.html + */ + sqlite3changegroup_delete: (changeGrp: WasmPointer) => number; + + /** + * Apply a changeset or patchset to a database. This function attempts to + * update the `"main"` database attached to handle `db` with the changes found + * in the changeset passed via the second and third arguments. + * + * The fourth argument (`xFilter`) passed to this function is the "filter + * callback". If it is not NULL, then for each table affected by at least one + * change in the changeset, the filter callback is invoked with the table name + * as the second argument, and a copy of the context pointer passed as the + * sixth argument as the first. If the "filter callback" returns zero, then no + * attempt is made to apply any changes to the table. Otherwise, if the return + * value is non-zero or the `xFilter` argument to is NULL, all changes related + * to the table are attempted. + * + * C Signature: + * + * int sqlite3changeset_apply( + * sqlite3 *db, + * int nChangeset, + * void *pChangeset, + * int(*xFilter)(void *pCtx, const char *zTab), + * int (*xConflict)(void *pCtx, int eConflict, sqlite3_changeset_iter *p), + * void *pCtx + * ); + * + * See https://www.sqlite.org/c3ref/changeset_apply.html + * + * @param db Apply change to `"main"` db of this handle + * @param nChangeset Size of changeset blob in bytes + * @param pChangeset Pointer to changeset blob + * @param xFilter Filter function + * @param xConflict Conflict handler function + * @param pCtx Context pointer passed to filter and conflict functions + */ + sqlite3changeset_apply: ( + db: Database | WasmPointer, + nChangeset: number, + pChangeSet: WasmPointer, + xFilter: ((pCtx: WasmPointer, tableName: string) => number) | WasmPointer, + xConflict: + | (( + pCtx: WasmPointer, + eConflict: number /* TODO: Can be more specific? */, + pIter: WasmPointer, + ) => + | CAPI['SQLITE_CHANGESET_OMIT'] + | CAPI['SQLITE_CHANGESET_ABORT'] + | CAPI['SQLITE_CHANGESET_REPLACE']) + | WasmPointer, + pCtx: WasmPointer, + ) => number; + + /** + * Apply a changeset or patchset to a database. This function attempts to + * update the `"main"` database attached to handle `db` with the changes found + * in the changeset passed via the second and third arguments. + * + * The fourth argument (`xFilter`) passed to this function is the "filter + * callback". If it is not NULL, then for each table affected by at least one + * change in the changeset, the filter callback is invoked with the table name + * as the second argument, and a copy of the context pointer passed as the + * sixth argument as the first. If the "filter callback" returns zero, then no + * attempt is made to apply any changes to the table. Otherwise, if the return + * value is non-zero or the `xFilter` argument to is NULL, all changes related + * to the table are attempted. + * + * C Signature: + * + * int sqlite3changeset_apply_v2( + * sqlite3 *db, + * int nChangeset, + * void *pChangeset, + * int(*xFilter)(void *pCtx, const char *zTab), + * int (*xConflict)(void *pCtx, int eConflict, sqlite3_changeset_iter *p), + * void *pCtx, + * void **ppRebase, + * int *pnRebase, + * int flags + * ); + * + * See https://www.sqlite.org/c3ref/changeset_apply.html + * + * @param db Apply change to `"main"` db of this handle + * @param nChangeset Size of changeset blob in bytes + * @param pChangeset Pointer to changeset blob + * @param xFilter Filter function + * @param xConflict Conflict handler function + * @param pCtx Context pointer passed to filter and conflict functions + * @param ppRebase OUT: Pointer to rebase data + * @param pnRebase OUT: Size of rebase data in bytes + * @param flags `SESSION_CHANGESETAPPLY_*` flags + */ + sqlite3changeset_apply_v2: ( + db: Database | WasmPointer, + nChangeset: number, + pChangeset: WasmPointer, + xFilter: ((pCtx: WasmPointer, tableName: string) => number) | WasmPointer, + xConflict: + | (( + pCtx: WasmPointer, + eConflict: number /* TODO: Can be more specific? */, + pIter: WasmPointer, + ) => + | CAPI['SQLITE_CHANGESET_OMIT'] + | CAPI['SQLITE_CHANGESET_ABORT'] + | CAPI['SQLITE_CHANGESET_REPLACE']) + | WasmPointer, + pCtx: WasmPointer, + ppRebase: WasmPointer, + pnRebase: WasmPointer, + flags: number, + ) => number; + + /** + * Streaming version of `sqlite3changeset_apply()`. + * + * C Signature: + * + * int sqlite3changeset_apply_strm( + * sqlite3 *db, + * int(*xInput)(void *pIn, void *pData, int *pnData), + * void *pIn, + * int(*xFilter)(void *pCtx, const char *zTab), + * int (*xConflict)(void *pCtx, int eConflict, sqlite3_changeset_iter *p), + * void *pCtx + * ); + * + * See https://www.sqlite.org/session/sqlite3changegroup_add_strm.html + * + * @param db Apply change to `"main"` db of this handle + * @param xInput Input function + * @param pIn First arg for xInput + * @param xFilter Filter function + * @param xConflict Conflict handler function + * @param pCtx First argumet for xFilter and xConflict + */ + sqlite3changeset_apply_strm: ( + db: Database | WasmPointer, + xInput: + | ((pIn: WasmPointer, pData: WasmPointer, pnData: WasmPointer) => number) + | WasmPointer, + pIn: WasmPointer, + xFilter: ((pCtx: WasmPointer, tableName: string) => number) | WasmPointer, + xConflict: + | (( + pCtx: WasmPointer, + eConflict: number /* TODO: Can be more specific? */, + ) => number) + | WasmPointer, + pCtx: WasmPointer, + ) => number; + + /** + * Streaming version of `sqlite3changeset_apply_v2()`. + * + * C Signature: + * + * int sqlite3changeset_apply_v2_strm( + * sqlite3 *db, + * int(*xInput)(void *pIn, void *pData, int *pnData), + * void *pIn, + * int(*xFilter)(void *pCtx, const char *zTab), + * int (*xConflict)(void *pCtx, int eConflict, sqlite3_changeset_iter *p), + * void *pCtx, + * void **ppRebase, + * int *pnRebase, + * int flags + * ); + * + * See https://www.sqlite.org/session/sqlite3changegroup_add_strm.html + * + * @param db Apply change to `"main"` db of this handle + * @param xInput Input function + * @param pIn First arg for xInput + * @param xFilter Filter function + * @param xConflict Conflict handler function + * @param pCtx First argumet for xFilter and xConflict + * @param ppRebase OUT: Pointer to rebase data + * @param pnRebase OUT: Size of rebase data in bytes + * @param flags `SESSION_CHANGESETAPPLY_*` flags + */ + sqlite3changeset_apply_v2_strm: ( + db: Database | WasmPointer, + xInput: + | ((pIn: WasmPointer, pData: WasmPointer, pnData: WasmPointer) => number) + | WasmPointer, + pIn: WasmPointer, + xFilter: ((pCtx: WasmPointer, tableName: string) => number) | WasmPointer, + xConflict: + | (( + pCtx: WasmPointer, + eConflict: number /* TODO: Can be more specific? */, + ) => number) + | WasmPointer, + pCtx: WasmPointer, + ppRebase: WasmPointer, + pnRebase: WasmPointer, + flags: number, + ) => number; + + /** + * Streaming version of `sqlite3changeset_concat()`. + * + * C Signature: + * + * int sqlite3changeset_concat_strm( + * int(*xInputA)(void *pIn, void *pData, int *pnData), + * void *pInA, + * int(*xInputB)(void *pIn, void *pData, int *pnData), + * void *pInB, + * int(*xOutput)(void *pOut, void *pData, int nData), + * void *pOut + * ); + * + * See https://www.sqlite.org/session/sqlite3changegroup_add_strm.html + */ + sqlite3changeset_concat_strm: ( + xInputA: + | ((pIn: WasmPointer, pData: WasmPointer, pnData: WasmPointer) => number) + | WasmPointer, + pInA: WasmPointer, + xInputB: + | ((pIn: WasmPointer, pData: WasmPointer, pnData: WasmPointer) => number) + | WasmPointer, + pInB: WasmPointer, + xOutput: + | ((pOut: WasmPointer, pData: WasmPointer, nData: number) => number) + | WasmPointer, + pOut: WasmPointer, + ) => number; + + /** + * Streaming version of `sqlite3changeset_invert()`. + * + * C Signature: + * + * int sqlite3changeset_invert_strm( + * int(*xInput)(void *pIn, void *pData, int *pnData), + * void *pIn, + * int(*xOutput)(void *pOut, void *pData, int nData), + * void *pOut + * ); + * + * See https://www.sqlite.org/session/sqlite3changegroup_add_strm.html + */ + sqlite3changeset_invert_strm: ( + xInput: + | ((pIn: WasmPointer, pData: WasmPointer, pnData: WasmPointer) => number) + | WasmPointer, + pIn: WasmPointer, + xOutput: + | ((pOut: WasmPointer, pData: WasmPointer, nData: number) => number) + | WasmPointer, + pOut: WasmPointer, + ) => number; + + /** + * Streaming version of `sqlite3changeset_start()`. + * + * C Signature: + * + * int sqlite3changeset_start_strm( + * sqlite3_changeset_iter **pp, + * int(*xInput)(void *pIn, void *pData, int *pnData), + * void *pIn + * ); + * + * See https://www.sqlite.org/session/sqlite3changegroup_add_strm.html + */ + sqlite3changeset_start_strm: ( + ppIter: WasmPointer, + xInput: + | ((pIn: WasmPointer, pData: WasmPointer, pnData: WasmPointer) => number) + | WasmPointer, + pIn: WasmPointer, + ) => number; + + /** + * Streaming version of `sqlite3changeset_start_v2()`. + * + * C Signature: + * + * int sqlite3changeset_start_v2_strm( + * sqlite3_changeset_iter **pp, + * int(*xInput)(void *pIn, void *pData, int *pnData), + * void *pIn, + * int flags + * ); + * + * See https://www.sqlite.org/session/sqlite3changegroup_add_strm.html + */ + sqlite3changeset_start_v2_strm: ( + ppIter: WasmPointer, + xInput: + | ((pIn: WasmPointer, pData: WasmPointer, pnData: WasmPointer) => number) + | WasmPointer, + pIn: WasmPointer, + flags: number, + ) => number; + + /** + * Streaming version of `sqlite3session_changeset()`. + * + * C Signature: + * + * int sqlite3session_changeset_strm( + * sqlite3_session *pSession, + * int(*xOutput)(void *pOut, void *pData, int nData), + * void *pOut + * ); + * + * See https://www.sqlite.org/session/sqlite3changegroup_add_strm.html + */ + sqlite3session_changeset_strm: ( + pSession: WasmPointer, + xOutput: + | ((pOut: WasmPointer, pData: WasmPointer, nData: number) => number) + | WasmPointer, + pOut: WasmPointer, + ) => number; + + /** + * Streaming version of `sqlite3session_patchset()`. + * + * C Signature: + * + * int sqlite3session_patchset_strm( + * sqlite3_session *pSession, + * int(*xOutput)(void *pOut, void *pData, int nData), + * void *pOut + * ); + * + * See https://www.sqlite.org/session/sqlite3changegroup_add_strm.html + */ + sqlite3session_patchset_strm: ( + pSession: WasmPointer, + xOutput: + | ((pOut: WasmPointer, pData: WasmPointer, nData: number) => number) + | WasmPointer, + pOut: WasmPointer, + ) => number; + + /** + * Streaming version of `sqlite3changegroup_add()`. + * + * C Signature: + * + * int sqlite3changegroup_add_strm( + * sqlite3_changegroup *p, + * int(*xInput)(void *pIn, void *pData, int *pnData), + * void *pIn + * ); + * + * See https://www.sqlite.org/session/sqlite3changegroup_add_strm.html + */ + sqlite3changegroup_add_strm: ( + changeGrp: WasmPointer, + xInput: ( + pIn: WasmPointer, + pData: WasmPointer, + pnData: WasmPointer, + ) => number, + pIn: WasmPointer, + ) => number; + + /** + * Streaming version of `sqlite3changegroup_output()`. + * + * C Signature: + * + * int sqlite3changegroup_output_strm( + * sqlite3_changegroup *p, + * int(*xOutput)(void *pOut, void *pData, int nData), + * void *pOut + * ); + * + * See https://www.sqlite.org/session/sqlite3changegroup_add_strm.html + */ + sqlite3changegroup_output_strm: ( + changeGrp: WasmPointer, + xOutput: (pOut: WasmPointer, pData: WasmPointer, nData: number) => number, + pOut: WasmPointer, + ) => number; + + /** + * Used to make global configuration changes to the sessions module in order + * to tune it to the specific needs of the application. + * + * C Signature: + * + * int sqlite3session_config( + * int op, + * void *pArg + * ); + * + * See https://www.sqlite.org/session/sqlite3session_config.html + */ + sqlite3session_config: ( + op: CAPI['SQLITE_SESSION_CONFIG_STRMSIZE'], + pArg: WasmPointer, + ) => number; + + /** + * If the wasm environment has a WASMFS/OPFS-backed persistent storage + * directory, its path is returned by this function. If it does not then it + * returns "" (noting that "" is a falsy value). + */ + sqlite3_wasmfs_opfs_dir: () => string; + + /** + * Returns true if sqlite3.capi.sqlite3_wasmfs_opfs_dir() is a non-empty + * string and the given name starts with (that string + '/'), else returns + * false. + */ + sqlite3_wasmfs_filename_is_persistent: (name: string) => boolean; + + /** + * Given an `sqlite3*`, an `sqlite3_vfs` name, and an optional db name + * (defaults to `"main"`), returns a truthy value (see below) if that db + * handle uses that VFS, else returns false. If `pDb` is falsy then the 3rd + * argument is ignored and this function returns a truthy value if the default + * VFS name matches that of the 2nd argument. Results are `undefined` if `pDb` + * is truthy but refers to an invalid pointer. The 3rd argument specifies the + * database name of the given database connection to check, defaulting to the + * main db. + * + * To permit safe use of this function from APIs which may be called via the C + * stack (like SQL UDFs), this function does not throw: if bad arguments cause + * a conversion error when passing into wasm-space, false is returned. + * + * See https://sqlite.org/wasm/doc/trunk/api-c-style.md#sqlite3_js_db_uses_vfs + */ + sqlite3_js_db_uses_vfs: ( + db: Database | WasmPointer, + vfsName: string, + dbName: string, + ) => boolean; + + /** Returns an array of the names of all currently-registered sqlite3 VFSes. */ + sqlite3_js_vfs_list: () => string[]; + + /** + * A convenience wrapper around `sqlite3_serialize()` which serializes the + * given `sqlite3*` pointer or `sqlite3.oo1.DB` instance to a `Uint8Array`. + * + * See https://sqlite.org/wasm/doc/trunk/api-c-style.md#sqlite3_js_db_export + * + * @param schema The schema to serialize. It may be a WASM C-string pointer or + * a JS string. If it is falsy, it defaults to `"main"`. + * @returns A `Uint8Array`. If the schema is empty, an empty array is + * returned. + * @throws A description of the problem. + */ + sqlite3_js_db_export: ( + db: Database | WasmPointer, + schema?: string | WasmPointer, + ) => Uint8Array; + + /** + * Given a `sqlite3*` and a database name (JS string or WASM C-string pointer, + * which may be 0), returns a pointer to the `sqlite3_vfs` responsible for it. + * If the given db name is null/0, or not provided, then `"main"` is assumed. + */ + sqlite3_js_db_vfs: ( + db: Database | WasmPointer, + dbName?: string | WasmPointer, + ) => WasmPointer; + + /** + * Given one of the `SQLITE_...` constant values, this function returns the + * string form of that constant, or undefined if no match is found, noting + * that some constants available in the C API are not exported to WASM because + * they simply are not used there. + */ + sqlite3_js_rc_str: (rc: number) => string; + + /** @deprecated Use `sqlite3_js_posix_create_file` or `OpfsDb#importDb` instead */ + sqlite3_js_vfs_create_file: ( + vfs: string | WasmPointer | sqlite3_vfs, + name: string | WasmPointer, + data: undefined | WasmPointer | Uint8Array | ArrayBuffer, + dataLen?: number, + ) => void; + + /** + * Clears all kvvfs-owned state and returns the number of records it deleted + * (one record per database page). + */ + sqlite3_js_kvvfs_clear: (which?: string) => void; + + /** Returns an estimate of how many bytes of storage are used by kvvfs. */ + sqlite3_js_kvvfs_size: (which?: string) => number; + + /** + * If the current environment supports the POSIX file APIs, this routine + * creates (or overwrites) the given file using those APIs. This is primarily + * intended for use in Emscripten-based builds where the POSIX APIs are + * transparently proxied by an in-memory virtual filesystem. It may behave + * differently in other environments. + * + * The first argument must be either a JS string or WASM C-string holding the + * filename. Note that this routine does not create intermediary directories + * if the filename has a directory part. + * + * The 2nd argument may either a valid WASM memory pointer, an ArrayBuffer, or + * a Uint8Array. The 3rd must be the length, in bytes, of the data array to + * copy. If the 2nd argument is an ArrayBuffer or Uint8Array and the 3rd is + * not a positive integer then the 3rd defaults to the array's byteLength + * value. + * + * Results are undefined if data is a WASM pointer and dataLen is exceeds + * data's bounds. + * + * Throws if any arguments are invalid or if creating or writing to the file + * fails. + */ + sqlite3_js_posix_create_file: ( + filename: string | WasmPointer, + data: Uint8Array | ArrayBuffer | WasmPointer, + dataLen?: number, + ) => void; + + /** + * Given a `sqlite3_value*`, this function attempts to convert it to an + * equivalent JS value with as much fidelity as feasible and return it. + * + * By default it throws if it cannot determine any sensible conversion. If + * passed a falsy second argument, it instead returns undefined if no suitable + * conversion is found. Note that there is no conversion from SQL to JS which + * results in the undefined value. It always throws a WasmAllocError if + * allocating memory for a conversion fails. + */ + sqlite3_value_to_js( + sqliteValue: WasmPointer, + throwIfCannotConvert?: true, + ): SqlValue; + sqlite3_value_to_js( + sqliteValue: WasmPointer, + throwIfCannotConvert: false, + ): SqlValue | undefined; + + /** + * Requires a C-style array of `sqlite3_value*` objects and the number of + * entries in that array. Returns a JS array containing the results of passing + * each C array entry to `sqlite3_value_to_js()`. The 3rd argument to this + * function is passed on as the 2nd argument to that one. + */ + sqlite3_values_to_js( + numVals: number, + sqliteValues: WasmPointer, + throwIfCannotConvert?: true, + ): SqlValue[]; + sqlite3_values_to_js( + numVals: number, + sqliteValues: WasmPointer, + throwIfCannotConvert: false, + ): (SqlValue | undefined)[]; + + SQLITE_ACCESS_EXISTS: 0; + SQLITE_ACCESS_READWRITE: 1; + SQLITE_ACCESS_READ: 2; + SQLITE_DENY: 1; + SQLITE_IGNORE: 2; + SQLITE_CREATE_INDEX: 1; + SQLITE_CREATE_TABLE: 2; + SQLITE_CREATE_TEMP_INDEX: 3; + SQLITE_CREATE_TEMP_TABLE: 4; + SQLITE_CREATE_TEMP_TRIGGER: 5; + SQLITE_CREATE_TEMP_VIEW: 6; + SQLITE_CREATE_TRIGGER: 7; + SQLITE_CREATE_VIEW: 8; + SQLITE_DELETE: 9; + SQLITE_DROP_INDEX: 10; + SQLITE_DROP_TABLE: 11; + SQLITE_DROP_TEMP_INDEX: 12; + SQLITE_DROP_TEMP_TABLE: 13; + SQLITE_DROP_TEMP_TRIGGER: 14; + SQLITE_DROP_TEMP_VIEW: 15; + SQLITE_DROP_TRIGGER: 16; + SQLITE_DROP_VIEW: 17; + SQLITE_INSERT: 18; + SQLITE_PRAGMA: 19; + SQLITE_READ: 20; + SQLITE_SELECT: 21; + SQLITE_TRANSACTION: 22; + SQLITE_UPDATE: 23; + SQLITE_ATTACH: 24; + SQLITE_DETACH: 25; + SQLITE_ALTER_TABLE: 26; + SQLITE_REINDEX: 27; + SQLITE_ANALYZE: 28; + SQLITE_CREATE_VTABLE: 29; + SQLITE_DROP_VTABLE: 30; + SQLITE_FUNCTION: 31; + SQLITE_SAVEPOINT: 32; + SQLITE_RECURSIVE: 33; + SQLITE_STATIC: 0; + SQLITE_TRANSIENT: -1; + SQLITE_WASM_DEALLOC: 1; + SQLITE_CHANGESETSTART_INVERT: 2; + SQLITE_CHANGESETAPPLY_NOSAVEPOINT: 1; + SQLITE_CHANGESETAPPLY_INVERT: 2; + SQLITE_CHANGESETAPPLY_IGNORENOOP: 4; + SQLITE_CHANGESET_DATA: 1; + SQLITE_CHANGESET_NOTFOUND: 2; + SQLITE_CHANGESET_CONFLICT: 3; + SQLITE_CHANGESET_CONSTRAINT: 4; + SQLITE_CHANGESET_FOREIGN_KEY: 5; + SQLITE_CHANGESET_OMIT: 0; + SQLITE_CHANGESET_REPLACE: 1; + SQLITE_CHANGESET_ABORT: 2; + SQLITE_CONFIG_SINGLETHREAD: 1; + SQLITE_CONFIG_MULTITHREAD: 2; + SQLITE_CONFIG_SERIALIZED: 3; + SQLITE_CONFIG_MALLOC: 4; + SQLITE_CONFIG_GETMALLOC: 5; + SQLITE_CONFIG_SCRATCH: 6; + SQLITE_CONFIG_PAGECACHE: 7; + SQLITE_CONFIG_HEAP: 8; + SQLITE_CONFIG_MEMSTATUS: 9; + SQLITE_CONFIG_MUTEX: 10; + SQLITE_CONFIG_GETMUTEX: 11; + SQLITE_CONFIG_LOOKASIDE: 13; + SQLITE_CONFIG_PCACHE: 14; + SQLITE_CONFIG_GETPCACHE: 15; + SQLITE_CONFIG_LOG: 16; + SQLITE_CONFIG_URI: 17; + SQLITE_CONFIG_PCACHE2: 18; + SQLITE_CONFIG_GETPCACHE2: 19; + SQLITE_CONFIG_COVERING_INDEX_SCAN: 20; + SQLITE_CONFIG_SQLLOG: 21; + SQLITE_CONFIG_MMAP_SIZE: 22; + SQLITE_CONFIG_WIN32_HEAPSIZE: 23; + SQLITE_CONFIG_PCACHE_HDRSZ: 24; + SQLITE_CONFIG_PMASZ: 25; + SQLITE_CONFIG_STMTJRNL_SPILL: 26; + SQLITE_CONFIG_SMALL_MALLOC: 27; + SQLITE_CONFIG_SORTERREF_SIZE: 28; + SQLITE_CONFIG_MEMDB_MAXSIZE: 29; + SQLITE_INTEGER: 1; + SQLITE_FLOAT: 2; + SQLITE_TEXT: 3; + SQLITE_BLOB: 4; + SQLITE_NULL: 5; + SQLITE_DBCONFIG_MAINDBNAME: 1000; + SQLITE_DBCONFIG_LOOKASIDE: 1001; + SQLITE_DBCONFIG_ENABLE_FKEY: 1002; + SQLITE_DBCONFIG_ENABLE_TRIGGER: 1003; + SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER: 1004; + SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION: 1005; + SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE: 1006; + SQLITE_DBCONFIG_ENABLE_QPSG: 1007; + SQLITE_DBCONFIG_TRIGGER_EQP: 1008; + SQLITE_DBCONFIG_RESET_DATABASE: 1009; + SQLITE_DBCONFIG_DEFENSIVE: 1010; + SQLITE_DBCONFIG_WRITABLE_SCHEMA: 1011; + SQLITE_DBCONFIG_LEGACY_ALTER_TABLE: 1012; + SQLITE_DBCONFIG_DQS_DML: 1013; + SQLITE_DBCONFIG_DQS_DDL: 1014; + SQLITE_DBCONFIG_ENABLE_VIEW: 1015; + SQLITE_DBCONFIG_LEGACY_FILE_FORMAT: 1016; + SQLITE_DBCONFIG_TRUSTED_SCHEMA: 1017; + SQLITE_DBCONFIG_STMT_SCANSTATUS: 1018; + SQLITE_DBCONFIG_REVERSE_SCANORDER: 1019; + SQLITE_DBCONFIG_MAX: 1019; + SQLITE_DBSTATUS_LOOKASIDE_USED: 0; + SQLITE_DBSTATUS_CACHE_USED: 1; + SQLITE_DBSTATUS_SCHEMA_USED: 2; + SQLITE_DBSTATUS_STMT_USED: 3; + SQLITE_DBSTATUS_LOOKASIDE_HIT: 4; + SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE: 5; + SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL: 6; + SQLITE_DBSTATUS_CACHE_HIT: 7; + SQLITE_DBSTATUS_CACHE_MISS: 8; + SQLITE_DBSTATUS_CACHE_WRITE: 9; + SQLITE_DBSTATUS_DEFERRED_FKS: 10; + SQLITE_DBSTATUS_CACHE_USED_SHARED: 11; + SQLITE_DBSTATUS_CACHE_SPILL: 12; + SQLITE_DBSTATUS_MAX: 12; + SQLITE_UTF8: 1; + SQLITE_UTF16LE: 2; + SQLITE_UTF16BE: 3; + SQLITE_UTF16: 4; + SQLITE_UTF16_ALIGNED: 8; + SQLITE_FCNTL_LOCKSTATE: 1; + SQLITE_FCNTL_GET_LOCKPROXYFILE: 2; + SQLITE_FCNTL_SET_LOCKPROXYFILE: 3; + SQLITE_FCNTL_LAST_ERRNO: 4; + SQLITE_FCNTL_SIZE_HINT: 5; + SQLITE_FCNTL_CHUNK_SIZE: 6; + SQLITE_FCNTL_FILE_POINTER: 7; + SQLITE_FCNTL_SYNC_OMITTED: 8; + SQLITE_FCNTL_WIN32_AV_RETRY: 9; + SQLITE_FCNTL_PERSIST_WAL: 10; + SQLITE_FCNTL_OVERWRITE: 11; + SQLITE_FCNTL_VFSNAME: 12; + SQLITE_FCNTL_POWERSAFE_OVERWRITE: 13; + SQLITE_FCNTL_PRAGMA: 14; + SQLITE_FCNTL_BUSYHANDLER: 15; + SQLITE_FCNTL_TEMPFILENAME: 16; + SQLITE_FCNTL_MMAP_SIZE: 18; + SQLITE_FCNTL_TRACE: 19; + SQLITE_FCNTL_HAS_MOVED: 20; + SQLITE_FCNTL_SYNC: 21; + SQLITE_FCNTL_COMMIT_PHASETWO: 22; + SQLITE_FCNTL_WIN32_SET_HANDLE: 23; + SQLITE_FCNTL_WAL_BLOCK: 24; + SQLITE_FCNTL_ZIPVFS: 25; + SQLITE_FCNTL_RBU: 26; + SQLITE_FCNTL_VFS_POINTER: 27; + SQLITE_FCNTL_JOURNAL_POINTER: 28; + SQLITE_FCNTL_WIN32_GET_HANDLE: 29; + SQLITE_FCNTL_PDB: 30; + SQLITE_FCNTL_BEGIN_ATOMIC_WRITE: 31; + SQLITE_FCNTL_COMMIT_ATOMIC_WRITE: 32; + SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE: 33; + SQLITE_FCNTL_LOCK_TIMEOUT: 34; + SQLITE_FCNTL_DATA_VERSION: 35; + SQLITE_FCNTL_SIZE_LIMIT: 36; + SQLITE_FCNTL_CKPT_DONE: 37; + SQLITE_FCNTL_RESERVE_BYTES: 38; + SQLITE_FCNTL_CKPT_START: 39; + SQLITE_FCNTL_EXTERNAL_READER: 40; + SQLITE_FCNTL_CKSM_FILE: 41; + SQLITE_FCNTL_RESET_CACHE: 42; + SQLITE_LOCK_NONE: 0; + SQLITE_LOCK_SHARED: 1; + SQLITE_LOCK_RESERVED: 2; + SQLITE_LOCK_PENDING: 3; + SQLITE_LOCK_EXCLUSIVE: 4; + SQLITE_IOCAP_ATOMIC: 1; + SQLITE_IOCAP_ATOMIC512: 2; + SQLITE_IOCAP_ATOMIC1K: 4; + SQLITE_IOCAP_ATOMIC2K: 8; + SQLITE_IOCAP_ATOMIC4K: 16; + SQLITE_IOCAP_ATOMIC8K: 32; + SQLITE_IOCAP_ATOMIC16K: 64; + SQLITE_IOCAP_ATOMIC32K: 128; + SQLITE_IOCAP_ATOMIC64K: 256; + SQLITE_IOCAP_SAFE_APPEND: 512; + SQLITE_IOCAP_SEQUENTIAL: 1024; + SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN: 2048; + SQLITE_IOCAP_POWERSAFE_OVERWRITE: 4096; + SQLITE_IOCAP_IMMUTABLE: 8192; + SQLITE_IOCAP_BATCH_ATOMIC: 16384; + SQLITE_MAX_ALLOCATION_SIZE: 536870911; + SQLITE_LIMIT_LENGTH: 0; + SQLITE_MAX_LENGTH: 1000000000; + SQLITE_LIMIT_SQL_LENGTH: 1; + SQLITE_MAX_SQL_LENGTH: 1000000000; + SQLITE_LIMIT_COLUMN: 2; + SQLITE_MAX_COLUMN: 2000; + SQLITE_LIMIT_EXPR_DEPTH: 3; + SQLITE_MAX_EXPR_DEPTH: 1000; + SQLITE_LIMIT_COMPOUND_SELECT: 4; + SQLITE_MAX_COMPOUND_SELECT: 500; + SQLITE_LIMIT_VDBE_OP: 5; + SQLITE_MAX_VDBE_OP: 250000000; + SQLITE_LIMIT_FUNCTION_ARG: 6; + SQLITE_MAX_FUNCTION_ARG: 127; + SQLITE_LIMIT_ATTACHED: 7; + SQLITE_MAX_ATTACHED: 10; + SQLITE_LIMIT_LIKE_PATTERN_LENGTH: 8; + SQLITE_MAX_LIKE_PATTERN_LENGTH: 50000; + SQLITE_LIMIT_VARIABLE_NUMBER: 9; + SQLITE_MAX_VARIABLE_NUMBER: 32766; + SQLITE_LIMIT_TRIGGER_DEPTH: 10; + SQLITE_MAX_TRIGGER_DEPTH: 1000; + SQLITE_LIMIT_WORKER_THREADS: 11; + SQLITE_MAX_WORKER_THREADS: 0; + SQLITE_OPEN_READONLY: 1; + SQLITE_OPEN_READWRITE: 2; + SQLITE_OPEN_CREATE: 4; + SQLITE_OPEN_URI: 64; + SQLITE_OPEN_MEMORY: 128; + SQLITE_OPEN_NOMUTEX: 32768; + SQLITE_OPEN_FULLMUTEX: 65536; + SQLITE_OPEN_SHAREDCACHE: 131072; + SQLITE_OPEN_PRIVATECACHE: 262144; + SQLITE_OPEN_EXRESCODE: 33554432; + SQLITE_OPEN_NOFOLLOW: 16777216; + SQLITE_OPEN_MAIN_DB: 256; + SQLITE_OPEN_MAIN_JOURNAL: 2048; + SQLITE_OPEN_TEMP_DB: 512; + SQLITE_OPEN_TEMP_JOURNAL: 4096; + SQLITE_OPEN_TRANSIENT_DB: 1024; + SQLITE_OPEN_SUBJOURNAL: 8192; + SQLITE_OPEN_SUPER_JOURNAL: 16384; + SQLITE_OPEN_WAL: 524288; + SQLITE_OPEN_DELETEONCLOSE: 8; + SQLITE_OPEN_EXCLUSIVE: 16; + SQLITE_PREPARE_PERSISTENT: 1; + SQLITE_PREPARE_NORMALIZE: 2; + SQLITE_PREPARE_NO_VTAB: 4; + SQLITE_OK: 0; + SQLITE_ERROR: 1; + SQLITE_INTERNAL: 2; + SQLITE_PERM: 3; + SQLITE_ABORT: 4; + SQLITE_BUSY: 5; + SQLITE_LOCKED: 6; + SQLITE_NOMEM: 7; + SQLITE_READONLY: 8; + SQLITE_INTERRUPT: 9; + SQLITE_IOERR: 10; + SQLITE_CORRUPT: 11; + SQLITE_NOTFOUND: 12; + SQLITE_FULL: 13; + SQLITE_CANTOPEN: 14; + SQLITE_PROTOCOL: 15; + SQLITE_EMPTY: 16; + SQLITE_SCHEMA: 17; + SQLITE_TOOBIG: 18; + SQLITE_CONSTRAINT: 19; + SQLITE_MISMATCH: 20; + SQLITE_MISUSE: 21; + SQLITE_NOLFS: 22; + SQLITE_AUTH: 23; + SQLITE_FORMAT: 24; + SQLITE_RANGE: 25; + SQLITE_NOTADB: 26; + SQLITE_NOTICE: 27; + SQLITE_WARNING: 28; + SQLITE_ROW: 100; + SQLITE_DONE: 101; + SQLITE_ERROR_MISSING_COLLSEQ: 257; + SQLITE_ERROR_RETRY: 513; + SQLITE_ERROR_SNAPSHOT: 769; + SQLITE_IOERR_READ: 266; + SQLITE_IOERR_SHORT_READ: 522; + SQLITE_IOERR_WRITE: 778; + SQLITE_IOERR_FSYNC: 1034; + SQLITE_IOERR_DIR_FSYNC: 1290; + SQLITE_IOERR_TRUNCATE: 1546; + SQLITE_IOERR_FSTAT: 1802; + SQLITE_IOERR_UNLOCK: 2058; + SQLITE_IOERR_RDLOCK: 2314; + SQLITE_IOERR_DELETE: 2570; + SQLITE_IOERR_BLOCKED: 2826; + SQLITE_IOERR_NOMEM: 3082; + SQLITE_IOERR_ACCESS: 3338; + SQLITE_IOERR_CHECKRESERVEDLOCK: 3594; + SQLITE_IOERR_LOCK: 3850; + SQLITE_IOERR_CLOSE: 4106; + SQLITE_IOERR_DIR_CLOSE: 4362; + SQLITE_IOERR_SHMOPEN: 4618; + SQLITE_IOERR_SHMSIZE: 4874; + SQLITE_IOERR_SHMLOCK: 5130; + SQLITE_IOERR_SHMMAP: 5386; + SQLITE_IOERR_SEEK: 5642; + SQLITE_IOERR_DELETE_NOENT: 5898; + SQLITE_IOERR_MMAP: 6154; + SQLITE_IOERR_GETTEMPPATH: 6410; + SQLITE_IOERR_CONVPATH: 6666; + SQLITE_IOERR_VNODE: 6922; + SQLITE_IOERR_AUTH: 7178; + SQLITE_IOERR_BEGIN_ATOMIC: 7434; + SQLITE_IOERR_COMMIT_ATOMIC: 7690; + SQLITE_IOERR_ROLLBACK_ATOMIC: 7946; + SQLITE_IOERR_DATA: 8202; + SQLITE_IOERR_CORRUPTFS: 8458; + SQLITE_LOCKED_SHAREDCACHE: 262; + SQLITE_LOCKED_VTAB: 518; + SQLITE_BUSY_RECOVERY: 261; + SQLITE_BUSY_SNAPSHOT: 517; + SQLITE_BUSY_TIMEOUT: 773; + SQLITE_CANTOPEN_NOTEMPDIR: 270; + SQLITE_CANTOPEN_ISDIR: 526; + SQLITE_CANTOPEN_FULLPATH: 782; + SQLITE_CANTOPEN_CONVPATH: 1038; + SQLITE_CANTOPEN_SYMLINK: 1550; + SQLITE_CORRUPT_VTAB: 267; + SQLITE_CORRUPT_SEQUENCE: 523; + SQLITE_CORRUPT_INDEX: 779; + SQLITE_READONLY_RECOVERY: 264; + SQLITE_READONLY_CANTLOCK: 520; + SQLITE_READONLY_ROLLBACK: 776; + SQLITE_READONLY_DBMOVED: 1032; + SQLITE_READONLY_CANTINIT: 1288; + SQLITE_READONLY_DIRECTORY: 1544; + SQLITE_ABORT_ROLLBACK: 516; + SQLITE_CONSTRAINT_CHECK: 275; + SQLITE_CONSTRAINT_COMMITHOOK: 531; + SQLITE_CONSTRAINT_FOREIGNKEY: 787; + SQLITE_CONSTRAINT_FUNCTION: 1043; + SQLITE_CONSTRAINT_NOTNULL: 1299; + SQLITE_CONSTRAINT_PRIMARYKEY: 1555; + SQLITE_CONSTRAINT_TRIGGER: 1811; + SQLITE_CONSTRAINT_UNIQUE: 2067; + SQLITE_CONSTRAINT_VTAB: 2323; + SQLITE_CONSTRAINT_ROWID: 2579; + SQLITE_CONSTRAINT_PINNED: 2835; + SQLITE_CONSTRAINT_DATATYPE: 3091; + SQLITE_NOTICE_RECOVER_WAL: 283; + SQLITE_NOTICE_RECOVER_ROLLBACK: 539; + SQLITE_WARNING_AUTOINDEX: 284; + SQLITE_AUTH_USER: 279; + SQLITE_OK_LOAD_PERMANENTLY: 256; + SQLITE_STATUS_MEMORY_USED: 0; + SQLITE_STATUS_PAGECACHE_USED: 1; + SQLITE_STATUS_PAGECACHE_OVERFLOW: 2; + SQLITE_STATUS_MALLOC_SIZE: 5; + SQLITE_STATUS_PARSER_STACK: 6; + SQLITE_STATUS_PAGECACHE_SIZE: 7; + SQLITE_STATUS_MALLOC_COUNT: 9; + SQLITE_STMTSTATUS_FULLSCAN_STEP: 1; + SQLITE_STMTSTATUS_SORT: 2; + SQLITE_STMTSTATUS_AUTOINDEX: 3; + SQLITE_STMTSTATUS_VM_STEP: 4; + SQLITE_STMTSTATUS_REPREPARE: 5; + SQLITE_STMTSTATUS_RUN: 6; + SQLITE_STMTSTATUS_FILTER_MISS: 7; + SQLITE_STMTSTATUS_FILTER_HIT: 8; + SQLITE_STMTSTATUS_MEMUSED: 99; + SQLITE_SYNC_NORMAL: 2; + SQLITE_SYNC_FULL: 3; + SQLITE_SYNC_DATAONLY: 16; + SQLITE_TRACE_STMT: 1; + SQLITE_TRACE_PROFILE: 2; + SQLITE_TRACE_ROW: 4; + SQLITE_TRACE_CLOSE: 8; + SQLITE_TXN_NONE: 0; + SQLITE_TXN_READ: 1; + SQLITE_TXN_WRITE: 2; + SQLITE_DETERMINISTIC: 2048; + SQLITE_DIRECTONLY: 524288; + SQLITE_INNOCUOUS: 2097152; + SQLITE_VERSION_NUMBER: number; + SQLITE_VERSION: string; + SQLITE_SOURCE_ID: string; + SQLITE_SERIALIZE_NOCOPY: 1; + SQLITE_DESERIALIZE_FREEONCLOSE: 1; + SQLITE_DESERIALIZE_READONLY: 4; + SQLITE_DESERIALIZE_RESIZEABLE: 2; + SQLITE_SESSION_CONFIG_STRMSIZE: 1; + SQLITE_SESSION_OBJCONFIG_SIZE: 1; + SQLITE_INDEX_SCAN_UNIQUE: 1; + SQLITE_INDEX_CONSTRAINT_EQ: 2; + SQLITE_INDEX_CONSTRAINT_GT: 4; + SQLITE_INDEX_CONSTRAINT_LE: 8; + SQLITE_INDEX_CONSTRAINT_LT: 16; + SQLITE_INDEX_CONSTRAINT_GE: 32; + SQLITE_INDEX_CONSTRAINT_MATCH: 64; + SQLITE_INDEX_CONSTRAINT_LIKE: 65; + SQLITE_INDEX_CONSTRAINT_GLOB: 66; + SQLITE_INDEX_CONSTRAINT_REGEXP: 67; + SQLITE_INDEX_CONSTRAINT_NE: 68; + SQLITE_INDEX_CONSTRAINT_ISNOT: 69; + SQLITE_INDEX_CONSTRAINT_ISNOTNULL: 70; + SQLITE_INDEX_CONSTRAINT_ISNULL: 71; + SQLITE_INDEX_CONSTRAINT_IS: 72; + SQLITE_INDEX_CONSTRAINT_LIMIT: 73; + SQLITE_INDEX_CONSTRAINT_OFFSET: 74; + SQLITE_INDEX_CONSTRAINT_FUNCTION: 150; + SQLITE_VTAB_CONSTRAINT_SUPPORT: 1; + SQLITE_VTAB_INNOCUOUS: 2; + SQLITE_VTAB_DIRECTONLY: 3; + SQLITE_VTAB_USES_ALL_SCHEMAS: 4; + SQLITE_ROLLBACK: 1; + SQLITE_FAIL: 3; + SQLITE_REPLACE: 5; +}; diff --git a/node_modules/@sqlite.org/sqlite-wasm/index.mjs b/node_modules/@sqlite.org/sqlite-wasm/index.mjs new file mode 100644 index 0000000..a9d2ae5 --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/index.mjs @@ -0,0 +1,7 @@ +import { default as sqlite3InitModule } from './sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs'; +import './sqlite-wasm/jswasm/sqlite3-worker1-promiser.mjs'; + +const sqlite3Worker1Promiser = globalThis.sqlite3Worker1Promiser; + +export default sqlite3InitModule; +export { sqlite3Worker1Promiser }; diff --git a/node_modules/@sqlite.org/sqlite-wasm/node.mjs b/node_modules/@sqlite.org/sqlite-wasm/node.mjs new file mode 100644 index 0000000..a0b6e1d --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/node.mjs @@ -0,0 +1,3 @@ +import { default as sqlite3InitModule } from './sqlite-wasm/jswasm/sqlite3-node.mjs'; + +export default sqlite3InitModule; diff --git a/node_modules/@sqlite.org/sqlite-wasm/package.json b/node_modules/@sqlite.org/sqlite-wasm/package.json new file mode 100644 index 0000000..ff151ae --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/package.json @@ -0,0 +1,72 @@ +{ + "name": "@sqlite.org/sqlite-wasm", + "version": "3.50.4-build1", + "description": "SQLite Wasm conveniently wrapped as an ES Module.", + "keywords": [ + "sqlite", + "sqlite3", + "sqlite-wasm", + "sqlite3-wasm", + "webassembly", + "wasm", + "esm", + "opfs", + "origin-private-file-system" + ], + "main": "index.mjs", + "node": "node.mjs", + "type": "module", + "files": [ + "index.d.ts", + "index.mjs", + "node.mjs", + "sqlite-wasm/" + ], + "types": "index.d.ts", + "exports": { + ".": { + "types": "./index.d.ts", + "node": "./node.mjs", + "import": "./index.mjs", + "main": "./index.mjs", + "browser": "./index.mjs" + }, + "./package.json": "./package.json", + "./sqlite3.wasm": "./sqlite-wasm/jswasm/sqlite3.wasm" + }, + "bin": { + "sqlite-wasm": "bin/index.js" + }, + "scripts": { + "publint": "npx publint", + "check-types": "tsc", + "clean": "shx rm -rf sqlite-wasm", + "build": "npm run clean && node bin/index.js", + "start": "npx http-server --coop", + "start:node": "cd demo && node node.mjs", + "fix": "npx prettier . --write", + "prepublishOnly": "npm run build && npm run fix && npm run publint && npm run check-types", + "deploy": "npm run prepublishOnly && git add . && git commit -am 'New release' && git push && npm publish --access public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/sqlite/sqlite-wasm.git" + }, + "author": "Thomas Steiner (tomac@google.com)", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/sqlite/sqlite-wasm/issues" + }, + "homepage": "https://github.com/sqlite/sqlite-wasm#readme", + "devDependencies": { + "decompress": "^4.2.1", + "http-server": "github:vapier/http-server", + "module-workers-polyfill": "^0.3.2", + "node-fetch": "^3.3.2", + "prettier": "^3.6.2", + "prettier-plugin-jsdoc": "^1.3.3", + "publint": "^0.3.12", + "shx": "^0.4.0", + "typescript": "^5.9.2" + } +} diff --git a/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs new file mode 100644 index 0000000..ac82b14 --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs @@ -0,0 +1,14037 @@ +/* + ** LICENSE for the sqlite3 WebAssembly/JavaScript APIs. + ** + ** This bundle (typically released as sqlite3.js or sqlite3.mjs) + ** is an amalgamation of JavaScript source code from two projects: + ** + ** 1) https://emscripten.org: the Emscripten "glue code" is covered by + ** the terms of the MIT license and University of Illinois/NCSA + ** Open Source License, as described at: + ** + ** https://emscripten.org/docs/introducing_emscripten/emscripten_license.html + ** + ** 2) https://sqlite.org: all code and documentation labeled as being + ** from this source are released under the same terms as the sqlite3 + ** C library: + ** + ** 2022-10-16 + ** + ** The author disclaims copyright to this source code. In place of a + ** legal notice, here is a blessing: + ** + ** * May you do good and not evil. + ** * May you find forgiveness for yourself and forgive others. + ** * May you share freely, never taking more than you give. + */ +/* + ** This code was built from sqlite3 version... + ** + ** SQLITE_VERSION "3.50.4" + ** SQLITE_VERSION_NUMBER 3050004 + ** SQLITE_SOURCE_ID "2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3" + ** + ** Using the Emscripten SDK version 3.1.70. + */ + +var sqlite3InitModule = (() => { + var _scriptName = import.meta.url; + + return function (moduleArg = {}) { + var moduleRtn; + + var Module = moduleArg; + + var readyPromiseResolve, readyPromiseReject; + var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; + }); + + var ENVIRONMENT_IS_WEB = typeof window == 'object'; + var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function'; + + var ENVIRONMENT_IS_NODE = + typeof process == 'object' && + typeof process.versions == 'object' && + typeof process.versions.node == 'string' && + process.type != 'renderer'; + var ENVIRONMENT_IS_SHELL = + !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + + const sqlite3InitModuleState = + globalThis.sqlite3InitModuleState || + Object.assign(Object.create(null), { + debugModule: () => {}, + }); + delete globalThis.sqlite3InitModuleState; + sqlite3InitModuleState.debugModule( + 'globalThis.location =', + globalThis.location, + ); + + var moduleOverrides = Object.assign({}, Module); + + var arguments_ = []; + var thisProgram = './this.program'; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + + var scriptDirectory = ''; + function locateFile(path) { + if (Module['locateFile']) { + return Module['locateFile'](path, scriptDirectory); + } + return scriptDirectory + path; + } + + var readAsync, readBinary; + + if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != 'undefined' && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + + if (_scriptName) { + scriptDirectory = _scriptName; + } + + if (scriptDirectory.startsWith('blob:')) { + scriptDirectory = ''; + } else { + scriptDirectory = scriptDirectory.substr( + 0, + scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/') + 1, + ); + } + + { + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.responseType = 'arraybuffer'; + xhr.send(null); + return new Uint8Array(xhr.response); + }; + } + + readAsync = (url) => { + return fetch(url, { credentials: 'same-origin' }).then((response) => { + if (response.ok) { + return response.arrayBuffer(); + } + return Promise.reject( + new Error(response.status + ' : ' + response.url), + ); + }); + }; + } + } else { + } + + var out = Module['print'] || console.log.bind(console); + var err = Module['printErr'] || console.error.bind(console); + + Object.assign(Module, moduleOverrides); + + moduleOverrides = null; + + if (Module['arguments']) arguments_ = Module['arguments']; + + if (Module['thisProgram']) thisProgram = Module['thisProgram']; + + var wasmBinary = Module['wasmBinary']; + + var wasmMemory; + + var ABORT = false; + + var EXITSTATUS; + + function assert(condition, text) { + if (!condition) { + abort(text); + } + } + + var HEAP, + HEAP8, + HEAPU8, + HEAP16, + HEAPU16, + HEAP32, + HEAPU32, + HEAPF32, + HEAP64, + HEAPU64, + HEAPF64; + + function updateMemoryViews() { + var b = wasmMemory.buffer; + Module['HEAP8'] = HEAP8 = new Int8Array(b); + Module['HEAP16'] = HEAP16 = new Int16Array(b); + Module['HEAPU8'] = HEAPU8 = new Uint8Array(b); + Module['HEAPU16'] = HEAPU16 = new Uint16Array(b); + Module['HEAP32'] = HEAP32 = new Int32Array(b); + Module['HEAPU32'] = HEAPU32 = new Uint32Array(b); + Module['HEAPF32'] = HEAPF32 = new Float32Array(b); + Module['HEAPF64'] = HEAPF64 = new Float64Array(b); + Module['HEAP64'] = HEAP64 = new BigInt64Array(b); + Module['HEAPU64'] = HEAPU64 = new BigUint64Array(b); + } + + if (Module['wasmMemory']) { + wasmMemory = Module['wasmMemory']; + } else { + var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 16777216; + + wasmMemory = new WebAssembly.Memory({ + initial: INITIAL_MEMORY / 65536, + + maximum: 32768, + }); + } + + updateMemoryViews(); + + var __ATPRERUN__ = []; + var __ATINIT__ = []; + var __ATEXIT__ = []; + var __ATPOSTRUN__ = []; + + var runtimeInitialized = false; + + function preRun() { + var preRuns = Module['preRun']; + if (preRuns) { + if (typeof preRuns == 'function') preRuns = [preRuns]; + preRuns.forEach(addOnPreRun); + } + callRuntimeCallbacks(__ATPRERUN__); + } + + function initRuntime() { + runtimeInitialized = true; + + if (!Module['noFSInit'] && !FS.initialized) FS.init(); + FS.ignorePermissions = false; + + TTY.init(); + callRuntimeCallbacks(__ATINIT__); + } + + function postRun() { + var postRuns = Module['postRun']; + if (postRuns) { + if (typeof postRuns == 'function') postRuns = [postRuns]; + postRuns.forEach(addOnPostRun); + } + + callRuntimeCallbacks(__ATPOSTRUN__); + } + + function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); + } + + function addOnInit(cb) { + __ATINIT__.unshift(cb); + } + + function addOnExit(cb) {} + + function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); + } + + var runDependencies = 0; + var runDependencyWatcher = null; + var dependenciesFulfilled = null; + + function getUniqueRunDependency(id) { + return id; + } + + function addRunDependency(id) { + runDependencies++; + + Module['monitorRunDependencies']?.(runDependencies); + } + + function removeRunDependency(id) { + runDependencies--; + + Module['monitorRunDependencies']?.(runDependencies); + + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + + function abort(what) { + Module['onAbort']?.(what); + + what = 'Aborted(' + what + ')'; + + err(what); + + ABORT = true; + + what += '. Build with -sASSERTIONS for more info.'; + + var e = new WebAssembly.RuntimeError(what); + + readyPromiseReject(e); + + throw e; + } + + var dataURIPrefix = 'data:application/octet-stream;base64,'; + + var isDataURI = (filename) => filename.startsWith(dataURIPrefix); + + var isFileURI = (filename) => filename.startsWith('file://'); + + function findWasmBinary() { + if (Module['locateFile']) { + var f = 'sqlite3.wasm'; + if (!isDataURI(f)) { + return locateFile(f); + } + return f; + } + + return new URL('sqlite3.wasm', import.meta.url).href; + } + + var wasmBinaryFile; + + function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw 'both async and sync fetching of the wasm failed'; + } + + function getBinaryPromise(binaryFile) { + if (!wasmBinary) { + return readAsync(binaryFile).then( + (response) => new Uint8Array(response), + + () => getBinarySync(binaryFile), + ); + } + + return Promise.resolve().then(() => getBinarySync(binaryFile)); + } + + function instantiateArrayBuffer(binaryFile, imports, receiver) { + return getBinaryPromise(binaryFile) + .then((binary) => { + return WebAssembly.instantiate(binary, imports); + }) + .then(receiver, (reason) => { + err(`failed to asynchronously prepare wasm: ${reason}`); + + abort(reason); + }); + } + + function instantiateAsync(binary, binaryFile, imports, callback) { + if ( + !binary && + typeof WebAssembly.instantiateStreaming == 'function' && + !isDataURI(binaryFile) && + typeof fetch == 'function' + ) { + return fetch(binaryFile, { credentials: 'same-origin' }).then( + (response) => { + var result = WebAssembly.instantiateStreaming(response, imports); + + return result.then(callback, function (reason) { + err(`wasm streaming compile failed: ${reason}`); + err('falling back to ArrayBuffer instantiation'); + return instantiateArrayBuffer(binaryFile, imports, callback); + }); + }, + ); + } + return instantiateArrayBuffer(binaryFile, imports, callback); + } + + function getWasmImports() { + return { + env: wasmImports, + wasi_snapshot_preview1: wasmImports, + }; + } + + function createWasm() { + var info = getWasmImports(); + + function receiveInstance(instance, module) { + wasmExports = instance.exports; + + addOnInit(wasmExports['__wasm_call_ctors']); + + removeRunDependency('wasm-instantiate'); + return wasmExports; + } + + addRunDependency('wasm-instantiate'); + + function receiveInstantiationResult(result) { + receiveInstance(result['instance']); + } + + if (Module['instantiateWasm']) { + try { + return Module['instantiateWasm'](info, receiveInstance); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + + readyPromiseReject(e); + } + } + + wasmBinaryFile ??= findWasmBinary(); + + instantiateAsync( + wasmBinary, + wasmBinaryFile, + info, + receiveInstantiationResult, + ).catch(readyPromiseReject); + return {}; + } + + function ExitStatus(status) { + this.name = 'ExitStatus'; + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + + var callRuntimeCallbacks = (callbacks) => { + callbacks.forEach((f) => f(Module)); + }; + + function getValue(ptr, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': + return HEAP8[ptr]; + case 'i8': + return HEAP8[ptr]; + case 'i16': + return HEAP16[ptr >> 1]; + case 'i32': + return HEAP32[ptr >> 2]; + case 'i64': + return HEAP64[ptr >> 3]; + case 'float': + return HEAPF32[ptr >> 2]; + case 'double': + return HEAPF64[ptr >> 3]; + case '*': + return HEAPU32[ptr >> 2]; + default: + abort(`invalid type for getValue: ${type}`); + } + } + + var noExitRuntime = Module['noExitRuntime'] || true; + + function setValue(ptr, value, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': + HEAP8[ptr] = value; + break; + case 'i8': + HEAP8[ptr] = value; + break; + case 'i16': + HEAP16[ptr >> 1] = value; + break; + case 'i32': + HEAP32[ptr >> 2] = value; + break; + case 'i64': + HEAP64[ptr >> 3] = BigInt(value); + break; + case 'float': + HEAPF32[ptr >> 2] = value; + break; + case 'double': + HEAPF64[ptr >> 3] = value; + break; + case '*': + HEAPU32[ptr >> 2] = value; + break; + default: + abort(`invalid type for setValue: ${type}`); + } + } + + var stackRestore = (val) => __emscripten_stack_restore(val); + + var stackSave = () => _emscripten_stack_get_current(); + + var PATH = { + isAbs: (path) => path.charAt(0) === '/', + splitPath: (filename) => { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift('..'); + } + } + return parts; + }, + normalize: (path) => { + var isAbsolute = PATH.isAbs(path), + trailingSlash = path.substr(-1) === '/'; + + path = PATH.normalizeArray( + path.split('/').filter((p) => !!p), + !isAbsolute, + ).join('/'); + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + return (isAbsolute ? '/' : '') + path; + }, + dirname: (path) => { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return '.'; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: (path) => { + if (path === '/') return '/'; + path = PATH.normalize(path); + path = path.replace(/\/$/, ''); + var lastSlash = path.lastIndexOf('/'); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + join: (...paths) => PATH.normalize(paths.join('/')), + join2: (l, r) => PATH.normalize(l + '/' + r), + }; + + var initRandomFill = () => { + if ( + typeof crypto == 'object' && + typeof crypto['getRandomValues'] == 'function' + ) { + return (view) => crypto.getRandomValues(view); + } else abort('initRandomDevice'); + }; + var randomFill = (view) => { + return (randomFill = initRandomFill())(view); + }; + + var PATH_FS = { + resolve: (...args) => { + var resolvedPath = '', + resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? args[i] : FS.cwd(); + + if (typeof path != 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + return ''; + } + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + + resolvedPath = PATH.normalizeArray( + resolvedPath.split('/').filter((p) => !!p), + !resolvedAbsolute, + ).join('/'); + return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join('/'); + }, + }; + + var UTF8Decoder = + typeof TextDecoder != 'undefined' ? new TextDecoder() : undefined; + + var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ''; + + while (idx < endPtr) { + var u0 = heapOrArray[idx++]; + if (!(u0 & 0x80)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 0xe0) == 0xc0) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 0xf0) == 0xe0) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + u0 = + ((u0 & 7) << 18) | + (u1 << 12) | + (u2 << 6) | + (heapOrArray[idx++] & 63); + } + + if (u0 < 0x10000) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 0x10000; + str += String.fromCharCode( + 0xd800 | (ch >> 10), + 0xdc00 | (ch & 0x3ff), + ); + } + } + return str; + }; + + var FS_stdin_getChar_buffer = []; + + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var c = str.charCodeAt(i); + if (c <= 0x7f) { + len++; + } else if (c <= 0x7ff) { + len += 2; + } else if (c >= 0xd800 && c <= 0xdfff) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; + }; + + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + if (!(maxBytesToWrite > 0)) return 0; + + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 0xd800 && u <= 0xdfff) { + var u1 = str.charCodeAt(++i); + u = (0x10000 + ((u & 0x3ff) << 10)) | (u1 & 0x3ff); + } + if (u <= 0x7f) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 0x7ff) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 0xc0 | (u >> 6); + heap[outIdx++] = 0x80 | (u & 63); + } else if (u <= 0xffff) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 0xe0 | (u >> 12); + heap[outIdx++] = 0x80 | ((u >> 6) & 63); + heap[outIdx++] = 0x80 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + heap[outIdx++] = 0xf0 | (u >> 18); + heap[outIdx++] = 0x80 | ((u >> 12) & 63); + heap[outIdx++] = 0x80 | ((u >> 6) & 63); + heap[outIdx++] = 0x80 | (u & 63); + } + } + + heap[outIdx] = 0; + return outIdx - startIdx; + }; + + function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length, + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + } + var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if ( + typeof window != 'undefined' && + typeof window.prompt == 'function' + ) { + result = window.prompt('Input: '); + if (result !== null) { + result += '\n'; + } + } else { + } + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); + }; + var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops: ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ + 0x03, 0x1c, 0x7f, 0x15, 0x04, 0x00, 0x01, 0x00, 0x11, 0x13, 0x1a, + 0x00, 0x12, 0x0f, 0x17, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ], + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [24, 80]; + }, + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + }, + }; + + var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); + }; + + var alignMemory = (size, alignment) => { + return Math.ceil(size / alignment) * alignment; + }; + var mmapAlloc = (size) => { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (ptr) zeroMemory(ptr, size); + return ptr; + }; + var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, '/', 16384 | 511, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2.0 : 1.125)) >>> + 0, + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray(0, Math.min(newSize, node.usedBytes)), + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw FS.genericErrors[44]; + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir(node) { + var entries = ['.', '..']; + for (var key of Object.keys(node.contents)) { + entries.push(key); + } + return entries; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + return length; + } + } + + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length, + ); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length, + ); + } + } + HEAP8.set(contents, ptr); + } + } + return { ptr, allocated }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + + return 0; + }, + }, + }; + + var asyncLoad = (url, onload, onerror, noRunDep) => { + var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : ''; + readAsync(url).then( + (arrayBuffer) => { + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, + (err) => { + if (onerror) { + onerror(); + } else { + throw `Loading data file "${url}" failed.`; + } + }, + ); + if (dep) addRunDependency(dep); + }; + + var FS_createDataFile = ( + parent, + name, + fileData, + canRead, + canWrite, + canOwn, + ) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); + }; + + var preloadPlugins = Module['preloadPlugins'] || []; + var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + if (typeof Browser != 'undefined') Browser.init(); + + var handled = false; + preloadPlugins.forEach((plugin) => { + if (handled) return; + if (plugin['canHandle'](fullname)) { + plugin['handle'](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }; + var FS_createPreloadedFile = ( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish, + ) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn, + ); + } + onload?.(); + removeRunDependency(dep); + } + if ( + FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == 'string') { + asyncLoad(url, processData, onerror); + } else { + processData(url); + } + }; + + var FS_modeStringToFlags = (str) => { + var flagModes = { + r: 0, + 'r+': 2, + w: 512 | 64 | 1, + 'w+': 512 | 64 | 2, + a: 1024 | 64 | 1, + 'a+': 1024 | 64 | 2, + }; + var flags = flagModes[str]; + if (typeof flags == 'undefined') { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; + }; + + var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }; + + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: '/', + initialized: false, + ignorePermissions: true, + ErrnoError: class { + constructor(errno) { + this.name = 'ErrnoError'; + this.errno = errno; + } + }, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + constructor() { + this.shared = {}; + } + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + 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(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; + this.readMode = 292 | 73; + this.writeMode = 146; + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? (this.mode |= this.readMode) : (this.mode &= ~this.readMode); + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? (this.mode |= this.writeMode) : (this.mode &= ~this.writeMode); + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + path = PATH_FS.resolve(path); + + if (!path) return { path: '', node: null }; + + var defaults = { + follow_mount: true, + recurse_count: 0, + }; + opts = Object.assign(defaults, opts); + + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + + var parts = path.split('/').filter((p) => !!p); + + var current = FS.root; + var current_path = '/'; + + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + + if (FS.isMountpoint(current)) { + if (!islast || (islast && opts.follow_mount)) { + current = current.mounted.root; + } + } + + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + 1, + }); + current = lookup.node; + + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + + return { path: current_path, node: current }; + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== '/' + ? `${mount}/${path}` + : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + var node = new FS.FSNode(parent, name, mode, rdev); + + FS.hashAddNode(node); + + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = ['r', 'w', 'rw'][flag & 3]; + if (flag & 512) { + perms += 'w'; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + + if (perms.includes('r') && !(node.mode & 292)) { + return 2; + } else if (perms.includes('w') && !(node.mode & 146)) { + return 2; + } else if (perms.includes('x') && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, 'x'); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, 'wx'); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, 'wx'); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== 'r' || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: (fd) => FS.streams[fd], + createStream(stream, fd = -1) { + stream = Object.assign(new FS.FSStream(), stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + + stream.stream_ops = device.stream_ops; + + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 0xff, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice(dev, ops) { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [mount]; + + while (check.length) { + var m = check.pop(); + + mounts.push(m); + + check.push(...m.mounts); + } + + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == 'function') { + callback = populate; + populate = false; + } + + FS.syncFSRequests++; + + if (FS.syncFSRequests > 1) { + err( + `warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`, + ); + } + + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + + function doCallback(errCode) { + FS.syncFSRequests--; + return callback(errCode); + } + + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + var root = mountpoint === '/'; + var pseudo = !mountpoint; + var node; + + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + + mountpoint = lookup.path; + node = lookup.node; + + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + + var mount = { + type, + opts, + mountpoint, + mounts: [], + }; + + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + + if (node.mount) { + node.mount.mounts.push(mount); + } + } + + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + + while (current) { + var next = current.name_next; + + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + + current = next; + } + }); + + node.mounted = null; + + var idx = node.mount.mounts.indexOf(mount); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === '.' || name === '..') { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create(path, mode) { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode) { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split('/'); + var d = ''; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += '/' + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == 'undefined') { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + + var lookup, old_dir, new_dir; + + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + + var old_node = FS.lookupNode(old_dir, old_name); + + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(28); + } + + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(55); + } + + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + + if (old_node === new_node) { + return; + } + + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, 'w'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + + FS.hashRemoveNode(old_node); + + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve( + FS.getPath(link.parent), + link.node_ops.readlink(link), + ); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat(path) { + return FS.stat(path, true); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: (mode & 4095) | (node.mode & ~4095), + timestamp: Date.now(), + }); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.chmod(stream.node, mode); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + timestamp: Date.now(), + }); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.chown(stream.node, uid, gid); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, 'w'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { + size: len, + timestamp: Date.now(), + }); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + node.node_ops.setattr(node, { + timestamp: Math.max(atime, mtime), + }); + }, + open(path, flags, mode) { + if (path === '') { + throw new FS.ErrnoError(44); + } + flags = typeof flags == 'string' ? FS_modeStringToFlags(flags) : flags; + if (flags & 64) { + mode = typeof mode == 'undefined' ? 438 : mode; + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == 'object') { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + }); + node = lookup.node; + } catch (e) {} + } + + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + + if (flags & 512 && !created) { + FS.truncate(node, 0); + } + + flags &= ~(128 | 512 | 131072); + + var stream = FS.createStream({ + node, + path: FS.getPath(node), + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + + ungotten: [], + error: false, + }); + + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module['logReadFiles'] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != 'undefined'; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position, + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != 'undefined'; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn, + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags, + ); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || 'binary'; + if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === 'utf8') { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === 'binary') { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == 'string') { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error('Unsupported data type'); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, 'x'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir('/tmp'); + FS.mkdir('/home'); + FS.mkdir('/home/web_user'); + }, + createDefaultDevices() { + FS.mkdir('/dev'); + + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + }); + FS.mkdev('/dev/null', FS.makedev(1, 3)); + + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev('/dev/tty', FS.makedev(5, 0)); + FS.mkdev('/dev/tty1', FS.makedev(6, 0)); + + var randomBuffer = new Uint8Array(1024), + randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomLeft = randomFill(randomBuffer).byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice('/dev', 'random', randomByte); + FS.createDevice('/dev', 'urandom', randomByte); + + FS.mkdir('/dev/shm'); + FS.mkdir('/dev/shm/tmp'); + }, + createSpecialDirectories() { + FS.mkdir('/proc'); + var proc_self = FS.mkdir('/proc/self'); + FS.mkdir('/proc/self/fd'); + FS.mount( + { + mount() { + var node = FS.createNode(proc_self, 'fd', 16384 | 511, 73); + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { mountpoint: 'fake' }, + node_ops: { readlink: () => stream.path }, + }; + ret.parent = ret; + return ret; + }, + }; + return node; + }, + }, + {}, + '/proc/self/fd', + ); + }, + createStandardStreams(input, output, error) { + if (input) { + FS.createDevice('/dev', 'stdin', input); + } else { + FS.symlink('/dev/tty', '/dev/stdin'); + } + if (output) { + FS.createDevice('/dev', 'stdout', null, output); + } else { + FS.symlink('/dev/tty', '/dev/stdout'); + } + if (error) { + FS.createDevice('/dev', 'stderr', null, error); + } else { + FS.symlink('/dev/tty1', '/dev/stderr'); + } + + var stdin = FS.open('/dev/stdin', 0); + var stdout = FS.open('/dev/stdout', 1); + var stderr = FS.open('/dev/stderr', 1); + }, + staticInit() { + [44].forEach((code) => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ''; + }); + + FS.nameTable = new Array(4096); + + FS.mount(MEMFS, {}, '/'); + + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + + FS.filesystems = { + MEMFS: MEMFS, + }; + }, + init(input, output, error) { + FS.initialized = true; + + input ??= Module['stdin']; + output ??= Module['stdout']; + error ??= Module['stderr']; + + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === '/'; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == 'string' ? parent : FS.getPath(parent); + var parts = path.split('/').reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2( + typeof parent == 'string' ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == 'string' ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == 'string') { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2( + typeof parent == 'string' ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != 'undefined') { + 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.', + ); + } else { + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + class LazyUint8Array { + constructor() { + this.lengthKnown = false; + this.chunks = []; + } + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open('HEAD', url, false); + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + '. Status: ' + xhr.status, + ); + var datalength = Number(xhr.getResponseHeader('Content-length')); + var header; + var hasByteServing = + (header = xhr.getResponseHeader('Accept-Ranges')) && + header === 'bytes'; + var usesGzip = + (header = xhr.getResponseHeader('Content-Encoding')) && + header === 'gzip'; + + var chunkSize = 1024 * 1024; + + if (!hasByteServing) chunkSize = datalength; + + var doXHR = (from, to) => { + if (from > to) + throw new Error( + 'invalid range (' + + from + + ', ' + + to + + ') or no bytes requested!', + ); + if (to > datalength - 1) + throw new Error( + 'only ' + datalength + ' bytes available! programmer error!', + ); + + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader('Range', 'bytes=' + from + '-' + to); + + xhr.responseType = 'arraybuffer'; + if (xhr.overrideMimeType) { + xhr.overrideMimeType('text/plain; charset=x-user-defined'); + } + + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + '. Status: ' + xhr.status, + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } + return intArrayFromString(xhr.responseText || '', true); + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == 'undefined') { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == 'undefined') + throw new Error('doXHR failed!'); + return lazyArray.chunks[chunkNum]; + }); + + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + 'LazyFiles on gzip forces download of the whole file when length is accessed', + ); + } + + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + + if (typeof XMLHttpRequest != 'undefined') { + if (!ENVIRONMENT_IS_WORKER) + throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc'; + var lazyArray = new LazyUint8Array(); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url: url }; + } + + var node = FS.createFile(parent, name, properties, canRead, canWrite); + + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { ptr, allocated: true }; + }; + node.stream_ops = stream_ops; + return node; + }, + }; + + var UTF8ToString = (ptr, maxBytesToRead) => { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ''; + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat(func, path, buf) { + var stat = func(path); + HEAP32[buf >> 2] = stat.dev; + HEAP32[(buf + 4) >> 2] = stat.mode; + HEAPU32[(buf + 8) >> 2] = stat.nlink; + HEAP32[(buf + 12) >> 2] = stat.uid; + HEAP32[(buf + 16) >> 2] = stat.gid; + HEAP32[(buf + 20) >> 2] = stat.rdev; + HEAP64[(buf + 24) >> 3] = BigInt(stat.size); + HEAP32[(buf + 32) >> 2] = 4096; + HEAP32[(buf + 36) >> 2] = stat.blocks; + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(buf + 40) >> 3] = BigInt(Math.floor(atime / 1000)); + HEAPU32[(buf + 48) >> 2] = (atime % 1000) * 1000 * 1000; + HEAP64[(buf + 56) >> 3] = BigInt(Math.floor(mtime / 1000)); + HEAPU32[(buf + 64) >> 2] = (mtime % 1000) * 1000 * 1000; + HEAP64[(buf + 72) >> 3] = BigInt(Math.floor(ctime / 1000)); + HEAPU32[(buf + 80) >> 2] = (ctime % 1000) * 1000 * 1000; + HEAP64[(buf + 88) >> 3] = BigInt(stat.ino); + return 0; + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + }; + function ___syscall_chmod(path, mode) { + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_faccessat(dirfd, path, amode, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ''; + if (amode & 4) perms += 'r'; + if (amode & 2) perms += 'w'; + if (amode & 1) perms += 'x'; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fchmod(fd, mode) { + try { + FS.fchmod(fd, mode); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fchown32(fd, owner, group) { + try { + FS.fchown(fd, owner, group); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function syscallGetVarargI() { + var ret = HEAP32[+SYSCALLS.varargs >> 2]; + SYSCALLS.varargs += 4; + return ret; + } + var syscallGetVarargP = syscallGetVarargI; + + function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + case 12: { + var arg = syscallGetVarargP(); + var offset = 0; + + HEAP16[(arg + offset) >> 1] = 2; + return 0; + } + case 13: + case 14: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var INT53_MAX = 9007199254740992; + + var INT53_MIN = -9007199254740992; + var bigintToI53Checked = (num) => + num < INT53_MIN || num > INT53_MAX ? NaN : Number(num); + function ___syscall_ftruncate64(fd, length) { + length = bigintToI53Checked(length); + + try { + if (isNaN(length)) return 61; + FS.ftruncate(fd, length); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + }; + function ___syscall_getcwd(buf, size) { + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: { + if (!stream.tty) return -59; + return 0; + } + case 21505: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + HEAP32[argp >> 2] = termios.c_iflag || 0; + HEAP32[(argp + 4) >> 2] = termios.c_oflag || 0; + HEAP32[(argp + 8) >> 2] = termios.c_cflag || 0; + HEAP32[(argp + 12) >> 2] = termios.c_lflag || 0; + for (var i = 0; i < 32; i++) { + HEAP8[argp + i + 17] = termios.c_cc[i] || 0; + } + return 0; + } + return 0; + } + case 21510: + case 21511: + case 21512: { + if (!stream.tty) return -59; + return 0; + } + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = HEAP32[argp >> 2]; + var c_oflag = HEAP32[(argp + 4) >> 2]; + var c_cflag = HEAP32[(argp + 8) >> 2]; + var c_lflag = HEAP32[(argp + 12) >> 2]; + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(HEAP8[argp + i + 17]); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc, + }); + } + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + HEAP32[argp >> 2] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + HEAP16[argp >> 1] = winsize[0]; + HEAP16[(argp + 2) >> 1] = winsize[1]; + } + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + case 21515: { + if (!stream.tty) return -59; + return 0; + } + default: + return -28; + } + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_lstat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_mkdirat(dirfd, path, mode) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + + path = PATH.normalize(path); + if (path[path.length - 1] === '/') + path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_newfstatat(dirfd, path, buf, flags) { + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~6400; + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_openat(dirfd, path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = HEAP8[buf + len]; + stringToUTF8(ret, buf, bufsize + 1); + + HEAP8[buf + len] = endChar; + return len; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_rmdir(path) { + try { + path = SYSCALLS.getStr(path); + FS.rmdir(path); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_stat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_unlinkat(dirfd, path, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort('Invalid flags passed to unlinkat'); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var readI53FromI64 = (ptr) => { + return HEAPU32[ptr >> 2] + HEAP32[(ptr + 4) >> 2] * 4294967296; + }; + + function ___syscall_utimensat(dirfd, path, times, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path, true); + var now = Date.now(), + atime, + mtime; + if (!times) { + atime = now; + mtime = now; + } else { + var seconds = readI53FromI64(times); + var nanoseconds = HEAP32[(times + 8) >> 2]; + if (nanoseconds == 1073741823) { + atime = now; + } else if (nanoseconds == 1073741822) { + atime = -1; + } else { + atime = seconds * 1000 + nanoseconds / (1000 * 1000); + } + times += 16; + seconds = readI53FromI64(times); + nanoseconds = HEAP32[(times + 8) >> 2]; + if (nanoseconds == 1073741823) { + mtime = now; + } else if (nanoseconds == 1073741822) { + mtime = -1; + } else { + mtime = seconds * 1000 + nanoseconds / (1000 * 1000); + } + } + + if (mtime != -1 || atime != -1) { + FS.utime(path, atime, mtime); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var nowIsMonotonic = 1; + var __emscripten_get_now_is_monotonic = () => nowIsMonotonic; + + var isLeapYear = (year) => + year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + + var MONTH_DAYS_LEAP_CUMULATIVE = [ + 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, + ]; + + var MONTH_DAYS_REGULAR_CUMULATIVE = [ + 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, + ]; + var ydayFromDate = (date) => { + var leap = isLeapYear(date.getFullYear()); + var monthDaysCumulative = leap + ? MONTH_DAYS_LEAP_CUMULATIVE + : MONTH_DAYS_REGULAR_CUMULATIVE; + var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; + + return yday; + }; + + function __localtime_js(time, tmPtr) { + time = bigintToI53Checked(time); + + var date = new Date(time * 1000); + HEAP32[tmPtr >> 2] = date.getSeconds(); + HEAP32[(tmPtr + 4) >> 2] = date.getMinutes(); + HEAP32[(tmPtr + 8) >> 2] = date.getHours(); + HEAP32[(tmPtr + 12) >> 2] = date.getDate(); + HEAP32[(tmPtr + 16) >> 2] = date.getMonth(); + HEAP32[(tmPtr + 20) >> 2] = date.getFullYear() - 1900; + HEAP32[(tmPtr + 24) >> 2] = date.getDay(); + + var yday = ydayFromDate(date) | 0; + HEAP32[(tmPtr + 28) >> 2] = yday; + HEAP32[(tmPtr + 36) >> 2] = -(date.getTimezoneOffset() * 60); + + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = + (summerOffset != winterOffset && + date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + HEAP32[(tmPtr + 32) >> 2] = dst; + } + + function __mmap_js(len, prot, flags, fd, offset, allocated, addr) { + offset = bigintToI53Checked(offset); + + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var res = FS.mmap(stream, len, offset, prot, flags); + var ptr = res.ptr; + HEAP32[allocated >> 2] = res.allocated; + HEAPU32[addr >> 2] = ptr; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function __munmap_js(addr, len, prot, flags, fd, offset) { + offset = bigintToI53Checked(offset); + + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var __tzset_js = (timezone, daylight, std_name, dst_name) => { + var currentYear = new Date().getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + + HEAPU32[timezone >> 2] = stdTimezoneOffset * 60; + + HEAP32[daylight >> 2] = Number(winterOffset != summerOffset); + + var extractZone = (timezoneOffset) => { + var sign = timezoneOffset >= 0 ? '-' : '+'; + + var absOffset = Math.abs(timezoneOffset); + var hours = String(Math.floor(absOffset / 60)).padStart(2, '0'); + var minutes = String(absOffset % 60).padStart(2, '0'); + + return `UTC${sign}${hours}${minutes}`; + }; + + var winterName = extractZone(winterOffset); + var summerName = extractZone(summerOffset); + if (summerOffset < winterOffset) { + stringToUTF8(winterName, std_name, 17); + stringToUTF8(summerName, dst_name, 17); + } else { + stringToUTF8(winterName, dst_name, 17); + stringToUTF8(summerName, std_name, 17); + } + }; + + var _emscripten_date_now = () => Date.now(); + + var _emscripten_get_now = () => performance.now(); + + var getHeapMax = () => 2147483648; + + var growMemory = (size) => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + wasmMemory.grow(pages); + updateMemoryViews(); + return 1; + } catch (e) {} + }; + var _emscripten_resize_heap = (requestedSize) => { + var oldSize = HEAPU8.length; + + requestedSize >>>= 0; + + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + return false; + } + + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296, + ); + + var newSize = Math.min( + maxHeapSize, + alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536), + ); + + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + return false; + }; + + var ENV = {}; + + var getExecutableName = () => { + return thisProgram || './this.program'; + }; + var getEnvStrings = () => { + if (!getEnvStrings.strings) { + var lang = + ( + (typeof navigator == 'object' && + navigator.languages && + navigator.languages[0]) || + 'C' + ).replace('-', '_') + '.UTF-8'; + var env = { + USER: 'web_user', + LOGNAME: 'web_user', + PATH: '/', + PWD: '/', + HOME: '/home/web_user', + LANG: lang, + _: getExecutableName(), + }; + + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; + else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; + }; + + var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + HEAP8[buffer++] = str.charCodeAt(i); + } + + HEAP8[buffer] = 0; + }; + var _environ_get = (__environ, environ_buf) => { + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + HEAPU32[(__environ + i * 4) >> 2] = ptr; + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; + }; + + var _environ_sizes_get = (penviron_count, penviron_buf_size) => { + var strings = getEnvStrings(); + HEAPU32[penviron_count >> 2] = strings.length; + var bufSize = 0; + strings.forEach((string) => (bufSize += string.length + 1)); + HEAPU32[penviron_buf_size >> 2] = bufSize; + return 0; + }; + + function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + function _fd_fdstat_get(fd, pbuf) { + try { + var rightsBase = 0; + var rightsInheriting = 0; + var flags = 0; + { + var stream = SYSCALLS.getStreamFromFD(fd); + + var type = stream.tty + ? 2 + : FS.isDir(stream.mode) + ? 3 + : FS.isLink(stream.mode) + ? 7 + : 4; + } + HEAP8[pbuf] = type; + HEAP16[(pbuf + 2) >> 1] = flags; + HEAP64[(pbuf + 8) >> 3] = BigInt(rightsBase); + HEAP64[(pbuf + 16) >> 3] = BigInt(rightsInheriting); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[iov >> 2]; + var len = HEAPU32[(iov + 4) >> 2]; + iov += 8; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + if (typeof offset != 'undefined') { + offset += curr; + } + } + return ret; + }; + + function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[newOffset >> 3] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + function _fd_sync(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (stream.stream_ops?.fsync) { + return stream.stream_ops.fsync(stream); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[iov >> 2]; + var len = HEAPU32[(iov + 4) >> 2]; + iov += 8; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + break; + } + if (typeof offset != 'undefined') { + offset += curr; + } + } + return ret; + }; + + function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + FS.createPreloadedFile = FS_createPreloadedFile; + FS.staticInit(); + + var wasmImports = { + __syscall_chmod: ___syscall_chmod, + + __syscall_faccessat: ___syscall_faccessat, + + __syscall_fchmod: ___syscall_fchmod, + + __syscall_fchown32: ___syscall_fchown32, + + __syscall_fcntl64: ___syscall_fcntl64, + + __syscall_fstat64: ___syscall_fstat64, + + __syscall_ftruncate64: ___syscall_ftruncate64, + + __syscall_getcwd: ___syscall_getcwd, + + __syscall_ioctl: ___syscall_ioctl, + + __syscall_lstat64: ___syscall_lstat64, + + __syscall_mkdirat: ___syscall_mkdirat, + + __syscall_newfstatat: ___syscall_newfstatat, + + __syscall_openat: ___syscall_openat, + + __syscall_readlinkat: ___syscall_readlinkat, + + __syscall_rmdir: ___syscall_rmdir, + + __syscall_stat64: ___syscall_stat64, + + __syscall_unlinkat: ___syscall_unlinkat, + + __syscall_utimensat: ___syscall_utimensat, + + _emscripten_get_now_is_monotonic: __emscripten_get_now_is_monotonic, + + _localtime_js: __localtime_js, + + _mmap_js: __mmap_js, + + _munmap_js: __munmap_js, + + _tzset_js: __tzset_js, + + emscripten_date_now: _emscripten_date_now, + + emscripten_get_now: _emscripten_get_now, + + emscripten_resize_heap: _emscripten_resize_heap, + + environ_get: _environ_get, + + environ_sizes_get: _environ_sizes_get, + + fd_close: _fd_close, + + fd_fdstat_get: _fd_fdstat_get, + + fd_read: _fd_read, + + fd_seek: _fd_seek, + + fd_sync: _fd_sync, + + fd_write: _fd_write, + + memory: wasmMemory, + }; + var wasmExports = createWasm(); + var ___wasm_call_ctors = () => + (___wasm_call_ctors = wasmExports['__wasm_call_ctors'])(); + var _sqlite3_status64 = (Module['_sqlite3_status64'] = (a0, a1, a2, a3) => + (_sqlite3_status64 = Module['_sqlite3_status64'] = + wasmExports['sqlite3_status64'])(a0, a1, a2, a3)); + var _sqlite3_status = (Module['_sqlite3_status'] = (a0, a1, a2, a3) => + (_sqlite3_status = Module['_sqlite3_status'] = + wasmExports['sqlite3_status'])(a0, a1, a2, a3)); + var _sqlite3_db_status = (Module['_sqlite3_db_status'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_db_status = Module['_sqlite3_db_status'] = + wasmExports['sqlite3_db_status'])(a0, a1, a2, a3, a4)); + var _sqlite3_msize = (Module['_sqlite3_msize'] = (a0) => + (_sqlite3_msize = Module['_sqlite3_msize'] = + wasmExports['sqlite3_msize'])(a0)); + var _sqlite3_vfs_find = (Module['_sqlite3_vfs_find'] = (a0) => + (_sqlite3_vfs_find = Module['_sqlite3_vfs_find'] = + wasmExports['sqlite3_vfs_find'])(a0)); + var _sqlite3_initialize = (Module['_sqlite3_initialize'] = () => + (_sqlite3_initialize = Module['_sqlite3_initialize'] = + wasmExports['sqlite3_initialize'])()); + var _sqlite3_malloc = (Module['_sqlite3_malloc'] = (a0) => + (_sqlite3_malloc = Module['_sqlite3_malloc'] = + wasmExports['sqlite3_malloc'])(a0)); + var _sqlite3_free = (Module['_sqlite3_free'] = (a0) => + (_sqlite3_free = Module['_sqlite3_free'] = wasmExports['sqlite3_free'])( + a0, + )); + var _sqlite3_vfs_register = (Module['_sqlite3_vfs_register'] = (a0, a1) => + (_sqlite3_vfs_register = Module['_sqlite3_vfs_register'] = + wasmExports['sqlite3_vfs_register'])(a0, a1)); + var _sqlite3_vfs_unregister = (Module['_sqlite3_vfs_unregister'] = (a0) => + (_sqlite3_vfs_unregister = Module['_sqlite3_vfs_unregister'] = + wasmExports['sqlite3_vfs_unregister'])(a0)); + var _sqlite3_malloc64 = (Module['_sqlite3_malloc64'] = (a0) => + (_sqlite3_malloc64 = Module['_sqlite3_malloc64'] = + wasmExports['sqlite3_malloc64'])(a0)); + var _sqlite3_realloc = (Module['_sqlite3_realloc'] = (a0, a1) => + (_sqlite3_realloc = Module['_sqlite3_realloc'] = + wasmExports['sqlite3_realloc'])(a0, a1)); + var _sqlite3_realloc64 = (Module['_sqlite3_realloc64'] = (a0, a1) => + (_sqlite3_realloc64 = Module['_sqlite3_realloc64'] = + wasmExports['sqlite3_realloc64'])(a0, a1)); + var _sqlite3_value_text = (Module['_sqlite3_value_text'] = (a0) => + (_sqlite3_value_text = Module['_sqlite3_value_text'] = + wasmExports['sqlite3_value_text'])(a0)); + var _sqlite3_randomness = (Module['_sqlite3_randomness'] = (a0, a1) => + (_sqlite3_randomness = Module['_sqlite3_randomness'] = + wasmExports['sqlite3_randomness'])(a0, a1)); + var _sqlite3_stricmp = (Module['_sqlite3_stricmp'] = (a0, a1) => + (_sqlite3_stricmp = Module['_sqlite3_stricmp'] = + wasmExports['sqlite3_stricmp'])(a0, a1)); + var _sqlite3_strnicmp = (Module['_sqlite3_strnicmp'] = (a0, a1, a2) => + (_sqlite3_strnicmp = Module['_sqlite3_strnicmp'] = + wasmExports['sqlite3_strnicmp'])(a0, a1, a2)); + var _sqlite3_uri_parameter = (Module['_sqlite3_uri_parameter'] = (a0, a1) => + (_sqlite3_uri_parameter = Module['_sqlite3_uri_parameter'] = + wasmExports['sqlite3_uri_parameter'])(a0, a1)); + var _sqlite3_uri_boolean = (Module['_sqlite3_uri_boolean'] = (a0, a1, a2) => + (_sqlite3_uri_boolean = Module['_sqlite3_uri_boolean'] = + wasmExports['sqlite3_uri_boolean'])(a0, a1, a2)); + var _sqlite3_serialize = (Module['_sqlite3_serialize'] = (a0, a1, a2, a3) => + (_sqlite3_serialize = Module['_sqlite3_serialize'] = + wasmExports['sqlite3_serialize'])(a0, a1, a2, a3)); + var _sqlite3_prepare_v2 = (Module['_sqlite3_prepare_v2'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_prepare_v2 = Module['_sqlite3_prepare_v2'] = + wasmExports['sqlite3_prepare_v2'])(a0, a1, a2, a3, a4)); + var _sqlite3_step = (Module['_sqlite3_step'] = (a0) => + (_sqlite3_step = Module['_sqlite3_step'] = wasmExports['sqlite3_step'])( + a0, + )); + var _sqlite3_column_int64 = (Module['_sqlite3_column_int64'] = (a0, a1) => + (_sqlite3_column_int64 = Module['_sqlite3_column_int64'] = + wasmExports['sqlite3_column_int64'])(a0, a1)); + var _sqlite3_reset = (Module['_sqlite3_reset'] = (a0) => + (_sqlite3_reset = Module['_sqlite3_reset'] = + wasmExports['sqlite3_reset'])(a0)); + var _sqlite3_exec = (Module['_sqlite3_exec'] = (a0, a1, a2, a3, a4) => + (_sqlite3_exec = Module['_sqlite3_exec'] = wasmExports['sqlite3_exec'])( + a0, + a1, + a2, + a3, + a4, + )); + var _sqlite3_column_int = (Module['_sqlite3_column_int'] = (a0, a1) => + (_sqlite3_column_int = Module['_sqlite3_column_int'] = + wasmExports['sqlite3_column_int'])(a0, a1)); + var _sqlite3_finalize = (Module['_sqlite3_finalize'] = (a0) => + (_sqlite3_finalize = Module['_sqlite3_finalize'] = + wasmExports['sqlite3_finalize'])(a0)); + var _sqlite3_file_control = (Module['_sqlite3_file_control'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_file_control = Module['_sqlite3_file_control'] = + wasmExports['sqlite3_file_control'])(a0, a1, a2, a3)); + var _sqlite3_column_name = (Module['_sqlite3_column_name'] = (a0, a1) => + (_sqlite3_column_name = Module['_sqlite3_column_name'] = + wasmExports['sqlite3_column_name'])(a0, a1)); + var _sqlite3_column_text = (Module['_sqlite3_column_text'] = (a0, a1) => + (_sqlite3_column_text = Module['_sqlite3_column_text'] = + wasmExports['sqlite3_column_text'])(a0, a1)); + var _sqlite3_column_type = (Module['_sqlite3_column_type'] = (a0, a1) => + (_sqlite3_column_type = Module['_sqlite3_column_type'] = + wasmExports['sqlite3_column_type'])(a0, a1)); + var _sqlite3_errmsg = (Module['_sqlite3_errmsg'] = (a0) => + (_sqlite3_errmsg = Module['_sqlite3_errmsg'] = + wasmExports['sqlite3_errmsg'])(a0)); + var _sqlite3_deserialize = (Module['_sqlite3_deserialize'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3_deserialize = Module['_sqlite3_deserialize'] = + wasmExports['sqlite3_deserialize'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3_clear_bindings = (Module['_sqlite3_clear_bindings'] = (a0) => + (_sqlite3_clear_bindings = Module['_sqlite3_clear_bindings'] = + wasmExports['sqlite3_clear_bindings'])(a0)); + var _sqlite3_value_blob = (Module['_sqlite3_value_blob'] = (a0) => + (_sqlite3_value_blob = Module['_sqlite3_value_blob'] = + wasmExports['sqlite3_value_blob'])(a0)); + var _sqlite3_value_bytes = (Module['_sqlite3_value_bytes'] = (a0) => + (_sqlite3_value_bytes = Module['_sqlite3_value_bytes'] = + wasmExports['sqlite3_value_bytes'])(a0)); + var _sqlite3_value_double = (Module['_sqlite3_value_double'] = (a0) => + (_sqlite3_value_double = Module['_sqlite3_value_double'] = + wasmExports['sqlite3_value_double'])(a0)); + var _sqlite3_value_int = (Module['_sqlite3_value_int'] = (a0) => + (_sqlite3_value_int = Module['_sqlite3_value_int'] = + wasmExports['sqlite3_value_int'])(a0)); + var _sqlite3_value_int64 = (Module['_sqlite3_value_int64'] = (a0) => + (_sqlite3_value_int64 = Module['_sqlite3_value_int64'] = + wasmExports['sqlite3_value_int64'])(a0)); + var _sqlite3_value_subtype = (Module['_sqlite3_value_subtype'] = (a0) => + (_sqlite3_value_subtype = Module['_sqlite3_value_subtype'] = + wasmExports['sqlite3_value_subtype'])(a0)); + var _sqlite3_value_pointer = (Module['_sqlite3_value_pointer'] = (a0, a1) => + (_sqlite3_value_pointer = Module['_sqlite3_value_pointer'] = + wasmExports['sqlite3_value_pointer'])(a0, a1)); + var _sqlite3_value_type = (Module['_sqlite3_value_type'] = (a0) => + (_sqlite3_value_type = Module['_sqlite3_value_type'] = + wasmExports['sqlite3_value_type'])(a0)); + var _sqlite3_value_nochange = (Module['_sqlite3_value_nochange'] = (a0) => + (_sqlite3_value_nochange = Module['_sqlite3_value_nochange'] = + wasmExports['sqlite3_value_nochange'])(a0)); + var _sqlite3_value_frombind = (Module['_sqlite3_value_frombind'] = (a0) => + (_sqlite3_value_frombind = Module['_sqlite3_value_frombind'] = + wasmExports['sqlite3_value_frombind'])(a0)); + var _sqlite3_value_dup = (Module['_sqlite3_value_dup'] = (a0) => + (_sqlite3_value_dup = Module['_sqlite3_value_dup'] = + wasmExports['sqlite3_value_dup'])(a0)); + var _sqlite3_value_free = (Module['_sqlite3_value_free'] = (a0) => + (_sqlite3_value_free = Module['_sqlite3_value_free'] = + wasmExports['sqlite3_value_free'])(a0)); + var _sqlite3_result_blob = (Module['_sqlite3_result_blob'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_result_blob = Module['_sqlite3_result_blob'] = + wasmExports['sqlite3_result_blob'])(a0, a1, a2, a3)); + var _sqlite3_result_error_toobig = (Module['_sqlite3_result_error_toobig'] = + (a0) => + (_sqlite3_result_error_toobig = Module['_sqlite3_result_error_toobig'] = + wasmExports['sqlite3_result_error_toobig'])(a0)); + var _sqlite3_result_error_nomem = (Module['_sqlite3_result_error_nomem'] = ( + a0, + ) => + (_sqlite3_result_error_nomem = Module['_sqlite3_result_error_nomem'] = + wasmExports['sqlite3_result_error_nomem'])(a0)); + var _sqlite3_result_double = (Module['_sqlite3_result_double'] = (a0, a1) => + (_sqlite3_result_double = Module['_sqlite3_result_double'] = + wasmExports['sqlite3_result_double'])(a0, a1)); + var _sqlite3_result_error = (Module['_sqlite3_result_error'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_result_error = Module['_sqlite3_result_error'] = + wasmExports['sqlite3_result_error'])(a0, a1, a2)); + var _sqlite3_result_int = (Module['_sqlite3_result_int'] = (a0, a1) => + (_sqlite3_result_int = Module['_sqlite3_result_int'] = + wasmExports['sqlite3_result_int'])(a0, a1)); + var _sqlite3_result_int64 = (Module['_sqlite3_result_int64'] = (a0, a1) => + (_sqlite3_result_int64 = Module['_sqlite3_result_int64'] = + wasmExports['sqlite3_result_int64'])(a0, a1)); + var _sqlite3_result_null = (Module['_sqlite3_result_null'] = (a0) => + (_sqlite3_result_null = Module['_sqlite3_result_null'] = + wasmExports['sqlite3_result_null'])(a0)); + var _sqlite3_result_pointer = (Module['_sqlite3_result_pointer'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_result_pointer = Module['_sqlite3_result_pointer'] = + wasmExports['sqlite3_result_pointer'])(a0, a1, a2, a3)); + var _sqlite3_result_subtype = (Module['_sqlite3_result_subtype'] = ( + a0, + a1, + ) => + (_sqlite3_result_subtype = Module['_sqlite3_result_subtype'] = + wasmExports['sqlite3_result_subtype'])(a0, a1)); + var _sqlite3_result_text = (Module['_sqlite3_result_text'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_result_text = Module['_sqlite3_result_text'] = + wasmExports['sqlite3_result_text'])(a0, a1, a2, a3)); + var _sqlite3_result_zeroblob = (Module['_sqlite3_result_zeroblob'] = ( + a0, + a1, + ) => + (_sqlite3_result_zeroblob = Module['_sqlite3_result_zeroblob'] = + wasmExports['sqlite3_result_zeroblob'])(a0, a1)); + var _sqlite3_result_zeroblob64 = (Module['_sqlite3_result_zeroblob64'] = ( + a0, + a1, + ) => + (_sqlite3_result_zeroblob64 = Module['_sqlite3_result_zeroblob64'] = + wasmExports['sqlite3_result_zeroblob64'])(a0, a1)); + var _sqlite3_result_error_code = (Module['_sqlite3_result_error_code'] = ( + a0, + a1, + ) => + (_sqlite3_result_error_code = Module['_sqlite3_result_error_code'] = + wasmExports['sqlite3_result_error_code'])(a0, a1)); + var _sqlite3_user_data = (Module['_sqlite3_user_data'] = (a0) => + (_sqlite3_user_data = Module['_sqlite3_user_data'] = + wasmExports['sqlite3_user_data'])(a0)); + var _sqlite3_context_db_handle = (Module['_sqlite3_context_db_handle'] = ( + a0, + ) => + (_sqlite3_context_db_handle = Module['_sqlite3_context_db_handle'] = + wasmExports['sqlite3_context_db_handle'])(a0)); + var _sqlite3_vtab_nochange = (Module['_sqlite3_vtab_nochange'] = (a0) => + (_sqlite3_vtab_nochange = Module['_sqlite3_vtab_nochange'] = + wasmExports['sqlite3_vtab_nochange'])(a0)); + var _sqlite3_vtab_in_first = (Module['_sqlite3_vtab_in_first'] = (a0, a1) => + (_sqlite3_vtab_in_first = Module['_sqlite3_vtab_in_first'] = + wasmExports['sqlite3_vtab_in_first'])(a0, a1)); + var _sqlite3_vtab_in_next = (Module['_sqlite3_vtab_in_next'] = (a0, a1) => + (_sqlite3_vtab_in_next = Module['_sqlite3_vtab_in_next'] = + wasmExports['sqlite3_vtab_in_next'])(a0, a1)); + var _sqlite3_aggregate_context = (Module['_sqlite3_aggregate_context'] = ( + a0, + a1, + ) => + (_sqlite3_aggregate_context = Module['_sqlite3_aggregate_context'] = + wasmExports['sqlite3_aggregate_context'])(a0, a1)); + var _sqlite3_get_auxdata = (Module['_sqlite3_get_auxdata'] = (a0, a1) => + (_sqlite3_get_auxdata = Module['_sqlite3_get_auxdata'] = + wasmExports['sqlite3_get_auxdata'])(a0, a1)); + var _sqlite3_set_auxdata = (Module['_sqlite3_set_auxdata'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_set_auxdata = Module['_sqlite3_set_auxdata'] = + wasmExports['sqlite3_set_auxdata'])(a0, a1, a2, a3)); + var _sqlite3_column_count = (Module['_sqlite3_column_count'] = (a0) => + (_sqlite3_column_count = Module['_sqlite3_column_count'] = + wasmExports['sqlite3_column_count'])(a0)); + var _sqlite3_data_count = (Module['_sqlite3_data_count'] = (a0) => + (_sqlite3_data_count = Module['_sqlite3_data_count'] = + wasmExports['sqlite3_data_count'])(a0)); + var _sqlite3_column_blob = (Module['_sqlite3_column_blob'] = (a0, a1) => + (_sqlite3_column_blob = Module['_sqlite3_column_blob'] = + wasmExports['sqlite3_column_blob'])(a0, a1)); + var _sqlite3_column_bytes = (Module['_sqlite3_column_bytes'] = (a0, a1) => + (_sqlite3_column_bytes = Module['_sqlite3_column_bytes'] = + wasmExports['sqlite3_column_bytes'])(a0, a1)); + var _sqlite3_column_double = (Module['_sqlite3_column_double'] = (a0, a1) => + (_sqlite3_column_double = Module['_sqlite3_column_double'] = + wasmExports['sqlite3_column_double'])(a0, a1)); + var _sqlite3_column_value = (Module['_sqlite3_column_value'] = (a0, a1) => + (_sqlite3_column_value = Module['_sqlite3_column_value'] = + wasmExports['sqlite3_column_value'])(a0, a1)); + var _sqlite3_column_decltype = (Module['_sqlite3_column_decltype'] = ( + a0, + a1, + ) => + (_sqlite3_column_decltype = Module['_sqlite3_column_decltype'] = + wasmExports['sqlite3_column_decltype'])(a0, a1)); + var _sqlite3_bind_blob = (Module['_sqlite3_bind_blob'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_bind_blob = Module['_sqlite3_bind_blob'] = + wasmExports['sqlite3_bind_blob'])(a0, a1, a2, a3, a4)); + var _sqlite3_bind_double = (Module['_sqlite3_bind_double'] = (a0, a1, a2) => + (_sqlite3_bind_double = Module['_sqlite3_bind_double'] = + wasmExports['sqlite3_bind_double'])(a0, a1, a2)); + var _sqlite3_bind_int = (Module['_sqlite3_bind_int'] = (a0, a1, a2) => + (_sqlite3_bind_int = Module['_sqlite3_bind_int'] = + wasmExports['sqlite3_bind_int'])(a0, a1, a2)); + var _sqlite3_bind_int64 = (Module['_sqlite3_bind_int64'] = (a0, a1, a2) => + (_sqlite3_bind_int64 = Module['_sqlite3_bind_int64'] = + wasmExports['sqlite3_bind_int64'])(a0, a1, a2)); + var _sqlite3_bind_null = (Module['_sqlite3_bind_null'] = (a0, a1) => + (_sqlite3_bind_null = Module['_sqlite3_bind_null'] = + wasmExports['sqlite3_bind_null'])(a0, a1)); + var _sqlite3_bind_pointer = (Module['_sqlite3_bind_pointer'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_bind_pointer = Module['_sqlite3_bind_pointer'] = + wasmExports['sqlite3_bind_pointer'])(a0, a1, a2, a3, a4)); + var _sqlite3_bind_text = (Module['_sqlite3_bind_text'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_bind_text = Module['_sqlite3_bind_text'] = + wasmExports['sqlite3_bind_text'])(a0, a1, a2, a3, a4)); + var _sqlite3_bind_parameter_count = (Module[ + '_sqlite3_bind_parameter_count' + ] = (a0) => + (_sqlite3_bind_parameter_count = Module['_sqlite3_bind_parameter_count'] = + wasmExports['sqlite3_bind_parameter_count'])(a0)); + var _sqlite3_bind_parameter_name = (Module['_sqlite3_bind_parameter_name'] = + (a0, a1) => + (_sqlite3_bind_parameter_name = Module['_sqlite3_bind_parameter_name'] = + wasmExports['sqlite3_bind_parameter_name'])(a0, a1)); + var _sqlite3_bind_parameter_index = (Module[ + '_sqlite3_bind_parameter_index' + ] = (a0, a1) => + (_sqlite3_bind_parameter_index = Module['_sqlite3_bind_parameter_index'] = + wasmExports['sqlite3_bind_parameter_index'])(a0, a1)); + var _sqlite3_db_handle = (Module['_sqlite3_db_handle'] = (a0) => + (_sqlite3_db_handle = Module['_sqlite3_db_handle'] = + wasmExports['sqlite3_db_handle'])(a0)); + var _sqlite3_stmt_readonly = (Module['_sqlite3_stmt_readonly'] = (a0) => + (_sqlite3_stmt_readonly = Module['_sqlite3_stmt_readonly'] = + wasmExports['sqlite3_stmt_readonly'])(a0)); + var _sqlite3_stmt_isexplain = (Module['_sqlite3_stmt_isexplain'] = (a0) => + (_sqlite3_stmt_isexplain = Module['_sqlite3_stmt_isexplain'] = + wasmExports['sqlite3_stmt_isexplain'])(a0)); + var _sqlite3_stmt_explain = (Module['_sqlite3_stmt_explain'] = (a0, a1) => + (_sqlite3_stmt_explain = Module['_sqlite3_stmt_explain'] = + wasmExports['sqlite3_stmt_explain'])(a0, a1)); + var _sqlite3_stmt_busy = (Module['_sqlite3_stmt_busy'] = (a0) => + (_sqlite3_stmt_busy = Module['_sqlite3_stmt_busy'] = + wasmExports['sqlite3_stmt_busy'])(a0)); + var _sqlite3_stmt_status = (Module['_sqlite3_stmt_status'] = (a0, a1, a2) => + (_sqlite3_stmt_status = Module['_sqlite3_stmt_status'] = + wasmExports['sqlite3_stmt_status'])(a0, a1, a2)); + var _sqlite3_sql = (Module['_sqlite3_sql'] = (a0) => + (_sqlite3_sql = Module['_sqlite3_sql'] = wasmExports['sqlite3_sql'])(a0)); + var _sqlite3_expanded_sql = (Module['_sqlite3_expanded_sql'] = (a0) => + (_sqlite3_expanded_sql = Module['_sqlite3_expanded_sql'] = + wasmExports['sqlite3_expanded_sql'])(a0)); + var _sqlite3_preupdate_old = (Module['_sqlite3_preupdate_old'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_preupdate_old = Module['_sqlite3_preupdate_old'] = + wasmExports['sqlite3_preupdate_old'])(a0, a1, a2)); + var _sqlite3_preupdate_count = (Module['_sqlite3_preupdate_count'] = (a0) => + (_sqlite3_preupdate_count = Module['_sqlite3_preupdate_count'] = + wasmExports['sqlite3_preupdate_count'])(a0)); + var _sqlite3_preupdate_depth = (Module['_sqlite3_preupdate_depth'] = (a0) => + (_sqlite3_preupdate_depth = Module['_sqlite3_preupdate_depth'] = + wasmExports['sqlite3_preupdate_depth'])(a0)); + var _sqlite3_preupdate_blobwrite = (Module['_sqlite3_preupdate_blobwrite'] = + (a0) => + (_sqlite3_preupdate_blobwrite = Module['_sqlite3_preupdate_blobwrite'] = + wasmExports['sqlite3_preupdate_blobwrite'])(a0)); + var _sqlite3_preupdate_new = (Module['_sqlite3_preupdate_new'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_preupdate_new = Module['_sqlite3_preupdate_new'] = + wasmExports['sqlite3_preupdate_new'])(a0, a1, a2)); + var _sqlite3_value_numeric_type = (Module['_sqlite3_value_numeric_type'] = ( + a0, + ) => + (_sqlite3_value_numeric_type = Module['_sqlite3_value_numeric_type'] = + wasmExports['sqlite3_value_numeric_type'])(a0)); + var _sqlite3_set_authorizer = (Module['_sqlite3_set_authorizer'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_set_authorizer = Module['_sqlite3_set_authorizer'] = + wasmExports['sqlite3_set_authorizer'])(a0, a1, a2)); + var _sqlite3_strglob = (Module['_sqlite3_strglob'] = (a0, a1) => + (_sqlite3_strglob = Module['_sqlite3_strglob'] = + wasmExports['sqlite3_strglob'])(a0, a1)); + var _sqlite3_strlike = (Module['_sqlite3_strlike'] = (a0, a1, a2) => + (_sqlite3_strlike = Module['_sqlite3_strlike'] = + wasmExports['sqlite3_strlike'])(a0, a1, a2)); + var _sqlite3_auto_extension = (Module['_sqlite3_auto_extension'] = (a0) => + (_sqlite3_auto_extension = Module['_sqlite3_auto_extension'] = + wasmExports['sqlite3_auto_extension'])(a0)); + var _sqlite3_cancel_auto_extension = (Module[ + '_sqlite3_cancel_auto_extension' + ] = (a0) => + (_sqlite3_cancel_auto_extension = Module[ + '_sqlite3_cancel_auto_extension' + ] = + wasmExports['sqlite3_cancel_auto_extension'])(a0)); + var _sqlite3_reset_auto_extension = (Module[ + '_sqlite3_reset_auto_extension' + ] = () => + (_sqlite3_reset_auto_extension = Module['_sqlite3_reset_auto_extension'] = + wasmExports['sqlite3_reset_auto_extension'])()); + var _sqlite3_prepare_v3 = (Module['_sqlite3_prepare_v3'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3_prepare_v3 = Module['_sqlite3_prepare_v3'] = + wasmExports['sqlite3_prepare_v3'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3_create_module = (Module['_sqlite3_create_module'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_create_module = Module['_sqlite3_create_module'] = + wasmExports['sqlite3_create_module'])(a0, a1, a2, a3)); + var _sqlite3_create_module_v2 = (Module['_sqlite3_create_module_v2'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_create_module_v2 = Module['_sqlite3_create_module_v2'] = + wasmExports['sqlite3_create_module_v2'])(a0, a1, a2, a3, a4)); + var _sqlite3_drop_modules = (Module['_sqlite3_drop_modules'] = (a0, a1) => + (_sqlite3_drop_modules = Module['_sqlite3_drop_modules'] = + wasmExports['sqlite3_drop_modules'])(a0, a1)); + var _sqlite3_declare_vtab = (Module['_sqlite3_declare_vtab'] = (a0, a1) => + (_sqlite3_declare_vtab = Module['_sqlite3_declare_vtab'] = + wasmExports['sqlite3_declare_vtab'])(a0, a1)); + var _sqlite3_vtab_on_conflict = (Module['_sqlite3_vtab_on_conflict'] = ( + a0, + ) => + (_sqlite3_vtab_on_conflict = Module['_sqlite3_vtab_on_conflict'] = + wasmExports['sqlite3_vtab_on_conflict'])(a0)); + var _sqlite3_vtab_collation = (Module['_sqlite3_vtab_collation'] = ( + a0, + a1, + ) => + (_sqlite3_vtab_collation = Module['_sqlite3_vtab_collation'] = + wasmExports['sqlite3_vtab_collation'])(a0, a1)); + var _sqlite3_vtab_in = (Module['_sqlite3_vtab_in'] = (a0, a1, a2) => + (_sqlite3_vtab_in = Module['_sqlite3_vtab_in'] = + wasmExports['sqlite3_vtab_in'])(a0, a1, a2)); + var _sqlite3_vtab_rhs_value = (Module['_sqlite3_vtab_rhs_value'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_vtab_rhs_value = Module['_sqlite3_vtab_rhs_value'] = + wasmExports['sqlite3_vtab_rhs_value'])(a0, a1, a2)); + var _sqlite3_vtab_distinct = (Module['_sqlite3_vtab_distinct'] = (a0) => + (_sqlite3_vtab_distinct = Module['_sqlite3_vtab_distinct'] = + wasmExports['sqlite3_vtab_distinct'])(a0)); + var _sqlite3_keyword_name = (Module['_sqlite3_keyword_name'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_keyword_name = Module['_sqlite3_keyword_name'] = + wasmExports['sqlite3_keyword_name'])(a0, a1, a2)); + var _sqlite3_keyword_count = (Module['_sqlite3_keyword_count'] = () => + (_sqlite3_keyword_count = Module['_sqlite3_keyword_count'] = + wasmExports['sqlite3_keyword_count'])()); + var _sqlite3_keyword_check = (Module['_sqlite3_keyword_check'] = (a0, a1) => + (_sqlite3_keyword_check = Module['_sqlite3_keyword_check'] = + wasmExports['sqlite3_keyword_check'])(a0, a1)); + var _sqlite3_complete = (Module['_sqlite3_complete'] = (a0) => + (_sqlite3_complete = Module['_sqlite3_complete'] = + wasmExports['sqlite3_complete'])(a0)); + var _sqlite3_libversion = (Module['_sqlite3_libversion'] = () => + (_sqlite3_libversion = Module['_sqlite3_libversion'] = + wasmExports['sqlite3_libversion'])()); + var _sqlite3_libversion_number = (Module['_sqlite3_libversion_number'] = + () => + (_sqlite3_libversion_number = Module['_sqlite3_libversion_number'] = + wasmExports['sqlite3_libversion_number'])()); + var _sqlite3_shutdown = (Module['_sqlite3_shutdown'] = () => + (_sqlite3_shutdown = Module['_sqlite3_shutdown'] = + wasmExports['sqlite3_shutdown'])()); + var _sqlite3_last_insert_rowid = (Module['_sqlite3_last_insert_rowid'] = ( + a0, + ) => + (_sqlite3_last_insert_rowid = Module['_sqlite3_last_insert_rowid'] = + wasmExports['sqlite3_last_insert_rowid'])(a0)); + var _sqlite3_set_last_insert_rowid = (Module[ + '_sqlite3_set_last_insert_rowid' + ] = (a0, a1) => + (_sqlite3_set_last_insert_rowid = Module[ + '_sqlite3_set_last_insert_rowid' + ] = + wasmExports['sqlite3_set_last_insert_rowid'])(a0, a1)); + var _sqlite3_changes64 = (Module['_sqlite3_changes64'] = (a0) => + (_sqlite3_changes64 = Module['_sqlite3_changes64'] = + wasmExports['sqlite3_changes64'])(a0)); + var _sqlite3_changes = (Module['_sqlite3_changes'] = (a0) => + (_sqlite3_changes = Module['_sqlite3_changes'] = + wasmExports['sqlite3_changes'])(a0)); + var _sqlite3_total_changes64 = (Module['_sqlite3_total_changes64'] = (a0) => + (_sqlite3_total_changes64 = Module['_sqlite3_total_changes64'] = + wasmExports['sqlite3_total_changes64'])(a0)); + var _sqlite3_total_changes = (Module['_sqlite3_total_changes'] = (a0) => + (_sqlite3_total_changes = Module['_sqlite3_total_changes'] = + wasmExports['sqlite3_total_changes'])(a0)); + var _sqlite3_txn_state = (Module['_sqlite3_txn_state'] = (a0, a1) => + (_sqlite3_txn_state = Module['_sqlite3_txn_state'] = + wasmExports['sqlite3_txn_state'])(a0, a1)); + var _sqlite3_close_v2 = (Module['_sqlite3_close_v2'] = (a0) => + (_sqlite3_close_v2 = Module['_sqlite3_close_v2'] = + wasmExports['sqlite3_close_v2'])(a0)); + var _sqlite3_busy_handler = (Module['_sqlite3_busy_handler'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_busy_handler = Module['_sqlite3_busy_handler'] = + wasmExports['sqlite3_busy_handler'])(a0, a1, a2)); + var _sqlite3_progress_handler = (Module['_sqlite3_progress_handler'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_progress_handler = Module['_sqlite3_progress_handler'] = + wasmExports['sqlite3_progress_handler'])(a0, a1, a2, a3)); + var _sqlite3_busy_timeout = (Module['_sqlite3_busy_timeout'] = (a0, a1) => + (_sqlite3_busy_timeout = Module['_sqlite3_busy_timeout'] = + wasmExports['sqlite3_busy_timeout'])(a0, a1)); + var _sqlite3_interrupt = (Module['_sqlite3_interrupt'] = (a0) => + (_sqlite3_interrupt = Module['_sqlite3_interrupt'] = + wasmExports['sqlite3_interrupt'])(a0)); + var _sqlite3_is_interrupted = (Module['_sqlite3_is_interrupted'] = (a0) => + (_sqlite3_is_interrupted = Module['_sqlite3_is_interrupted'] = + wasmExports['sqlite3_is_interrupted'])(a0)); + var _sqlite3_create_function = (Module['_sqlite3_create_function'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (_sqlite3_create_function = Module['_sqlite3_create_function'] = + wasmExports['sqlite3_create_function'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var _sqlite3_create_function_v2 = (Module['_sqlite3_create_function_v2'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (_sqlite3_create_function_v2 = Module['_sqlite3_create_function_v2'] = + wasmExports['sqlite3_create_function_v2'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3_create_window_function = (Module[ + '_sqlite3_create_window_function' + ] = (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) => + (_sqlite3_create_window_function = Module[ + '_sqlite3_create_window_function' + ] = + wasmExports['sqlite3_create_window_function'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var _sqlite3_overload_function = (Module['_sqlite3_overload_function'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_overload_function = Module['_sqlite3_overload_function'] = + wasmExports['sqlite3_overload_function'])(a0, a1, a2)); + var _sqlite3_trace_v2 = (Module['_sqlite3_trace_v2'] = (a0, a1, a2, a3) => + (_sqlite3_trace_v2 = Module['_sqlite3_trace_v2'] = + wasmExports['sqlite3_trace_v2'])(a0, a1, a2, a3)); + var _sqlite3_commit_hook = (Module['_sqlite3_commit_hook'] = (a0, a1, a2) => + (_sqlite3_commit_hook = Module['_sqlite3_commit_hook'] = + wasmExports['sqlite3_commit_hook'])(a0, a1, a2)); + var _sqlite3_update_hook = (Module['_sqlite3_update_hook'] = (a0, a1, a2) => + (_sqlite3_update_hook = Module['_sqlite3_update_hook'] = + wasmExports['sqlite3_update_hook'])(a0, a1, a2)); + var _sqlite3_rollback_hook = (Module['_sqlite3_rollback_hook'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_rollback_hook = Module['_sqlite3_rollback_hook'] = + wasmExports['sqlite3_rollback_hook'])(a0, a1, a2)); + var _sqlite3_preupdate_hook = (Module['_sqlite3_preupdate_hook'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_preupdate_hook = Module['_sqlite3_preupdate_hook'] = + wasmExports['sqlite3_preupdate_hook'])(a0, a1, a2)); + var _sqlite3_error_offset = (Module['_sqlite3_error_offset'] = (a0) => + (_sqlite3_error_offset = Module['_sqlite3_error_offset'] = + wasmExports['sqlite3_error_offset'])(a0)); + var _sqlite3_errcode = (Module['_sqlite3_errcode'] = (a0) => + (_sqlite3_errcode = Module['_sqlite3_errcode'] = + wasmExports['sqlite3_errcode'])(a0)); + var _sqlite3_extended_errcode = (Module['_sqlite3_extended_errcode'] = ( + a0, + ) => + (_sqlite3_extended_errcode = Module['_sqlite3_extended_errcode'] = + wasmExports['sqlite3_extended_errcode'])(a0)); + var _sqlite3_errstr = (Module['_sqlite3_errstr'] = (a0) => + (_sqlite3_errstr = Module['_sqlite3_errstr'] = + wasmExports['sqlite3_errstr'])(a0)); + var _sqlite3_limit = (Module['_sqlite3_limit'] = (a0, a1, a2) => + (_sqlite3_limit = Module['_sqlite3_limit'] = + wasmExports['sqlite3_limit'])(a0, a1, a2)); + var _sqlite3_open = (Module['_sqlite3_open'] = (a0, a1) => + (_sqlite3_open = Module['_sqlite3_open'] = wasmExports['sqlite3_open'])( + a0, + a1, + )); + var _sqlite3_open_v2 = (Module['_sqlite3_open_v2'] = (a0, a1, a2, a3) => + (_sqlite3_open_v2 = Module['_sqlite3_open_v2'] = + wasmExports['sqlite3_open_v2'])(a0, a1, a2, a3)); + var _sqlite3_create_collation = (Module['_sqlite3_create_collation'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_create_collation = Module['_sqlite3_create_collation'] = + wasmExports['sqlite3_create_collation'])(a0, a1, a2, a3, a4)); + var _sqlite3_create_collation_v2 = (Module['_sqlite3_create_collation_v2'] = + (a0, a1, a2, a3, a4, a5) => + (_sqlite3_create_collation_v2 = Module['_sqlite3_create_collation_v2'] = + wasmExports['sqlite3_create_collation_v2'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3_collation_needed = (Module['_sqlite3_collation_needed'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_collation_needed = Module['_sqlite3_collation_needed'] = + wasmExports['sqlite3_collation_needed'])(a0, a1, a2)); + var _sqlite3_get_autocommit = (Module['_sqlite3_get_autocommit'] = (a0) => + (_sqlite3_get_autocommit = Module['_sqlite3_get_autocommit'] = + wasmExports['sqlite3_get_autocommit'])(a0)); + var _sqlite3_table_column_metadata = (Module[ + '_sqlite3_table_column_metadata' + ] = (a0, a1, a2, a3, a4, a5, a6, a7, a8) => + (_sqlite3_table_column_metadata = Module[ + '_sqlite3_table_column_metadata' + ] = + wasmExports['sqlite3_table_column_metadata'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3_extended_result_codes = (Module[ + '_sqlite3_extended_result_codes' + ] = (a0, a1) => + (_sqlite3_extended_result_codes = Module[ + '_sqlite3_extended_result_codes' + ] = + wasmExports['sqlite3_extended_result_codes'])(a0, a1)); + var _sqlite3_uri_key = (Module['_sqlite3_uri_key'] = (a0, a1) => + (_sqlite3_uri_key = Module['_sqlite3_uri_key'] = + wasmExports['sqlite3_uri_key'])(a0, a1)); + var _sqlite3_uri_int64 = (Module['_sqlite3_uri_int64'] = (a0, a1, a2) => + (_sqlite3_uri_int64 = Module['_sqlite3_uri_int64'] = + wasmExports['sqlite3_uri_int64'])(a0, a1, a2)); + var _sqlite3_db_name = (Module['_sqlite3_db_name'] = (a0, a1) => + (_sqlite3_db_name = Module['_sqlite3_db_name'] = + wasmExports['sqlite3_db_name'])(a0, a1)); + var _sqlite3_db_filename = (Module['_sqlite3_db_filename'] = (a0, a1) => + (_sqlite3_db_filename = Module['_sqlite3_db_filename'] = + wasmExports['sqlite3_db_filename'])(a0, a1)); + var _sqlite3_db_readonly = (Module['_sqlite3_db_readonly'] = (a0, a1) => + (_sqlite3_db_readonly = Module['_sqlite3_db_readonly'] = + wasmExports['sqlite3_db_readonly'])(a0, a1)); + var _sqlite3_compileoption_used = (Module['_sqlite3_compileoption_used'] = ( + a0, + ) => + (_sqlite3_compileoption_used = Module['_sqlite3_compileoption_used'] = + wasmExports['sqlite3_compileoption_used'])(a0)); + var _sqlite3_compileoption_get = (Module['_sqlite3_compileoption_get'] = ( + a0, + ) => + (_sqlite3_compileoption_get = Module['_sqlite3_compileoption_get'] = + wasmExports['sqlite3_compileoption_get'])(a0)); + var _sqlite3session_diff = (Module['_sqlite3session_diff'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3session_diff = Module['_sqlite3session_diff'] = + wasmExports['sqlite3session_diff'])(a0, a1, a2, a3)); + var _sqlite3session_attach = (Module['_sqlite3session_attach'] = (a0, a1) => + (_sqlite3session_attach = Module['_sqlite3session_attach'] = + wasmExports['sqlite3session_attach'])(a0, a1)); + var _sqlite3session_create = (Module['_sqlite3session_create'] = ( + a0, + a1, + a2, + ) => + (_sqlite3session_create = Module['_sqlite3session_create'] = + wasmExports['sqlite3session_create'])(a0, a1, a2)); + var _sqlite3session_delete = (Module['_sqlite3session_delete'] = (a0) => + (_sqlite3session_delete = Module['_sqlite3session_delete'] = + wasmExports['sqlite3session_delete'])(a0)); + var _sqlite3session_table_filter = (Module['_sqlite3session_table_filter'] = + (a0, a1, a2) => + (_sqlite3session_table_filter = Module['_sqlite3session_table_filter'] = + wasmExports['sqlite3session_table_filter'])(a0, a1, a2)); + var _sqlite3session_changeset = (Module['_sqlite3session_changeset'] = ( + a0, + a1, + a2, + ) => + (_sqlite3session_changeset = Module['_sqlite3session_changeset'] = + wasmExports['sqlite3session_changeset'])(a0, a1, a2)); + var _sqlite3session_changeset_strm = (Module[ + '_sqlite3session_changeset_strm' + ] = (a0, a1, a2) => + (_sqlite3session_changeset_strm = Module[ + '_sqlite3session_changeset_strm' + ] = + wasmExports['sqlite3session_changeset_strm'])(a0, a1, a2)); + var _sqlite3session_patchset_strm = (Module[ + '_sqlite3session_patchset_strm' + ] = (a0, a1, a2) => + (_sqlite3session_patchset_strm = Module['_sqlite3session_patchset_strm'] = + wasmExports['sqlite3session_patchset_strm'])(a0, a1, a2)); + var _sqlite3session_patchset = (Module['_sqlite3session_patchset'] = ( + a0, + a1, + a2, + ) => + (_sqlite3session_patchset = Module['_sqlite3session_patchset'] = + wasmExports['sqlite3session_patchset'])(a0, a1, a2)); + var _sqlite3session_enable = (Module['_sqlite3session_enable'] = (a0, a1) => + (_sqlite3session_enable = Module['_sqlite3session_enable'] = + wasmExports['sqlite3session_enable'])(a0, a1)); + var _sqlite3session_indirect = (Module['_sqlite3session_indirect'] = ( + a0, + a1, + ) => + (_sqlite3session_indirect = Module['_sqlite3session_indirect'] = + wasmExports['sqlite3session_indirect'])(a0, a1)); + var _sqlite3session_isempty = (Module['_sqlite3session_isempty'] = (a0) => + (_sqlite3session_isempty = Module['_sqlite3session_isempty'] = + wasmExports['sqlite3session_isempty'])(a0)); + var _sqlite3session_memory_used = (Module['_sqlite3session_memory_used'] = ( + a0, + ) => + (_sqlite3session_memory_used = Module['_sqlite3session_memory_used'] = + wasmExports['sqlite3session_memory_used'])(a0)); + var _sqlite3session_object_config = (Module[ + '_sqlite3session_object_config' + ] = (a0, a1, a2) => + (_sqlite3session_object_config = Module['_sqlite3session_object_config'] = + wasmExports['sqlite3session_object_config'])(a0, a1, a2)); + var _sqlite3session_changeset_size = (Module[ + '_sqlite3session_changeset_size' + ] = (a0) => + (_sqlite3session_changeset_size = Module[ + '_sqlite3session_changeset_size' + ] = + wasmExports['sqlite3session_changeset_size'])(a0)); + var _sqlite3changeset_start = (Module['_sqlite3changeset_start'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_start = Module['_sqlite3changeset_start'] = + wasmExports['sqlite3changeset_start'])(a0, a1, a2)); + var _sqlite3changeset_start_v2 = (Module['_sqlite3changeset_start_v2'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3changeset_start_v2 = Module['_sqlite3changeset_start_v2'] = + wasmExports['sqlite3changeset_start_v2'])(a0, a1, a2, a3)); + var _sqlite3changeset_start_strm = (Module['_sqlite3changeset_start_strm'] = + (a0, a1, a2) => + (_sqlite3changeset_start_strm = Module['_sqlite3changeset_start_strm'] = + wasmExports['sqlite3changeset_start_strm'])(a0, a1, a2)); + var _sqlite3changeset_start_v2_strm = (Module[ + '_sqlite3changeset_start_v2_strm' + ] = (a0, a1, a2, a3) => + (_sqlite3changeset_start_v2_strm = Module[ + '_sqlite3changeset_start_v2_strm' + ] = + wasmExports['sqlite3changeset_start_v2_strm'])(a0, a1, a2, a3)); + var _sqlite3changeset_next = (Module['_sqlite3changeset_next'] = (a0) => + (_sqlite3changeset_next = Module['_sqlite3changeset_next'] = + wasmExports['sqlite3changeset_next'])(a0)); + var _sqlite3changeset_op = (Module['_sqlite3changeset_op'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3changeset_op = Module['_sqlite3changeset_op'] = + wasmExports['sqlite3changeset_op'])(a0, a1, a2, a3, a4)); + var _sqlite3changeset_pk = (Module['_sqlite3changeset_pk'] = (a0, a1, a2) => + (_sqlite3changeset_pk = Module['_sqlite3changeset_pk'] = + wasmExports['sqlite3changeset_pk'])(a0, a1, a2)); + var _sqlite3changeset_old = (Module['_sqlite3changeset_old'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_old = Module['_sqlite3changeset_old'] = + wasmExports['sqlite3changeset_old'])(a0, a1, a2)); + var _sqlite3changeset_new = (Module['_sqlite3changeset_new'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_new = Module['_sqlite3changeset_new'] = + wasmExports['sqlite3changeset_new'])(a0, a1, a2)); + var _sqlite3changeset_conflict = (Module['_sqlite3changeset_conflict'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_conflict = Module['_sqlite3changeset_conflict'] = + wasmExports['sqlite3changeset_conflict'])(a0, a1, a2)); + var _sqlite3changeset_fk_conflicts = (Module[ + '_sqlite3changeset_fk_conflicts' + ] = (a0, a1) => + (_sqlite3changeset_fk_conflicts = Module[ + '_sqlite3changeset_fk_conflicts' + ] = + wasmExports['sqlite3changeset_fk_conflicts'])(a0, a1)); + var _sqlite3changeset_finalize = (Module['_sqlite3changeset_finalize'] = ( + a0, + ) => + (_sqlite3changeset_finalize = Module['_sqlite3changeset_finalize'] = + wasmExports['sqlite3changeset_finalize'])(a0)); + var _sqlite3changeset_invert = (Module['_sqlite3changeset_invert'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3changeset_invert = Module['_sqlite3changeset_invert'] = + wasmExports['sqlite3changeset_invert'])(a0, a1, a2, a3)); + var _sqlite3changeset_invert_strm = (Module[ + '_sqlite3changeset_invert_strm' + ] = (a0, a1, a2, a3) => + (_sqlite3changeset_invert_strm = Module['_sqlite3changeset_invert_strm'] = + wasmExports['sqlite3changeset_invert_strm'])(a0, a1, a2, a3)); + var _sqlite3changeset_apply_v2 = (Module['_sqlite3changeset_apply_v2'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (_sqlite3changeset_apply_v2 = Module['_sqlite3changeset_apply_v2'] = + wasmExports['sqlite3changeset_apply_v2'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3changeset_apply = (Module['_sqlite3changeset_apply'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3changeset_apply = Module['_sqlite3changeset_apply'] = + wasmExports['sqlite3changeset_apply'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3changeset_apply_v2_strm = (Module[ + '_sqlite3changeset_apply_v2_strm' + ] = (a0, a1, a2, a3, a4, a5, a6, a7, a8) => + (_sqlite3changeset_apply_v2_strm = Module[ + '_sqlite3changeset_apply_v2_strm' + ] = + wasmExports['sqlite3changeset_apply_v2_strm'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3changeset_apply_strm = (Module['_sqlite3changeset_apply_strm'] = + (a0, a1, a2, a3, a4, a5) => + (_sqlite3changeset_apply_strm = Module['_sqlite3changeset_apply_strm'] = + wasmExports['sqlite3changeset_apply_strm'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3changegroup_new = (Module['_sqlite3changegroup_new'] = (a0) => + (_sqlite3changegroup_new = Module['_sqlite3changegroup_new'] = + wasmExports['sqlite3changegroup_new'])(a0)); + var _sqlite3changegroup_add = (Module['_sqlite3changegroup_add'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changegroup_add = Module['_sqlite3changegroup_add'] = + wasmExports['sqlite3changegroup_add'])(a0, a1, a2)); + var _sqlite3changegroup_output = (Module['_sqlite3changegroup_output'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changegroup_output = Module['_sqlite3changegroup_output'] = + wasmExports['sqlite3changegroup_output'])(a0, a1, a2)); + var _sqlite3changegroup_add_strm = (Module['_sqlite3changegroup_add_strm'] = + (a0, a1, a2) => + (_sqlite3changegroup_add_strm = Module['_sqlite3changegroup_add_strm'] = + wasmExports['sqlite3changegroup_add_strm'])(a0, a1, a2)); + var _sqlite3changegroup_output_strm = (Module[ + '_sqlite3changegroup_output_strm' + ] = (a0, a1, a2) => + (_sqlite3changegroup_output_strm = Module[ + '_sqlite3changegroup_output_strm' + ] = + wasmExports['sqlite3changegroup_output_strm'])(a0, a1, a2)); + var _sqlite3changegroup_delete = (Module['_sqlite3changegroup_delete'] = ( + a0, + ) => + (_sqlite3changegroup_delete = Module['_sqlite3changegroup_delete'] = + wasmExports['sqlite3changegroup_delete'])(a0)); + var _sqlite3changeset_concat = (Module['_sqlite3changeset_concat'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3changeset_concat = Module['_sqlite3changeset_concat'] = + wasmExports['sqlite3changeset_concat'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3changeset_concat_strm = (Module[ + '_sqlite3changeset_concat_strm' + ] = (a0, a1, a2, a3, a4, a5) => + (_sqlite3changeset_concat_strm = Module['_sqlite3changeset_concat_strm'] = + wasmExports['sqlite3changeset_concat_strm'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3session_config = (Module['_sqlite3session_config'] = (a0, a1) => + (_sqlite3session_config = Module['_sqlite3session_config'] = + wasmExports['sqlite3session_config'])(a0, a1)); + var _sqlite3_sourceid = (Module['_sqlite3_sourceid'] = () => + (_sqlite3_sourceid = Module['_sqlite3_sourceid'] = + wasmExports['sqlite3_sourceid'])()); + var _sqlite3__wasm_pstack_ptr = (Module['_sqlite3__wasm_pstack_ptr'] = () => + (_sqlite3__wasm_pstack_ptr = Module['_sqlite3__wasm_pstack_ptr'] = + wasmExports['sqlite3__wasm_pstack_ptr'])()); + var _sqlite3__wasm_pstack_restore = (Module[ + '_sqlite3__wasm_pstack_restore' + ] = (a0) => + (_sqlite3__wasm_pstack_restore = Module['_sqlite3__wasm_pstack_restore'] = + wasmExports['sqlite3__wasm_pstack_restore'])(a0)); + var _sqlite3__wasm_pstack_alloc = (Module['_sqlite3__wasm_pstack_alloc'] = ( + a0, + ) => + (_sqlite3__wasm_pstack_alloc = Module['_sqlite3__wasm_pstack_alloc'] = + wasmExports['sqlite3__wasm_pstack_alloc'])(a0)); + var _sqlite3__wasm_pstack_remaining = (Module[ + '_sqlite3__wasm_pstack_remaining' + ] = () => + (_sqlite3__wasm_pstack_remaining = Module[ + '_sqlite3__wasm_pstack_remaining' + ] = + wasmExports['sqlite3__wasm_pstack_remaining'])()); + var _sqlite3__wasm_pstack_quota = (Module['_sqlite3__wasm_pstack_quota'] = + () => + (_sqlite3__wasm_pstack_quota = Module['_sqlite3__wasm_pstack_quota'] = + wasmExports['sqlite3__wasm_pstack_quota'])()); + var _sqlite3__wasm_db_error = (Module['_sqlite3__wasm_db_error'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_db_error = Module['_sqlite3__wasm_db_error'] = + wasmExports['sqlite3__wasm_db_error'])(a0, a1, a2)); + var _sqlite3__wasm_test_struct = (Module['_sqlite3__wasm_test_struct'] = ( + a0, + ) => + (_sqlite3__wasm_test_struct = Module['_sqlite3__wasm_test_struct'] = + wasmExports['sqlite3__wasm_test_struct'])(a0)); + var _sqlite3__wasm_enum_json = (Module['_sqlite3__wasm_enum_json'] = () => + (_sqlite3__wasm_enum_json = Module['_sqlite3__wasm_enum_json'] = + wasmExports['sqlite3__wasm_enum_json'])()); + var _sqlite3__wasm_vfs_unlink = (Module['_sqlite3__wasm_vfs_unlink'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_vfs_unlink = Module['_sqlite3__wasm_vfs_unlink'] = + wasmExports['sqlite3__wasm_vfs_unlink'])(a0, a1)); + var _sqlite3__wasm_db_vfs = (Module['_sqlite3__wasm_db_vfs'] = (a0, a1) => + (_sqlite3__wasm_db_vfs = Module['_sqlite3__wasm_db_vfs'] = + wasmExports['sqlite3__wasm_db_vfs'])(a0, a1)); + var _sqlite3__wasm_db_reset = (Module['_sqlite3__wasm_db_reset'] = (a0) => + (_sqlite3__wasm_db_reset = Module['_sqlite3__wasm_db_reset'] = + wasmExports['sqlite3__wasm_db_reset'])(a0)); + var _sqlite3__wasm_db_export_chunked = (Module[ + '_sqlite3__wasm_db_export_chunked' + ] = (a0, a1) => + (_sqlite3__wasm_db_export_chunked = Module[ + '_sqlite3__wasm_db_export_chunked' + ] = + wasmExports['sqlite3__wasm_db_export_chunked'])(a0, a1)); + var _sqlite3__wasm_db_serialize = (Module['_sqlite3__wasm_db_serialize'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3__wasm_db_serialize = Module['_sqlite3__wasm_db_serialize'] = + wasmExports['sqlite3__wasm_db_serialize'])(a0, a1, a2, a3, a4)); + var _sqlite3__wasm_vfs_create_file = (Module[ + '_sqlite3__wasm_vfs_create_file' + ] = (a0, a1, a2, a3) => + (_sqlite3__wasm_vfs_create_file = Module[ + '_sqlite3__wasm_vfs_create_file' + ] = + wasmExports['sqlite3__wasm_vfs_create_file'])(a0, a1, a2, a3)); + var _sqlite3__wasm_posix_create_file = (Module[ + '_sqlite3__wasm_posix_create_file' + ] = (a0, a1, a2) => + (_sqlite3__wasm_posix_create_file = Module[ + '_sqlite3__wasm_posix_create_file' + ] = + wasmExports['sqlite3__wasm_posix_create_file'])(a0, a1, a2)); + var _sqlite3__wasm_kvvfsMakeKeyOnPstack = (Module[ + '_sqlite3__wasm_kvvfsMakeKeyOnPstack' + ] = (a0, a1) => + (_sqlite3__wasm_kvvfsMakeKeyOnPstack = Module[ + '_sqlite3__wasm_kvvfsMakeKeyOnPstack' + ] = + wasmExports['sqlite3__wasm_kvvfsMakeKeyOnPstack'])(a0, a1)); + var _sqlite3__wasm_kvvfs_methods = (Module['_sqlite3__wasm_kvvfs_methods'] = + () => + (_sqlite3__wasm_kvvfs_methods = Module['_sqlite3__wasm_kvvfs_methods'] = + wasmExports['sqlite3__wasm_kvvfs_methods'])()); + var _sqlite3__wasm_vtab_config = (Module['_sqlite3__wasm_vtab_config'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_vtab_config = Module['_sqlite3__wasm_vtab_config'] = + wasmExports['sqlite3__wasm_vtab_config'])(a0, a1, a2)); + var _sqlite3__wasm_db_config_ip = (Module['_sqlite3__wasm_db_config_ip'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3__wasm_db_config_ip = Module['_sqlite3__wasm_db_config_ip'] = + wasmExports['sqlite3__wasm_db_config_ip'])(a0, a1, a2, a3)); + var _sqlite3__wasm_db_config_pii = (Module['_sqlite3__wasm_db_config_pii'] = + (a0, a1, a2, a3, a4) => + (_sqlite3__wasm_db_config_pii = Module['_sqlite3__wasm_db_config_pii'] = + wasmExports['sqlite3__wasm_db_config_pii'])(a0, a1, a2, a3, a4)); + var _sqlite3__wasm_db_config_s = (Module['_sqlite3__wasm_db_config_s'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_db_config_s = Module['_sqlite3__wasm_db_config_s'] = + wasmExports['sqlite3__wasm_db_config_s'])(a0, a1, a2)); + var _sqlite3__wasm_config_i = (Module['_sqlite3__wasm_config_i'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_config_i = Module['_sqlite3__wasm_config_i'] = + wasmExports['sqlite3__wasm_config_i'])(a0, a1)); + var _sqlite3__wasm_config_ii = (Module['_sqlite3__wasm_config_ii'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_config_ii = Module['_sqlite3__wasm_config_ii'] = + wasmExports['sqlite3__wasm_config_ii'])(a0, a1, a2)); + var _sqlite3__wasm_config_j = (Module['_sqlite3__wasm_config_j'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_config_j = Module['_sqlite3__wasm_config_j'] = + wasmExports['sqlite3__wasm_config_j'])(a0, a1)); + var _sqlite3__wasm_qfmt_token = (Module['_sqlite3__wasm_qfmt_token'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_qfmt_token = Module['_sqlite3__wasm_qfmt_token'] = + wasmExports['sqlite3__wasm_qfmt_token'])(a0, a1)); + var _sqlite3__wasm_init_wasmfs = (Module['_sqlite3__wasm_init_wasmfs'] = ( + a0, + ) => + (_sqlite3__wasm_init_wasmfs = Module['_sqlite3__wasm_init_wasmfs'] = + wasmExports['sqlite3__wasm_init_wasmfs'])(a0)); + var _sqlite3__wasm_test_intptr = (Module['_sqlite3__wasm_test_intptr'] = ( + a0, + ) => + (_sqlite3__wasm_test_intptr = Module['_sqlite3__wasm_test_intptr'] = + wasmExports['sqlite3__wasm_test_intptr'])(a0)); + var _sqlite3__wasm_test_voidptr = (Module['_sqlite3__wasm_test_voidptr'] = ( + a0, + ) => + (_sqlite3__wasm_test_voidptr = Module['_sqlite3__wasm_test_voidptr'] = + wasmExports['sqlite3__wasm_test_voidptr'])(a0)); + var _sqlite3__wasm_test_int64_max = (Module[ + '_sqlite3__wasm_test_int64_max' + ] = () => + (_sqlite3__wasm_test_int64_max = Module['_sqlite3__wasm_test_int64_max'] = + wasmExports['sqlite3__wasm_test_int64_max'])()); + var _sqlite3__wasm_test_int64_min = (Module[ + '_sqlite3__wasm_test_int64_min' + ] = () => + (_sqlite3__wasm_test_int64_min = Module['_sqlite3__wasm_test_int64_min'] = + wasmExports['sqlite3__wasm_test_int64_min'])()); + var _sqlite3__wasm_test_int64_times2 = (Module[ + '_sqlite3__wasm_test_int64_times2' + ] = (a0) => + (_sqlite3__wasm_test_int64_times2 = Module[ + '_sqlite3__wasm_test_int64_times2' + ] = + wasmExports['sqlite3__wasm_test_int64_times2'])(a0)); + var _sqlite3__wasm_test_int64_minmax = (Module[ + '_sqlite3__wasm_test_int64_minmax' + ] = (a0, a1) => + (_sqlite3__wasm_test_int64_minmax = Module[ + '_sqlite3__wasm_test_int64_minmax' + ] = + wasmExports['sqlite3__wasm_test_int64_minmax'])(a0, a1)); + var _sqlite3__wasm_test_int64ptr = (Module['_sqlite3__wasm_test_int64ptr'] = + (a0) => + (_sqlite3__wasm_test_int64ptr = Module['_sqlite3__wasm_test_int64ptr'] = + wasmExports['sqlite3__wasm_test_int64ptr'])(a0)); + var _sqlite3__wasm_test_stack_overflow = (Module[ + '_sqlite3__wasm_test_stack_overflow' + ] = (a0) => + (_sqlite3__wasm_test_stack_overflow = Module[ + '_sqlite3__wasm_test_stack_overflow' + ] = + wasmExports['sqlite3__wasm_test_stack_overflow'])(a0)); + var _sqlite3__wasm_test_str_hello = (Module[ + '_sqlite3__wasm_test_str_hello' + ] = (a0) => + (_sqlite3__wasm_test_str_hello = Module['_sqlite3__wasm_test_str_hello'] = + wasmExports['sqlite3__wasm_test_str_hello'])(a0)); + var _sqlite3__wasm_SQLTester_strglob = (Module[ + '_sqlite3__wasm_SQLTester_strglob' + ] = (a0, a1) => + (_sqlite3__wasm_SQLTester_strglob = Module[ + '_sqlite3__wasm_SQLTester_strglob' + ] = + wasmExports['sqlite3__wasm_SQLTester_strglob'])(a0, a1)); + var _malloc = (Module['_malloc'] = (a0) => + (_malloc = Module['_malloc'] = wasmExports['malloc'])(a0)); + var _free = (Module['_free'] = (a0) => + (_free = Module['_free'] = wasmExports['free'])(a0)); + var _realloc = (Module['_realloc'] = (a0, a1) => + (_realloc = Module['_realloc'] = wasmExports['realloc'])(a0, a1)); + var _emscripten_builtin_memalign = (a0, a1) => + (_emscripten_builtin_memalign = + wasmExports['emscripten_builtin_memalign'])(a0, a1); + var __emscripten_stack_restore = (a0) => + (__emscripten_stack_restore = wasmExports['_emscripten_stack_restore'])( + a0, + ); + var __emscripten_stack_alloc = (a0) => + (__emscripten_stack_alloc = wasmExports['_emscripten_stack_alloc'])(a0); + var _emscripten_stack_get_current = () => + (_emscripten_stack_get_current = + wasmExports['emscripten_stack_get_current'])(); + + Module['wasmMemory'] = wasmMemory; + + var calledRun; + var calledPrerun; + + dependenciesFulfilled = function runCaller() { + if (!calledRun) run(); + if (!calledRun) dependenciesFulfilled = runCaller; + }; + + function run() { + if (runDependencies > 0) { + return; + } + + if (!calledPrerun) { + calledPrerun = 1; + preRun(); + + if (runDependencies > 0) { + return; + } + } + + function doRun() { + if (calledRun) return; + calledRun = 1; + Module['calledRun'] = 1; + + if (ABORT) return; + + initRuntime(); + + readyPromiseResolve(Module); + Module['onRuntimeInitialized']?.(); + + postRun(); + } + + if (Module['setStatus']) { + Module['setStatus']('Running...'); + setTimeout(() => { + setTimeout(() => Module['setStatus'](''), 1); + doRun(); + }, 1); + } else { + doRun(); + } + } + + if (Module['preInit']) { + if (typeof Module['preInit'] == 'function') + Module['preInit'] = [Module['preInit']]; + while (Module['preInit'].length > 0) { + Module['preInit'].pop()(); + } + } + + run(); + + Module.runSQLite3PostLoadInit = function (EmscriptenModule) { + 'use strict'; + + 'use strict'; + globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap( + apiConfig = globalThis.sqlite3ApiConfig || + sqlite3ApiBootstrap.defaultConfig, + ) { + if (sqlite3ApiBootstrap.sqlite3) { + (sqlite3ApiBootstrap.sqlite3.config || console).warn( + 'sqlite3ApiBootstrap() called multiple times.', + 'Config and external initializers are ignored on calls after the first.', + ); + return sqlite3ApiBootstrap.sqlite3; + } + const config = Object.assign( + Object.create(null), + { + exports: undefined, + memory: undefined, + bigIntEnabled: (() => { + if ('undefined' !== typeof Module) { + if (!!Module.HEAPU64) return true; + } + return !!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: false, + }, + apiConfig || {}, + ); + + Object.assign( + config, + { + allocExportName: config.useStdAlloc ? 'malloc' : 'sqlite3_malloc', + deallocExportName: config.useStdAlloc ? 'free' : 'sqlite3_free', + reallocExportName: config.useStdAlloc + ? 'realloc' + : 'sqlite3_realloc', + }, + config, + ); + + ['exports', 'memory', 'wasmfsOpfsDir'].forEach((k) => { + if ('function' === typeof config[k]) { + config[k] = config[k](); + } + }); + + delete globalThis.sqlite3ApiConfig; + delete sqlite3ApiBootstrap.defaultConfig; + + const capi = Object.create(null); + + const wasm = Object.create(null); + + const __rcStr = (rc) => { + return ( + (capi.sqlite3_js_rc_str && capi.sqlite3_js_rc_str(rc)) || + 'Unknown result code #' + rc + ); + }; + + const __isInt = (n) => 'number' === typeof n && n === (n | 0); + + class SQLite3Error extends Error { + constructor(...args) { + let rc; + if (args.length) { + if (__isInt(args[0])) { + rc = args[0]; + if (1 === args.length) { + super(__rcStr(args[0])); + } else { + const rcStr = __rcStr(rc); + if ('object' === typeof args[1]) { + super(rcStr, args[1]); + } else { + args[0] = rcStr + ':'; + super(args.join(' ')); + } + } + } else { + if (2 === args.length && 'object' === typeof args[1]) { + super(...args); + } else { + super(args.join(' ')); + } + } + } + this.resultCode = rc || capi.SQLITE_ERROR; + this.name = 'SQLite3Error'; + } + } + + SQLite3Error.toss = (...args) => { + throw new SQLite3Error(...args); + }; + const toss3 = SQLite3Error.toss; + + if (config.wasmfsOpfsDir && !/^\/[^/]+$/.test(config.wasmfsOpfsDir)) { + toss3( + "config.wasmfsOpfsDir must be falsy or in the form '/dir-name'.", + ); + } + + const isInt32 = (n) => { + return ( + 'bigint' !== typeof n && + !!(n === (n | 0) && n <= 2147483647 && n >= -2147483648) + ); + }; + + const bigIntFits64 = function f(b) { + if (!f._max) { + f._max = BigInt('0x7fffffffffffffff'); + f._min = ~f._max; + } + return b >= f._min && b <= f._max; + }; + + const bigIntFits32 = (b) => b >= -0x7fffffffn - 1n && b <= 0x7fffffffn; + + const bigIntFitsDouble = function f(b) { + if (!f._min) { + f._min = Number.MIN_SAFE_INTEGER; + f._max = Number.MAX_SAFE_INTEGER; + } + return b >= f._min && b <= f._max; + }; + + const isTypedArray = (v) => { + return v && v.constructor && isInt32(v.constructor.BYTES_PER_ELEMENT) + ? v + : false; + }; + + const __SAB = + 'undefined' === typeof SharedArrayBuffer + ? function () {} + : SharedArrayBuffer; + + const isSharedTypedArray = (aTypedArray) => + aTypedArray.buffer instanceof __SAB; + + const typedArrayPart = (aTypedArray, begin, end) => { + return isSharedTypedArray(aTypedArray) + ? aTypedArray.slice(begin, end) + : aTypedArray.subarray(begin, end); + }; + + const isBindableTypedArray = (v) => { + return ( + v && + (v instanceof Uint8Array || + v instanceof Int8Array || + v instanceof ArrayBuffer) + ); + }; + + const isSQLableTypedArray = (v) => { + return ( + v && + (v instanceof Uint8Array || + v instanceof Int8Array || + v instanceof ArrayBuffer) + ); + }; + + const affirmBindableTypedArray = (v) => { + return ( + isBindableTypedArray(v) || + toss3('Value is not of a supported TypedArray type.') + ); + }; + + const utf8Decoder = new TextDecoder('utf-8'); + + const typedArrayToString = function (typedArray, begin, end) { + return utf8Decoder.decode(typedArrayPart(typedArray, begin, end)); + }; + + const flexibleString = function (v) { + if (isSQLableTypedArray(v)) { + return typedArrayToString( + v instanceof ArrayBuffer ? new Uint8Array(v) : v, + ); + } else if (Array.isArray(v)) return v.join(''); + else if (wasm.isPtr(v)) v = wasm.cstrToJs(v); + return v; + }; + + class WasmAllocError extends Error { + constructor(...args) { + if (2 === args.length && 'object' === typeof args[1]) { + super(...args); + } else if (args.length) { + super(args.join(' ')); + } else { + super('Allocation failed.'); + } + this.resultCode = capi.SQLITE_NOMEM; + this.name = 'WasmAllocError'; + } + } + + WasmAllocError.toss = (...args) => { + throw new WasmAllocError(...args); + }; + + Object.assign(capi, { + sqlite3_bind_blob: undefined, + + sqlite3_bind_text: undefined, + + sqlite3_create_function_v2: ( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + xDestroy, + ) => {}, + + sqlite3_create_function: ( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + ) => {}, + + sqlite3_create_window_function: ( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ) => {}, + + sqlite3_prepare_v3: ( + dbPtr, + sql, + sqlByteLen, + prepFlags, + stmtPtrPtr, + strPtrPtr, + ) => {}, + + sqlite3_prepare_v2: ( + dbPtr, + sql, + sqlByteLen, + stmtPtrPtr, + strPtrPtr, + ) => {}, + + sqlite3_exec: (pDb, sql, callback, pVoid, pErrMsg) => {}, + + sqlite3_randomness: (n, outPtr) => {}, + }); + + const util = { + affirmBindableTypedArray, + flexibleString, + bigIntFits32, + bigIntFits64, + bigIntFitsDouble, + isBindableTypedArray, + isInt32, + isSQLableTypedArray, + isTypedArray, + typedArrayToString, + isUIThread: () => + globalThis.window === globalThis && !!globalThis.document, + + isSharedTypedArray, + toss: function (...args) { + throw new Error(args.join(' ')); + }, + toss3, + typedArrayPart, + + affirmDbHeader: function (bytes) { + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + const header = 'SQLite format 3'; + if (header.length > bytes.byteLength) { + toss3('Input does not contain an SQLite3 database header.'); + } + for (let i = 0; i < header.length; ++i) { + if (header.charCodeAt(i) !== bytes[i]) { + toss3('Input does not contain an SQLite3 database header.'); + } + } + }, + + affirmIsDb: function (bytes) { + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + const n = bytes.byteLength; + if (n < 512 || n % 512 !== 0) { + toss3('Byte array size', n, 'is invalid for an SQLite3 db.'); + } + util.affirmDbHeader(bytes); + }, + }; + + Object.assign(wasm, { + ptrSizeof: config.wasmPtrSizeof || 4, + + ptrIR: config.wasmPtrIR || 'i32', + + bigIntEnabled: !!config.bigIntEnabled, + + exports: + config.exports || + toss3('Missing API config.exports (WASM module exports).'), + + memory: + config.memory || + config.exports['memory'] || + toss3( + 'API config object requires a WebAssembly.Memory object', + 'in either config.exports.memory (exported)', + 'or config.memory (imported).', + ), + + alloc: undefined, + + realloc: undefined, + + dealloc: undefined, + }); + + wasm.allocFromTypedArray = function (srcTypedArray) { + if (srcTypedArray instanceof ArrayBuffer) { + srcTypedArray = new Uint8Array(srcTypedArray); + } + affirmBindableTypedArray(srcTypedArray); + const pRet = wasm.alloc(srcTypedArray.byteLength || 1); + wasm + .heapForSize(srcTypedArray.constructor) + .set(srcTypedArray.byteLength ? srcTypedArray : [0], pRet); + return pRet; + }; + + { + const keyAlloc = config.allocExportName, + keyDealloc = config.deallocExportName, + keyRealloc = config.reallocExportName; + for (const key of [keyAlloc, keyDealloc, keyRealloc]) { + const f = wasm.exports[key]; + if (!(f instanceof Function)) + toss3('Missing required exports[', key, '] function.'); + } + + wasm.alloc = function f(n) { + return ( + f.impl(n) || + WasmAllocError.toss('Failed to allocate', n, ' bytes.') + ); + }; + wasm.alloc.impl = wasm.exports[keyAlloc]; + wasm.realloc = function f(m, n) { + const m2 = f.impl(m, n); + return n + ? m2 || WasmAllocError.toss('Failed to reallocate', n, ' bytes.') + : 0; + }; + wasm.realloc.impl = wasm.exports[keyRealloc]; + wasm.dealloc = wasm.exports[keyDealloc]; + } + + wasm.compileOptionUsed = function f(optName) { + if (!arguments.length) { + if (f._result) return f._result; + else if (!f._opt) { + f._rx = /^([^=]+)=(.+)/; + f._rxInt = /^-?\d+$/; + f._opt = function (opt, rv) { + const m = f._rx.exec(opt); + rv[0] = m ? m[1] : opt; + rv[1] = m ? (f._rxInt.test(m[2]) ? +m[2] : m[2]) : true; + }; + } + const rc = {}, + ov = [0, 0]; + let i = 0, + k; + while ((k = capi.sqlite3_compileoption_get(i++))) { + f._opt(k, ov); + rc[ov[0]] = ov[1]; + } + return (f._result = rc); + } else if (Array.isArray(optName)) { + const rc = {}; + optName.forEach((v) => { + rc[v] = capi.sqlite3_compileoption_used(v); + }); + return rc; + } else if ('object' === typeof optName) { + Object.keys(optName).forEach((k) => { + optName[k] = capi.sqlite3_compileoption_used(k); + }); + return optName; + } + return 'string' === typeof optName + ? !!capi.sqlite3_compileoption_used(optName) + : false; + }; + + wasm.pstack = Object.assign(Object.create(null), { + restore: wasm.exports.sqlite3__wasm_pstack_restore, + + alloc: function (n) { + if ('string' === typeof n && !(n = wasm.sizeofIR(n))) { + WasmAllocError.toss( + 'Invalid value for pstack.alloc(', + arguments[0], + ')', + ); + } + return ( + wasm.exports.sqlite3__wasm_pstack_alloc(n) || + WasmAllocError.toss( + 'Could not allocate', + n, + 'bytes from the pstack.', + ) + ); + }, + + allocChunks: function (n, sz) { + if ('string' === typeof sz && !(sz = wasm.sizeofIR(sz))) { + WasmAllocError.toss( + 'Invalid size value for allocChunks(', + arguments[1], + ')', + ); + } + const mem = wasm.pstack.alloc(n * sz); + const rc = []; + let i = 0, + offset = 0; + for (; i < n; ++i, offset += sz) rc.push(mem + offset); + return rc; + }, + + allocPtr: (n = 1, safePtrSize = true) => { + return 1 === n + ? wasm.pstack.alloc(safePtrSize ? 8 : wasm.ptrSizeof) + : wasm.pstack.allocChunks(n, safePtrSize ? 8 : wasm.ptrSizeof); + }, + + call: function (f) { + const stackPos = wasm.pstack.pointer; + try { + return f(sqlite3); + } finally { + wasm.pstack.restore(stackPos); + } + }, + }); + Object.defineProperties(wasm.pstack, { + pointer: { + configurable: false, + iterable: true, + writeable: false, + get: wasm.exports.sqlite3__wasm_pstack_ptr, + }, + + quota: { + configurable: false, + iterable: true, + writeable: false, + get: wasm.exports.sqlite3__wasm_pstack_quota, + }, + + remaining: { + configurable: false, + iterable: true, + writeable: false, + get: wasm.exports.sqlite3__wasm_pstack_remaining, + }, + }); + + capi.sqlite3_randomness = (...args) => { + if ( + 1 === args.length && + util.isTypedArray(args[0]) && + 1 === args[0].BYTES_PER_ELEMENT + ) { + const ta = args[0]; + if (0 === ta.byteLength) { + wasm.exports.sqlite3_randomness(0, 0); + return ta; + } + const stack = wasm.pstack.pointer; + try { + let n = ta.byteLength, + offset = 0; + const r = wasm.exports.sqlite3_randomness; + const heap = wasm.heap8u(); + const nAlloc = n < 512 ? n : 512; + const ptr = wasm.pstack.alloc(nAlloc); + do { + const j = n > nAlloc ? nAlloc : n; + r(j, ptr); + ta.set(typedArrayPart(heap, ptr, ptr + j), offset); + n -= j; + offset += j; + } while (n > 0); + } catch (e) { + console.error( + 'Highly unexpected (and ignored!) ' + + 'exception in sqlite3_randomness():', + e, + ); + } finally { + wasm.pstack.restore(stack); + } + return ta; + } + wasm.exports.sqlite3_randomness(...args); + }; + + let __wasmfsOpfsDir = undefined; + + capi.sqlite3_wasmfs_opfs_dir = function () { + if (undefined !== __wasmfsOpfsDir) return __wasmfsOpfsDir; + + const pdir = config.wasmfsOpfsDir; + if ( + !pdir || + !globalThis.FileSystemHandle || + !globalThis.FileSystemDirectoryHandle || + !globalThis.FileSystemFileHandle + ) { + return (__wasmfsOpfsDir = ''); + } + try { + if ( + pdir && + 0 === + wasm.xCallWrapped( + 'sqlite3__wasm_init_wasmfs', + 'i32', + ['string'], + pdir, + ) + ) { + return (__wasmfsOpfsDir = pdir); + } else { + return (__wasmfsOpfsDir = ''); + } + } catch (e) { + return (__wasmfsOpfsDir = ''); + } + }; + + capi.sqlite3_wasmfs_filename_is_persistent = function (name) { + const p = capi.sqlite3_wasmfs_opfs_dir(); + return p && name ? name.startsWith(p + '/') : false; + }; + + capi.sqlite3_js_db_uses_vfs = function (pDb, vfsName, dbName = 0) { + try { + const pK = capi.sqlite3_vfs_find(vfsName); + if (!pK) return false; + else if (!pDb) { + return pK === capi.sqlite3_vfs_find(0) ? pK : false; + } else { + return pK === capi.sqlite3_js_db_vfs(pDb, dbName) ? pK : false; + } + } catch (e) { + return false; + } + }; + + capi.sqlite3_js_vfs_list = function () { + const rc = []; + let pVfs = capi.sqlite3_vfs_find(0); + while (pVfs) { + const oVfs = new capi.sqlite3_vfs(pVfs); + rc.push(wasm.cstrToJs(oVfs.$zName)); + pVfs = oVfs.$pNext; + oVfs.dispose(); + } + return rc; + }; + + capi.sqlite3_js_db_export = function (pDb, schema = 0) { + pDb = wasm.xWrap.testConvertArg('sqlite3*', pDb); + if (!pDb) toss3('Invalid sqlite3* argument.'); + if (!wasm.bigIntEnabled) toss3('BigInt64 support is not enabled.'); + const scope = wasm.scopedAllocPush(); + let pOut; + try { + const pSize = wasm.scopedAlloc(8 + wasm.ptrSizeof); + const ppOut = pSize + 8; + + const zSchema = schema + ? wasm.isPtr(schema) + ? schema + : wasm.scopedAllocCString('' + schema) + : 0; + let rc = wasm.exports.sqlite3__wasm_db_serialize( + pDb, + zSchema, + ppOut, + pSize, + 0, + ); + if (rc) { + toss3( + 'Database serialization failed with code', + sqlite3.capi.sqlite3_js_rc_str(rc), + ); + } + pOut = wasm.peekPtr(ppOut); + const nOut = wasm.peek(pSize, 'i64'); + rc = nOut + ? wasm.heap8u().slice(pOut, pOut + Number(nOut)) + : new Uint8Array(); + return rc; + } finally { + if (pOut) wasm.exports.sqlite3_free(pOut); + wasm.scopedAllocPop(scope); + } + }; + + capi.sqlite3_js_db_vfs = (dbPointer, dbName = 0) => + util.sqlite3__wasm_db_vfs(dbPointer, dbName); + + capi.sqlite3_js_aggregate_context = (pCtx, n) => { + return ( + capi.sqlite3_aggregate_context(pCtx, n) || + (n + ? WasmAllocError.toss( + 'Cannot allocate', + n, + 'bytes for sqlite3_aggregate_context()', + ) + : 0) + ); + }; + + capi.sqlite3_js_posix_create_file = function (filename, data, dataLen) { + let pData; + if (data && wasm.isPtr(data)) { + pData = data; + } else if ( + data instanceof ArrayBuffer || + data instanceof Uint8Array + ) { + pData = wasm.allocFromTypedArray(data); + if (arguments.length < 3 || !util.isInt32(dataLen) || dataLen < 0) { + dataLen = data.byteLength; + } + } else { + SQLite3Error.toss( + 'Invalid 2nd argument for sqlite3_js_posix_create_file().', + ); + } + try { + if (!util.isInt32(dataLen) || dataLen < 0) { + SQLite3Error.toss( + 'Invalid 3rd argument for sqlite3_js_posix_create_file().', + ); + } + const rc = util.sqlite3__wasm_posix_create_file( + filename, + pData, + dataLen, + ); + if (rc) + SQLite3Error.toss( + 'Creation of file failed with sqlite3 result code', + capi.sqlite3_js_rc_str(rc), + ); + } finally { + wasm.dealloc(pData); + } + }; + + capi.sqlite3_js_vfs_create_file = function ( + vfs, + filename, + data, + dataLen, + ) { + config.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 pData; + if (data) { + if (wasm.isPtr(data)) { + pData = data; + } else if (data instanceof ArrayBuffer) { + data = new Uint8Array(data); + } + if (data instanceof Uint8Array) { + pData = wasm.allocFromTypedArray(data); + if ( + arguments.length < 4 || + !util.isInt32(dataLen) || + dataLen < 0 + ) { + dataLen = data.byteLength; + } + } else { + SQLite3Error.toss( + 'Invalid 3rd argument type for sqlite3_js_vfs_create_file().', + ); + } + } else { + pData = 0; + } + if (!util.isInt32(dataLen) || dataLen < 0) { + wasm.dealloc(pData); + SQLite3Error.toss( + 'Invalid 4th argument for sqlite3_js_vfs_create_file().', + ); + } + try { + const rc = util.sqlite3__wasm_vfs_create_file( + vfs, + filename, + pData, + dataLen, + ); + if (rc) + SQLite3Error.toss( + 'Creation of file failed with sqlite3 result code', + capi.sqlite3_js_rc_str(rc), + ); + } finally { + wasm.dealloc(pData); + } + }; + + capi.sqlite3_js_sql_to_string = (sql) => { + if ('string' === typeof sql) { + return sql; + } + const x = flexibleString(v); + return x === v ? undefined : x; + }; + + if (util.isUIThread()) { + const __kvvfsInfo = function (which) { + const rc = Object.create(null); + rc.prefix = 'kvvfs-' + which; + rc.stores = []; + if ('session' === which || '' === which) + rc.stores.push(globalThis.sessionStorage); + if ('local' === which || '' === which) + rc.stores.push(globalThis.localStorage); + return rc; + }; + + capi.sqlite3_js_kvvfs_clear = function (which = '') { + let rc = 0; + const kvinfo = __kvvfsInfo(which); + kvinfo.stores.forEach((s) => { + const toRm = []; + let i; + for (i = 0; i < s.length; ++i) { + const k = s.key(i); + if (k.startsWith(kvinfo.prefix)) toRm.push(k); + } + toRm.forEach((kk) => s.removeItem(kk)); + rc += toRm.length; + }); + return rc; + }; + + capi.sqlite3_js_kvvfs_size = function (which = '') { + let sz = 0; + const kvinfo = __kvvfsInfo(which); + kvinfo.stores.forEach((s) => { + let i; + for (i = 0; i < s.length; ++i) { + const k = s.key(i); + if (k.startsWith(kvinfo.prefix)) { + sz += k.length; + sz += s.getItem(k).length; + } + } + }); + return sz * 2; + }; + } + + capi.sqlite3_db_config = function (pDb, op, ...args) { + switch (op) { + case capi.SQLITE_DBCONFIG_ENABLE_FKEY: + case capi.SQLITE_DBCONFIG_ENABLE_TRIGGER: + case capi.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER: + case capi.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION: + case capi.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE: + case capi.SQLITE_DBCONFIG_ENABLE_QPSG: + case capi.SQLITE_DBCONFIG_TRIGGER_EQP: + case capi.SQLITE_DBCONFIG_RESET_DATABASE: + case capi.SQLITE_DBCONFIG_DEFENSIVE: + case capi.SQLITE_DBCONFIG_WRITABLE_SCHEMA: + case capi.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE: + case capi.SQLITE_DBCONFIG_DQS_DML: + case capi.SQLITE_DBCONFIG_DQS_DDL: + case capi.SQLITE_DBCONFIG_ENABLE_VIEW: + case capi.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT: + case capi.SQLITE_DBCONFIG_TRUSTED_SCHEMA: + case capi.SQLITE_DBCONFIG_STMT_SCANSTATUS: + case capi.SQLITE_DBCONFIG_REVERSE_SCANORDER: + case capi.SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE: + case capi.SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE: + case capi.SQLITE_DBCONFIG_ENABLE_COMMENTS: + if (!this.ip) { + this.ip = wasm.xWrap('sqlite3__wasm_db_config_ip', 'int', [ + 'sqlite3*', + 'int', + 'int', + '*', + ]); + } + return this.ip(pDb, op, args[0], args[1] || 0); + case capi.SQLITE_DBCONFIG_LOOKASIDE: + if (!this.pii) { + this.pii = wasm.xWrap('sqlite3__wasm_db_config_pii', 'int', [ + 'sqlite3*', + 'int', + '*', + 'int', + 'int', + ]); + } + return this.pii(pDb, op, args[0], args[1], args[2]); + case capi.SQLITE_DBCONFIG_MAINDBNAME: + if (!this.s) { + this.s = wasm.xWrap('sqlite3__wasm_db_config_s', 'int', [ + 'sqlite3*', + 'int', + 'string:static', + ]); + } + return this.s(pDb, op, args[0]); + default: + return capi.SQLITE_MISUSE; + } + }.bind(Object.create(null)); + + capi.sqlite3_value_to_js = function ( + pVal, + throwIfCannotConvert = true, + ) { + let arg; + const valType = capi.sqlite3_value_type(pVal); + switch (valType) { + case capi.SQLITE_INTEGER: + if (wasm.bigIntEnabled) { + arg = capi.sqlite3_value_int64(pVal); + if (util.bigIntFitsDouble(arg)) arg = Number(arg); + } else arg = capi.sqlite3_value_double(pVal); + break; + case capi.SQLITE_FLOAT: + arg = capi.sqlite3_value_double(pVal); + break; + case capi.SQLITE_TEXT: + arg = capi.sqlite3_value_text(pVal); + break; + case capi.SQLITE_BLOB: { + const n = capi.sqlite3_value_bytes(pVal); + const pBlob = capi.sqlite3_value_blob(pVal); + if (n && !pBlob) + sqlite3.WasmAllocError.toss( + 'Cannot allocate memory for blob argument of', + n, + 'byte(s)', + ); + arg = n ? wasm.heap8u().slice(pBlob, pBlob + Number(n)) : null; + break; + } + case capi.SQLITE_NULL: + arg = null; + break; + default: + if (throwIfCannotConvert) { + toss3( + capi.SQLITE_MISMATCH, + 'Unhandled sqlite3_value_type():', + valType, + ); + } + arg = undefined; + } + return arg; + }; + + capi.sqlite3_values_to_js = function ( + argc, + pArgv, + throwIfCannotConvert = true, + ) { + let i; + const tgt = []; + for (i = 0; i < argc; ++i) { + tgt.push( + capi.sqlite3_value_to_js( + wasm.peekPtr(pArgv + wasm.ptrSizeof * i), + throwIfCannotConvert, + ), + ); + } + return tgt; + }; + + capi.sqlite3_result_error_js = function (pCtx, e) { + if (e instanceof WasmAllocError) { + capi.sqlite3_result_error_nomem(pCtx); + } else { + capi.sqlite3_result_error(pCtx, '' + e, -1); + } + }; + + capi.sqlite3_result_js = function (pCtx, val) { + if (val instanceof Error) { + capi.sqlite3_result_error_js(pCtx, val); + return; + } + try { + switch (typeof val) { + case 'undefined': + break; + case 'boolean': + capi.sqlite3_result_int(pCtx, val ? 1 : 0); + break; + case 'bigint': + if (util.bigIntFits32(val)) { + capi.sqlite3_result_int(pCtx, Number(val)); + } else if (util.bigIntFitsDouble(val)) { + capi.sqlite3_result_double(pCtx, Number(val)); + } else if (wasm.bigIntEnabled) { + if (util.bigIntFits64(val)) + capi.sqlite3_result_int64(pCtx, val); + else + toss3( + 'BigInt value', + val.toString(), + 'is too BigInt for int64.', + ); + } else { + toss3('BigInt value', val.toString(), 'is too BigInt.'); + } + break; + case 'number': { + let f; + if (util.isInt32(val)) { + f = capi.sqlite3_result_int; + } else if ( + wasm.bigIntEnabled && + Number.isInteger(val) && + util.bigIntFits64(BigInt(val)) + ) { + f = capi.sqlite3_result_int64; + } else { + f = capi.sqlite3_result_double; + } + f(pCtx, val); + break; + } + case 'string': { + const [p, n] = wasm.allocCString(val, true); + capi.sqlite3_result_text(pCtx, p, n, capi.SQLITE_WASM_DEALLOC); + break; + } + case 'object': + if (null === val) { + capi.sqlite3_result_null(pCtx); + break; + } else if (util.isBindableTypedArray(val)) { + const pBlob = wasm.allocFromTypedArray(val); + capi.sqlite3_result_blob( + pCtx, + pBlob, + val.byteLength, + capi.SQLITE_WASM_DEALLOC, + ); + break; + } + + default: + toss3( + "Don't not how to handle this UDF result value:", + typeof val, + val, + ); + } + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + + capi.sqlite3_column_js = function ( + pStmt, + iCol, + throwIfCannotConvert = true, + ) { + const v = capi.sqlite3_column_value(pStmt, iCol); + return 0 === v + ? undefined + : capi.sqlite3_value_to_js(v, throwIfCannotConvert); + }; + + const __newOldValue = function (pObj, iCol, impl) { + impl = capi[impl]; + if (!this.ptr) this.ptr = wasm.allocPtr(); + else wasm.pokePtr(this.ptr, 0); + const rc = impl(pObj, iCol, this.ptr); + if (rc) + return SQLite3Error.toss( + rc, + arguments[2] + '() failed with code ' + rc, + ); + const pv = wasm.peekPtr(this.ptr); + return pv ? capi.sqlite3_value_to_js(pv, true) : undefined; + }.bind(Object.create(null)); + + capi.sqlite3_preupdate_new_js = (pDb, iCol) => + __newOldValue(pDb, iCol, 'sqlite3_preupdate_new'); + + capi.sqlite3_preupdate_old_js = (pDb, iCol) => + __newOldValue(pDb, iCol, 'sqlite3_preupdate_old'); + + capi.sqlite3changeset_new_js = (pChangesetIter, iCol) => + __newOldValue(pChangesetIter, iCol, 'sqlite3changeset_new'); + + capi.sqlite3changeset_old_js = (pChangesetIter, iCol) => + __newOldValue(pChangesetIter, iCol, 'sqlite3changeset_old'); + + const sqlite3 = { + WasmAllocError: WasmAllocError, + SQLite3Error: SQLite3Error, + capi, + util, + wasm, + config, + + version: Object.create(null), + + client: undefined, + + asyncPostInit: async function ff() { + if (ff.isReady instanceof Promise) return ff.isReady; + let lia = sqlite3ApiBootstrap.initializersAsync; + delete sqlite3ApiBootstrap.initializersAsync; + const postInit = async () => { + if (!sqlite3.__isUnderTest) { + delete sqlite3.util; + + delete sqlite3.StructBinder; + } + return sqlite3; + }; + const catcher = (e) => { + config.error('an async sqlite3 initializer failed:', e); + throw e; + }; + if (!lia || !lia.length) { + return (ff.isReady = postInit().catch(catcher)); + } + lia = lia.map((f) => { + return f instanceof Function ? async (x) => f(sqlite3) : f; + }); + lia.push(postInit); + let p = Promise.resolve(sqlite3); + while (lia.length) p = p.then(lia.shift()); + return (ff.isReady = p.catch(catcher)); + }, + + scriptInfo: undefined, + }; + try { + sqlite3ApiBootstrap.initializers.forEach((f) => { + f(sqlite3); + }); + } catch (e) { + console.error('sqlite3 bootstrap initializer threw:', e); + throw e; + } + delete sqlite3ApiBootstrap.initializers; + sqlite3ApiBootstrap.sqlite3 = sqlite3; + return sqlite3; + }; + + globalThis.sqlite3ApiBootstrap.initializers = []; + + globalThis.sqlite3ApiBootstrap.initializersAsync = []; + + globalThis.sqlite3ApiBootstrap.defaultConfig = Object.create(null); + + globalThis.sqlite3ApiBootstrap.sqlite3 = undefined; + + globalThis.WhWasmUtilInstaller = function (target) { + 'use strict'; + if (undefined === target.bigIntEnabled) { + target.bigIntEnabled = !!globalThis['BigInt64Array']; + } + + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + + if (!target.exports) { + Object.defineProperty(target, 'exports', { + enumerable: true, + configurable: true, + get: () => target.instance && target.instance.exports, + }); + } + + const ptrIR = target.pointerIR || 'i32'; + const ptrSizeof = (target.ptrSizeof = + 'i32' === ptrIR + ? 4 + : 'i64' === ptrIR + ? 8 + : toss('Unhandled ptrSizeof:', ptrIR)); + + const cache = Object.create(null); + + cache.heapSize = 0; + + cache.memory = null; + + cache.freeFuncIndexes = []; + + cache.scopedAlloc = []; + + cache.utf8Decoder = new TextDecoder(); + cache.utf8Encoder = new TextEncoder('utf-8'); + + target.sizeofIR = (n) => { + switch (n) { + 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 ptrSizeof; + default: + return ('' + n).endsWith('*') ? ptrSizeof : undefined; + } + }; + + const heapWrappers = function () { + if (!cache.memory) { + cache.memory = + target.memory instanceof WebAssembly.Memory + ? target.memory + : target.exports.memory; + } else if (cache.heapSize === cache.memory.buffer.byteLength) { + return cache; + } + + const b = cache.memory.buffer; + cache.HEAP8 = new Int8Array(b); + cache.HEAP8U = new Uint8Array(b); + cache.HEAP16 = new Int16Array(b); + cache.HEAP16U = new Uint16Array(b); + cache.HEAP32 = new Int32Array(b); + cache.HEAP32U = new Uint32Array(b); + if (target.bigIntEnabled) { + cache.HEAP64 = new BigInt64Array(b); + cache.HEAP64U = new BigUint64Array(b); + } + cache.HEAP32F = new Float32Array(b); + cache.HEAP64F = new Float64Array(b); + cache.heapSize = b.byteLength; + return cache; + }; + + target.heap8 = () => heapWrappers().HEAP8; + + target.heap8u = () => heapWrappers().HEAP8U; + + target.heap16 = () => heapWrappers().HEAP16; + + target.heap16u = () => heapWrappers().HEAP16U; + + target.heap32 = () => heapWrappers().HEAP32; + + target.heap32u = () => heapWrappers().HEAP32U; + + target.heapForSize = function (n, unsigned = true) { + let ctor; + const c = + cache.memory && cache.heapSize === cache.memory.buffer.byteLength + ? cache + : heapWrappers(); + switch (n) { + case Int8Array: + return c.HEAP8; + case Uint8Array: + return c.HEAP8U; + case Int16Array: + return c.HEAP16; + case Uint16Array: + return c.HEAP16U; + case Int32Array: + return c.HEAP32; + case Uint32Array: + return c.HEAP32U; + case 8: + return unsigned ? c.HEAP8U : c.HEAP8; + case 16: + return unsigned ? c.HEAP16U : c.HEAP16; + case 32: + return unsigned ? c.HEAP32U : c.HEAP32; + case 64: + if (c.HEAP64) return unsigned ? c.HEAP64U : c.HEAP64; + break; + default: + if (target.bigIntEnabled) { + if (n === globalThis['BigUint64Array']) return c.HEAP64U; + else if (n === globalThis['BigInt64Array']) return c.HEAP64; + break; + } + } + toss( + 'Invalid heapForSize() size: expecting 8, 16, 32,', + 'or (if BigInt is enabled) 64.', + ); + }; + + target.functionTable = function () { + return target.exports.__indirect_function_table; + }; + + target.functionEntry = function (fptr) { + const ft = target.functionTable(); + return fptr < ft.length ? ft.get(fptr) : undefined; + }; + + target.jsFuncToWasm = function f(func, sig) { + if (!f._) { + f._ = { + 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: 0x7c, + f32: 0x7d, + i64: 0x7e, + i32: 0x7f, + }), + + uleb128Encode: function (tgt, method, n) { + if (n < 128) tgt[method](n); + else tgt[method](n % 128 | 128, n >> 7); + }, + + rxJSig: /^(\w)\((\w*)\)$/, + + sigParams: function (sig) { + const m = f._.rxJSig.exec(sig); + return m ? m[2] : sig.substr(1); + }, + + letterType: (x) => + f._.sigTypes[x] || toss('Invalid signature letter:', x), + + pushSigType: (dest, letter) => + dest.push(f._.typeCodes[f._.letterType(letter)]), + }; + } + if ('string' === typeof func) { + const x = sig; + sig = func; + func = x; + } + const sigParams = f._.sigParams(sig); + const wasmCode = [0x01, 0x60]; + f._.uleb128Encode(wasmCode, 'push', sigParams.length); + for (const x of sigParams) f._.pushSigType(wasmCode, x); + if ('v' === sig[0]) wasmCode.push(0); + else { + wasmCode.push(1); + f._.pushSigType(wasmCode, sig[0]); + } + f._.uleb128Encode(wasmCode, 'unshift', wasmCode.length); + wasmCode.unshift( + 0x00, + 0x61, + 0x73, + 0x6d, + 0x01, + 0x00, + 0x00, + 0x00, + 0x01, + ); + wasmCode.push( + 0x02, + 0x07, + + 0x01, + 0x01, + 0x65, + 0x01, + 0x66, + 0x00, + 0x00, + 0x07, + 0x05, + + 0x01, + 0x01, + 0x66, + 0x00, + 0x00, + ); + return new WebAssembly.Instance( + new WebAssembly.Module(new Uint8Array(wasmCode)), + { + e: { f: func }, + }, + ).exports['f']; + }; + + const __installFunction = function f(func, sig, scoped) { + if (scoped && !cache.scopedAlloc.length) { + toss('No scopedAllocPush() scope is active.'); + } + if ('string' === typeof func) { + const x = sig; + sig = func; + func = x; + } + if ('string' !== typeof sig || !(func instanceof Function)) { + toss( + 'Invalid arguments: expecting (function,signature) ' + + 'or (signature,function).', + ); + } + const ft = target.functionTable(); + const oldLen = ft.length; + let ptr; + while (cache.freeFuncIndexes.length) { + ptr = cache.freeFuncIndexes.pop(); + if (ft.get(ptr)) { + ptr = null; + continue; + } else { + break; + } + } + if (!ptr) { + ptr = oldLen; + ft.grow(1); + } + try { + ft.set(ptr, func); + if (scoped) { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(ptr); + } + return ptr; + } catch (e) { + if (!(e instanceof TypeError)) { + if (ptr === oldLen) cache.freeFuncIndexes.push(oldLen); + throw e; + } + } + + try { + const fptr = target.jsFuncToWasm(func, sig); + ft.set(ptr, fptr); + if (scoped) { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(ptr); + } + } catch (e) { + if (ptr === oldLen) cache.freeFuncIndexes.push(oldLen); + throw e; + } + return ptr; + }; + + target.installFunction = (func, sig) => + __installFunction(func, sig, false); + + target.scopedInstallFunction = (func, sig) => + __installFunction(func, sig, true); + + target.uninstallFunction = function (ptr) { + if (!ptr && 0 !== ptr) return undefined; + const fi = cache.freeFuncIndexes; + const ft = target.functionTable(); + fi.push(ptr); + const rc = ft.get(ptr); + ft.set(ptr, null); + return rc; + }; + + target.peek = function f(ptr, type = 'i8') { + if (type.endsWith('*')) type = ptrIR; + const c = + cache.memory && cache.heapSize === cache.memory.buffer.byteLength + ? cache + : heapWrappers(); + const list = Array.isArray(ptr) ? [] : undefined; + let rc; + do { + if (list) ptr = arguments[0].shift(); + switch (type) { + case 'i1': + case 'i8': + rc = c.HEAP8[ptr >> 0]; + break; + case 'i16': + rc = c.HEAP16[ptr >> 1]; + break; + case 'i32': + rc = c.HEAP32[ptr >> 2]; + break; + case 'float': + case 'f32': + rc = c.HEAP32F[ptr >> 2]; + break; + case 'double': + case 'f64': + rc = Number(c.HEAP64F[ptr >> 3]); + break; + case 'i64': + if (target.bigIntEnabled) { + rc = BigInt(c.HEAP64[ptr >> 3]); + break; + } + + default: + toss('Invalid type for peek():', type); + } + if (list) list.push(rc); + } while (list && arguments[0].length); + return list || rc; + }; + + target.poke = function (ptr, value, type = 'i8') { + if (type.endsWith('*')) type = ptrIR; + const c = + cache.memory && cache.heapSize === cache.memory.buffer.byteLength + ? cache + : heapWrappers(); + for (const p of Array.isArray(ptr) ? ptr : [ptr]) { + switch (type) { + case 'i1': + case 'i8': + c.HEAP8[p >> 0] = value; + continue; + case 'i16': + c.HEAP16[p >> 1] = value; + continue; + case 'i32': + c.HEAP32[p >> 2] = value; + continue; + case 'float': + case 'f32': + c.HEAP32F[p >> 2] = value; + continue; + case 'double': + case 'f64': + c.HEAP64F[p >> 3] = value; + continue; + case 'i64': + if (c.HEAP64) { + c.HEAP64[p >> 3] = BigInt(value); + continue; + } + + default: + toss('Invalid type for poke(): ' + type); + } + } + return this; + }; + + target.peekPtr = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, ptrIR); + + target.pokePtr = (ptr, value = 0) => target.poke(ptr, value, ptrIR); + + target.peek8 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i8'); + + target.poke8 = (ptr, value) => target.poke(ptr, value, 'i8'); + + target.peek16 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i16'); + + target.poke16 = (ptr, value) => target.poke(ptr, value, 'i16'); + + target.peek32 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i32'); + + target.poke32 = (ptr, value) => target.poke(ptr, value, 'i32'); + + target.peek64 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i64'); + + target.poke64 = (ptr, value) => target.poke(ptr, value, 'i64'); + + target.peek32f = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'f32'); + + target.poke32f = (ptr, value) => target.poke(ptr, value, 'f32'); + + target.peek64f = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'f64'); + + target.poke64f = (ptr, value) => target.poke(ptr, value, 'f64'); + + target.getMemValue = target.peek; + + target.getPtrValue = target.peekPtr; + + target.setMemValue = target.poke; + + target.setPtrValue = target.pokePtr; + + target.isPtr32 = (ptr) => + 'number' === typeof ptr && ptr === (ptr | 0) && ptr >= 0; + + target.isPtr = target.isPtr32; + + target.cstrlen = function (ptr) { + if (!ptr || !target.isPtr(ptr)) return null; + const h = heapWrappers().HEAP8U; + let pos = ptr; + for (; h[pos] !== 0; ++pos) {} + return pos - ptr; + }; + + const __SAB = + 'undefined' === typeof SharedArrayBuffer + ? function () {} + : SharedArrayBuffer; + const __utf8Decode = function (arrayBuffer, begin, end) { + return cache.utf8Decoder.decode( + arrayBuffer.buffer instanceof __SAB + ? arrayBuffer.slice(begin, end) + : arrayBuffer.subarray(begin, end), + ); + }; + + target.cstrToJs = function (ptr) { + const n = target.cstrlen(ptr); + return n + ? __utf8Decode(heapWrappers().HEAP8U, ptr, ptr + n) + : null === n + ? n + : ''; + }; + + target.jstrlen = function (str) { + if ('string' !== typeof str) return null; + const n = str.length; + let len = 0; + for (let i = 0; i < n; ++i) { + let u = str.charCodeAt(i); + if (u >= 0xd800 && u <= 0xdfff) { + u = + (0x10000 + ((u & 0x3ff) << 10)) | (str.charCodeAt(++i) & 0x3ff); + } + if (u <= 0x7f) ++len; + else if (u <= 0x7ff) len += 2; + else if (u <= 0xffff) len += 3; + else len += 4; + } + return len; + }; + + target.jstrcpy = function ( + jstr, + tgt, + offset = 0, + maxBytes = -1, + addNul = true, + ) { + if ( + !tgt || + (!(tgt instanceof Int8Array) && !(tgt instanceof Uint8Array)) + ) { + toss('jstrcpy() target must be an Int8Array or Uint8Array.'); + } + if (maxBytes < 0) maxBytes = tgt.length - offset; + if (!(maxBytes > 0) || !(offset >= 0)) return 0; + let i = 0, + max = jstr.length; + const begin = offset, + end = offset + maxBytes - (addNul ? 1 : 0); + for (; i < max && offset < end; ++i) { + let u = jstr.charCodeAt(i); + if (u >= 0xd800 && u <= 0xdfff) { + u = + (0x10000 + ((u & 0x3ff) << 10)) | + (jstr.charCodeAt(++i) & 0x3ff); + } + if (u <= 0x7f) { + if (offset >= end) break; + tgt[offset++] = u; + } else if (u <= 0x7ff) { + if (offset + 1 >= end) break; + tgt[offset++] = 0xc0 | (u >> 6); + tgt[offset++] = 0x80 | (u & 0x3f); + } else if (u <= 0xffff) { + if (offset + 2 >= end) break; + tgt[offset++] = 0xe0 | (u >> 12); + tgt[offset++] = 0x80 | ((u >> 6) & 0x3f); + tgt[offset++] = 0x80 | (u & 0x3f); + } else { + if (offset + 3 >= end) break; + tgt[offset++] = 0xf0 | (u >> 18); + tgt[offset++] = 0x80 | ((u >> 12) & 0x3f); + tgt[offset++] = 0x80 | ((u >> 6) & 0x3f); + tgt[offset++] = 0x80 | (u & 0x3f); + } + } + if (addNul) tgt[offset++] = 0; + return offset - begin; + }; + + target.cstrncpy = function (tgtPtr, srcPtr, n) { + if (!tgtPtr || !srcPtr) + toss('cstrncpy() does not accept NULL strings.'); + if (n < 0) n = target.cstrlen(strPtr) + 1; + else if (!(n > 0)) return 0; + const heap = target.heap8u(); + let i = 0, + ch; + for (; i < n && (ch = heap[srcPtr + i]); ++i) { + heap[tgtPtr + i] = ch; + } + if (i < n) heap[tgtPtr + i++] = 0; + return i; + }; + + target.jstrToUintArray = (str, addNul = false) => { + return cache.utf8Encoder.encode(addNul ? str + '\0' : str); + }; + + const __affirmAlloc = (obj, funcName) => { + if ( + !(obj.alloc instanceof Function) || + !(obj.dealloc instanceof Function) + ) { + toss( + 'Object is missing alloc() and/or dealloc() function(s)', + 'required by', + funcName + '().', + ); + } + }; + + const __allocCStr = function ( + jstr, + returnWithLength, + allocator, + funcName, + ) { + __affirmAlloc(target, funcName); + if ('string' !== typeof jstr) return null; + if (0) { + const n = target.jstrlen(jstr), + ptr = allocator(n + 1); + target.jstrcpy(jstr, target.heap8u(), ptr, n + 1, true); + return returnWithLength ? [ptr, n] : ptr; + } else { + const u = cache.utf8Encoder.encode(jstr), + ptr = allocator(u.length + 1), + heap = heapWrappers().HEAP8U; + heap.set(u, ptr); + heap[ptr + u.length] = 0; + return returnWithLength ? [ptr, u.length] : ptr; + } + }; + + target.allocCString = (jstr, returnWithLength = false) => + __allocCStr(jstr, returnWithLength, target.alloc, 'allocCString()'); + + target.scopedAllocPush = function () { + __affirmAlloc(target, 'scopedAllocPush'); + const a = []; + cache.scopedAlloc.push(a); + return a; + }; + + target.scopedAllocPop = function (state) { + __affirmAlloc(target, 'scopedAllocPop'); + const n = arguments.length + ? cache.scopedAlloc.indexOf(state) + : cache.scopedAlloc.length - 1; + if (n < 0) toss('Invalid state object for scopedAllocPop().'); + if (0 === arguments.length) state = cache.scopedAlloc[n]; + cache.scopedAlloc.splice(n, 1); + for (let p; (p = state.pop()); ) { + if (target.functionEntry(p)) { + target.uninstallFunction(p); + } else target.dealloc(p); + } + }; + + target.scopedAlloc = function (n) { + if (!cache.scopedAlloc.length) { + toss('No scopedAllocPush() scope is active.'); + } + const p = target.alloc(n); + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(p); + return p; + }; + + Object.defineProperty(target.scopedAlloc, 'level', { + configurable: false, + enumerable: false, + get: () => cache.scopedAlloc.length, + set: () => toss("The 'active' property is read-only."), + }); + + target.scopedAllocCString = (jstr, returnWithLength = false) => + __allocCStr( + jstr, + returnWithLength, + target.scopedAlloc, + 'scopedAllocCString()', + ); + + const __allocMainArgv = function (isScoped, list) { + const pList = target[isScoped ? 'scopedAlloc' : 'alloc']( + (list.length + 1) * target.ptrSizeof, + ); + let i = 0; + list.forEach((e) => { + target.pokePtr( + pList + target.ptrSizeof * i++, + target[isScoped ? 'scopedAllocCString' : 'allocCString']('' + e), + ); + }); + target.pokePtr(pList + target.ptrSizeof * i, 0); + return pList; + }; + + target.scopedAllocMainArgv = (list) => __allocMainArgv(true, list); + + target.allocMainArgv = (list) => __allocMainArgv(false, list); + + target.cArgvToJs = (argc, pArgv) => { + const list = []; + for (let i = 0; i < argc; ++i) { + const arg = target.peekPtr(pArgv + target.ptrSizeof * i); + list.push(arg ? target.cstrToJs(arg) : null); + } + return list; + }; + + target.scopedAllocCall = function (func) { + target.scopedAllocPush(); + try { + return func(); + } finally { + target.scopedAllocPop(); + } + }; + + const __allocPtr = function (howMany, safePtrSize, method) { + __affirmAlloc(target, method); + const pIr = safePtrSize ? 'i64' : ptrIR; + let m = target[method](howMany * (safePtrSize ? 8 : ptrSizeof)); + target.poke(m, 0, pIr); + if (1 === howMany) { + return m; + } + const a = [m]; + for (let i = 1; i < howMany; ++i) { + m += safePtrSize ? 8 : ptrSizeof; + a[i] = m; + target.poke(m, 0, pIr); + } + return a; + }; + + target.allocPtr = (howMany = 1, safePtrSize = true) => + __allocPtr(howMany, safePtrSize, 'alloc'); + + target.scopedAllocPtr = (howMany = 1, safePtrSize = true) => + __allocPtr(howMany, safePtrSize, 'scopedAlloc'); + + target.xGet = function (name) { + return ( + target.exports[name] || toss('Cannot find exported symbol:', name) + ); + }; + + const __argcMismatch = (f, n) => + toss(f + '() requires', n, 'argument(s).'); + + target.xCall = function (fname, ...args) { + const f = fname instanceof Function ? fname : target.xGet(fname); + if (!(f instanceof Function)) + toss('Exported symbol', fname, 'is not a function.'); + if (f.length !== args.length) + __argcMismatch(f === fname ? f.name : fname, f.length); + return 2 === arguments.length && Array.isArray(arguments[1]) + ? f.apply(null, arguments[1]) + : f.apply(null, args); + }; + + cache.xWrap = Object.create(null); + cache.xWrap.convert = Object.create(null); + + cache.xWrap.convert.arg = new Map(); + + cache.xWrap.convert.result = new Map(); + const xArg = cache.xWrap.convert.arg, + xResult = cache.xWrap.convert.result; + + if (target.bigIntEnabled) { + xArg.set('i64', (i) => BigInt(i)); + } + const __xArgPtr = + 'i32' === ptrIR ? (i) => i | 0 : (i) => BigInt(i) | BigInt(0); + xArg + .set('i32', __xArgPtr) + .set('i16', (i) => (i | 0) & 0xffff) + .set('i8', (i) => (i | 0) & 0xff) + .set('f32', (i) => Number(i).valueOf()) + .set('float', xArg.get('f32')) + .set('f64', xArg.get('f32')) + .set('double', xArg.get('f64')) + .set('int', xArg.get('i32')) + .set('null', (i) => i) + .set(null, xArg.get('null')) + .set('**', __xArgPtr) + .set('*', __xArgPtr); + xResult + .set('*', __xArgPtr) + .set('pointer', __xArgPtr) + .set('number', (v) => Number(v)) + .set('void', (v) => undefined) + .set('null', (v) => v) + .set(null, xResult.get('null')); + + { + const copyToResult = [ + 'i8', + 'i16', + 'i32', + 'int', + 'f32', + 'float', + 'f64', + 'double', + ]; + if (target.bigIntEnabled) copyToResult.push('i64'); + const adaptPtr = xArg.get(ptrIR); + for (const t of copyToResult) { + xArg.set(t + '*', adaptPtr); + xResult.set(t + '*', adaptPtr); + xResult.set(t, xArg.get(t) || toss('Missing arg converter:', t)); + } + } + + const __xArgString = function (v) { + if ('string' === typeof v) return target.scopedAllocCString(v); + return v ? __xArgPtr(v) : null; + }; + xArg + .set('string', __xArgString) + .set('utf8', __xArgString) + .set('pointer', __xArgString); + + xResult + .set('string', (i) => target.cstrToJs(i)) + .set('utf8', xResult.get('string')) + .set('string:dealloc', (i) => { + try { + return i ? target.cstrToJs(i) : null; + } finally { + target.dealloc(i); + } + }) + .set('utf8:dealloc', xResult.get('string:dealloc')) + .set('json', (i) => JSON.parse(target.cstrToJs(i))) + .set('json:dealloc', (i) => { + try { + return i ? JSON.parse(target.cstrToJs(i)) : null; + } finally { + target.dealloc(i); + } + }); + + const AbstractArgAdapter = class { + constructor(opt) { + this.name = opt.name || 'unnamed adapter'; + } + + convertArg(v, argv, argIndex) { + toss('AbstractArgAdapter must be subclassed.'); + } + }; + + xArg.FuncPtrAdapter = class FuncPtrAdapter extends AbstractArgAdapter { + constructor(opt) { + super(opt); + if (xArg.FuncPtrAdapter.warnOnUse) { + console.warn( + 'xArg.FuncPtrAdapter is an internal-only API', + 'and is not intended to be invoked from', + 'client-level code. Invoked with:', + opt, + ); + } + this.name = opt.name || 'unnamed'; + this.signature = opt.signature; + if (opt.contextKey instanceof Function) { + this.contextKey = opt.contextKey; + if (!opt.bindScope) opt.bindScope = 'context'; + } + this.bindScope = + opt.bindScope || + toss( + 'FuncPtrAdapter options requires a bindScope (explicit or implied).', + ); + if (FuncPtrAdapter.bindScopes.indexOf(opt.bindScope) < 0) { + toss( + 'Invalid options.bindScope (' + + opt.bindMod + + ') for FuncPtrAdapter. ' + + 'Expecting one of: (' + + FuncPtrAdapter.bindScopes.join(', ') + + ')', + ); + } + this.isTransient = 'transient' === this.bindScope; + this.isContext = 'context' === this.bindScope; + this.isPermanent = 'permanent' === this.bindScope; + this.singleton = 'singleton' === this.bindScope ? [] : undefined; + + this.callProxy = + opt.callProxy instanceof Function ? opt.callProxy : undefined; + } + + contextKey(argv, argIndex) { + return this; + } + + contextMap(key) { + const cm = this.__cmap || (this.__cmap = new Map()); + let rc = cm.get(key); + if (undefined === rc) cm.set(key, (rc = [])); + return rc; + } + + convertArg(v, argv, argIndex) { + let pair = this.singleton; + if (!pair && this.isContext) { + pair = this.contextMap(this.contextKey(argv, argIndex)); + } + if (pair && pair[0] === v) return pair[1]; + if (v instanceof Function) { + if (this.callProxy) v = this.callProxy(v); + const fp = __installFunction(v, this.signature, this.isTransient); + if (FuncPtrAdapter.debugFuncInstall) { + FuncPtrAdapter.debugOut( + 'FuncPtrAdapter installed', + this, + this.contextKey(argv, argIndex), + '@' + fp, + v, + ); + } + if (pair) { + if (pair[1]) { + if (FuncPtrAdapter.debugFuncInstall) { + FuncPtrAdapter.debugOut( + 'FuncPtrAdapter uninstalling', + this, + this.contextKey(argv, argIndex), + '@' + pair[1], + v, + ); + } + try { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push( + pair[1], + ); + } catch (e) {} + } + pair[0] = v; + pair[1] = fp; + } + return fp; + } else if (target.isPtr(v) || null === v || undefined === v) { + if (pair && pair[1] && pair[1] !== v) { + if (FuncPtrAdapter.debugFuncInstall) { + FuncPtrAdapter.debugOut( + 'FuncPtrAdapter uninstalling', + this, + this.contextKey(argv, argIndex), + '@' + pair[1], + v, + ); + } + try { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(pair[1]); + } catch (e) {} + pair[0] = pair[1] = v | 0; + } + return v || 0; + } else { + throw new TypeError( + 'Invalid FuncPtrAdapter argument type. ' + + 'Expecting a function pointer or a ' + + (this.name ? this.name + ' ' : '') + + 'function matching signature ' + + this.signature + + '.', + ); + } + } + }; + + xArg.FuncPtrAdapter.warnOnUse = false; + + xArg.FuncPtrAdapter.debugFuncInstall = false; + + xArg.FuncPtrAdapter.debugOut = console.debug.bind(console); + + xArg.FuncPtrAdapter.bindScopes = [ + 'transient', + 'context', + 'singleton', + 'permanent', + ]; + + const __xArgAdapterCheck = (t) => + xArg.get(t) || toss('Argument adapter not found:', t); + + const __xResultAdapterCheck = (t) => + xResult.get(t) || toss('Result adapter not found:', t); + + cache.xWrap.convertArg = (t, ...args) => __xArgAdapterCheck(t)(...args); + + cache.xWrap.convertArgNoCheck = (t, ...args) => xArg.get(t)(...args); + + cache.xWrap.convertResult = (t, v) => + null === t ? v : t ? __xResultAdapterCheck(t)(v) : undefined; + + cache.xWrap.convertResultNoCheck = (t, v) => + null === t ? v : t ? xResult.get(t)(v) : undefined; + + target.xWrap = function (fArg, resultType, ...argTypes) { + if (3 === arguments.length && Array.isArray(arguments[2])) { + argTypes = arguments[2]; + } + if (target.isPtr(fArg)) { + fArg = + target.functionEntry(fArg) || + toss('Function pointer not found in WASM function table.'); + } + const fIsFunc = fArg instanceof Function; + const xf = fIsFunc ? fArg : target.xGet(fArg); + if (fIsFunc) fArg = xf.name || 'unnamed function'; + if (argTypes.length !== xf.length) __argcMismatch(fArg, xf.length); + if (null === resultType && 0 === xf.length) { + return xf; + } + if (undefined !== resultType && null !== resultType) + __xResultAdapterCheck(resultType); + for (const t of argTypes) { + if (t instanceof AbstractArgAdapter) + xArg.set(t, (...args) => t.convertArg(...args)); + else __xArgAdapterCheck(t); + } + const cxw = cache.xWrap; + if (0 === xf.length) { + return (...args) => + args.length + ? __argcMismatch(fArg, xf.length) + : cxw.convertResult(resultType, xf.call(null)); + } + return function (...args) { + if (args.length !== xf.length) __argcMismatch(fArg, xf.length); + const scope = target.scopedAllocPush(); + try { + let i = 0; + for (; i < args.length; ++i) + args[i] = cxw.convertArgNoCheck(argTypes[i], args[i], args, i); + return cxw.convertResultNoCheck(resultType, xf.apply(null, args)); + } finally { + target.scopedAllocPop(scope); + } + }; + }; + + const __xAdapter = function ( + func, + argc, + typeName, + adapter, + modeName, + xcvPart, + ) { + if ('string' === typeof typeName) { + if (1 === argc) return xcvPart.get(typeName); + else if (2 === argc) { + if (!adapter) { + xcvPart.delete(typeName); + return func; + } else if (!(adapter instanceof Function)) { + toss(modeName, 'requires a function argument.'); + } + xcvPart.set(typeName, adapter); + return func; + } + } + toss('Invalid arguments to', modeName); + }; + + target.xWrap.resultAdapter = function f(typeName, adapter) { + return __xAdapter( + f, + arguments.length, + typeName, + adapter, + 'resultAdapter()', + xResult, + ); + }; + + target.xWrap.argAdapter = function f(typeName, adapter) { + return __xAdapter( + f, + arguments.length, + typeName, + adapter, + 'argAdapter()', + xArg, + ); + }; + + target.xWrap.FuncPtrAdapter = xArg.FuncPtrAdapter; + + target.xCallWrapped = function (fArg, resultType, argTypes, ...args) { + if (Array.isArray(arguments[3])) args = arguments[3]; + return target + .xWrap(fArg, resultType, argTypes || []) + .apply(null, args || []); + }; + + target.xWrap.testConvertArg = cache.xWrap.convertArg; + + target.xWrap.testConvertResult = cache.xWrap.convertResult; + + return target; + }; + + globalThis.WhWasmUtilInstaller.yawl = function (config) { + const wfetch = () => fetch(config.uri, { credentials: 'same-origin' }); + const wui = this; + const finalThen = function (arg) { + if (config.wasmUtilTarget) { + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + const tgt = config.wasmUtilTarget; + tgt.module = arg.module; + tgt.instance = arg.instance; + + if (!tgt.instance.exports.memory) { + tgt.memory = + (config.imports && + config.imports.env && + config.imports.env.memory) || + toss("Missing 'memory' object!"); + } + if (!tgt.alloc && arg.instance.exports.malloc) { + const exports = arg.instance.exports; + tgt.alloc = function (n) { + return ( + exports.malloc(n) || toss('Allocation of', n, 'bytes failed.') + ); + }; + tgt.dealloc = function (m) { + exports.free(m); + }; + } + wui(tgt); + } + if (config.onload) config.onload(arg, config); + return arg; + }; + const loadWasm = WebAssembly.instantiateStreaming + ? function loadWasmStreaming() { + return WebAssembly.instantiateStreaming( + wfetch(), + config.imports || {}, + ).then(finalThen); + } + : function loadWasmOldSchool() { + return wfetch() + .then((response) => response.arrayBuffer()) + .then((bytes) => + WebAssembly.instantiate(bytes, config.imports || {}), + ) + .then(finalThen); + }; + return loadWasm; + }.bind(globalThis.WhWasmUtilInstaller); + + ('use strict'); + globalThis.Jaccwabyt = function StructBinderFactory(config) { + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + + if ( + !(config.heap instanceof WebAssembly.Memory) && + !(config.heap instanceof Function) + ) { + toss( + 'config.heap must be WebAssembly.Memory instance or a function.', + ); + } + ['alloc', 'dealloc'].forEach(function (k) { + config[k] instanceof Function || + toss("Config option '" + k + "' must be a function."); + }); + const SBF = StructBinderFactory; + const heap = + config.heap instanceof Function + ? config.heap + : () => new Uint8Array(config.heap.buffer), + alloc = config.alloc, + dealloc = config.dealloc, + log = config.log || console.log.bind(console), + memberPrefix = config.memberPrefix || '', + memberSuffix = config.memberSuffix || '', + bigIntEnabled = + undefined === config.bigIntEnabled + ? !!globalThis['BigInt64Array'] + : !!config.bigIntEnabled, + BigInt = globalThis['BigInt'], + BigInt64Array = globalThis['BigInt64Array'], + ptrSizeof = config.ptrSizeof || 4, + ptrIR = config.ptrIR || 'i32'; + if (!SBF.debugFlags) { + SBF.__makeDebugFlags = function (deriveFrom = null) { + if (deriveFrom && deriveFrom.__flags) + deriveFrom = deriveFrom.__flags; + const f = function f(flags) { + if (0 === arguments.length) { + return f.__flags; + } + if (flags < 0) { + delete f.__flags.getter; + delete f.__flags.setter; + delete f.__flags.alloc; + delete f.__flags.dealloc; + } else { + f.__flags.getter = 0 !== (0x01 & flags); + f.__flags.setter = 0 !== (0x02 & flags); + f.__flags.alloc = 0 !== (0x04 & flags); + f.__flags.dealloc = 0 !== (0x08 & flags); + } + return f._flags; + }; + Object.defineProperty(f, '__flags', { + iterable: false, + writable: false, + value: Object.create(deriveFrom), + }); + if (!deriveFrom) f(0); + return f; + }; + SBF.debugFlags = SBF.__makeDebugFlags(); + } + + const isLittleEndian = (function () { + const buffer = new ArrayBuffer(2); + new DataView(buffer).setInt16(0, 256, true); + + return new Int16Array(buffer)[0] === 256; + })(); + + const isFuncSig = (s) => '(' === s[1]; + + const isPtrSig = (s) => 'p' === s || 'P' === s; + const isAutoPtrSig = (s) => 'P' === s; + const sigLetter = (s) => (isFuncSig(s) ? 'p' : s[0]); + + const sigIR = function (s) { + switch (sigLetter(s)) { + case 'c': + case 'C': + return 'i8'; + case 'i': + return 'i32'; + case 'p': + case 'P': + case 's': + return ptrIR; + case 'j': + return 'i64'; + case 'f': + return 'float'; + case 'd': + return 'double'; + } + toss('Unhandled signature IR:', s); + }; + + const affirmBigIntArray = BigInt64Array + ? () => true + : () => toss('BigInt64Array is not available.'); + + const sigDVGetter = function (s) { + switch (sigLetter(s)) { + case 'p': + case 'P': + case 's': { + switch (ptrSizeof) { + case 4: + return 'getInt32'; + case 8: + return affirmBigIntArray() && 'getBigInt64'; + } + break; + } + case 'i': + return 'getInt32'; + case 'c': + return 'getInt8'; + case 'C': + return 'getUint8'; + case 'j': + return affirmBigIntArray() && 'getBigInt64'; + case 'f': + return 'getFloat32'; + case 'd': + return 'getFloat64'; + } + toss('Unhandled DataView getter for signature:', s); + }; + + const sigDVSetter = function (s) { + switch (sigLetter(s)) { + case 'p': + case 'P': + case 's': { + switch (ptrSizeof) { + case 4: + return 'setInt32'; + case 8: + return affirmBigIntArray() && 'setBigInt64'; + } + break; + } + case 'i': + return 'setInt32'; + case 'c': + return 'setInt8'; + case 'C': + return 'setUint8'; + case 'j': + return affirmBigIntArray() && 'setBigInt64'; + case 'f': + return 'setFloat32'; + case 'd': + return 'setFloat64'; + } + toss('Unhandled DataView setter for signature:', s); + }; + + const sigDVSetWrapper = function (s) { + switch (sigLetter(s)) { + case 'i': + case 'f': + case 'c': + case 'C': + case 'd': + return Number; + case 'j': + return affirmBigIntArray() && BigInt; + case 'p': + case 'P': + case 's': + switch (ptrSizeof) { + case 4: + return Number; + case 8: + return affirmBigIntArray() && BigInt; + } + break; + } + toss('Unhandled DataView set wrapper for signature:', s); + }; + + const sPropName = (s, k) => s + '::' + k; + + const __propThrowOnSet = function (structName, propName) { + return () => toss(sPropName(structName, propName), 'is read-only.'); + }; + + const __instancePointerMap = new WeakMap(); + + const xPtrPropName = '(pointer-is-external)'; + + const __freeStruct = function (ctor, obj, m) { + if (!m) m = __instancePointerMap.get(obj); + if (m) { + __instancePointerMap.delete(obj); + if (Array.isArray(obj.ondispose)) { + let x; + while ((x = obj.ondispose.shift())) { + try { + if (x instanceof Function) x.call(obj); + else if (x instanceof StructType) x.dispose(); + else if ('number' === typeof x) dealloc(x); + } catch (e) { + console.warn( + 'ondispose() for', + ctor.structName, + '@', + m, + 'threw. NOT propagating it.', + e, + ); + } + } + } else if (obj.ondispose instanceof Function) { + try { + obj.ondispose(); + } catch (e) { + console.warn( + 'ondispose() for', + ctor.structName, + '@', + m, + 'threw. NOT propagating it.', + e, + ); + } + } + delete obj.ondispose; + if (ctor.debugFlags.__flags.dealloc) { + log( + 'debug.dealloc:', + obj[xPtrPropName] ? 'EXTERNAL' : '', + ctor.structName, + 'instance:', + ctor.structInfo.sizeof, + 'bytes @' + m, + ); + } + if (!obj[xPtrPropName]) dealloc(m); + } + }; + + const rop = (v) => { + return { + configurable: false, + writable: false, + iterable: false, + value: v, + }; + }; + + const __allocStruct = function (ctor, obj, m) { + let fill = !m; + if (m) Object.defineProperty(obj, xPtrPropName, rop(m)); + else { + m = alloc(ctor.structInfo.sizeof); + if (!m) toss('Allocation of', ctor.structName, 'structure failed.'); + } + try { + if (ctor.debugFlags.__flags.alloc) { + log( + 'debug.alloc:', + fill ? '' : 'EXTERNAL', + ctor.structName, + 'instance:', + ctor.structInfo.sizeof, + 'bytes @' + m, + ); + } + if (fill) heap().fill(0, m, m + ctor.structInfo.sizeof); + __instancePointerMap.set(obj, m); + } catch (e) { + __freeStruct(ctor, obj, m); + throw e; + } + }; + + const __memoryDump = function () { + const p = this.pointer; + return p + ? new Uint8Array(heap().slice(p, p + this.structInfo.sizeof)) + : null; + }; + + const __memberKey = (k) => memberPrefix + k + memberSuffix; + const __memberKeyProp = rop(__memberKey); + + const __lookupMember = function ( + structInfo, + memberName, + tossIfNotFound = true, + ) { + let m = structInfo.members[memberName]; + if (!m && (memberPrefix || memberSuffix)) { + for (const v of Object.values(structInfo.members)) { + if (v.key === memberName) { + m = v; + break; + } + } + if (!m && tossIfNotFound) { + toss( + sPropName(structInfo.name, memberName), + 'is not a mapped struct member.', + ); + } + } + return m; + }; + + const __memberSignature = function f( + obj, + memberName, + emscriptenFormat = false, + ) { + if (!f._) + f._ = (x) => + x.replace(/[^vipPsjrdcC]/g, '').replace(/[pPscC]/g, 'i'); + const m = __lookupMember(obj.structInfo, memberName, true); + return emscriptenFormat ? f._(m.signature) : m.signature; + }; + + const __ptrPropDescriptor = { + configurable: false, + enumerable: false, + get: function () { + return __instancePointerMap.get(this); + }, + set: () => toss("Cannot assign the 'pointer' property of a struct."), + }; + + const __structMemberKeys = rop(function () { + const a = []; + for (const k of Object.keys(this.structInfo.members)) { + a.push(this.memberKey(k)); + } + return a; + }); + + const __utf8Decoder = new TextDecoder('utf-8'); + const __utf8Encoder = new TextEncoder(); + + const __SAB = + 'undefined' === typeof SharedArrayBuffer + ? function () {} + : SharedArrayBuffer; + const __utf8Decode = function (arrayBuffer, begin, end) { + return __utf8Decoder.decode( + arrayBuffer.buffer instanceof __SAB + ? arrayBuffer.slice(begin, end) + : arrayBuffer.subarray(begin, end), + ); + }; + + const __memberIsString = function ( + obj, + memberName, + tossIfNotFound = false, + ) { + const m = __lookupMember(obj.structInfo, memberName, tossIfNotFound); + return m && 1 === m.signature.length && 's' === m.signature[0] + ? m + : false; + }; + + const __affirmCStringSignature = function (member) { + if ('s' === member.signature) return; + toss( + 'Invalid member type signature for C-string value:', + JSON.stringify(member), + ); + }; + + const __memberToJsString = function f(obj, memberName) { + const m = __lookupMember(obj.structInfo, memberName, true); + __affirmCStringSignature(m); + const addr = obj[m.key]; + + if (!addr) return null; + let pos = addr; + const mem = heap(); + for (; mem[pos] !== 0; ++pos) {} + + return addr === pos ? '' : __utf8Decode(mem, addr, pos); + }; + + const __addOnDispose = function (obj, ...v) { + if (obj.ondispose) { + if (!Array.isArray(obj.ondispose)) { + obj.ondispose = [obj.ondispose]; + } + } else { + obj.ondispose = []; + } + obj.ondispose.push(...v); + }; + + const __allocCString = function (str) { + const u = __utf8Encoder.encode(str); + const mem = alloc(u.length + 1); + if (!mem) toss('Allocation error while duplicating string:', str); + const h = heap(); + + h.set(u, mem); + h[mem + u.length] = 0; + + return mem; + }; + + const __setMemberCString = function (obj, memberName, str) { + const m = __lookupMember(obj.structInfo, memberName, true); + __affirmCStringSignature(m); + + const mem = __allocCString(str); + obj[m.key] = mem; + __addOnDispose(obj, mem); + return obj; + }; + + const StructType = function ctor(structName, structInfo) { + if (arguments[2] !== rop) { + toss( + 'Do not call the StructType constructor', + 'from client-level code.', + ); + } + Object.defineProperties(this, { + structName: rop(structName), + structInfo: rop(structInfo), + }); + }; + + StructType.prototype = Object.create(null, { + dispose: rop(function () { + __freeStruct(this.constructor, this); + }), + lookupMember: rop(function (memberName, tossIfNotFound = true) { + return __lookupMember(this.structInfo, memberName, tossIfNotFound); + }), + memberToJsString: rop(function (memberName) { + return __memberToJsString(this, memberName); + }), + memberIsString: rop(function (memberName, tossIfNotFound = true) { + return __memberIsString(this, memberName, tossIfNotFound); + }), + memberKey: __memberKeyProp, + memberKeys: __structMemberKeys, + memberSignature: rop(function (memberName, emscriptenFormat = false) { + return __memberSignature(this, memberName, emscriptenFormat); + }), + memoryDump: rop(__memoryDump), + pointer: __ptrPropDescriptor, + setMemberCString: rop(function (memberName, str) { + return __setMemberCString(this, memberName, str); + }), + }); + + Object.assign(StructType.prototype, { + addOnDispose: function (...v) { + __addOnDispose(this, ...v); + return this; + }, + }); + + Object.defineProperties(StructType, { + allocCString: rop(__allocCString), + isA: rop((v) => v instanceof StructType), + hasExternalPointer: rop( + (v) => v instanceof StructType && !!v[xPtrPropName], + ), + memberKey: __memberKeyProp, + }); + + const isNumericValue = (v) => + Number.isFinite(v) || v instanceof (BigInt || Number); + + const makeMemberWrapper = function f(ctor, name, descr) { + if (!f._) { + f._ = { getters: {}, setters: {}, sw: {} }; + const a = ['i', 'c', 'C', 'p', 'P', 's', 'f', 'd', 'v()']; + if (bigIntEnabled) a.push('j'); + a.forEach(function (v) { + f._.getters[v] = sigDVGetter(v); + f._.setters[v] = sigDVSetter(v); + f._.sw[v] = sigDVSetWrapper(v); + }); + const rxSig1 = /^[ipPsjfdcC]$/, + rxSig2 = /^[vipPsjfdcC]\([ipPsjfdcC]*\)$/; + f.sigCheck = function (obj, name, key, sig) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + toss(obj.structName, 'already has a property named', key + '.'); + } + rxSig1.test(sig) || + rxSig2.test(sig) || + toss( + 'Malformed signature for', + sPropName(obj.structName, name) + ':', + sig, + ); + }; + } + const key = ctor.memberKey(name); + f.sigCheck(ctor.prototype, name, key, descr.signature); + descr.key = key; + descr.name = name; + const sigGlyph = sigLetter(descr.signature); + const xPropName = sPropName(ctor.prototype.structName, key); + const dbg = ctor.prototype.debugFlags.__flags; + + const prop = Object.create(null); + prop.configurable = false; + prop.enumerable = false; + prop.get = function () { + if (dbg.getter) { + log( + 'debug.getter:', + f._.getters[sigGlyph], + 'for', + sigIR(sigGlyph), + xPropName, + '@', + this.pointer, + '+', + descr.offset, + 'sz', + descr.sizeof, + ); + } + let rc = new DataView( + heap().buffer, + this.pointer + descr.offset, + descr.sizeof, + )[f._.getters[sigGlyph]](0, isLittleEndian); + if (dbg.getter) log('debug.getter:', xPropName, 'result =', rc); + return rc; + }; + if (descr.readOnly) { + prop.set = __propThrowOnSet(ctor.prototype.structName, key); + } else { + prop.set = function (v) { + if (dbg.setter) { + log( + 'debug.setter:', + f._.setters[sigGlyph], + 'for', + sigIR(sigGlyph), + xPropName, + '@', + this.pointer, + '+', + descr.offset, + 'sz', + descr.sizeof, + v, + ); + } + if (!this.pointer) { + toss('Cannot set struct property on disposed instance.'); + } + if (null === v) v = 0; + else + while (!isNumericValue(v)) { + if ( + isAutoPtrSig(descr.signature) && + v instanceof StructType + ) { + v = v.pointer || 0; + if (dbg.setter) + log('debug.setter:', xPropName, 'resolved to', v); + break; + } + toss('Invalid value for pointer-type', xPropName + '.'); + } + new DataView( + heap().buffer, + this.pointer + descr.offset, + descr.sizeof, + )[f._.setters[sigGlyph]](0, f._.sw[sigGlyph](v), isLittleEndian); + }; + } + Object.defineProperty(ctor.prototype, key, prop); + }; + + const StructBinder = function StructBinder(structName, structInfo) { + if (1 === arguments.length) { + structInfo = structName; + structName = structInfo.name; + } else if (!structInfo.name) { + structInfo.name = structName; + } + if (!structName) toss('Struct name is required.'); + let lastMember = false; + Object.keys(structInfo.members).forEach((k) => { + const m = structInfo.members[k]; + if (!m.sizeof) toss(structName, 'member', k, 'is missing sizeof.'); + else if (m.sizeof === 1) { + m.signature === 'c' || + m.signature === 'C' || + toss( + 'Unexpected sizeof==1 member', + sPropName(structInfo.name, k), + 'with signature', + m.signature, + ); + } else { + if (0 !== m.sizeof % 4) { + console.warn( + 'Invalid struct member description =', + m, + 'from', + structInfo, + ); + toss( + structName, + 'member', + k, + 'sizeof is not aligned. sizeof=' + m.sizeof, + ); + } + if (0 !== m.offset % 4) { + console.warn( + 'Invalid struct member description =', + m, + 'from', + structInfo, + ); + toss( + structName, + 'member', + k, + 'offset is not aligned. offset=' + m.offset, + ); + } + } + if (!lastMember || lastMember.offset < m.offset) lastMember = m; + }); + if (!lastMember) toss('No member property descriptions found.'); + else if (structInfo.sizeof < lastMember.offset + lastMember.sizeof) { + toss( + 'Invalid struct config:', + structName, + 'max member offset (' + lastMember.offset + ') ', + 'extends past end of struct (sizeof=' + structInfo.sizeof + ').', + ); + } + const debugFlags = rop(SBF.__makeDebugFlags(StructBinder.debugFlags)); + + const StructCtor = function StructCtor(externalMemory) { + if (!(this instanceof StructCtor)) { + toss( + 'The', + structName, + "constructor may only be called via 'new'.", + ); + } else if (arguments.length) { + if ( + externalMemory !== (externalMemory | 0) || + externalMemory <= 0 + ) { + toss('Invalid pointer value for', structName, 'constructor.'); + } + __allocStruct(StructCtor, this, externalMemory); + } else { + __allocStruct(StructCtor, this); + } + }; + Object.defineProperties(StructCtor, { + debugFlags: debugFlags, + isA: rop((v) => v instanceof StructCtor), + memberKey: __memberKeyProp, + memberKeys: __structMemberKeys, + methodInfoForKey: rop(function (mKey) {}), + structInfo: rop(structInfo), + structName: rop(structName), + }); + StructCtor.prototype = new StructType(structName, structInfo, rop); + Object.defineProperties(StructCtor.prototype, { + debugFlags: debugFlags, + constructor: rop(StructCtor), + }); + Object.keys(structInfo.members).forEach((name) => + makeMemberWrapper(StructCtor, name, structInfo.members[name]), + ); + return StructCtor; + }; + StructBinder.StructType = StructType; + StructBinder.config = config; + StructBinder.allocCString = __allocCString; + if (!StructBinder.debugFlags) { + StructBinder.debugFlags = SBF.__makeDebugFlags(SBF.debugFlags); + } + return StructBinder; + }; + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + 'use strict'; + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + const toss3 = sqlite3.SQLite3Error.toss; + const capi = sqlite3.capi, + wasm = sqlite3.wasm, + util = sqlite3.util; + globalThis.WhWasmUtilInstaller(wasm); + delete globalThis.WhWasmUtilInstaller; + + if (0) { + const dealloc = wasm.exports[sqlite3.config.deallocExportName]; + const nFunc = wasm.functionTable().length; + let i; + for (i = 0; i < nFunc; ++i) { + const e = wasm.functionEntry(i); + if (dealloc === e) { + capi.SQLITE_WASM_DEALLOC = i; + break; + } + } + if (dealloc !== wasm.functionEntry(capi.SQLITE_WASM_DEALLOC)) { + toss( + 'Internal error: cannot find function pointer for SQLITE_WASM_DEALLOC.', + ); + } + } + + wasm.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', undefined, '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 wasm.xWrap.FuncPtrAdapter({ + signature: 'i(pi)', + contextKey: (argv, argIndex) => argv[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 wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_commit_hook', + signature: 'i(p)', + contextKey: (argv) => argv[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 wasm.xWrap.FuncPtrAdapter({ + signature: 'i(pipp)', + bindScope: 'transient', + callProxy: (callback) => { + let aNames; + return (pVoid, nCols, pColVals, pColNames) => { + try { + const aVals = wasm.cArgvToJs(nCols, pColVals); + if (!aNames) aNames = wasm.cArgvToJs(nCols, pColNames); + return callback(aVals, aNames) | 0; + } catch (e) { + return e.resultCode || capi.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', undefined, '*'], + ['sqlite3_get_autocommit', 'int', 'sqlite3*'], + ['sqlite3_get_auxdata', '*', 'sqlite3_context*', 'int'], + ['sqlite3_initialize', undefined], + ['sqlite3_interrupt', undefined, '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', + undefined, + 'sqlite3_context*', + '*', + 'int', + '*', + ], + ['sqlite3_result_double', undefined, 'sqlite3_context*', 'f64'], + [ + 'sqlite3_result_error', + undefined, + 'sqlite3_context*', + 'string', + 'int', + ], + ['sqlite3_result_error_code', undefined, 'sqlite3_context*', 'int'], + ['sqlite3_result_error_nomem', undefined, 'sqlite3_context*'], + ['sqlite3_result_error_toobig', undefined, 'sqlite3_context*'], + ['sqlite3_result_int', undefined, 'sqlite3_context*', 'int'], + ['sqlite3_result_null', undefined, 'sqlite3_context*'], + [ + 'sqlite3_result_pointer', + undefined, + 'sqlite3_context*', + '*', + 'string:static', + '*', + ], + ['sqlite3_result_subtype', undefined, 'sqlite3_value*', 'int'], + [ + 'sqlite3_result_text', + undefined, + 'sqlite3_context*', + 'string', + 'int', + '*', + ], + ['sqlite3_result_zeroblob', undefined, 'sqlite3_context*', 'int'], + [ + 'sqlite3_rollback_hook', + 'void*', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_rollback_hook', + signature: 'v(p)', + contextKey: (argv) => argv[0], + }), + '*', + ], + ], + + [ + 'sqlite3_set_auxdata', + undefined, + [ + 'sqlite3_context*', + 'int', + '*', + true + ? '*' + : new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroyAuxData', + signature: 'v(p)', + contextKey: (argv, argIndex) => argv[0], + }), + ], + ], + ['sqlite3_shutdown', undefined], + ['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 wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_trace_v2::callback', + signature: 'i(ippp)', + contextKey: (argv, argIndex) => argv[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', undefined, '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*'], + ]; + + if (!!wasm.exports.sqlite3_progress_handler) { + wasm.bindingSignatures.push([ + 'sqlite3_progress_handler', + undefined, + [ + 'sqlite3*', + 'int', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xProgressHandler', + signature: 'i(p)', + bindScope: 'context', + contextKey: (argv, argIndex) => argv[0], + }), + '*', + ], + ]); + } + + if (!!wasm.exports.sqlite3_stmt_explain) { + wasm.bindingSignatures.push( + ['sqlite3_stmt_explain', 'int', 'sqlite3_stmt*', 'int'], + ['sqlite3_stmt_isexplain', 'int', 'sqlite3_stmt*'], + ); + } + + if (!!wasm.exports.sqlite3_set_authorizer) { + wasm.bindingSignatures.push([ + 'sqlite3_set_authorizer', + 'int', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_set_authorizer::xAuth', + signature: 'i(pi' + 'ssss)', + contextKey: (argv, argIndex) => argv[0], + callProxy: (callback) => { + return (pV, iCode, s0, s1, s2, s3) => { + try { + s0 = s0 && wasm.cstrToJs(s0); + s1 = s1 && wasm.cstrToJs(s1); + s2 = s2 && wasm.cstrToJs(s2); + s3 = s3 && wasm.cstrToJs(s3); + return callback(pV, iCode, s0, s1, s2, s3) || 0; + } catch (e) { + return e.resultCode || capi.SQLITE_ERROR; + } + }; + }, + }), + '*', + ], + ]); + } + + if (false && wasm.compileOptionUsed('SQLITE_ENABLE_NORMALIZE')) { + wasm.bindingSignatures.push([ + 'sqlite3_normalized_sql', + 'string', + 'sqlite3_stmt*', + ]); + } + + wasm.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', undefined, '*', 'i64'], + ['sqlite3_result_zeroblob64', 'int', '*', 'i64'], + ['sqlite3_serialize', '*', 'sqlite3*', 'string', '*', 'int'], + ['sqlite3_set_last_insert_rowid', undefined, ['sqlite3*', 'i64']], + ['sqlite3_status64', 'int', 'int', '*', '*', 'int'], + ['sqlite3_total_changes64', 'i64', ['sqlite3*']], + [ + 'sqlite3_update_hook', + '*', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_update_hook', + signature: 'v(iippj)', + contextKey: (argv) => argv[0], + callProxy: (callback) => { + return (p, op, z0, z1, rowid) => { + callback( + p, + op, + wasm.cstrToJs(z0), + wasm.cstrToJs(z1), + rowid, + ); + }; + }, + }), + '*', + ], + ], + ['sqlite3_uri_int64', 'i64', ['sqlite3_filename', 'string', 'i64']], + ['sqlite3_value_int64', 'i64', 'sqlite3_value*'], + ]; + + if (wasm.bigIntEnabled && !!wasm.exports.sqlite3_declare_vtab) { + wasm.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', + '**', + ], + ); + } + + if (wasm.bigIntEnabled && !!wasm.exports.sqlite3_preupdate_hook) { + wasm.bindingSignatures.int64.push( + ['sqlite3_preupdate_blobwrite', 'int', 'sqlite3*'], + ['sqlite3_preupdate_count', 'int', 'sqlite3*'], + ['sqlite3_preupdate_depth', 'int', 'sqlite3*'], + [ + 'sqlite3_preupdate_hook', + '*', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_preupdate_hook', + signature: 'v(ppippjj)', + contextKey: (argv) => argv[0], + callProxy: (callback) => { + return (p, db, op, zDb, zTbl, iKey1, iKey2) => { + callback( + p, + db, + op, + wasm.cstrToJs(zDb), + wasm.cstrToJs(zTbl), + iKey1, + iKey2, + ); + }; + }, + }), + '*', + ], + ], + ['sqlite3_preupdate_new', 'int', ['sqlite3*', 'int', '**']], + ['sqlite3_preupdate_old', 'int', ['sqlite3*', 'int', '**']], + ); + } + + if ( + wasm.bigIntEnabled && + !!wasm.exports.sqlite3changegroup_add && + !!wasm.exports.sqlite3session_create && + !!wasm.exports.sqlite3_preupdate_hook + ) { + const __ipsProxy = { + signature: 'i(ps)', + callProxy: (callback) => { + return (p, s) => { + try { + return callback(p, wasm.cstrToJs(s)) | 0; + } catch (e) { + return e.resultCode || capi.SQLITE_ERROR; + } + }; + }, + }; + + wasm.bindingSignatures.int64.push( + ...[ + [ + 'sqlite3changegroup_add', + 'int', + ['sqlite3_changegroup*', 'int', 'void*'], + ], + [ + 'sqlite3changegroup_add_strm', + 'int', + [ + 'sqlite3_changegroup*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changegroup_delete', + undefined, + ['sqlite3_changegroup*'], + ], + ['sqlite3changegroup_new', 'int', ['**']], + [ + 'sqlite3changegroup_output', + 'int', + ['sqlite3_changegroup*', 'int*', '**'], + ], + [ + 'sqlite3changegroup_output_strm', + 'int', + [ + 'sqlite3_changegroup*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xOutput', + signature: 'i(ppi)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changeset_apply', + 'int', + [ + 'sqlite3*', + 'int', + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xConflict', + signature: 'i(pip)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changeset_apply_strm', + 'int', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xConflict', + signature: 'i(pip)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changeset_apply_v2', + 'int', + [ + 'sqlite3*', + 'int', + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xConflict', + signature: 'i(pip)', + bindScope: 'transient', + }), + 'void*', + '**', + 'int*', + 'int', + ], + ], + [ + 'sqlite3changeset_apply_v2_strm', + 'int', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xInputA', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInputB', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + ], + ], + ['sqlite3changeset_start_v2', 'int', ['**', 'int', '*', 'int']], + [ + 'sqlite3changeset_start_v2_strm', + 'int', + [ + '**', + new wasm.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 wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xOutput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3session_table_filter', + undefined, + [ + 'sqlite3_session*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + ...__ipsProxy, + contextKey: (argv, argIndex) => argv[0], + }), + '*', + ], + ], + ], + ); + } + + wasm.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'], + ]; + + sqlite3.StructBinder = globalThis.Jaccwabyt({ + heap: 0 ? wasm.memory : wasm.heap8u, + alloc: wasm.alloc, + dealloc: wasm.dealloc, + bigIntEnabled: wasm.bigIntEnabled, + memberPrefix: '$', + }); + delete globalThis.Jaccwabyt; + + { + const __xString = wasm.xWrap.argAdapter('string'); + wasm.xWrap.argAdapter('string:flexible', (v) => + __xString(util.flexibleString(v)), + ); + + wasm.xWrap.argAdapter( + 'string:static', + function (v) { + if (wasm.isPtr(v)) return v; + v = '' + v; + let rc = this[v]; + return rc || (this[v] = wasm.allocCString(v)); + }.bind(Object.create(null)), + ); + + const __xArgPtr = wasm.xWrap.argAdapter('*'); + const nilType = function () {}; + wasm.xWrap.argAdapter('sqlite3_filename', __xArgPtr)( + 'sqlite3_context*', + __xArgPtr, + )('sqlite3_value*', __xArgPtr)('void*', __xArgPtr)( + 'sqlite3_changegroup*', + __xArgPtr, + )('sqlite3_changeset_iter*', __xArgPtr)( + 'sqlite3_session*', + __xArgPtr, + )('sqlite3_stmt*', (v) => + __xArgPtr( + v instanceof (sqlite3?.oo1?.Stmt || nilType) ? v.pointer : v, + ), + )('sqlite3*', (v) => + __xArgPtr( + v instanceof (sqlite3?.oo1?.DB || nilType) ? v.pointer : v, + ), + )('sqlite3_vfs*', (v) => { + if ('string' === typeof v) { + return ( + capi.sqlite3_vfs_find(v) || + sqlite3.SQLite3Error.toss( + capi.SQLITE_NOTFOUND, + 'Unknown sqlite3_vfs name:', + v, + ) + ); + } + return __xArgPtr( + v instanceof (capi.sqlite3_vfs || nilType) ? v.pointer : v, + ); + }); + if (wasm.exports.sqlite3_declare_vtab) { + wasm.xWrap.argAdapter('sqlite3_index_info*', (v) => + __xArgPtr( + v instanceof (capi.sqlite3_index_info || nilType) + ? v.pointer + : v, + ), + )('sqlite3_module*', (v) => + __xArgPtr( + v instanceof (capi.sqlite3_module || nilType) ? v.pointer : v, + ), + ); + } + + const __xRcPtr = wasm.xWrap.resultAdapter('*'); + wasm.xWrap.resultAdapter('sqlite3*', __xRcPtr)( + 'sqlite3_context*', + __xRcPtr, + )('sqlite3_stmt*', __xRcPtr)('sqlite3_value*', __xRcPtr)( + 'sqlite3_vfs*', + __xRcPtr, + )('void*', __xRcPtr); + + if (0 === wasm.exports.sqlite3_step.length) { + wasm.xWrap.doArgcCheck = false; + sqlite3.config.warn( + 'Disabling sqlite3.wasm.xWrap.doArgcCheck due to environmental quirks.', + ); + } + for (const e of wasm.bindingSignatures) { + capi[e[0]] = wasm.xWrap.apply(null, e); + } + for (const e of wasm.bindingSignatures.wasmInternal) { + util[e[0]] = wasm.xWrap.apply(null, e); + } + + const fI64Disabled = function (fname) { + return () => + toss( + fname + '() is unavailable due to lack', + 'of BigInt support in this build.', + ); + }; + for (const e of wasm.bindingSignatures.int64) { + capi[e[0]] = wasm.bigIntEnabled + ? wasm.xWrap.apply(null, e) + : fI64Disabled(e[0]); + } + + delete wasm.bindingSignatures; + + if (wasm.exports.sqlite3__wasm_db_error) { + const __db_err = wasm.xWrap( + 'sqlite3__wasm_db_error', + 'int', + 'sqlite3*', + 'int', + 'string', + ); + + util.sqlite3__wasm_db_error = function (pDb, resultCode, message) { + if (resultCode instanceof sqlite3.WasmAllocError) { + resultCode = capi.SQLITE_NOMEM; + message = 0; + } else if (resultCode instanceof Error) { + message = message || '' + resultCode; + resultCode = resultCode.resultCode || capi.SQLITE_ERROR; + } + return pDb ? __db_err(pDb, resultCode, message) : resultCode; + }; + } else { + util.sqlite3__wasm_db_error = function (pDb, errCode, msg) { + console.warn( + 'sqlite3__wasm_db_error() is not exported.', + arguments, + ); + return errCode; + }; + } + } + + { + const cJson = wasm.xCall('sqlite3__wasm_enum_json'); + if (!cJson) { + toss( + "Maintenance required: increase sqlite3__wasm_enum_json()'s", + 'static buffer size!', + ); + } + + wasm.ctype = JSON.parse(wasm.cstrToJs(cJson)); + + const defineGroups = [ + 'access', + 'authorizer', + 'blobFinalizers', + 'changeset', + 'config', + 'dataTypes', + 'dbConfig', + 'dbStatus', + 'encodings', + 'fcntl', + 'flock', + 'ioCap', + 'limits', + 'openFlags', + 'prepareFlags', + 'resultCodes', + 'sqlite3Status', + 'stmtStatus', + 'syncFlags', + 'trace', + 'txnState', + 'udfFlags', + 'version', + ]; + if (wasm.bigIntEnabled) { + defineGroups.push('serialize', 'session', 'vtab'); + } + for (const t of defineGroups) { + for (const e of Object.entries(wasm.ctype[t])) { + capi[e[0]] = e[1]; + } + } + if (!wasm.functionEntry(capi.SQLITE_WASM_DEALLOC)) { + toss( + 'Internal error: cannot resolve exported function', + 'entry SQLITE_WASM_DEALLOC (==' + capi.SQLITE_WASM_DEALLOC + ').', + ); + } + const __rcMap = Object.create(null); + for (const t of ['resultCodes']) { + for (const e of Object.entries(wasm.ctype[t])) { + __rcMap[e[1]] = e[0]; + } + } + + capi.sqlite3_js_rc_str = (rc) => __rcMap[rc]; + + const notThese = Object.assign(Object.create(null), { + WasmTestStruct: true, + + sqlite3_kvvfs_methods: !util.isUIThread(), + + sqlite3_index_info: !wasm.bigIntEnabled, + sqlite3_index_constraint: !wasm.bigIntEnabled, + sqlite3_index_orderby: !wasm.bigIntEnabled, + sqlite3_index_constraint_usage: !wasm.bigIntEnabled, + }); + for (const s of wasm.ctype.structs) { + if (!notThese[s.name]) { + capi[s.name] = sqlite3.StructBinder(s); + } + } + if (capi.sqlite3_index_info) { + for (const k of [ + 'sqlite3_index_constraint', + 'sqlite3_index_orderby', + 'sqlite3_index_constraint_usage', + ]) { + capi.sqlite3_index_info[k] = capi[k]; + delete capi[k]; + } + capi.sqlite3_vtab_config = wasm.xWrap( + 'sqlite3__wasm_vtab_config', + 'int', + ['sqlite3*', 'int', 'int'], + ); + } + } + + const __dbArgcMismatch = (pDb, f, n) => { + return util.sqlite3__wasm_db_error( + pDb, + capi.SQLITE_MISUSE, + f + '() requires ' + n + ' argument' + (1 === n ? '' : 's') + '.', + ); + }; + + const __errEncoding = (pDb) => { + return util.sqlite3__wasm_db_error( + pDb, + capi.SQLITE_FORMAT, + 'SQLITE_UTF8 is the only supported encoding.', + ); + }; + + const __argPDb = (pDb) => wasm.xWrap.argAdapter('sqlite3*')(pDb); + const __argStr = (str) => (wasm.isPtr(str) ? wasm.cstrToJs(str) : str); + const __dbCleanupMap = function (pDb, mode) { + pDb = __argPDb(pDb); + let m = this.dbMap.get(pDb); + if (!mode) { + this.dbMap.delete(pDb); + return m; + } else if (!m && mode > 0) { + this.dbMap.set(pDb, (m = Object.create(null))); + } + return m; + }.bind( + Object.assign(Object.create(null), { + dbMap: new Map(), + }), + ); + + __dbCleanupMap.addCollation = function (pDb, name) { + const m = __dbCleanupMap(pDb, 1); + if (!m.collation) m.collation = new Set(); + m.collation.add(__argStr(name).toLowerCase()); + }; + + __dbCleanupMap._addUDF = function (pDb, name, arity, map) { + name = __argStr(name).toLowerCase(); + let u = map.get(name); + if (!u) map.set(name, (u = new Set())); + u.add(arity < 0 ? -1 : arity); + }; + + __dbCleanupMap.addFunction = function (pDb, name, arity) { + const m = __dbCleanupMap(pDb, 1); + if (!m.udf) m.udf = new Map(); + this._addUDF(pDb, name, arity, m.udf); + }; + + if (wasm.exports.sqlite3_create_window_function) { + __dbCleanupMap.addWindowFunc = function (pDb, name, arity) { + const m = __dbCleanupMap(pDb, 1); + if (!m.wudf) m.wudf = new Map(); + this._addUDF(pDb, name, arity, m.wudf); + }; + } + + __dbCleanupMap.cleanup = function (pDb) { + pDb = __argPDb(pDb); + + const closeArgs = [pDb]; + for (const name 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 x = wasm.exports[name]; + if (!x) { + continue; + } + closeArgs.length = x.length; + try { + capi[name](...closeArgs); + } catch (e) { + sqlite3.config.warn( + 'close-time call of', + name + '(', + closeArgs, + ') threw:', + e, + ); + } + } + const m = __dbCleanupMap(pDb, 0); + if (!m) return; + if (m.collation) { + for (const name of m.collation) { + try { + capi.sqlite3_create_collation_v2( + pDb, + name, + capi.SQLITE_UTF8, + 0, + 0, + 0, + ); + } catch (e) {} + } + delete m.collation; + } + let i; + for (i = 0; i < 2; ++i) { + const fmap = i ? m.wudf : m.udf; + if (!fmap) continue; + const func = i + ? capi.sqlite3_create_window_function + : capi.sqlite3_create_function_v2; + for (const e of fmap) { + const name = e[0], + arities = e[1]; + const fargs = [pDb, name, 0, capi.SQLITE_UTF8, 0, 0, 0, 0, 0]; + if (i) fargs.push(0); + for (const arity of arities) { + try { + fargs[2] = arity; + func.apply(null, fargs); + } catch (e) {} + } + arities.clear(); + } + fmap.clear(); + } + delete m.udf; + delete m.wudf; + }; + + { + const __sqlite3CloseV2 = wasm.xWrap( + 'sqlite3_close_v2', + 'int', + 'sqlite3*', + ); + capi.sqlite3_close_v2 = function (pDb) { + if (1 !== arguments.length) + return __dbArgcMismatch(pDb, 'sqlite3_close_v2', 1); + if (pDb) { + try { + __dbCleanupMap.cleanup(pDb); + } catch (e) {} + } + return __sqlite3CloseV2(pDb); + }; + } + + if (capi.sqlite3session_create) { + const __sqlite3SessionDelete = wasm.xWrap( + 'sqlite3session_delete', + undefined, + ['sqlite3_session*'], + ); + capi.sqlite3session_delete = function (pSession) { + if (1 !== arguments.length) { + return __dbArgcMismatch(pDb, 'sqlite3session_delete', 1); + } else if (pSession) { + capi.sqlite3session_table_filter(pSession, 0, 0); + } + __sqlite3SessionDelete(pSession); + }; + } + + { + const contextKey = (argv, argIndex) => { + return ( + 'argv[' + + argIndex + + ']:' + + argv[0] + + ':' + + wasm.cstrToJs(argv[1]).toLowerCase() + ); + }; + const __sqlite3CreateCollationV2 = wasm.xWrap( + 'sqlite3_create_collation_v2', + 'int', + [ + 'sqlite3*', + 'string', + 'int', + '*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xCompare', + signature: 'i(pipip)', + contextKey, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroy', + signature: 'v(p)', + contextKey, + }), + ], + ); + + capi.sqlite3_create_collation_v2 = function ( + pDb, + zName, + eTextRep, + pArg, + xCompare, + xDestroy, + ) { + if (6 !== arguments.length) + return __dbArgcMismatch(pDb, 'sqlite3_create_collation_v2', 6); + else if (0 === (eTextRep & 0xf)) { + eTextRep |= capi.SQLITE_UTF8; + } else if (capi.SQLITE_UTF8 !== (eTextRep & 0xf)) { + return __errEncoding(pDb); + } + try { + const rc = __sqlite3CreateCollationV2( + pDb, + zName, + eTextRep, + pArg, + xCompare, + xDestroy, + ); + if (0 === rc && xCompare instanceof Function) { + __dbCleanupMap.addCollation(pDb, zName); + } + return rc; + } catch (e) { + return util.sqlite3__wasm_db_error(pDb, e); + } + }; + + capi.sqlite3_create_collation = ( + pDb, + zName, + eTextRep, + pArg, + xCompare, + ) => { + return 5 === arguments.length + ? capi.sqlite3_create_collation_v2( + pDb, + zName, + eTextRep, + pArg, + xCompare, + 0, + ) + : __dbArgcMismatch(pDb, 'sqlite3_create_collation', 5); + }; + } + + { + const contextKey = function (argv, argIndex) { + return ( + argv[0] + + ':' + + (argv[2] < 0 ? -1 : argv[2]) + + ':' + + argIndex + + ':' + + wasm.cstrToJs(argv[1]).toLowerCase() + ); + }; + + const __cfProxy = Object.assign(Object.create(null), { + xInverseAndStep: { + signature: 'v(pip)', + contextKey, + callProxy: (callback) => { + return (pCtx, argc, pArgv) => { + try { + callback(pCtx, ...capi.sqlite3_values_to_js(argc, pArgv)); + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + }, + }, + xFinalAndValue: { + signature: 'v(p)', + contextKey, + callProxy: (callback) => { + return (pCtx) => { + try { + capi.sqlite3_result_js(pCtx, callback(pCtx)); + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + }, + }, + xFunc: { + signature: 'v(pip)', + contextKey, + callProxy: (callback) => { + return (pCtx, argc, pArgv) => { + try { + capi.sqlite3_result_js( + pCtx, + callback(pCtx, ...capi.sqlite3_values_to_js(argc, pArgv)), + ); + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + }, + }, + xDestroy: { + signature: 'v(p)', + contextKey, + + callProxy: (callback) => { + return (pVoid) => { + try { + callback(pVoid); + } catch (e) { + console.error('UDF xDestroy method threw:', e); + } + }; + }, + }, + }); + + const __sqlite3CreateFunction = wasm.xWrap( + 'sqlite3_create_function_v2', + 'int', + [ + 'sqlite3*', + 'string', + 'int', + 'int', + '*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFunc', + ...__cfProxy.xFunc, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xStep', + ...__cfProxy.xInverseAndStep, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFinal', + ...__cfProxy.xFinalAndValue, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroy', + ...__cfProxy.xDestroy, + }), + ], + ); + + const __sqlite3CreateWindowFunction = wasm.exports + .sqlite3_create_window_function + ? wasm.xWrap('sqlite3_create_window_function', 'int', [ + 'sqlite3*', + 'string', + 'int', + 'int', + '*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xStep', + ...__cfProxy.xInverseAndStep, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFinal', + ...__cfProxy.xFinalAndValue, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xValue', + ...__cfProxy.xFinalAndValue, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInverse', + ...__cfProxy.xInverseAndStep, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroy', + ...__cfProxy.xDestroy, + }), + ]) + : undefined; + + capi.sqlite3_create_function_v2 = function f( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + pDb, + 'sqlite3_create_function_v2', + f.length, + ); + } else if (0 === (eTextRep & 0xf)) { + eTextRep |= capi.SQLITE_UTF8; + } else if (capi.SQLITE_UTF8 !== (eTextRep & 0xf)) { + return __errEncoding(pDb); + } + try { + const rc = __sqlite3CreateFunction( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + xDestroy, + ); + if ( + 0 === rc && + (xFunc instanceof Function || + xStep instanceof Function || + xFinal instanceof Function || + xDestroy instanceof Function) + ) { + __dbCleanupMap.addFunction(pDb, funcName, nArg); + } + return rc; + } catch (e) { + console.error('sqlite3_create_function_v2() setup threw:', e); + return util.sqlite3__wasm_db_error( + pDb, + e, + 'Creation of UDF threw: ' + e, + ); + } + }; + + capi.sqlite3_create_function = function f( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + ) { + return f.length === arguments.length + ? capi.sqlite3_create_function_v2( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + 0, + ) + : __dbArgcMismatch(pDb, 'sqlite3_create_function', f.length); + }; + + if (__sqlite3CreateWindowFunction) { + capi.sqlite3_create_window_function = function f( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + pDb, + 'sqlite3_create_window_function', + f.length, + ); + } else if (0 === (eTextRep & 0xf)) { + eTextRep |= capi.SQLITE_UTF8; + } else if (capi.SQLITE_UTF8 !== (eTextRep & 0xf)) { + return __errEncoding(pDb); + } + try { + const rc = __sqlite3CreateWindowFunction( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ); + if ( + 0 === rc && + (xStep instanceof Function || + xFinal instanceof Function || + xValue instanceof Function || + xInverse instanceof Function || + xDestroy instanceof Function) + ) { + __dbCleanupMap.addWindowFunc(pDb, funcName, nArg); + } + return rc; + } catch (e) { + console.error( + 'sqlite3_create_window_function() setup threw:', + e, + ); + return util.sqlite3__wasm_db_error( + pDb, + e, + 'Creation of UDF threw: ' + e, + ); + } + }; + } else { + delete capi.sqlite3_create_window_function; + } + + capi.sqlite3_create_function_v2.udfSetResult = + capi.sqlite3_create_function.udfSetResult = capi.sqlite3_result_js; + if (capi.sqlite3_create_window_function) { + capi.sqlite3_create_window_function.udfSetResult = + capi.sqlite3_result_js; + } + + capi.sqlite3_create_function_v2.udfConvertArgs = + capi.sqlite3_create_function.udfConvertArgs = + capi.sqlite3_values_to_js; + if (capi.sqlite3_create_window_function) { + capi.sqlite3_create_window_function.udfConvertArgs = + capi.sqlite3_values_to_js; + } + + capi.sqlite3_create_function_v2.udfSetError = + capi.sqlite3_create_function.udfSetError = + capi.sqlite3_result_error_js; + if (capi.sqlite3_create_window_function) { + capi.sqlite3_create_window_function.udfSetError = + capi.sqlite3_result_error_js; + } + } + + { + const __flexiString = (v, n) => { + if ('string' === typeof v) { + n = -1; + } else if (util.isSQLableTypedArray(v)) { + n = v.byteLength; + v = util.typedArrayToString( + v instanceof ArrayBuffer ? new Uint8Array(v) : v, + ); + } else if (Array.isArray(v)) { + v = v.join(''); + n = -1; + } + return [v, n]; + }; + + const __prepare = { + basic: wasm.xWrap('sqlite3_prepare_v3', 'int', [ + 'sqlite3*', + 'string', + 'int', + 'int', + '**', + '**', + ]), + + full: wasm.xWrap('sqlite3_prepare_v3', 'int', [ + 'sqlite3*', + '*', + 'int', + 'int', + '**', + '**', + ]), + }; + + capi.sqlite3_prepare_v3 = function f( + pDb, + sql, + sqlLen, + prepFlags, + ppStmt, + pzTail, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch(pDb, 'sqlite3_prepare_v3', f.length); + } + const [xSql, xSqlLen] = __flexiString(sql, sqlLen); + switch (typeof xSql) { + case 'string': + return __prepare.basic( + pDb, + xSql, + xSqlLen, + prepFlags, + ppStmt, + null, + ); + case 'number': + return __prepare.full( + pDb, + xSql, + xSqlLen, + prepFlags, + ppStmt, + pzTail, + ); + default: + return util.sqlite3__wasm_db_error( + pDb, + capi.SQLITE_MISUSE, + 'Invalid SQL argument type for sqlite3_prepare_v2/v3().', + ); + } + }; + + capi.sqlite3_prepare_v2 = function f( + pDb, + sql, + sqlLen, + ppStmt, + pzTail, + ) { + return f.length === arguments.length + ? capi.sqlite3_prepare_v3(pDb, sql, sqlLen, 0, ppStmt, pzTail) + : __dbArgcMismatch(pDb, 'sqlite3_prepare_v2', f.length); + }; + } + + { + const __bindText = wasm.xWrap('sqlite3_bind_text', 'int', [ + 'sqlite3_stmt*', + 'int', + 'string', + 'int', + '*', + ]); + const __bindBlob = wasm.xWrap('sqlite3_bind_blob', 'int', [ + 'sqlite3_stmt*', + 'int', + '*', + 'int', + '*', + ]); + + capi.sqlite3_bind_text = function f( + pStmt, + iCol, + text, + nText, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + capi.sqlite3_db_handle(pStmt), + 'sqlite3_bind_text', + f.length, + ); + } else if (wasm.isPtr(text) || null === text) { + return __bindText(pStmt, iCol, text, nText, xDestroy); + } else if (text instanceof ArrayBuffer) { + text = new Uint8Array(text); + } else if (Array.isArray(pMem)) { + text = pMem.join(''); + } + let p, n; + try { + if (util.isSQLableTypedArray(text)) { + p = wasm.allocFromTypedArray(text); + n = text.byteLength; + } else if ('string' === typeof text) { + [p, n] = wasm.allocCString(text); + } else { + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + capi.SQLITE_MISUSE, + 'Invalid 3rd argument type for sqlite3_bind_text().', + ); + } + return __bindText(pStmt, iCol, p, n, capi.SQLITE_WASM_DEALLOC); + } catch (e) { + wasm.dealloc(p); + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + e, + ); + } + }; + + capi.sqlite3_bind_blob = function f( + pStmt, + iCol, + pMem, + nMem, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + capi.sqlite3_db_handle(pStmt), + 'sqlite3_bind_blob', + f.length, + ); + } else if (wasm.isPtr(pMem) || null === pMem) { + return __bindBlob(pStmt, iCol, pMem, nMem, xDestroy); + } else if (pMem instanceof ArrayBuffer) { + pMem = new Uint8Array(pMem); + } else if (Array.isArray(pMem)) { + pMem = pMem.join(''); + } + let p, n; + try { + if (util.isBindableTypedArray(pMem)) { + p = wasm.allocFromTypedArray(pMem); + n = nMem >= 0 ? nMem : pMem.byteLength; + } else if ('string' === typeof pMem) { + [p, n] = wasm.allocCString(pMem); + } else { + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + capi.SQLITE_MISUSE, + 'Invalid 3rd argument type for sqlite3_bind_blob().', + ); + } + return __bindBlob(pStmt, iCol, p, n, capi.SQLITE_WASM_DEALLOC); + } catch (e) { + wasm.dealloc(p); + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + e, + ); + } + }; + } + + { + capi.sqlite3_config = function (op, ...args) { + if (arguments.length < 2) return capi.SQLITE_MISUSE; + switch (op) { + case capi.SQLITE_CONFIG_COVERING_INDEX_SCAN: + case capi.SQLITE_CONFIG_MEMSTATUS: + case capi.SQLITE_CONFIG_SMALL_MALLOC: + case capi.SQLITE_CONFIG_SORTERREF_SIZE: + case capi.SQLITE_CONFIG_STMTJRNL_SPILL: + case capi.SQLITE_CONFIG_URI: + return wasm.exports.sqlite3__wasm_config_i(op, args[0]); + case capi.SQLITE_CONFIG_LOOKASIDE: + return wasm.exports.sqlite3__wasm_config_ii( + op, + args[0], + args[1], + ); + case capi.SQLITE_CONFIG_MEMDB_MAXSIZE: + return wasm.exports.sqlite3__wasm_config_j(op, args[0]); + case capi.SQLITE_CONFIG_GETMALLOC: + case capi.SQLITE_CONFIG_GETMUTEX: + case capi.SQLITE_CONFIG_GETPCACHE2: + case capi.SQLITE_CONFIG_GETPCACHE: + case capi.SQLITE_CONFIG_HEAP: + case capi.SQLITE_CONFIG_LOG: + case capi.SQLITE_CONFIG_MALLOC: + case capi.SQLITE_CONFIG_MMAP_SIZE: + case capi.SQLITE_CONFIG_MULTITHREAD: + case capi.SQLITE_CONFIG_MUTEX: + case capi.SQLITE_CONFIG_PAGECACHE: + case capi.SQLITE_CONFIG_PCACHE2: + case capi.SQLITE_CONFIG_PCACHE: + case capi.SQLITE_CONFIG_PCACHE_HDRSZ: + case capi.SQLITE_CONFIG_PMASZ: + case capi.SQLITE_CONFIG_SERIALIZED: + case capi.SQLITE_CONFIG_SINGLETHREAD: + case capi.SQLITE_CONFIG_SQLLOG: + case capi.SQLITE_CONFIG_WIN32_HEAPSIZE: + default: + return capi.SQLITE_NOTFOUND; + } + }; + } + + { + const __autoExtFptr = new Set(); + + capi.sqlite3_auto_extension = function (fPtr) { + if (fPtr instanceof Function) { + fPtr = wasm.installFunction('i(ppp)', fPtr); + } else if (1 !== arguments.length || !wasm.isPtr(fPtr)) { + return capi.SQLITE_MISUSE; + } + const rc = wasm.exports.sqlite3_auto_extension(fPtr); + if (fPtr !== arguments[0]) { + if (0 === rc) __autoExtFptr.add(fPtr); + else wasm.uninstallFunction(fPtr); + } + return rc; + }; + + capi.sqlite3_cancel_auto_extension = function (fPtr) { + if (!fPtr || 1 !== arguments.length || !wasm.isPtr(fPtr)) return 0; + return wasm.exports.sqlite3_cancel_auto_extension(fPtr); + }; + + capi.sqlite3_reset_auto_extension = function () { + wasm.exports.sqlite3_reset_auto_extension(); + for (const fp of __autoExtFptr) wasm.uninstallFunction(fp); + __autoExtFptr.clear(); + }; + } + + const pKvvfs = capi.sqlite3_vfs_find('kvvfs'); + if (pKvvfs) { + if (util.isUIThread()) { + const kvvfsMethods = new capi.sqlite3_kvvfs_methods( + wasm.exports.sqlite3__wasm_kvvfs_methods(), + ); + delete capi.sqlite3_kvvfs_methods; + + const kvvfsMakeKey = + wasm.exports.sqlite3__wasm_kvvfsMakeKeyOnPstack, + pstack = wasm.pstack; + + const kvvfsStorage = (zClass) => + 115 === wasm.peek(zClass) ? sessionStorage : localStorage; + + const kvvfsImpls = { + xRead: (zClass, zKey, zBuf, nBuf) => { + const stack = pstack.pointer, + astack = wasm.scopedAllocPush(); + try { + const zXKey = kvvfsMakeKey(zClass, zKey); + if (!zXKey) return -3; + const jKey = wasm.cstrToJs(zXKey); + const jV = kvvfsStorage(zClass).getItem(jKey); + if (!jV) return -1; + const nV = jV.length; + if (nBuf <= 0) return nV; + else if (1 === nBuf) { + wasm.poke(zBuf, 0); + return nV; + } + const zV = wasm.scopedAllocCString(jV); + if (nBuf > nV + 1) nBuf = nV + 1; + wasm.heap8u().copyWithin(zBuf, zV, zV + nBuf - 1); + wasm.poke(zBuf + nBuf - 1, 0); + return nBuf - 1; + } catch (e) { + console.error('kvstorageRead()', e); + return -2; + } finally { + pstack.restore(stack); + wasm.scopedAllocPop(astack); + } + }, + xWrite: (zClass, zKey, zData) => { + const stack = pstack.pointer; + try { + const zXKey = kvvfsMakeKey(zClass, zKey); + if (!zXKey) return 1; + const jKey = wasm.cstrToJs(zXKey); + kvvfsStorage(zClass).setItem(jKey, wasm.cstrToJs(zData)); + return 0; + } catch (e) { + console.error('kvstorageWrite()', e); + return capi.SQLITE_IOERR; + } finally { + pstack.restore(stack); + } + }, + xDelete: (zClass, zKey) => { + const stack = pstack.pointer; + try { + const zXKey = kvvfsMakeKey(zClass, zKey); + if (!zXKey) return 1; + kvvfsStorage(zClass).removeItem(wasm.cstrToJs(zXKey)); + return 0; + } catch (e) { + console.error('kvstorageDelete()', e); + return capi.SQLITE_IOERR; + } finally { + pstack.restore(stack); + } + }, + }; + for (const k of Object.keys(kvvfsImpls)) { + kvvfsMethods[kvvfsMethods.memberKey(k)] = wasm.installFunction( + kvvfsMethods.memberSignature(k), + kvvfsImpls[k], + ); + } + } else { + capi.sqlite3_vfs_unregister(pKvvfs); + } + } + + wasm.xWrap.FuncPtrAdapter.warnOnUse = true; + + const StructBinder = sqlite3.StructBinder; + const installMethod = function callee( + tgt, + name, + func, + applyArgcCheck = callee.installMethodArgcCheck, + ) { + if (!(tgt instanceof StructBinder.StructType)) { + toss('Usage error: target object is-not-a StructType.'); + } else if (!(func instanceof Function) && !wasm.isPtr(func)) { + toss('Usage error: expecting a Function or WASM pointer to one.'); + } + if (1 === arguments.length) { + return (n, f) => callee(tgt, n, f, applyArgcCheck); + } + if (!callee.argcProxy) { + callee.argcProxy = function (tgt, funcName, func, sig) { + return function (...args) { + if (func.length !== arguments.length) { + toss( + 'Argument mismatch for', + tgt.structInfo.name + + '::' + + funcName + + ': Native signature is:', + sig, + ); + } + return func.apply(this, args); + }; + }; + + callee.removeFuncList = function () { + if (this.ondispose.__removeFuncList) { + this.ondispose.__removeFuncList.forEach((v, ndx) => { + if ('number' === typeof v) { + try { + wasm.uninstallFunction(v); + } catch (e) {} + } + }); + delete this.ondispose.__removeFuncList; + } + }; + } + const sigN = tgt.memberSignature(name); + if (sigN.length < 2) { + toss( + 'Member', + name, + 'does not have a function pointer signature:', + sigN, + ); + } + const memKey = tgt.memberKey(name); + const fProxy = + applyArgcCheck && !wasm.isPtr(func) + ? callee.argcProxy(tgt, memKey, func, sigN) + : func; + if (wasm.isPtr(fProxy)) { + if (fProxy && !wasm.functionEntry(fProxy)) { + toss('Pointer', fProxy, 'is not a WASM function table entry.'); + } + tgt[memKey] = fProxy; + } else { + const pFunc = wasm.installFunction( + fProxy, + tgt.memberSignature(name, true), + ); + tgt[memKey] = pFunc; + if (!tgt.ondispose || !tgt.ondispose.__removeFuncList) { + tgt.addOnDispose( + 'ondispose.__removeFuncList handler', + callee.removeFuncList, + ); + tgt.ondispose.__removeFuncList = []; + } + tgt.ondispose.__removeFuncList.push(memKey, pFunc); + } + return (n, f) => callee(tgt, n, f, applyArgcCheck); + }; + installMethod.installMethodArgcCheck = false; + + const installMethods = function ( + structInstance, + methods, + applyArgcCheck = installMethod.installMethodArgcCheck, + ) { + const seen = new Map(); + for (const k of Object.keys(methods)) { + const m = methods[k]; + const prior = seen.get(m); + if (prior) { + const mkey = structInstance.memberKey(k); + structInstance[mkey] = + structInstance[structInstance.memberKey(prior)]; + } else { + installMethod(structInstance, k, m, applyArgcCheck); + seen.set(m, k); + } + } + return structInstance; + }; + + StructBinder.StructType.prototype.installMethod = function callee( + name, + func, + applyArgcCheck = installMethod.installMethodArgcCheck, + ) { + return arguments.length < 3 && name && 'object' === typeof name + ? installMethods(this, ...arguments) + : installMethod(this, ...arguments); + }; + + StructBinder.StructType.prototype.installMethods = function ( + methods, + applyArgcCheck = installMethod.installMethodArgcCheck, + ) { + return installMethods(this, methods, applyArgcCheck); + }; + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + sqlite3.version = { + libVersion: '3.50.4', + libVersionNumber: 3050004, + sourceId: + '2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3', + downloadVersion: 3500400, + }; + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + const toss3 = (...args) => { + throw new sqlite3.SQLite3Error(...args); + }; + + const capi = sqlite3.capi, + wasm = sqlite3.wasm, + util = sqlite3.util; + + const __ptrMap = new WeakMap(); + + const __stmtMap = new WeakMap(); + + const getOwnOption = (opts, p, dflt) => { + const d = Object.getOwnPropertyDescriptor(opts, p); + return d ? d.value : dflt; + }; + + const checkSqlite3Rc = function (dbPtr, sqliteResultCode) { + if (sqliteResultCode) { + if (dbPtr instanceof DB) dbPtr = dbPtr.pointer; + toss3( + sqliteResultCode, + 'sqlite3 result code', + sqliteResultCode + ':', + dbPtr + ? capi.sqlite3_errmsg(dbPtr) + : capi.sqlite3_errstr(sqliteResultCode), + ); + } + return arguments[0]; + }; + + const __dbTraceToConsole = wasm.installFunction( + 'i(ippp)', + function (t, c, p, x) { + if (capi.SQLITE_TRACE_STMT === t) { + console.log( + 'SQL TRACE #' + ++this.counter + ' via sqlite3@' + c + ':', + wasm.cstrToJs(x), + ); + } + }.bind({ counter: 0 }), + ); + + const __vfsPostOpenCallback = Object.create(null); + + const dbCtorHelper = function ctor(...args) { + if (!ctor._name2vfs) { + ctor._name2vfs = Object.create(null); + const isWorkerThread = + 'function' === typeof importScripts + ? (n) => + toss3( + 'The VFS for', + n, + 'is only available in the main window thread.', + ) + : false; + ctor._name2vfs[':localStorage:'] = { + vfs: 'kvvfs', + filename: isWorkerThread || (() => 'local'), + }; + ctor._name2vfs[':sessionStorage:'] = { + vfs: 'kvvfs', + filename: isWorkerThread || (() => 'session'), + }; + } + const opt = ctor.normalizeArgs(...args); + let fn = opt.filename, + vfsName = opt.vfs, + flagsStr = opt.flags; + if ( + ('string' !== typeof fn && 'number' !== typeof fn) || + 'string' !== typeof flagsStr || + (vfsName && + 'string' !== typeof vfsName && + 'number' !== typeof vfsName) + ) { + sqlite3.config.error('Invalid DB ctor args', opt, arguments); + toss3('Invalid arguments for DB constructor.'); + } + let fnJs = 'number' === typeof fn ? wasm.cstrToJs(fn) : fn; + const vfsCheck = ctor._name2vfs[fnJs]; + if (vfsCheck) { + vfsName = vfsCheck.vfs; + fn = fnJs = vfsCheck.filename(fnJs); + } + let pDb, + oflags = 0; + if (flagsStr.indexOf('c') >= 0) { + oflags |= capi.SQLITE_OPEN_CREATE | capi.SQLITE_OPEN_READWRITE; + } + if (flagsStr.indexOf('w') >= 0) oflags |= capi.SQLITE_OPEN_READWRITE; + if (0 === oflags) oflags |= capi.SQLITE_OPEN_READONLY; + oflags |= capi.SQLITE_OPEN_EXRESCODE; + const stack = wasm.pstack.pointer; + try { + const pPtr = wasm.pstack.allocPtr(); + let rc = capi.sqlite3_open_v2(fn, pPtr, oflags, vfsName || 0); + pDb = wasm.peekPtr(pPtr); + checkSqlite3Rc(pDb, rc); + capi.sqlite3_extended_result_codes(pDb, 1); + if (flagsStr.indexOf('t') >= 0) { + capi.sqlite3_trace_v2( + pDb, + capi.SQLITE_TRACE_STMT, + __dbTraceToConsole, + pDb, + ); + } + } catch (e) { + if (pDb) capi.sqlite3_close_v2(pDb); + throw e; + } finally { + wasm.pstack.restore(stack); + } + this.filename = fnJs; + __ptrMap.set(this, pDb); + __stmtMap.set(this, Object.create(null)); + try { + const pVfs = + capi.sqlite3_js_db_vfs(pDb) || + toss3('Internal error: cannot get VFS for new db handle.'); + const postInitSql = __vfsPostOpenCallback[pVfs]; + if (postInitSql) { + if (postInitSql instanceof Function) { + postInitSql(this, sqlite3); + } else { + checkSqlite3Rc( + pDb, + capi.sqlite3_exec(pDb, postInitSql, 0, 0, 0), + ); + } + } + } catch (e) { + this.close(); + throw e; + } + }; + + dbCtorHelper.setVfsPostOpenCallback = function (pVfs, callback) { + if (!(callback instanceof Function)) { + toss3( + 'dbCtorHelper.setVfsPostOpenCallback() should not be used with ' + + 'a non-function argument.', + arguments, + ); + } + __vfsPostOpenCallback[pVfs] = callback; + }; + + dbCtorHelper.normalizeArgs = function ( + filename = ':memory:', + flags = 'c', + vfs = null, + ) { + const arg = {}; + if ( + 1 === arguments.length && + arguments[0] && + 'object' === typeof arguments[0] + ) { + Object.assign(arg, arguments[0]); + if (undefined === arg.flags) arg.flags = 'c'; + if (undefined === arg.vfs) arg.vfs = null; + if (undefined === arg.filename) arg.filename = ':memory:'; + } else { + arg.filename = filename; + arg.flags = flags; + arg.vfs = vfs; + } + return arg; + }; + + const DB = function (...args) { + dbCtorHelper.apply(this, args); + }; + DB.dbCtorHelper = dbCtorHelper; + + const BindTypes = { + null: 1, + number: 2, + string: 3, + boolean: 4, + blob: 5, + }; + BindTypes['undefined'] == BindTypes.null; + if (wasm.bigIntEnabled) { + BindTypes.bigint = BindTypes.number; + } + + const Stmt = function () { + if (BindTypes !== arguments[2]) { + toss3( + capi.SQLITE_MISUSE, + 'Do not call the Stmt constructor directly. Use DB.prepare().', + ); + } + this.db = arguments[0]; + __ptrMap.set(this, arguments[1]); + this.parameterCount = capi.sqlite3_bind_parameter_count(this.pointer); + }; + + const affirmDbOpen = function (db) { + if (!db.pointer) toss3('DB has been closed.'); + return db; + }; + + const affirmColIndex = function (stmt, ndx) { + if (ndx !== (ndx | 0) || ndx < 0 || ndx >= stmt.columnCount) { + toss3('Column index', ndx, 'is out of range.'); + } + return stmt; + }; + + const parseExecArgs = function (db, args) { + const out = Object.create(null); + out.opt = Object.create(null); + switch (args.length) { + case 1: + if ( + 'string' === typeof args[0] || + util.isSQLableTypedArray(args[0]) + ) { + out.sql = args[0]; + } else if (Array.isArray(args[0])) { + out.sql = args[0]; + } else if (args[0] && 'object' === typeof args[0]) { + out.opt = args[0]; + out.sql = out.opt.sql; + } + break; + case 2: + out.sql = args[0]; + out.opt = args[1]; + break; + default: + toss3('Invalid argument count for exec().'); + } + out.sql = util.flexibleString(out.sql); + if ('string' !== typeof out.sql) { + toss3('Missing SQL argument or unsupported SQL value type.'); + } + const opt = out.opt; + switch (opt.returnValue) { + case 'resultRows': + if (!opt.resultRows) opt.resultRows = []; + out.returnVal = () => opt.resultRows; + break; + case 'saveSql': + if (!opt.saveSql) opt.saveSql = []; + out.returnVal = () => opt.saveSql; + break; + case undefined: + case 'this': + out.returnVal = () => db; + break; + default: + toss3('Invalid returnValue value:', opt.returnValue); + } + if (!opt.callback && !opt.returnValue && undefined !== opt.rowMode) { + if (!opt.resultRows) opt.resultRows = []; + out.returnVal = () => opt.resultRows; + } + if (opt.callback || opt.resultRows) { + switch (undefined === opt.rowMode ? 'array' : opt.rowMode) { + case 'object': + out.cbArg = (stmt, cache) => { + if (!cache.columnNames) + cache.columnNames = stmt.getColumnNames([]); + + const row = stmt.get([]); + const rv = Object.create(null); + for (const i in cache.columnNames) + rv[cache.columnNames[i]] = row[i]; + return rv; + }; + break; + case 'array': + out.cbArg = (stmt) => stmt.get([]); + break; + case 'stmt': + if (Array.isArray(opt.resultRows)) { + toss3( + 'exec(): invalid rowMode for a resultRows array: must', + "be one of 'array', 'object',", + 'a result column number, or column name reference.', + ); + } + out.cbArg = (stmt) => stmt; + break; + default: + if (util.isInt32(opt.rowMode)) { + out.cbArg = (stmt) => stmt.get(opt.rowMode); + break; + } else if ( + 'string' === typeof opt.rowMode && + opt.rowMode.length > 1 && + '$' === opt.rowMode[0] + ) { + const $colName = opt.rowMode.substr(1); + out.cbArg = (stmt) => { + const rc = stmt.get(Object.create(null))[$colName]; + return undefined === rc + ? toss3( + capi.SQLITE_NOTFOUND, + 'exec(): unknown result column:', + $colName, + ) + : rc; + }; + break; + } + toss3('Invalid rowMode:', opt.rowMode); + } + } + return out; + }; + + const __selectFirstRow = (db, sql, bind, ...getArgs) => { + const stmt = db.prepare(sql); + try { + const rc = stmt.bind(bind).step() + ? stmt.get(...getArgs) + : undefined; + stmt.reset(); + return rc; + } finally { + stmt.finalize(); + } + }; + + const __selectAll = (db, sql, bind, rowMode) => + db.exec({ + sql, + bind, + rowMode, + returnValue: 'resultRows', + }); + + DB.checkRc = (db, resultCode) => checkSqlite3Rc(db, resultCode); + + DB.prototype = { + isOpen: function () { + return !!this.pointer; + }, + + affirmOpen: function () { + return affirmDbOpen(this); + }, + + close: function () { + if (this.pointer) { + if (this.onclose && this.onclose.before instanceof Function) { + try { + this.onclose.before(this); + } catch (e) {} + } + const pDb = this.pointer; + Object.keys(__stmtMap.get(this)).forEach((k, s) => { + if (s && s.pointer) { + try { + s.finalize(); + } catch (e) {} + } + }); + __ptrMap.delete(this); + __stmtMap.delete(this); + capi.sqlite3_close_v2(pDb); + if (this.onclose && this.onclose.after instanceof Function) { + try { + this.onclose.after(this); + } catch (e) {} + } + delete this.filename; + } + }, + + changes: function (total = false, sixtyFour = false) { + const p = affirmDbOpen(this).pointer; + if (total) { + return sixtyFour + ? capi.sqlite3_total_changes64(p) + : capi.sqlite3_total_changes(p); + } else { + return sixtyFour + ? capi.sqlite3_changes64(p) + : capi.sqlite3_changes(p); + } + }, + + dbFilename: function (dbName = 'main') { + return capi.sqlite3_db_filename(affirmDbOpen(this).pointer, dbName); + }, + + dbName: function (dbNumber = 0) { + return capi.sqlite3_db_name(affirmDbOpen(this).pointer, dbNumber); + }, + + dbVfsName: function (dbName = 0) { + let rc; + const pVfs = capi.sqlite3_js_db_vfs( + affirmDbOpen(this).pointer, + dbName, + ); + if (pVfs) { + const v = new capi.sqlite3_vfs(pVfs); + try { + rc = wasm.cstrToJs(v.$zName); + } finally { + v.dispose(); + } + } + return rc; + }, + + prepare: function (sql) { + affirmDbOpen(this); + const stack = wasm.pstack.pointer; + let ppStmt, pStmt; + try { + ppStmt = wasm.pstack.alloc(8); + DB.checkRc( + this, + capi.sqlite3_prepare_v2(this.pointer, sql, -1, ppStmt, null), + ); + pStmt = wasm.peekPtr(ppStmt); + } finally { + wasm.pstack.restore(stack); + } + if (!pStmt) toss3('Cannot prepare empty SQL.'); + const stmt = new Stmt(this, pStmt, BindTypes); + __stmtMap.get(this)[pStmt] = stmt; + return stmt; + }, + + exec: function () { + affirmDbOpen(this); + const arg = parseExecArgs(this, arguments); + if (!arg.sql) { + return toss3('exec() requires an SQL string.'); + } + const opt = arg.opt; + const callback = opt.callback; + const resultRows = Array.isArray(opt.resultRows) + ? opt.resultRows + : undefined; + let stmt; + let bind = opt.bind; + let evalFirstResult = !!( + arg.cbArg || + opt.columnNames || + resultRows + ); + const stack = wasm.scopedAllocPush(); + const saveSql = Array.isArray(opt.saveSql) + ? opt.saveSql + : undefined; + try { + const isTA = util.isSQLableTypedArray(arg.sql); + let sqlByteLen = isTA + ? arg.sql.byteLength + : wasm.jstrlen(arg.sql); + const ppStmt = wasm.scopedAlloc( + 2 * wasm.ptrSizeof + (sqlByteLen + 1), + ); + const pzTail = ppStmt + wasm.ptrSizeof; + let pSql = pzTail + wasm.ptrSizeof; + const pSqlEnd = pSql + sqlByteLen; + if (isTA) wasm.heap8().set(arg.sql, pSql); + else wasm.jstrcpy(arg.sql, wasm.heap8(), pSql, sqlByteLen, false); + wasm.poke(pSql + sqlByteLen, 0); + while (pSql && wasm.peek(pSql, 'i8')) { + wasm.pokePtr([ppStmt, pzTail], 0); + DB.checkRc( + this, + capi.sqlite3_prepare_v3( + this.pointer, + pSql, + sqlByteLen, + 0, + ppStmt, + pzTail, + ), + ); + const pStmt = wasm.peekPtr(ppStmt); + pSql = wasm.peekPtr(pzTail); + sqlByteLen = pSqlEnd - pSql; + if (!pStmt) continue; + if (saveSql) saveSql.push(capi.sqlite3_sql(pStmt).trim()); + stmt = new Stmt(this, pStmt, BindTypes); + if (bind && stmt.parameterCount) { + stmt.bind(bind); + bind = null; + } + if (evalFirstResult && stmt.columnCount) { + let gotColNames = Array.isArray(opt.columnNames) ? 0 : 1; + evalFirstResult = false; + if (arg.cbArg || resultRows) { + const cbArgCache = Object.create(null); + for (; stmt.step(); stmt._lockedByExec = false) { + if (0 === gotColNames++) { + stmt.getColumnNames( + (cbArgCache.columnNames = opt.columnNames || []), + ); + } + stmt._lockedByExec = true; + const row = arg.cbArg(stmt, cbArgCache); + if (resultRows) resultRows.push(row); + if (callback && false === callback.call(opt, row, stmt)) { + break; + } + } + stmt._lockedByExec = false; + } + if (0 === gotColNames) { + stmt.getColumnNames(opt.columnNames); + } + } else { + stmt.step(); + } + stmt.reset().finalize(); + stmt = null; + } + } finally { + wasm.scopedAllocPop(stack); + if (stmt) { + delete stmt._lockedByExec; + stmt.finalize(); + } + } + return arg.returnVal(); + }, + + createFunction: function f(name, xFunc, opt) { + const isFunc = (f) => f instanceof Function; + switch (arguments.length) { + case 1: + opt = name; + name = opt.name; + xFunc = opt.xFunc || 0; + break; + case 2: + if (!isFunc(xFunc)) { + opt = xFunc; + xFunc = opt.xFunc || 0; + } + break; + case 3: + break; + default: + break; + } + if (!opt) opt = {}; + if ('string' !== typeof name) { + toss3('Invalid arguments: missing function name.'); + } + let xStep = opt.xStep || 0; + let xFinal = opt.xFinal || 0; + const xValue = opt.xValue || 0; + const xInverse = opt.xInverse || 0; + let isWindow = undefined; + if (isFunc(xFunc)) { + isWindow = false; + if (isFunc(xStep) || isFunc(xFinal)) { + toss3('Ambiguous arguments: scalar or aggregate?'); + } + xStep = xFinal = null; + } else if (isFunc(xStep)) { + if (!isFunc(xFinal)) { + toss3('Missing xFinal() callback for aggregate or window UDF.'); + } + xFunc = null; + } else if (isFunc(xFinal)) { + toss3('Missing xStep() callback for aggregate or window UDF.'); + } else { + toss3('Missing function-type properties.'); + } + if (false === isWindow) { + if (isFunc(xValue) || isFunc(xInverse)) { + toss3( + 'xValue and xInverse are not permitted for non-window UDFs.', + ); + } + } else if (isFunc(xValue)) { + if (!isFunc(xInverse)) { + toss3('xInverse must be provided if xValue is.'); + } + isWindow = true; + } else if (isFunc(xInverse)) { + toss3('xValue must be provided if xInverse is.'); + } + const pApp = opt.pApp; + if ( + undefined !== pApp && + null !== pApp && + ('number' !== typeof pApp || !util.isInt32(pApp)) + ) { + toss3( + 'Invalid value for pApp property. Must be a legal WASM pointer value.', + ); + } + const xDestroy = opt.xDestroy || 0; + if (xDestroy && !isFunc(xDestroy)) { + toss3('xDestroy property must be a function.'); + } + let fFlags = 0; + if (getOwnOption(opt, 'deterministic')) + fFlags |= capi.SQLITE_DETERMINISTIC; + if (getOwnOption(opt, 'directOnly')) + fFlags |= capi.SQLITE_DIRECTONLY; + if (getOwnOption(opt, 'innocuous')) fFlags |= capi.SQLITE_INNOCUOUS; + name = name.toLowerCase(); + const xArity = xFunc || xStep; + const arity = getOwnOption(opt, 'arity'); + const arityArg = + 'number' === typeof arity + ? arity + : xArity.length + ? xArity.length - 1 + : 0; + let rc; + if (isWindow) { + rc = capi.sqlite3_create_window_function( + this.pointer, + name, + arityArg, + capi.SQLITE_UTF8 | fFlags, + pApp || 0, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ); + } else { + rc = capi.sqlite3_create_function_v2( + this.pointer, + name, + arityArg, + capi.SQLITE_UTF8 | fFlags, + pApp || 0, + xFunc, + xStep, + xFinal, + xDestroy, + ); + } + DB.checkRc(this, rc); + return this; + }, + + selectValue: function (sql, bind, asType) { + return __selectFirstRow(this, sql, bind, 0, asType); + }, + + selectValues: function (sql, bind, asType) { + const stmt = this.prepare(sql), + rc = []; + try { + stmt.bind(bind); + while (stmt.step()) rc.push(stmt.get(0, asType)); + stmt.reset(); + } finally { + stmt.finalize(); + } + return rc; + }, + + selectArray: function (sql, bind) { + return __selectFirstRow(this, sql, bind, []); + }, + + selectObject: function (sql, bind) { + return __selectFirstRow(this, sql, bind, {}); + }, + + selectArrays: function (sql, bind) { + return __selectAll(this, sql, bind, 'array'); + }, + + selectObjects: function (sql, bind) { + return __selectAll(this, sql, bind, 'object'); + }, + + openStatementCount: function () { + return this.pointer ? Object.keys(__stmtMap.get(this)).length : 0; + }, + + transaction: function (callback) { + let opener = 'BEGIN'; + if (arguments.length > 1) { + if (/[^a-zA-Z]/.test(arguments[0])) { + toss3( + capi.SQLITE_MISUSE, + 'Invalid argument for BEGIN qualifier.', + ); + } + opener += ' ' + arguments[0]; + callback = arguments[1]; + } + affirmDbOpen(this).exec(opener); + try { + const rc = callback(this); + this.exec('COMMIT'); + return rc; + } catch (e) { + this.exec('ROLLBACK'); + throw e; + } + }, + + savepoint: function (callback) { + affirmDbOpen(this).exec('SAVEPOINT oo1'); + try { + const rc = callback(this); + this.exec('RELEASE oo1'); + return rc; + } catch (e) { + this.exec('ROLLBACK to SAVEPOINT oo1; RELEASE SAVEPOINT oo1'); + throw e; + } + }, + + checkRc: function (resultCode) { + return checkSqlite3Rc(this, resultCode); + }, + }; + + const affirmStmtOpen = function (stmt) { + if (!stmt.pointer) toss3('Stmt has been closed.'); + return stmt; + }; + + const isSupportedBindType = function (v) { + let t = BindTypes[null === v || undefined === v ? 'null' : typeof v]; + switch (t) { + case BindTypes.boolean: + case BindTypes.null: + case BindTypes.number: + case BindTypes.string: + return t; + case BindTypes.bigint: + if (wasm.bigIntEnabled) return t; + + default: + return util.isBindableTypedArray(v) ? BindTypes.blob : undefined; + } + }; + + const affirmSupportedBindType = function (v) { + return ( + isSupportedBindType(v) || + toss3('Unsupported bind() argument type:', typeof v) + ); + }; + + const affirmParamIndex = function (stmt, key) { + const n = + 'number' === typeof key + ? key + : capi.sqlite3_bind_parameter_index(stmt.pointer, key); + if (0 === n || !util.isInt32(n)) { + toss3('Invalid bind() parameter name: ' + key); + } else if (n < 1 || n > stmt.parameterCount) + toss3('Bind index', key, 'is out of range.'); + return n; + }; + + const affirmNotLockedByExec = function (stmt, currentOpName) { + if (stmt._lockedByExec) { + toss3( + 'Operation is illegal when statement is locked:', + currentOpName, + ); + } + return stmt; + }; + + const bindOne = function f(stmt, ndx, bindType, val) { + affirmNotLockedByExec(affirmStmtOpen(stmt), 'bind()'); + if (!f._) { + f._tooBigInt = (v) => + toss3( + 'BigInt value is too big to store without precision loss:', + v, + ); + f._ = { + string: function (stmt, ndx, val, asBlob) { + const [pStr, n] = wasm.allocCString(val, true); + const f = asBlob + ? capi.sqlite3_bind_blob + : capi.sqlite3_bind_text; + return f(stmt.pointer, ndx, pStr, n, capi.SQLITE_WASM_DEALLOC); + }, + }; + } + affirmSupportedBindType(val); + ndx = affirmParamIndex(stmt, ndx); + let rc = 0; + switch ( + null === val || undefined === val ? BindTypes.null : bindType + ) { + case BindTypes.null: + rc = capi.sqlite3_bind_null(stmt.pointer, ndx); + break; + case BindTypes.string: + rc = f._.string(stmt, ndx, val, false); + break; + case BindTypes.number: { + let m; + if (util.isInt32(val)) m = capi.sqlite3_bind_int; + else if ('bigint' === typeof val) { + if (!util.bigIntFits64(val)) { + f._tooBigInt(val); + } else if (wasm.bigIntEnabled) { + m = capi.sqlite3_bind_int64; + } else if (util.bigIntFitsDouble(val)) { + val = Number(val); + m = capi.sqlite3_bind_double; + } else { + f._tooBigInt(val); + } + } else { + val = Number(val); + if (wasm.bigIntEnabled && Number.isInteger(val)) { + m = capi.sqlite3_bind_int64; + } else { + m = capi.sqlite3_bind_double; + } + } + rc = m(stmt.pointer, ndx, val); + break; + } + case BindTypes.boolean: + rc = capi.sqlite3_bind_int(stmt.pointer, ndx, val ? 1 : 0); + break; + case BindTypes.blob: { + if ('string' === typeof val) { + rc = f._.string(stmt, ndx, val, true); + break; + } else if (val instanceof ArrayBuffer) { + val = new Uint8Array(val); + } else if (!util.isBindableTypedArray(val)) { + toss3( + 'Binding a value as a blob requires', + 'that it be a string, Uint8Array, Int8Array, or ArrayBuffer.', + ); + } + const pBlob = wasm.alloc(val.byteLength || 1); + wasm.heap8().set(val.byteLength ? val : [0], pBlob); + rc = capi.sqlite3_bind_blob( + stmt.pointer, + ndx, + pBlob, + val.byteLength, + capi.SQLITE_WASM_DEALLOC, + ); + break; + } + default: + sqlite3.config.warn('Unsupported bind() argument type:', val); + toss3('Unsupported bind() argument type: ' + typeof val); + } + if (rc) DB.checkRc(stmt.db.pointer, rc); + stmt._mayGet = false; + return stmt; + }; + + Stmt.prototype = { + finalize: function () { + if (this.pointer) { + affirmNotLockedByExec(this, 'finalize()'); + const rc = capi.sqlite3_finalize(this.pointer); + delete __stmtMap.get(this.db)[this.pointer]; + __ptrMap.delete(this); + delete this._mayGet; + delete this.parameterCount; + delete this._lockedByExec; + delete this.db; + return rc; + } + }, + + clearBindings: function () { + affirmNotLockedByExec(affirmStmtOpen(this), 'clearBindings()'); + capi.sqlite3_clear_bindings(this.pointer); + this._mayGet = false; + return this; + }, + + reset: function (alsoClearBinds) { + affirmNotLockedByExec(this, 'reset()'); + if (alsoClearBinds) this.clearBindings(); + const rc = capi.sqlite3_reset(affirmStmtOpen(this).pointer); + this._mayGet = false; + checkSqlite3Rc(this.db, rc); + return this; + }, + + bind: function () { + affirmStmtOpen(this); + let ndx, arg; + switch (arguments.length) { + case 1: + ndx = 1; + arg = arguments[0]; + break; + case 2: + ndx = arguments[0]; + arg = arguments[1]; + break; + default: + toss3('Invalid bind() arguments.'); + } + if (undefined === arg) { + return this; + } else if (!this.parameterCount) { + toss3('This statement has no bindable parameters.'); + } + this._mayGet = false; + if (null === arg) { + return bindOne(this, ndx, BindTypes.null, arg); + } else if (Array.isArray(arg)) { + if (1 !== arguments.length) { + toss3( + 'When binding an array, an index argument is not permitted.', + ); + } + arg.forEach((v, i) => + bindOne(this, i + 1, affirmSupportedBindType(v), v), + ); + return this; + } else if (arg instanceof ArrayBuffer) { + arg = new Uint8Array(arg); + } + if ('object' === typeof arg && !util.isBindableTypedArray(arg)) { + if (1 !== arguments.length) { + toss3( + 'When binding an object, an index argument is not permitted.', + ); + } + Object.keys(arg).forEach((k) => + bindOne(this, k, affirmSupportedBindType(arg[k]), arg[k]), + ); + return this; + } else { + return bindOne(this, ndx, affirmSupportedBindType(arg), arg); + } + toss3('Should not reach this point.'); + }, + + bindAsBlob: function (ndx, arg) { + affirmStmtOpen(this); + if (1 === arguments.length) { + arg = ndx; + ndx = 1; + } + const t = affirmSupportedBindType(arg); + if ( + BindTypes.string !== t && + BindTypes.blob !== t && + BindTypes.null !== t + ) { + toss3('Invalid value type for bindAsBlob()'); + } + return bindOne(this, ndx, BindTypes.blob, arg); + }, + + step: function () { + affirmNotLockedByExec(this, 'step()'); + const rc = capi.sqlite3_step(affirmStmtOpen(this).pointer); + switch (rc) { + case capi.SQLITE_DONE: + return (this._mayGet = false); + case capi.SQLITE_ROW: + return (this._mayGet = true); + default: + this._mayGet = false; + sqlite3.config.warn( + 'sqlite3_step() rc=', + rc, + capi.sqlite3_js_rc_str(rc), + 'SQL =', + capi.sqlite3_sql(this.pointer), + ); + DB.checkRc(this.db.pointer, rc); + } + }, + + stepReset: function () { + this.step(); + return this.reset(); + }, + + stepFinalize: function () { + try { + const rc = this.step(); + this.reset(); + return rc; + } finally { + try { + this.finalize(); + } catch (e) {} + } + }, + + get: function (ndx, asType) { + if (!affirmStmtOpen(this)._mayGet) { + toss3('Stmt.step() has not (recently) returned true.'); + } + if (Array.isArray(ndx)) { + let i = 0; + const n = this.columnCount; + while (i < n) { + ndx[i] = this.get(i++); + } + return ndx; + } else if (ndx && 'object' === typeof ndx) { + let i = 0; + const n = this.columnCount; + while (i < n) { + ndx[capi.sqlite3_column_name(this.pointer, i)] = this.get(i++); + } + return ndx; + } + affirmColIndex(this, ndx); + switch ( + undefined === asType + ? capi.sqlite3_column_type(this.pointer, ndx) + : asType + ) { + case capi.SQLITE_NULL: + return null; + case capi.SQLITE_INTEGER: { + if (wasm.bigIntEnabled) { + const rc = capi.sqlite3_column_int64(this.pointer, ndx); + if ( + rc >= Number.MIN_SAFE_INTEGER && + rc <= Number.MAX_SAFE_INTEGER + ) { + return Number(rc).valueOf(); + } + return rc; + } else { + const rc = capi.sqlite3_column_double(this.pointer, ndx); + if ( + rc > Number.MAX_SAFE_INTEGER || + rc < Number.MIN_SAFE_INTEGER + ) { + toss3( + 'Integer is out of range for JS integer range: ' + rc, + ); + } + + return util.isInt32(rc) ? rc | 0 : rc; + } + } + case capi.SQLITE_FLOAT: + return capi.sqlite3_column_double(this.pointer, ndx); + case capi.SQLITE_TEXT: + return capi.sqlite3_column_text(this.pointer, ndx); + case capi.SQLITE_BLOB: { + const n = capi.sqlite3_column_bytes(this.pointer, ndx), + ptr = capi.sqlite3_column_blob(this.pointer, ndx), + rc = new Uint8Array(n); + + if (n) rc.set(wasm.heap8u().slice(ptr, ptr + n), 0); + + if (n && this.db._blobXfer instanceof Array) { + this.db._blobXfer.push(rc.buffer); + } + return rc; + } + default: + toss3( + "Don't know how to translate", + 'type of result column #' + ndx + '.', + ); + } + toss3('Not reached.'); + }, + + getInt: function (ndx) { + return this.get(ndx, capi.SQLITE_INTEGER); + }, + + getFloat: function (ndx) { + return this.get(ndx, capi.SQLITE_FLOAT); + }, + + getString: function (ndx) { + return this.get(ndx, capi.SQLITE_TEXT); + }, + + getBlob: function (ndx) { + return this.get(ndx, capi.SQLITE_BLOB); + }, + + getJSON: function (ndx) { + const s = this.get(ndx, capi.SQLITE_STRING); + return null === s ? s : JSON.parse(s); + }, + + getColumnName: function (ndx) { + return capi.sqlite3_column_name( + affirmColIndex(affirmStmtOpen(this), ndx).pointer, + ndx, + ); + }, + + getColumnNames: function (tgt = []) { + affirmColIndex(affirmStmtOpen(this), 0); + const n = this.columnCount; + for (let i = 0; i < n; ++i) { + tgt.push(capi.sqlite3_column_name(this.pointer, i)); + } + return tgt; + }, + + getParamIndex: function (name) { + return affirmStmtOpen(this).parameterCount + ? capi.sqlite3_bind_parameter_index(this.pointer, name) + : undefined; + }, + + getParamName: function (ndx) { + return affirmStmtOpen(this).parameterCount + ? capi.sqlite3_bind_parameter_name(this.pointer, ndx) + : undefined; + }, + + isBusy: function () { + return 0 !== capi.sqlite3_stmt_busy(affirmStmtOpen(this)); + }, + + isReadOnly: function () { + return 0 !== capi.sqlite3_stmt_readonly(affirmStmtOpen(this)); + }, + }; + + { + const prop = { + enumerable: true, + get: function () { + return __ptrMap.get(this); + }, + set: () => toss3('The pointer property is read-only.'), + }; + Object.defineProperty(Stmt.prototype, 'pointer', prop); + Object.defineProperty(DB.prototype, 'pointer', prop); + } + + Object.defineProperty(Stmt.prototype, 'columnCount', { + enumerable: false, + get: function () { + return capi.sqlite3_column_count(this.pointer); + }, + set: () => toss3('The columnCount property is read-only.'), + }); + + sqlite3.oo1 = { + DB, + Stmt, + }; + + if (util.isUIThread()) { + sqlite3.oo1.JsStorageDb = function (storageName = 'session') { + const opt = dbCtorHelper.normalizeArgs(...arguments); + storageName = opt.filename; + if ('session' !== storageName && 'local' !== storageName) { + toss3("JsStorageDb db name must be one of 'session' or 'local'."); + } + opt.vfs = 'kvvfs'; + dbCtorHelper.call(this, opt); + }; + const jdb = sqlite3.oo1.JsStorageDb; + jdb.prototype = Object.create(DB.prototype); + + jdb.clearStorage = capi.sqlite3_js_kvvfs_clear; + + jdb.prototype.clearStorage = function () { + return jdb.clearStorage(affirmDbOpen(this).filename); + }; + + jdb.storageSize = capi.sqlite3_js_kvvfs_size; + + jdb.prototype.storageSize = function () { + return jdb.storageSize(affirmDbOpen(this).filename); + }; + } + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const util = sqlite3.util; + sqlite3.initWorker1API = function () { + 'use strict'; + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + if (!(globalThis.WorkerGlobalScope instanceof Function)) { + toss('initWorker1API() must be run from a Worker thread.'); + } + const sqlite3 = this.sqlite3 || toss('Missing this.sqlite3 object.'); + const DB = sqlite3.oo1.DB; + + const getDbId = function (db) { + let id = wState.idMap.get(db); + if (id) return id; + id = 'db#' + ++wState.idSeq + '@' + db.pointer; + + wState.idMap.set(db, id); + return id; + }; + + const wState = { + dbList: [], + + idSeq: 0, + + idMap: new WeakMap(), + + xfer: [], + open: function (opt) { + const db = new DB(opt); + this.dbs[getDbId(db)] = db; + if (this.dbList.indexOf(db) < 0) this.dbList.push(db); + return db; + }, + close: function (db, alsoUnlink) { + if (db) { + delete this.dbs[getDbId(db)]; + const filename = db.filename; + const pVfs = util.sqlite3__wasm_db_vfs(db.pointer, 0); + db.close(); + const ddNdx = this.dbList.indexOf(db); + if (ddNdx >= 0) this.dbList.splice(ddNdx, 1); + if (alsoUnlink && filename && pVfs) { + util.sqlite3__wasm_vfs_unlink(pVfs, filename); + } + } + }, + + post: function (msg, xferList) { + if (xferList && xferList.length) { + globalThis.postMessage(msg, Array.from(xferList)); + xferList.length = 0; + } else { + globalThis.postMessage(msg); + } + }, + + dbs: Object.create(null), + + getDb: function (id, require = true) { + return ( + this.dbs[id] || + (require ? toss('Unknown (or closed) DB ID:', id) : undefined) + ); + }, + }; + + const affirmDbOpen = function (db = wState.dbList[0]) { + return db && db.pointer ? db : toss('DB is not opened.'); + }; + + const getMsgDb = function (msgData, affirmExists = true) { + const db = wState.getDb(msgData.dbId, false) || wState.dbList[0]; + return affirmExists ? affirmDbOpen(db) : db; + }; + + const getDefaultDbId = function () { + return wState.dbList[0] && getDbId(wState.dbList[0]); + }; + + const isSpecialDbFilename = (n) => { + return '' === n || ':' === n[0]; + }; + + const wMsgHandler = { + open: function (ev) { + const oargs = Object.create(null), + args = ev.args || Object.create(null); + if (args.simulateError) { + toss('Throwing because of simulateError flag.'); + } + const rc = Object.create(null); + oargs.vfs = args.vfs; + oargs.filename = args.filename || ''; + const db = wState.open(oargs); + rc.filename = db.filename; + rc.persistent = !!sqlite3.capi.sqlite3_js_db_uses_vfs( + db.pointer, + 'opfs', + ); + rc.dbId = getDbId(db); + rc.vfs = db.dbVfsName(); + return rc; + }, + + close: function (ev) { + const db = getMsgDb(ev, false); + const response = { + filename: db && db.filename, + }; + if (db) { + const doUnlink = + ev.args && 'object' === typeof ev.args + ? !!ev.args.unlink + : false; + wState.close(db, doUnlink); + } + return response; + }, + + exec: function (ev) { + const rc = + 'string' === typeof ev.args + ? { sql: ev.args } + : ev.args || Object.create(null); + if ('stmt' === rc.rowMode) { + toss( + "Invalid rowMode for 'exec': stmt mode", + 'does not work in the Worker API.', + ); + } else if (!rc.sql) { + toss("'exec' requires input SQL."); + } + const db = getMsgDb(ev); + if (rc.callback || Array.isArray(rc.resultRows)) { + db._blobXfer = wState.xfer; + } + const theCallback = rc.callback; + let rowNumber = 0; + const hadColNames = !!rc.columnNames; + if ('string' === typeof theCallback) { + if (!hadColNames) rc.columnNames = []; + + rc.callback = function (row, stmt) { + wState.post( + { + type: theCallback, + columnNames: rc.columnNames, + rowNumber: ++rowNumber, + row: row, + }, + wState.xfer, + ); + }; + } + try { + const changeCount = !!rc.countChanges + ? db.changes(true, 64 === rc.countChanges) + : undefined; + db.exec(rc); + if (undefined !== changeCount) { + rc.changeCount = + db.changes(true, 64 === rc.countChanges) - changeCount; + } + const lastInsertRowId = !!rc.lastInsertRowId + ? sqlite3.capi.sqlite3_last_insert_rowid(db) + : undefined; + if (undefined !== lastInsertRowId) { + rc.lastInsertRowId = lastInsertRowId; + } + if (rc.callback instanceof Function) { + rc.callback = theCallback; + + wState.post({ + type: theCallback, + columnNames: rc.columnNames, + rowNumber: null, + row: undefined, + }); + } + } finally { + delete db._blobXfer; + if (rc.callback) rc.callback = theCallback; + } + return rc; + }, + + 'config-get': function () { + const rc = Object.create(null), + src = sqlite3.config; + ['bigIntEnabled'].forEach(function (k) { + if (Object.getOwnPropertyDescriptor(src, k)) rc[k] = src[k]; + }); + rc.version = sqlite3.version; + rc.vfsList = sqlite3.capi.sqlite3_js_vfs_list(); + return rc; + }, + + export: function (ev) { + const db = getMsgDb(ev); + const response = { + byteArray: sqlite3.capi.sqlite3_js_db_export(db.pointer), + filename: db.filename, + mimetype: 'application/x-sqlite3', + }; + wState.xfer.push(response.byteArray.buffer); + return response; + }, + + toss: function (ev) { + toss('Testing worker exception'); + }, + }; + + globalThis.onmessage = async function (ev) { + ev = ev.data; + let result, + dbId = ev.dbId, + evType = ev.type; + const arrivalTime = performance.now(); + try { + if ( + wMsgHandler.hasOwnProperty(evType) && + wMsgHandler[evType] instanceof Function + ) { + result = await wMsgHandler[evType](ev); + } else { + toss('Unknown db worker message type:', ev.type); + } + } catch (err) { + evType = 'error'; + result = { + operation: ev.type, + message: err.message, + errorClass: err.name, + input: ev, + }; + if (err.stack) { + result.stack = + 'string' === typeof err.stack + ? err.stack.split(/\n\s*/) + : err.stack; + } + if (0) + sqlite3.config.warn( + 'Worker is propagating an exception to main thread.', + 'Reporting it _here_ for the stack trace:', + err, + result, + ); + } + if (!dbId) { + dbId = result.dbId || getDefaultDbId(); + } + + wState.post( + { + type: evType, + dbId: dbId, + messageId: ev.messageId, + workerReceivedTime: arrivalTime, + workerRespondTime: performance.now(), + departureTime: ev.departureTime, + + result: result, + }, + wState.xfer, + ); + }; + globalThis.postMessage({ + type: 'sqlite3-api', + result: 'worker1-ready', + }); + }.bind({ sqlite3 }); + }); + + ('use strict'); + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const wasm = sqlite3.wasm, + capi = sqlite3.capi, + toss = sqlite3.util.toss3; + const vfs = Object.create(null); + sqlite3.vfs = vfs; + + capi.sqlite3_vfs.prototype.registerVfs = function (asDefault = false) { + if (!(this instanceof sqlite3.capi.sqlite3_vfs)) { + toss('Expecting a sqlite3_vfs-type argument.'); + } + const rc = capi.sqlite3_vfs_register(this, asDefault ? 1 : 0); + if (rc) { + toss('sqlite3_vfs_register(', this, ') failed with rc', rc); + } + if (this.pointer !== capi.sqlite3_vfs_find(this.$zName)) { + toss( + 'BUG: sqlite3_vfs_find(vfs.$zName) failed for just-installed VFS', + this, + ); + } + return this; + }; + + vfs.installVfs = function (opt) { + let count = 0; + const propList = ['io', 'vfs']; + for (const key of propList) { + const o = opt[key]; + if (o) { + ++count; + o.struct.installMethods(o.methods, !!o.applyArgcCheck); + if ('vfs' === key) { + if (!o.struct.$zName && 'string' === typeof o.name) { + o.struct.addOnDispose( + (o.struct.$zName = wasm.allocCString(o.name)), + ); + } + o.struct.registerVfs(!!o.asDefault); + } + } + } + if (!count) + toss( + 'Misuse: installVfs() options object requires at least', + 'one of:', + propList, + ); + return this; + }; + }); + + ('use strict'); + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + if (!sqlite3.wasm.exports.sqlite3_declare_vtab) { + return; + } + const wasm = sqlite3.wasm, + capi = sqlite3.capi, + toss = sqlite3.util.toss3; + const vtab = Object.create(null); + sqlite3.vtab = vtab; + + const sii = capi.sqlite3_index_info; + + sii.prototype.nthConstraint = function (n, asPtr = false) { + if (n < 0 || n >= this.$nConstraint) return false; + const ptr = + this.$aConstraint + + sii.sqlite3_index_constraint.structInfo.sizeof * n; + return asPtr ? ptr : new sii.sqlite3_index_constraint(ptr); + }; + + sii.prototype.nthConstraintUsage = function (n, asPtr = false) { + if (n < 0 || n >= this.$nConstraint) return false; + const ptr = + this.$aConstraintUsage + + sii.sqlite3_index_constraint_usage.structInfo.sizeof * n; + return asPtr ? ptr : new sii.sqlite3_index_constraint_usage(ptr); + }; + + sii.prototype.nthOrderBy = function (n, asPtr = false) { + if (n < 0 || n >= this.$nOrderBy) return false; + const ptr = + this.$aOrderBy + sii.sqlite3_index_orderby.structInfo.sizeof * n; + return asPtr ? ptr : new sii.sqlite3_index_orderby(ptr); + }; + + const __xWrapFactory = function (methodName, StructType) { + return function (ptr, removeMapping = false) { + if (0 === arguments.length) ptr = new StructType(); + if (ptr instanceof StructType) { + this.set(ptr.pointer, ptr); + return ptr; + } else if (!wasm.isPtr(ptr)) { + sqlite3.SQLite3Error.toss( + 'Invalid argument to', + methodName + '()', + ); + } + let rc = this.get(ptr); + if (removeMapping) this.delete(ptr); + return rc; + }.bind(new Map()); + }; + + const StructPtrMapper = function (name, StructType) { + const __xWrap = __xWrapFactory(name, StructType); + + return Object.assign(Object.create(null), { + StructType, + + create: (ppOut) => { + const rc = __xWrap(); + wasm.pokePtr(ppOut, rc.pointer); + return rc; + }, + + get: (pCObj) => __xWrap(pCObj), + + unget: (pCObj) => __xWrap(pCObj, true), + + dispose: (pCObj) => { + const o = __xWrap(pCObj, true); + if (o) o.dispose(); + }, + }); + }; + + vtab.xVtab = StructPtrMapper('xVtab', capi.sqlite3_vtab); + + vtab.xCursor = StructPtrMapper('xCursor', capi.sqlite3_vtab_cursor); + + vtab.xIndexInfo = (pIdxInfo) => new capi.sqlite3_index_info(pIdxInfo); + + vtab.xError = function f(methodName, err, defaultRc) { + if (f.errorReporter instanceof Function) { + try { + f.errorReporter( + 'sqlite3_module::' + methodName + '(): ' + err.message, + ); + } catch (e) {} + } + let rc; + if (err instanceof sqlite3.WasmAllocError) rc = capi.SQLITE_NOMEM; + else if (arguments.length > 2) rc = defaultRc; + else if (err instanceof sqlite3.SQLite3Error) rc = err.resultCode; + return rc || capi.SQLITE_ERROR; + }; + vtab.xError.errorReporter = 1 ? console.error.bind(console) : false; + + vtab.xRowid = (ppRowid64, value) => wasm.poke(ppRowid64, value, 'i64'); + + vtab.setupModule = function (opt) { + let createdMod = false; + const mod = + this instanceof capi.sqlite3_module + ? this + : opt.struct || (createdMod = new capi.sqlite3_module()); + try { + const methods = opt.methods || toss("Missing 'methods' object."); + for (const e of Object.entries({ + xConnect: 'xCreate', + xDisconnect: 'xDestroy', + })) { + const k = e[0], + v = e[1]; + if (true === methods[k]) methods[k] = methods[v]; + else if (true === methods[v]) methods[v] = methods[k]; + } + if (opt.catchExceptions) { + const fwrap = function (methodName, func) { + if (['xConnect', 'xCreate'].indexOf(methodName) >= 0) { + return function (pDb, pAux, argc, argv, ppVtab, pzErr) { + try { + return func(...arguments) || 0; + } catch (e) { + if (!(e instanceof sqlite3.WasmAllocError)) { + wasm.dealloc(wasm.peekPtr(pzErr)); + wasm.pokePtr(pzErr, wasm.allocCString(e.message)); + } + return vtab.xError(methodName, e); + } + }; + } else { + return function (...args) { + try { + return func(...args) || 0; + } catch (e) { + return vtab.xError(methodName, e); + } + }; + } + }; + const mnames = [ + 'xCreate', + 'xConnect', + 'xBestIndex', + 'xDisconnect', + 'xDestroy', + 'xOpen', + 'xClose', + 'xFilter', + 'xNext', + 'xEof', + 'xColumn', + 'xRowid', + 'xUpdate', + 'xBegin', + 'xSync', + 'xCommit', + 'xRollback', + 'xFindFunction', + 'xRename', + 'xSavepoint', + 'xRelease', + 'xRollbackTo', + 'xShadowName', + ]; + const remethods = Object.create(null); + for (const k of mnames) { + const m = methods[k]; + if (!(m instanceof Function)) continue; + else if ('xConnect' === k && methods.xCreate === m) { + remethods[k] = methods.xCreate; + } else if ('xCreate' === k && methods.xConnect === m) { + remethods[k] = methods.xConnect; + } else { + remethods[k] = fwrap(k, m); + } + } + mod.installMethods(remethods, false); + } else { + mod.installMethods(methods, !!opt.applyArgcCheck); + } + if (0 === mod.$iVersion) { + let v; + if ('number' === typeof opt.iVersion) v = opt.iVersion; + else if (mod.$xShadowName) v = 3; + else if (mod.$xSavePoint || mod.$xRelease || mod.$xRollbackTo) + v = 2; + else v = 1; + mod.$iVersion = v; + } + } catch (e) { + if (createdMod) createdMod.dispose(); + throw e; + } + return mod; + }; + + capi.sqlite3_module.prototype.setupModule = function (opt) { + return vtab.setupModule.call(this, opt); + }; + }); + + ('use strict'); + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const installOpfsVfs = function callee(options) { + 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', + ), + ); + } else if ('undefined' === typeof WorkerGlobalScope) { + return Promise.reject( + new Error( + 'The OPFS sqlite3_vfs cannot run in the main thread ' + + 'because it requires Atomics.wait().', + ), + ); + } else if ( + !globalThis.FileSystemHandle || + !globalThis.FileSystemDirectoryHandle || + !globalThis.FileSystemFileHandle || + !globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle || + !navigator?.storage?.getDirectory + ) { + return Promise.reject(new Error('Missing required OPFS APIs.')); + } + if (!options || 'object' !== typeof options) { + options = Object.create(null); + } + const urlParams = new URL(globalThis.location.href).searchParams; + if (urlParams.has('opfs-disable')) { + return Promise.resolve(sqlite3); + } + if (undefined === options.verbose) { + options.verbose = urlParams.has('opfs-verbose') + ? +urlParams.get('opfs-verbose') || 2 + : 1; + } + if (undefined === options.sanityChecks) { + options.sanityChecks = urlParams.has('opfs-sanity-check'); + } + if (undefined === options.proxyUri) { + options.proxyUri = callee.defaultProxyUri; + } + + if ('function' === typeof options.proxyUri) { + options.proxyUri = options.proxyUri(); + } + const thePromise = new Promise(function ( + promiseResolve_, + promiseReject_, + ) { + const loggers = [ + sqlite3.config.error, + sqlite3.config.warn, + sqlite3.config.log, + ]; + const logImpl = (level, ...args) => { + if (options.verbose > level) + loggers[level]('OPFS syncer:', ...args); + }; + const log = (...args) => logImpl(2, ...args); + const warn = (...args) => logImpl(1, ...args); + const error = (...args) => logImpl(0, ...args); + const toss = sqlite3.util.toss; + const capi = sqlite3.capi; + const util = sqlite3.util; + const wasm = sqlite3.wasm; + const sqlite3_vfs = capi.sqlite3_vfs; + const sqlite3_file = capi.sqlite3_file; + const sqlite3_io_methods = capi.sqlite3_io_methods; + + const opfsUtil = Object.create(null); + + const thisThreadHasOPFS = () => { + return ( + globalThis.FileSystemHandle && + globalThis.FileSystemDirectoryHandle && + globalThis.FileSystemFileHandle && + globalThis.FileSystemFileHandle.prototype + .createSyncAccessHandle && + navigator?.storage?.getDirectory + ); + }; + + opfsUtil.metrics = { + dump: function () { + let k, + n = 0, + t = 0, + w = 0; + for (k in state.opIds) { + const m = metrics[k]; + n += m.count; + t += m.time; + w += m.wait; + m.avgTime = m.count && m.time ? m.time / m.count : 0; + m.avgWait = m.count && m.wait ? m.wait / m.count : 0; + } + sqlite3.config.log( + globalThis.location.href, + 'metrics for', + globalThis.location.href, + ':', + metrics, + '\nTotal of', + n, + 'op(s) for', + t, + 'ms (incl. ' + w + ' ms of waiting on the async side)', + ); + sqlite3.config.log('Serialization metrics:', metrics.s11n); + W.postMessage({ type: 'opfs-async-metrics' }); + }, + reset: function () { + let k; + const r = (m) => (m.count = m.time = m.wait = 0); + for (k in state.opIds) { + r((metrics[k] = Object.create(null))); + } + let s = (metrics.s11n = Object.create(null)); + s = s.serialize = Object.create(null); + s.count = s.time = 0; + s = metrics.s11n.deserialize = Object.create(null); + s.count = s.time = 0; + }, + }; + const opfsIoMethods = new sqlite3_io_methods(); + const opfsVfs = new sqlite3_vfs().addOnDispose(() => + opfsIoMethods.dispose(), + ); + let promiseWasRejected = undefined; + const promiseReject = (err) => { + promiseWasRejected = true; + opfsVfs.dispose(); + return promiseReject_(err); + }; + const promiseResolve = () => { + promiseWasRejected = false; + return promiseResolve_(sqlite3); + }; + const W = new Worker( + new URL('sqlite3-opfs-async-proxy.js', import.meta.url), + ); + setTimeout(() => { + if (undefined === promiseWasRejected) { + promiseReject( + new Error( + 'Timeout while waiting for OPFS async proxy worker.', + ), + ); + } + }, 4000); + W._originalOnError = W.onerror; + W.onerror = function (err) { + error('Error initializing OPFS asyncer:', err); + promiseReject( + new Error( + 'Loading OPFS async Worker failed for unknown reasons.', + ), + ); + }; + const pDVfs = capi.sqlite3_vfs_find(null); + const dVfs = pDVfs ? new sqlite3_vfs(pDVfs) : null; + opfsIoMethods.$iVersion = 1; + opfsVfs.$iVersion = 2; + opfsVfs.$szOsFile = capi.sqlite3_file.structInfo.sizeof; + opfsVfs.$mxPathname = 1024; + opfsVfs.$zName = wasm.allocCString('opfs'); + + opfsVfs.$xDlOpen = + opfsVfs.$xDlError = + opfsVfs.$xDlSym = + opfsVfs.$xDlClose = + null; + opfsVfs.addOnDispose( + '$zName', + opfsVfs.$zName, + 'cleanup default VFS wrapper', + () => (dVfs ? dVfs.dispose() : null), + ); + + const state = Object.create(null); + state.verbose = options.verbose; + state.littleEndian = (() => { + const buffer = new ArrayBuffer(2); + new DataView(buffer).setInt16(0, 256, true); + + return new Int16Array(buffer)[0] === 256; + })(); + + state.asyncIdleWaitTime = 150; + + state.asyncS11nExceptions = 1; + + state.fileBufferSize = 1024 * 64; + state.sabS11nOffset = state.fileBufferSize; + + state.sabS11nSize = opfsVfs.$mxPathname * 2; + + state.sabIO = new SharedArrayBuffer( + state.fileBufferSize + state.sabS11nSize, + ); + state.opIds = Object.create(null); + const metrics = Object.create(null); + { + let i = 0; + + state.opIds.whichOp = i++; + + state.opIds.rc = i++; + + state.opIds.xAccess = i++; + state.opIds.xClose = i++; + state.opIds.xDelete = i++; + state.opIds.xDeleteNoWait = i++; + state.opIds.xFileSize = i++; + state.opIds.xLock = i++; + state.opIds.xOpen = i++; + state.opIds.xRead = i++; + state.opIds.xSleep = i++; + state.opIds.xSync = i++; + state.opIds.xTruncate = i++; + state.opIds.xUnlock = i++; + state.opIds.xWrite = i++; + state.opIds.mkdir = i++; + state.opIds['opfs-async-metrics'] = i++; + state.opIds['opfs-async-shutdown'] = i++; + + state.opIds.retry = i++; + state.sabOP = new SharedArrayBuffer(i * 4); + opfsUtil.metrics.reset(); + } + + state.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((k) => { + if (undefined === (state.sq3Codes[k] = capi[k])) { + toss('Maintenance required: not found:', k); + } + }); + state.opfsFlags = Object.assign(Object.create(null), { + OPFS_UNLOCK_ASAP: 0x01, + + OPFS_UNLINK_BEFORE_OPEN: 0x02, + + defaultUnlockAsap: false, + }); + + const opRun = (op, ...args) => { + const opNdx = state.opIds[op] || toss('Invalid op ID:', op); + state.s11n.serialize(...args); + Atomics.store(state.sabOPView, state.opIds.rc, -1); + Atomics.store(state.sabOPView, state.opIds.whichOp, opNdx); + Atomics.notify(state.sabOPView, state.opIds.whichOp); + const t = performance.now(); + while ( + 'not-equal' !== + Atomics.wait(state.sabOPView, state.opIds.rc, -1) + ) {} + + const rc = Atomics.load(state.sabOPView, state.opIds.rc); + metrics[op].wait += performance.now() - t; + if (rc && state.asyncS11nExceptions) { + const err = state.s11n.deserialize(); + if (err) error(op + '() async error:', ...err); + } + return rc; + }; + + opfsUtil.debug = { + asyncShutdown: () => { + warn( + 'Shutting down OPFS async listener. The OPFS VFS will no longer work.', + ); + opRun('opfs-async-shutdown'); + }, + asyncRestart: () => { + warn( + 'Attempting to restart OPFS VFS async listener. Might work, might not.', + ); + W.postMessage({ type: 'opfs-async-restart' }); + }, + }; + + const initS11n = () => { + if (state.s11n) return state.s11n; + const textDecoder = new TextDecoder(), + textEncoder = new TextEncoder('utf-8'), + viewU8 = new Uint8Array( + state.sabIO, + state.sabS11nOffset, + state.sabS11nSize, + ), + viewDV = new DataView( + state.sabIO, + state.sabS11nOffset, + state.sabS11nSize, + ); + state.s11n = Object.create(null); + + const TypeIds = Object.create(null); + TypeIds.number = { + id: 1, + size: 8, + getter: 'getFloat64', + setter: 'setFloat64', + }; + TypeIds.bigint = { + id: 2, + size: 8, + getter: 'getBigInt64', + setter: 'setBigInt64', + }; + TypeIds.boolean = { + id: 3, + size: 4, + getter: 'getInt32', + setter: 'setInt32', + }; + TypeIds.string = { id: 4 }; + + const getTypeId = (v) => + TypeIds[typeof v] || + toss( + 'Maintenance required: this value type cannot be serialized.', + v, + ); + const getTypeIdById = (tid) => { + switch (tid) { + case TypeIds.number.id: + return TypeIds.number; + case TypeIds.bigint.id: + return TypeIds.bigint; + case TypeIds.boolean.id: + return TypeIds.boolean; + case TypeIds.string.id: + return TypeIds.string; + default: + toss('Invalid type ID:', tid); + } + }; + + state.s11n.deserialize = function (clear = false) { + ++metrics.s11n.deserialize.count; + const t = performance.now(); + const argc = viewU8[0]; + const rc = argc ? [] : null; + if (argc) { + const typeIds = []; + let offset = 1, + i, + n, + v; + for (i = 0; i < argc; ++i, ++offset) { + typeIds.push(getTypeIdById(viewU8[offset])); + } + for (i = 0; i < argc; ++i) { + const t = typeIds[i]; + if (t.getter) { + v = viewDV[t.getter](offset, state.littleEndian); + offset += t.size; + } else { + n = viewDV.getInt32(offset, state.littleEndian); + offset += 4; + v = textDecoder.decode(viewU8.slice(offset, offset + n)); + offset += n; + } + rc.push(v); + } + } + if (clear) viewU8[0] = 0; + + metrics.s11n.deserialize.time += performance.now() - t; + return rc; + }; + + state.s11n.serialize = function (...args) { + const t = performance.now(); + ++metrics.s11n.serialize.count; + if (args.length) { + const typeIds = []; + let i = 0, + offset = 1; + viewU8[0] = args.length & 0xff; + for (; i < args.length; ++i, ++offset) { + typeIds.push(getTypeId(args[i])); + viewU8[offset] = typeIds[i].id; + } + for (i = 0; i < args.length; ++i) { + const t = typeIds[i]; + if (t.setter) { + viewDV[t.setter](offset, args[i], state.littleEndian); + offset += t.size; + } else { + const s = textEncoder.encode(args[i]); + viewDV.setInt32(offset, s.byteLength, state.littleEndian); + offset += 4; + viewU8.set(s, offset); + offset += s.byteLength; + } + } + } else { + viewU8[0] = 0; + } + metrics.s11n.serialize.time += performance.now() - t; + }; + return state.s11n; + }; + + const randomFilename = function f(len = 16) { + if (!f._chars) { + f._chars = + 'abcdefghijklmnopqrstuvwxyz' + + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + + '012346789'; + f._n = f._chars.length; + } + const a = []; + let i = 0; + for (; i < len; ++i) { + const ndx = (Math.random() * (f._n * 64)) % f._n | 0; + a[i] = f._chars[ndx]; + } + return a.join(''); + }; + + const __openFiles = Object.create(null); + + const opTimer = Object.create(null); + opTimer.op = undefined; + opTimer.start = undefined; + const mTimeStart = (op) => { + opTimer.start = performance.now(); + opTimer.op = op; + ++metrics[op].count; + }; + const mTimeEnd = () => + (metrics[opTimer.op].time += performance.now() - opTimer.start); + + const ioSyncWrappers = { + xCheckReservedLock: function (pFile, pOut) { + wasm.poke(pOut, 0, 'i32'); + return 0; + }, + xClose: function (pFile) { + mTimeStart('xClose'); + let rc = 0; + const f = __openFiles[pFile]; + if (f) { + delete __openFiles[pFile]; + rc = opRun('xClose', pFile); + if (f.sq3File) f.sq3File.dispose(); + } + mTimeEnd(); + return rc; + }, + xDeviceCharacteristics: function (pFile) { + return capi.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN; + }, + xFileControl: function (pFile, opId, pArg) { + return capi.SQLITE_NOTFOUND; + }, + xFileSize: function (pFile, pSz64) { + mTimeStart('xFileSize'); + let rc = opRun('xFileSize', pFile); + if (0 == rc) { + try { + const sz = state.s11n.deserialize()[0]; + wasm.poke(pSz64, sz, 'i64'); + } catch (e) { + error('Unexpected error reading xFileSize() result:', e); + rc = state.sq3Codes.SQLITE_IOERR; + } + } + mTimeEnd(); + return rc; + }, + xLock: function (pFile, lockType) { + mTimeStart('xLock'); + const f = __openFiles[pFile]; + let rc = 0; + + if (!f.lockType) { + rc = opRun('xLock', pFile, lockType); + if (0 === rc) f.lockType = lockType; + } else { + f.lockType = lockType; + } + mTimeEnd(); + return rc; + }, + xRead: function (pFile, pDest, n, offset64) { + mTimeStart('xRead'); + const f = __openFiles[pFile]; + let rc; + try { + rc = opRun('xRead', pFile, n, Number(offset64)); + if (0 === rc || capi.SQLITE_IOERR_SHORT_READ === rc) { + wasm.heap8u().set(f.sabView.subarray(0, n), pDest); + } + } catch (e) { + error('xRead(', arguments, ') failed:', e, f); + rc = capi.SQLITE_IOERR_READ; + } + mTimeEnd(); + return rc; + }, + xSync: function (pFile, flags) { + mTimeStart('xSync'); + ++metrics.xSync.count; + const rc = opRun('xSync', pFile, flags); + mTimeEnd(); + return rc; + }, + xTruncate: function (pFile, sz64) { + mTimeStart('xTruncate'); + const rc = opRun('xTruncate', pFile, Number(sz64)); + mTimeEnd(); + return rc; + }, + xUnlock: function (pFile, lockType) { + mTimeStart('xUnlock'); + const f = __openFiles[pFile]; + let rc = 0; + if (capi.SQLITE_LOCK_NONE === lockType && f.lockType) { + rc = opRun('xUnlock', pFile, lockType); + } + if (0 === rc) f.lockType = lockType; + mTimeEnd(); + return rc; + }, + xWrite: function (pFile, pSrc, n, offset64) { + mTimeStart('xWrite'); + const f = __openFiles[pFile]; + let rc; + try { + f.sabView.set(wasm.heap8u().subarray(pSrc, pSrc + n)); + rc = opRun('xWrite', pFile, n, Number(offset64)); + } catch (e) { + error('xWrite(', arguments, ') failed:', e, f); + rc = capi.SQLITE_IOERR_WRITE; + } + mTimeEnd(); + return rc; + }, + }; + + const vfsSyncWrappers = { + xAccess: function (pVfs, zName, flags, pOut) { + mTimeStart('xAccess'); + const rc = opRun('xAccess', wasm.cstrToJs(zName)); + wasm.poke(pOut, rc ? 0 : 1, 'i32'); + mTimeEnd(); + return 0; + }, + xCurrentTime: function (pVfs, pOut) { + wasm.poke( + pOut, + 2440587.5 + new Date().getTime() / 86400000, + 'double', + ); + return 0; + }, + xCurrentTimeInt64: function (pVfs, pOut) { + wasm.poke( + pOut, + 2440587.5 * 86400000 + new Date().getTime(), + 'i64', + ); + return 0; + }, + xDelete: function (pVfs, zName, doSyncDir) { + mTimeStart('xDelete'); + const rc = opRun( + 'xDelete', + wasm.cstrToJs(zName), + doSyncDir, + false, + ); + mTimeEnd(); + return rc; + }, + xFullPathname: function (pVfs, zName, nOut, pOut) { + const i = wasm.cstrncpy(pOut, zName, nOut); + return i < nOut ? 0 : capi.SQLITE_CANTOPEN; + }, + xGetLastError: function (pVfs, nOut, pOut) { + warn('OPFS xGetLastError() has nothing sensible to return.'); + return 0; + }, + + xOpen: function f(pVfs, zName, pFile, flags, pOutFlags) { + mTimeStart('xOpen'); + let opfsFlags = 0; + if (0 === zName) { + zName = randomFilename(); + } else if (wasm.isPtr(zName)) { + if (capi.sqlite3_uri_boolean(zName, 'opfs-unlock-asap', 0)) { + opfsFlags |= state.opfsFlags.OPFS_UNLOCK_ASAP; + } + if ( + capi.sqlite3_uri_boolean(zName, 'delete-before-open', 0) + ) { + opfsFlags |= state.opfsFlags.OPFS_UNLINK_BEFORE_OPEN; + } + zName = wasm.cstrToJs(zName); + } + const fh = Object.create(null); + fh.fid = pFile; + fh.filename = zName; + fh.sab = new SharedArrayBuffer(state.fileBufferSize); + fh.flags = flags; + fh.readOnly = + !(sqlite3.SQLITE_OPEN_CREATE & flags) && + !!(flags & capi.SQLITE_OPEN_READONLY); + const rc = opRun('xOpen', pFile, zName, flags, opfsFlags); + if (!rc) { + if (fh.readOnly) { + wasm.poke(pOutFlags, capi.SQLITE_OPEN_READONLY, 'i32'); + } + __openFiles[pFile] = fh; + fh.sabView = state.sabFileBufView; + fh.sq3File = new sqlite3_file(pFile); + fh.sq3File.$pMethods = opfsIoMethods.pointer; + fh.lockType = capi.SQLITE_LOCK_NONE; + } + mTimeEnd(); + return rc; + }, + }; + + if (dVfs) { + opfsVfs.$xRandomness = dVfs.$xRandomness; + opfsVfs.$xSleep = dVfs.$xSleep; + } + if (!opfsVfs.$xRandomness) { + vfsSyncWrappers.xRandomness = function (pVfs, nOut, pOut) { + const heap = wasm.heap8u(); + let i = 0; + for (; i < nOut; ++i) + heap[pOut + i] = (Math.random() * 255000) & 0xff; + return i; + }; + } + if (!opfsVfs.$xSleep) { + vfsSyncWrappers.xSleep = function (pVfs, ms) { + Atomics.wait(state.sabOPView, state.opIds.xSleep, 0, ms); + return 0; + }; + } + + opfsUtil.getResolvedPath = function (filename, splitIt) { + const p = new URL(filename, 'file://irrelevant').pathname; + return splitIt ? p.split('/').filter((v) => !!v) : p; + }; + + opfsUtil.getDirForFilename = async function f( + absFilename, + createDirs = false, + ) { + const path = opfsUtil.getResolvedPath(absFilename, true); + const filename = path.pop(); + let dh = opfsUtil.rootDirectory; + for (const dirName of path) { + if (dirName) { + dh = await dh.getDirectoryHandle(dirName, { + create: !!createDirs, + }); + } + } + return [dh, filename]; + }; + + opfsUtil.mkdir = async function (absDirName) { + try { + await opfsUtil.getDirForFilename( + absDirName + '/filepart', + true, + ); + return true; + } catch (e) { + return false; + } + }; + + opfsUtil.entryExists = async function (fsEntryName) { + try { + const [dh, fn] = await opfsUtil.getDirForFilename(fsEntryName); + await dh.getFileHandle(fn); + return true; + } catch (e) { + return false; + } + }; + + opfsUtil.randomFilename = randomFilename; + + opfsUtil.treeList = async function () { + const doDir = async function callee(dirHandle, tgt) { + tgt.name = dirHandle.name; + tgt.dirs = []; + tgt.files = []; + for await (const handle of dirHandle.values()) { + if ('directory' === handle.kind) { + const subDir = Object.create(null); + tgt.dirs.push(subDir); + await callee(handle, subDir); + } else { + tgt.files.push(handle.name); + } + } + }; + const root = Object.create(null); + await doDir(opfsUtil.rootDirectory, root); + return root; + }; + + opfsUtil.rmfr = async function () { + const dir = opfsUtil.rootDirectory, + opt = { recurse: true }; + for await (const handle of dir.values()) { + dir.removeEntry(handle.name, opt); + } + }; + + opfsUtil.unlink = async function ( + fsEntryName, + recursive = false, + throwOnError = false, + ) { + try { + const [hDir, filenamePart] = await opfsUtil.getDirForFilename( + fsEntryName, + false, + ); + await hDir.removeEntry(filenamePart, { recursive }); + return true; + } catch (e) { + if (throwOnError) { + throw new Error( + 'unlink(', + arguments[0], + ') failed: ' + e.message, + { + cause: e, + }, + ); + } + return false; + } + }; + + opfsUtil.traverse = async function (opt) { + const defaultOpt = { + recursive: true, + directory: opfsUtil.rootDirectory, + }; + if ('function' === typeof opt) { + opt = { callback: opt }; + } + opt = Object.assign(defaultOpt, opt || {}); + const doDir = async function callee(dirHandle, depth) { + for await (const handle of dirHandle.values()) { + if (false === opt.callback(handle, dirHandle, depth)) + return false; + else if (opt.recursive && 'directory' === handle.kind) { + if (false === (await callee(handle, depth + 1))) break; + } + } + }; + doDir(opt.directory, 0); + }; + + const importDbChunked = async function (filename, callback) { + const [hDir, fnamePart] = await opfsUtil.getDirForFilename( + filename, + true, + ); + const hFile = await hDir.getFileHandle(fnamePart, { + create: true, + }); + let sah = await hFile.createSyncAccessHandle(); + let nWrote = 0, + chunk, + checkedHeader = false, + err = false; + try { + sah.truncate(0); + while (undefined !== (chunk = await callback())) { + if (chunk instanceof ArrayBuffer) + chunk = new Uint8Array(chunk); + if (0 === nWrote && chunk.byteLength >= 15) { + util.affirmDbHeader(chunk); + checkedHeader = true; + } + sah.write(chunk, { at: nWrote }); + nWrote += chunk.byteLength; + } + if (nWrote < 512 || 0 !== nWrote % 512) { + toss( + 'Input size', + nWrote, + 'is not correct for an SQLite database.', + ); + } + if (!checkedHeader) { + const header = new Uint8Array(20); + sah.read(header, { at: 0 }); + util.affirmDbHeader(header); + } + sah.write(new Uint8Array([1, 1]), { at: 18 }); + return nWrote; + } catch (e) { + await sah.close(); + sah = undefined; + await hDir.removeEntry(fnamePart).catch(() => {}); + throw e; + } finally { + if (sah) await sah.close(); + } + }; + + opfsUtil.importDb = async function (filename, bytes) { + if (bytes instanceof Function) { + return importDbChunked(filename, bytes); + } + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + util.affirmIsDb(bytes); + const n = bytes.byteLength; + const [hDir, fnamePart] = await opfsUtil.getDirForFilename( + filename, + true, + ); + let sah, + err, + nWrote = 0; + try { + const hFile = await hDir.getFileHandle(fnamePart, { + create: true, + }); + sah = await hFile.createSyncAccessHandle(); + sah.truncate(0); + nWrote = sah.write(bytes, { at: 0 }); + if (nWrote != n) { + toss( + 'Expected to write ' + + n + + ' bytes but wrote ' + + nWrote + + '.', + ); + } + sah.write(new Uint8Array([1, 1]), { at: 18 }); + return nWrote; + } catch (e) { + if (sah) { + await sah.close(); + sah = undefined; + } + await hDir.removeEntry(fnamePart).catch(() => {}); + throw e; + } finally { + if (sah) await sah.close(); + } + }; + + if (sqlite3.oo1) { + const OpfsDb = function (...args) { + const opt = sqlite3.oo1.DB.dbCtorHelper.normalizeArgs(...args); + opt.vfs = opfsVfs.$zName; + sqlite3.oo1.DB.dbCtorHelper.call(this, opt); + }; + OpfsDb.prototype = Object.create(sqlite3.oo1.DB.prototype); + sqlite3.oo1.OpfsDb = OpfsDb; + OpfsDb.importDb = opfsUtil.importDb; + sqlite3.oo1.DB.dbCtorHelper.setVfsPostOpenCallback( + opfsVfs.pointer, + function (oo1Db, sqlite3) { + sqlite3.capi.sqlite3_busy_timeout(oo1Db, 10000); + }, + ); + } + + const sanityCheck = function () { + const scope = wasm.scopedAllocPush(); + const sq3File = new sqlite3_file(); + try { + const fid = sq3File.pointer; + const openFlags = + capi.SQLITE_OPEN_CREATE | + capi.SQLITE_OPEN_READWRITE | + capi.SQLITE_OPEN_MAIN_DB; + const pOut = wasm.scopedAlloc(8); + const dbFile = '/sanity/check/file' + randomFilename(8); + const zDbFile = wasm.scopedAllocCString(dbFile); + let rc; + state.s11n.serialize('This is ä string.'); + rc = state.s11n.deserialize(); + log('deserialize() says:', rc); + if ('This is ä string.' !== rc[0]) toss('String d13n error.'); + vfsSyncWrappers.xAccess(opfsVfs.pointer, zDbFile, 0, pOut); + rc = wasm.peek(pOut, 'i32'); + log('xAccess(', dbFile, ') exists ?=', rc); + rc = vfsSyncWrappers.xOpen( + opfsVfs.pointer, + zDbFile, + fid, + openFlags, + pOut, + ); + log( + 'open rc =', + rc, + 'state.sabOPView[xOpen] =', + state.sabOPView[state.opIds.xOpen], + ); + if (0 !== rc) { + error('open failed with code', rc); + return; + } + vfsSyncWrappers.xAccess(opfsVfs.pointer, zDbFile, 0, pOut); + rc = wasm.peek(pOut, 'i32'); + if (!rc) toss('xAccess() failed to detect file.'); + rc = ioSyncWrappers.xSync(sq3File.pointer, 0); + if (rc) toss('sync failed w/ rc', rc); + rc = ioSyncWrappers.xTruncate(sq3File.pointer, 1024); + if (rc) toss('truncate failed w/ rc', rc); + wasm.poke(pOut, 0, 'i64'); + rc = ioSyncWrappers.xFileSize(sq3File.pointer, pOut); + if (rc) toss('xFileSize failed w/ rc', rc); + log('xFileSize says:', wasm.peek(pOut, 'i64')); + rc = ioSyncWrappers.xWrite(sq3File.pointer, zDbFile, 10, 1); + if (rc) toss('xWrite() failed!'); + const readBuf = wasm.scopedAlloc(16); + rc = ioSyncWrappers.xRead(sq3File.pointer, readBuf, 6, 2); + wasm.poke(readBuf + 6, 0); + let jRead = wasm.cstrToJs(readBuf); + log('xRead() got:', jRead); + if ('sanity' !== jRead) toss('Unexpected xRead() value.'); + if (vfsSyncWrappers.xSleep) { + log('xSleep()ing before close()ing...'); + vfsSyncWrappers.xSleep(opfsVfs.pointer, 2000); + log('waking up from xSleep()'); + } + rc = ioSyncWrappers.xClose(fid); + log('xClose rc =', rc, 'sabOPView =', state.sabOPView); + log('Deleting file:', dbFile); + vfsSyncWrappers.xDelete(opfsVfs.pointer, zDbFile, 0x1234); + vfsSyncWrappers.xAccess(opfsVfs.pointer, zDbFile, 0, pOut); + rc = wasm.peek(pOut, 'i32'); + if (rc) + toss( + 'Expecting 0 from xAccess(', + dbFile, + ') after xDelete().', + ); + warn('End of OPFS sanity checks.'); + } finally { + sq3File.dispose(); + wasm.scopedAllocPop(scope); + } + }; + + W.onmessage = function ({ data }) { + switch (data.type) { + case 'opfs-unavailable': + promiseReject(new Error(data.payload.join(' '))); + break; + case 'opfs-async-loaded': + W.postMessage({ type: 'opfs-async-init', args: state }); + break; + case 'opfs-async-inited': { + if (true === promiseWasRejected) { + break; + } + try { + sqlite3.vfs.installVfs({ + io: { struct: opfsIoMethods, methods: ioSyncWrappers }, + vfs: { struct: opfsVfs, methods: vfsSyncWrappers }, + }); + state.sabOPView = new Int32Array(state.sabOP); + state.sabFileBufView = new Uint8Array( + state.sabIO, + 0, + state.fileBufferSize, + ); + state.sabS11nView = new Uint8Array( + state.sabIO, + state.sabS11nOffset, + state.sabS11nSize, + ); + initS11n(); + if (options.sanityChecks) { + warn( + 'Running sanity checks because of opfs-sanity-check URL arg...', + ); + sanityCheck(); + } + if (thisThreadHasOPFS()) { + navigator.storage + .getDirectory() + .then((d) => { + W.onerror = W._originalOnError; + delete W._originalOnError; + sqlite3.opfs = opfsUtil; + opfsUtil.rootDirectory = d; + log('End of OPFS sqlite3_vfs setup.', opfsVfs); + promiseResolve(); + }) + .catch(promiseReject); + } else { + promiseResolve(); + } + } catch (e) { + error(e); + promiseReject(e); + } + break; + } + default: { + const errMsg = + 'Unexpected message from the OPFS async worker: ' + + JSON.stringify(data); + error(errMsg); + promiseReject(new Error(errMsg)); + break; + } + } + }; + }); + return thePromise; + }; + installOpfsVfs.defaultProxyUri = 'sqlite3-opfs-async-proxy.js'; + globalThis.sqlite3ApiBootstrap.initializersAsync.push( + async (sqlite3) => { + try { + let proxyJs = installOpfsVfs.defaultProxyUri; + if (sqlite3.scriptInfo.sqlite3Dir) { + installOpfsVfs.defaultProxyUri = + sqlite3.scriptInfo.sqlite3Dir + proxyJs; + } + return installOpfsVfs().catch((e) => { + sqlite3.config.warn( + 'Ignoring inability to install OPFS sqlite3_vfs:', + e.message, + ); + }); + } catch (e) { + sqlite3.config.error('installOpfsVfs() exception:', e); + return Promise.reject(e); + } + }, + ); + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + 'use strict'; + const toss = sqlite3.util.toss; + const toss3 = sqlite3.util.toss3; + const initPromises = Object.create(null); + const capi = sqlite3.capi; + const util = sqlite3.util; + const wasm = sqlite3.wasm; + + const SECTOR_SIZE = 4096; + const HEADER_MAX_PATH_SIZE = 512; + const HEADER_FLAGS_SIZE = 4; + const HEADER_DIGEST_SIZE = 8; + const HEADER_CORPUS_SIZE = HEADER_MAX_PATH_SIZE + HEADER_FLAGS_SIZE; + const HEADER_OFFSET_FLAGS = HEADER_MAX_PATH_SIZE; + const HEADER_OFFSET_DIGEST = HEADER_CORPUS_SIZE; + const HEADER_OFFSET_DATA = SECTOR_SIZE; + + const PERSISTENT_FILE_TYPES = + capi.SQLITE_OPEN_MAIN_DB | + capi.SQLITE_OPEN_MAIN_JOURNAL | + capi.SQLITE_OPEN_SUPER_JOURNAL | + capi.SQLITE_OPEN_WAL; + const FLAG_COMPUTE_DIGEST_V2 = capi.SQLITE_OPEN_MEMORY; + const OPAQUE_DIR_NAME = '.opaque'; + + const getRandomName = () => Math.random().toString(36).slice(2); + + const textDecoder = new TextDecoder(); + const textEncoder = new TextEncoder(); + + const optionDefaults = Object.assign(Object.create(null), { + name: 'opfs-sahpool', + directory: undefined, + initialCapacity: 6, + clearOnInit: false, + + verbosity: 2, + forceReinitIfPreviouslyFailed: false, + }); + + const loggers = [ + sqlite3.config.error, + sqlite3.config.warn, + sqlite3.config.log, + ]; + const log = sqlite3.config.log; + const warn = sqlite3.config.warn; + const error = sqlite3.config.error; + + const __mapVfsToPool = new Map(); + const getPoolForVfs = (pVfs) => __mapVfsToPool.get(pVfs); + const setPoolForVfs = (pVfs, pool) => { + if (pool) __mapVfsToPool.set(pVfs, pool); + else __mapVfsToPool.delete(pVfs); + }; + + const __mapSqlite3File = new Map(); + const getPoolForPFile = (pFile) => __mapSqlite3File.get(pFile); + const setPoolForPFile = (pFile, pool) => { + if (pool) __mapSqlite3File.set(pFile, pool); + else __mapSqlite3File.delete(pFile); + }; + + const ioMethods = { + xCheckReservedLock: function (pFile, pOut) { + const pool = getPoolForPFile(pFile); + pool.log('xCheckReservedLock'); + pool.storeErr(); + wasm.poke32(pOut, 1); + return 0; + }, + xClose: function (pFile) { + const pool = getPoolForPFile(pFile); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + if (file) { + try { + pool.log(`xClose ${file.path}`); + pool.mapS3FileToOFile(pFile, false); + file.sah.flush(); + if (file.flags & capi.SQLITE_OPEN_DELETEONCLOSE) { + pool.deletePath(file.path); + } + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + } + return 0; + }, + xDeviceCharacteristics: function (pFile) { + return capi.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN; + }, + xFileControl: function (pFile, opId, pArg) { + return capi.SQLITE_NOTFOUND; + }, + xFileSize: function (pFile, pSz64) { + const pool = getPoolForPFile(pFile); + pool.log(`xFileSize`); + const file = pool.getOFileForS3File(pFile); + const size = file.sah.getSize() - HEADER_OFFSET_DATA; + + wasm.poke64(pSz64, BigInt(size)); + return 0; + }, + xLock: function (pFile, lockType) { + const pool = getPoolForPFile(pFile); + pool.log(`xLock ${lockType}`); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + file.lockType = lockType; + return 0; + }, + xRead: function (pFile, pDest, n, offset64) { + const pool = getPoolForPFile(pFile); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + pool.log(`xRead ${file.path} ${n} @ ${offset64}`); + try { + const nRead = file.sah.read( + wasm.heap8u().subarray(pDest, pDest + n), + { at: HEADER_OFFSET_DATA + Number(offset64) }, + ); + if (nRead < n) { + wasm.heap8u().fill(0, pDest + nRead, pDest + n); + return capi.SQLITE_IOERR_SHORT_READ; + } + return 0; + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + }, + xSectorSize: function (pFile) { + return SECTOR_SIZE; + }, + xSync: function (pFile, flags) { + const pool = getPoolForPFile(pFile); + pool.log(`xSync ${flags}`); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + + try { + file.sah.flush(); + return 0; + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + }, + xTruncate: function (pFile, sz64) { + const pool = getPoolForPFile(pFile); + pool.log(`xTruncate ${sz64}`); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + + try { + file.sah.truncate(HEADER_OFFSET_DATA + Number(sz64)); + return 0; + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + }, + xUnlock: function (pFile, lockType) { + const pool = getPoolForPFile(pFile); + pool.log('xUnlock'); + const file = pool.getOFileForS3File(pFile); + file.lockType = lockType; + return 0; + }, + xWrite: function (pFile, pSrc, n, offset64) { + const pool = getPoolForPFile(pFile); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + pool.log(`xWrite ${file.path} ${n} ${offset64}`); + try { + const nBytes = file.sah.write( + wasm.heap8u().subarray(pSrc, pSrc + n), + { at: HEADER_OFFSET_DATA + Number(offset64) }, + ); + return n === nBytes ? 0 : toss('Unknown write() failure.'); + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + }, + }; + + const opfsIoMethods = new capi.sqlite3_io_methods(); + opfsIoMethods.$iVersion = 1; + sqlite3.vfs.installVfs({ + io: { struct: opfsIoMethods, methods: ioMethods }, + }); + + const vfsMethods = { + xAccess: function (pVfs, zName, flags, pOut) { + const pool = getPoolForVfs(pVfs); + pool.storeErr(); + try { + const name = pool.getPath(zName); + wasm.poke32(pOut, pool.hasFilename(name) ? 1 : 0); + } catch (e) { + wasm.poke32(pOut, 0); + } + return 0; + }, + xCurrentTime: function (pVfs, pOut) { + wasm.poke( + pOut, + 2440587.5 + new Date().getTime() / 86400000, + 'double', + ); + return 0; + }, + xCurrentTimeInt64: function (pVfs, pOut) { + wasm.poke(pOut, 2440587.5 * 86400000 + new Date().getTime(), 'i64'); + return 0; + }, + xDelete: function (pVfs, zName, doSyncDir) { + const pool = getPoolForVfs(pVfs); + pool.log(`xDelete ${wasm.cstrToJs(zName)}`); + pool.storeErr(); + try { + pool.deletePath(pool.getPath(zName)); + return 0; + } catch (e) { + pool.storeErr(e); + return capi.SQLITE_IOERR_DELETE; + } + }, + xFullPathname: function (pVfs, zName, nOut, pOut) { + const i = wasm.cstrncpy(pOut, zName, nOut); + return i < nOut ? 0 : capi.SQLITE_CANTOPEN; + }, + xGetLastError: function (pVfs, nOut, pOut) { + const pool = getPoolForVfs(pVfs); + const e = pool.popErr(); + pool.log(`xGetLastError ${nOut} e =`, e); + if (e) { + const scope = wasm.scopedAllocPush(); + try { + const [cMsg, n] = wasm.scopedAllocCString(e.message, true); + wasm.cstrncpy(pOut, cMsg, nOut); + if (n > nOut) wasm.poke8(pOut + nOut - 1, 0); + } catch (e) { + return capi.SQLITE_NOMEM; + } finally { + wasm.scopedAllocPop(scope); + } + } + return e ? e.sqlite3Rc || capi.SQLITE_IOERR : 0; + }, + + xOpen: function f(pVfs, zName, pFile, flags, pOutFlags) { + const pool = getPoolForVfs(pVfs); + try { + flags &= ~FLAG_COMPUTE_DIGEST_V2; + pool.log(`xOpen ${wasm.cstrToJs(zName)} ${flags}`); + + const path = + zName && wasm.peek8(zName) + ? pool.getPath(zName) + : getRandomName(); + let sah = pool.getSAHForPath(path); + if (!sah && flags & capi.SQLITE_OPEN_CREATE) { + if (pool.getFileCount() < pool.getCapacity()) { + sah = pool.nextAvailableSAH(); + pool.setAssociatedPath(sah, path, flags); + } else { + toss('SAH pool is full. Cannot create file', path); + } + } + if (!sah) { + toss('file not found:', path); + } + + const file = { path, flags, sah }; + pool.mapS3FileToOFile(pFile, file); + file.lockType = capi.SQLITE_LOCK_NONE; + const sq3File = new capi.sqlite3_file(pFile); + sq3File.$pMethods = opfsIoMethods.pointer; + sq3File.dispose(); + wasm.poke32(pOutFlags, flags); + return 0; + } catch (e) { + pool.storeErr(e); + return capi.SQLITE_CANTOPEN; + } + }, + }; + + const createOpfsVfs = function (vfsName) { + if (sqlite3.capi.sqlite3_vfs_find(vfsName)) { + toss3('VFS name is already registered:', vfsName); + } + const opfsVfs = new capi.sqlite3_vfs(); + + const pDVfs = capi.sqlite3_vfs_find(null); + const dVfs = pDVfs ? new capi.sqlite3_vfs(pDVfs) : null; + opfsVfs.$iVersion = 2; + opfsVfs.$szOsFile = capi.sqlite3_file.structInfo.sizeof; + opfsVfs.$mxPathname = HEADER_MAX_PATH_SIZE; + opfsVfs.addOnDispose( + (opfsVfs.$zName = wasm.allocCString(vfsName)), + () => setPoolForVfs(opfsVfs.pointer, 0), + ); + + if (dVfs) { + opfsVfs.$xRandomness = dVfs.$xRandomness; + opfsVfs.$xSleep = dVfs.$xSleep; + dVfs.dispose(); + } + if (!opfsVfs.$xRandomness && !vfsMethods.xRandomness) { + vfsMethods.xRandomness = function (pVfs, nOut, pOut) { + const heap = wasm.heap8u(); + let i = 0; + for (; i < nOut; ++i) + heap[pOut + i] = (Math.random() * 255000) & 0xff; + return i; + }; + } + if (!opfsVfs.$xSleep && !vfsMethods.xSleep) { + vfsMethods.xSleep = (pVfs, ms) => 0; + } + sqlite3.vfs.installVfs({ + vfs: { struct: opfsVfs, methods: vfsMethods }, + }); + return opfsVfs; + }; + + class OpfsSAHPool { + vfsDir; + + #dhVfsRoot; + + #dhOpaque; + + #dhVfsParent; + + #mapSAHToName = new Map(); + + #mapFilenameToSAH = new Map(); + + #availableSAH = new Set(); + + #mapS3FileToOFile_ = new Map(); + + #apBody = new Uint8Array(HEADER_CORPUS_SIZE); + + #dvBody; + + #cVfs; + + #verbosity; + + constructor(options = Object.create(null)) { + this.#verbosity = options.verbosity ?? optionDefaults.verbosity; + this.vfsName = options.name || optionDefaults.name; + this.#cVfs = createOpfsVfs(this.vfsName); + setPoolForVfs(this.#cVfs.pointer, this); + this.vfsDir = options.directory || '.' + this.vfsName; + this.#dvBody = new DataView( + this.#apBody.buffer, + this.#apBody.byteOffset, + ); + this.isReady = this.reset( + !!(options.clearOnInit ?? optionDefaults.clearOnInit), + ).then(() => { + if (this.$error) throw this.$error; + return this.getCapacity() + ? Promise.resolve(undefined) + : this.addCapacity( + options.initialCapacity || optionDefaults.initialCapacity, + ); + }); + } + + #logImpl(level, ...args) { + if (this.#verbosity > level) + loggers[level](this.vfsName + ':', ...args); + } + log(...args) { + this.#logImpl(2, ...args); + } + warn(...args) { + this.#logImpl(1, ...args); + } + error(...args) { + this.#logImpl(0, ...args); + } + + getVfs() { + return this.#cVfs; + } + + getCapacity() { + return this.#mapSAHToName.size; + } + + getFileCount() { + return this.#mapFilenameToSAH.size; + } + + getFileNames() { + const rc = []; + for (const n of this.#mapFilenameToSAH.keys()) rc.push(n); + return rc; + } + + async addCapacity(n) { + for (let i = 0; i < n; ++i) { + const name = getRandomName(); + const h = await this.#dhOpaque.getFileHandle(name, { + create: true, + }); + const ah = await h.createSyncAccessHandle(); + this.#mapSAHToName.set(ah, name); + this.setAssociatedPath(ah, '', 0); + } + return this.getCapacity(); + } + + async reduceCapacity(n) { + let nRm = 0; + for (const ah of Array.from(this.#availableSAH)) { + if (nRm === n || this.getFileCount() === this.getCapacity()) { + break; + } + const name = this.#mapSAHToName.get(ah); + + ah.close(); + await this.#dhOpaque.removeEntry(name); + this.#mapSAHToName.delete(ah); + this.#availableSAH.delete(ah); + ++nRm; + } + return nRm; + } + + releaseAccessHandles() { + for (const ah of this.#mapSAHToName.keys()) ah.close(); + this.#mapSAHToName.clear(); + this.#mapFilenameToSAH.clear(); + this.#availableSAH.clear(); + } + + async acquireAccessHandles(clearFiles = false) { + const files = []; + for await (const [name, h] of this.#dhOpaque) { + if ('file' === h.kind) { + files.push([name, h]); + } + } + return Promise.all( + files.map(async ([name, h]) => { + try { + const ah = await h.createSyncAccessHandle(); + this.#mapSAHToName.set(ah, name); + if (clearFiles) { + ah.truncate(HEADER_OFFSET_DATA); + this.setAssociatedPath(ah, '', 0); + } else { + const path = this.getAssociatedPath(ah); + if (path) { + this.#mapFilenameToSAH.set(path, ah); + } else { + this.#availableSAH.add(ah); + } + } + } catch (e) { + this.storeErr(e); + this.releaseAccessHandles(); + throw e; + } + }), + ); + } + + getAssociatedPath(sah) { + sah.read(this.#apBody, { at: 0 }); + + const flags = this.#dvBody.getUint32(HEADER_OFFSET_FLAGS); + if ( + this.#apBody[0] && + (flags & capi.SQLITE_OPEN_DELETEONCLOSE || + (flags & PERSISTENT_FILE_TYPES) === 0) + ) { + warn( + `Removing file with unexpected flags ${flags.toString(16)}`, + this.#apBody, + ); + this.setAssociatedPath(sah, '', 0); + return ''; + } + + const fileDigest = new Uint32Array(HEADER_DIGEST_SIZE / 4); + sah.read(fileDigest, { at: HEADER_OFFSET_DIGEST }); + const compDigest = this.computeDigest(this.#apBody, flags); + + if (fileDigest.every((v, i) => v === compDigest[i])) { + const pathBytes = this.#apBody.findIndex((v) => 0 === v); + if (0 === pathBytes) { + sah.truncate(HEADER_OFFSET_DATA); + } + + return pathBytes + ? textDecoder.decode(this.#apBody.subarray(0, pathBytes)) + : ''; + } else { + warn('Disassociating file with bad digest.'); + this.setAssociatedPath(sah, '', 0); + return ''; + } + } + + setAssociatedPath(sah, path, flags) { + const enc = textEncoder.encodeInto(path, this.#apBody); + if (HEADER_MAX_PATH_SIZE <= enc.written + 1) { + toss('Path too long:', path); + } + if (path && flags) { + flags |= FLAG_COMPUTE_DIGEST_V2; + } + this.#apBody.fill(0, enc.written, HEADER_MAX_PATH_SIZE); + this.#dvBody.setUint32(HEADER_OFFSET_FLAGS, flags); + const digest = this.computeDigest(this.#apBody, flags); + + sah.write(this.#apBody, { at: 0 }); + sah.write(digest, { at: HEADER_OFFSET_DIGEST }); + sah.flush(); + + if (path) { + this.#mapFilenameToSAH.set(path, sah); + this.#availableSAH.delete(sah); + } else { + sah.truncate(HEADER_OFFSET_DATA); + this.#availableSAH.add(sah); + } + } + + computeDigest(byteArray, fileFlags) { + if (fileFlags & FLAG_COMPUTE_DIGEST_V2) { + let h1 = 0xdeadbeef; + let h2 = 0x41c6ce57; + for (const v of byteArray) { + h1 = Math.imul(h1 ^ v, 2654435761); + h2 = Math.imul(h2 ^ v, 104729); + } + return new Uint32Array([h1 >>> 0, h2 >>> 0]); + } else { + return new Uint32Array([0, 0]); + } + } + + async reset(clearFiles) { + await this.isReady; + let h = await navigator.storage.getDirectory(); + let prev, prevName; + for (const d of this.vfsDir.split('/')) { + if (d) { + prev = h; + h = await h.getDirectoryHandle(d, { create: true }); + } + } + this.#dhVfsRoot = h; + this.#dhVfsParent = prev; + this.#dhOpaque = await this.#dhVfsRoot.getDirectoryHandle( + OPAQUE_DIR_NAME, + { create: true }, + ); + this.releaseAccessHandles(); + return this.acquireAccessHandles(clearFiles); + } + + getPath(arg) { + if (wasm.isPtr(arg)) arg = wasm.cstrToJs(arg); + return ( + arg instanceof URL ? arg : new URL(arg, 'file://localhost/') + ).pathname; + } + + deletePath(path) { + const sah = this.#mapFilenameToSAH.get(path); + if (sah) { + this.#mapFilenameToSAH.delete(path); + this.setAssociatedPath(sah, '', 0); + } + return !!sah; + } + + storeErr(e, code) { + if (e) { + e.sqlite3Rc = code || capi.SQLITE_IOERR; + this.error(e); + } + this.$error = e; + return code; + } + + popErr() { + const rc = this.$error; + this.$error = undefined; + return rc; + } + + nextAvailableSAH() { + const [rc] = this.#availableSAH.keys(); + return rc; + } + + getOFileForS3File(pFile) { + return this.#mapS3FileToOFile_.get(pFile); + } + + mapS3FileToOFile(pFile, file) { + if (file) { + this.#mapS3FileToOFile_.set(pFile, file); + setPoolForPFile(pFile, this); + } else { + this.#mapS3FileToOFile_.delete(pFile); + setPoolForPFile(pFile, false); + } + } + + hasFilename(name) { + return this.#mapFilenameToSAH.has(name); + } + + getSAHForPath(path) { + return this.#mapFilenameToSAH.get(path); + } + + async removeVfs() { + if (!this.#cVfs.pointer || !this.#dhOpaque) return false; + capi.sqlite3_vfs_unregister(this.#cVfs.pointer); + this.#cVfs.dispose(); + delete initPromises[this.vfsName]; + try { + this.releaseAccessHandles(); + await this.#dhVfsRoot.removeEntry(OPAQUE_DIR_NAME, { + recursive: true, + }); + this.#dhOpaque = undefined; + await this.#dhVfsParent.removeEntry(this.#dhVfsRoot.name, { + recursive: true, + }); + this.#dhVfsRoot = this.#dhVfsParent = undefined; + } catch (e) { + sqlite3.config.error( + this.vfsName, + 'removeVfs() failed with no recovery strategy:', + e, + ); + } + return true; + } + + pauseVfs() { + if (this.#mapS3FileToOFile_.size > 0) { + sqlite3.SQLite3Error.toss( + capi.SQLITE_MISUSE, + 'Cannot pause VFS', + this.vfsName, + 'because it has opened files.', + ); + } + if (this.#mapSAHToName.size > 0) { + capi.sqlite3_vfs_unregister(this.vfsName); + this.releaseAccessHandles(); + } + return this; + } + + isPaused() { + return 0 === this.#mapSAHToName.size; + } + + async unpauseVfs() { + if (0 === this.#mapSAHToName.size) { + return this.acquireAccessHandles(false).then( + () => capi.sqlite3_vfs_register(this.#cVfs, 0), + this, + ); + } + return this; + } + + exportFile(name) { + const sah = + this.#mapFilenameToSAH.get(name) || toss('File not found:', name); + const n = sah.getSize() - HEADER_OFFSET_DATA; + const b = new Uint8Array(n > 0 ? n : 0); + if (n > 0) { + const nRead = sah.read(b, { at: HEADER_OFFSET_DATA }); + if (nRead != n) { + toss( + 'Expected to read ' + n + ' bytes but read ' + nRead + '.', + ); + } + } + return b; + } + + async importDbChunked(name, callback) { + const sah = + this.#mapFilenameToSAH.get(name) || + this.nextAvailableSAH() || + toss('No available handles to import to.'); + sah.truncate(0); + let nWrote = 0, + chunk, + checkedHeader = false, + err = false; + try { + while (undefined !== (chunk = await callback())) { + if (chunk instanceof ArrayBuffer) chunk = new Uint8Array(chunk); + if (0 === nWrote && chunk.byteLength >= 15) { + util.affirmDbHeader(chunk); + checkedHeader = true; + } + sah.write(chunk, { at: HEADER_OFFSET_DATA + nWrote }); + nWrote += chunk.byteLength; + } + if (nWrote < 512 || 0 !== nWrote % 512) { + toss( + 'Input size', + nWrote, + 'is not correct for an SQLite database.', + ); + } + if (!checkedHeader) { + const header = new Uint8Array(20); + sah.read(header, { at: 0 }); + util.affirmDbHeader(header); + } + sah.write(new Uint8Array([1, 1]), { + at: HEADER_OFFSET_DATA + 18, + }); + } catch (e) { + this.setAssociatedPath(sah, '', 0); + throw e; + } + this.setAssociatedPath(sah, name, capi.SQLITE_OPEN_MAIN_DB); + return nWrote; + } + + importDb(name, bytes) { + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + else if (bytes instanceof Function) + return this.importDbChunked(name, bytes); + const sah = + this.#mapFilenameToSAH.get(name) || + this.nextAvailableSAH() || + toss('No available handles to import to.'); + const n = bytes.byteLength; + if (n < 512 || n % 512 != 0) { + toss('Byte array size is invalid for an SQLite db.'); + } + const header = 'SQLite format 3'; + for (let i = 0; i < header.length; ++i) { + if (header.charCodeAt(i) !== bytes[i]) { + toss('Input does not contain an SQLite database header.'); + } + } + const nWrote = sah.write(bytes, { at: HEADER_OFFSET_DATA }); + if (nWrote != n) { + this.setAssociatedPath(sah, '', 0); + toss( + 'Expected to write ' + n + ' bytes but wrote ' + nWrote + '.', + ); + } else { + sah.write(new Uint8Array([1, 1]), { + at: HEADER_OFFSET_DATA + 18, + }); + this.setAssociatedPath(sah, name, capi.SQLITE_OPEN_MAIN_DB); + } + return nWrote; + } + } + + class OpfsSAHPoolUtil { + #p; + + constructor(sahPool) { + this.#p = sahPool; + this.vfsName = sahPool.vfsName; + } + + async addCapacity(n) { + return this.#p.addCapacity(n); + } + + async reduceCapacity(n) { + return this.#p.reduceCapacity(n); + } + + getCapacity() { + return this.#p.getCapacity(this.#p); + } + + getFileCount() { + return this.#p.getFileCount(); + } + getFileNames() { + return this.#p.getFileNames(); + } + + async reserveMinimumCapacity(min) { + const c = this.#p.getCapacity(); + return c < min ? this.#p.addCapacity(min - c) : c; + } + + exportFile(name) { + return this.#p.exportFile(name); + } + + importDb(name, bytes) { + return this.#p.importDb(name, bytes); + } + + async wipeFiles() { + return this.#p.reset(true); + } + + unlink(filename) { + return this.#p.deletePath(filename); + } + + async removeVfs() { + return this.#p.removeVfs(); + } + + pauseVfs() { + this.#p.pauseVfs(); + return this; + } + async unpauseVfs() { + return this.#p.unpauseVfs().then(() => this); + } + isPaused() { + return this.#p.isPaused(); + } + } + + const apiVersionCheck = async () => { + const dh = await navigator.storage.getDirectory(); + const fn = '.opfs-sahpool-sync-check-' + getRandomName(); + const fh = await dh.getFileHandle(fn, { create: true }); + const ah = await fh.createSyncAccessHandle(); + const close = ah.close(); + await close; + await dh.removeEntry(fn); + if (close?.then) { + toss( + 'The local OPFS API is too old for opfs-sahpool:', + 'it has an async FileSystemSyncAccessHandle.close() method.', + ); + } + return true; + }; + + sqlite3.installOpfsSAHPoolVfs = async function ( + options = Object.create(null), + ) { + options = Object.assign( + Object.create(null), + optionDefaults, + options || {}, + ); + const vfsName = options.name; + if (options.$testThrowPhase1) { + throw options.$testThrowPhase1; + } + if (initPromises[vfsName]) { + try { + const p = await initPromises[vfsName]; + + return p; + } catch (e) { + if (options.forceReinitIfPreviouslyFailed) { + delete initPromises[vfsName]; + } else { + throw e; + } + } + } + if ( + !globalThis.FileSystemHandle || + !globalThis.FileSystemDirectoryHandle || + !globalThis.FileSystemFileHandle || + !globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle || + !navigator?.storage?.getDirectory + ) { + return (initPromises[vfsName] = Promise.reject( + new Error('Missing required OPFS APIs.'), + )); + } + + return (initPromises[vfsName] = apiVersionCheck() + .then(async function () { + if (options.$testThrowPhase2) { + throw options.$testThrowPhase2; + } + const thePool = new OpfsSAHPool(options); + return thePool.isReady + .then(async () => { + const poolUtil = new OpfsSAHPoolUtil(thePool); + if (sqlite3.oo1) { + const oo1 = sqlite3.oo1; + const theVfs = thePool.getVfs(); + const OpfsSAHPoolDb = function (...args) { + const opt = oo1.DB.dbCtorHelper.normalizeArgs(...args); + opt.vfs = theVfs.$zName; + oo1.DB.dbCtorHelper.call(this, opt); + }; + OpfsSAHPoolDb.prototype = Object.create(oo1.DB.prototype); + poolUtil.OpfsSAHPoolDb = OpfsSAHPoolDb; + } + thePool.log('VFS initialized.'); + return poolUtil; + }) + .catch(async (e) => { + await thePool.removeVfs().catch(() => {}); + throw e; + }); + }) + .catch((err) => { + return (initPromises[vfsName] = Promise.reject(err)); + })); + }; + }); + + ('use strict'); + if ('undefined' !== typeof Module) { + const SABC = Object.assign( + Object.create(null), + { + exports: + 'undefined' === typeof wasmExports ? Module['asm'] : wasmExports, + memory: Module.wasmMemory, + }, + globalThis.sqlite3ApiConfig || {}, + ); + + globalThis.sqlite3ApiConfig = SABC; + let sqlite3; + try { + sqlite3 = globalThis.sqlite3ApiBootstrap(); + } catch (e) { + console.error('sqlite3ApiBootstrap() error:', e); + throw e; + } finally { + delete globalThis.sqlite3ApiBootstrap; + delete globalThis.sqlite3ApiConfig; + } + + Module.sqlite3 = sqlite3; + } 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.', + ); + } + }; + + moduleRtn = readyPromise; + + return moduleRtn; + }; +})(); + +const toExportForESM = (function () { + const originalInit = sqlite3InitModule; + if (!originalInit) { + throw new Error( + 'Expecting globalThis.sqlite3InitModule to be defined by the Emscripten build.', + ); + } + + const initModuleState = (globalThis.sqlite3InitModuleState = Object.assign( + Object.create(null), + { + moduleScript: globalThis?.document?.currentScript, + isWorker: 'undefined' !== typeof WorkerGlobalScope, + location: globalThis.location, + urlParams: globalThis?.location?.href + ? new URL(globalThis.location.href).searchParams + : new URLSearchParams(), + }, + )); + initModuleState.debugModule = initModuleState.urlParams.has( + 'sqlite3.debugModule', + ) + ? (...args) => console.warn('sqlite3.debugModule:', ...args) + : () => {}; + + if (initModuleState.urlParams.has('sqlite3.dir')) { + initModuleState.sqlite3Dir = + initModuleState.urlParams.get('sqlite3.dir') + '/'; + } else if (initModuleState.moduleScript) { + const li = initModuleState.moduleScript.src.split('/'); + li.pop(); + initModuleState.sqlite3Dir = li.join('/') + '/'; + } + + globalThis.sqlite3InitModule = function ff(...args) { + return originalInit(...args) + .then((EmscriptenModule) => { + EmscriptenModule.runSQLite3PostLoadInit(EmscriptenModule); + const s = EmscriptenModule.sqlite3; + s.scriptInfo = initModuleState; + + if (ff.__isUnderTest) s.__isUnderTest = true; + const f = s.asyncPostInit; + delete s.asyncPostInit; + const rv = f(); + return rv; + }) + .catch((e) => { + console.error('Exception loading sqlite3 module:', e); + throw e; + }); + }; + globalThis.sqlite3InitModule.ready = originalInit.ready; + + if (globalThis.sqlite3InitModuleState.moduleScript) { + const sim = globalThis.sqlite3InitModuleState; + let src = sim.moduleScript.src.split('/'); + src.pop(); + sim.scriptDir = src.join('/') + '/'; + } + initModuleState.debugModule('sqlite3InitModuleState =', initModuleState); + if (0) { + console.warn('Replaced sqlite3InitModule()'); + console.warn('globalThis.location.href =', globalThis.location.href); + if ('undefined' !== typeof document) { + console.warn( + 'document.currentScript.src =', + document?.currentScript?.src, + ); + } + } + return globalThis.sqlite3InitModule; +})(); +sqlite3InitModule = toExportForESM; +export default sqlite3InitModule; diff --git a/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-node.mjs b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-node.mjs new file mode 100644 index 0000000..49b4fa7 --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-node.mjs @@ -0,0 +1,12043 @@ +/* + ** LICENSE for the sqlite3 WebAssembly/JavaScript APIs. + ** + ** This bundle (typically released as sqlite3.js or sqlite3.mjs) + ** is an amalgamation of JavaScript source code from two projects: + ** + ** 1) https://emscripten.org: the Emscripten "glue code" is covered by + ** the terms of the MIT license and University of Illinois/NCSA + ** Open Source License, as described at: + ** + ** https://emscripten.org/docs/introducing_emscripten/emscripten_license.html + ** + ** 2) https://sqlite.org: all code and documentation labeled as being + ** from this source are released under the same terms as the sqlite3 + ** C library: + ** + ** 2022-10-16 + ** + ** The author disclaims copyright to this source code. In place of a + ** legal notice, here is a blessing: + ** + ** * May you do good and not evil. + ** * May you find forgiveness for yourself and forgive others. + ** * May you share freely, never taking more than you give. + */ +/* + ** This code was built from sqlite3 version... + ** + ** SQLITE_VERSION "3.50.4" + ** SQLITE_VERSION_NUMBER 3050004 + ** SQLITE_SOURCE_ID "2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3" + ** + ** Using the Emscripten SDK version 3.1.70. + */ + +import { createRequire } from 'module'; +const require = createRequire(import.meta.url); + +var sqlite3InitModule = (() => { + var _scriptName = import.meta.url; + + return function (moduleArg = {}) { + var moduleRtn; + + var Module = moduleArg; + + var readyPromiseResolve, readyPromiseReject; + var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; + }); + + var ENVIRONMENT_IS_WEB = false; + var ENVIRONMENT_IS_WORKER = false; + var ENVIRONMENT_IS_NODE = true; + var ENVIRONMENT_IS_SHELL = false; + + if (ENVIRONMENT_IS_NODE) { + } + + const sqlite3InitModuleState = + globalThis.sqlite3InitModuleState || + Object.assign(Object.create(null), { + debugModule: () => {}, + }); + delete globalThis.sqlite3InitModuleState; + sqlite3InitModuleState.debugModule( + 'globalThis.location =', + globalThis.location, + ); + + var moduleOverrides = Object.assign({}, Module); + + var arguments_ = []; + var thisProgram = './this.program'; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + + var scriptDirectory = ''; + function locateFile(path) { + if (Module['locateFile']) { + return Module['locateFile'](path, scriptDirectory); + } + return scriptDirectory + path; + } + + var readAsync, readBinary; + + if (ENVIRONMENT_IS_NODE) { + var fs = require('fs'); + var nodePath = require('path'); + + if (!import.meta.url.startsWith('data:')) { + scriptDirectory = + nodePath.dirname(require('url').fileURLToPath(import.meta.url)) + '/'; + } + + readBinary = (filename) => { + filename = isFileURI(filename) + ? new URL(filename) + : nodePath.normalize(filename); + var ret = fs.readFileSync(filename); + return ret; + }; + + readAsync = (filename, binary = true) => { + filename = isFileURI(filename) + ? new URL(filename) + : nodePath.normalize(filename); + return new Promise((resolve, reject) => { + fs.readFile(filename, binary ? undefined : 'utf8', (err, data) => { + if (err) reject(err); + else resolve(binary ? data.buffer : data); + }); + }); + }; + + if (!Module['thisProgram'] && process.argv.length > 1) { + thisProgram = process.argv[1].replace(/\\/g, '/'); + } + + arguments_ = process.argv.slice(2); + + quit_ = (status, toThrow) => { + process.exitCode = status; + throw toThrow; + }; + } else { + } + + var out = Module['print'] || console.log.bind(console); + var err = Module['printErr'] || console.error.bind(console); + + Object.assign(Module, moduleOverrides); + + moduleOverrides = null; + + if (Module['arguments']) arguments_ = Module['arguments']; + + if (Module['thisProgram']) thisProgram = Module['thisProgram']; + + var wasmBinary = Module['wasmBinary']; + + var wasmMemory; + + var ABORT = false; + + var EXITSTATUS; + + function assert(condition, text) { + if (!condition) { + abort(text); + } + } + + var HEAP, + HEAP8, + HEAPU8, + HEAP16, + HEAPU16, + HEAP32, + HEAPU32, + HEAPF32, + HEAP64, + HEAPU64, + HEAPF64; + + function updateMemoryViews() { + var b = wasmMemory.buffer; + Module['HEAP8'] = HEAP8 = new Int8Array(b); + Module['HEAP16'] = HEAP16 = new Int16Array(b); + Module['HEAPU8'] = HEAPU8 = new Uint8Array(b); + Module['HEAPU16'] = HEAPU16 = new Uint16Array(b); + Module['HEAP32'] = HEAP32 = new Int32Array(b); + Module['HEAPU32'] = HEAPU32 = new Uint32Array(b); + Module['HEAPF32'] = HEAPF32 = new Float32Array(b); + Module['HEAPF64'] = HEAPF64 = new Float64Array(b); + Module['HEAP64'] = HEAP64 = new BigInt64Array(b); + Module['HEAPU64'] = HEAPU64 = new BigUint64Array(b); + } + + if (Module['wasmMemory']) { + wasmMemory = Module['wasmMemory']; + } else { + var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 16777216; + + wasmMemory = new WebAssembly.Memory({ + initial: INITIAL_MEMORY / 65536, + + maximum: 32768, + }); + } + + updateMemoryViews(); + + var __ATPRERUN__ = []; + var __ATINIT__ = []; + var __ATEXIT__ = []; + var __ATPOSTRUN__ = []; + + var runtimeInitialized = false; + + function preRun() { + var preRuns = Module['preRun']; + if (preRuns) { + if (typeof preRuns == 'function') preRuns = [preRuns]; + preRuns.forEach(addOnPreRun); + } + callRuntimeCallbacks(__ATPRERUN__); + } + + function initRuntime() { + runtimeInitialized = true; + + if (!Module['noFSInit'] && !FS.initialized) FS.init(); + FS.ignorePermissions = false; + + TTY.init(); + callRuntimeCallbacks(__ATINIT__); + } + + function postRun() { + var postRuns = Module['postRun']; + if (postRuns) { + if (typeof postRuns == 'function') postRuns = [postRuns]; + postRuns.forEach(addOnPostRun); + } + + callRuntimeCallbacks(__ATPOSTRUN__); + } + + function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); + } + + function addOnInit(cb) { + __ATINIT__.unshift(cb); + } + + function addOnExit(cb) {} + + function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); + } + + var runDependencies = 0; + var runDependencyWatcher = null; + var dependenciesFulfilled = null; + + function getUniqueRunDependency(id) { + return id; + } + + function addRunDependency(id) { + runDependencies++; + + Module['monitorRunDependencies']?.(runDependencies); + } + + function removeRunDependency(id) { + runDependencies--; + + Module['monitorRunDependencies']?.(runDependencies); + + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + + function abort(what) { + Module['onAbort']?.(what); + + what = 'Aborted(' + what + ')'; + + err(what); + + ABORT = true; + + what += '. Build with -sASSERTIONS for more info.'; + + var e = new WebAssembly.RuntimeError(what); + + readyPromiseReject(e); + + throw e; + } + + var dataURIPrefix = 'data:application/octet-stream;base64,'; + + var isDataURI = (filename) => filename.startsWith(dataURIPrefix); + + var isFileURI = (filename) => filename.startsWith('file://'); + + function findWasmBinary() { + if (Module['locateFile']) { + var f = 'sqlite3.wasm'; + if (!isDataURI(f)) { + return locateFile(f); + } + return f; + } + + return new URL('sqlite3.wasm', import.meta.url).href; + } + + var wasmBinaryFile; + + function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw 'both async and sync fetching of the wasm failed'; + } + + function getBinaryPromise(binaryFile) { + if (!wasmBinary) { + return readAsync(binaryFile).then( + (response) => new Uint8Array(response), + + () => getBinarySync(binaryFile), + ); + } + + return Promise.resolve().then(() => getBinarySync(binaryFile)); + } + + function instantiateArrayBuffer(binaryFile, imports, receiver) { + return getBinaryPromise(binaryFile) + .then((binary) => { + return WebAssembly.instantiate(binary, imports); + }) + .then(receiver, (reason) => { + err(`failed to asynchronously prepare wasm: ${reason}`); + + abort(reason); + }); + } + + function instantiateAsync(binary, binaryFile, imports, callback) { + if ( + !binary && + typeof WebAssembly.instantiateStreaming == 'function' && + !isDataURI(binaryFile) && + !ENVIRONMENT_IS_NODE && + typeof fetch == 'function' + ) { + return fetch(binaryFile, { credentials: 'same-origin' }).then( + (response) => { + var result = WebAssembly.instantiateStreaming(response, imports); + + return result.then(callback, function (reason) { + err(`wasm streaming compile failed: ${reason}`); + err('falling back to ArrayBuffer instantiation'); + return instantiateArrayBuffer(binaryFile, imports, callback); + }); + }, + ); + } + return instantiateArrayBuffer(binaryFile, imports, callback); + } + + function getWasmImports() { + return { + env: wasmImports, + wasi_snapshot_preview1: wasmImports, + }; + } + + function createWasm() { + var info = getWasmImports(); + + function receiveInstance(instance, module) { + wasmExports = instance.exports; + + addOnInit(wasmExports['__wasm_call_ctors']); + + removeRunDependency('wasm-instantiate'); + return wasmExports; + } + + addRunDependency('wasm-instantiate'); + + function receiveInstantiationResult(result) { + receiveInstance(result['instance']); + } + + if (Module['instantiateWasm']) { + try { + return Module['instantiateWasm'](info, receiveInstance); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + + readyPromiseReject(e); + } + } + + wasmBinaryFile ??= findWasmBinary(); + + instantiateAsync( + wasmBinary, + wasmBinaryFile, + info, + receiveInstantiationResult, + ).catch(readyPromiseReject); + return {}; + } + + function ExitStatus(status) { + this.name = 'ExitStatus'; + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + + var callRuntimeCallbacks = (callbacks) => { + callbacks.forEach((f) => f(Module)); + }; + + function getValue(ptr, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': + return HEAP8[ptr]; + case 'i8': + return HEAP8[ptr]; + case 'i16': + return HEAP16[ptr >> 1]; + case 'i32': + return HEAP32[ptr >> 2]; + case 'i64': + return HEAP64[ptr >> 3]; + case 'float': + return HEAPF32[ptr >> 2]; + case 'double': + return HEAPF64[ptr >> 3]; + case '*': + return HEAPU32[ptr >> 2]; + default: + abort(`invalid type for getValue: ${type}`); + } + } + + var noExitRuntime = Module['noExitRuntime'] || true; + + function setValue(ptr, value, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': + HEAP8[ptr] = value; + break; + case 'i8': + HEAP8[ptr] = value; + break; + case 'i16': + HEAP16[ptr >> 1] = value; + break; + case 'i32': + HEAP32[ptr >> 2] = value; + break; + case 'i64': + HEAP64[ptr >> 3] = BigInt(value); + break; + case 'float': + HEAPF32[ptr >> 2] = value; + break; + case 'double': + HEAPF64[ptr >> 3] = value; + break; + case '*': + HEAPU32[ptr >> 2] = value; + break; + default: + abort(`invalid type for setValue: ${type}`); + } + } + + var stackRestore = (val) => __emscripten_stack_restore(val); + + var stackSave = () => _emscripten_stack_get_current(); + + var PATH = { + isAbs: (path) => path.charAt(0) === '/', + splitPath: (filename) => { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift('..'); + } + } + return parts; + }, + normalize: (path) => { + var isAbsolute = PATH.isAbs(path), + trailingSlash = path.substr(-1) === '/'; + + path = PATH.normalizeArray( + path.split('/').filter((p) => !!p), + !isAbsolute, + ).join('/'); + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + return (isAbsolute ? '/' : '') + path; + }, + dirname: (path) => { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return '.'; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: (path) => { + if (path === '/') return '/'; + path = PATH.normalize(path); + path = path.replace(/\/$/, ''); + var lastSlash = path.lastIndexOf('/'); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + join: (...paths) => PATH.normalize(paths.join('/')), + join2: (l, r) => PATH.normalize(l + '/' + r), + }; + + var initRandomFill = () => { + if ( + typeof crypto == 'object' && + typeof crypto['getRandomValues'] == 'function' + ) { + return (view) => crypto.getRandomValues(view); + } else if (ENVIRONMENT_IS_NODE) { + try { + var crypto_module = require('crypto'); + var randomFillSync = crypto_module['randomFillSync']; + if (randomFillSync) { + return (view) => crypto_module['randomFillSync'](view); + } + + var randomBytes = crypto_module['randomBytes']; + return (view) => (view.set(randomBytes(view.byteLength)), view); + } catch (e) {} + } + + abort('initRandomDevice'); + }; + var randomFill = (view) => { + return (randomFill = initRandomFill())(view); + }; + + var PATH_FS = { + resolve: (...args) => { + var resolvedPath = '', + resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? args[i] : FS.cwd(); + + if (typeof path != 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + return ''; + } + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + + resolvedPath = PATH.normalizeArray( + resolvedPath.split('/').filter((p) => !!p), + !resolvedAbsolute, + ).join('/'); + return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join('/'); + }, + }; + + var UTF8Decoder = + typeof TextDecoder != 'undefined' ? new TextDecoder() : undefined; + + var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ''; + + while (idx < endPtr) { + var u0 = heapOrArray[idx++]; + if (!(u0 & 0x80)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 0xe0) == 0xc0) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 0xf0) == 0xe0) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + u0 = + ((u0 & 7) << 18) | + (u1 << 12) | + (u2 << 6) | + (heapOrArray[idx++] & 63); + } + + if (u0 < 0x10000) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 0x10000; + str += String.fromCharCode( + 0xd800 | (ch >> 10), + 0xdc00 | (ch & 0x3ff), + ); + } + } + return str; + }; + + var FS_stdin_getChar_buffer = []; + + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var c = str.charCodeAt(i); + if (c <= 0x7f) { + len++; + } else if (c <= 0x7ff) { + len += 2; + } else if (c >= 0xd800 && c <= 0xdfff) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; + }; + + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + if (!(maxBytesToWrite > 0)) return 0; + + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 0xd800 && u <= 0xdfff) { + var u1 = str.charCodeAt(++i); + u = (0x10000 + ((u & 0x3ff) << 10)) | (u1 & 0x3ff); + } + if (u <= 0x7f) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 0x7ff) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 0xc0 | (u >> 6); + heap[outIdx++] = 0x80 | (u & 63); + } else if (u <= 0xffff) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 0xe0 | (u >> 12); + heap[outIdx++] = 0x80 | ((u >> 6) & 63); + heap[outIdx++] = 0x80 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + heap[outIdx++] = 0xf0 | (u >> 18); + heap[outIdx++] = 0x80 | ((u >> 12) & 63); + heap[outIdx++] = 0x80 | ((u >> 6) & 63); + heap[outIdx++] = 0x80 | (u & 63); + } + } + + heap[outIdx] = 0; + return outIdx - startIdx; + }; + + function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length, + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + } + var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if (ENVIRONMENT_IS_NODE) { + var BUFSIZE = 256; + var buf = Buffer.alloc(BUFSIZE); + var bytesRead = 0; + + var fd = process.stdin.fd; + + try { + bytesRead = fs.readSync(fd, buf, 0, BUFSIZE); + } catch (e) { + if (e.toString().includes('EOF')) bytesRead = 0; + else throw e; + } + + if (bytesRead > 0) { + result = buf.slice(0, bytesRead).toString('utf-8'); + } + } else { + } + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); + }; + var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops: ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ + 0x03, 0x1c, 0x7f, 0x15, 0x04, 0x00, 0x01, 0x00, 0x11, 0x13, 0x1a, + 0x00, 0x12, 0x0f, 0x17, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ], + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [24, 80]; + }, + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + }, + }; + + var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); + }; + + var alignMemory = (size, alignment) => { + return Math.ceil(size / alignment) * alignment; + }; + var mmapAlloc = (size) => { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (ptr) zeroMemory(ptr, size); + return ptr; + }; + var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, '/', 16384 | 511, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2.0 : 1.125)) >>> + 0, + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray(0, Math.min(newSize, node.usedBytes)), + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw FS.genericErrors[44]; + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir(node) { + var entries = ['.', '..']; + for (var key of Object.keys(node.contents)) { + entries.push(key); + } + return entries; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + return length; + } + } + + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length, + ); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length, + ); + } + } + HEAP8.set(contents, ptr); + } + } + return { ptr, allocated }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + + return 0; + }, + }, + }; + + var asyncLoad = (url, onload, onerror, noRunDep) => { + var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : ''; + readAsync(url).then( + (arrayBuffer) => { + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, + (err) => { + if (onerror) { + onerror(); + } else { + throw `Loading data file "${url}" failed.`; + } + }, + ); + if (dep) addRunDependency(dep); + }; + + var FS_createDataFile = ( + parent, + name, + fileData, + canRead, + canWrite, + canOwn, + ) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); + }; + + var preloadPlugins = Module['preloadPlugins'] || []; + var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + if (typeof Browser != 'undefined') Browser.init(); + + var handled = false; + preloadPlugins.forEach((plugin) => { + if (handled) return; + if (plugin['canHandle'](fullname)) { + plugin['handle'](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }; + var FS_createPreloadedFile = ( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish, + ) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn, + ); + } + onload?.(); + removeRunDependency(dep); + } + if ( + FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == 'string') { + asyncLoad(url, processData, onerror); + } else { + processData(url); + } + }; + + var FS_modeStringToFlags = (str) => { + var flagModes = { + r: 0, + 'r+': 2, + w: 512 | 64 | 1, + 'w+': 512 | 64 | 2, + a: 1024 | 64 | 1, + 'a+': 1024 | 64 | 2, + }; + var flags = flagModes[str]; + if (typeof flags == 'undefined') { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; + }; + + var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }; + + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: '/', + initialized: false, + ignorePermissions: true, + ErrnoError: class { + constructor(errno) { + this.name = 'ErrnoError'; + this.errno = errno; + } + }, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + constructor() { + this.shared = {}; + } + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + 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(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; + this.readMode = 292 | 73; + this.writeMode = 146; + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? (this.mode |= this.readMode) : (this.mode &= ~this.readMode); + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? (this.mode |= this.writeMode) : (this.mode &= ~this.writeMode); + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + path = PATH_FS.resolve(path); + + if (!path) return { path: '', node: null }; + + var defaults = { + follow_mount: true, + recurse_count: 0, + }; + opts = Object.assign(defaults, opts); + + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + + var parts = path.split('/').filter((p) => !!p); + + var current = FS.root; + var current_path = '/'; + + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + + if (FS.isMountpoint(current)) { + if (!islast || (islast && opts.follow_mount)) { + current = current.mounted.root; + } + } + + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + 1, + }); + current = lookup.node; + + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + + return { path: current_path, node: current }; + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== '/' + ? `${mount}/${path}` + : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + var node = new FS.FSNode(parent, name, mode, rdev); + + FS.hashAddNode(node); + + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = ['r', 'w', 'rw'][flag & 3]; + if (flag & 512) { + perms += 'w'; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + + if (perms.includes('r') && !(node.mode & 292)) { + return 2; + } else if (perms.includes('w') && !(node.mode & 146)) { + return 2; + } else if (perms.includes('x') && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, 'x'); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, 'wx'); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, 'wx'); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== 'r' || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: (fd) => FS.streams[fd], + createStream(stream, fd = -1) { + stream = Object.assign(new FS.FSStream(), stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + + stream.stream_ops = device.stream_ops; + + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 0xff, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice(dev, ops) { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [mount]; + + while (check.length) { + var m = check.pop(); + + mounts.push(m); + + check.push(...m.mounts); + } + + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == 'function') { + callback = populate; + populate = false; + } + + FS.syncFSRequests++; + + if (FS.syncFSRequests > 1) { + err( + `warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`, + ); + } + + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + + function doCallback(errCode) { + FS.syncFSRequests--; + return callback(errCode); + } + + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + var root = mountpoint === '/'; + var pseudo = !mountpoint; + var node; + + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + + mountpoint = lookup.path; + node = lookup.node; + + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + + var mount = { + type, + opts, + mountpoint, + mounts: [], + }; + + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + + if (node.mount) { + node.mount.mounts.push(mount); + } + } + + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + + while (current) { + var next = current.name_next; + + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + + current = next; + } + }); + + node.mounted = null; + + var idx = node.mount.mounts.indexOf(mount); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === '.' || name === '..') { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create(path, mode) { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode) { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split('/'); + var d = ''; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += '/' + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == 'undefined') { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + + var lookup, old_dir, new_dir; + + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + + var old_node = FS.lookupNode(old_dir, old_name); + + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(28); + } + + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(55); + } + + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + + if (old_node === new_node) { + return; + } + + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, 'w'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + + FS.hashRemoveNode(old_node); + + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve( + FS.getPath(link.parent), + link.node_ops.readlink(link), + ); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat(path) { + return FS.stat(path, true); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: (mode & 4095) | (node.mode & ~4095), + timestamp: Date.now(), + }); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.chmod(stream.node, mode); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + timestamp: Date.now(), + }); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.chown(stream.node, uid, gid); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, 'w'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { + size: len, + timestamp: Date.now(), + }); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + node.node_ops.setattr(node, { + timestamp: Math.max(atime, mtime), + }); + }, + open(path, flags, mode) { + if (path === '') { + throw new FS.ErrnoError(44); + } + flags = typeof flags == 'string' ? FS_modeStringToFlags(flags) : flags; + if (flags & 64) { + mode = typeof mode == 'undefined' ? 438 : mode; + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == 'object') { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + }); + node = lookup.node; + } catch (e) {} + } + + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + + if (flags & 512 && !created) { + FS.truncate(node, 0); + } + + flags &= ~(128 | 512 | 131072); + + var stream = FS.createStream({ + node, + path: FS.getPath(node), + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + + ungotten: [], + error: false, + }); + + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module['logReadFiles'] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != 'undefined'; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position, + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != 'undefined'; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn, + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags, + ); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || 'binary'; + if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === 'utf8') { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === 'binary') { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == 'string') { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error('Unsupported data type'); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, 'x'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir('/tmp'); + FS.mkdir('/home'); + FS.mkdir('/home/web_user'); + }, + createDefaultDevices() { + FS.mkdir('/dev'); + + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + }); + FS.mkdev('/dev/null', FS.makedev(1, 3)); + + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev('/dev/tty', FS.makedev(5, 0)); + FS.mkdev('/dev/tty1', FS.makedev(6, 0)); + + var randomBuffer = new Uint8Array(1024), + randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomLeft = randomFill(randomBuffer).byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice('/dev', 'random', randomByte); + FS.createDevice('/dev', 'urandom', randomByte); + + FS.mkdir('/dev/shm'); + FS.mkdir('/dev/shm/tmp'); + }, + createSpecialDirectories() { + FS.mkdir('/proc'); + var proc_self = FS.mkdir('/proc/self'); + FS.mkdir('/proc/self/fd'); + FS.mount( + { + mount() { + var node = FS.createNode(proc_self, 'fd', 16384 | 511, 73); + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { mountpoint: 'fake' }, + node_ops: { readlink: () => stream.path }, + }; + ret.parent = ret; + return ret; + }, + }; + return node; + }, + }, + {}, + '/proc/self/fd', + ); + }, + createStandardStreams(input, output, error) { + if (input) { + FS.createDevice('/dev', 'stdin', input); + } else { + FS.symlink('/dev/tty', '/dev/stdin'); + } + if (output) { + FS.createDevice('/dev', 'stdout', null, output); + } else { + FS.symlink('/dev/tty', '/dev/stdout'); + } + if (error) { + FS.createDevice('/dev', 'stderr', null, error); + } else { + FS.symlink('/dev/tty1', '/dev/stderr'); + } + + var stdin = FS.open('/dev/stdin', 0); + var stdout = FS.open('/dev/stdout', 1); + var stderr = FS.open('/dev/stderr', 1); + }, + staticInit() { + [44].forEach((code) => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ''; + }); + + FS.nameTable = new Array(4096); + + FS.mount(MEMFS, {}, '/'); + + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + + FS.filesystems = { + MEMFS: MEMFS, + }; + }, + init(input, output, error) { + FS.initialized = true; + + input ??= Module['stdin']; + output ??= Module['stdout']; + error ??= Module['stderr']; + + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === '/'; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == 'string' ? parent : FS.getPath(parent); + var parts = path.split('/').reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2( + typeof parent == 'string' ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == 'string' ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == 'string') { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2( + typeof parent == 'string' ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != 'undefined') { + 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.', + ); + } else { + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + class LazyUint8Array { + constructor() { + this.lengthKnown = false; + this.chunks = []; + } + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open('HEAD', url, false); + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + '. Status: ' + xhr.status, + ); + var datalength = Number(xhr.getResponseHeader('Content-length')); + var header; + var hasByteServing = + (header = xhr.getResponseHeader('Accept-Ranges')) && + header === 'bytes'; + var usesGzip = + (header = xhr.getResponseHeader('Content-Encoding')) && + header === 'gzip'; + + var chunkSize = 1024 * 1024; + + if (!hasByteServing) chunkSize = datalength; + + var doXHR = (from, to) => { + if (from > to) + throw new Error( + 'invalid range (' + + from + + ', ' + + to + + ') or no bytes requested!', + ); + if (to > datalength - 1) + throw new Error( + 'only ' + datalength + ' bytes available! programmer error!', + ); + + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader('Range', 'bytes=' + from + '-' + to); + + xhr.responseType = 'arraybuffer'; + if (xhr.overrideMimeType) { + xhr.overrideMimeType('text/plain; charset=x-user-defined'); + } + + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + '. Status: ' + xhr.status, + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } + return intArrayFromString(xhr.responseText || '', true); + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == 'undefined') { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == 'undefined') + throw new Error('doXHR failed!'); + return lazyArray.chunks[chunkNum]; + }); + + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + 'LazyFiles on gzip forces download of the whole file when length is accessed', + ); + } + + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + + if (typeof XMLHttpRequest != 'undefined') { + if (!ENVIRONMENT_IS_WORKER) + throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc'; + var lazyArray = new LazyUint8Array(); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url: url }; + } + + var node = FS.createFile(parent, name, properties, canRead, canWrite); + + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { ptr, allocated: true }; + }; + node.stream_ops = stream_ops; + return node; + }, + }; + + var UTF8ToString = (ptr, maxBytesToRead) => { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ''; + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat(func, path, buf) { + var stat = func(path); + HEAP32[buf >> 2] = stat.dev; + HEAP32[(buf + 4) >> 2] = stat.mode; + HEAPU32[(buf + 8) >> 2] = stat.nlink; + HEAP32[(buf + 12) >> 2] = stat.uid; + HEAP32[(buf + 16) >> 2] = stat.gid; + HEAP32[(buf + 20) >> 2] = stat.rdev; + HEAP64[(buf + 24) >> 3] = BigInt(stat.size); + HEAP32[(buf + 32) >> 2] = 4096; + HEAP32[(buf + 36) >> 2] = stat.blocks; + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(buf + 40) >> 3] = BigInt(Math.floor(atime / 1000)); + HEAPU32[(buf + 48) >> 2] = (atime % 1000) * 1000 * 1000; + HEAP64[(buf + 56) >> 3] = BigInt(Math.floor(mtime / 1000)); + HEAPU32[(buf + 64) >> 2] = (mtime % 1000) * 1000 * 1000; + HEAP64[(buf + 72) >> 3] = BigInt(Math.floor(ctime / 1000)); + HEAPU32[(buf + 80) >> 2] = (ctime % 1000) * 1000 * 1000; + HEAP64[(buf + 88) >> 3] = BigInt(stat.ino); + return 0; + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + }; + function ___syscall_chmod(path, mode) { + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_faccessat(dirfd, path, amode, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ''; + if (amode & 4) perms += 'r'; + if (amode & 2) perms += 'w'; + if (amode & 1) perms += 'x'; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fchmod(fd, mode) { + try { + FS.fchmod(fd, mode); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fchown32(fd, owner, group) { + try { + FS.fchown(fd, owner, group); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function syscallGetVarargI() { + var ret = HEAP32[+SYSCALLS.varargs >> 2]; + SYSCALLS.varargs += 4; + return ret; + } + var syscallGetVarargP = syscallGetVarargI; + + function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + case 12: { + var arg = syscallGetVarargP(); + var offset = 0; + + HEAP16[(arg + offset) >> 1] = 2; + return 0; + } + case 13: + case 14: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var INT53_MAX = 9007199254740992; + + var INT53_MIN = -9007199254740992; + var bigintToI53Checked = (num) => + num < INT53_MIN || num > INT53_MAX ? NaN : Number(num); + function ___syscall_ftruncate64(fd, length) { + length = bigintToI53Checked(length); + + try { + if (isNaN(length)) return 61; + FS.ftruncate(fd, length); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + }; + function ___syscall_getcwd(buf, size) { + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: { + if (!stream.tty) return -59; + return 0; + } + case 21505: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + HEAP32[argp >> 2] = termios.c_iflag || 0; + HEAP32[(argp + 4) >> 2] = termios.c_oflag || 0; + HEAP32[(argp + 8) >> 2] = termios.c_cflag || 0; + HEAP32[(argp + 12) >> 2] = termios.c_lflag || 0; + for (var i = 0; i < 32; i++) { + HEAP8[argp + i + 17] = termios.c_cc[i] || 0; + } + return 0; + } + return 0; + } + case 21510: + case 21511: + case 21512: { + if (!stream.tty) return -59; + return 0; + } + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = HEAP32[argp >> 2]; + var c_oflag = HEAP32[(argp + 4) >> 2]; + var c_cflag = HEAP32[(argp + 8) >> 2]; + var c_lflag = HEAP32[(argp + 12) >> 2]; + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(HEAP8[argp + i + 17]); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc, + }); + } + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + HEAP32[argp >> 2] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + HEAP16[argp >> 1] = winsize[0]; + HEAP16[(argp + 2) >> 1] = winsize[1]; + } + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + case 21515: { + if (!stream.tty) return -59; + return 0; + } + default: + return -28; + } + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_lstat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_mkdirat(dirfd, path, mode) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + + path = PATH.normalize(path); + if (path[path.length - 1] === '/') + path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_newfstatat(dirfd, path, buf, flags) { + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~6400; + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_openat(dirfd, path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = HEAP8[buf + len]; + stringToUTF8(ret, buf, bufsize + 1); + + HEAP8[buf + len] = endChar; + return len; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_rmdir(path) { + try { + path = SYSCALLS.getStr(path); + FS.rmdir(path); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_stat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_unlinkat(dirfd, path, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort('Invalid flags passed to unlinkat'); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var readI53FromI64 = (ptr) => { + return HEAPU32[ptr >> 2] + HEAP32[(ptr + 4) >> 2] * 4294967296; + }; + + function ___syscall_utimensat(dirfd, path, times, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path, true); + var now = Date.now(), + atime, + mtime; + if (!times) { + atime = now; + mtime = now; + } else { + var seconds = readI53FromI64(times); + var nanoseconds = HEAP32[(times + 8) >> 2]; + if (nanoseconds == 1073741823) { + atime = now; + } else if (nanoseconds == 1073741822) { + atime = -1; + } else { + atime = seconds * 1000 + nanoseconds / (1000 * 1000); + } + times += 16; + seconds = readI53FromI64(times); + nanoseconds = HEAP32[(times + 8) >> 2]; + if (nanoseconds == 1073741823) { + mtime = now; + } else if (nanoseconds == 1073741822) { + mtime = -1; + } else { + mtime = seconds * 1000 + nanoseconds / (1000 * 1000); + } + } + + if (mtime != -1 || atime != -1) { + FS.utime(path, atime, mtime); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var nowIsMonotonic = 1; + var __emscripten_get_now_is_monotonic = () => nowIsMonotonic; + + var isLeapYear = (year) => + year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + + var MONTH_DAYS_LEAP_CUMULATIVE = [ + 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, + ]; + + var MONTH_DAYS_REGULAR_CUMULATIVE = [ + 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, + ]; + var ydayFromDate = (date) => { + var leap = isLeapYear(date.getFullYear()); + var monthDaysCumulative = leap + ? MONTH_DAYS_LEAP_CUMULATIVE + : MONTH_DAYS_REGULAR_CUMULATIVE; + var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; + + return yday; + }; + + function __localtime_js(time, tmPtr) { + time = bigintToI53Checked(time); + + var date = new Date(time * 1000); + HEAP32[tmPtr >> 2] = date.getSeconds(); + HEAP32[(tmPtr + 4) >> 2] = date.getMinutes(); + HEAP32[(tmPtr + 8) >> 2] = date.getHours(); + HEAP32[(tmPtr + 12) >> 2] = date.getDate(); + HEAP32[(tmPtr + 16) >> 2] = date.getMonth(); + HEAP32[(tmPtr + 20) >> 2] = date.getFullYear() - 1900; + HEAP32[(tmPtr + 24) >> 2] = date.getDay(); + + var yday = ydayFromDate(date) | 0; + HEAP32[(tmPtr + 28) >> 2] = yday; + HEAP32[(tmPtr + 36) >> 2] = -(date.getTimezoneOffset() * 60); + + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = + (summerOffset != winterOffset && + date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + HEAP32[(tmPtr + 32) >> 2] = dst; + } + + function __mmap_js(len, prot, flags, fd, offset, allocated, addr) { + offset = bigintToI53Checked(offset); + + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var res = FS.mmap(stream, len, offset, prot, flags); + var ptr = res.ptr; + HEAP32[allocated >> 2] = res.allocated; + HEAPU32[addr >> 2] = ptr; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function __munmap_js(addr, len, prot, flags, fd, offset) { + offset = bigintToI53Checked(offset); + + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var __tzset_js = (timezone, daylight, std_name, dst_name) => { + var currentYear = new Date().getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + + HEAPU32[timezone >> 2] = stdTimezoneOffset * 60; + + HEAP32[daylight >> 2] = Number(winterOffset != summerOffset); + + var extractZone = (timezoneOffset) => { + var sign = timezoneOffset >= 0 ? '-' : '+'; + + var absOffset = Math.abs(timezoneOffset); + var hours = String(Math.floor(absOffset / 60)).padStart(2, '0'); + var minutes = String(absOffset % 60).padStart(2, '0'); + + return `UTC${sign}${hours}${minutes}`; + }; + + var winterName = extractZone(winterOffset); + var summerName = extractZone(summerOffset); + if (summerOffset < winterOffset) { + stringToUTF8(winterName, std_name, 17); + stringToUTF8(summerName, dst_name, 17); + } else { + stringToUTF8(winterName, dst_name, 17); + stringToUTF8(summerName, std_name, 17); + } + }; + + var _emscripten_date_now = () => Date.now(); + + var _emscripten_get_now = () => performance.now(); + + var getHeapMax = () => 2147483648; + + var growMemory = (size) => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + wasmMemory.grow(pages); + updateMemoryViews(); + return 1; + } catch (e) {} + }; + var _emscripten_resize_heap = (requestedSize) => { + var oldSize = HEAPU8.length; + + requestedSize >>>= 0; + + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + return false; + } + + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296, + ); + + var newSize = Math.min( + maxHeapSize, + alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536), + ); + + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + return false; + }; + + var ENV = {}; + + var getExecutableName = () => { + return thisProgram || './this.program'; + }; + var getEnvStrings = () => { + if (!getEnvStrings.strings) { + var lang = + ( + (typeof navigator == 'object' && + navigator.languages && + navigator.languages[0]) || + 'C' + ).replace('-', '_') + '.UTF-8'; + var env = { + USER: 'web_user', + LOGNAME: 'web_user', + PATH: '/', + PWD: '/', + HOME: '/home/web_user', + LANG: lang, + _: getExecutableName(), + }; + + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; + else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; + }; + + var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + HEAP8[buffer++] = str.charCodeAt(i); + } + + HEAP8[buffer] = 0; + }; + var _environ_get = (__environ, environ_buf) => { + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + HEAPU32[(__environ + i * 4) >> 2] = ptr; + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; + }; + + var _environ_sizes_get = (penviron_count, penviron_buf_size) => { + var strings = getEnvStrings(); + HEAPU32[penviron_count >> 2] = strings.length; + var bufSize = 0; + strings.forEach((string) => (bufSize += string.length + 1)); + HEAPU32[penviron_buf_size >> 2] = bufSize; + return 0; + }; + + function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + function _fd_fdstat_get(fd, pbuf) { + try { + var rightsBase = 0; + var rightsInheriting = 0; + var flags = 0; + { + var stream = SYSCALLS.getStreamFromFD(fd); + + var type = stream.tty + ? 2 + : FS.isDir(stream.mode) + ? 3 + : FS.isLink(stream.mode) + ? 7 + : 4; + } + HEAP8[pbuf] = type; + HEAP16[(pbuf + 2) >> 1] = flags; + HEAP64[(pbuf + 8) >> 3] = BigInt(rightsBase); + HEAP64[(pbuf + 16) >> 3] = BigInt(rightsInheriting); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[iov >> 2]; + var len = HEAPU32[(iov + 4) >> 2]; + iov += 8; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + if (typeof offset != 'undefined') { + offset += curr; + } + } + return ret; + }; + + function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[newOffset >> 3] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + function _fd_sync(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (stream.stream_ops?.fsync) { + return stream.stream_ops.fsync(stream); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[iov >> 2]; + var len = HEAPU32[(iov + 4) >> 2]; + iov += 8; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + break; + } + if (typeof offset != 'undefined') { + offset += curr; + } + } + return ret; + }; + + function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + FS.createPreloadedFile = FS_createPreloadedFile; + FS.staticInit(); + + var wasmImports = { + __syscall_chmod: ___syscall_chmod, + + __syscall_faccessat: ___syscall_faccessat, + + __syscall_fchmod: ___syscall_fchmod, + + __syscall_fchown32: ___syscall_fchown32, + + __syscall_fcntl64: ___syscall_fcntl64, + + __syscall_fstat64: ___syscall_fstat64, + + __syscall_ftruncate64: ___syscall_ftruncate64, + + __syscall_getcwd: ___syscall_getcwd, + + __syscall_ioctl: ___syscall_ioctl, + + __syscall_lstat64: ___syscall_lstat64, + + __syscall_mkdirat: ___syscall_mkdirat, + + __syscall_newfstatat: ___syscall_newfstatat, + + __syscall_openat: ___syscall_openat, + + __syscall_readlinkat: ___syscall_readlinkat, + + __syscall_rmdir: ___syscall_rmdir, + + __syscall_stat64: ___syscall_stat64, + + __syscall_unlinkat: ___syscall_unlinkat, + + __syscall_utimensat: ___syscall_utimensat, + + _emscripten_get_now_is_monotonic: __emscripten_get_now_is_monotonic, + + _localtime_js: __localtime_js, + + _mmap_js: __mmap_js, + + _munmap_js: __munmap_js, + + _tzset_js: __tzset_js, + + emscripten_date_now: _emscripten_date_now, + + emscripten_get_now: _emscripten_get_now, + + emscripten_resize_heap: _emscripten_resize_heap, + + environ_get: _environ_get, + + environ_sizes_get: _environ_sizes_get, + + fd_close: _fd_close, + + fd_fdstat_get: _fd_fdstat_get, + + fd_read: _fd_read, + + fd_seek: _fd_seek, + + fd_sync: _fd_sync, + + fd_write: _fd_write, + + memory: wasmMemory, + }; + var wasmExports = createWasm(); + var ___wasm_call_ctors = () => + (___wasm_call_ctors = wasmExports['__wasm_call_ctors'])(); + var _sqlite3_status64 = (Module['_sqlite3_status64'] = (a0, a1, a2, a3) => + (_sqlite3_status64 = Module['_sqlite3_status64'] = + wasmExports['sqlite3_status64'])(a0, a1, a2, a3)); + var _sqlite3_status = (Module['_sqlite3_status'] = (a0, a1, a2, a3) => + (_sqlite3_status = Module['_sqlite3_status'] = + wasmExports['sqlite3_status'])(a0, a1, a2, a3)); + var _sqlite3_db_status = (Module['_sqlite3_db_status'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_db_status = Module['_sqlite3_db_status'] = + wasmExports['sqlite3_db_status'])(a0, a1, a2, a3, a4)); + var _sqlite3_msize = (Module['_sqlite3_msize'] = (a0) => + (_sqlite3_msize = Module['_sqlite3_msize'] = + wasmExports['sqlite3_msize'])(a0)); + var _sqlite3_vfs_find = (Module['_sqlite3_vfs_find'] = (a0) => + (_sqlite3_vfs_find = Module['_sqlite3_vfs_find'] = + wasmExports['sqlite3_vfs_find'])(a0)); + var _sqlite3_initialize = (Module['_sqlite3_initialize'] = () => + (_sqlite3_initialize = Module['_sqlite3_initialize'] = + wasmExports['sqlite3_initialize'])()); + var _sqlite3_malloc = (Module['_sqlite3_malloc'] = (a0) => + (_sqlite3_malloc = Module['_sqlite3_malloc'] = + wasmExports['sqlite3_malloc'])(a0)); + var _sqlite3_free = (Module['_sqlite3_free'] = (a0) => + (_sqlite3_free = Module['_sqlite3_free'] = wasmExports['sqlite3_free'])( + a0, + )); + var _sqlite3_vfs_register = (Module['_sqlite3_vfs_register'] = (a0, a1) => + (_sqlite3_vfs_register = Module['_sqlite3_vfs_register'] = + wasmExports['sqlite3_vfs_register'])(a0, a1)); + var _sqlite3_vfs_unregister = (Module['_sqlite3_vfs_unregister'] = (a0) => + (_sqlite3_vfs_unregister = Module['_sqlite3_vfs_unregister'] = + wasmExports['sqlite3_vfs_unregister'])(a0)); + var _sqlite3_malloc64 = (Module['_sqlite3_malloc64'] = (a0) => + (_sqlite3_malloc64 = Module['_sqlite3_malloc64'] = + wasmExports['sqlite3_malloc64'])(a0)); + var _sqlite3_realloc = (Module['_sqlite3_realloc'] = (a0, a1) => + (_sqlite3_realloc = Module['_sqlite3_realloc'] = + wasmExports['sqlite3_realloc'])(a0, a1)); + var _sqlite3_realloc64 = (Module['_sqlite3_realloc64'] = (a0, a1) => + (_sqlite3_realloc64 = Module['_sqlite3_realloc64'] = + wasmExports['sqlite3_realloc64'])(a0, a1)); + var _sqlite3_value_text = (Module['_sqlite3_value_text'] = (a0) => + (_sqlite3_value_text = Module['_sqlite3_value_text'] = + wasmExports['sqlite3_value_text'])(a0)); + var _sqlite3_randomness = (Module['_sqlite3_randomness'] = (a0, a1) => + (_sqlite3_randomness = Module['_sqlite3_randomness'] = + wasmExports['sqlite3_randomness'])(a0, a1)); + var _sqlite3_stricmp = (Module['_sqlite3_stricmp'] = (a0, a1) => + (_sqlite3_stricmp = Module['_sqlite3_stricmp'] = + wasmExports['sqlite3_stricmp'])(a0, a1)); + var _sqlite3_strnicmp = (Module['_sqlite3_strnicmp'] = (a0, a1, a2) => + (_sqlite3_strnicmp = Module['_sqlite3_strnicmp'] = + wasmExports['sqlite3_strnicmp'])(a0, a1, a2)); + var _sqlite3_uri_parameter = (Module['_sqlite3_uri_parameter'] = (a0, a1) => + (_sqlite3_uri_parameter = Module['_sqlite3_uri_parameter'] = + wasmExports['sqlite3_uri_parameter'])(a0, a1)); + var _sqlite3_uri_boolean = (Module['_sqlite3_uri_boolean'] = (a0, a1, a2) => + (_sqlite3_uri_boolean = Module['_sqlite3_uri_boolean'] = + wasmExports['sqlite3_uri_boolean'])(a0, a1, a2)); + var _sqlite3_serialize = (Module['_sqlite3_serialize'] = (a0, a1, a2, a3) => + (_sqlite3_serialize = Module['_sqlite3_serialize'] = + wasmExports['sqlite3_serialize'])(a0, a1, a2, a3)); + var _sqlite3_prepare_v2 = (Module['_sqlite3_prepare_v2'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_prepare_v2 = Module['_sqlite3_prepare_v2'] = + wasmExports['sqlite3_prepare_v2'])(a0, a1, a2, a3, a4)); + var _sqlite3_step = (Module['_sqlite3_step'] = (a0) => + (_sqlite3_step = Module['_sqlite3_step'] = wasmExports['sqlite3_step'])( + a0, + )); + var _sqlite3_column_int64 = (Module['_sqlite3_column_int64'] = (a0, a1) => + (_sqlite3_column_int64 = Module['_sqlite3_column_int64'] = + wasmExports['sqlite3_column_int64'])(a0, a1)); + var _sqlite3_reset = (Module['_sqlite3_reset'] = (a0) => + (_sqlite3_reset = Module['_sqlite3_reset'] = + wasmExports['sqlite3_reset'])(a0)); + var _sqlite3_exec = (Module['_sqlite3_exec'] = (a0, a1, a2, a3, a4) => + (_sqlite3_exec = Module['_sqlite3_exec'] = wasmExports['sqlite3_exec'])( + a0, + a1, + a2, + a3, + a4, + )); + var _sqlite3_column_int = (Module['_sqlite3_column_int'] = (a0, a1) => + (_sqlite3_column_int = Module['_sqlite3_column_int'] = + wasmExports['sqlite3_column_int'])(a0, a1)); + var _sqlite3_finalize = (Module['_sqlite3_finalize'] = (a0) => + (_sqlite3_finalize = Module['_sqlite3_finalize'] = + wasmExports['sqlite3_finalize'])(a0)); + var _sqlite3_file_control = (Module['_sqlite3_file_control'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_file_control = Module['_sqlite3_file_control'] = + wasmExports['sqlite3_file_control'])(a0, a1, a2, a3)); + var _sqlite3_column_name = (Module['_sqlite3_column_name'] = (a0, a1) => + (_sqlite3_column_name = Module['_sqlite3_column_name'] = + wasmExports['sqlite3_column_name'])(a0, a1)); + var _sqlite3_column_text = (Module['_sqlite3_column_text'] = (a0, a1) => + (_sqlite3_column_text = Module['_sqlite3_column_text'] = + wasmExports['sqlite3_column_text'])(a0, a1)); + var _sqlite3_column_type = (Module['_sqlite3_column_type'] = (a0, a1) => + (_sqlite3_column_type = Module['_sqlite3_column_type'] = + wasmExports['sqlite3_column_type'])(a0, a1)); + var _sqlite3_errmsg = (Module['_sqlite3_errmsg'] = (a0) => + (_sqlite3_errmsg = Module['_sqlite3_errmsg'] = + wasmExports['sqlite3_errmsg'])(a0)); + var _sqlite3_deserialize = (Module['_sqlite3_deserialize'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3_deserialize = Module['_sqlite3_deserialize'] = + wasmExports['sqlite3_deserialize'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3_clear_bindings = (Module['_sqlite3_clear_bindings'] = (a0) => + (_sqlite3_clear_bindings = Module['_sqlite3_clear_bindings'] = + wasmExports['sqlite3_clear_bindings'])(a0)); + var _sqlite3_value_blob = (Module['_sqlite3_value_blob'] = (a0) => + (_sqlite3_value_blob = Module['_sqlite3_value_blob'] = + wasmExports['sqlite3_value_blob'])(a0)); + var _sqlite3_value_bytes = (Module['_sqlite3_value_bytes'] = (a0) => + (_sqlite3_value_bytes = Module['_sqlite3_value_bytes'] = + wasmExports['sqlite3_value_bytes'])(a0)); + var _sqlite3_value_double = (Module['_sqlite3_value_double'] = (a0) => + (_sqlite3_value_double = Module['_sqlite3_value_double'] = + wasmExports['sqlite3_value_double'])(a0)); + var _sqlite3_value_int = (Module['_sqlite3_value_int'] = (a0) => + (_sqlite3_value_int = Module['_sqlite3_value_int'] = + wasmExports['sqlite3_value_int'])(a0)); + var _sqlite3_value_int64 = (Module['_sqlite3_value_int64'] = (a0) => + (_sqlite3_value_int64 = Module['_sqlite3_value_int64'] = + wasmExports['sqlite3_value_int64'])(a0)); + var _sqlite3_value_subtype = (Module['_sqlite3_value_subtype'] = (a0) => + (_sqlite3_value_subtype = Module['_sqlite3_value_subtype'] = + wasmExports['sqlite3_value_subtype'])(a0)); + var _sqlite3_value_pointer = (Module['_sqlite3_value_pointer'] = (a0, a1) => + (_sqlite3_value_pointer = Module['_sqlite3_value_pointer'] = + wasmExports['sqlite3_value_pointer'])(a0, a1)); + var _sqlite3_value_type = (Module['_sqlite3_value_type'] = (a0) => + (_sqlite3_value_type = Module['_sqlite3_value_type'] = + wasmExports['sqlite3_value_type'])(a0)); + var _sqlite3_value_nochange = (Module['_sqlite3_value_nochange'] = (a0) => + (_sqlite3_value_nochange = Module['_sqlite3_value_nochange'] = + wasmExports['sqlite3_value_nochange'])(a0)); + var _sqlite3_value_frombind = (Module['_sqlite3_value_frombind'] = (a0) => + (_sqlite3_value_frombind = Module['_sqlite3_value_frombind'] = + wasmExports['sqlite3_value_frombind'])(a0)); + var _sqlite3_value_dup = (Module['_sqlite3_value_dup'] = (a0) => + (_sqlite3_value_dup = Module['_sqlite3_value_dup'] = + wasmExports['sqlite3_value_dup'])(a0)); + var _sqlite3_value_free = (Module['_sqlite3_value_free'] = (a0) => + (_sqlite3_value_free = Module['_sqlite3_value_free'] = + wasmExports['sqlite3_value_free'])(a0)); + var _sqlite3_result_blob = (Module['_sqlite3_result_blob'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_result_blob = Module['_sqlite3_result_blob'] = + wasmExports['sqlite3_result_blob'])(a0, a1, a2, a3)); + var _sqlite3_result_error_toobig = (Module['_sqlite3_result_error_toobig'] = + (a0) => + (_sqlite3_result_error_toobig = Module['_sqlite3_result_error_toobig'] = + wasmExports['sqlite3_result_error_toobig'])(a0)); + var _sqlite3_result_error_nomem = (Module['_sqlite3_result_error_nomem'] = ( + a0, + ) => + (_sqlite3_result_error_nomem = Module['_sqlite3_result_error_nomem'] = + wasmExports['sqlite3_result_error_nomem'])(a0)); + var _sqlite3_result_double = (Module['_sqlite3_result_double'] = (a0, a1) => + (_sqlite3_result_double = Module['_sqlite3_result_double'] = + wasmExports['sqlite3_result_double'])(a0, a1)); + var _sqlite3_result_error = (Module['_sqlite3_result_error'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_result_error = Module['_sqlite3_result_error'] = + wasmExports['sqlite3_result_error'])(a0, a1, a2)); + var _sqlite3_result_int = (Module['_sqlite3_result_int'] = (a0, a1) => + (_sqlite3_result_int = Module['_sqlite3_result_int'] = + wasmExports['sqlite3_result_int'])(a0, a1)); + var _sqlite3_result_int64 = (Module['_sqlite3_result_int64'] = (a0, a1) => + (_sqlite3_result_int64 = Module['_sqlite3_result_int64'] = + wasmExports['sqlite3_result_int64'])(a0, a1)); + var _sqlite3_result_null = (Module['_sqlite3_result_null'] = (a0) => + (_sqlite3_result_null = Module['_sqlite3_result_null'] = + wasmExports['sqlite3_result_null'])(a0)); + var _sqlite3_result_pointer = (Module['_sqlite3_result_pointer'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_result_pointer = Module['_sqlite3_result_pointer'] = + wasmExports['sqlite3_result_pointer'])(a0, a1, a2, a3)); + var _sqlite3_result_subtype = (Module['_sqlite3_result_subtype'] = ( + a0, + a1, + ) => + (_sqlite3_result_subtype = Module['_sqlite3_result_subtype'] = + wasmExports['sqlite3_result_subtype'])(a0, a1)); + var _sqlite3_result_text = (Module['_sqlite3_result_text'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_result_text = Module['_sqlite3_result_text'] = + wasmExports['sqlite3_result_text'])(a0, a1, a2, a3)); + var _sqlite3_result_zeroblob = (Module['_sqlite3_result_zeroblob'] = ( + a0, + a1, + ) => + (_sqlite3_result_zeroblob = Module['_sqlite3_result_zeroblob'] = + wasmExports['sqlite3_result_zeroblob'])(a0, a1)); + var _sqlite3_result_zeroblob64 = (Module['_sqlite3_result_zeroblob64'] = ( + a0, + a1, + ) => + (_sqlite3_result_zeroblob64 = Module['_sqlite3_result_zeroblob64'] = + wasmExports['sqlite3_result_zeroblob64'])(a0, a1)); + var _sqlite3_result_error_code = (Module['_sqlite3_result_error_code'] = ( + a0, + a1, + ) => + (_sqlite3_result_error_code = Module['_sqlite3_result_error_code'] = + wasmExports['sqlite3_result_error_code'])(a0, a1)); + var _sqlite3_user_data = (Module['_sqlite3_user_data'] = (a0) => + (_sqlite3_user_data = Module['_sqlite3_user_data'] = + wasmExports['sqlite3_user_data'])(a0)); + var _sqlite3_context_db_handle = (Module['_sqlite3_context_db_handle'] = ( + a0, + ) => + (_sqlite3_context_db_handle = Module['_sqlite3_context_db_handle'] = + wasmExports['sqlite3_context_db_handle'])(a0)); + var _sqlite3_vtab_nochange = (Module['_sqlite3_vtab_nochange'] = (a0) => + (_sqlite3_vtab_nochange = Module['_sqlite3_vtab_nochange'] = + wasmExports['sqlite3_vtab_nochange'])(a0)); + var _sqlite3_vtab_in_first = (Module['_sqlite3_vtab_in_first'] = (a0, a1) => + (_sqlite3_vtab_in_first = Module['_sqlite3_vtab_in_first'] = + wasmExports['sqlite3_vtab_in_first'])(a0, a1)); + var _sqlite3_vtab_in_next = (Module['_sqlite3_vtab_in_next'] = (a0, a1) => + (_sqlite3_vtab_in_next = Module['_sqlite3_vtab_in_next'] = + wasmExports['sqlite3_vtab_in_next'])(a0, a1)); + var _sqlite3_aggregate_context = (Module['_sqlite3_aggregate_context'] = ( + a0, + a1, + ) => + (_sqlite3_aggregate_context = Module['_sqlite3_aggregate_context'] = + wasmExports['sqlite3_aggregate_context'])(a0, a1)); + var _sqlite3_get_auxdata = (Module['_sqlite3_get_auxdata'] = (a0, a1) => + (_sqlite3_get_auxdata = Module['_sqlite3_get_auxdata'] = + wasmExports['sqlite3_get_auxdata'])(a0, a1)); + var _sqlite3_set_auxdata = (Module['_sqlite3_set_auxdata'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_set_auxdata = Module['_sqlite3_set_auxdata'] = + wasmExports['sqlite3_set_auxdata'])(a0, a1, a2, a3)); + var _sqlite3_column_count = (Module['_sqlite3_column_count'] = (a0) => + (_sqlite3_column_count = Module['_sqlite3_column_count'] = + wasmExports['sqlite3_column_count'])(a0)); + var _sqlite3_data_count = (Module['_sqlite3_data_count'] = (a0) => + (_sqlite3_data_count = Module['_sqlite3_data_count'] = + wasmExports['sqlite3_data_count'])(a0)); + var _sqlite3_column_blob = (Module['_sqlite3_column_blob'] = (a0, a1) => + (_sqlite3_column_blob = Module['_sqlite3_column_blob'] = + wasmExports['sqlite3_column_blob'])(a0, a1)); + var _sqlite3_column_bytes = (Module['_sqlite3_column_bytes'] = (a0, a1) => + (_sqlite3_column_bytes = Module['_sqlite3_column_bytes'] = + wasmExports['sqlite3_column_bytes'])(a0, a1)); + var _sqlite3_column_double = (Module['_sqlite3_column_double'] = (a0, a1) => + (_sqlite3_column_double = Module['_sqlite3_column_double'] = + wasmExports['sqlite3_column_double'])(a0, a1)); + var _sqlite3_column_value = (Module['_sqlite3_column_value'] = (a0, a1) => + (_sqlite3_column_value = Module['_sqlite3_column_value'] = + wasmExports['sqlite3_column_value'])(a0, a1)); + var _sqlite3_column_decltype = (Module['_sqlite3_column_decltype'] = ( + a0, + a1, + ) => + (_sqlite3_column_decltype = Module['_sqlite3_column_decltype'] = + wasmExports['sqlite3_column_decltype'])(a0, a1)); + var _sqlite3_bind_blob = (Module['_sqlite3_bind_blob'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_bind_blob = Module['_sqlite3_bind_blob'] = + wasmExports['sqlite3_bind_blob'])(a0, a1, a2, a3, a4)); + var _sqlite3_bind_double = (Module['_sqlite3_bind_double'] = (a0, a1, a2) => + (_sqlite3_bind_double = Module['_sqlite3_bind_double'] = + wasmExports['sqlite3_bind_double'])(a0, a1, a2)); + var _sqlite3_bind_int = (Module['_sqlite3_bind_int'] = (a0, a1, a2) => + (_sqlite3_bind_int = Module['_sqlite3_bind_int'] = + wasmExports['sqlite3_bind_int'])(a0, a1, a2)); + var _sqlite3_bind_int64 = (Module['_sqlite3_bind_int64'] = (a0, a1, a2) => + (_sqlite3_bind_int64 = Module['_sqlite3_bind_int64'] = + wasmExports['sqlite3_bind_int64'])(a0, a1, a2)); + var _sqlite3_bind_null = (Module['_sqlite3_bind_null'] = (a0, a1) => + (_sqlite3_bind_null = Module['_sqlite3_bind_null'] = + wasmExports['sqlite3_bind_null'])(a0, a1)); + var _sqlite3_bind_pointer = (Module['_sqlite3_bind_pointer'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_bind_pointer = Module['_sqlite3_bind_pointer'] = + wasmExports['sqlite3_bind_pointer'])(a0, a1, a2, a3, a4)); + var _sqlite3_bind_text = (Module['_sqlite3_bind_text'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_bind_text = Module['_sqlite3_bind_text'] = + wasmExports['sqlite3_bind_text'])(a0, a1, a2, a3, a4)); + var _sqlite3_bind_parameter_count = (Module[ + '_sqlite3_bind_parameter_count' + ] = (a0) => + (_sqlite3_bind_parameter_count = Module['_sqlite3_bind_parameter_count'] = + wasmExports['sqlite3_bind_parameter_count'])(a0)); + var _sqlite3_bind_parameter_name = (Module['_sqlite3_bind_parameter_name'] = + (a0, a1) => + (_sqlite3_bind_parameter_name = Module['_sqlite3_bind_parameter_name'] = + wasmExports['sqlite3_bind_parameter_name'])(a0, a1)); + var _sqlite3_bind_parameter_index = (Module[ + '_sqlite3_bind_parameter_index' + ] = (a0, a1) => + (_sqlite3_bind_parameter_index = Module['_sqlite3_bind_parameter_index'] = + wasmExports['sqlite3_bind_parameter_index'])(a0, a1)); + var _sqlite3_db_handle = (Module['_sqlite3_db_handle'] = (a0) => + (_sqlite3_db_handle = Module['_sqlite3_db_handle'] = + wasmExports['sqlite3_db_handle'])(a0)); + var _sqlite3_stmt_readonly = (Module['_sqlite3_stmt_readonly'] = (a0) => + (_sqlite3_stmt_readonly = Module['_sqlite3_stmt_readonly'] = + wasmExports['sqlite3_stmt_readonly'])(a0)); + var _sqlite3_stmt_isexplain = (Module['_sqlite3_stmt_isexplain'] = (a0) => + (_sqlite3_stmt_isexplain = Module['_sqlite3_stmt_isexplain'] = + wasmExports['sqlite3_stmt_isexplain'])(a0)); + var _sqlite3_stmt_explain = (Module['_sqlite3_stmt_explain'] = (a0, a1) => + (_sqlite3_stmt_explain = Module['_sqlite3_stmt_explain'] = + wasmExports['sqlite3_stmt_explain'])(a0, a1)); + var _sqlite3_stmt_busy = (Module['_sqlite3_stmt_busy'] = (a0) => + (_sqlite3_stmt_busy = Module['_sqlite3_stmt_busy'] = + wasmExports['sqlite3_stmt_busy'])(a0)); + var _sqlite3_stmt_status = (Module['_sqlite3_stmt_status'] = (a0, a1, a2) => + (_sqlite3_stmt_status = Module['_sqlite3_stmt_status'] = + wasmExports['sqlite3_stmt_status'])(a0, a1, a2)); + var _sqlite3_sql = (Module['_sqlite3_sql'] = (a0) => + (_sqlite3_sql = Module['_sqlite3_sql'] = wasmExports['sqlite3_sql'])(a0)); + var _sqlite3_expanded_sql = (Module['_sqlite3_expanded_sql'] = (a0) => + (_sqlite3_expanded_sql = Module['_sqlite3_expanded_sql'] = + wasmExports['sqlite3_expanded_sql'])(a0)); + var _sqlite3_preupdate_old = (Module['_sqlite3_preupdate_old'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_preupdate_old = Module['_sqlite3_preupdate_old'] = + wasmExports['sqlite3_preupdate_old'])(a0, a1, a2)); + var _sqlite3_preupdate_count = (Module['_sqlite3_preupdate_count'] = (a0) => + (_sqlite3_preupdate_count = Module['_sqlite3_preupdate_count'] = + wasmExports['sqlite3_preupdate_count'])(a0)); + var _sqlite3_preupdate_depth = (Module['_sqlite3_preupdate_depth'] = (a0) => + (_sqlite3_preupdate_depth = Module['_sqlite3_preupdate_depth'] = + wasmExports['sqlite3_preupdate_depth'])(a0)); + var _sqlite3_preupdate_blobwrite = (Module['_sqlite3_preupdate_blobwrite'] = + (a0) => + (_sqlite3_preupdate_blobwrite = Module['_sqlite3_preupdate_blobwrite'] = + wasmExports['sqlite3_preupdate_blobwrite'])(a0)); + var _sqlite3_preupdate_new = (Module['_sqlite3_preupdate_new'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_preupdate_new = Module['_sqlite3_preupdate_new'] = + wasmExports['sqlite3_preupdate_new'])(a0, a1, a2)); + var _sqlite3_value_numeric_type = (Module['_sqlite3_value_numeric_type'] = ( + a0, + ) => + (_sqlite3_value_numeric_type = Module['_sqlite3_value_numeric_type'] = + wasmExports['sqlite3_value_numeric_type'])(a0)); + var _sqlite3_set_authorizer = (Module['_sqlite3_set_authorizer'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_set_authorizer = Module['_sqlite3_set_authorizer'] = + wasmExports['sqlite3_set_authorizer'])(a0, a1, a2)); + var _sqlite3_strglob = (Module['_sqlite3_strglob'] = (a0, a1) => + (_sqlite3_strglob = Module['_sqlite3_strglob'] = + wasmExports['sqlite3_strglob'])(a0, a1)); + var _sqlite3_strlike = (Module['_sqlite3_strlike'] = (a0, a1, a2) => + (_sqlite3_strlike = Module['_sqlite3_strlike'] = + wasmExports['sqlite3_strlike'])(a0, a1, a2)); + var _sqlite3_auto_extension = (Module['_sqlite3_auto_extension'] = (a0) => + (_sqlite3_auto_extension = Module['_sqlite3_auto_extension'] = + wasmExports['sqlite3_auto_extension'])(a0)); + var _sqlite3_cancel_auto_extension = (Module[ + '_sqlite3_cancel_auto_extension' + ] = (a0) => + (_sqlite3_cancel_auto_extension = Module[ + '_sqlite3_cancel_auto_extension' + ] = + wasmExports['sqlite3_cancel_auto_extension'])(a0)); + var _sqlite3_reset_auto_extension = (Module[ + '_sqlite3_reset_auto_extension' + ] = () => + (_sqlite3_reset_auto_extension = Module['_sqlite3_reset_auto_extension'] = + wasmExports['sqlite3_reset_auto_extension'])()); + var _sqlite3_prepare_v3 = (Module['_sqlite3_prepare_v3'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3_prepare_v3 = Module['_sqlite3_prepare_v3'] = + wasmExports['sqlite3_prepare_v3'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3_create_module = (Module['_sqlite3_create_module'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_create_module = Module['_sqlite3_create_module'] = + wasmExports['sqlite3_create_module'])(a0, a1, a2, a3)); + var _sqlite3_create_module_v2 = (Module['_sqlite3_create_module_v2'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_create_module_v2 = Module['_sqlite3_create_module_v2'] = + wasmExports['sqlite3_create_module_v2'])(a0, a1, a2, a3, a4)); + var _sqlite3_drop_modules = (Module['_sqlite3_drop_modules'] = (a0, a1) => + (_sqlite3_drop_modules = Module['_sqlite3_drop_modules'] = + wasmExports['sqlite3_drop_modules'])(a0, a1)); + var _sqlite3_declare_vtab = (Module['_sqlite3_declare_vtab'] = (a0, a1) => + (_sqlite3_declare_vtab = Module['_sqlite3_declare_vtab'] = + wasmExports['sqlite3_declare_vtab'])(a0, a1)); + var _sqlite3_vtab_on_conflict = (Module['_sqlite3_vtab_on_conflict'] = ( + a0, + ) => + (_sqlite3_vtab_on_conflict = Module['_sqlite3_vtab_on_conflict'] = + wasmExports['sqlite3_vtab_on_conflict'])(a0)); + var _sqlite3_vtab_collation = (Module['_sqlite3_vtab_collation'] = ( + a0, + a1, + ) => + (_sqlite3_vtab_collation = Module['_sqlite3_vtab_collation'] = + wasmExports['sqlite3_vtab_collation'])(a0, a1)); + var _sqlite3_vtab_in = (Module['_sqlite3_vtab_in'] = (a0, a1, a2) => + (_sqlite3_vtab_in = Module['_sqlite3_vtab_in'] = + wasmExports['sqlite3_vtab_in'])(a0, a1, a2)); + var _sqlite3_vtab_rhs_value = (Module['_sqlite3_vtab_rhs_value'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_vtab_rhs_value = Module['_sqlite3_vtab_rhs_value'] = + wasmExports['sqlite3_vtab_rhs_value'])(a0, a1, a2)); + var _sqlite3_vtab_distinct = (Module['_sqlite3_vtab_distinct'] = (a0) => + (_sqlite3_vtab_distinct = Module['_sqlite3_vtab_distinct'] = + wasmExports['sqlite3_vtab_distinct'])(a0)); + var _sqlite3_keyword_name = (Module['_sqlite3_keyword_name'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_keyword_name = Module['_sqlite3_keyword_name'] = + wasmExports['sqlite3_keyword_name'])(a0, a1, a2)); + var _sqlite3_keyword_count = (Module['_sqlite3_keyword_count'] = () => + (_sqlite3_keyword_count = Module['_sqlite3_keyword_count'] = + wasmExports['sqlite3_keyword_count'])()); + var _sqlite3_keyword_check = (Module['_sqlite3_keyword_check'] = (a0, a1) => + (_sqlite3_keyword_check = Module['_sqlite3_keyword_check'] = + wasmExports['sqlite3_keyword_check'])(a0, a1)); + var _sqlite3_complete = (Module['_sqlite3_complete'] = (a0) => + (_sqlite3_complete = Module['_sqlite3_complete'] = + wasmExports['sqlite3_complete'])(a0)); + var _sqlite3_libversion = (Module['_sqlite3_libversion'] = () => + (_sqlite3_libversion = Module['_sqlite3_libversion'] = + wasmExports['sqlite3_libversion'])()); + var _sqlite3_libversion_number = (Module['_sqlite3_libversion_number'] = + () => + (_sqlite3_libversion_number = Module['_sqlite3_libversion_number'] = + wasmExports['sqlite3_libversion_number'])()); + var _sqlite3_shutdown = (Module['_sqlite3_shutdown'] = () => + (_sqlite3_shutdown = Module['_sqlite3_shutdown'] = + wasmExports['sqlite3_shutdown'])()); + var _sqlite3_last_insert_rowid = (Module['_sqlite3_last_insert_rowid'] = ( + a0, + ) => + (_sqlite3_last_insert_rowid = Module['_sqlite3_last_insert_rowid'] = + wasmExports['sqlite3_last_insert_rowid'])(a0)); + var _sqlite3_set_last_insert_rowid = (Module[ + '_sqlite3_set_last_insert_rowid' + ] = (a0, a1) => + (_sqlite3_set_last_insert_rowid = Module[ + '_sqlite3_set_last_insert_rowid' + ] = + wasmExports['sqlite3_set_last_insert_rowid'])(a0, a1)); + var _sqlite3_changes64 = (Module['_sqlite3_changes64'] = (a0) => + (_sqlite3_changes64 = Module['_sqlite3_changes64'] = + wasmExports['sqlite3_changes64'])(a0)); + var _sqlite3_changes = (Module['_sqlite3_changes'] = (a0) => + (_sqlite3_changes = Module['_sqlite3_changes'] = + wasmExports['sqlite3_changes'])(a0)); + var _sqlite3_total_changes64 = (Module['_sqlite3_total_changes64'] = (a0) => + (_sqlite3_total_changes64 = Module['_sqlite3_total_changes64'] = + wasmExports['sqlite3_total_changes64'])(a0)); + var _sqlite3_total_changes = (Module['_sqlite3_total_changes'] = (a0) => + (_sqlite3_total_changes = Module['_sqlite3_total_changes'] = + wasmExports['sqlite3_total_changes'])(a0)); + var _sqlite3_txn_state = (Module['_sqlite3_txn_state'] = (a0, a1) => + (_sqlite3_txn_state = Module['_sqlite3_txn_state'] = + wasmExports['sqlite3_txn_state'])(a0, a1)); + var _sqlite3_close_v2 = (Module['_sqlite3_close_v2'] = (a0) => + (_sqlite3_close_v2 = Module['_sqlite3_close_v2'] = + wasmExports['sqlite3_close_v2'])(a0)); + var _sqlite3_busy_handler = (Module['_sqlite3_busy_handler'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_busy_handler = Module['_sqlite3_busy_handler'] = + wasmExports['sqlite3_busy_handler'])(a0, a1, a2)); + var _sqlite3_progress_handler = (Module['_sqlite3_progress_handler'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_progress_handler = Module['_sqlite3_progress_handler'] = + wasmExports['sqlite3_progress_handler'])(a0, a1, a2, a3)); + var _sqlite3_busy_timeout = (Module['_sqlite3_busy_timeout'] = (a0, a1) => + (_sqlite3_busy_timeout = Module['_sqlite3_busy_timeout'] = + wasmExports['sqlite3_busy_timeout'])(a0, a1)); + var _sqlite3_interrupt = (Module['_sqlite3_interrupt'] = (a0) => + (_sqlite3_interrupt = Module['_sqlite3_interrupt'] = + wasmExports['sqlite3_interrupt'])(a0)); + var _sqlite3_is_interrupted = (Module['_sqlite3_is_interrupted'] = (a0) => + (_sqlite3_is_interrupted = Module['_sqlite3_is_interrupted'] = + wasmExports['sqlite3_is_interrupted'])(a0)); + var _sqlite3_create_function = (Module['_sqlite3_create_function'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (_sqlite3_create_function = Module['_sqlite3_create_function'] = + wasmExports['sqlite3_create_function'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var _sqlite3_create_function_v2 = (Module['_sqlite3_create_function_v2'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (_sqlite3_create_function_v2 = Module['_sqlite3_create_function_v2'] = + wasmExports['sqlite3_create_function_v2'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3_create_window_function = (Module[ + '_sqlite3_create_window_function' + ] = (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) => + (_sqlite3_create_window_function = Module[ + '_sqlite3_create_window_function' + ] = + wasmExports['sqlite3_create_window_function'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var _sqlite3_overload_function = (Module['_sqlite3_overload_function'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_overload_function = Module['_sqlite3_overload_function'] = + wasmExports['sqlite3_overload_function'])(a0, a1, a2)); + var _sqlite3_trace_v2 = (Module['_sqlite3_trace_v2'] = (a0, a1, a2, a3) => + (_sqlite3_trace_v2 = Module['_sqlite3_trace_v2'] = + wasmExports['sqlite3_trace_v2'])(a0, a1, a2, a3)); + var _sqlite3_commit_hook = (Module['_sqlite3_commit_hook'] = (a0, a1, a2) => + (_sqlite3_commit_hook = Module['_sqlite3_commit_hook'] = + wasmExports['sqlite3_commit_hook'])(a0, a1, a2)); + var _sqlite3_update_hook = (Module['_sqlite3_update_hook'] = (a0, a1, a2) => + (_sqlite3_update_hook = Module['_sqlite3_update_hook'] = + wasmExports['sqlite3_update_hook'])(a0, a1, a2)); + var _sqlite3_rollback_hook = (Module['_sqlite3_rollback_hook'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_rollback_hook = Module['_sqlite3_rollback_hook'] = + wasmExports['sqlite3_rollback_hook'])(a0, a1, a2)); + var _sqlite3_preupdate_hook = (Module['_sqlite3_preupdate_hook'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_preupdate_hook = Module['_sqlite3_preupdate_hook'] = + wasmExports['sqlite3_preupdate_hook'])(a0, a1, a2)); + var _sqlite3_error_offset = (Module['_sqlite3_error_offset'] = (a0) => + (_sqlite3_error_offset = Module['_sqlite3_error_offset'] = + wasmExports['sqlite3_error_offset'])(a0)); + var _sqlite3_errcode = (Module['_sqlite3_errcode'] = (a0) => + (_sqlite3_errcode = Module['_sqlite3_errcode'] = + wasmExports['sqlite3_errcode'])(a0)); + var _sqlite3_extended_errcode = (Module['_sqlite3_extended_errcode'] = ( + a0, + ) => + (_sqlite3_extended_errcode = Module['_sqlite3_extended_errcode'] = + wasmExports['sqlite3_extended_errcode'])(a0)); + var _sqlite3_errstr = (Module['_sqlite3_errstr'] = (a0) => + (_sqlite3_errstr = Module['_sqlite3_errstr'] = + wasmExports['sqlite3_errstr'])(a0)); + var _sqlite3_limit = (Module['_sqlite3_limit'] = (a0, a1, a2) => + (_sqlite3_limit = Module['_sqlite3_limit'] = + wasmExports['sqlite3_limit'])(a0, a1, a2)); + var _sqlite3_open = (Module['_sqlite3_open'] = (a0, a1) => + (_sqlite3_open = Module['_sqlite3_open'] = wasmExports['sqlite3_open'])( + a0, + a1, + )); + var _sqlite3_open_v2 = (Module['_sqlite3_open_v2'] = (a0, a1, a2, a3) => + (_sqlite3_open_v2 = Module['_sqlite3_open_v2'] = + wasmExports['sqlite3_open_v2'])(a0, a1, a2, a3)); + var _sqlite3_create_collation = (Module['_sqlite3_create_collation'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_create_collation = Module['_sqlite3_create_collation'] = + wasmExports['sqlite3_create_collation'])(a0, a1, a2, a3, a4)); + var _sqlite3_create_collation_v2 = (Module['_sqlite3_create_collation_v2'] = + (a0, a1, a2, a3, a4, a5) => + (_sqlite3_create_collation_v2 = Module['_sqlite3_create_collation_v2'] = + wasmExports['sqlite3_create_collation_v2'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3_collation_needed = (Module['_sqlite3_collation_needed'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_collation_needed = Module['_sqlite3_collation_needed'] = + wasmExports['sqlite3_collation_needed'])(a0, a1, a2)); + var _sqlite3_get_autocommit = (Module['_sqlite3_get_autocommit'] = (a0) => + (_sqlite3_get_autocommit = Module['_sqlite3_get_autocommit'] = + wasmExports['sqlite3_get_autocommit'])(a0)); + var _sqlite3_table_column_metadata = (Module[ + '_sqlite3_table_column_metadata' + ] = (a0, a1, a2, a3, a4, a5, a6, a7, a8) => + (_sqlite3_table_column_metadata = Module[ + '_sqlite3_table_column_metadata' + ] = + wasmExports['sqlite3_table_column_metadata'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3_extended_result_codes = (Module[ + '_sqlite3_extended_result_codes' + ] = (a0, a1) => + (_sqlite3_extended_result_codes = Module[ + '_sqlite3_extended_result_codes' + ] = + wasmExports['sqlite3_extended_result_codes'])(a0, a1)); + var _sqlite3_uri_key = (Module['_sqlite3_uri_key'] = (a0, a1) => + (_sqlite3_uri_key = Module['_sqlite3_uri_key'] = + wasmExports['sqlite3_uri_key'])(a0, a1)); + var _sqlite3_uri_int64 = (Module['_sqlite3_uri_int64'] = (a0, a1, a2) => + (_sqlite3_uri_int64 = Module['_sqlite3_uri_int64'] = + wasmExports['sqlite3_uri_int64'])(a0, a1, a2)); + var _sqlite3_db_name = (Module['_sqlite3_db_name'] = (a0, a1) => + (_sqlite3_db_name = Module['_sqlite3_db_name'] = + wasmExports['sqlite3_db_name'])(a0, a1)); + var _sqlite3_db_filename = (Module['_sqlite3_db_filename'] = (a0, a1) => + (_sqlite3_db_filename = Module['_sqlite3_db_filename'] = + wasmExports['sqlite3_db_filename'])(a0, a1)); + var _sqlite3_db_readonly = (Module['_sqlite3_db_readonly'] = (a0, a1) => + (_sqlite3_db_readonly = Module['_sqlite3_db_readonly'] = + wasmExports['sqlite3_db_readonly'])(a0, a1)); + var _sqlite3_compileoption_used = (Module['_sqlite3_compileoption_used'] = ( + a0, + ) => + (_sqlite3_compileoption_used = Module['_sqlite3_compileoption_used'] = + wasmExports['sqlite3_compileoption_used'])(a0)); + var _sqlite3_compileoption_get = (Module['_sqlite3_compileoption_get'] = ( + a0, + ) => + (_sqlite3_compileoption_get = Module['_sqlite3_compileoption_get'] = + wasmExports['sqlite3_compileoption_get'])(a0)); + var _sqlite3session_diff = (Module['_sqlite3session_diff'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3session_diff = Module['_sqlite3session_diff'] = + wasmExports['sqlite3session_diff'])(a0, a1, a2, a3)); + var _sqlite3session_attach = (Module['_sqlite3session_attach'] = (a0, a1) => + (_sqlite3session_attach = Module['_sqlite3session_attach'] = + wasmExports['sqlite3session_attach'])(a0, a1)); + var _sqlite3session_create = (Module['_sqlite3session_create'] = ( + a0, + a1, + a2, + ) => + (_sqlite3session_create = Module['_sqlite3session_create'] = + wasmExports['sqlite3session_create'])(a0, a1, a2)); + var _sqlite3session_delete = (Module['_sqlite3session_delete'] = (a0) => + (_sqlite3session_delete = Module['_sqlite3session_delete'] = + wasmExports['sqlite3session_delete'])(a0)); + var _sqlite3session_table_filter = (Module['_sqlite3session_table_filter'] = + (a0, a1, a2) => + (_sqlite3session_table_filter = Module['_sqlite3session_table_filter'] = + wasmExports['sqlite3session_table_filter'])(a0, a1, a2)); + var _sqlite3session_changeset = (Module['_sqlite3session_changeset'] = ( + a0, + a1, + a2, + ) => + (_sqlite3session_changeset = Module['_sqlite3session_changeset'] = + wasmExports['sqlite3session_changeset'])(a0, a1, a2)); + var _sqlite3session_changeset_strm = (Module[ + '_sqlite3session_changeset_strm' + ] = (a0, a1, a2) => + (_sqlite3session_changeset_strm = Module[ + '_sqlite3session_changeset_strm' + ] = + wasmExports['sqlite3session_changeset_strm'])(a0, a1, a2)); + var _sqlite3session_patchset_strm = (Module[ + '_sqlite3session_patchset_strm' + ] = (a0, a1, a2) => + (_sqlite3session_patchset_strm = Module['_sqlite3session_patchset_strm'] = + wasmExports['sqlite3session_patchset_strm'])(a0, a1, a2)); + var _sqlite3session_patchset = (Module['_sqlite3session_patchset'] = ( + a0, + a1, + a2, + ) => + (_sqlite3session_patchset = Module['_sqlite3session_patchset'] = + wasmExports['sqlite3session_patchset'])(a0, a1, a2)); + var _sqlite3session_enable = (Module['_sqlite3session_enable'] = (a0, a1) => + (_sqlite3session_enable = Module['_sqlite3session_enable'] = + wasmExports['sqlite3session_enable'])(a0, a1)); + var _sqlite3session_indirect = (Module['_sqlite3session_indirect'] = ( + a0, + a1, + ) => + (_sqlite3session_indirect = Module['_sqlite3session_indirect'] = + wasmExports['sqlite3session_indirect'])(a0, a1)); + var _sqlite3session_isempty = (Module['_sqlite3session_isempty'] = (a0) => + (_sqlite3session_isempty = Module['_sqlite3session_isempty'] = + wasmExports['sqlite3session_isempty'])(a0)); + var _sqlite3session_memory_used = (Module['_sqlite3session_memory_used'] = ( + a0, + ) => + (_sqlite3session_memory_used = Module['_sqlite3session_memory_used'] = + wasmExports['sqlite3session_memory_used'])(a0)); + var _sqlite3session_object_config = (Module[ + '_sqlite3session_object_config' + ] = (a0, a1, a2) => + (_sqlite3session_object_config = Module['_sqlite3session_object_config'] = + wasmExports['sqlite3session_object_config'])(a0, a1, a2)); + var _sqlite3session_changeset_size = (Module[ + '_sqlite3session_changeset_size' + ] = (a0) => + (_sqlite3session_changeset_size = Module[ + '_sqlite3session_changeset_size' + ] = + wasmExports['sqlite3session_changeset_size'])(a0)); + var _sqlite3changeset_start = (Module['_sqlite3changeset_start'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_start = Module['_sqlite3changeset_start'] = + wasmExports['sqlite3changeset_start'])(a0, a1, a2)); + var _sqlite3changeset_start_v2 = (Module['_sqlite3changeset_start_v2'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3changeset_start_v2 = Module['_sqlite3changeset_start_v2'] = + wasmExports['sqlite3changeset_start_v2'])(a0, a1, a2, a3)); + var _sqlite3changeset_start_strm = (Module['_sqlite3changeset_start_strm'] = + (a0, a1, a2) => + (_sqlite3changeset_start_strm = Module['_sqlite3changeset_start_strm'] = + wasmExports['sqlite3changeset_start_strm'])(a0, a1, a2)); + var _sqlite3changeset_start_v2_strm = (Module[ + '_sqlite3changeset_start_v2_strm' + ] = (a0, a1, a2, a3) => + (_sqlite3changeset_start_v2_strm = Module[ + '_sqlite3changeset_start_v2_strm' + ] = + wasmExports['sqlite3changeset_start_v2_strm'])(a0, a1, a2, a3)); + var _sqlite3changeset_next = (Module['_sqlite3changeset_next'] = (a0) => + (_sqlite3changeset_next = Module['_sqlite3changeset_next'] = + wasmExports['sqlite3changeset_next'])(a0)); + var _sqlite3changeset_op = (Module['_sqlite3changeset_op'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3changeset_op = Module['_sqlite3changeset_op'] = + wasmExports['sqlite3changeset_op'])(a0, a1, a2, a3, a4)); + var _sqlite3changeset_pk = (Module['_sqlite3changeset_pk'] = (a0, a1, a2) => + (_sqlite3changeset_pk = Module['_sqlite3changeset_pk'] = + wasmExports['sqlite3changeset_pk'])(a0, a1, a2)); + var _sqlite3changeset_old = (Module['_sqlite3changeset_old'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_old = Module['_sqlite3changeset_old'] = + wasmExports['sqlite3changeset_old'])(a0, a1, a2)); + var _sqlite3changeset_new = (Module['_sqlite3changeset_new'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_new = Module['_sqlite3changeset_new'] = + wasmExports['sqlite3changeset_new'])(a0, a1, a2)); + var _sqlite3changeset_conflict = (Module['_sqlite3changeset_conflict'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_conflict = Module['_sqlite3changeset_conflict'] = + wasmExports['sqlite3changeset_conflict'])(a0, a1, a2)); + var _sqlite3changeset_fk_conflicts = (Module[ + '_sqlite3changeset_fk_conflicts' + ] = (a0, a1) => + (_sqlite3changeset_fk_conflicts = Module[ + '_sqlite3changeset_fk_conflicts' + ] = + wasmExports['sqlite3changeset_fk_conflicts'])(a0, a1)); + var _sqlite3changeset_finalize = (Module['_sqlite3changeset_finalize'] = ( + a0, + ) => + (_sqlite3changeset_finalize = Module['_sqlite3changeset_finalize'] = + wasmExports['sqlite3changeset_finalize'])(a0)); + var _sqlite3changeset_invert = (Module['_sqlite3changeset_invert'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3changeset_invert = Module['_sqlite3changeset_invert'] = + wasmExports['sqlite3changeset_invert'])(a0, a1, a2, a3)); + var _sqlite3changeset_invert_strm = (Module[ + '_sqlite3changeset_invert_strm' + ] = (a0, a1, a2, a3) => + (_sqlite3changeset_invert_strm = Module['_sqlite3changeset_invert_strm'] = + wasmExports['sqlite3changeset_invert_strm'])(a0, a1, a2, a3)); + var _sqlite3changeset_apply_v2 = (Module['_sqlite3changeset_apply_v2'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (_sqlite3changeset_apply_v2 = Module['_sqlite3changeset_apply_v2'] = + wasmExports['sqlite3changeset_apply_v2'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3changeset_apply = (Module['_sqlite3changeset_apply'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3changeset_apply = Module['_sqlite3changeset_apply'] = + wasmExports['sqlite3changeset_apply'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3changeset_apply_v2_strm = (Module[ + '_sqlite3changeset_apply_v2_strm' + ] = (a0, a1, a2, a3, a4, a5, a6, a7, a8) => + (_sqlite3changeset_apply_v2_strm = Module[ + '_sqlite3changeset_apply_v2_strm' + ] = + wasmExports['sqlite3changeset_apply_v2_strm'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3changeset_apply_strm = (Module['_sqlite3changeset_apply_strm'] = + (a0, a1, a2, a3, a4, a5) => + (_sqlite3changeset_apply_strm = Module['_sqlite3changeset_apply_strm'] = + wasmExports['sqlite3changeset_apply_strm'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3changegroup_new = (Module['_sqlite3changegroup_new'] = (a0) => + (_sqlite3changegroup_new = Module['_sqlite3changegroup_new'] = + wasmExports['sqlite3changegroup_new'])(a0)); + var _sqlite3changegroup_add = (Module['_sqlite3changegroup_add'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changegroup_add = Module['_sqlite3changegroup_add'] = + wasmExports['sqlite3changegroup_add'])(a0, a1, a2)); + var _sqlite3changegroup_output = (Module['_sqlite3changegroup_output'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changegroup_output = Module['_sqlite3changegroup_output'] = + wasmExports['sqlite3changegroup_output'])(a0, a1, a2)); + var _sqlite3changegroup_add_strm = (Module['_sqlite3changegroup_add_strm'] = + (a0, a1, a2) => + (_sqlite3changegroup_add_strm = Module['_sqlite3changegroup_add_strm'] = + wasmExports['sqlite3changegroup_add_strm'])(a0, a1, a2)); + var _sqlite3changegroup_output_strm = (Module[ + '_sqlite3changegroup_output_strm' + ] = (a0, a1, a2) => + (_sqlite3changegroup_output_strm = Module[ + '_sqlite3changegroup_output_strm' + ] = + wasmExports['sqlite3changegroup_output_strm'])(a0, a1, a2)); + var _sqlite3changegroup_delete = (Module['_sqlite3changegroup_delete'] = ( + a0, + ) => + (_sqlite3changegroup_delete = Module['_sqlite3changegroup_delete'] = + wasmExports['sqlite3changegroup_delete'])(a0)); + var _sqlite3changeset_concat = (Module['_sqlite3changeset_concat'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3changeset_concat = Module['_sqlite3changeset_concat'] = + wasmExports['sqlite3changeset_concat'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3changeset_concat_strm = (Module[ + '_sqlite3changeset_concat_strm' + ] = (a0, a1, a2, a3, a4, a5) => + (_sqlite3changeset_concat_strm = Module['_sqlite3changeset_concat_strm'] = + wasmExports['sqlite3changeset_concat_strm'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3session_config = (Module['_sqlite3session_config'] = (a0, a1) => + (_sqlite3session_config = Module['_sqlite3session_config'] = + wasmExports['sqlite3session_config'])(a0, a1)); + var _sqlite3_sourceid = (Module['_sqlite3_sourceid'] = () => + (_sqlite3_sourceid = Module['_sqlite3_sourceid'] = + wasmExports['sqlite3_sourceid'])()); + var _sqlite3__wasm_pstack_ptr = (Module['_sqlite3__wasm_pstack_ptr'] = () => + (_sqlite3__wasm_pstack_ptr = Module['_sqlite3__wasm_pstack_ptr'] = + wasmExports['sqlite3__wasm_pstack_ptr'])()); + var _sqlite3__wasm_pstack_restore = (Module[ + '_sqlite3__wasm_pstack_restore' + ] = (a0) => + (_sqlite3__wasm_pstack_restore = Module['_sqlite3__wasm_pstack_restore'] = + wasmExports['sqlite3__wasm_pstack_restore'])(a0)); + var _sqlite3__wasm_pstack_alloc = (Module['_sqlite3__wasm_pstack_alloc'] = ( + a0, + ) => + (_sqlite3__wasm_pstack_alloc = Module['_sqlite3__wasm_pstack_alloc'] = + wasmExports['sqlite3__wasm_pstack_alloc'])(a0)); + var _sqlite3__wasm_pstack_remaining = (Module[ + '_sqlite3__wasm_pstack_remaining' + ] = () => + (_sqlite3__wasm_pstack_remaining = Module[ + '_sqlite3__wasm_pstack_remaining' + ] = + wasmExports['sqlite3__wasm_pstack_remaining'])()); + var _sqlite3__wasm_pstack_quota = (Module['_sqlite3__wasm_pstack_quota'] = + () => + (_sqlite3__wasm_pstack_quota = Module['_sqlite3__wasm_pstack_quota'] = + wasmExports['sqlite3__wasm_pstack_quota'])()); + var _sqlite3__wasm_db_error = (Module['_sqlite3__wasm_db_error'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_db_error = Module['_sqlite3__wasm_db_error'] = + wasmExports['sqlite3__wasm_db_error'])(a0, a1, a2)); + var _sqlite3__wasm_test_struct = (Module['_sqlite3__wasm_test_struct'] = ( + a0, + ) => + (_sqlite3__wasm_test_struct = Module['_sqlite3__wasm_test_struct'] = + wasmExports['sqlite3__wasm_test_struct'])(a0)); + var _sqlite3__wasm_enum_json = (Module['_sqlite3__wasm_enum_json'] = () => + (_sqlite3__wasm_enum_json = Module['_sqlite3__wasm_enum_json'] = + wasmExports['sqlite3__wasm_enum_json'])()); + var _sqlite3__wasm_vfs_unlink = (Module['_sqlite3__wasm_vfs_unlink'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_vfs_unlink = Module['_sqlite3__wasm_vfs_unlink'] = + wasmExports['sqlite3__wasm_vfs_unlink'])(a0, a1)); + var _sqlite3__wasm_db_vfs = (Module['_sqlite3__wasm_db_vfs'] = (a0, a1) => + (_sqlite3__wasm_db_vfs = Module['_sqlite3__wasm_db_vfs'] = + wasmExports['sqlite3__wasm_db_vfs'])(a0, a1)); + var _sqlite3__wasm_db_reset = (Module['_sqlite3__wasm_db_reset'] = (a0) => + (_sqlite3__wasm_db_reset = Module['_sqlite3__wasm_db_reset'] = + wasmExports['sqlite3__wasm_db_reset'])(a0)); + var _sqlite3__wasm_db_export_chunked = (Module[ + '_sqlite3__wasm_db_export_chunked' + ] = (a0, a1) => + (_sqlite3__wasm_db_export_chunked = Module[ + '_sqlite3__wasm_db_export_chunked' + ] = + wasmExports['sqlite3__wasm_db_export_chunked'])(a0, a1)); + var _sqlite3__wasm_db_serialize = (Module['_sqlite3__wasm_db_serialize'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3__wasm_db_serialize = Module['_sqlite3__wasm_db_serialize'] = + wasmExports['sqlite3__wasm_db_serialize'])(a0, a1, a2, a3, a4)); + var _sqlite3__wasm_vfs_create_file = (Module[ + '_sqlite3__wasm_vfs_create_file' + ] = (a0, a1, a2, a3) => + (_sqlite3__wasm_vfs_create_file = Module[ + '_sqlite3__wasm_vfs_create_file' + ] = + wasmExports['sqlite3__wasm_vfs_create_file'])(a0, a1, a2, a3)); + var _sqlite3__wasm_posix_create_file = (Module[ + '_sqlite3__wasm_posix_create_file' + ] = (a0, a1, a2) => + (_sqlite3__wasm_posix_create_file = Module[ + '_sqlite3__wasm_posix_create_file' + ] = + wasmExports['sqlite3__wasm_posix_create_file'])(a0, a1, a2)); + var _sqlite3__wasm_kvvfsMakeKeyOnPstack = (Module[ + '_sqlite3__wasm_kvvfsMakeKeyOnPstack' + ] = (a0, a1) => + (_sqlite3__wasm_kvvfsMakeKeyOnPstack = Module[ + '_sqlite3__wasm_kvvfsMakeKeyOnPstack' + ] = + wasmExports['sqlite3__wasm_kvvfsMakeKeyOnPstack'])(a0, a1)); + var _sqlite3__wasm_kvvfs_methods = (Module['_sqlite3__wasm_kvvfs_methods'] = + () => + (_sqlite3__wasm_kvvfs_methods = Module['_sqlite3__wasm_kvvfs_methods'] = + wasmExports['sqlite3__wasm_kvvfs_methods'])()); + var _sqlite3__wasm_vtab_config = (Module['_sqlite3__wasm_vtab_config'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_vtab_config = Module['_sqlite3__wasm_vtab_config'] = + wasmExports['sqlite3__wasm_vtab_config'])(a0, a1, a2)); + var _sqlite3__wasm_db_config_ip = (Module['_sqlite3__wasm_db_config_ip'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3__wasm_db_config_ip = Module['_sqlite3__wasm_db_config_ip'] = + wasmExports['sqlite3__wasm_db_config_ip'])(a0, a1, a2, a3)); + var _sqlite3__wasm_db_config_pii = (Module['_sqlite3__wasm_db_config_pii'] = + (a0, a1, a2, a3, a4) => + (_sqlite3__wasm_db_config_pii = Module['_sqlite3__wasm_db_config_pii'] = + wasmExports['sqlite3__wasm_db_config_pii'])(a0, a1, a2, a3, a4)); + var _sqlite3__wasm_db_config_s = (Module['_sqlite3__wasm_db_config_s'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_db_config_s = Module['_sqlite3__wasm_db_config_s'] = + wasmExports['sqlite3__wasm_db_config_s'])(a0, a1, a2)); + var _sqlite3__wasm_config_i = (Module['_sqlite3__wasm_config_i'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_config_i = Module['_sqlite3__wasm_config_i'] = + wasmExports['sqlite3__wasm_config_i'])(a0, a1)); + var _sqlite3__wasm_config_ii = (Module['_sqlite3__wasm_config_ii'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_config_ii = Module['_sqlite3__wasm_config_ii'] = + wasmExports['sqlite3__wasm_config_ii'])(a0, a1, a2)); + var _sqlite3__wasm_config_j = (Module['_sqlite3__wasm_config_j'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_config_j = Module['_sqlite3__wasm_config_j'] = + wasmExports['sqlite3__wasm_config_j'])(a0, a1)); + var _sqlite3__wasm_qfmt_token = (Module['_sqlite3__wasm_qfmt_token'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_qfmt_token = Module['_sqlite3__wasm_qfmt_token'] = + wasmExports['sqlite3__wasm_qfmt_token'])(a0, a1)); + var _sqlite3__wasm_init_wasmfs = (Module['_sqlite3__wasm_init_wasmfs'] = ( + a0, + ) => + (_sqlite3__wasm_init_wasmfs = Module['_sqlite3__wasm_init_wasmfs'] = + wasmExports['sqlite3__wasm_init_wasmfs'])(a0)); + var _sqlite3__wasm_test_intptr = (Module['_sqlite3__wasm_test_intptr'] = ( + a0, + ) => + (_sqlite3__wasm_test_intptr = Module['_sqlite3__wasm_test_intptr'] = + wasmExports['sqlite3__wasm_test_intptr'])(a0)); + var _sqlite3__wasm_test_voidptr = (Module['_sqlite3__wasm_test_voidptr'] = ( + a0, + ) => + (_sqlite3__wasm_test_voidptr = Module['_sqlite3__wasm_test_voidptr'] = + wasmExports['sqlite3__wasm_test_voidptr'])(a0)); + var _sqlite3__wasm_test_int64_max = (Module[ + '_sqlite3__wasm_test_int64_max' + ] = () => + (_sqlite3__wasm_test_int64_max = Module['_sqlite3__wasm_test_int64_max'] = + wasmExports['sqlite3__wasm_test_int64_max'])()); + var _sqlite3__wasm_test_int64_min = (Module[ + '_sqlite3__wasm_test_int64_min' + ] = () => + (_sqlite3__wasm_test_int64_min = Module['_sqlite3__wasm_test_int64_min'] = + wasmExports['sqlite3__wasm_test_int64_min'])()); + var _sqlite3__wasm_test_int64_times2 = (Module[ + '_sqlite3__wasm_test_int64_times2' + ] = (a0) => + (_sqlite3__wasm_test_int64_times2 = Module[ + '_sqlite3__wasm_test_int64_times2' + ] = + wasmExports['sqlite3__wasm_test_int64_times2'])(a0)); + var _sqlite3__wasm_test_int64_minmax = (Module[ + '_sqlite3__wasm_test_int64_minmax' + ] = (a0, a1) => + (_sqlite3__wasm_test_int64_minmax = Module[ + '_sqlite3__wasm_test_int64_minmax' + ] = + wasmExports['sqlite3__wasm_test_int64_minmax'])(a0, a1)); + var _sqlite3__wasm_test_int64ptr = (Module['_sqlite3__wasm_test_int64ptr'] = + (a0) => + (_sqlite3__wasm_test_int64ptr = Module['_sqlite3__wasm_test_int64ptr'] = + wasmExports['sqlite3__wasm_test_int64ptr'])(a0)); + var _sqlite3__wasm_test_stack_overflow = (Module[ + '_sqlite3__wasm_test_stack_overflow' + ] = (a0) => + (_sqlite3__wasm_test_stack_overflow = Module[ + '_sqlite3__wasm_test_stack_overflow' + ] = + wasmExports['sqlite3__wasm_test_stack_overflow'])(a0)); + var _sqlite3__wasm_test_str_hello = (Module[ + '_sqlite3__wasm_test_str_hello' + ] = (a0) => + (_sqlite3__wasm_test_str_hello = Module['_sqlite3__wasm_test_str_hello'] = + wasmExports['sqlite3__wasm_test_str_hello'])(a0)); + var _sqlite3__wasm_SQLTester_strglob = (Module[ + '_sqlite3__wasm_SQLTester_strglob' + ] = (a0, a1) => + (_sqlite3__wasm_SQLTester_strglob = Module[ + '_sqlite3__wasm_SQLTester_strglob' + ] = + wasmExports['sqlite3__wasm_SQLTester_strglob'])(a0, a1)); + var _malloc = (Module['_malloc'] = (a0) => + (_malloc = Module['_malloc'] = wasmExports['malloc'])(a0)); + var _free = (Module['_free'] = (a0) => + (_free = Module['_free'] = wasmExports['free'])(a0)); + var _realloc = (Module['_realloc'] = (a0, a1) => + (_realloc = Module['_realloc'] = wasmExports['realloc'])(a0, a1)); + var _emscripten_builtin_memalign = (a0, a1) => + (_emscripten_builtin_memalign = + wasmExports['emscripten_builtin_memalign'])(a0, a1); + var __emscripten_stack_restore = (a0) => + (__emscripten_stack_restore = wasmExports['_emscripten_stack_restore'])( + a0, + ); + var __emscripten_stack_alloc = (a0) => + (__emscripten_stack_alloc = wasmExports['_emscripten_stack_alloc'])(a0); + var _emscripten_stack_get_current = () => + (_emscripten_stack_get_current = + wasmExports['emscripten_stack_get_current'])(); + + Module['wasmMemory'] = wasmMemory; + + var calledRun; + var calledPrerun; + + dependenciesFulfilled = function runCaller() { + if (!calledRun) run(); + if (!calledRun) dependenciesFulfilled = runCaller; + }; + + function run() { + if (runDependencies > 0) { + return; + } + + if (!calledPrerun) { + calledPrerun = 1; + preRun(); + + if (runDependencies > 0) { + return; + } + } + + function doRun() { + if (calledRun) return; + calledRun = 1; + Module['calledRun'] = 1; + + if (ABORT) return; + + initRuntime(); + + readyPromiseResolve(Module); + Module['onRuntimeInitialized']?.(); + + postRun(); + } + + if (Module['setStatus']) { + Module['setStatus']('Running...'); + setTimeout(() => { + setTimeout(() => Module['setStatus'](''), 1); + doRun(); + }, 1); + } else { + doRun(); + } + } + + if (Module['preInit']) { + if (typeof Module['preInit'] == 'function') + Module['preInit'] = [Module['preInit']]; + while (Module['preInit'].length > 0) { + Module['preInit'].pop()(); + } + } + + run(); + + Module.runSQLite3PostLoadInit = function (EmscriptenModule) { + 'use strict'; + + 'use strict'; + globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap( + apiConfig = globalThis.sqlite3ApiConfig || + sqlite3ApiBootstrap.defaultConfig, + ) { + if (sqlite3ApiBootstrap.sqlite3) { + (sqlite3ApiBootstrap.sqlite3.config || console).warn( + 'sqlite3ApiBootstrap() called multiple times.', + 'Config and external initializers are ignored on calls after the first.', + ); + return sqlite3ApiBootstrap.sqlite3; + } + const config = Object.assign( + Object.create(null), + { + exports: undefined, + memory: undefined, + bigIntEnabled: (() => { + if ('undefined' !== typeof Module) { + if (!!Module.HEAPU64) return true; + } + return !!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: false, + }, + apiConfig || {}, + ); + + Object.assign( + config, + { + allocExportName: config.useStdAlloc ? 'malloc' : 'sqlite3_malloc', + deallocExportName: config.useStdAlloc ? 'free' : 'sqlite3_free', + reallocExportName: config.useStdAlloc + ? 'realloc' + : 'sqlite3_realloc', + }, + config, + ); + + ['exports', 'memory', 'wasmfsOpfsDir'].forEach((k) => { + if ('function' === typeof config[k]) { + config[k] = config[k](); + } + }); + + delete globalThis.sqlite3ApiConfig; + delete sqlite3ApiBootstrap.defaultConfig; + + const capi = Object.create(null); + + const wasm = Object.create(null); + + const __rcStr = (rc) => { + return ( + (capi.sqlite3_js_rc_str && capi.sqlite3_js_rc_str(rc)) || + 'Unknown result code #' + rc + ); + }; + + const __isInt = (n) => 'number' === typeof n && n === (n | 0); + + class SQLite3Error extends Error { + constructor(...args) { + let rc; + if (args.length) { + if (__isInt(args[0])) { + rc = args[0]; + if (1 === args.length) { + super(__rcStr(args[0])); + } else { + const rcStr = __rcStr(rc); + if ('object' === typeof args[1]) { + super(rcStr, args[1]); + } else { + args[0] = rcStr + ':'; + super(args.join(' ')); + } + } + } else { + if (2 === args.length && 'object' === typeof args[1]) { + super(...args); + } else { + super(args.join(' ')); + } + } + } + this.resultCode = rc || capi.SQLITE_ERROR; + this.name = 'SQLite3Error'; + } + } + + SQLite3Error.toss = (...args) => { + throw new SQLite3Error(...args); + }; + const toss3 = SQLite3Error.toss; + + if (config.wasmfsOpfsDir && !/^\/[^/]+$/.test(config.wasmfsOpfsDir)) { + toss3( + "config.wasmfsOpfsDir must be falsy or in the form '/dir-name'.", + ); + } + + const isInt32 = (n) => { + return ( + 'bigint' !== typeof n && + !!(n === (n | 0) && n <= 2147483647 && n >= -2147483648) + ); + }; + + const bigIntFits64 = function f(b) { + if (!f._max) { + f._max = BigInt('0x7fffffffffffffff'); + f._min = ~f._max; + } + return b >= f._min && b <= f._max; + }; + + const bigIntFits32 = (b) => b >= -0x7fffffffn - 1n && b <= 0x7fffffffn; + + const bigIntFitsDouble = function f(b) { + if (!f._min) { + f._min = Number.MIN_SAFE_INTEGER; + f._max = Number.MAX_SAFE_INTEGER; + } + return b >= f._min && b <= f._max; + }; + + const isTypedArray = (v) => { + return v && v.constructor && isInt32(v.constructor.BYTES_PER_ELEMENT) + ? v + : false; + }; + + const __SAB = + 'undefined' === typeof SharedArrayBuffer + ? function () {} + : SharedArrayBuffer; + + const isSharedTypedArray = (aTypedArray) => + aTypedArray.buffer instanceof __SAB; + + const typedArrayPart = (aTypedArray, begin, end) => { + return isSharedTypedArray(aTypedArray) + ? aTypedArray.slice(begin, end) + : aTypedArray.subarray(begin, end); + }; + + const isBindableTypedArray = (v) => { + return ( + v && + (v instanceof Uint8Array || + v instanceof Int8Array || + v instanceof ArrayBuffer) + ); + }; + + const isSQLableTypedArray = (v) => { + return ( + v && + (v instanceof Uint8Array || + v instanceof Int8Array || + v instanceof ArrayBuffer) + ); + }; + + const affirmBindableTypedArray = (v) => { + return ( + isBindableTypedArray(v) || + toss3('Value is not of a supported TypedArray type.') + ); + }; + + const utf8Decoder = new TextDecoder('utf-8'); + + const typedArrayToString = function (typedArray, begin, end) { + return utf8Decoder.decode(typedArrayPart(typedArray, begin, end)); + }; + + const flexibleString = function (v) { + if (isSQLableTypedArray(v)) { + return typedArrayToString( + v instanceof ArrayBuffer ? new Uint8Array(v) : v, + ); + } else if (Array.isArray(v)) return v.join(''); + else if (wasm.isPtr(v)) v = wasm.cstrToJs(v); + return v; + }; + + class WasmAllocError extends Error { + constructor(...args) { + if (2 === args.length && 'object' === typeof args[1]) { + super(...args); + } else if (args.length) { + super(args.join(' ')); + } else { + super('Allocation failed.'); + } + this.resultCode = capi.SQLITE_NOMEM; + this.name = 'WasmAllocError'; + } + } + + WasmAllocError.toss = (...args) => { + throw new WasmAllocError(...args); + }; + + Object.assign(capi, { + sqlite3_bind_blob: undefined, + + sqlite3_bind_text: undefined, + + sqlite3_create_function_v2: ( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + xDestroy, + ) => {}, + + sqlite3_create_function: ( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + ) => {}, + + sqlite3_create_window_function: ( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ) => {}, + + sqlite3_prepare_v3: ( + dbPtr, + sql, + sqlByteLen, + prepFlags, + stmtPtrPtr, + strPtrPtr, + ) => {}, + + sqlite3_prepare_v2: ( + dbPtr, + sql, + sqlByteLen, + stmtPtrPtr, + strPtrPtr, + ) => {}, + + sqlite3_exec: (pDb, sql, callback, pVoid, pErrMsg) => {}, + + sqlite3_randomness: (n, outPtr) => {}, + }); + + const util = { + affirmBindableTypedArray, + flexibleString, + bigIntFits32, + bigIntFits64, + bigIntFitsDouble, + isBindableTypedArray, + isInt32, + isSQLableTypedArray, + isTypedArray, + typedArrayToString, + isUIThread: () => + globalThis.window === globalThis && !!globalThis.document, + + isSharedTypedArray, + toss: function (...args) { + throw new Error(args.join(' ')); + }, + toss3, + typedArrayPart, + + affirmDbHeader: function (bytes) { + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + const header = 'SQLite format 3'; + if (header.length > bytes.byteLength) { + toss3('Input does not contain an SQLite3 database header.'); + } + for (let i = 0; i < header.length; ++i) { + if (header.charCodeAt(i) !== bytes[i]) { + toss3('Input does not contain an SQLite3 database header.'); + } + } + }, + + affirmIsDb: function (bytes) { + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + const n = bytes.byteLength; + if (n < 512 || n % 512 !== 0) { + toss3('Byte array size', n, 'is invalid for an SQLite3 db.'); + } + util.affirmDbHeader(bytes); + }, + }; + + Object.assign(wasm, { + ptrSizeof: config.wasmPtrSizeof || 4, + + ptrIR: config.wasmPtrIR || 'i32', + + bigIntEnabled: !!config.bigIntEnabled, + + exports: + config.exports || + toss3('Missing API config.exports (WASM module exports).'), + + memory: + config.memory || + config.exports['memory'] || + toss3( + 'API config object requires a WebAssembly.Memory object', + 'in either config.exports.memory (exported)', + 'or config.memory (imported).', + ), + + alloc: undefined, + + realloc: undefined, + + dealloc: undefined, + }); + + wasm.allocFromTypedArray = function (srcTypedArray) { + if (srcTypedArray instanceof ArrayBuffer) { + srcTypedArray = new Uint8Array(srcTypedArray); + } + affirmBindableTypedArray(srcTypedArray); + const pRet = wasm.alloc(srcTypedArray.byteLength || 1); + wasm + .heapForSize(srcTypedArray.constructor) + .set(srcTypedArray.byteLength ? srcTypedArray : [0], pRet); + return pRet; + }; + + { + const keyAlloc = config.allocExportName, + keyDealloc = config.deallocExportName, + keyRealloc = config.reallocExportName; + for (const key of [keyAlloc, keyDealloc, keyRealloc]) { + const f = wasm.exports[key]; + if (!(f instanceof Function)) + toss3('Missing required exports[', key, '] function.'); + } + + wasm.alloc = function f(n) { + return ( + f.impl(n) || + WasmAllocError.toss('Failed to allocate', n, ' bytes.') + ); + }; + wasm.alloc.impl = wasm.exports[keyAlloc]; + wasm.realloc = function f(m, n) { + const m2 = f.impl(m, n); + return n + ? m2 || WasmAllocError.toss('Failed to reallocate', n, ' bytes.') + : 0; + }; + wasm.realloc.impl = wasm.exports[keyRealloc]; + wasm.dealloc = wasm.exports[keyDealloc]; + } + + wasm.compileOptionUsed = function f(optName) { + if (!arguments.length) { + if (f._result) return f._result; + else if (!f._opt) { + f._rx = /^([^=]+)=(.+)/; + f._rxInt = /^-?\d+$/; + f._opt = function (opt, rv) { + const m = f._rx.exec(opt); + rv[0] = m ? m[1] : opt; + rv[1] = m ? (f._rxInt.test(m[2]) ? +m[2] : m[2]) : true; + }; + } + const rc = {}, + ov = [0, 0]; + let i = 0, + k; + while ((k = capi.sqlite3_compileoption_get(i++))) { + f._opt(k, ov); + rc[ov[0]] = ov[1]; + } + return (f._result = rc); + } else if (Array.isArray(optName)) { + const rc = {}; + optName.forEach((v) => { + rc[v] = capi.sqlite3_compileoption_used(v); + }); + return rc; + } else if ('object' === typeof optName) { + Object.keys(optName).forEach((k) => { + optName[k] = capi.sqlite3_compileoption_used(k); + }); + return optName; + } + return 'string' === typeof optName + ? !!capi.sqlite3_compileoption_used(optName) + : false; + }; + + wasm.pstack = Object.assign(Object.create(null), { + restore: wasm.exports.sqlite3__wasm_pstack_restore, + + alloc: function (n) { + if ('string' === typeof n && !(n = wasm.sizeofIR(n))) { + WasmAllocError.toss( + 'Invalid value for pstack.alloc(', + arguments[0], + ')', + ); + } + return ( + wasm.exports.sqlite3__wasm_pstack_alloc(n) || + WasmAllocError.toss( + 'Could not allocate', + n, + 'bytes from the pstack.', + ) + ); + }, + + allocChunks: function (n, sz) { + if ('string' === typeof sz && !(sz = wasm.sizeofIR(sz))) { + WasmAllocError.toss( + 'Invalid size value for allocChunks(', + arguments[1], + ')', + ); + } + const mem = wasm.pstack.alloc(n * sz); + const rc = []; + let i = 0, + offset = 0; + for (; i < n; ++i, offset += sz) rc.push(mem + offset); + return rc; + }, + + allocPtr: (n = 1, safePtrSize = true) => { + return 1 === n + ? wasm.pstack.alloc(safePtrSize ? 8 : wasm.ptrSizeof) + : wasm.pstack.allocChunks(n, safePtrSize ? 8 : wasm.ptrSizeof); + }, + + call: function (f) { + const stackPos = wasm.pstack.pointer; + try { + return f(sqlite3); + } finally { + wasm.pstack.restore(stackPos); + } + }, + }); + Object.defineProperties(wasm.pstack, { + pointer: { + configurable: false, + iterable: true, + writeable: false, + get: wasm.exports.sqlite3__wasm_pstack_ptr, + }, + + quota: { + configurable: false, + iterable: true, + writeable: false, + get: wasm.exports.sqlite3__wasm_pstack_quota, + }, + + remaining: { + configurable: false, + iterable: true, + writeable: false, + get: wasm.exports.sqlite3__wasm_pstack_remaining, + }, + }); + + capi.sqlite3_randomness = (...args) => { + if ( + 1 === args.length && + util.isTypedArray(args[0]) && + 1 === args[0].BYTES_PER_ELEMENT + ) { + const ta = args[0]; + if (0 === ta.byteLength) { + wasm.exports.sqlite3_randomness(0, 0); + return ta; + } + const stack = wasm.pstack.pointer; + try { + let n = ta.byteLength, + offset = 0; + const r = wasm.exports.sqlite3_randomness; + const heap = wasm.heap8u(); + const nAlloc = n < 512 ? n : 512; + const ptr = wasm.pstack.alloc(nAlloc); + do { + const j = n > nAlloc ? nAlloc : n; + r(j, ptr); + ta.set(typedArrayPart(heap, ptr, ptr + j), offset); + n -= j; + offset += j; + } while (n > 0); + } catch (e) { + console.error( + 'Highly unexpected (and ignored!) ' + + 'exception in sqlite3_randomness():', + e, + ); + } finally { + wasm.pstack.restore(stack); + } + return ta; + } + wasm.exports.sqlite3_randomness(...args); + }; + + let __wasmfsOpfsDir = undefined; + + capi.sqlite3_wasmfs_opfs_dir = function () { + if (undefined !== __wasmfsOpfsDir) return __wasmfsOpfsDir; + + const pdir = config.wasmfsOpfsDir; + if ( + !pdir || + !globalThis.FileSystemHandle || + !globalThis.FileSystemDirectoryHandle || + !globalThis.FileSystemFileHandle + ) { + return (__wasmfsOpfsDir = ''); + } + try { + if ( + pdir && + 0 === + wasm.xCallWrapped( + 'sqlite3__wasm_init_wasmfs', + 'i32', + ['string'], + pdir, + ) + ) { + return (__wasmfsOpfsDir = pdir); + } else { + return (__wasmfsOpfsDir = ''); + } + } catch (e) { + return (__wasmfsOpfsDir = ''); + } + }; + + capi.sqlite3_wasmfs_filename_is_persistent = function (name) { + const p = capi.sqlite3_wasmfs_opfs_dir(); + return p && name ? name.startsWith(p + '/') : false; + }; + + capi.sqlite3_js_db_uses_vfs = function (pDb, vfsName, dbName = 0) { + try { + const pK = capi.sqlite3_vfs_find(vfsName); + if (!pK) return false; + else if (!pDb) { + return pK === capi.sqlite3_vfs_find(0) ? pK : false; + } else { + return pK === capi.sqlite3_js_db_vfs(pDb, dbName) ? pK : false; + } + } catch (e) { + return false; + } + }; + + capi.sqlite3_js_vfs_list = function () { + const rc = []; + let pVfs = capi.sqlite3_vfs_find(0); + while (pVfs) { + const oVfs = new capi.sqlite3_vfs(pVfs); + rc.push(wasm.cstrToJs(oVfs.$zName)); + pVfs = oVfs.$pNext; + oVfs.dispose(); + } + return rc; + }; + + capi.sqlite3_js_db_export = function (pDb, schema = 0) { + pDb = wasm.xWrap.testConvertArg('sqlite3*', pDb); + if (!pDb) toss3('Invalid sqlite3* argument.'); + if (!wasm.bigIntEnabled) toss3('BigInt64 support is not enabled.'); + const scope = wasm.scopedAllocPush(); + let pOut; + try { + const pSize = wasm.scopedAlloc(8 + wasm.ptrSizeof); + const ppOut = pSize + 8; + + const zSchema = schema + ? wasm.isPtr(schema) + ? schema + : wasm.scopedAllocCString('' + schema) + : 0; + let rc = wasm.exports.sqlite3__wasm_db_serialize( + pDb, + zSchema, + ppOut, + pSize, + 0, + ); + if (rc) { + toss3( + 'Database serialization failed with code', + sqlite3.capi.sqlite3_js_rc_str(rc), + ); + } + pOut = wasm.peekPtr(ppOut); + const nOut = wasm.peek(pSize, 'i64'); + rc = nOut + ? wasm.heap8u().slice(pOut, pOut + Number(nOut)) + : new Uint8Array(); + return rc; + } finally { + if (pOut) wasm.exports.sqlite3_free(pOut); + wasm.scopedAllocPop(scope); + } + }; + + capi.sqlite3_js_db_vfs = (dbPointer, dbName = 0) => + util.sqlite3__wasm_db_vfs(dbPointer, dbName); + + capi.sqlite3_js_aggregate_context = (pCtx, n) => { + return ( + capi.sqlite3_aggregate_context(pCtx, n) || + (n + ? WasmAllocError.toss( + 'Cannot allocate', + n, + 'bytes for sqlite3_aggregate_context()', + ) + : 0) + ); + }; + + capi.sqlite3_js_posix_create_file = function (filename, data, dataLen) { + let pData; + if (data && wasm.isPtr(data)) { + pData = data; + } else if ( + data instanceof ArrayBuffer || + data instanceof Uint8Array + ) { + pData = wasm.allocFromTypedArray(data); + if (arguments.length < 3 || !util.isInt32(dataLen) || dataLen < 0) { + dataLen = data.byteLength; + } + } else { + SQLite3Error.toss( + 'Invalid 2nd argument for sqlite3_js_posix_create_file().', + ); + } + try { + if (!util.isInt32(dataLen) || dataLen < 0) { + SQLite3Error.toss( + 'Invalid 3rd argument for sqlite3_js_posix_create_file().', + ); + } + const rc = util.sqlite3__wasm_posix_create_file( + filename, + pData, + dataLen, + ); + if (rc) + SQLite3Error.toss( + 'Creation of file failed with sqlite3 result code', + capi.sqlite3_js_rc_str(rc), + ); + } finally { + wasm.dealloc(pData); + } + }; + + capi.sqlite3_js_vfs_create_file = function ( + vfs, + filename, + data, + dataLen, + ) { + config.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 pData; + if (data) { + if (wasm.isPtr(data)) { + pData = data; + } else if (data instanceof ArrayBuffer) { + data = new Uint8Array(data); + } + if (data instanceof Uint8Array) { + pData = wasm.allocFromTypedArray(data); + if ( + arguments.length < 4 || + !util.isInt32(dataLen) || + dataLen < 0 + ) { + dataLen = data.byteLength; + } + } else { + SQLite3Error.toss( + 'Invalid 3rd argument type for sqlite3_js_vfs_create_file().', + ); + } + } else { + pData = 0; + } + if (!util.isInt32(dataLen) || dataLen < 0) { + wasm.dealloc(pData); + SQLite3Error.toss( + 'Invalid 4th argument for sqlite3_js_vfs_create_file().', + ); + } + try { + const rc = util.sqlite3__wasm_vfs_create_file( + vfs, + filename, + pData, + dataLen, + ); + if (rc) + SQLite3Error.toss( + 'Creation of file failed with sqlite3 result code', + capi.sqlite3_js_rc_str(rc), + ); + } finally { + wasm.dealloc(pData); + } + }; + + capi.sqlite3_js_sql_to_string = (sql) => { + if ('string' === typeof sql) { + return sql; + } + const x = flexibleString(v); + return x === v ? undefined : x; + }; + + if (util.isUIThread()) { + const __kvvfsInfo = function (which) { + const rc = Object.create(null); + rc.prefix = 'kvvfs-' + which; + rc.stores = []; + if ('session' === which || '' === which) + rc.stores.push(globalThis.sessionStorage); + if ('local' === which || '' === which) + rc.stores.push(globalThis.localStorage); + return rc; + }; + + capi.sqlite3_js_kvvfs_clear = function (which = '') { + let rc = 0; + const kvinfo = __kvvfsInfo(which); + kvinfo.stores.forEach((s) => { + const toRm = []; + let i; + for (i = 0; i < s.length; ++i) { + const k = s.key(i); + if (k.startsWith(kvinfo.prefix)) toRm.push(k); + } + toRm.forEach((kk) => s.removeItem(kk)); + rc += toRm.length; + }); + return rc; + }; + + capi.sqlite3_js_kvvfs_size = function (which = '') { + let sz = 0; + const kvinfo = __kvvfsInfo(which); + kvinfo.stores.forEach((s) => { + let i; + for (i = 0; i < s.length; ++i) { + const k = s.key(i); + if (k.startsWith(kvinfo.prefix)) { + sz += k.length; + sz += s.getItem(k).length; + } + } + }); + return sz * 2; + }; + } + + capi.sqlite3_db_config = function (pDb, op, ...args) { + switch (op) { + case capi.SQLITE_DBCONFIG_ENABLE_FKEY: + case capi.SQLITE_DBCONFIG_ENABLE_TRIGGER: + case capi.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER: + case capi.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION: + case capi.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE: + case capi.SQLITE_DBCONFIG_ENABLE_QPSG: + case capi.SQLITE_DBCONFIG_TRIGGER_EQP: + case capi.SQLITE_DBCONFIG_RESET_DATABASE: + case capi.SQLITE_DBCONFIG_DEFENSIVE: + case capi.SQLITE_DBCONFIG_WRITABLE_SCHEMA: + case capi.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE: + case capi.SQLITE_DBCONFIG_DQS_DML: + case capi.SQLITE_DBCONFIG_DQS_DDL: + case capi.SQLITE_DBCONFIG_ENABLE_VIEW: + case capi.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT: + case capi.SQLITE_DBCONFIG_TRUSTED_SCHEMA: + case capi.SQLITE_DBCONFIG_STMT_SCANSTATUS: + case capi.SQLITE_DBCONFIG_REVERSE_SCANORDER: + case capi.SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE: + case capi.SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE: + case capi.SQLITE_DBCONFIG_ENABLE_COMMENTS: + if (!this.ip) { + this.ip = wasm.xWrap('sqlite3__wasm_db_config_ip', 'int', [ + 'sqlite3*', + 'int', + 'int', + '*', + ]); + } + return this.ip(pDb, op, args[0], args[1] || 0); + case capi.SQLITE_DBCONFIG_LOOKASIDE: + if (!this.pii) { + this.pii = wasm.xWrap('sqlite3__wasm_db_config_pii', 'int', [ + 'sqlite3*', + 'int', + '*', + 'int', + 'int', + ]); + } + return this.pii(pDb, op, args[0], args[1], args[2]); + case capi.SQLITE_DBCONFIG_MAINDBNAME: + if (!this.s) { + this.s = wasm.xWrap('sqlite3__wasm_db_config_s', 'int', [ + 'sqlite3*', + 'int', + 'string:static', + ]); + } + return this.s(pDb, op, args[0]); + default: + return capi.SQLITE_MISUSE; + } + }.bind(Object.create(null)); + + capi.sqlite3_value_to_js = function ( + pVal, + throwIfCannotConvert = true, + ) { + let arg; + const valType = capi.sqlite3_value_type(pVal); + switch (valType) { + case capi.SQLITE_INTEGER: + if (wasm.bigIntEnabled) { + arg = capi.sqlite3_value_int64(pVal); + if (util.bigIntFitsDouble(arg)) arg = Number(arg); + } else arg = capi.sqlite3_value_double(pVal); + break; + case capi.SQLITE_FLOAT: + arg = capi.sqlite3_value_double(pVal); + break; + case capi.SQLITE_TEXT: + arg = capi.sqlite3_value_text(pVal); + break; + case capi.SQLITE_BLOB: { + const n = capi.sqlite3_value_bytes(pVal); + const pBlob = capi.sqlite3_value_blob(pVal); + if (n && !pBlob) + sqlite3.WasmAllocError.toss( + 'Cannot allocate memory for blob argument of', + n, + 'byte(s)', + ); + arg = n ? wasm.heap8u().slice(pBlob, pBlob + Number(n)) : null; + break; + } + case capi.SQLITE_NULL: + arg = null; + break; + default: + if (throwIfCannotConvert) { + toss3( + capi.SQLITE_MISMATCH, + 'Unhandled sqlite3_value_type():', + valType, + ); + } + arg = undefined; + } + return arg; + }; + + capi.sqlite3_values_to_js = function ( + argc, + pArgv, + throwIfCannotConvert = true, + ) { + let i; + const tgt = []; + for (i = 0; i < argc; ++i) { + tgt.push( + capi.sqlite3_value_to_js( + wasm.peekPtr(pArgv + wasm.ptrSizeof * i), + throwIfCannotConvert, + ), + ); + } + return tgt; + }; + + capi.sqlite3_result_error_js = function (pCtx, e) { + if (e instanceof WasmAllocError) { + capi.sqlite3_result_error_nomem(pCtx); + } else { + capi.sqlite3_result_error(pCtx, '' + e, -1); + } + }; + + capi.sqlite3_result_js = function (pCtx, val) { + if (val instanceof Error) { + capi.sqlite3_result_error_js(pCtx, val); + return; + } + try { + switch (typeof val) { + case 'undefined': + break; + case 'boolean': + capi.sqlite3_result_int(pCtx, val ? 1 : 0); + break; + case 'bigint': + if (util.bigIntFits32(val)) { + capi.sqlite3_result_int(pCtx, Number(val)); + } else if (util.bigIntFitsDouble(val)) { + capi.sqlite3_result_double(pCtx, Number(val)); + } else if (wasm.bigIntEnabled) { + if (util.bigIntFits64(val)) + capi.sqlite3_result_int64(pCtx, val); + else + toss3( + 'BigInt value', + val.toString(), + 'is too BigInt for int64.', + ); + } else { + toss3('BigInt value', val.toString(), 'is too BigInt.'); + } + break; + case 'number': { + let f; + if (util.isInt32(val)) { + f = capi.sqlite3_result_int; + } else if ( + wasm.bigIntEnabled && + Number.isInteger(val) && + util.bigIntFits64(BigInt(val)) + ) { + f = capi.sqlite3_result_int64; + } else { + f = capi.sqlite3_result_double; + } + f(pCtx, val); + break; + } + case 'string': { + const [p, n] = wasm.allocCString(val, true); + capi.sqlite3_result_text(pCtx, p, n, capi.SQLITE_WASM_DEALLOC); + break; + } + case 'object': + if (null === val) { + capi.sqlite3_result_null(pCtx); + break; + } else if (util.isBindableTypedArray(val)) { + const pBlob = wasm.allocFromTypedArray(val); + capi.sqlite3_result_blob( + pCtx, + pBlob, + val.byteLength, + capi.SQLITE_WASM_DEALLOC, + ); + break; + } + + default: + toss3( + "Don't not how to handle this UDF result value:", + typeof val, + val, + ); + } + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + + capi.sqlite3_column_js = function ( + pStmt, + iCol, + throwIfCannotConvert = true, + ) { + const v = capi.sqlite3_column_value(pStmt, iCol); + return 0 === v + ? undefined + : capi.sqlite3_value_to_js(v, throwIfCannotConvert); + }; + + const __newOldValue = function (pObj, iCol, impl) { + impl = capi[impl]; + if (!this.ptr) this.ptr = wasm.allocPtr(); + else wasm.pokePtr(this.ptr, 0); + const rc = impl(pObj, iCol, this.ptr); + if (rc) + return SQLite3Error.toss( + rc, + arguments[2] + '() failed with code ' + rc, + ); + const pv = wasm.peekPtr(this.ptr); + return pv ? capi.sqlite3_value_to_js(pv, true) : undefined; + }.bind(Object.create(null)); + + capi.sqlite3_preupdate_new_js = (pDb, iCol) => + __newOldValue(pDb, iCol, 'sqlite3_preupdate_new'); + + capi.sqlite3_preupdate_old_js = (pDb, iCol) => + __newOldValue(pDb, iCol, 'sqlite3_preupdate_old'); + + capi.sqlite3changeset_new_js = (pChangesetIter, iCol) => + __newOldValue(pChangesetIter, iCol, 'sqlite3changeset_new'); + + capi.sqlite3changeset_old_js = (pChangesetIter, iCol) => + __newOldValue(pChangesetIter, iCol, 'sqlite3changeset_old'); + + const sqlite3 = { + WasmAllocError: WasmAllocError, + SQLite3Error: SQLite3Error, + capi, + util, + wasm, + config, + + version: Object.create(null), + + client: undefined, + + asyncPostInit: async function ff() { + if (ff.isReady instanceof Promise) return ff.isReady; + let lia = sqlite3ApiBootstrap.initializersAsync; + delete sqlite3ApiBootstrap.initializersAsync; + const postInit = async () => { + if (!sqlite3.__isUnderTest) { + delete sqlite3.util; + + delete sqlite3.StructBinder; + } + return sqlite3; + }; + const catcher = (e) => { + config.error('an async sqlite3 initializer failed:', e); + throw e; + }; + if (!lia || !lia.length) { + return (ff.isReady = postInit().catch(catcher)); + } + lia = lia.map((f) => { + return f instanceof Function ? async (x) => f(sqlite3) : f; + }); + lia.push(postInit); + let p = Promise.resolve(sqlite3); + while (lia.length) p = p.then(lia.shift()); + return (ff.isReady = p.catch(catcher)); + }, + + scriptInfo: undefined, + }; + try { + sqlite3ApiBootstrap.initializers.forEach((f) => { + f(sqlite3); + }); + } catch (e) { + console.error('sqlite3 bootstrap initializer threw:', e); + throw e; + } + delete sqlite3ApiBootstrap.initializers; + sqlite3ApiBootstrap.sqlite3 = sqlite3; + return sqlite3; + }; + + globalThis.sqlite3ApiBootstrap.initializers = []; + + globalThis.sqlite3ApiBootstrap.initializersAsync = []; + + globalThis.sqlite3ApiBootstrap.defaultConfig = Object.create(null); + + globalThis.sqlite3ApiBootstrap.sqlite3 = undefined; + + globalThis.WhWasmUtilInstaller = function (target) { + 'use strict'; + if (undefined === target.bigIntEnabled) { + target.bigIntEnabled = !!globalThis['BigInt64Array']; + } + + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + + if (!target.exports) { + Object.defineProperty(target, 'exports', { + enumerable: true, + configurable: true, + get: () => target.instance && target.instance.exports, + }); + } + + const ptrIR = target.pointerIR || 'i32'; + const ptrSizeof = (target.ptrSizeof = + 'i32' === ptrIR + ? 4 + : 'i64' === ptrIR + ? 8 + : toss('Unhandled ptrSizeof:', ptrIR)); + + const cache = Object.create(null); + + cache.heapSize = 0; + + cache.memory = null; + + cache.freeFuncIndexes = []; + + cache.scopedAlloc = []; + + cache.utf8Decoder = new TextDecoder(); + cache.utf8Encoder = new TextEncoder('utf-8'); + + target.sizeofIR = (n) => { + switch (n) { + 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 ptrSizeof; + default: + return ('' + n).endsWith('*') ? ptrSizeof : undefined; + } + }; + + const heapWrappers = function () { + if (!cache.memory) { + cache.memory = + target.memory instanceof WebAssembly.Memory + ? target.memory + : target.exports.memory; + } else if (cache.heapSize === cache.memory.buffer.byteLength) { + return cache; + } + + const b = cache.memory.buffer; + cache.HEAP8 = new Int8Array(b); + cache.HEAP8U = new Uint8Array(b); + cache.HEAP16 = new Int16Array(b); + cache.HEAP16U = new Uint16Array(b); + cache.HEAP32 = new Int32Array(b); + cache.HEAP32U = new Uint32Array(b); + if (target.bigIntEnabled) { + cache.HEAP64 = new BigInt64Array(b); + cache.HEAP64U = new BigUint64Array(b); + } + cache.HEAP32F = new Float32Array(b); + cache.HEAP64F = new Float64Array(b); + cache.heapSize = b.byteLength; + return cache; + }; + + target.heap8 = () => heapWrappers().HEAP8; + + target.heap8u = () => heapWrappers().HEAP8U; + + target.heap16 = () => heapWrappers().HEAP16; + + target.heap16u = () => heapWrappers().HEAP16U; + + target.heap32 = () => heapWrappers().HEAP32; + + target.heap32u = () => heapWrappers().HEAP32U; + + target.heapForSize = function (n, unsigned = true) { + let ctor; + const c = + cache.memory && cache.heapSize === cache.memory.buffer.byteLength + ? cache + : heapWrappers(); + switch (n) { + case Int8Array: + return c.HEAP8; + case Uint8Array: + return c.HEAP8U; + case Int16Array: + return c.HEAP16; + case Uint16Array: + return c.HEAP16U; + case Int32Array: + return c.HEAP32; + case Uint32Array: + return c.HEAP32U; + case 8: + return unsigned ? c.HEAP8U : c.HEAP8; + case 16: + return unsigned ? c.HEAP16U : c.HEAP16; + case 32: + return unsigned ? c.HEAP32U : c.HEAP32; + case 64: + if (c.HEAP64) return unsigned ? c.HEAP64U : c.HEAP64; + break; + default: + if (target.bigIntEnabled) { + if (n === globalThis['BigUint64Array']) return c.HEAP64U; + else if (n === globalThis['BigInt64Array']) return c.HEAP64; + break; + } + } + toss( + 'Invalid heapForSize() size: expecting 8, 16, 32,', + 'or (if BigInt is enabled) 64.', + ); + }; + + target.functionTable = function () { + return target.exports.__indirect_function_table; + }; + + target.functionEntry = function (fptr) { + const ft = target.functionTable(); + return fptr < ft.length ? ft.get(fptr) : undefined; + }; + + target.jsFuncToWasm = function f(func, sig) { + if (!f._) { + f._ = { + 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: 0x7c, + f32: 0x7d, + i64: 0x7e, + i32: 0x7f, + }), + + uleb128Encode: function (tgt, method, n) { + if (n < 128) tgt[method](n); + else tgt[method](n % 128 | 128, n >> 7); + }, + + rxJSig: /^(\w)\((\w*)\)$/, + + sigParams: function (sig) { + const m = f._.rxJSig.exec(sig); + return m ? m[2] : sig.substr(1); + }, + + letterType: (x) => + f._.sigTypes[x] || toss('Invalid signature letter:', x), + + pushSigType: (dest, letter) => + dest.push(f._.typeCodes[f._.letterType(letter)]), + }; + } + if ('string' === typeof func) { + const x = sig; + sig = func; + func = x; + } + const sigParams = f._.sigParams(sig); + const wasmCode = [0x01, 0x60]; + f._.uleb128Encode(wasmCode, 'push', sigParams.length); + for (const x of sigParams) f._.pushSigType(wasmCode, x); + if ('v' === sig[0]) wasmCode.push(0); + else { + wasmCode.push(1); + f._.pushSigType(wasmCode, sig[0]); + } + f._.uleb128Encode(wasmCode, 'unshift', wasmCode.length); + wasmCode.unshift( + 0x00, + 0x61, + 0x73, + 0x6d, + 0x01, + 0x00, + 0x00, + 0x00, + 0x01, + ); + wasmCode.push( + 0x02, + 0x07, + + 0x01, + 0x01, + 0x65, + 0x01, + 0x66, + 0x00, + 0x00, + 0x07, + 0x05, + + 0x01, + 0x01, + 0x66, + 0x00, + 0x00, + ); + return new WebAssembly.Instance( + new WebAssembly.Module(new Uint8Array(wasmCode)), + { + e: { f: func }, + }, + ).exports['f']; + }; + + const __installFunction = function f(func, sig, scoped) { + if (scoped && !cache.scopedAlloc.length) { + toss('No scopedAllocPush() scope is active.'); + } + if ('string' === typeof func) { + const x = sig; + sig = func; + func = x; + } + if ('string' !== typeof sig || !(func instanceof Function)) { + toss( + 'Invalid arguments: expecting (function,signature) ' + + 'or (signature,function).', + ); + } + const ft = target.functionTable(); + const oldLen = ft.length; + let ptr; + while (cache.freeFuncIndexes.length) { + ptr = cache.freeFuncIndexes.pop(); + if (ft.get(ptr)) { + ptr = null; + continue; + } else { + break; + } + } + if (!ptr) { + ptr = oldLen; + ft.grow(1); + } + try { + ft.set(ptr, func); + if (scoped) { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(ptr); + } + return ptr; + } catch (e) { + if (!(e instanceof TypeError)) { + if (ptr === oldLen) cache.freeFuncIndexes.push(oldLen); + throw e; + } + } + + try { + const fptr = target.jsFuncToWasm(func, sig); + ft.set(ptr, fptr); + if (scoped) { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(ptr); + } + } catch (e) { + if (ptr === oldLen) cache.freeFuncIndexes.push(oldLen); + throw e; + } + return ptr; + }; + + target.installFunction = (func, sig) => + __installFunction(func, sig, false); + + target.scopedInstallFunction = (func, sig) => + __installFunction(func, sig, true); + + target.uninstallFunction = function (ptr) { + if (!ptr && 0 !== ptr) return undefined; + const fi = cache.freeFuncIndexes; + const ft = target.functionTable(); + fi.push(ptr); + const rc = ft.get(ptr); + ft.set(ptr, null); + return rc; + }; + + target.peek = function f(ptr, type = 'i8') { + if (type.endsWith('*')) type = ptrIR; + const c = + cache.memory && cache.heapSize === cache.memory.buffer.byteLength + ? cache + : heapWrappers(); + const list = Array.isArray(ptr) ? [] : undefined; + let rc; + do { + if (list) ptr = arguments[0].shift(); + switch (type) { + case 'i1': + case 'i8': + rc = c.HEAP8[ptr >> 0]; + break; + case 'i16': + rc = c.HEAP16[ptr >> 1]; + break; + case 'i32': + rc = c.HEAP32[ptr >> 2]; + break; + case 'float': + case 'f32': + rc = c.HEAP32F[ptr >> 2]; + break; + case 'double': + case 'f64': + rc = Number(c.HEAP64F[ptr >> 3]); + break; + case 'i64': + if (target.bigIntEnabled) { + rc = BigInt(c.HEAP64[ptr >> 3]); + break; + } + + default: + toss('Invalid type for peek():', type); + } + if (list) list.push(rc); + } while (list && arguments[0].length); + return list || rc; + }; + + target.poke = function (ptr, value, type = 'i8') { + if (type.endsWith('*')) type = ptrIR; + const c = + cache.memory && cache.heapSize === cache.memory.buffer.byteLength + ? cache + : heapWrappers(); + for (const p of Array.isArray(ptr) ? ptr : [ptr]) { + switch (type) { + case 'i1': + case 'i8': + c.HEAP8[p >> 0] = value; + continue; + case 'i16': + c.HEAP16[p >> 1] = value; + continue; + case 'i32': + c.HEAP32[p >> 2] = value; + continue; + case 'float': + case 'f32': + c.HEAP32F[p >> 2] = value; + continue; + case 'double': + case 'f64': + c.HEAP64F[p >> 3] = value; + continue; + case 'i64': + if (c.HEAP64) { + c.HEAP64[p >> 3] = BigInt(value); + continue; + } + + default: + toss('Invalid type for poke(): ' + type); + } + } + return this; + }; + + target.peekPtr = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, ptrIR); + + target.pokePtr = (ptr, value = 0) => target.poke(ptr, value, ptrIR); + + target.peek8 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i8'); + + target.poke8 = (ptr, value) => target.poke(ptr, value, 'i8'); + + target.peek16 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i16'); + + target.poke16 = (ptr, value) => target.poke(ptr, value, 'i16'); + + target.peek32 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i32'); + + target.poke32 = (ptr, value) => target.poke(ptr, value, 'i32'); + + target.peek64 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i64'); + + target.poke64 = (ptr, value) => target.poke(ptr, value, 'i64'); + + target.peek32f = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'f32'); + + target.poke32f = (ptr, value) => target.poke(ptr, value, 'f32'); + + target.peek64f = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'f64'); + + target.poke64f = (ptr, value) => target.poke(ptr, value, 'f64'); + + target.getMemValue = target.peek; + + target.getPtrValue = target.peekPtr; + + target.setMemValue = target.poke; + + target.setPtrValue = target.pokePtr; + + target.isPtr32 = (ptr) => + 'number' === typeof ptr && ptr === (ptr | 0) && ptr >= 0; + + target.isPtr = target.isPtr32; + + target.cstrlen = function (ptr) { + if (!ptr || !target.isPtr(ptr)) return null; + const h = heapWrappers().HEAP8U; + let pos = ptr; + for (; h[pos] !== 0; ++pos) {} + return pos - ptr; + }; + + const __SAB = + 'undefined' === typeof SharedArrayBuffer + ? function () {} + : SharedArrayBuffer; + const __utf8Decode = function (arrayBuffer, begin, end) { + return cache.utf8Decoder.decode( + arrayBuffer.buffer instanceof __SAB + ? arrayBuffer.slice(begin, end) + : arrayBuffer.subarray(begin, end), + ); + }; + + target.cstrToJs = function (ptr) { + const n = target.cstrlen(ptr); + return n + ? __utf8Decode(heapWrappers().HEAP8U, ptr, ptr + n) + : null === n + ? n + : ''; + }; + + target.jstrlen = function (str) { + if ('string' !== typeof str) return null; + const n = str.length; + let len = 0; + for (let i = 0; i < n; ++i) { + let u = str.charCodeAt(i); + if (u >= 0xd800 && u <= 0xdfff) { + u = + (0x10000 + ((u & 0x3ff) << 10)) | (str.charCodeAt(++i) & 0x3ff); + } + if (u <= 0x7f) ++len; + else if (u <= 0x7ff) len += 2; + else if (u <= 0xffff) len += 3; + else len += 4; + } + return len; + }; + + target.jstrcpy = function ( + jstr, + tgt, + offset = 0, + maxBytes = -1, + addNul = true, + ) { + if ( + !tgt || + (!(tgt instanceof Int8Array) && !(tgt instanceof Uint8Array)) + ) { + toss('jstrcpy() target must be an Int8Array or Uint8Array.'); + } + if (maxBytes < 0) maxBytes = tgt.length - offset; + if (!(maxBytes > 0) || !(offset >= 0)) return 0; + let i = 0, + max = jstr.length; + const begin = offset, + end = offset + maxBytes - (addNul ? 1 : 0); + for (; i < max && offset < end; ++i) { + let u = jstr.charCodeAt(i); + if (u >= 0xd800 && u <= 0xdfff) { + u = + (0x10000 + ((u & 0x3ff) << 10)) | + (jstr.charCodeAt(++i) & 0x3ff); + } + if (u <= 0x7f) { + if (offset >= end) break; + tgt[offset++] = u; + } else if (u <= 0x7ff) { + if (offset + 1 >= end) break; + tgt[offset++] = 0xc0 | (u >> 6); + tgt[offset++] = 0x80 | (u & 0x3f); + } else if (u <= 0xffff) { + if (offset + 2 >= end) break; + tgt[offset++] = 0xe0 | (u >> 12); + tgt[offset++] = 0x80 | ((u >> 6) & 0x3f); + tgt[offset++] = 0x80 | (u & 0x3f); + } else { + if (offset + 3 >= end) break; + tgt[offset++] = 0xf0 | (u >> 18); + tgt[offset++] = 0x80 | ((u >> 12) & 0x3f); + tgt[offset++] = 0x80 | ((u >> 6) & 0x3f); + tgt[offset++] = 0x80 | (u & 0x3f); + } + } + if (addNul) tgt[offset++] = 0; + return offset - begin; + }; + + target.cstrncpy = function (tgtPtr, srcPtr, n) { + if (!tgtPtr || !srcPtr) + toss('cstrncpy() does not accept NULL strings.'); + if (n < 0) n = target.cstrlen(strPtr) + 1; + else if (!(n > 0)) return 0; + const heap = target.heap8u(); + let i = 0, + ch; + for (; i < n && (ch = heap[srcPtr + i]); ++i) { + heap[tgtPtr + i] = ch; + } + if (i < n) heap[tgtPtr + i++] = 0; + return i; + }; + + target.jstrToUintArray = (str, addNul = false) => { + return cache.utf8Encoder.encode(addNul ? str + '\0' : str); + }; + + const __affirmAlloc = (obj, funcName) => { + if ( + !(obj.alloc instanceof Function) || + !(obj.dealloc instanceof Function) + ) { + toss( + 'Object is missing alloc() and/or dealloc() function(s)', + 'required by', + funcName + '().', + ); + } + }; + + const __allocCStr = function ( + jstr, + returnWithLength, + allocator, + funcName, + ) { + __affirmAlloc(target, funcName); + if ('string' !== typeof jstr) return null; + if (0) { + const n = target.jstrlen(jstr), + ptr = allocator(n + 1); + target.jstrcpy(jstr, target.heap8u(), ptr, n + 1, true); + return returnWithLength ? [ptr, n] : ptr; + } else { + const u = cache.utf8Encoder.encode(jstr), + ptr = allocator(u.length + 1), + heap = heapWrappers().HEAP8U; + heap.set(u, ptr); + heap[ptr + u.length] = 0; + return returnWithLength ? [ptr, u.length] : ptr; + } + }; + + target.allocCString = (jstr, returnWithLength = false) => + __allocCStr(jstr, returnWithLength, target.alloc, 'allocCString()'); + + target.scopedAllocPush = function () { + __affirmAlloc(target, 'scopedAllocPush'); + const a = []; + cache.scopedAlloc.push(a); + return a; + }; + + target.scopedAllocPop = function (state) { + __affirmAlloc(target, 'scopedAllocPop'); + const n = arguments.length + ? cache.scopedAlloc.indexOf(state) + : cache.scopedAlloc.length - 1; + if (n < 0) toss('Invalid state object for scopedAllocPop().'); + if (0 === arguments.length) state = cache.scopedAlloc[n]; + cache.scopedAlloc.splice(n, 1); + for (let p; (p = state.pop()); ) { + if (target.functionEntry(p)) { + target.uninstallFunction(p); + } else target.dealloc(p); + } + }; + + target.scopedAlloc = function (n) { + if (!cache.scopedAlloc.length) { + toss('No scopedAllocPush() scope is active.'); + } + const p = target.alloc(n); + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(p); + return p; + }; + + Object.defineProperty(target.scopedAlloc, 'level', { + configurable: false, + enumerable: false, + get: () => cache.scopedAlloc.length, + set: () => toss("The 'active' property is read-only."), + }); + + target.scopedAllocCString = (jstr, returnWithLength = false) => + __allocCStr( + jstr, + returnWithLength, + target.scopedAlloc, + 'scopedAllocCString()', + ); + + const __allocMainArgv = function (isScoped, list) { + const pList = target[isScoped ? 'scopedAlloc' : 'alloc']( + (list.length + 1) * target.ptrSizeof, + ); + let i = 0; + list.forEach((e) => { + target.pokePtr( + pList + target.ptrSizeof * i++, + target[isScoped ? 'scopedAllocCString' : 'allocCString']('' + e), + ); + }); + target.pokePtr(pList + target.ptrSizeof * i, 0); + return pList; + }; + + target.scopedAllocMainArgv = (list) => __allocMainArgv(true, list); + + target.allocMainArgv = (list) => __allocMainArgv(false, list); + + target.cArgvToJs = (argc, pArgv) => { + const list = []; + for (let i = 0; i < argc; ++i) { + const arg = target.peekPtr(pArgv + target.ptrSizeof * i); + list.push(arg ? target.cstrToJs(arg) : null); + } + return list; + }; + + target.scopedAllocCall = function (func) { + target.scopedAllocPush(); + try { + return func(); + } finally { + target.scopedAllocPop(); + } + }; + + const __allocPtr = function (howMany, safePtrSize, method) { + __affirmAlloc(target, method); + const pIr = safePtrSize ? 'i64' : ptrIR; + let m = target[method](howMany * (safePtrSize ? 8 : ptrSizeof)); + target.poke(m, 0, pIr); + if (1 === howMany) { + return m; + } + const a = [m]; + for (let i = 1; i < howMany; ++i) { + m += safePtrSize ? 8 : ptrSizeof; + a[i] = m; + target.poke(m, 0, pIr); + } + return a; + }; + + target.allocPtr = (howMany = 1, safePtrSize = true) => + __allocPtr(howMany, safePtrSize, 'alloc'); + + target.scopedAllocPtr = (howMany = 1, safePtrSize = true) => + __allocPtr(howMany, safePtrSize, 'scopedAlloc'); + + target.xGet = function (name) { + return ( + target.exports[name] || toss('Cannot find exported symbol:', name) + ); + }; + + const __argcMismatch = (f, n) => + toss(f + '() requires', n, 'argument(s).'); + + target.xCall = function (fname, ...args) { + const f = fname instanceof Function ? fname : target.xGet(fname); + if (!(f instanceof Function)) + toss('Exported symbol', fname, 'is not a function.'); + if (f.length !== args.length) + __argcMismatch(f === fname ? f.name : fname, f.length); + return 2 === arguments.length && Array.isArray(arguments[1]) + ? f.apply(null, arguments[1]) + : f.apply(null, args); + }; + + cache.xWrap = Object.create(null); + cache.xWrap.convert = Object.create(null); + + cache.xWrap.convert.arg = new Map(); + + cache.xWrap.convert.result = new Map(); + const xArg = cache.xWrap.convert.arg, + xResult = cache.xWrap.convert.result; + + if (target.bigIntEnabled) { + xArg.set('i64', (i) => BigInt(i)); + } + const __xArgPtr = + 'i32' === ptrIR ? (i) => i | 0 : (i) => BigInt(i) | BigInt(0); + xArg + .set('i32', __xArgPtr) + .set('i16', (i) => (i | 0) & 0xffff) + .set('i8', (i) => (i | 0) & 0xff) + .set('f32', (i) => Number(i).valueOf()) + .set('float', xArg.get('f32')) + .set('f64', xArg.get('f32')) + .set('double', xArg.get('f64')) + .set('int', xArg.get('i32')) + .set('null', (i) => i) + .set(null, xArg.get('null')) + .set('**', __xArgPtr) + .set('*', __xArgPtr); + xResult + .set('*', __xArgPtr) + .set('pointer', __xArgPtr) + .set('number', (v) => Number(v)) + .set('void', (v) => undefined) + .set('null', (v) => v) + .set(null, xResult.get('null')); + + { + const copyToResult = [ + 'i8', + 'i16', + 'i32', + 'int', + 'f32', + 'float', + 'f64', + 'double', + ]; + if (target.bigIntEnabled) copyToResult.push('i64'); + const adaptPtr = xArg.get(ptrIR); + for (const t of copyToResult) { + xArg.set(t + '*', adaptPtr); + xResult.set(t + '*', adaptPtr); + xResult.set(t, xArg.get(t) || toss('Missing arg converter:', t)); + } + } + + const __xArgString = function (v) { + if ('string' === typeof v) return target.scopedAllocCString(v); + return v ? __xArgPtr(v) : null; + }; + xArg + .set('string', __xArgString) + .set('utf8', __xArgString) + .set('pointer', __xArgString); + + xResult + .set('string', (i) => target.cstrToJs(i)) + .set('utf8', xResult.get('string')) + .set('string:dealloc', (i) => { + try { + return i ? target.cstrToJs(i) : null; + } finally { + target.dealloc(i); + } + }) + .set('utf8:dealloc', xResult.get('string:dealloc')) + .set('json', (i) => JSON.parse(target.cstrToJs(i))) + .set('json:dealloc', (i) => { + try { + return i ? JSON.parse(target.cstrToJs(i)) : null; + } finally { + target.dealloc(i); + } + }); + + const AbstractArgAdapter = class { + constructor(opt) { + this.name = opt.name || 'unnamed adapter'; + } + + convertArg(v, argv, argIndex) { + toss('AbstractArgAdapter must be subclassed.'); + } + }; + + xArg.FuncPtrAdapter = class FuncPtrAdapter extends AbstractArgAdapter { + constructor(opt) { + super(opt); + if (xArg.FuncPtrAdapter.warnOnUse) { + console.warn( + 'xArg.FuncPtrAdapter is an internal-only API', + 'and is not intended to be invoked from', + 'client-level code. Invoked with:', + opt, + ); + } + this.name = opt.name || 'unnamed'; + this.signature = opt.signature; + if (opt.contextKey instanceof Function) { + this.contextKey = opt.contextKey; + if (!opt.bindScope) opt.bindScope = 'context'; + } + this.bindScope = + opt.bindScope || + toss( + 'FuncPtrAdapter options requires a bindScope (explicit or implied).', + ); + if (FuncPtrAdapter.bindScopes.indexOf(opt.bindScope) < 0) { + toss( + 'Invalid options.bindScope (' + + opt.bindMod + + ') for FuncPtrAdapter. ' + + 'Expecting one of: (' + + FuncPtrAdapter.bindScopes.join(', ') + + ')', + ); + } + this.isTransient = 'transient' === this.bindScope; + this.isContext = 'context' === this.bindScope; + this.isPermanent = 'permanent' === this.bindScope; + this.singleton = 'singleton' === this.bindScope ? [] : undefined; + + this.callProxy = + opt.callProxy instanceof Function ? opt.callProxy : undefined; + } + + contextKey(argv, argIndex) { + return this; + } + + contextMap(key) { + const cm = this.__cmap || (this.__cmap = new Map()); + let rc = cm.get(key); + if (undefined === rc) cm.set(key, (rc = [])); + return rc; + } + + convertArg(v, argv, argIndex) { + let pair = this.singleton; + if (!pair && this.isContext) { + pair = this.contextMap(this.contextKey(argv, argIndex)); + } + if (pair && pair[0] === v) return pair[1]; + if (v instanceof Function) { + if (this.callProxy) v = this.callProxy(v); + const fp = __installFunction(v, this.signature, this.isTransient); + if (FuncPtrAdapter.debugFuncInstall) { + FuncPtrAdapter.debugOut( + 'FuncPtrAdapter installed', + this, + this.contextKey(argv, argIndex), + '@' + fp, + v, + ); + } + if (pair) { + if (pair[1]) { + if (FuncPtrAdapter.debugFuncInstall) { + FuncPtrAdapter.debugOut( + 'FuncPtrAdapter uninstalling', + this, + this.contextKey(argv, argIndex), + '@' + pair[1], + v, + ); + } + try { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push( + pair[1], + ); + } catch (e) {} + } + pair[0] = v; + pair[1] = fp; + } + return fp; + } else if (target.isPtr(v) || null === v || undefined === v) { + if (pair && pair[1] && pair[1] !== v) { + if (FuncPtrAdapter.debugFuncInstall) { + FuncPtrAdapter.debugOut( + 'FuncPtrAdapter uninstalling', + this, + this.contextKey(argv, argIndex), + '@' + pair[1], + v, + ); + } + try { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(pair[1]); + } catch (e) {} + pair[0] = pair[1] = v | 0; + } + return v || 0; + } else { + throw new TypeError( + 'Invalid FuncPtrAdapter argument type. ' + + 'Expecting a function pointer or a ' + + (this.name ? this.name + ' ' : '') + + 'function matching signature ' + + this.signature + + '.', + ); + } + } + }; + + xArg.FuncPtrAdapter.warnOnUse = false; + + xArg.FuncPtrAdapter.debugFuncInstall = false; + + xArg.FuncPtrAdapter.debugOut = console.debug.bind(console); + + xArg.FuncPtrAdapter.bindScopes = [ + 'transient', + 'context', + 'singleton', + 'permanent', + ]; + + const __xArgAdapterCheck = (t) => + xArg.get(t) || toss('Argument adapter not found:', t); + + const __xResultAdapterCheck = (t) => + xResult.get(t) || toss('Result adapter not found:', t); + + cache.xWrap.convertArg = (t, ...args) => __xArgAdapterCheck(t)(...args); + + cache.xWrap.convertArgNoCheck = (t, ...args) => xArg.get(t)(...args); + + cache.xWrap.convertResult = (t, v) => + null === t ? v : t ? __xResultAdapterCheck(t)(v) : undefined; + + cache.xWrap.convertResultNoCheck = (t, v) => + null === t ? v : t ? xResult.get(t)(v) : undefined; + + target.xWrap = function (fArg, resultType, ...argTypes) { + if (3 === arguments.length && Array.isArray(arguments[2])) { + argTypes = arguments[2]; + } + if (target.isPtr(fArg)) { + fArg = + target.functionEntry(fArg) || + toss('Function pointer not found in WASM function table.'); + } + const fIsFunc = fArg instanceof Function; + const xf = fIsFunc ? fArg : target.xGet(fArg); + if (fIsFunc) fArg = xf.name || 'unnamed function'; + if (argTypes.length !== xf.length) __argcMismatch(fArg, xf.length); + if (null === resultType && 0 === xf.length) { + return xf; + } + if (undefined !== resultType && null !== resultType) + __xResultAdapterCheck(resultType); + for (const t of argTypes) { + if (t instanceof AbstractArgAdapter) + xArg.set(t, (...args) => t.convertArg(...args)); + else __xArgAdapterCheck(t); + } + const cxw = cache.xWrap; + if (0 === xf.length) { + return (...args) => + args.length + ? __argcMismatch(fArg, xf.length) + : cxw.convertResult(resultType, xf.call(null)); + } + return function (...args) { + if (args.length !== xf.length) __argcMismatch(fArg, xf.length); + const scope = target.scopedAllocPush(); + try { + let i = 0; + for (; i < args.length; ++i) + args[i] = cxw.convertArgNoCheck(argTypes[i], args[i], args, i); + return cxw.convertResultNoCheck(resultType, xf.apply(null, args)); + } finally { + target.scopedAllocPop(scope); + } + }; + }; + + const __xAdapter = function ( + func, + argc, + typeName, + adapter, + modeName, + xcvPart, + ) { + if ('string' === typeof typeName) { + if (1 === argc) return xcvPart.get(typeName); + else if (2 === argc) { + if (!adapter) { + xcvPart.delete(typeName); + return func; + } else if (!(adapter instanceof Function)) { + toss(modeName, 'requires a function argument.'); + } + xcvPart.set(typeName, adapter); + return func; + } + } + toss('Invalid arguments to', modeName); + }; + + target.xWrap.resultAdapter = function f(typeName, adapter) { + return __xAdapter( + f, + arguments.length, + typeName, + adapter, + 'resultAdapter()', + xResult, + ); + }; + + target.xWrap.argAdapter = function f(typeName, adapter) { + return __xAdapter( + f, + arguments.length, + typeName, + adapter, + 'argAdapter()', + xArg, + ); + }; + + target.xWrap.FuncPtrAdapter = xArg.FuncPtrAdapter; + + target.xCallWrapped = function (fArg, resultType, argTypes, ...args) { + if (Array.isArray(arguments[3])) args = arguments[3]; + return target + .xWrap(fArg, resultType, argTypes || []) + .apply(null, args || []); + }; + + target.xWrap.testConvertArg = cache.xWrap.convertArg; + + target.xWrap.testConvertResult = cache.xWrap.convertResult; + + return target; + }; + + globalThis.WhWasmUtilInstaller.yawl = function (config) { + const wfetch = () => fetch(config.uri, { credentials: 'same-origin' }); + const wui = this; + const finalThen = function (arg) { + if (config.wasmUtilTarget) { + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + const tgt = config.wasmUtilTarget; + tgt.module = arg.module; + tgt.instance = arg.instance; + + if (!tgt.instance.exports.memory) { + tgt.memory = + (config.imports && + config.imports.env && + config.imports.env.memory) || + toss("Missing 'memory' object!"); + } + if (!tgt.alloc && arg.instance.exports.malloc) { + const exports = arg.instance.exports; + tgt.alloc = function (n) { + return ( + exports.malloc(n) || toss('Allocation of', n, 'bytes failed.') + ); + }; + tgt.dealloc = function (m) { + exports.free(m); + }; + } + wui(tgt); + } + if (config.onload) config.onload(arg, config); + return arg; + }; + const loadWasm = WebAssembly.instantiateStreaming + ? function loadWasmStreaming() { + return WebAssembly.instantiateStreaming( + wfetch(), + config.imports || {}, + ).then(finalThen); + } + : function loadWasmOldSchool() { + return wfetch() + .then((response) => response.arrayBuffer()) + .then((bytes) => + WebAssembly.instantiate(bytes, config.imports || {}), + ) + .then(finalThen); + }; + return loadWasm; + }.bind(globalThis.WhWasmUtilInstaller); + + ('use strict'); + globalThis.Jaccwabyt = function StructBinderFactory(config) { + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + + if ( + !(config.heap instanceof WebAssembly.Memory) && + !(config.heap instanceof Function) + ) { + toss( + 'config.heap must be WebAssembly.Memory instance or a function.', + ); + } + ['alloc', 'dealloc'].forEach(function (k) { + config[k] instanceof Function || + toss("Config option '" + k + "' must be a function."); + }); + const SBF = StructBinderFactory; + const heap = + config.heap instanceof Function + ? config.heap + : () => new Uint8Array(config.heap.buffer), + alloc = config.alloc, + dealloc = config.dealloc, + log = config.log || console.log.bind(console), + memberPrefix = config.memberPrefix || '', + memberSuffix = config.memberSuffix || '', + bigIntEnabled = + undefined === config.bigIntEnabled + ? !!globalThis['BigInt64Array'] + : !!config.bigIntEnabled, + BigInt = globalThis['BigInt'], + BigInt64Array = globalThis['BigInt64Array'], + ptrSizeof = config.ptrSizeof || 4, + ptrIR = config.ptrIR || 'i32'; + if (!SBF.debugFlags) { + SBF.__makeDebugFlags = function (deriveFrom = null) { + if (deriveFrom && deriveFrom.__flags) + deriveFrom = deriveFrom.__flags; + const f = function f(flags) { + if (0 === arguments.length) { + return f.__flags; + } + if (flags < 0) { + delete f.__flags.getter; + delete f.__flags.setter; + delete f.__flags.alloc; + delete f.__flags.dealloc; + } else { + f.__flags.getter = 0 !== (0x01 & flags); + f.__flags.setter = 0 !== (0x02 & flags); + f.__flags.alloc = 0 !== (0x04 & flags); + f.__flags.dealloc = 0 !== (0x08 & flags); + } + return f._flags; + }; + Object.defineProperty(f, '__flags', { + iterable: false, + writable: false, + value: Object.create(deriveFrom), + }); + if (!deriveFrom) f(0); + return f; + }; + SBF.debugFlags = SBF.__makeDebugFlags(); + } + + const isLittleEndian = (function () { + const buffer = new ArrayBuffer(2); + new DataView(buffer).setInt16(0, 256, true); + + return new Int16Array(buffer)[0] === 256; + })(); + + const isFuncSig = (s) => '(' === s[1]; + + const isPtrSig = (s) => 'p' === s || 'P' === s; + const isAutoPtrSig = (s) => 'P' === s; + const sigLetter = (s) => (isFuncSig(s) ? 'p' : s[0]); + + const sigIR = function (s) { + switch (sigLetter(s)) { + case 'c': + case 'C': + return 'i8'; + case 'i': + return 'i32'; + case 'p': + case 'P': + case 's': + return ptrIR; + case 'j': + return 'i64'; + case 'f': + return 'float'; + case 'd': + return 'double'; + } + toss('Unhandled signature IR:', s); + }; + + const affirmBigIntArray = BigInt64Array + ? () => true + : () => toss('BigInt64Array is not available.'); + + const sigDVGetter = function (s) { + switch (sigLetter(s)) { + case 'p': + case 'P': + case 's': { + switch (ptrSizeof) { + case 4: + return 'getInt32'; + case 8: + return affirmBigIntArray() && 'getBigInt64'; + } + break; + } + case 'i': + return 'getInt32'; + case 'c': + return 'getInt8'; + case 'C': + return 'getUint8'; + case 'j': + return affirmBigIntArray() && 'getBigInt64'; + case 'f': + return 'getFloat32'; + case 'd': + return 'getFloat64'; + } + toss('Unhandled DataView getter for signature:', s); + }; + + const sigDVSetter = function (s) { + switch (sigLetter(s)) { + case 'p': + case 'P': + case 's': { + switch (ptrSizeof) { + case 4: + return 'setInt32'; + case 8: + return affirmBigIntArray() && 'setBigInt64'; + } + break; + } + case 'i': + return 'setInt32'; + case 'c': + return 'setInt8'; + case 'C': + return 'setUint8'; + case 'j': + return affirmBigIntArray() && 'setBigInt64'; + case 'f': + return 'setFloat32'; + case 'd': + return 'setFloat64'; + } + toss('Unhandled DataView setter for signature:', s); + }; + + const sigDVSetWrapper = function (s) { + switch (sigLetter(s)) { + case 'i': + case 'f': + case 'c': + case 'C': + case 'd': + return Number; + case 'j': + return affirmBigIntArray() && BigInt; + case 'p': + case 'P': + case 's': + switch (ptrSizeof) { + case 4: + return Number; + case 8: + return affirmBigIntArray() && BigInt; + } + break; + } + toss('Unhandled DataView set wrapper for signature:', s); + }; + + const sPropName = (s, k) => s + '::' + k; + + const __propThrowOnSet = function (structName, propName) { + return () => toss(sPropName(structName, propName), 'is read-only.'); + }; + + const __instancePointerMap = new WeakMap(); + + const xPtrPropName = '(pointer-is-external)'; + + const __freeStruct = function (ctor, obj, m) { + if (!m) m = __instancePointerMap.get(obj); + if (m) { + __instancePointerMap.delete(obj); + if (Array.isArray(obj.ondispose)) { + let x; + while ((x = obj.ondispose.shift())) { + try { + if (x instanceof Function) x.call(obj); + else if (x instanceof StructType) x.dispose(); + else if ('number' === typeof x) dealloc(x); + } catch (e) { + console.warn( + 'ondispose() for', + ctor.structName, + '@', + m, + 'threw. NOT propagating it.', + e, + ); + } + } + } else if (obj.ondispose instanceof Function) { + try { + obj.ondispose(); + } catch (e) { + console.warn( + 'ondispose() for', + ctor.structName, + '@', + m, + 'threw. NOT propagating it.', + e, + ); + } + } + delete obj.ondispose; + if (ctor.debugFlags.__flags.dealloc) { + log( + 'debug.dealloc:', + obj[xPtrPropName] ? 'EXTERNAL' : '', + ctor.structName, + 'instance:', + ctor.structInfo.sizeof, + 'bytes @' + m, + ); + } + if (!obj[xPtrPropName]) dealloc(m); + } + }; + + const rop = (v) => { + return { + configurable: false, + writable: false, + iterable: false, + value: v, + }; + }; + + const __allocStruct = function (ctor, obj, m) { + let fill = !m; + if (m) Object.defineProperty(obj, xPtrPropName, rop(m)); + else { + m = alloc(ctor.structInfo.sizeof); + if (!m) toss('Allocation of', ctor.structName, 'structure failed.'); + } + try { + if (ctor.debugFlags.__flags.alloc) { + log( + 'debug.alloc:', + fill ? '' : 'EXTERNAL', + ctor.structName, + 'instance:', + ctor.structInfo.sizeof, + 'bytes @' + m, + ); + } + if (fill) heap().fill(0, m, m + ctor.structInfo.sizeof); + __instancePointerMap.set(obj, m); + } catch (e) { + __freeStruct(ctor, obj, m); + throw e; + } + }; + + const __memoryDump = function () { + const p = this.pointer; + return p + ? new Uint8Array(heap().slice(p, p + this.structInfo.sizeof)) + : null; + }; + + const __memberKey = (k) => memberPrefix + k + memberSuffix; + const __memberKeyProp = rop(__memberKey); + + const __lookupMember = function ( + structInfo, + memberName, + tossIfNotFound = true, + ) { + let m = structInfo.members[memberName]; + if (!m && (memberPrefix || memberSuffix)) { + for (const v of Object.values(structInfo.members)) { + if (v.key === memberName) { + m = v; + break; + } + } + if (!m && tossIfNotFound) { + toss( + sPropName(structInfo.name, memberName), + 'is not a mapped struct member.', + ); + } + } + return m; + }; + + const __memberSignature = function f( + obj, + memberName, + emscriptenFormat = false, + ) { + if (!f._) + f._ = (x) => + x.replace(/[^vipPsjrdcC]/g, '').replace(/[pPscC]/g, 'i'); + const m = __lookupMember(obj.structInfo, memberName, true); + return emscriptenFormat ? f._(m.signature) : m.signature; + }; + + const __ptrPropDescriptor = { + configurable: false, + enumerable: false, + get: function () { + return __instancePointerMap.get(this); + }, + set: () => toss("Cannot assign the 'pointer' property of a struct."), + }; + + const __structMemberKeys = rop(function () { + const a = []; + for (const k of Object.keys(this.structInfo.members)) { + a.push(this.memberKey(k)); + } + return a; + }); + + const __utf8Decoder = new TextDecoder('utf-8'); + const __utf8Encoder = new TextEncoder(); + + const __SAB = + 'undefined' === typeof SharedArrayBuffer + ? function () {} + : SharedArrayBuffer; + const __utf8Decode = function (arrayBuffer, begin, end) { + return __utf8Decoder.decode( + arrayBuffer.buffer instanceof __SAB + ? arrayBuffer.slice(begin, end) + : arrayBuffer.subarray(begin, end), + ); + }; + + const __memberIsString = function ( + obj, + memberName, + tossIfNotFound = false, + ) { + const m = __lookupMember(obj.structInfo, memberName, tossIfNotFound); + return m && 1 === m.signature.length && 's' === m.signature[0] + ? m + : false; + }; + + const __affirmCStringSignature = function (member) { + if ('s' === member.signature) return; + toss( + 'Invalid member type signature for C-string value:', + JSON.stringify(member), + ); + }; + + const __memberToJsString = function f(obj, memberName) { + const m = __lookupMember(obj.structInfo, memberName, true); + __affirmCStringSignature(m); + const addr = obj[m.key]; + + if (!addr) return null; + let pos = addr; + const mem = heap(); + for (; mem[pos] !== 0; ++pos) {} + + return addr === pos ? '' : __utf8Decode(mem, addr, pos); + }; + + const __addOnDispose = function (obj, ...v) { + if (obj.ondispose) { + if (!Array.isArray(obj.ondispose)) { + obj.ondispose = [obj.ondispose]; + } + } else { + obj.ondispose = []; + } + obj.ondispose.push(...v); + }; + + const __allocCString = function (str) { + const u = __utf8Encoder.encode(str); + const mem = alloc(u.length + 1); + if (!mem) toss('Allocation error while duplicating string:', str); + const h = heap(); + + h.set(u, mem); + h[mem + u.length] = 0; + + return mem; + }; + + const __setMemberCString = function (obj, memberName, str) { + const m = __lookupMember(obj.structInfo, memberName, true); + __affirmCStringSignature(m); + + const mem = __allocCString(str); + obj[m.key] = mem; + __addOnDispose(obj, mem); + return obj; + }; + + const StructType = function ctor(structName, structInfo) { + if (arguments[2] !== rop) { + toss( + 'Do not call the StructType constructor', + 'from client-level code.', + ); + } + Object.defineProperties(this, { + structName: rop(structName), + structInfo: rop(structInfo), + }); + }; + + StructType.prototype = Object.create(null, { + dispose: rop(function () { + __freeStruct(this.constructor, this); + }), + lookupMember: rop(function (memberName, tossIfNotFound = true) { + return __lookupMember(this.structInfo, memberName, tossIfNotFound); + }), + memberToJsString: rop(function (memberName) { + return __memberToJsString(this, memberName); + }), + memberIsString: rop(function (memberName, tossIfNotFound = true) { + return __memberIsString(this, memberName, tossIfNotFound); + }), + memberKey: __memberKeyProp, + memberKeys: __structMemberKeys, + memberSignature: rop(function (memberName, emscriptenFormat = false) { + return __memberSignature(this, memberName, emscriptenFormat); + }), + memoryDump: rop(__memoryDump), + pointer: __ptrPropDescriptor, + setMemberCString: rop(function (memberName, str) { + return __setMemberCString(this, memberName, str); + }), + }); + + Object.assign(StructType.prototype, { + addOnDispose: function (...v) { + __addOnDispose(this, ...v); + return this; + }, + }); + + Object.defineProperties(StructType, { + allocCString: rop(__allocCString), + isA: rop((v) => v instanceof StructType), + hasExternalPointer: rop( + (v) => v instanceof StructType && !!v[xPtrPropName], + ), + memberKey: __memberKeyProp, + }); + + const isNumericValue = (v) => + Number.isFinite(v) || v instanceof (BigInt || Number); + + const makeMemberWrapper = function f(ctor, name, descr) { + if (!f._) { + f._ = { getters: {}, setters: {}, sw: {} }; + const a = ['i', 'c', 'C', 'p', 'P', 's', 'f', 'd', 'v()']; + if (bigIntEnabled) a.push('j'); + a.forEach(function (v) { + f._.getters[v] = sigDVGetter(v); + f._.setters[v] = sigDVSetter(v); + f._.sw[v] = sigDVSetWrapper(v); + }); + const rxSig1 = /^[ipPsjfdcC]$/, + rxSig2 = /^[vipPsjfdcC]\([ipPsjfdcC]*\)$/; + f.sigCheck = function (obj, name, key, sig) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + toss(obj.structName, 'already has a property named', key + '.'); + } + rxSig1.test(sig) || + rxSig2.test(sig) || + toss( + 'Malformed signature for', + sPropName(obj.structName, name) + ':', + sig, + ); + }; + } + const key = ctor.memberKey(name); + f.sigCheck(ctor.prototype, name, key, descr.signature); + descr.key = key; + descr.name = name; + const sigGlyph = sigLetter(descr.signature); + const xPropName = sPropName(ctor.prototype.structName, key); + const dbg = ctor.prototype.debugFlags.__flags; + + const prop = Object.create(null); + prop.configurable = false; + prop.enumerable = false; + prop.get = function () { + if (dbg.getter) { + log( + 'debug.getter:', + f._.getters[sigGlyph], + 'for', + sigIR(sigGlyph), + xPropName, + '@', + this.pointer, + '+', + descr.offset, + 'sz', + descr.sizeof, + ); + } + let rc = new DataView( + heap().buffer, + this.pointer + descr.offset, + descr.sizeof, + )[f._.getters[sigGlyph]](0, isLittleEndian); + if (dbg.getter) log('debug.getter:', xPropName, 'result =', rc); + return rc; + }; + if (descr.readOnly) { + prop.set = __propThrowOnSet(ctor.prototype.structName, key); + } else { + prop.set = function (v) { + if (dbg.setter) { + log( + 'debug.setter:', + f._.setters[sigGlyph], + 'for', + sigIR(sigGlyph), + xPropName, + '@', + this.pointer, + '+', + descr.offset, + 'sz', + descr.sizeof, + v, + ); + } + if (!this.pointer) { + toss('Cannot set struct property on disposed instance.'); + } + if (null === v) v = 0; + else + while (!isNumericValue(v)) { + if ( + isAutoPtrSig(descr.signature) && + v instanceof StructType + ) { + v = v.pointer || 0; + if (dbg.setter) + log('debug.setter:', xPropName, 'resolved to', v); + break; + } + toss('Invalid value for pointer-type', xPropName + '.'); + } + new DataView( + heap().buffer, + this.pointer + descr.offset, + descr.sizeof, + )[f._.setters[sigGlyph]](0, f._.sw[sigGlyph](v), isLittleEndian); + }; + } + Object.defineProperty(ctor.prototype, key, prop); + }; + + const StructBinder = function StructBinder(structName, structInfo) { + if (1 === arguments.length) { + structInfo = structName; + structName = structInfo.name; + } else if (!structInfo.name) { + structInfo.name = structName; + } + if (!structName) toss('Struct name is required.'); + let lastMember = false; + Object.keys(structInfo.members).forEach((k) => { + const m = structInfo.members[k]; + if (!m.sizeof) toss(structName, 'member', k, 'is missing sizeof.'); + else if (m.sizeof === 1) { + m.signature === 'c' || + m.signature === 'C' || + toss( + 'Unexpected sizeof==1 member', + sPropName(structInfo.name, k), + 'with signature', + m.signature, + ); + } else { + if (0 !== m.sizeof % 4) { + console.warn( + 'Invalid struct member description =', + m, + 'from', + structInfo, + ); + toss( + structName, + 'member', + k, + 'sizeof is not aligned. sizeof=' + m.sizeof, + ); + } + if (0 !== m.offset % 4) { + console.warn( + 'Invalid struct member description =', + m, + 'from', + structInfo, + ); + toss( + structName, + 'member', + k, + 'offset is not aligned. offset=' + m.offset, + ); + } + } + if (!lastMember || lastMember.offset < m.offset) lastMember = m; + }); + if (!lastMember) toss('No member property descriptions found.'); + else if (structInfo.sizeof < lastMember.offset + lastMember.sizeof) { + toss( + 'Invalid struct config:', + structName, + 'max member offset (' + lastMember.offset + ') ', + 'extends past end of struct (sizeof=' + structInfo.sizeof + ').', + ); + } + const debugFlags = rop(SBF.__makeDebugFlags(StructBinder.debugFlags)); + + const StructCtor = function StructCtor(externalMemory) { + if (!(this instanceof StructCtor)) { + toss( + 'The', + structName, + "constructor may only be called via 'new'.", + ); + } else if (arguments.length) { + if ( + externalMemory !== (externalMemory | 0) || + externalMemory <= 0 + ) { + toss('Invalid pointer value for', structName, 'constructor.'); + } + __allocStruct(StructCtor, this, externalMemory); + } else { + __allocStruct(StructCtor, this); + } + }; + Object.defineProperties(StructCtor, { + debugFlags: debugFlags, + isA: rop((v) => v instanceof StructCtor), + memberKey: __memberKeyProp, + memberKeys: __structMemberKeys, + methodInfoForKey: rop(function (mKey) {}), + structInfo: rop(structInfo), + structName: rop(structName), + }); + StructCtor.prototype = new StructType(structName, structInfo, rop); + Object.defineProperties(StructCtor.prototype, { + debugFlags: debugFlags, + constructor: rop(StructCtor), + }); + Object.keys(structInfo.members).forEach((name) => + makeMemberWrapper(StructCtor, name, structInfo.members[name]), + ); + return StructCtor; + }; + StructBinder.StructType = StructType; + StructBinder.config = config; + StructBinder.allocCString = __allocCString; + if (!StructBinder.debugFlags) { + StructBinder.debugFlags = SBF.__makeDebugFlags(SBF.debugFlags); + } + return StructBinder; + }; + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + 'use strict'; + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + const toss3 = sqlite3.SQLite3Error.toss; + const capi = sqlite3.capi, + wasm = sqlite3.wasm, + util = sqlite3.util; + globalThis.WhWasmUtilInstaller(wasm); + delete globalThis.WhWasmUtilInstaller; + + if (0) { + const dealloc = wasm.exports[sqlite3.config.deallocExportName]; + const nFunc = wasm.functionTable().length; + let i; + for (i = 0; i < nFunc; ++i) { + const e = wasm.functionEntry(i); + if (dealloc === e) { + capi.SQLITE_WASM_DEALLOC = i; + break; + } + } + if (dealloc !== wasm.functionEntry(capi.SQLITE_WASM_DEALLOC)) { + toss( + 'Internal error: cannot find function pointer for SQLITE_WASM_DEALLOC.', + ); + } + } + + wasm.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', undefined, '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 wasm.xWrap.FuncPtrAdapter({ + signature: 'i(pi)', + contextKey: (argv, argIndex) => argv[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 wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_commit_hook', + signature: 'i(p)', + contextKey: (argv) => argv[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 wasm.xWrap.FuncPtrAdapter({ + signature: 'i(pipp)', + bindScope: 'transient', + callProxy: (callback) => { + let aNames; + return (pVoid, nCols, pColVals, pColNames) => { + try { + const aVals = wasm.cArgvToJs(nCols, pColVals); + if (!aNames) aNames = wasm.cArgvToJs(nCols, pColNames); + return callback(aVals, aNames) | 0; + } catch (e) { + return e.resultCode || capi.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', undefined, '*'], + ['sqlite3_get_autocommit', 'int', 'sqlite3*'], + ['sqlite3_get_auxdata', '*', 'sqlite3_context*', 'int'], + ['sqlite3_initialize', undefined], + ['sqlite3_interrupt', undefined, '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', + undefined, + 'sqlite3_context*', + '*', + 'int', + '*', + ], + ['sqlite3_result_double', undefined, 'sqlite3_context*', 'f64'], + [ + 'sqlite3_result_error', + undefined, + 'sqlite3_context*', + 'string', + 'int', + ], + ['sqlite3_result_error_code', undefined, 'sqlite3_context*', 'int'], + ['sqlite3_result_error_nomem', undefined, 'sqlite3_context*'], + ['sqlite3_result_error_toobig', undefined, 'sqlite3_context*'], + ['sqlite3_result_int', undefined, 'sqlite3_context*', 'int'], + ['sqlite3_result_null', undefined, 'sqlite3_context*'], + [ + 'sqlite3_result_pointer', + undefined, + 'sqlite3_context*', + '*', + 'string:static', + '*', + ], + ['sqlite3_result_subtype', undefined, 'sqlite3_value*', 'int'], + [ + 'sqlite3_result_text', + undefined, + 'sqlite3_context*', + 'string', + 'int', + '*', + ], + ['sqlite3_result_zeroblob', undefined, 'sqlite3_context*', 'int'], + [ + 'sqlite3_rollback_hook', + 'void*', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_rollback_hook', + signature: 'v(p)', + contextKey: (argv) => argv[0], + }), + '*', + ], + ], + + [ + 'sqlite3_set_auxdata', + undefined, + [ + 'sqlite3_context*', + 'int', + '*', + true + ? '*' + : new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroyAuxData', + signature: 'v(p)', + contextKey: (argv, argIndex) => argv[0], + }), + ], + ], + ['sqlite3_shutdown', undefined], + ['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 wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_trace_v2::callback', + signature: 'i(ippp)', + contextKey: (argv, argIndex) => argv[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', undefined, '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*'], + ]; + + if (!!wasm.exports.sqlite3_progress_handler) { + wasm.bindingSignatures.push([ + 'sqlite3_progress_handler', + undefined, + [ + 'sqlite3*', + 'int', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xProgressHandler', + signature: 'i(p)', + bindScope: 'context', + contextKey: (argv, argIndex) => argv[0], + }), + '*', + ], + ]); + } + + if (!!wasm.exports.sqlite3_stmt_explain) { + wasm.bindingSignatures.push( + ['sqlite3_stmt_explain', 'int', 'sqlite3_stmt*', 'int'], + ['sqlite3_stmt_isexplain', 'int', 'sqlite3_stmt*'], + ); + } + + if (!!wasm.exports.sqlite3_set_authorizer) { + wasm.bindingSignatures.push([ + 'sqlite3_set_authorizer', + 'int', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_set_authorizer::xAuth', + signature: 'i(pi' + 'ssss)', + contextKey: (argv, argIndex) => argv[0], + callProxy: (callback) => { + return (pV, iCode, s0, s1, s2, s3) => { + try { + s0 = s0 && wasm.cstrToJs(s0); + s1 = s1 && wasm.cstrToJs(s1); + s2 = s2 && wasm.cstrToJs(s2); + s3 = s3 && wasm.cstrToJs(s3); + return callback(pV, iCode, s0, s1, s2, s3) || 0; + } catch (e) { + return e.resultCode || capi.SQLITE_ERROR; + } + }; + }, + }), + '*', + ], + ]); + } + + if (false && wasm.compileOptionUsed('SQLITE_ENABLE_NORMALIZE')) { + wasm.bindingSignatures.push([ + 'sqlite3_normalized_sql', + 'string', + 'sqlite3_stmt*', + ]); + } + + wasm.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', undefined, '*', 'i64'], + ['sqlite3_result_zeroblob64', 'int', '*', 'i64'], + ['sqlite3_serialize', '*', 'sqlite3*', 'string', '*', 'int'], + ['sqlite3_set_last_insert_rowid', undefined, ['sqlite3*', 'i64']], + ['sqlite3_status64', 'int', 'int', '*', '*', 'int'], + ['sqlite3_total_changes64', 'i64', ['sqlite3*']], + [ + 'sqlite3_update_hook', + '*', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_update_hook', + signature: 'v(iippj)', + contextKey: (argv) => argv[0], + callProxy: (callback) => { + return (p, op, z0, z1, rowid) => { + callback( + p, + op, + wasm.cstrToJs(z0), + wasm.cstrToJs(z1), + rowid, + ); + }; + }, + }), + '*', + ], + ], + ['sqlite3_uri_int64', 'i64', ['sqlite3_filename', 'string', 'i64']], + ['sqlite3_value_int64', 'i64', 'sqlite3_value*'], + ]; + + if (wasm.bigIntEnabled && !!wasm.exports.sqlite3_declare_vtab) { + wasm.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', + '**', + ], + ); + } + + if (wasm.bigIntEnabled && !!wasm.exports.sqlite3_preupdate_hook) { + wasm.bindingSignatures.int64.push( + ['sqlite3_preupdate_blobwrite', 'int', 'sqlite3*'], + ['sqlite3_preupdate_count', 'int', 'sqlite3*'], + ['sqlite3_preupdate_depth', 'int', 'sqlite3*'], + [ + 'sqlite3_preupdate_hook', + '*', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_preupdate_hook', + signature: 'v(ppippjj)', + contextKey: (argv) => argv[0], + callProxy: (callback) => { + return (p, db, op, zDb, zTbl, iKey1, iKey2) => { + callback( + p, + db, + op, + wasm.cstrToJs(zDb), + wasm.cstrToJs(zTbl), + iKey1, + iKey2, + ); + }; + }, + }), + '*', + ], + ], + ['sqlite3_preupdate_new', 'int', ['sqlite3*', 'int', '**']], + ['sqlite3_preupdate_old', 'int', ['sqlite3*', 'int', '**']], + ); + } + + if ( + wasm.bigIntEnabled && + !!wasm.exports.sqlite3changegroup_add && + !!wasm.exports.sqlite3session_create && + !!wasm.exports.sqlite3_preupdate_hook + ) { + const __ipsProxy = { + signature: 'i(ps)', + callProxy: (callback) => { + return (p, s) => { + try { + return callback(p, wasm.cstrToJs(s)) | 0; + } catch (e) { + return e.resultCode || capi.SQLITE_ERROR; + } + }; + }, + }; + + wasm.bindingSignatures.int64.push( + ...[ + [ + 'sqlite3changegroup_add', + 'int', + ['sqlite3_changegroup*', 'int', 'void*'], + ], + [ + 'sqlite3changegroup_add_strm', + 'int', + [ + 'sqlite3_changegroup*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changegroup_delete', + undefined, + ['sqlite3_changegroup*'], + ], + ['sqlite3changegroup_new', 'int', ['**']], + [ + 'sqlite3changegroup_output', + 'int', + ['sqlite3_changegroup*', 'int*', '**'], + ], + [ + 'sqlite3changegroup_output_strm', + 'int', + [ + 'sqlite3_changegroup*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xOutput', + signature: 'i(ppi)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changeset_apply', + 'int', + [ + 'sqlite3*', + 'int', + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xConflict', + signature: 'i(pip)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changeset_apply_strm', + 'int', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xConflict', + signature: 'i(pip)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changeset_apply_v2', + 'int', + [ + 'sqlite3*', + 'int', + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xConflict', + signature: 'i(pip)', + bindScope: 'transient', + }), + 'void*', + '**', + 'int*', + 'int', + ], + ], + [ + 'sqlite3changeset_apply_v2_strm', + 'int', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xInputA', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInputB', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + ], + ], + ['sqlite3changeset_start_v2', 'int', ['**', 'int', '*', 'int']], + [ + 'sqlite3changeset_start_v2_strm', + 'int', + [ + '**', + new wasm.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 wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xOutput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3session_table_filter', + undefined, + [ + 'sqlite3_session*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + ...__ipsProxy, + contextKey: (argv, argIndex) => argv[0], + }), + '*', + ], + ], + ], + ); + } + + wasm.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'], + ]; + + sqlite3.StructBinder = globalThis.Jaccwabyt({ + heap: 0 ? wasm.memory : wasm.heap8u, + alloc: wasm.alloc, + dealloc: wasm.dealloc, + bigIntEnabled: wasm.bigIntEnabled, + memberPrefix: '$', + }); + delete globalThis.Jaccwabyt; + + { + const __xString = wasm.xWrap.argAdapter('string'); + wasm.xWrap.argAdapter('string:flexible', (v) => + __xString(util.flexibleString(v)), + ); + + wasm.xWrap.argAdapter( + 'string:static', + function (v) { + if (wasm.isPtr(v)) return v; + v = '' + v; + let rc = this[v]; + return rc || (this[v] = wasm.allocCString(v)); + }.bind(Object.create(null)), + ); + + const __xArgPtr = wasm.xWrap.argAdapter('*'); + const nilType = function () {}; + wasm.xWrap.argAdapter('sqlite3_filename', __xArgPtr)( + 'sqlite3_context*', + __xArgPtr, + )('sqlite3_value*', __xArgPtr)('void*', __xArgPtr)( + 'sqlite3_changegroup*', + __xArgPtr, + )('sqlite3_changeset_iter*', __xArgPtr)( + 'sqlite3_session*', + __xArgPtr, + )('sqlite3_stmt*', (v) => + __xArgPtr( + v instanceof (sqlite3?.oo1?.Stmt || nilType) ? v.pointer : v, + ), + )('sqlite3*', (v) => + __xArgPtr( + v instanceof (sqlite3?.oo1?.DB || nilType) ? v.pointer : v, + ), + )('sqlite3_vfs*', (v) => { + if ('string' === typeof v) { + return ( + capi.sqlite3_vfs_find(v) || + sqlite3.SQLite3Error.toss( + capi.SQLITE_NOTFOUND, + 'Unknown sqlite3_vfs name:', + v, + ) + ); + } + return __xArgPtr( + v instanceof (capi.sqlite3_vfs || nilType) ? v.pointer : v, + ); + }); + if (wasm.exports.sqlite3_declare_vtab) { + wasm.xWrap.argAdapter('sqlite3_index_info*', (v) => + __xArgPtr( + v instanceof (capi.sqlite3_index_info || nilType) + ? v.pointer + : v, + ), + )('sqlite3_module*', (v) => + __xArgPtr( + v instanceof (capi.sqlite3_module || nilType) ? v.pointer : v, + ), + ); + } + + const __xRcPtr = wasm.xWrap.resultAdapter('*'); + wasm.xWrap.resultAdapter('sqlite3*', __xRcPtr)( + 'sqlite3_context*', + __xRcPtr, + )('sqlite3_stmt*', __xRcPtr)('sqlite3_value*', __xRcPtr)( + 'sqlite3_vfs*', + __xRcPtr, + )('void*', __xRcPtr); + + if (0 === wasm.exports.sqlite3_step.length) { + wasm.xWrap.doArgcCheck = false; + sqlite3.config.warn( + 'Disabling sqlite3.wasm.xWrap.doArgcCheck due to environmental quirks.', + ); + } + for (const e of wasm.bindingSignatures) { + capi[e[0]] = wasm.xWrap.apply(null, e); + } + for (const e of wasm.bindingSignatures.wasmInternal) { + util[e[0]] = wasm.xWrap.apply(null, e); + } + + const fI64Disabled = function (fname) { + return () => + toss( + fname + '() is unavailable due to lack', + 'of BigInt support in this build.', + ); + }; + for (const e of wasm.bindingSignatures.int64) { + capi[e[0]] = wasm.bigIntEnabled + ? wasm.xWrap.apply(null, e) + : fI64Disabled(e[0]); + } + + delete wasm.bindingSignatures; + + if (wasm.exports.sqlite3__wasm_db_error) { + const __db_err = wasm.xWrap( + 'sqlite3__wasm_db_error', + 'int', + 'sqlite3*', + 'int', + 'string', + ); + + util.sqlite3__wasm_db_error = function (pDb, resultCode, message) { + if (resultCode instanceof sqlite3.WasmAllocError) { + resultCode = capi.SQLITE_NOMEM; + message = 0; + } else if (resultCode instanceof Error) { + message = message || '' + resultCode; + resultCode = resultCode.resultCode || capi.SQLITE_ERROR; + } + return pDb ? __db_err(pDb, resultCode, message) : resultCode; + }; + } else { + util.sqlite3__wasm_db_error = function (pDb, errCode, msg) { + console.warn( + 'sqlite3__wasm_db_error() is not exported.', + arguments, + ); + return errCode; + }; + } + } + + { + const cJson = wasm.xCall('sqlite3__wasm_enum_json'); + if (!cJson) { + toss( + "Maintenance required: increase sqlite3__wasm_enum_json()'s", + 'static buffer size!', + ); + } + + wasm.ctype = JSON.parse(wasm.cstrToJs(cJson)); + + const defineGroups = [ + 'access', + 'authorizer', + 'blobFinalizers', + 'changeset', + 'config', + 'dataTypes', + 'dbConfig', + 'dbStatus', + 'encodings', + 'fcntl', + 'flock', + 'ioCap', + 'limits', + 'openFlags', + 'prepareFlags', + 'resultCodes', + 'sqlite3Status', + 'stmtStatus', + 'syncFlags', + 'trace', + 'txnState', + 'udfFlags', + 'version', + ]; + if (wasm.bigIntEnabled) { + defineGroups.push('serialize', 'session', 'vtab'); + } + for (const t of defineGroups) { + for (const e of Object.entries(wasm.ctype[t])) { + capi[e[0]] = e[1]; + } + } + if (!wasm.functionEntry(capi.SQLITE_WASM_DEALLOC)) { + toss( + 'Internal error: cannot resolve exported function', + 'entry SQLITE_WASM_DEALLOC (==' + capi.SQLITE_WASM_DEALLOC + ').', + ); + } + const __rcMap = Object.create(null); + for (const t of ['resultCodes']) { + for (const e of Object.entries(wasm.ctype[t])) { + __rcMap[e[1]] = e[0]; + } + } + + capi.sqlite3_js_rc_str = (rc) => __rcMap[rc]; + + const notThese = Object.assign(Object.create(null), { + WasmTestStruct: true, + + sqlite3_kvvfs_methods: !util.isUIThread(), + + sqlite3_index_info: !wasm.bigIntEnabled, + sqlite3_index_constraint: !wasm.bigIntEnabled, + sqlite3_index_orderby: !wasm.bigIntEnabled, + sqlite3_index_constraint_usage: !wasm.bigIntEnabled, + }); + for (const s of wasm.ctype.structs) { + if (!notThese[s.name]) { + capi[s.name] = sqlite3.StructBinder(s); + } + } + if (capi.sqlite3_index_info) { + for (const k of [ + 'sqlite3_index_constraint', + 'sqlite3_index_orderby', + 'sqlite3_index_constraint_usage', + ]) { + capi.sqlite3_index_info[k] = capi[k]; + delete capi[k]; + } + capi.sqlite3_vtab_config = wasm.xWrap( + 'sqlite3__wasm_vtab_config', + 'int', + ['sqlite3*', 'int', 'int'], + ); + } + } + + const __dbArgcMismatch = (pDb, f, n) => { + return util.sqlite3__wasm_db_error( + pDb, + capi.SQLITE_MISUSE, + f + '() requires ' + n + ' argument' + (1 === n ? '' : 's') + '.', + ); + }; + + const __errEncoding = (pDb) => { + return util.sqlite3__wasm_db_error( + pDb, + capi.SQLITE_FORMAT, + 'SQLITE_UTF8 is the only supported encoding.', + ); + }; + + const __argPDb = (pDb) => wasm.xWrap.argAdapter('sqlite3*')(pDb); + const __argStr = (str) => (wasm.isPtr(str) ? wasm.cstrToJs(str) : str); + const __dbCleanupMap = function (pDb, mode) { + pDb = __argPDb(pDb); + let m = this.dbMap.get(pDb); + if (!mode) { + this.dbMap.delete(pDb); + return m; + } else if (!m && mode > 0) { + this.dbMap.set(pDb, (m = Object.create(null))); + } + return m; + }.bind( + Object.assign(Object.create(null), { + dbMap: new Map(), + }), + ); + + __dbCleanupMap.addCollation = function (pDb, name) { + const m = __dbCleanupMap(pDb, 1); + if (!m.collation) m.collation = new Set(); + m.collation.add(__argStr(name).toLowerCase()); + }; + + __dbCleanupMap._addUDF = function (pDb, name, arity, map) { + name = __argStr(name).toLowerCase(); + let u = map.get(name); + if (!u) map.set(name, (u = new Set())); + u.add(arity < 0 ? -1 : arity); + }; + + __dbCleanupMap.addFunction = function (pDb, name, arity) { + const m = __dbCleanupMap(pDb, 1); + if (!m.udf) m.udf = new Map(); + this._addUDF(pDb, name, arity, m.udf); + }; + + if (wasm.exports.sqlite3_create_window_function) { + __dbCleanupMap.addWindowFunc = function (pDb, name, arity) { + const m = __dbCleanupMap(pDb, 1); + if (!m.wudf) m.wudf = new Map(); + this._addUDF(pDb, name, arity, m.wudf); + }; + } + + __dbCleanupMap.cleanup = function (pDb) { + pDb = __argPDb(pDb); + + const closeArgs = [pDb]; + for (const name 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 x = wasm.exports[name]; + if (!x) { + continue; + } + closeArgs.length = x.length; + try { + capi[name](...closeArgs); + } catch (e) { + sqlite3.config.warn( + 'close-time call of', + name + '(', + closeArgs, + ') threw:', + e, + ); + } + } + const m = __dbCleanupMap(pDb, 0); + if (!m) return; + if (m.collation) { + for (const name of m.collation) { + try { + capi.sqlite3_create_collation_v2( + pDb, + name, + capi.SQLITE_UTF8, + 0, + 0, + 0, + ); + } catch (e) {} + } + delete m.collation; + } + let i; + for (i = 0; i < 2; ++i) { + const fmap = i ? m.wudf : m.udf; + if (!fmap) continue; + const func = i + ? capi.sqlite3_create_window_function + : capi.sqlite3_create_function_v2; + for (const e of fmap) { + const name = e[0], + arities = e[1]; + const fargs = [pDb, name, 0, capi.SQLITE_UTF8, 0, 0, 0, 0, 0]; + if (i) fargs.push(0); + for (const arity of arities) { + try { + fargs[2] = arity; + func.apply(null, fargs); + } catch (e) {} + } + arities.clear(); + } + fmap.clear(); + } + delete m.udf; + delete m.wudf; + }; + + { + const __sqlite3CloseV2 = wasm.xWrap( + 'sqlite3_close_v2', + 'int', + 'sqlite3*', + ); + capi.sqlite3_close_v2 = function (pDb) { + if (1 !== arguments.length) + return __dbArgcMismatch(pDb, 'sqlite3_close_v2', 1); + if (pDb) { + try { + __dbCleanupMap.cleanup(pDb); + } catch (e) {} + } + return __sqlite3CloseV2(pDb); + }; + } + + if (capi.sqlite3session_create) { + const __sqlite3SessionDelete = wasm.xWrap( + 'sqlite3session_delete', + undefined, + ['sqlite3_session*'], + ); + capi.sqlite3session_delete = function (pSession) { + if (1 !== arguments.length) { + return __dbArgcMismatch(pDb, 'sqlite3session_delete', 1); + } else if (pSession) { + capi.sqlite3session_table_filter(pSession, 0, 0); + } + __sqlite3SessionDelete(pSession); + }; + } + + { + const contextKey = (argv, argIndex) => { + return ( + 'argv[' + + argIndex + + ']:' + + argv[0] + + ':' + + wasm.cstrToJs(argv[1]).toLowerCase() + ); + }; + const __sqlite3CreateCollationV2 = wasm.xWrap( + 'sqlite3_create_collation_v2', + 'int', + [ + 'sqlite3*', + 'string', + 'int', + '*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xCompare', + signature: 'i(pipip)', + contextKey, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroy', + signature: 'v(p)', + contextKey, + }), + ], + ); + + capi.sqlite3_create_collation_v2 = function ( + pDb, + zName, + eTextRep, + pArg, + xCompare, + xDestroy, + ) { + if (6 !== arguments.length) + return __dbArgcMismatch(pDb, 'sqlite3_create_collation_v2', 6); + else if (0 === (eTextRep & 0xf)) { + eTextRep |= capi.SQLITE_UTF8; + } else if (capi.SQLITE_UTF8 !== (eTextRep & 0xf)) { + return __errEncoding(pDb); + } + try { + const rc = __sqlite3CreateCollationV2( + pDb, + zName, + eTextRep, + pArg, + xCompare, + xDestroy, + ); + if (0 === rc && xCompare instanceof Function) { + __dbCleanupMap.addCollation(pDb, zName); + } + return rc; + } catch (e) { + return util.sqlite3__wasm_db_error(pDb, e); + } + }; + + capi.sqlite3_create_collation = ( + pDb, + zName, + eTextRep, + pArg, + xCompare, + ) => { + return 5 === arguments.length + ? capi.sqlite3_create_collation_v2( + pDb, + zName, + eTextRep, + pArg, + xCompare, + 0, + ) + : __dbArgcMismatch(pDb, 'sqlite3_create_collation', 5); + }; + } + + { + const contextKey = function (argv, argIndex) { + return ( + argv[0] + + ':' + + (argv[2] < 0 ? -1 : argv[2]) + + ':' + + argIndex + + ':' + + wasm.cstrToJs(argv[1]).toLowerCase() + ); + }; + + const __cfProxy = Object.assign(Object.create(null), { + xInverseAndStep: { + signature: 'v(pip)', + contextKey, + callProxy: (callback) => { + return (pCtx, argc, pArgv) => { + try { + callback(pCtx, ...capi.sqlite3_values_to_js(argc, pArgv)); + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + }, + }, + xFinalAndValue: { + signature: 'v(p)', + contextKey, + callProxy: (callback) => { + return (pCtx) => { + try { + capi.sqlite3_result_js(pCtx, callback(pCtx)); + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + }, + }, + xFunc: { + signature: 'v(pip)', + contextKey, + callProxy: (callback) => { + return (pCtx, argc, pArgv) => { + try { + capi.sqlite3_result_js( + pCtx, + callback(pCtx, ...capi.sqlite3_values_to_js(argc, pArgv)), + ); + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + }, + }, + xDestroy: { + signature: 'v(p)', + contextKey, + + callProxy: (callback) => { + return (pVoid) => { + try { + callback(pVoid); + } catch (e) { + console.error('UDF xDestroy method threw:', e); + } + }; + }, + }, + }); + + const __sqlite3CreateFunction = wasm.xWrap( + 'sqlite3_create_function_v2', + 'int', + [ + 'sqlite3*', + 'string', + 'int', + 'int', + '*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFunc', + ...__cfProxy.xFunc, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xStep', + ...__cfProxy.xInverseAndStep, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFinal', + ...__cfProxy.xFinalAndValue, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroy', + ...__cfProxy.xDestroy, + }), + ], + ); + + const __sqlite3CreateWindowFunction = wasm.exports + .sqlite3_create_window_function + ? wasm.xWrap('sqlite3_create_window_function', 'int', [ + 'sqlite3*', + 'string', + 'int', + 'int', + '*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xStep', + ...__cfProxy.xInverseAndStep, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFinal', + ...__cfProxy.xFinalAndValue, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xValue', + ...__cfProxy.xFinalAndValue, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInverse', + ...__cfProxy.xInverseAndStep, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroy', + ...__cfProxy.xDestroy, + }), + ]) + : undefined; + + capi.sqlite3_create_function_v2 = function f( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + pDb, + 'sqlite3_create_function_v2', + f.length, + ); + } else if (0 === (eTextRep & 0xf)) { + eTextRep |= capi.SQLITE_UTF8; + } else if (capi.SQLITE_UTF8 !== (eTextRep & 0xf)) { + return __errEncoding(pDb); + } + try { + const rc = __sqlite3CreateFunction( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + xDestroy, + ); + if ( + 0 === rc && + (xFunc instanceof Function || + xStep instanceof Function || + xFinal instanceof Function || + xDestroy instanceof Function) + ) { + __dbCleanupMap.addFunction(pDb, funcName, nArg); + } + return rc; + } catch (e) { + console.error('sqlite3_create_function_v2() setup threw:', e); + return util.sqlite3__wasm_db_error( + pDb, + e, + 'Creation of UDF threw: ' + e, + ); + } + }; + + capi.sqlite3_create_function = function f( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + ) { + return f.length === arguments.length + ? capi.sqlite3_create_function_v2( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + 0, + ) + : __dbArgcMismatch(pDb, 'sqlite3_create_function', f.length); + }; + + if (__sqlite3CreateWindowFunction) { + capi.sqlite3_create_window_function = function f( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + pDb, + 'sqlite3_create_window_function', + f.length, + ); + } else if (0 === (eTextRep & 0xf)) { + eTextRep |= capi.SQLITE_UTF8; + } else if (capi.SQLITE_UTF8 !== (eTextRep & 0xf)) { + return __errEncoding(pDb); + } + try { + const rc = __sqlite3CreateWindowFunction( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ); + if ( + 0 === rc && + (xStep instanceof Function || + xFinal instanceof Function || + xValue instanceof Function || + xInverse instanceof Function || + xDestroy instanceof Function) + ) { + __dbCleanupMap.addWindowFunc(pDb, funcName, nArg); + } + return rc; + } catch (e) { + console.error( + 'sqlite3_create_window_function() setup threw:', + e, + ); + return util.sqlite3__wasm_db_error( + pDb, + e, + 'Creation of UDF threw: ' + e, + ); + } + }; + } else { + delete capi.sqlite3_create_window_function; + } + + capi.sqlite3_create_function_v2.udfSetResult = + capi.sqlite3_create_function.udfSetResult = capi.sqlite3_result_js; + if (capi.sqlite3_create_window_function) { + capi.sqlite3_create_window_function.udfSetResult = + capi.sqlite3_result_js; + } + + capi.sqlite3_create_function_v2.udfConvertArgs = + capi.sqlite3_create_function.udfConvertArgs = + capi.sqlite3_values_to_js; + if (capi.sqlite3_create_window_function) { + capi.sqlite3_create_window_function.udfConvertArgs = + capi.sqlite3_values_to_js; + } + + capi.sqlite3_create_function_v2.udfSetError = + capi.sqlite3_create_function.udfSetError = + capi.sqlite3_result_error_js; + if (capi.sqlite3_create_window_function) { + capi.sqlite3_create_window_function.udfSetError = + capi.sqlite3_result_error_js; + } + } + + { + const __flexiString = (v, n) => { + if ('string' === typeof v) { + n = -1; + } else if (util.isSQLableTypedArray(v)) { + n = v.byteLength; + v = util.typedArrayToString( + v instanceof ArrayBuffer ? new Uint8Array(v) : v, + ); + } else if (Array.isArray(v)) { + v = v.join(''); + n = -1; + } + return [v, n]; + }; + + const __prepare = { + basic: wasm.xWrap('sqlite3_prepare_v3', 'int', [ + 'sqlite3*', + 'string', + 'int', + 'int', + '**', + '**', + ]), + + full: wasm.xWrap('sqlite3_prepare_v3', 'int', [ + 'sqlite3*', + '*', + 'int', + 'int', + '**', + '**', + ]), + }; + + capi.sqlite3_prepare_v3 = function f( + pDb, + sql, + sqlLen, + prepFlags, + ppStmt, + pzTail, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch(pDb, 'sqlite3_prepare_v3', f.length); + } + const [xSql, xSqlLen] = __flexiString(sql, sqlLen); + switch (typeof xSql) { + case 'string': + return __prepare.basic( + pDb, + xSql, + xSqlLen, + prepFlags, + ppStmt, + null, + ); + case 'number': + return __prepare.full( + pDb, + xSql, + xSqlLen, + prepFlags, + ppStmt, + pzTail, + ); + default: + return util.sqlite3__wasm_db_error( + pDb, + capi.SQLITE_MISUSE, + 'Invalid SQL argument type for sqlite3_prepare_v2/v3().', + ); + } + }; + + capi.sqlite3_prepare_v2 = function f( + pDb, + sql, + sqlLen, + ppStmt, + pzTail, + ) { + return f.length === arguments.length + ? capi.sqlite3_prepare_v3(pDb, sql, sqlLen, 0, ppStmt, pzTail) + : __dbArgcMismatch(pDb, 'sqlite3_prepare_v2', f.length); + }; + } + + { + const __bindText = wasm.xWrap('sqlite3_bind_text', 'int', [ + 'sqlite3_stmt*', + 'int', + 'string', + 'int', + '*', + ]); + const __bindBlob = wasm.xWrap('sqlite3_bind_blob', 'int', [ + 'sqlite3_stmt*', + 'int', + '*', + 'int', + '*', + ]); + + capi.sqlite3_bind_text = function f( + pStmt, + iCol, + text, + nText, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + capi.sqlite3_db_handle(pStmt), + 'sqlite3_bind_text', + f.length, + ); + } else if (wasm.isPtr(text) || null === text) { + return __bindText(pStmt, iCol, text, nText, xDestroy); + } else if (text instanceof ArrayBuffer) { + text = new Uint8Array(text); + } else if (Array.isArray(pMem)) { + text = pMem.join(''); + } + let p, n; + try { + if (util.isSQLableTypedArray(text)) { + p = wasm.allocFromTypedArray(text); + n = text.byteLength; + } else if ('string' === typeof text) { + [p, n] = wasm.allocCString(text); + } else { + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + capi.SQLITE_MISUSE, + 'Invalid 3rd argument type for sqlite3_bind_text().', + ); + } + return __bindText(pStmt, iCol, p, n, capi.SQLITE_WASM_DEALLOC); + } catch (e) { + wasm.dealloc(p); + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + e, + ); + } + }; + + capi.sqlite3_bind_blob = function f( + pStmt, + iCol, + pMem, + nMem, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + capi.sqlite3_db_handle(pStmt), + 'sqlite3_bind_blob', + f.length, + ); + } else if (wasm.isPtr(pMem) || null === pMem) { + return __bindBlob(pStmt, iCol, pMem, nMem, xDestroy); + } else if (pMem instanceof ArrayBuffer) { + pMem = new Uint8Array(pMem); + } else if (Array.isArray(pMem)) { + pMem = pMem.join(''); + } + let p, n; + try { + if (util.isBindableTypedArray(pMem)) { + p = wasm.allocFromTypedArray(pMem); + n = nMem >= 0 ? nMem : pMem.byteLength; + } else if ('string' === typeof pMem) { + [p, n] = wasm.allocCString(pMem); + } else { + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + capi.SQLITE_MISUSE, + 'Invalid 3rd argument type for sqlite3_bind_blob().', + ); + } + return __bindBlob(pStmt, iCol, p, n, capi.SQLITE_WASM_DEALLOC); + } catch (e) { + wasm.dealloc(p); + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + e, + ); + } + }; + } + + { + capi.sqlite3_config = function (op, ...args) { + if (arguments.length < 2) return capi.SQLITE_MISUSE; + switch (op) { + case capi.SQLITE_CONFIG_COVERING_INDEX_SCAN: + case capi.SQLITE_CONFIG_MEMSTATUS: + case capi.SQLITE_CONFIG_SMALL_MALLOC: + case capi.SQLITE_CONFIG_SORTERREF_SIZE: + case capi.SQLITE_CONFIG_STMTJRNL_SPILL: + case capi.SQLITE_CONFIG_URI: + return wasm.exports.sqlite3__wasm_config_i(op, args[0]); + case capi.SQLITE_CONFIG_LOOKASIDE: + return wasm.exports.sqlite3__wasm_config_ii( + op, + args[0], + args[1], + ); + case capi.SQLITE_CONFIG_MEMDB_MAXSIZE: + return wasm.exports.sqlite3__wasm_config_j(op, args[0]); + case capi.SQLITE_CONFIG_GETMALLOC: + case capi.SQLITE_CONFIG_GETMUTEX: + case capi.SQLITE_CONFIG_GETPCACHE2: + case capi.SQLITE_CONFIG_GETPCACHE: + case capi.SQLITE_CONFIG_HEAP: + case capi.SQLITE_CONFIG_LOG: + case capi.SQLITE_CONFIG_MALLOC: + case capi.SQLITE_CONFIG_MMAP_SIZE: + case capi.SQLITE_CONFIG_MULTITHREAD: + case capi.SQLITE_CONFIG_MUTEX: + case capi.SQLITE_CONFIG_PAGECACHE: + case capi.SQLITE_CONFIG_PCACHE2: + case capi.SQLITE_CONFIG_PCACHE: + case capi.SQLITE_CONFIG_PCACHE_HDRSZ: + case capi.SQLITE_CONFIG_PMASZ: + case capi.SQLITE_CONFIG_SERIALIZED: + case capi.SQLITE_CONFIG_SINGLETHREAD: + case capi.SQLITE_CONFIG_SQLLOG: + case capi.SQLITE_CONFIG_WIN32_HEAPSIZE: + default: + return capi.SQLITE_NOTFOUND; + } + }; + } + + { + const __autoExtFptr = new Set(); + + capi.sqlite3_auto_extension = function (fPtr) { + if (fPtr instanceof Function) { + fPtr = wasm.installFunction('i(ppp)', fPtr); + } else if (1 !== arguments.length || !wasm.isPtr(fPtr)) { + return capi.SQLITE_MISUSE; + } + const rc = wasm.exports.sqlite3_auto_extension(fPtr); + if (fPtr !== arguments[0]) { + if (0 === rc) __autoExtFptr.add(fPtr); + else wasm.uninstallFunction(fPtr); + } + return rc; + }; + + capi.sqlite3_cancel_auto_extension = function (fPtr) { + if (!fPtr || 1 !== arguments.length || !wasm.isPtr(fPtr)) return 0; + return wasm.exports.sqlite3_cancel_auto_extension(fPtr); + }; + + capi.sqlite3_reset_auto_extension = function () { + wasm.exports.sqlite3_reset_auto_extension(); + for (const fp of __autoExtFptr) wasm.uninstallFunction(fp); + __autoExtFptr.clear(); + }; + } + + const pKvvfs = capi.sqlite3_vfs_find('kvvfs'); + if (pKvvfs) { + if (util.isUIThread()) { + const kvvfsMethods = new capi.sqlite3_kvvfs_methods( + wasm.exports.sqlite3__wasm_kvvfs_methods(), + ); + delete capi.sqlite3_kvvfs_methods; + + const kvvfsMakeKey = + wasm.exports.sqlite3__wasm_kvvfsMakeKeyOnPstack, + pstack = wasm.pstack; + + const kvvfsStorage = (zClass) => + 115 === wasm.peek(zClass) ? sessionStorage : localStorage; + + const kvvfsImpls = { + xRead: (zClass, zKey, zBuf, nBuf) => { + const stack = pstack.pointer, + astack = wasm.scopedAllocPush(); + try { + const zXKey = kvvfsMakeKey(zClass, zKey); + if (!zXKey) return -3; + const jKey = wasm.cstrToJs(zXKey); + const jV = kvvfsStorage(zClass).getItem(jKey); + if (!jV) return -1; + const nV = jV.length; + if (nBuf <= 0) return nV; + else if (1 === nBuf) { + wasm.poke(zBuf, 0); + return nV; + } + const zV = wasm.scopedAllocCString(jV); + if (nBuf > nV + 1) nBuf = nV + 1; + wasm.heap8u().copyWithin(zBuf, zV, zV + nBuf - 1); + wasm.poke(zBuf + nBuf - 1, 0); + return nBuf - 1; + } catch (e) { + console.error('kvstorageRead()', e); + return -2; + } finally { + pstack.restore(stack); + wasm.scopedAllocPop(astack); + } + }, + xWrite: (zClass, zKey, zData) => { + const stack = pstack.pointer; + try { + const zXKey = kvvfsMakeKey(zClass, zKey); + if (!zXKey) return 1; + const jKey = wasm.cstrToJs(zXKey); + kvvfsStorage(zClass).setItem(jKey, wasm.cstrToJs(zData)); + return 0; + } catch (e) { + console.error('kvstorageWrite()', e); + return capi.SQLITE_IOERR; + } finally { + pstack.restore(stack); + } + }, + xDelete: (zClass, zKey) => { + const stack = pstack.pointer; + try { + const zXKey = kvvfsMakeKey(zClass, zKey); + if (!zXKey) return 1; + kvvfsStorage(zClass).removeItem(wasm.cstrToJs(zXKey)); + return 0; + } catch (e) { + console.error('kvstorageDelete()', e); + return capi.SQLITE_IOERR; + } finally { + pstack.restore(stack); + } + }, + }; + for (const k of Object.keys(kvvfsImpls)) { + kvvfsMethods[kvvfsMethods.memberKey(k)] = wasm.installFunction( + kvvfsMethods.memberSignature(k), + kvvfsImpls[k], + ); + } + } else { + capi.sqlite3_vfs_unregister(pKvvfs); + } + } + + wasm.xWrap.FuncPtrAdapter.warnOnUse = true; + + const StructBinder = sqlite3.StructBinder; + const installMethod = function callee( + tgt, + name, + func, + applyArgcCheck = callee.installMethodArgcCheck, + ) { + if (!(tgt instanceof StructBinder.StructType)) { + toss('Usage error: target object is-not-a StructType.'); + } else if (!(func instanceof Function) && !wasm.isPtr(func)) { + toss('Usage error: expecting a Function or WASM pointer to one.'); + } + if (1 === arguments.length) { + return (n, f) => callee(tgt, n, f, applyArgcCheck); + } + if (!callee.argcProxy) { + callee.argcProxy = function (tgt, funcName, func, sig) { + return function (...args) { + if (func.length !== arguments.length) { + toss( + 'Argument mismatch for', + tgt.structInfo.name + + '::' + + funcName + + ': Native signature is:', + sig, + ); + } + return func.apply(this, args); + }; + }; + + callee.removeFuncList = function () { + if (this.ondispose.__removeFuncList) { + this.ondispose.__removeFuncList.forEach((v, ndx) => { + if ('number' === typeof v) { + try { + wasm.uninstallFunction(v); + } catch (e) {} + } + }); + delete this.ondispose.__removeFuncList; + } + }; + } + const sigN = tgt.memberSignature(name); + if (sigN.length < 2) { + toss( + 'Member', + name, + 'does not have a function pointer signature:', + sigN, + ); + } + const memKey = tgt.memberKey(name); + const fProxy = + applyArgcCheck && !wasm.isPtr(func) + ? callee.argcProxy(tgt, memKey, func, sigN) + : func; + if (wasm.isPtr(fProxy)) { + if (fProxy && !wasm.functionEntry(fProxy)) { + toss('Pointer', fProxy, 'is not a WASM function table entry.'); + } + tgt[memKey] = fProxy; + } else { + const pFunc = wasm.installFunction( + fProxy, + tgt.memberSignature(name, true), + ); + tgt[memKey] = pFunc; + if (!tgt.ondispose || !tgt.ondispose.__removeFuncList) { + tgt.addOnDispose( + 'ondispose.__removeFuncList handler', + callee.removeFuncList, + ); + tgt.ondispose.__removeFuncList = []; + } + tgt.ondispose.__removeFuncList.push(memKey, pFunc); + } + return (n, f) => callee(tgt, n, f, applyArgcCheck); + }; + installMethod.installMethodArgcCheck = false; + + const installMethods = function ( + structInstance, + methods, + applyArgcCheck = installMethod.installMethodArgcCheck, + ) { + const seen = new Map(); + for (const k of Object.keys(methods)) { + const m = methods[k]; + const prior = seen.get(m); + if (prior) { + const mkey = structInstance.memberKey(k); + structInstance[mkey] = + structInstance[structInstance.memberKey(prior)]; + } else { + installMethod(structInstance, k, m, applyArgcCheck); + seen.set(m, k); + } + } + return structInstance; + }; + + StructBinder.StructType.prototype.installMethod = function callee( + name, + func, + applyArgcCheck = installMethod.installMethodArgcCheck, + ) { + return arguments.length < 3 && name && 'object' === typeof name + ? installMethods(this, ...arguments) + : installMethod(this, ...arguments); + }; + + StructBinder.StructType.prototype.installMethods = function ( + methods, + applyArgcCheck = installMethod.installMethodArgcCheck, + ) { + return installMethods(this, methods, applyArgcCheck); + }; + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + sqlite3.version = { + libVersion: '3.50.4', + libVersionNumber: 3050004, + sourceId: + '2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3', + downloadVersion: 3500400, + }; + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + const toss3 = (...args) => { + throw new sqlite3.SQLite3Error(...args); + }; + + const capi = sqlite3.capi, + wasm = sqlite3.wasm, + util = sqlite3.util; + + const __ptrMap = new WeakMap(); + + const __stmtMap = new WeakMap(); + + const getOwnOption = (opts, p, dflt) => { + const d = Object.getOwnPropertyDescriptor(opts, p); + return d ? d.value : dflt; + }; + + const checkSqlite3Rc = function (dbPtr, sqliteResultCode) { + if (sqliteResultCode) { + if (dbPtr instanceof DB) dbPtr = dbPtr.pointer; + toss3( + sqliteResultCode, + 'sqlite3 result code', + sqliteResultCode + ':', + dbPtr + ? capi.sqlite3_errmsg(dbPtr) + : capi.sqlite3_errstr(sqliteResultCode), + ); + } + return arguments[0]; + }; + + const __dbTraceToConsole = wasm.installFunction( + 'i(ippp)', + function (t, c, p, x) { + if (capi.SQLITE_TRACE_STMT === t) { + console.log( + 'SQL TRACE #' + ++this.counter + ' via sqlite3@' + c + ':', + wasm.cstrToJs(x), + ); + } + }.bind({ counter: 0 }), + ); + + const __vfsPostOpenCallback = Object.create(null); + + const dbCtorHelper = function ctor(...args) { + if (!ctor._name2vfs) { + ctor._name2vfs = Object.create(null); + const isWorkerThread = + 'function' === typeof importScripts + ? (n) => + toss3( + 'The VFS for', + n, + 'is only available in the main window thread.', + ) + : false; + ctor._name2vfs[':localStorage:'] = { + vfs: 'kvvfs', + filename: isWorkerThread || (() => 'local'), + }; + ctor._name2vfs[':sessionStorage:'] = { + vfs: 'kvvfs', + filename: isWorkerThread || (() => 'session'), + }; + } + const opt = ctor.normalizeArgs(...args); + let fn = opt.filename, + vfsName = opt.vfs, + flagsStr = opt.flags; + if ( + ('string' !== typeof fn && 'number' !== typeof fn) || + 'string' !== typeof flagsStr || + (vfsName && + 'string' !== typeof vfsName && + 'number' !== typeof vfsName) + ) { + sqlite3.config.error('Invalid DB ctor args', opt, arguments); + toss3('Invalid arguments for DB constructor.'); + } + let fnJs = 'number' === typeof fn ? wasm.cstrToJs(fn) : fn; + const vfsCheck = ctor._name2vfs[fnJs]; + if (vfsCheck) { + vfsName = vfsCheck.vfs; + fn = fnJs = vfsCheck.filename(fnJs); + } + let pDb, + oflags = 0; + if (flagsStr.indexOf('c') >= 0) { + oflags |= capi.SQLITE_OPEN_CREATE | capi.SQLITE_OPEN_READWRITE; + } + if (flagsStr.indexOf('w') >= 0) oflags |= capi.SQLITE_OPEN_READWRITE; + if (0 === oflags) oflags |= capi.SQLITE_OPEN_READONLY; + oflags |= capi.SQLITE_OPEN_EXRESCODE; + const stack = wasm.pstack.pointer; + try { + const pPtr = wasm.pstack.allocPtr(); + let rc = capi.sqlite3_open_v2(fn, pPtr, oflags, vfsName || 0); + pDb = wasm.peekPtr(pPtr); + checkSqlite3Rc(pDb, rc); + capi.sqlite3_extended_result_codes(pDb, 1); + if (flagsStr.indexOf('t') >= 0) { + capi.sqlite3_trace_v2( + pDb, + capi.SQLITE_TRACE_STMT, + __dbTraceToConsole, + pDb, + ); + } + } catch (e) { + if (pDb) capi.sqlite3_close_v2(pDb); + throw e; + } finally { + wasm.pstack.restore(stack); + } + this.filename = fnJs; + __ptrMap.set(this, pDb); + __stmtMap.set(this, Object.create(null)); + try { + const pVfs = + capi.sqlite3_js_db_vfs(pDb) || + toss3('Internal error: cannot get VFS for new db handle.'); + const postInitSql = __vfsPostOpenCallback[pVfs]; + if (postInitSql) { + if (postInitSql instanceof Function) { + postInitSql(this, sqlite3); + } else { + checkSqlite3Rc( + pDb, + capi.sqlite3_exec(pDb, postInitSql, 0, 0, 0), + ); + } + } + } catch (e) { + this.close(); + throw e; + } + }; + + dbCtorHelper.setVfsPostOpenCallback = function (pVfs, callback) { + if (!(callback instanceof Function)) { + toss3( + 'dbCtorHelper.setVfsPostOpenCallback() should not be used with ' + + 'a non-function argument.', + arguments, + ); + } + __vfsPostOpenCallback[pVfs] = callback; + }; + + dbCtorHelper.normalizeArgs = function ( + filename = ':memory:', + flags = 'c', + vfs = null, + ) { + const arg = {}; + if ( + 1 === arguments.length && + arguments[0] && + 'object' === typeof arguments[0] + ) { + Object.assign(arg, arguments[0]); + if (undefined === arg.flags) arg.flags = 'c'; + if (undefined === arg.vfs) arg.vfs = null; + if (undefined === arg.filename) arg.filename = ':memory:'; + } else { + arg.filename = filename; + arg.flags = flags; + arg.vfs = vfs; + } + return arg; + }; + + const DB = function (...args) { + dbCtorHelper.apply(this, args); + }; + DB.dbCtorHelper = dbCtorHelper; + + const BindTypes = { + null: 1, + number: 2, + string: 3, + boolean: 4, + blob: 5, + }; + BindTypes['undefined'] == BindTypes.null; + if (wasm.bigIntEnabled) { + BindTypes.bigint = BindTypes.number; + } + + const Stmt = function () { + if (BindTypes !== arguments[2]) { + toss3( + capi.SQLITE_MISUSE, + 'Do not call the Stmt constructor directly. Use DB.prepare().', + ); + } + this.db = arguments[0]; + __ptrMap.set(this, arguments[1]); + this.parameterCount = capi.sqlite3_bind_parameter_count(this.pointer); + }; + + const affirmDbOpen = function (db) { + if (!db.pointer) toss3('DB has been closed.'); + return db; + }; + + const affirmColIndex = function (stmt, ndx) { + if (ndx !== (ndx | 0) || ndx < 0 || ndx >= stmt.columnCount) { + toss3('Column index', ndx, 'is out of range.'); + } + return stmt; + }; + + const parseExecArgs = function (db, args) { + const out = Object.create(null); + out.opt = Object.create(null); + switch (args.length) { + case 1: + if ( + 'string' === typeof args[0] || + util.isSQLableTypedArray(args[0]) + ) { + out.sql = args[0]; + } else if (Array.isArray(args[0])) { + out.sql = args[0]; + } else if (args[0] && 'object' === typeof args[0]) { + out.opt = args[0]; + out.sql = out.opt.sql; + } + break; + case 2: + out.sql = args[0]; + out.opt = args[1]; + break; + default: + toss3('Invalid argument count for exec().'); + } + out.sql = util.flexibleString(out.sql); + if ('string' !== typeof out.sql) { + toss3('Missing SQL argument or unsupported SQL value type.'); + } + const opt = out.opt; + switch (opt.returnValue) { + case 'resultRows': + if (!opt.resultRows) opt.resultRows = []; + out.returnVal = () => opt.resultRows; + break; + case 'saveSql': + if (!opt.saveSql) opt.saveSql = []; + out.returnVal = () => opt.saveSql; + break; + case undefined: + case 'this': + out.returnVal = () => db; + break; + default: + toss3('Invalid returnValue value:', opt.returnValue); + } + if (!opt.callback && !opt.returnValue && undefined !== opt.rowMode) { + if (!opt.resultRows) opt.resultRows = []; + out.returnVal = () => opt.resultRows; + } + if (opt.callback || opt.resultRows) { + switch (undefined === opt.rowMode ? 'array' : opt.rowMode) { + case 'object': + out.cbArg = (stmt, cache) => { + if (!cache.columnNames) + cache.columnNames = stmt.getColumnNames([]); + + const row = stmt.get([]); + const rv = Object.create(null); + for (const i in cache.columnNames) + rv[cache.columnNames[i]] = row[i]; + return rv; + }; + break; + case 'array': + out.cbArg = (stmt) => stmt.get([]); + break; + case 'stmt': + if (Array.isArray(opt.resultRows)) { + toss3( + 'exec(): invalid rowMode for a resultRows array: must', + "be one of 'array', 'object',", + 'a result column number, or column name reference.', + ); + } + out.cbArg = (stmt) => stmt; + break; + default: + if (util.isInt32(opt.rowMode)) { + out.cbArg = (stmt) => stmt.get(opt.rowMode); + break; + } else if ( + 'string' === typeof opt.rowMode && + opt.rowMode.length > 1 && + '$' === opt.rowMode[0] + ) { + const $colName = opt.rowMode.substr(1); + out.cbArg = (stmt) => { + const rc = stmt.get(Object.create(null))[$colName]; + return undefined === rc + ? toss3( + capi.SQLITE_NOTFOUND, + 'exec(): unknown result column:', + $colName, + ) + : rc; + }; + break; + } + toss3('Invalid rowMode:', opt.rowMode); + } + } + return out; + }; + + const __selectFirstRow = (db, sql, bind, ...getArgs) => { + const stmt = db.prepare(sql); + try { + const rc = stmt.bind(bind).step() + ? stmt.get(...getArgs) + : undefined; + stmt.reset(); + return rc; + } finally { + stmt.finalize(); + } + }; + + const __selectAll = (db, sql, bind, rowMode) => + db.exec({ + sql, + bind, + rowMode, + returnValue: 'resultRows', + }); + + DB.checkRc = (db, resultCode) => checkSqlite3Rc(db, resultCode); + + DB.prototype = { + isOpen: function () { + return !!this.pointer; + }, + + affirmOpen: function () { + return affirmDbOpen(this); + }, + + close: function () { + if (this.pointer) { + if (this.onclose && this.onclose.before instanceof Function) { + try { + this.onclose.before(this); + } catch (e) {} + } + const pDb = this.pointer; + Object.keys(__stmtMap.get(this)).forEach((k, s) => { + if (s && s.pointer) { + try { + s.finalize(); + } catch (e) {} + } + }); + __ptrMap.delete(this); + __stmtMap.delete(this); + capi.sqlite3_close_v2(pDb); + if (this.onclose && this.onclose.after instanceof Function) { + try { + this.onclose.after(this); + } catch (e) {} + } + delete this.filename; + } + }, + + changes: function (total = false, sixtyFour = false) { + const p = affirmDbOpen(this).pointer; + if (total) { + return sixtyFour + ? capi.sqlite3_total_changes64(p) + : capi.sqlite3_total_changes(p); + } else { + return sixtyFour + ? capi.sqlite3_changes64(p) + : capi.sqlite3_changes(p); + } + }, + + dbFilename: function (dbName = 'main') { + return capi.sqlite3_db_filename(affirmDbOpen(this).pointer, dbName); + }, + + dbName: function (dbNumber = 0) { + return capi.sqlite3_db_name(affirmDbOpen(this).pointer, dbNumber); + }, + + dbVfsName: function (dbName = 0) { + let rc; + const pVfs = capi.sqlite3_js_db_vfs( + affirmDbOpen(this).pointer, + dbName, + ); + if (pVfs) { + const v = new capi.sqlite3_vfs(pVfs); + try { + rc = wasm.cstrToJs(v.$zName); + } finally { + v.dispose(); + } + } + return rc; + }, + + prepare: function (sql) { + affirmDbOpen(this); + const stack = wasm.pstack.pointer; + let ppStmt, pStmt; + try { + ppStmt = wasm.pstack.alloc(8); + DB.checkRc( + this, + capi.sqlite3_prepare_v2(this.pointer, sql, -1, ppStmt, null), + ); + pStmt = wasm.peekPtr(ppStmt); + } finally { + wasm.pstack.restore(stack); + } + if (!pStmt) toss3('Cannot prepare empty SQL.'); + const stmt = new Stmt(this, pStmt, BindTypes); + __stmtMap.get(this)[pStmt] = stmt; + return stmt; + }, + + exec: function () { + affirmDbOpen(this); + const arg = parseExecArgs(this, arguments); + if (!arg.sql) { + return toss3('exec() requires an SQL string.'); + } + const opt = arg.opt; + const callback = opt.callback; + const resultRows = Array.isArray(opt.resultRows) + ? opt.resultRows + : undefined; + let stmt; + let bind = opt.bind; + let evalFirstResult = !!( + arg.cbArg || + opt.columnNames || + resultRows + ); + const stack = wasm.scopedAllocPush(); + const saveSql = Array.isArray(opt.saveSql) + ? opt.saveSql + : undefined; + try { + const isTA = util.isSQLableTypedArray(arg.sql); + let sqlByteLen = isTA + ? arg.sql.byteLength + : wasm.jstrlen(arg.sql); + const ppStmt = wasm.scopedAlloc( + 2 * wasm.ptrSizeof + (sqlByteLen + 1), + ); + const pzTail = ppStmt + wasm.ptrSizeof; + let pSql = pzTail + wasm.ptrSizeof; + const pSqlEnd = pSql + sqlByteLen; + if (isTA) wasm.heap8().set(arg.sql, pSql); + else wasm.jstrcpy(arg.sql, wasm.heap8(), pSql, sqlByteLen, false); + wasm.poke(pSql + sqlByteLen, 0); + while (pSql && wasm.peek(pSql, 'i8')) { + wasm.pokePtr([ppStmt, pzTail], 0); + DB.checkRc( + this, + capi.sqlite3_prepare_v3( + this.pointer, + pSql, + sqlByteLen, + 0, + ppStmt, + pzTail, + ), + ); + const pStmt = wasm.peekPtr(ppStmt); + pSql = wasm.peekPtr(pzTail); + sqlByteLen = pSqlEnd - pSql; + if (!pStmt) continue; + if (saveSql) saveSql.push(capi.sqlite3_sql(pStmt).trim()); + stmt = new Stmt(this, pStmt, BindTypes); + if (bind && stmt.parameterCount) { + stmt.bind(bind); + bind = null; + } + if (evalFirstResult && stmt.columnCount) { + let gotColNames = Array.isArray(opt.columnNames) ? 0 : 1; + evalFirstResult = false; + if (arg.cbArg || resultRows) { + const cbArgCache = Object.create(null); + for (; stmt.step(); stmt._lockedByExec = false) { + if (0 === gotColNames++) { + stmt.getColumnNames( + (cbArgCache.columnNames = opt.columnNames || []), + ); + } + stmt._lockedByExec = true; + const row = arg.cbArg(stmt, cbArgCache); + if (resultRows) resultRows.push(row); + if (callback && false === callback.call(opt, row, stmt)) { + break; + } + } + stmt._lockedByExec = false; + } + if (0 === gotColNames) { + stmt.getColumnNames(opt.columnNames); + } + } else { + stmt.step(); + } + stmt.reset().finalize(); + stmt = null; + } + } finally { + wasm.scopedAllocPop(stack); + if (stmt) { + delete stmt._lockedByExec; + stmt.finalize(); + } + } + return arg.returnVal(); + }, + + createFunction: function f(name, xFunc, opt) { + const isFunc = (f) => f instanceof Function; + switch (arguments.length) { + case 1: + opt = name; + name = opt.name; + xFunc = opt.xFunc || 0; + break; + case 2: + if (!isFunc(xFunc)) { + opt = xFunc; + xFunc = opt.xFunc || 0; + } + break; + case 3: + break; + default: + break; + } + if (!opt) opt = {}; + if ('string' !== typeof name) { + toss3('Invalid arguments: missing function name.'); + } + let xStep = opt.xStep || 0; + let xFinal = opt.xFinal || 0; + const xValue = opt.xValue || 0; + const xInverse = opt.xInverse || 0; + let isWindow = undefined; + if (isFunc(xFunc)) { + isWindow = false; + if (isFunc(xStep) || isFunc(xFinal)) { + toss3('Ambiguous arguments: scalar or aggregate?'); + } + xStep = xFinal = null; + } else if (isFunc(xStep)) { + if (!isFunc(xFinal)) { + toss3('Missing xFinal() callback for aggregate or window UDF.'); + } + xFunc = null; + } else if (isFunc(xFinal)) { + toss3('Missing xStep() callback for aggregate or window UDF.'); + } else { + toss3('Missing function-type properties.'); + } + if (false === isWindow) { + if (isFunc(xValue) || isFunc(xInverse)) { + toss3( + 'xValue and xInverse are not permitted for non-window UDFs.', + ); + } + } else if (isFunc(xValue)) { + if (!isFunc(xInverse)) { + toss3('xInverse must be provided if xValue is.'); + } + isWindow = true; + } else if (isFunc(xInverse)) { + toss3('xValue must be provided if xInverse is.'); + } + const pApp = opt.pApp; + if ( + undefined !== pApp && + null !== pApp && + ('number' !== typeof pApp || !util.isInt32(pApp)) + ) { + toss3( + 'Invalid value for pApp property. Must be a legal WASM pointer value.', + ); + } + const xDestroy = opt.xDestroy || 0; + if (xDestroy && !isFunc(xDestroy)) { + toss3('xDestroy property must be a function.'); + } + let fFlags = 0; + if (getOwnOption(opt, 'deterministic')) + fFlags |= capi.SQLITE_DETERMINISTIC; + if (getOwnOption(opt, 'directOnly')) + fFlags |= capi.SQLITE_DIRECTONLY; + if (getOwnOption(opt, 'innocuous')) fFlags |= capi.SQLITE_INNOCUOUS; + name = name.toLowerCase(); + const xArity = xFunc || xStep; + const arity = getOwnOption(opt, 'arity'); + const arityArg = + 'number' === typeof arity + ? arity + : xArity.length + ? xArity.length - 1 + : 0; + let rc; + if (isWindow) { + rc = capi.sqlite3_create_window_function( + this.pointer, + name, + arityArg, + capi.SQLITE_UTF8 | fFlags, + pApp || 0, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ); + } else { + rc = capi.sqlite3_create_function_v2( + this.pointer, + name, + arityArg, + capi.SQLITE_UTF8 | fFlags, + pApp || 0, + xFunc, + xStep, + xFinal, + xDestroy, + ); + } + DB.checkRc(this, rc); + return this; + }, + + selectValue: function (sql, bind, asType) { + return __selectFirstRow(this, sql, bind, 0, asType); + }, + + selectValues: function (sql, bind, asType) { + const stmt = this.prepare(sql), + rc = []; + try { + stmt.bind(bind); + while (stmt.step()) rc.push(stmt.get(0, asType)); + stmt.reset(); + } finally { + stmt.finalize(); + } + return rc; + }, + + selectArray: function (sql, bind) { + return __selectFirstRow(this, sql, bind, []); + }, + + selectObject: function (sql, bind) { + return __selectFirstRow(this, sql, bind, {}); + }, + + selectArrays: function (sql, bind) { + return __selectAll(this, sql, bind, 'array'); + }, + + selectObjects: function (sql, bind) { + return __selectAll(this, sql, bind, 'object'); + }, + + openStatementCount: function () { + return this.pointer ? Object.keys(__stmtMap.get(this)).length : 0; + }, + + transaction: function (callback) { + let opener = 'BEGIN'; + if (arguments.length > 1) { + if (/[^a-zA-Z]/.test(arguments[0])) { + toss3( + capi.SQLITE_MISUSE, + 'Invalid argument for BEGIN qualifier.', + ); + } + opener += ' ' + arguments[0]; + callback = arguments[1]; + } + affirmDbOpen(this).exec(opener); + try { + const rc = callback(this); + this.exec('COMMIT'); + return rc; + } catch (e) { + this.exec('ROLLBACK'); + throw e; + } + }, + + savepoint: function (callback) { + affirmDbOpen(this).exec('SAVEPOINT oo1'); + try { + const rc = callback(this); + this.exec('RELEASE oo1'); + return rc; + } catch (e) { + this.exec('ROLLBACK to SAVEPOINT oo1; RELEASE SAVEPOINT oo1'); + throw e; + } + }, + + checkRc: function (resultCode) { + return checkSqlite3Rc(this, resultCode); + }, + }; + + const affirmStmtOpen = function (stmt) { + if (!stmt.pointer) toss3('Stmt has been closed.'); + return stmt; + }; + + const isSupportedBindType = function (v) { + let t = BindTypes[null === v || undefined === v ? 'null' : typeof v]; + switch (t) { + case BindTypes.boolean: + case BindTypes.null: + case BindTypes.number: + case BindTypes.string: + return t; + case BindTypes.bigint: + if (wasm.bigIntEnabled) return t; + + default: + return util.isBindableTypedArray(v) ? BindTypes.blob : undefined; + } + }; + + const affirmSupportedBindType = function (v) { + return ( + isSupportedBindType(v) || + toss3('Unsupported bind() argument type:', typeof v) + ); + }; + + const affirmParamIndex = function (stmt, key) { + const n = + 'number' === typeof key + ? key + : capi.sqlite3_bind_parameter_index(stmt.pointer, key); + if (0 === n || !util.isInt32(n)) { + toss3('Invalid bind() parameter name: ' + key); + } else if (n < 1 || n > stmt.parameterCount) + toss3('Bind index', key, 'is out of range.'); + return n; + }; + + const affirmNotLockedByExec = function (stmt, currentOpName) { + if (stmt._lockedByExec) { + toss3( + 'Operation is illegal when statement is locked:', + currentOpName, + ); + } + return stmt; + }; + + const bindOne = function f(stmt, ndx, bindType, val) { + affirmNotLockedByExec(affirmStmtOpen(stmt), 'bind()'); + if (!f._) { + f._tooBigInt = (v) => + toss3( + 'BigInt value is too big to store without precision loss:', + v, + ); + f._ = { + string: function (stmt, ndx, val, asBlob) { + const [pStr, n] = wasm.allocCString(val, true); + const f = asBlob + ? capi.sqlite3_bind_blob + : capi.sqlite3_bind_text; + return f(stmt.pointer, ndx, pStr, n, capi.SQLITE_WASM_DEALLOC); + }, + }; + } + affirmSupportedBindType(val); + ndx = affirmParamIndex(stmt, ndx); + let rc = 0; + switch ( + null === val || undefined === val ? BindTypes.null : bindType + ) { + case BindTypes.null: + rc = capi.sqlite3_bind_null(stmt.pointer, ndx); + break; + case BindTypes.string: + rc = f._.string(stmt, ndx, val, false); + break; + case BindTypes.number: { + let m; + if (util.isInt32(val)) m = capi.sqlite3_bind_int; + else if ('bigint' === typeof val) { + if (!util.bigIntFits64(val)) { + f._tooBigInt(val); + } else if (wasm.bigIntEnabled) { + m = capi.sqlite3_bind_int64; + } else if (util.bigIntFitsDouble(val)) { + val = Number(val); + m = capi.sqlite3_bind_double; + } else { + f._tooBigInt(val); + } + } else { + val = Number(val); + if (wasm.bigIntEnabled && Number.isInteger(val)) { + m = capi.sqlite3_bind_int64; + } else { + m = capi.sqlite3_bind_double; + } + } + rc = m(stmt.pointer, ndx, val); + break; + } + case BindTypes.boolean: + rc = capi.sqlite3_bind_int(stmt.pointer, ndx, val ? 1 : 0); + break; + case BindTypes.blob: { + if ('string' === typeof val) { + rc = f._.string(stmt, ndx, val, true); + break; + } else if (val instanceof ArrayBuffer) { + val = new Uint8Array(val); + } else if (!util.isBindableTypedArray(val)) { + toss3( + 'Binding a value as a blob requires', + 'that it be a string, Uint8Array, Int8Array, or ArrayBuffer.', + ); + } + const pBlob = wasm.alloc(val.byteLength || 1); + wasm.heap8().set(val.byteLength ? val : [0], pBlob); + rc = capi.sqlite3_bind_blob( + stmt.pointer, + ndx, + pBlob, + val.byteLength, + capi.SQLITE_WASM_DEALLOC, + ); + break; + } + default: + sqlite3.config.warn('Unsupported bind() argument type:', val); + toss3('Unsupported bind() argument type: ' + typeof val); + } + if (rc) DB.checkRc(stmt.db.pointer, rc); + stmt._mayGet = false; + return stmt; + }; + + Stmt.prototype = { + finalize: function () { + if (this.pointer) { + affirmNotLockedByExec(this, 'finalize()'); + const rc = capi.sqlite3_finalize(this.pointer); + delete __stmtMap.get(this.db)[this.pointer]; + __ptrMap.delete(this); + delete this._mayGet; + delete this.parameterCount; + delete this._lockedByExec; + delete this.db; + return rc; + } + }, + + clearBindings: function () { + affirmNotLockedByExec(affirmStmtOpen(this), 'clearBindings()'); + capi.sqlite3_clear_bindings(this.pointer); + this._mayGet = false; + return this; + }, + + reset: function (alsoClearBinds) { + affirmNotLockedByExec(this, 'reset()'); + if (alsoClearBinds) this.clearBindings(); + const rc = capi.sqlite3_reset(affirmStmtOpen(this).pointer); + this._mayGet = false; + checkSqlite3Rc(this.db, rc); + return this; + }, + + bind: function () { + affirmStmtOpen(this); + let ndx, arg; + switch (arguments.length) { + case 1: + ndx = 1; + arg = arguments[0]; + break; + case 2: + ndx = arguments[0]; + arg = arguments[1]; + break; + default: + toss3('Invalid bind() arguments.'); + } + if (undefined === arg) { + return this; + } else if (!this.parameterCount) { + toss3('This statement has no bindable parameters.'); + } + this._mayGet = false; + if (null === arg) { + return bindOne(this, ndx, BindTypes.null, arg); + } else if (Array.isArray(arg)) { + if (1 !== arguments.length) { + toss3( + 'When binding an array, an index argument is not permitted.', + ); + } + arg.forEach((v, i) => + bindOne(this, i + 1, affirmSupportedBindType(v), v), + ); + return this; + } else if (arg instanceof ArrayBuffer) { + arg = new Uint8Array(arg); + } + if ('object' === typeof arg && !util.isBindableTypedArray(arg)) { + if (1 !== arguments.length) { + toss3( + 'When binding an object, an index argument is not permitted.', + ); + } + Object.keys(arg).forEach((k) => + bindOne(this, k, affirmSupportedBindType(arg[k]), arg[k]), + ); + return this; + } else { + return bindOne(this, ndx, affirmSupportedBindType(arg), arg); + } + toss3('Should not reach this point.'); + }, + + bindAsBlob: function (ndx, arg) { + affirmStmtOpen(this); + if (1 === arguments.length) { + arg = ndx; + ndx = 1; + } + const t = affirmSupportedBindType(arg); + if ( + BindTypes.string !== t && + BindTypes.blob !== t && + BindTypes.null !== t + ) { + toss3('Invalid value type for bindAsBlob()'); + } + return bindOne(this, ndx, BindTypes.blob, arg); + }, + + step: function () { + affirmNotLockedByExec(this, 'step()'); + const rc = capi.sqlite3_step(affirmStmtOpen(this).pointer); + switch (rc) { + case capi.SQLITE_DONE: + return (this._mayGet = false); + case capi.SQLITE_ROW: + return (this._mayGet = true); + default: + this._mayGet = false; + sqlite3.config.warn( + 'sqlite3_step() rc=', + rc, + capi.sqlite3_js_rc_str(rc), + 'SQL =', + capi.sqlite3_sql(this.pointer), + ); + DB.checkRc(this.db.pointer, rc); + } + }, + + stepReset: function () { + this.step(); + return this.reset(); + }, + + stepFinalize: function () { + try { + const rc = this.step(); + this.reset(); + return rc; + } finally { + try { + this.finalize(); + } catch (e) {} + } + }, + + get: function (ndx, asType) { + if (!affirmStmtOpen(this)._mayGet) { + toss3('Stmt.step() has not (recently) returned true.'); + } + if (Array.isArray(ndx)) { + let i = 0; + const n = this.columnCount; + while (i < n) { + ndx[i] = this.get(i++); + } + return ndx; + } else if (ndx && 'object' === typeof ndx) { + let i = 0; + const n = this.columnCount; + while (i < n) { + ndx[capi.sqlite3_column_name(this.pointer, i)] = this.get(i++); + } + return ndx; + } + affirmColIndex(this, ndx); + switch ( + undefined === asType + ? capi.sqlite3_column_type(this.pointer, ndx) + : asType + ) { + case capi.SQLITE_NULL: + return null; + case capi.SQLITE_INTEGER: { + if (wasm.bigIntEnabled) { + const rc = capi.sqlite3_column_int64(this.pointer, ndx); + if ( + rc >= Number.MIN_SAFE_INTEGER && + rc <= Number.MAX_SAFE_INTEGER + ) { + return Number(rc).valueOf(); + } + return rc; + } else { + const rc = capi.sqlite3_column_double(this.pointer, ndx); + if ( + rc > Number.MAX_SAFE_INTEGER || + rc < Number.MIN_SAFE_INTEGER + ) { + toss3( + 'Integer is out of range for JS integer range: ' + rc, + ); + } + + return util.isInt32(rc) ? rc | 0 : rc; + } + } + case capi.SQLITE_FLOAT: + return capi.sqlite3_column_double(this.pointer, ndx); + case capi.SQLITE_TEXT: + return capi.sqlite3_column_text(this.pointer, ndx); + case capi.SQLITE_BLOB: { + const n = capi.sqlite3_column_bytes(this.pointer, ndx), + ptr = capi.sqlite3_column_blob(this.pointer, ndx), + rc = new Uint8Array(n); + + if (n) rc.set(wasm.heap8u().slice(ptr, ptr + n), 0); + + if (n && this.db._blobXfer instanceof Array) { + this.db._blobXfer.push(rc.buffer); + } + return rc; + } + default: + toss3( + "Don't know how to translate", + 'type of result column #' + ndx + '.', + ); + } + toss3('Not reached.'); + }, + + getInt: function (ndx) { + return this.get(ndx, capi.SQLITE_INTEGER); + }, + + getFloat: function (ndx) { + return this.get(ndx, capi.SQLITE_FLOAT); + }, + + getString: function (ndx) { + return this.get(ndx, capi.SQLITE_TEXT); + }, + + getBlob: function (ndx) { + return this.get(ndx, capi.SQLITE_BLOB); + }, + + getJSON: function (ndx) { + const s = this.get(ndx, capi.SQLITE_STRING); + return null === s ? s : JSON.parse(s); + }, + + getColumnName: function (ndx) { + return capi.sqlite3_column_name( + affirmColIndex(affirmStmtOpen(this), ndx).pointer, + ndx, + ); + }, + + getColumnNames: function (tgt = []) { + affirmColIndex(affirmStmtOpen(this), 0); + const n = this.columnCount; + for (let i = 0; i < n; ++i) { + tgt.push(capi.sqlite3_column_name(this.pointer, i)); + } + return tgt; + }, + + getParamIndex: function (name) { + return affirmStmtOpen(this).parameterCount + ? capi.sqlite3_bind_parameter_index(this.pointer, name) + : undefined; + }, + + getParamName: function (ndx) { + return affirmStmtOpen(this).parameterCount + ? capi.sqlite3_bind_parameter_name(this.pointer, ndx) + : undefined; + }, + + isBusy: function () { + return 0 !== capi.sqlite3_stmt_busy(affirmStmtOpen(this)); + }, + + isReadOnly: function () { + return 0 !== capi.sqlite3_stmt_readonly(affirmStmtOpen(this)); + }, + }; + + { + const prop = { + enumerable: true, + get: function () { + return __ptrMap.get(this); + }, + set: () => toss3('The pointer property is read-only.'), + }; + Object.defineProperty(Stmt.prototype, 'pointer', prop); + Object.defineProperty(DB.prototype, 'pointer', prop); + } + + Object.defineProperty(Stmt.prototype, 'columnCount', { + enumerable: false, + get: function () { + return capi.sqlite3_column_count(this.pointer); + }, + set: () => toss3('The columnCount property is read-only.'), + }); + + sqlite3.oo1 = { + DB, + Stmt, + }; + + if (util.isUIThread()) { + sqlite3.oo1.JsStorageDb = function (storageName = 'session') { + const opt = dbCtorHelper.normalizeArgs(...arguments); + storageName = opt.filename; + if ('session' !== storageName && 'local' !== storageName) { + toss3("JsStorageDb db name must be one of 'session' or 'local'."); + } + opt.vfs = 'kvvfs'; + dbCtorHelper.call(this, opt); + }; + const jdb = sqlite3.oo1.JsStorageDb; + jdb.prototype = Object.create(DB.prototype); + + jdb.clearStorage = capi.sqlite3_js_kvvfs_clear; + + jdb.prototype.clearStorage = function () { + return jdb.clearStorage(affirmDbOpen(this).filename); + }; + + jdb.storageSize = capi.sqlite3_js_kvvfs_size; + + jdb.prototype.storageSize = function () { + return jdb.storageSize(affirmDbOpen(this).filename); + }; + } + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const util = sqlite3.util; + sqlite3.initWorker1API = function () { + 'use strict'; + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + if (!(globalThis.WorkerGlobalScope instanceof Function)) { + toss('initWorker1API() must be run from a Worker thread.'); + } + const sqlite3 = this.sqlite3 || toss('Missing this.sqlite3 object.'); + const DB = sqlite3.oo1.DB; + + const getDbId = function (db) { + let id = wState.idMap.get(db); + if (id) return id; + id = 'db#' + ++wState.idSeq + '@' + db.pointer; + + wState.idMap.set(db, id); + return id; + }; + + const wState = { + dbList: [], + + idSeq: 0, + + idMap: new WeakMap(), + + xfer: [], + open: function (opt) { + const db = new DB(opt); + this.dbs[getDbId(db)] = db; + if (this.dbList.indexOf(db) < 0) this.dbList.push(db); + return db; + }, + close: function (db, alsoUnlink) { + if (db) { + delete this.dbs[getDbId(db)]; + const filename = db.filename; + const pVfs = util.sqlite3__wasm_db_vfs(db.pointer, 0); + db.close(); + const ddNdx = this.dbList.indexOf(db); + if (ddNdx >= 0) this.dbList.splice(ddNdx, 1); + if (alsoUnlink && filename && pVfs) { + util.sqlite3__wasm_vfs_unlink(pVfs, filename); + } + } + }, + + post: function (msg, xferList) { + if (xferList && xferList.length) { + globalThis.postMessage(msg, Array.from(xferList)); + xferList.length = 0; + } else { + globalThis.postMessage(msg); + } + }, + + dbs: Object.create(null), + + getDb: function (id, require = true) { + return ( + this.dbs[id] || + (require ? toss('Unknown (or closed) DB ID:', id) : undefined) + ); + }, + }; + + const affirmDbOpen = function (db = wState.dbList[0]) { + return db && db.pointer ? db : toss('DB is not opened.'); + }; + + const getMsgDb = function (msgData, affirmExists = true) { + const db = wState.getDb(msgData.dbId, false) || wState.dbList[0]; + return affirmExists ? affirmDbOpen(db) : db; + }; + + const getDefaultDbId = function () { + return wState.dbList[0] && getDbId(wState.dbList[0]); + }; + + const isSpecialDbFilename = (n) => { + return '' === n || ':' === n[0]; + }; + + const wMsgHandler = { + open: function (ev) { + const oargs = Object.create(null), + args = ev.args || Object.create(null); + if (args.simulateError) { + toss('Throwing because of simulateError flag.'); + } + const rc = Object.create(null); + oargs.vfs = args.vfs; + oargs.filename = args.filename || ''; + const db = wState.open(oargs); + rc.filename = db.filename; + rc.persistent = !!sqlite3.capi.sqlite3_js_db_uses_vfs( + db.pointer, + 'opfs', + ); + rc.dbId = getDbId(db); + rc.vfs = db.dbVfsName(); + return rc; + }, + + close: function (ev) { + const db = getMsgDb(ev, false); + const response = { + filename: db && db.filename, + }; + if (db) { + const doUnlink = + ev.args && 'object' === typeof ev.args + ? !!ev.args.unlink + : false; + wState.close(db, doUnlink); + } + return response; + }, + + exec: function (ev) { + const rc = + 'string' === typeof ev.args + ? { sql: ev.args } + : ev.args || Object.create(null); + if ('stmt' === rc.rowMode) { + toss( + "Invalid rowMode for 'exec': stmt mode", + 'does not work in the Worker API.', + ); + } else if (!rc.sql) { + toss("'exec' requires input SQL."); + } + const db = getMsgDb(ev); + if (rc.callback || Array.isArray(rc.resultRows)) { + db._blobXfer = wState.xfer; + } + const theCallback = rc.callback; + let rowNumber = 0; + const hadColNames = !!rc.columnNames; + if ('string' === typeof theCallback) { + if (!hadColNames) rc.columnNames = []; + + rc.callback = function (row, stmt) { + wState.post( + { + type: theCallback, + columnNames: rc.columnNames, + rowNumber: ++rowNumber, + row: row, + }, + wState.xfer, + ); + }; + } + try { + const changeCount = !!rc.countChanges + ? db.changes(true, 64 === rc.countChanges) + : undefined; + db.exec(rc); + if (undefined !== changeCount) { + rc.changeCount = + db.changes(true, 64 === rc.countChanges) - changeCount; + } + const lastInsertRowId = !!rc.lastInsertRowId + ? sqlite3.capi.sqlite3_last_insert_rowid(db) + : undefined; + if (undefined !== lastInsertRowId) { + rc.lastInsertRowId = lastInsertRowId; + } + if (rc.callback instanceof Function) { + rc.callback = theCallback; + + wState.post({ + type: theCallback, + columnNames: rc.columnNames, + rowNumber: null, + row: undefined, + }); + } + } finally { + delete db._blobXfer; + if (rc.callback) rc.callback = theCallback; + } + return rc; + }, + + 'config-get': function () { + const rc = Object.create(null), + src = sqlite3.config; + ['bigIntEnabled'].forEach(function (k) { + if (Object.getOwnPropertyDescriptor(src, k)) rc[k] = src[k]; + }); + rc.version = sqlite3.version; + rc.vfsList = sqlite3.capi.sqlite3_js_vfs_list(); + return rc; + }, + + export: function (ev) { + const db = getMsgDb(ev); + const response = { + byteArray: sqlite3.capi.sqlite3_js_db_export(db.pointer), + filename: db.filename, + mimetype: 'application/x-sqlite3', + }; + wState.xfer.push(response.byteArray.buffer); + return response; + }, + + toss: function (ev) { + toss('Testing worker exception'); + }, + }; + + globalThis.onmessage = async function (ev) { + ev = ev.data; + let result, + dbId = ev.dbId, + evType = ev.type; + const arrivalTime = performance.now(); + try { + if ( + wMsgHandler.hasOwnProperty(evType) && + wMsgHandler[evType] instanceof Function + ) { + result = await wMsgHandler[evType](ev); + } else { + toss('Unknown db worker message type:', ev.type); + } + } catch (err) { + evType = 'error'; + result = { + operation: ev.type, + message: err.message, + errorClass: err.name, + input: ev, + }; + if (err.stack) { + result.stack = + 'string' === typeof err.stack + ? err.stack.split(/\n\s*/) + : err.stack; + } + if (0) + sqlite3.config.warn( + 'Worker is propagating an exception to main thread.', + 'Reporting it _here_ for the stack trace:', + err, + result, + ); + } + if (!dbId) { + dbId = result.dbId || getDefaultDbId(); + } + + wState.post( + { + type: evType, + dbId: dbId, + messageId: ev.messageId, + workerReceivedTime: arrivalTime, + workerRespondTime: performance.now(), + departureTime: ev.departureTime, + + result: result, + }, + wState.xfer, + ); + }; + globalThis.postMessage({ + type: 'sqlite3-api', + result: 'worker1-ready', + }); + }.bind({ sqlite3 }); + }); + + ('use strict'); + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const wasm = sqlite3.wasm, + capi = sqlite3.capi, + toss = sqlite3.util.toss3; + const vfs = Object.create(null); + sqlite3.vfs = vfs; + + capi.sqlite3_vfs.prototype.registerVfs = function (asDefault = false) { + if (!(this instanceof sqlite3.capi.sqlite3_vfs)) { + toss('Expecting a sqlite3_vfs-type argument.'); + } + const rc = capi.sqlite3_vfs_register(this, asDefault ? 1 : 0); + if (rc) { + toss('sqlite3_vfs_register(', this, ') failed with rc', rc); + } + if (this.pointer !== capi.sqlite3_vfs_find(this.$zName)) { + toss( + 'BUG: sqlite3_vfs_find(vfs.$zName) failed for just-installed VFS', + this, + ); + } + return this; + }; + + vfs.installVfs = function (opt) { + let count = 0; + const propList = ['io', 'vfs']; + for (const key of propList) { + const o = opt[key]; + if (o) { + ++count; + o.struct.installMethods(o.methods, !!o.applyArgcCheck); + if ('vfs' === key) { + if (!o.struct.$zName && 'string' === typeof o.name) { + o.struct.addOnDispose( + (o.struct.$zName = wasm.allocCString(o.name)), + ); + } + o.struct.registerVfs(!!o.asDefault); + } + } + } + if (!count) + toss( + 'Misuse: installVfs() options object requires at least', + 'one of:', + propList, + ); + return this; + }; + }); + + ('use strict'); + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + if (!sqlite3.wasm.exports.sqlite3_declare_vtab) { + return; + } + const wasm = sqlite3.wasm, + capi = sqlite3.capi, + toss = sqlite3.util.toss3; + const vtab = Object.create(null); + sqlite3.vtab = vtab; + + const sii = capi.sqlite3_index_info; + + sii.prototype.nthConstraint = function (n, asPtr = false) { + if (n < 0 || n >= this.$nConstraint) return false; + const ptr = + this.$aConstraint + + sii.sqlite3_index_constraint.structInfo.sizeof * n; + return asPtr ? ptr : new sii.sqlite3_index_constraint(ptr); + }; + + sii.prototype.nthConstraintUsage = function (n, asPtr = false) { + if (n < 0 || n >= this.$nConstraint) return false; + const ptr = + this.$aConstraintUsage + + sii.sqlite3_index_constraint_usage.structInfo.sizeof * n; + return asPtr ? ptr : new sii.sqlite3_index_constraint_usage(ptr); + }; + + sii.prototype.nthOrderBy = function (n, asPtr = false) { + if (n < 0 || n >= this.$nOrderBy) return false; + const ptr = + this.$aOrderBy + sii.sqlite3_index_orderby.structInfo.sizeof * n; + return asPtr ? ptr : new sii.sqlite3_index_orderby(ptr); + }; + + const __xWrapFactory = function (methodName, StructType) { + return function (ptr, removeMapping = false) { + if (0 === arguments.length) ptr = new StructType(); + if (ptr instanceof StructType) { + this.set(ptr.pointer, ptr); + return ptr; + } else if (!wasm.isPtr(ptr)) { + sqlite3.SQLite3Error.toss( + 'Invalid argument to', + methodName + '()', + ); + } + let rc = this.get(ptr); + if (removeMapping) this.delete(ptr); + return rc; + }.bind(new Map()); + }; + + const StructPtrMapper = function (name, StructType) { + const __xWrap = __xWrapFactory(name, StructType); + + return Object.assign(Object.create(null), { + StructType, + + create: (ppOut) => { + const rc = __xWrap(); + wasm.pokePtr(ppOut, rc.pointer); + return rc; + }, + + get: (pCObj) => __xWrap(pCObj), + + unget: (pCObj) => __xWrap(pCObj, true), + + dispose: (pCObj) => { + const o = __xWrap(pCObj, true); + if (o) o.dispose(); + }, + }); + }; + + vtab.xVtab = StructPtrMapper('xVtab', capi.sqlite3_vtab); + + vtab.xCursor = StructPtrMapper('xCursor', capi.sqlite3_vtab_cursor); + + vtab.xIndexInfo = (pIdxInfo) => new capi.sqlite3_index_info(pIdxInfo); + + vtab.xError = function f(methodName, err, defaultRc) { + if (f.errorReporter instanceof Function) { + try { + f.errorReporter( + 'sqlite3_module::' + methodName + '(): ' + err.message, + ); + } catch (e) {} + } + let rc; + if (err instanceof sqlite3.WasmAllocError) rc = capi.SQLITE_NOMEM; + else if (arguments.length > 2) rc = defaultRc; + else if (err instanceof sqlite3.SQLite3Error) rc = err.resultCode; + return rc || capi.SQLITE_ERROR; + }; + vtab.xError.errorReporter = 1 ? console.error.bind(console) : false; + + vtab.xRowid = (ppRowid64, value) => wasm.poke(ppRowid64, value, 'i64'); + + vtab.setupModule = function (opt) { + let createdMod = false; + const mod = + this instanceof capi.sqlite3_module + ? this + : opt.struct || (createdMod = new capi.sqlite3_module()); + try { + const methods = opt.methods || toss("Missing 'methods' object."); + for (const e of Object.entries({ + xConnect: 'xCreate', + xDisconnect: 'xDestroy', + })) { + const k = e[0], + v = e[1]; + if (true === methods[k]) methods[k] = methods[v]; + else if (true === methods[v]) methods[v] = methods[k]; + } + if (opt.catchExceptions) { + const fwrap = function (methodName, func) { + if (['xConnect', 'xCreate'].indexOf(methodName) >= 0) { + return function (pDb, pAux, argc, argv, ppVtab, pzErr) { + try { + return func(...arguments) || 0; + } catch (e) { + if (!(e instanceof sqlite3.WasmAllocError)) { + wasm.dealloc(wasm.peekPtr(pzErr)); + wasm.pokePtr(pzErr, wasm.allocCString(e.message)); + } + return vtab.xError(methodName, e); + } + }; + } else { + return function (...args) { + try { + return func(...args) || 0; + } catch (e) { + return vtab.xError(methodName, e); + } + }; + } + }; + const mnames = [ + 'xCreate', + 'xConnect', + 'xBestIndex', + 'xDisconnect', + 'xDestroy', + 'xOpen', + 'xClose', + 'xFilter', + 'xNext', + 'xEof', + 'xColumn', + 'xRowid', + 'xUpdate', + 'xBegin', + 'xSync', + 'xCommit', + 'xRollback', + 'xFindFunction', + 'xRename', + 'xSavepoint', + 'xRelease', + 'xRollbackTo', + 'xShadowName', + ]; + const remethods = Object.create(null); + for (const k of mnames) { + const m = methods[k]; + if (!(m instanceof Function)) continue; + else if ('xConnect' === k && methods.xCreate === m) { + remethods[k] = methods.xCreate; + } else if ('xCreate' === k && methods.xConnect === m) { + remethods[k] = methods.xConnect; + } else { + remethods[k] = fwrap(k, m); + } + } + mod.installMethods(remethods, false); + } else { + mod.installMethods(methods, !!opt.applyArgcCheck); + } + if (0 === mod.$iVersion) { + let v; + if ('number' === typeof opt.iVersion) v = opt.iVersion; + else if (mod.$xShadowName) v = 3; + else if (mod.$xSavePoint || mod.$xRelease || mod.$xRollbackTo) + v = 2; + else v = 1; + mod.$iVersion = v; + } + } catch (e) { + if (createdMod) createdMod.dispose(); + throw e; + } + return mod; + }; + + capi.sqlite3_module.prototype.setupModule = function (opt) { + return vtab.setupModule.call(this, opt); + }; + }); + + ('use strict'); + if ('undefined' !== typeof Module) { + const SABC = Object.assign( + Object.create(null), + { + exports: + 'undefined' === typeof wasmExports ? Module['asm'] : wasmExports, + memory: Module.wasmMemory, + }, + globalThis.sqlite3ApiConfig || {}, + ); + + globalThis.sqlite3ApiConfig = SABC; + let sqlite3; + try { + sqlite3 = globalThis.sqlite3ApiBootstrap(); + } catch (e) { + console.error('sqlite3ApiBootstrap() error:', e); + throw e; + } finally { + delete globalThis.sqlite3ApiBootstrap; + delete globalThis.sqlite3ApiConfig; + } + + Module.sqlite3 = sqlite3; + } 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.', + ); + } + }; + + moduleRtn = readyPromise; + + return moduleRtn; + }; +})(); + +const toExportForESM = (function () { + const originalInit = sqlite3InitModule; + if (!originalInit) { + throw new Error( + 'Expecting globalThis.sqlite3InitModule to be defined by the Emscripten build.', + ); + } + + const initModuleState = (globalThis.sqlite3InitModuleState = Object.assign( + Object.create(null), + { + moduleScript: globalThis?.document?.currentScript, + isWorker: 'undefined' !== typeof WorkerGlobalScope, + location: globalThis.location, + urlParams: globalThis?.location?.href + ? new URL(globalThis.location.href).searchParams + : new URLSearchParams(), + }, + )); + initModuleState.debugModule = initModuleState.urlParams.has( + 'sqlite3.debugModule', + ) + ? (...args) => console.warn('sqlite3.debugModule:', ...args) + : () => {}; + + if (initModuleState.urlParams.has('sqlite3.dir')) { + initModuleState.sqlite3Dir = + initModuleState.urlParams.get('sqlite3.dir') + '/'; + } else if (initModuleState.moduleScript) { + const li = initModuleState.moduleScript.src.split('/'); + li.pop(); + initModuleState.sqlite3Dir = li.join('/') + '/'; + } + + globalThis.sqlite3InitModule = function ff(...args) { + return originalInit(...args) + .then((EmscriptenModule) => { + EmscriptenModule.runSQLite3PostLoadInit(EmscriptenModule); + const s = EmscriptenModule.sqlite3; + s.scriptInfo = initModuleState; + + if (ff.__isUnderTest) s.__isUnderTest = true; + const f = s.asyncPostInit; + delete s.asyncPostInit; + const rv = f(); + return rv; + }) + .catch((e) => { + console.error('Exception loading sqlite3 module:', e); + throw e; + }); + }; + globalThis.sqlite3InitModule.ready = originalInit.ready; + + if (globalThis.sqlite3InitModuleState.moduleScript) { + const sim = globalThis.sqlite3InitModuleState; + let src = sim.moduleScript.src.split('/'); + src.pop(); + sim.scriptDir = src.join('/') + '/'; + } + initModuleState.debugModule('sqlite3InitModuleState =', initModuleState); + if (0) { + console.warn('Replaced sqlite3InitModule()'); + console.warn('globalThis.location.href =', globalThis.location.href); + if ('undefined' !== typeof document) { + console.warn( + 'document.currentScript.src =', + document?.currentScript?.src, + ); + } + } + return globalThis.sqlite3InitModule; +})(); +sqlite3InitModule = toExportForESM; +export default sqlite3InitModule; diff --git a/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-opfs-async-proxy.js b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-opfs-async-proxy.js new file mode 100644 index 0000000..9f5e840 --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-opfs-async-proxy.js @@ -0,0 +1,691 @@ +/* + 2022-09-16 + + The author disclaims copyright to this source code. In place of a + legal notice, here is a blessing: + + * May you do good and not evil. + * May you find forgiveness for yourself and forgive others. + * May you share freely, never taking more than you give. + + *********************************************************************** + + A Worker which manages asynchronous OPFS handles on behalf of a + synchronous API which controls it via a combination of Worker + messages, SharedArrayBuffer, and Atomics. It is the asynchronous + counterpart of the API defined in sqlite3-vfs-opfs.js. + + Highly indebted to: + + https://github.com/rhashimoto/wa-sqlite/blob/master/src/examples/OriginPrivateFileSystemVFS.js + + for demonstrating how to use the OPFS APIs. + + This file is to be loaded as a Worker. It does not have any direct + access to the sqlite3 JS/WASM bits, so any bits which it needs (most + notably SQLITE_xxx integer codes) have to be imported into it via an + initialization process. + + This file represents an implementation detail of a larger piece of + code, and not a public interface. Its details may change at any time + and are not intended to be used by any client-level code. + + 2022-11-27: Chrome v108 changes some async methods to synchronous, as + documented at: + + https://developer.chrome.com/blog/sync-methods-for-accesshandles/ + + Firefox v111 and Safari 16.4, both released in March 2023, also + include this. + + We cannot change to the sync forms at this point without breaking + clients who use Chrome v104-ish or higher. truncate(), getSize(), + flush(), and close() are now (as of v108) synchronous. Calling them + with an "await", as we have to for the async forms, is still legal + with the sync forms but is superfluous. Calling the async forms with + theFunc().then(...) is not compatible with the change to + synchronous, but we do do not use those APIs that way. i.e. we don't + _need_ to change anything for this, but at some point (after Chrome + versions (approximately) 104-107 are extinct) should change our + usage of those methods to remove the "await". +*/ +'use strict'; +const wPost = (type, ...args) => postMessage({ type, payload: args }); +const installAsyncProxy = function () { + const toss = function (...args) { + throw new Error(args.join(' ')); + }; + if (globalThis.window === globalThis) { + toss( + 'This code cannot run from the main thread.', + 'Load it as a Worker from a separate Worker.', + ); + } else if (!navigator?.storage?.getDirectory) { + toss('This API requires navigator.storage.getDirectory.'); + } + + const state = Object.create(null); + + state.verbose = 1; + + const loggers = { + 0: console.error.bind(console), + 1: console.warn.bind(console), + 2: console.log.bind(console), + }; + const logImpl = (level, ...args) => { + if (state.verbose > level) loggers[level]('OPFS asyncer:', ...args); + }; + const log = (...args) => logImpl(2, ...args); + const warn = (...args) => logImpl(1, ...args); + const error = (...args) => logImpl(0, ...args); + + const __openFiles = Object.create(null); + + const __implicitLocks = new Set(); + + const getResolvedPath = function (filename, splitIt) { + const p = new URL(filename, 'file://irrelevant').pathname; + return splitIt ? p.split('/').filter((v) => !!v) : p; + }; + + const getDirForFilename = async function f(absFilename, createDirs = false) { + const path = getResolvedPath(absFilename, true); + const filename = path.pop(); + let dh = state.rootDir; + for (const dirName of path) { + if (dirName) { + dh = await dh.getDirectoryHandle(dirName, { create: !!createDirs }); + } + } + return [dh, filename]; + }; + + const closeSyncHandle = async (fh) => { + if (fh.syncHandle) { + log('Closing sync handle for', fh.filenameAbs); + const h = fh.syncHandle; + delete fh.syncHandle; + delete fh.xLock; + __implicitLocks.delete(fh.fid); + return h.close(); + } + }; + + const closeSyncHandleNoThrow = async (fh) => { + try { + await closeSyncHandle(fh); + } catch (e) { + warn('closeSyncHandleNoThrow() ignoring:', e, fh); + } + }; + + const releaseImplicitLocks = async () => { + if (__implicitLocks.size) { + for (const fid of __implicitLocks) { + const fh = __openFiles[fid]; + await closeSyncHandleNoThrow(fh); + log('Auto-unlocked', fid, fh.filenameAbs); + } + } + }; + + const releaseImplicitLock = async (fh) => { + if (fh.releaseImplicitLocks && __implicitLocks.has(fh.fid)) { + return closeSyncHandleNoThrow(fh); + } + }; + + class GetSyncHandleError extends Error { + constructor(errorObject, ...msg) { + super( + [...msg, ': ' + errorObject.name + ':', errorObject.message].join(' '), + { + cause: errorObject, + }, + ); + this.name = 'GetSyncHandleError'; + } + } + + GetSyncHandleError.convertRc = (e, rc) => { + if (e instanceof GetSyncHandleError) { + if ( + e.cause.name === 'NoModificationAllowedError' || + (e.cause.name === 'DOMException' && + 0 === e.cause.message.indexOf('Access Handles cannot')) + ) { + return state.sq3Codes.SQLITE_BUSY; + } else if ('NotFoundError' === e.cause.name) { + return state.sq3Codes.SQLITE_CANTOPEN; + } + } else if ('NotFoundError' === e?.name) { + return state.sq3Codes.SQLITE_CANTOPEN; + } + return rc; + }; + + const getSyncHandle = async (fh, opName) => { + if (!fh.syncHandle) { + const t = performance.now(); + log('Acquiring sync handle for', fh.filenameAbs); + const maxTries = 6, + msBase = state.asyncIdleWaitTime * 2; + let i = 1, + ms = msBase; + for (; true; ms = msBase * ++i) { + try { + fh.syncHandle = await fh.fileHandle.createSyncAccessHandle(); + break; + } catch (e) { + if (i === maxTries) { + throw new GetSyncHandleError( + e, + 'Error getting sync handle for', + opName + '().', + maxTries, + 'attempts failed.', + fh.filenameAbs, + ); + } + warn( + 'Error getting sync handle for', + opName + '(). Waiting', + ms, + 'ms and trying again.', + fh.filenameAbs, + e, + ); + Atomics.wait(state.sabOPView, state.opIds.retry, 0, ms); + } + } + log( + 'Got', + opName + '() sync handle for', + fh.filenameAbs, + 'in', + performance.now() - t, + 'ms', + ); + if (!fh.xLock) { + __implicitLocks.add(fh.fid); + log( + 'Acquired implicit lock for', + opName + '()', + fh.fid, + fh.filenameAbs, + ); + } + } + return fh.syncHandle; + }; + + const storeAndNotify = (opName, value) => { + log(opName + '() => notify(', value, ')'); + Atomics.store(state.sabOPView, state.opIds.rc, value); + Atomics.notify(state.sabOPView, state.opIds.rc); + }; + + const affirmNotRO = function (opName, fh) { + if (fh.readOnly) toss(opName + '(): File is read-only: ' + fh.filenameAbs); + }; + + let flagAsyncShutdown = false; + + const vfsAsyncImpls = { + 'opfs-async-shutdown': async () => { + flagAsyncShutdown = true; + storeAndNotify('opfs-async-shutdown', 0); + }, + mkdir: async (dirname) => { + let rc = 0; + try { + await getDirForFilename(dirname + '/filepart', true); + } catch (e) { + state.s11n.storeException(2, e); + rc = state.sq3Codes.SQLITE_IOERR; + } + storeAndNotify('mkdir', rc); + }, + xAccess: async (filename) => { + let rc = 0; + try { + const [dh, fn] = await getDirForFilename(filename); + await dh.getFileHandle(fn); + } catch (e) { + state.s11n.storeException(2, e); + rc = state.sq3Codes.SQLITE_IOERR; + } + storeAndNotify('xAccess', rc); + }, + xClose: async function (fid) { + const opName = 'xClose'; + __implicitLocks.delete(fid); + const fh = __openFiles[fid]; + let rc = 0; + if (fh) { + delete __openFiles[fid]; + await closeSyncHandle(fh); + if (fh.deleteOnClose) { + try { + await fh.dirHandle.removeEntry(fh.filenamePart); + } catch (e) { + warn('Ignoring dirHandle.removeEntry() failure of', fh, e); + } + } + } else { + state.s11n.serialize(); + rc = state.sq3Codes.SQLITE_NOTFOUND; + } + storeAndNotify(opName, rc); + }, + xDelete: async function (...args) { + const rc = await vfsAsyncImpls.xDeleteNoWait(...args); + storeAndNotify('xDelete', rc); + }, + xDeleteNoWait: async function (filename, syncDir = 0, recursive = false) { + let rc = 0; + try { + while (filename) { + const [hDir, filenamePart] = await getDirForFilename(filename, false); + if (!filenamePart) break; + await hDir.removeEntry(filenamePart, { recursive }); + if (0x1234 !== syncDir) break; + recursive = false; + filename = getResolvedPath(filename, true); + filename.pop(); + filename = filename.join('/'); + } + } catch (e) { + state.s11n.storeException(2, e); + rc = state.sq3Codes.SQLITE_IOERR_DELETE; + } + return rc; + }, + xFileSize: async function (fid) { + const fh = __openFiles[fid]; + let rc = 0; + try { + const sz = await (await getSyncHandle(fh, 'xFileSize')).getSize(); + state.s11n.serialize(Number(sz)); + } catch (e) { + state.s11n.storeException(1, e); + rc = GetSyncHandleError.convertRc(e, state.sq3Codes.SQLITE_IOERR); + } + await releaseImplicitLock(fh); + storeAndNotify('xFileSize', rc); + }, + xLock: async function (fid, lockType) { + const fh = __openFiles[fid]; + let rc = 0; + const oldLockType = fh.xLock; + fh.xLock = lockType; + if (!fh.syncHandle) { + try { + await getSyncHandle(fh, 'xLock'); + __implicitLocks.delete(fid); + } catch (e) { + state.s11n.storeException(1, e); + rc = GetSyncHandleError.convertRc( + e, + state.sq3Codes.SQLITE_IOERR_LOCK, + ); + fh.xLock = oldLockType; + } + } + storeAndNotify('xLock', rc); + }, + xOpen: async function (fid, filename, flags, opfsFlags) { + const opName = 'xOpen'; + const create = state.sq3Codes.SQLITE_OPEN_CREATE & flags; + try { + let hDir, filenamePart; + try { + [hDir, filenamePart] = await getDirForFilename(filename, !!create); + } catch (e) { + state.s11n.storeException(1, e); + storeAndNotify(opName, state.sq3Codes.SQLITE_NOTFOUND); + return; + } + if (state.opfsFlags.OPFS_UNLINK_BEFORE_OPEN & opfsFlags) { + try { + await hDir.removeEntry(filenamePart); + } catch (e) {} + } + const hFile = await hDir.getFileHandle(filenamePart, { create }); + const fh = Object.assign(Object.create(null), { + fid: fid, + filenameAbs: filename, + filenamePart: filenamePart, + dirHandle: hDir, + fileHandle: hFile, + sabView: state.sabFileBufView, + readOnly: !create && !!(state.sq3Codes.SQLITE_OPEN_READONLY & flags), + deleteOnClose: !!(state.sq3Codes.SQLITE_OPEN_DELETEONCLOSE & flags), + }); + fh.releaseImplicitLocks = + opfsFlags & state.opfsFlags.OPFS_UNLOCK_ASAP || + state.opfsFlags.defaultUnlockAsap; + __openFiles[fid] = fh; + storeAndNotify(opName, 0); + } catch (e) { + error(opName, e); + state.s11n.storeException(1, e); + storeAndNotify(opName, state.sq3Codes.SQLITE_IOERR); + } + }, + xRead: async function (fid, n, offset64) { + let rc = 0, + nRead; + const fh = __openFiles[fid]; + try { + nRead = (await getSyncHandle(fh, 'xRead')).read( + fh.sabView.subarray(0, n), + { at: Number(offset64) }, + ); + if (nRead < n) { + fh.sabView.fill(0, nRead, n); + rc = state.sq3Codes.SQLITE_IOERR_SHORT_READ; + } + } catch (e) { + error('xRead() failed', e, fh); + state.s11n.storeException(1, e); + rc = GetSyncHandleError.convertRc(e, state.sq3Codes.SQLITE_IOERR_READ); + } + await releaseImplicitLock(fh); + storeAndNotify('xRead', rc); + }, + xSync: async function (fid, flags) { + const fh = __openFiles[fid]; + let rc = 0; + if (!fh.readOnly && fh.syncHandle) { + try { + await fh.syncHandle.flush(); + } catch (e) { + state.s11n.storeException(2, e); + rc = state.sq3Codes.SQLITE_IOERR_FSYNC; + } + } + storeAndNotify('xSync', rc); + }, + xTruncate: async function (fid, size) { + let rc = 0; + const fh = __openFiles[fid]; + try { + affirmNotRO('xTruncate', fh); + await (await getSyncHandle(fh, 'xTruncate')).truncate(size); + } catch (e) { + error('xTruncate():', e, fh); + state.s11n.storeException(2, e); + rc = GetSyncHandleError.convertRc( + e, + state.sq3Codes.SQLITE_IOERR_TRUNCATE, + ); + } + await releaseImplicitLock(fh); + storeAndNotify('xTruncate', rc); + }, + xUnlock: async function (fid, lockType) { + let rc = 0; + const fh = __openFiles[fid]; + if (fh.syncHandle && state.sq3Codes.SQLITE_LOCK_NONE === lockType) { + try { + await closeSyncHandle(fh); + } catch (e) { + state.s11n.storeException(1, e); + rc = state.sq3Codes.SQLITE_IOERR_UNLOCK; + } + } + storeAndNotify('xUnlock', rc); + }, + xWrite: async function (fid, n, offset64) { + let rc; + const fh = __openFiles[fid]; + try { + affirmNotRO('xWrite', fh); + rc = + n === + (await getSyncHandle(fh, 'xWrite')).write(fh.sabView.subarray(0, n), { + at: Number(offset64), + }) + ? 0 + : state.sq3Codes.SQLITE_IOERR_WRITE; + } catch (e) { + error('xWrite():', e, fh); + state.s11n.storeException(1, e); + rc = GetSyncHandleError.convertRc(e, state.sq3Codes.SQLITE_IOERR_WRITE); + } + await releaseImplicitLock(fh); + storeAndNotify('xWrite', rc); + }, + }; + + const initS11n = () => { + if (state.s11n) return state.s11n; + const textDecoder = new TextDecoder(), + textEncoder = new TextEncoder('utf-8'), + viewU8 = new Uint8Array( + state.sabIO, + state.sabS11nOffset, + state.sabS11nSize, + ), + viewDV = new DataView( + state.sabIO, + state.sabS11nOffset, + state.sabS11nSize, + ); + state.s11n = Object.create(null); + const TypeIds = Object.create(null); + TypeIds.number = { + id: 1, + size: 8, + getter: 'getFloat64', + setter: 'setFloat64', + }; + TypeIds.bigint = { + id: 2, + size: 8, + getter: 'getBigInt64', + setter: 'setBigInt64', + }; + TypeIds.boolean = { + id: 3, + size: 4, + getter: 'getInt32', + setter: 'setInt32', + }; + TypeIds.string = { id: 4 }; + const getTypeId = (v) => + TypeIds[typeof v] || + toss('Maintenance required: this value type cannot be serialized.', v); + const getTypeIdById = (tid) => { + switch (tid) { + case TypeIds.number.id: + return TypeIds.number; + case TypeIds.bigint.id: + return TypeIds.bigint; + case TypeIds.boolean.id: + return TypeIds.boolean; + case TypeIds.string.id: + return TypeIds.string; + default: + toss('Invalid type ID:', tid); + } + }; + state.s11n.deserialize = function (clear = false) { + const argc = viewU8[0]; + const rc = argc ? [] : null; + if (argc) { + const typeIds = []; + let offset = 1, + i, + n, + v; + for (i = 0; i < argc; ++i, ++offset) { + typeIds.push(getTypeIdById(viewU8[offset])); + } + for (i = 0; i < argc; ++i) { + const t = typeIds[i]; + if (t.getter) { + v = viewDV[t.getter](offset, state.littleEndian); + offset += t.size; + } else { + n = viewDV.getInt32(offset, state.littleEndian); + offset += 4; + v = textDecoder.decode(viewU8.slice(offset, offset + n)); + offset += n; + } + rc.push(v); + } + } + if (clear) viewU8[0] = 0; + + return rc; + }; + state.s11n.serialize = function (...args) { + if (args.length) { + const typeIds = []; + let i = 0, + offset = 1; + viewU8[0] = args.length & 0xff; + for (; i < args.length; ++i, ++offset) { + typeIds.push(getTypeId(args[i])); + viewU8[offset] = typeIds[i].id; + } + for (i = 0; i < args.length; ++i) { + const t = typeIds[i]; + if (t.setter) { + viewDV[t.setter](offset, args[i], state.littleEndian); + offset += t.size; + } else { + const s = textEncoder.encode(args[i]); + viewDV.setInt32(offset, s.byteLength, state.littleEndian); + offset += 4; + viewU8.set(s, offset); + offset += s.byteLength; + } + } + } else { + viewU8[0] = 0; + } + }; + + state.s11n.storeException = state.asyncS11nExceptions + ? (priority, e) => { + if (priority <= state.asyncS11nExceptions) { + state.s11n.serialize([e.name, ': ', e.message].join('')); + } + } + : () => {}; + + return state.s11n; + }; + + const waitLoop = async function f() { + const opHandlers = Object.create(null); + for (let k of Object.keys(state.opIds)) { + const vi = vfsAsyncImpls[k]; + if (!vi) continue; + const o = Object.create(null); + opHandlers[state.opIds[k]] = o; + o.key = k; + o.f = vi; + } + while (!flagAsyncShutdown) { + try { + if ( + 'not-equal' !== + Atomics.wait( + state.sabOPView, + state.opIds.whichOp, + 0, + state.asyncIdleWaitTime, + ) + ) { + await releaseImplicitLocks(); + continue; + } + const opId = Atomics.load(state.sabOPView, state.opIds.whichOp); + Atomics.store(state.sabOPView, state.opIds.whichOp, 0); + const hnd = + opHandlers[opId] ?? toss('No waitLoop handler for whichOp #', opId); + const args = state.s11n.deserialize(true) || []; + + if (hnd.f) await hnd.f(...args); + else error('Missing callback for opId', opId); + } catch (e) { + error('in waitLoop():', e); + } + } + }; + + navigator.storage + .getDirectory() + .then(function (d) { + state.rootDir = d; + globalThis.onmessage = function ({ data }) { + switch (data.type) { + case 'opfs-async-init': { + const opt = data.args; + for (const k in opt) state[k] = opt[k]; + state.verbose = opt.verbose ?? 1; + state.sabOPView = new Int32Array(state.sabOP); + state.sabFileBufView = new Uint8Array( + state.sabIO, + 0, + state.fileBufferSize, + ); + state.sabS11nView = new Uint8Array( + state.sabIO, + state.sabS11nOffset, + state.sabS11nSize, + ); + Object.keys(vfsAsyncImpls).forEach((k) => { + if (!Number.isFinite(state.opIds[k])) { + toss('Maintenance required: missing state.opIds[', k, ']'); + } + }); + initS11n(); + log('init state', state); + wPost('opfs-async-inited'); + waitLoop(); + break; + } + case 'opfs-async-restart': + if (flagAsyncShutdown) { + warn( + 'Restarting after opfs-async-shutdown. Might or might not work.', + ); + flagAsyncShutdown = false; + waitLoop(); + } + break; + } + }; + wPost('opfs-async-loaded'); + }) + .catch((e) => error('error initializing OPFS asyncer:', e)); +}; +if (!globalThis.SharedArrayBuffer) { + wPost( + 'opfs-unavailable', + 'Missing SharedArrayBuffer API.', + 'The server must emit the COOP/COEP response headers to enable that.', + ); +} else if (!globalThis.Atomics) { + wPost( + 'opfs-unavailable', + 'Missing Atomics API.', + 'The server must emit the COOP/COEP response headers to enable that.', + ); +} else if ( + !globalThis.FileSystemHandle || + !globalThis.FileSystemDirectoryHandle || + !globalThis.FileSystemFileHandle || + !globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle || + !navigator?.storage?.getDirectory +) { + wPost('opfs-unavailable', 'Missing required OPFS APIs.'); +} else { + installAsyncProxy(); +} diff --git a/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1-bundler-friendly.mjs b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1-bundler-friendly.mjs new file mode 100644 index 0000000..b5a0b18 --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1-bundler-friendly.mjs @@ -0,0 +1,35 @@ +/* + 2022-05-23 + + The author disclaims copyright to this source code. In place of a + legal notice, here is a blessing: + + * May you do good and not evil. + * May you find forgiveness for yourself and forgive others. + * May you share freely, never taking more than you give. + + *********************************************************************** + + This is a JS Worker file for the main sqlite3 api. It loads + sqlite3.js, initializes the module, and postMessage()'s a message + after the module is initialized: + + {type: 'sqlite3-api', result: 'worker1-ready'} + + This seemingly superfluous level of indirection is necessary when + loading sqlite3.js via a Worker. Instantiating a worker with new + Worker("sqlite.js") will not (cannot) call sqlite3InitModule() to + initialize the module due to a timing/order-of-operations conflict + (and that symbol is not exported in a way that a Worker loading it + that way can see it). Thus JS code wanting to load the sqlite3 + Worker-specific API needs to pass _this_ file (or equivalent) to the + Worker constructor and then listen for an event in the form shown + above in order to know when the module has completed initialization. + + This file accepts a URL arguments to adjust how it loads sqlite3.js: + + - `sqlite3.dir`, if set, treats the given directory name as the + directory from which `sqlite3.js` will be loaded. +*/ +import { default as sqlite3InitModule } from './sqlite3-bundler-friendly.mjs'; +sqlite3InitModule().then((sqlite3) => sqlite3.initWorker1API()); diff --git a/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1-promiser.js b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1-promiser.js new file mode 100644 index 0000000..06f4513 --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1-promiser.js @@ -0,0 +1,193 @@ +/* + 2022-08-24 + + The author disclaims copyright to this source code. In place of a + legal notice, here is a blessing: + + * May you do good and not evil. + * May you find forgiveness for yourself and forgive others. + * May you share freely, never taking more than you give. + + *********************************************************************** + + This file implements a Promise-based proxy for the sqlite3 Worker + API #1. It is intended to be included either from the main thread or + a Worker, but only if (A) the environment supports nested Workers + and (B) it's _not_ a Worker which loads the sqlite3 WASM/JS + module. This file's features will load that module and provide a + slightly simpler client-side interface than the slightly-lower-level + Worker API does. + + This script necessarily exposes one global symbol, but clients may + freely `delete` that symbol after calling it. +*/ +'use strict'; + +globalThis.sqlite3Worker1Promiser = function callee( + config = callee.defaultConfig, +) { + if (1 === arguments.length && 'function' === typeof arguments[0]) { + const f = config; + config = Object.assign(Object.create(null), callee.defaultConfig); + config.onready = f; + } else { + config = Object.assign(Object.create(null), callee.defaultConfig, config); + } + const handlerMap = Object.create(null); + const noop = function () {}; + const err = config.onerror || noop; + const debug = config.debug || noop; + const idTypeMap = config.generateMessageId ? undefined : Object.create(null); + const genMsgId = + config.generateMessageId || + function (msg) { + return ( + msg.type + '#' + (idTypeMap[msg.type] = (idTypeMap[msg.type] || 0) + 1) + ); + }; + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + if (!config.worker) config.worker = callee.defaultConfig.worker; + if ('function' === typeof config.worker) config.worker = config.worker(); + let dbId; + let promiserFunc; + config.worker.onmessage = function (ev) { + ev = ev.data; + debug('worker1.onmessage', ev); + let msgHandler = handlerMap[ev.messageId]; + if (!msgHandler) { + if (ev && 'sqlite3-api' === ev.type && 'worker1-ready' === ev.result) { + if (config.onready) config.onready(promiserFunc); + return; + } + msgHandler = handlerMap[ev.type]; + if (msgHandler && msgHandler.onrow) { + msgHandler.onrow(ev); + return; + } + if (config.onunhandled) config.onunhandled(arguments[0]); + else err('sqlite3Worker1Promiser() unhandled worker message:', ev); + return; + } + delete handlerMap[ev.messageId]; + switch (ev.type) { + case 'error': + msgHandler.reject(ev); + return; + case 'open': + if (!dbId) dbId = ev.dbId; + break; + case 'close': + if (ev.dbId === dbId) dbId = undefined; + break; + default: + break; + } + try { + msgHandler.resolve(ev); + } catch (e) { + msgHandler.reject(e); + } + }; + return (promiserFunc = function () { + let msg; + if (1 === arguments.length) { + msg = arguments[0]; + } else if (2 === arguments.length) { + msg = Object.create(null); + msg.type = arguments[0]; + msg.args = arguments[1]; + msg.dbId = msg.args.dbId; + } else { + toss('Invalid arguments for sqlite3Worker1Promiser()-created factory.'); + } + if (!msg.dbId && msg.type !== 'open') msg.dbId = dbId; + msg.messageId = genMsgId(msg); + msg.departureTime = performance.now(); + const proxy = Object.create(null); + proxy.message = msg; + let rowCallbackId; + if ('exec' === msg.type && msg.args) { + if ('function' === typeof msg.args.callback) { + rowCallbackId = msg.messageId + ':row'; + proxy.onrow = msg.args.callback; + msg.args.callback = rowCallbackId; + handlerMap[rowCallbackId] = proxy; + } else if ('string' === typeof msg.args.callback) { + toss( + 'exec callback may not be a string when using the Promise interface.', + ); + } + } + + let p = new Promise(function (resolve, reject) { + proxy.resolve = resolve; + proxy.reject = reject; + handlerMap[msg.messageId] = proxy; + debug( + 'Posting', + msg.type, + 'message to Worker dbId=' + (dbId || 'default') + ':', + msg, + ); + config.worker.postMessage(msg); + }); + if (rowCallbackId) p = p.finally(() => delete handlerMap[rowCallbackId]); + return p; + }); +}; + +globalThis.sqlite3Worker1Promiser.defaultConfig = { + worker: function () { + let theJs = 'sqlite3-worker1.js'; + if (this.currentScript) { + const src = this.currentScript.src.split('/'); + src.pop(); + theJs = src.join('/') + '/' + theJs; + } else if (globalThis.location) { + const urlParams = new URL(globalThis.location.href).searchParams; + if (urlParams.has('sqlite3.dir')) { + theJs = urlParams.get('sqlite3.dir') + '/' + theJs; + } + } + return new Worker(theJs + globalThis.location.search); + }.bind({ + currentScript: globalThis?.document?.currentScript, + }), + onerror: (...args) => console.error('worker1 promiser error', ...args), +}; + +sqlite3Worker1Promiser.v2 = function (config) { + let oldFunc; + if ('function' == typeof config) { + oldFunc = config; + config = {}; + } else if ('function' === typeof config?.onready) { + oldFunc = config.onready; + delete config.onready; + } + const promiseProxy = Object.create(null); + config = Object.assign(config || Object.create(null), { + onready: async function (func) { + try { + if (oldFunc) await oldFunc(func); + promiseProxy.resolve(func); + } catch (e) { + promiseProxy.reject(e); + } + }, + }); + const p = new Promise(function (resolve, reject) { + promiseProxy.resolve = resolve; + promiseProxy.reject = reject; + }); + try { + this.original(config); + } catch (e) { + promiseProxy.reject(e); + } + return p; +}.bind({ + original: sqlite3Worker1Promiser, +}); diff --git a/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1-promiser.mjs b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1-promiser.mjs new file mode 100644 index 0000000..e7e25b0 --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1-promiser.mjs @@ -0,0 +1,187 @@ +/* + 2022-08-24 + + The author disclaims copyright to this source code. In place of a + legal notice, here is a blessing: + + * May you do good and not evil. + * May you find forgiveness for yourself and forgive others. + * May you share freely, never taking more than you give. + + *********************************************************************** + + This file implements a Promise-based proxy for the sqlite3 Worker + API #1. It is intended to be included either from the main thread or + a Worker, but only if (A) the environment supports nested Workers + and (B) it's _not_ a Worker which loads the sqlite3 WASM/JS + module. This file's features will load that module and provide a + slightly simpler client-side interface than the slightly-lower-level + Worker API does. + + This script necessarily exposes one global symbol, but clients may + freely `delete` that symbol after calling it. +*/ +'use strict'; + +globalThis.sqlite3Worker1Promiser = function callee( + config = callee.defaultConfig, +) { + if (1 === arguments.length && 'function' === typeof arguments[0]) { + const f = config; + config = Object.assign(Object.create(null), callee.defaultConfig); + config.onready = f; + } else { + config = Object.assign(Object.create(null), callee.defaultConfig, config); + } + const handlerMap = Object.create(null); + const noop = function () {}; + const err = config.onerror || noop; + const debug = config.debug || noop; + const idTypeMap = config.generateMessageId ? undefined : Object.create(null); + const genMsgId = + config.generateMessageId || + function (msg) { + return ( + msg.type + '#' + (idTypeMap[msg.type] = (idTypeMap[msg.type] || 0) + 1) + ); + }; + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + if (!config.worker) config.worker = callee.defaultConfig.worker; + if ('function' === typeof config.worker) config.worker = config.worker(); + let dbId; + let promiserFunc; + config.worker.onmessage = function (ev) { + ev = ev.data; + debug('worker1.onmessage', ev); + let msgHandler = handlerMap[ev.messageId]; + if (!msgHandler) { + if (ev && 'sqlite3-api' === ev.type && 'worker1-ready' === ev.result) { + if (config.onready) config.onready(promiserFunc); + return; + } + msgHandler = handlerMap[ev.type]; + if (msgHandler && msgHandler.onrow) { + msgHandler.onrow(ev); + return; + } + if (config.onunhandled) config.onunhandled(arguments[0]); + else err('sqlite3Worker1Promiser() unhandled worker message:', ev); + return; + } + delete handlerMap[ev.messageId]; + switch (ev.type) { + case 'error': + msgHandler.reject(ev); + return; + case 'open': + if (!dbId) dbId = ev.dbId; + break; + case 'close': + if (ev.dbId === dbId) dbId = undefined; + break; + default: + break; + } + try { + msgHandler.resolve(ev); + } catch (e) { + msgHandler.reject(e); + } + }; + return (promiserFunc = function () { + let msg; + if (1 === arguments.length) { + msg = arguments[0]; + } else if (2 === arguments.length) { + msg = Object.create(null); + msg.type = arguments[0]; + msg.args = arguments[1]; + msg.dbId = msg.args.dbId; + } else { + toss('Invalid arguments for sqlite3Worker1Promiser()-created factory.'); + } + if (!msg.dbId && msg.type !== 'open') msg.dbId = dbId; + msg.messageId = genMsgId(msg); + msg.departureTime = performance.now(); + const proxy = Object.create(null); + proxy.message = msg; + let rowCallbackId; + if ('exec' === msg.type && msg.args) { + if ('function' === typeof msg.args.callback) { + rowCallbackId = msg.messageId + ':row'; + proxy.onrow = msg.args.callback; + msg.args.callback = rowCallbackId; + handlerMap[rowCallbackId] = proxy; + } else if ('string' === typeof msg.args.callback) { + toss( + 'exec callback may not be a string when using the Promise interface.', + ); + } + } + + let p = new Promise(function (resolve, reject) { + proxy.resolve = resolve; + proxy.reject = reject; + handlerMap[msg.messageId] = proxy; + debug( + 'Posting', + msg.type, + 'message to Worker dbId=' + (dbId || 'default') + ':', + msg, + ); + config.worker.postMessage(msg); + }); + if (rowCallbackId) p = p.finally(() => delete handlerMap[rowCallbackId]); + return p; + }); +}; + +globalThis.sqlite3Worker1Promiser.defaultConfig = { + worker: function () { + return new Worker( + new URL('sqlite3-worker1-bundler-friendly.mjs', import.meta.url), + { + type: 'module', + }, + ); + }, + onerror: (...args) => console.error('worker1 promiser error', ...args), +}; + +sqlite3Worker1Promiser.v2 = function (config) { + let oldFunc; + if ('function' == typeof config) { + oldFunc = config; + config = {}; + } else if ('function' === typeof config?.onready) { + oldFunc = config.onready; + delete config.onready; + } + const promiseProxy = Object.create(null); + config = Object.assign(config || Object.create(null), { + onready: async function (func) { + try { + if (oldFunc) await oldFunc(func); + promiseProxy.resolve(func); + } catch (e) { + promiseProxy.reject(e); + } + }, + }); + const p = new Promise(function (resolve, reject) { + promiseProxy.resolve = resolve; + promiseProxy.reject = reject; + }); + try { + this.original(config); + } catch (e) { + promiseProxy.reject(e); + } + return p; +}.bind({ + original: sqlite3Worker1Promiser, +}); + +export default sqlite3Worker1Promiser.v2; diff --git a/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1.js b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1.js new file mode 100644 index 0000000..de42e01 --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1.js @@ -0,0 +1,46 @@ +/* + 2022-05-23 + + The author disclaims copyright to this source code. In place of a + legal notice, here is a blessing: + + * May you do good and not evil. + * May you find forgiveness for yourself and forgive others. + * May you share freely, never taking more than you give. + + *********************************************************************** + + This is a JS Worker file for the main sqlite3 api. It loads + sqlite3.js, initializes the module, and postMessage()'s a message + after the module is initialized: + + {type: 'sqlite3-api', result: 'worker1-ready'} + + This seemingly superfluous level of indirection is necessary when + loading sqlite3.js via a Worker. Instantiating a worker with new + Worker("sqlite.js") will not (cannot) call sqlite3InitModule() to + initialize the module due to a timing/order-of-operations conflict + (and that symbol is not exported in a way that a Worker loading it + that way can see it). Thus JS code wanting to load the sqlite3 + Worker-specific API needs to pass _this_ file (or equivalent) to the + Worker constructor and then listen for an event in the form shown + above in order to know when the module has completed initialization. + + This file accepts a URL arguments to adjust how it loads sqlite3.js: + + - `sqlite3.dir`, if set, treats the given directory name as the + directory from which `sqlite3.js` will be loaded. +*/ +'use strict'; +{ + const urlParams = globalThis.location + ? new URL(globalThis.location.href).searchParams + : new URLSearchParams(); + let theJs = 'sqlite3.js'; + if (urlParams.has('sqlite3.dir')) { + theJs = urlParams.get('sqlite3.dir') + '/' + theJs; + } + + importScripts(theJs); +} +sqlite3InitModule().then((sqlite3) => sqlite3.initWorker1API()); diff --git a/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.js b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.js new file mode 100644 index 0000000..f697456 --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.js @@ -0,0 +1,14070 @@ +/* + ** LICENSE for the sqlite3 WebAssembly/JavaScript APIs. + ** + ** This bundle (typically released as sqlite3.js or sqlite3.mjs) + ** is an amalgamation of JavaScript source code from two projects: + ** + ** 1) https://emscripten.org: the Emscripten "glue code" is covered by + ** the terms of the MIT license and University of Illinois/NCSA + ** Open Source License, as described at: + ** + ** https://emscripten.org/docs/introducing_emscripten/emscripten_license.html + ** + ** 2) https://sqlite.org: all code and documentation labeled as being + ** from this source are released under the same terms as the sqlite3 + ** C library: + ** + ** 2022-10-16 + ** + ** The author disclaims copyright to this source code. In place of a + ** legal notice, here is a blessing: + ** + ** * May you do good and not evil. + ** * May you find forgiveness for yourself and forgive others. + ** * May you share freely, never taking more than you give. + */ +/* + ** This code was built from sqlite3 version... + ** + ** SQLITE_VERSION "3.50.4" + ** SQLITE_VERSION_NUMBER 3050004 + ** SQLITE_SOURCE_ID "2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3" + ** + ** Using the Emscripten SDK version 3.1.70. + */ + +var sqlite3InitModule = (() => { + var _scriptName = + typeof document != 'undefined' ? document.currentScript?.src : undefined; + + return function (moduleArg = {}) { + var moduleRtn; + + var Module = moduleArg; + + var readyPromiseResolve, readyPromiseReject; + var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; + }); + + var ENVIRONMENT_IS_WEB = typeof window == 'object'; + var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function'; + + var ENVIRONMENT_IS_NODE = + typeof process == 'object' && + typeof process.versions == 'object' && + typeof process.versions.node == 'string' && + process.type != 'renderer'; + var ENVIRONMENT_IS_SHELL = + !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + + const sqlite3InitModuleState = + globalThis.sqlite3InitModuleState || + Object.assign(Object.create(null), { + debugModule: () => {}, + }); + delete globalThis.sqlite3InitModuleState; + sqlite3InitModuleState.debugModule( + 'globalThis.location =', + globalThis.location, + ); + + Module['locateFile'] = function (path, prefix) { + 'use strict'; + let theFile; + const up = this.urlParams; + if (up.has(path)) { + theFile = up.get(path); + } else if (this.sqlite3Dir) { + theFile = this.sqlite3Dir + path; + } else if (this.scriptDir) { + theFile = this.scriptDir + path; + } else { + theFile = prefix + path; + } + this.debugModule( + 'locateFile(', + arguments[0], + ',', + arguments[1], + ')', + 'sqlite3InitModuleState.scriptDir =', + this.scriptDir, + 'up.entries() =', + Array.from(up.entries()), + 'result =', + theFile, + ); + return theFile; + }.bind(sqlite3InitModuleState); + + var moduleOverrides = Object.assign({}, Module); + + var arguments_ = []; + var thisProgram = './this.program'; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + + var scriptDirectory = ''; + function locateFile(path) { + if (Module['locateFile']) { + return Module['locateFile'](path, scriptDirectory); + } + return scriptDirectory + path; + } + + var readAsync, readBinary; + + if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != 'undefined' && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + + if (_scriptName) { + scriptDirectory = _scriptName; + } + + if (scriptDirectory.startsWith('blob:')) { + scriptDirectory = ''; + } else { + scriptDirectory = scriptDirectory.substr( + 0, + scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/') + 1, + ); + } + + { + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.responseType = 'arraybuffer'; + xhr.send(null); + return new Uint8Array(xhr.response); + }; + } + + readAsync = (url) => { + return fetch(url, { credentials: 'same-origin' }).then((response) => { + if (response.ok) { + return response.arrayBuffer(); + } + return Promise.reject( + new Error(response.status + ' : ' + response.url), + ); + }); + }; + } + } else { + } + + var out = Module['print'] || console.log.bind(console); + var err = Module['printErr'] || console.error.bind(console); + + Object.assign(Module, moduleOverrides); + + moduleOverrides = null; + + if (Module['arguments']) arguments_ = Module['arguments']; + + if (Module['thisProgram']) thisProgram = Module['thisProgram']; + + var wasmBinary = Module['wasmBinary']; + + var wasmMemory; + + var ABORT = false; + + var EXITSTATUS; + + function assert(condition, text) { + if (!condition) { + abort(text); + } + } + + var HEAP, + HEAP8, + HEAPU8, + HEAP16, + HEAPU16, + HEAP32, + HEAPU32, + HEAPF32, + HEAP64, + HEAPU64, + HEAPF64; + + function updateMemoryViews() { + var b = wasmMemory.buffer; + Module['HEAP8'] = HEAP8 = new Int8Array(b); + Module['HEAP16'] = HEAP16 = new Int16Array(b); + Module['HEAPU8'] = HEAPU8 = new Uint8Array(b); + Module['HEAPU16'] = HEAPU16 = new Uint16Array(b); + Module['HEAP32'] = HEAP32 = new Int32Array(b); + Module['HEAPU32'] = HEAPU32 = new Uint32Array(b); + Module['HEAPF32'] = HEAPF32 = new Float32Array(b); + Module['HEAPF64'] = HEAPF64 = new Float64Array(b); + Module['HEAP64'] = HEAP64 = new BigInt64Array(b); + Module['HEAPU64'] = HEAPU64 = new BigUint64Array(b); + } + + if (Module['wasmMemory']) { + wasmMemory = Module['wasmMemory']; + } else { + var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 16777216; + + wasmMemory = new WebAssembly.Memory({ + initial: INITIAL_MEMORY / 65536, + + maximum: 32768, + }); + } + + updateMemoryViews(); + + var __ATPRERUN__ = []; + var __ATINIT__ = []; + var __ATEXIT__ = []; + var __ATPOSTRUN__ = []; + + var runtimeInitialized = false; + + function preRun() { + var preRuns = Module['preRun']; + if (preRuns) { + if (typeof preRuns == 'function') preRuns = [preRuns]; + preRuns.forEach(addOnPreRun); + } + callRuntimeCallbacks(__ATPRERUN__); + } + + function initRuntime() { + runtimeInitialized = true; + + if (!Module['noFSInit'] && !FS.initialized) FS.init(); + FS.ignorePermissions = false; + + TTY.init(); + callRuntimeCallbacks(__ATINIT__); + } + + function postRun() { + var postRuns = Module['postRun']; + if (postRuns) { + if (typeof postRuns == 'function') postRuns = [postRuns]; + postRuns.forEach(addOnPostRun); + } + + callRuntimeCallbacks(__ATPOSTRUN__); + } + + function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); + } + + function addOnInit(cb) { + __ATINIT__.unshift(cb); + } + + function addOnExit(cb) {} + + function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); + } + + var runDependencies = 0; + var runDependencyWatcher = null; + var dependenciesFulfilled = null; + + function getUniqueRunDependency(id) { + return id; + } + + function addRunDependency(id) { + runDependencies++; + + Module['monitorRunDependencies']?.(runDependencies); + } + + function removeRunDependency(id) { + runDependencies--; + + Module['monitorRunDependencies']?.(runDependencies); + + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + + function abort(what) { + Module['onAbort']?.(what); + + what = 'Aborted(' + what + ')'; + + err(what); + + ABORT = true; + + what += '. Build with -sASSERTIONS for more info.'; + + var e = new WebAssembly.RuntimeError(what); + + readyPromiseReject(e); + + throw e; + } + + var dataURIPrefix = 'data:application/octet-stream;base64,'; + + var isDataURI = (filename) => filename.startsWith(dataURIPrefix); + + var isFileURI = (filename) => filename.startsWith('file://'); + + function findWasmBinary() { + var f = 'sqlite3.wasm'; + if (!isDataURI(f)) { + return locateFile(f); + } + return f; + } + + var wasmBinaryFile; + + function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw 'both async and sync fetching of the wasm failed'; + } + + function getBinaryPromise(binaryFile) { + if (!wasmBinary) { + return readAsync(binaryFile).then( + (response) => new Uint8Array(response), + + () => getBinarySync(binaryFile), + ); + } + + return Promise.resolve().then(() => getBinarySync(binaryFile)); + } + + function instantiateArrayBuffer(binaryFile, imports, receiver) { + return getBinaryPromise(binaryFile) + .then((binary) => { + return WebAssembly.instantiate(binary, imports); + }) + .then(receiver, (reason) => { + err(`failed to asynchronously prepare wasm: ${reason}`); + + abort(reason); + }); + } + + function instantiateAsync(binary, binaryFile, imports, callback) { + if ( + !binary && + typeof WebAssembly.instantiateStreaming == 'function' && + !isDataURI(binaryFile) && + typeof fetch == 'function' + ) { + return fetch(binaryFile, { credentials: 'same-origin' }).then( + (response) => { + var result = WebAssembly.instantiateStreaming(response, imports); + + return result.then(callback, function (reason) { + err(`wasm streaming compile failed: ${reason}`); + err('falling back to ArrayBuffer instantiation'); + return instantiateArrayBuffer(binaryFile, imports, callback); + }); + }, + ); + } + return instantiateArrayBuffer(binaryFile, imports, callback); + } + + function getWasmImports() { + return { + env: wasmImports, + wasi_snapshot_preview1: wasmImports, + }; + } + + function createWasm() { + var info = getWasmImports(); + + function receiveInstance(instance, module) { + wasmExports = instance.exports; + + addOnInit(wasmExports['__wasm_call_ctors']); + + removeRunDependency('wasm-instantiate'); + return wasmExports; + } + + addRunDependency('wasm-instantiate'); + + function receiveInstantiationResult(result) { + receiveInstance(result['instance']); + } + + if (Module['instantiateWasm']) { + try { + return Module['instantiateWasm'](info, receiveInstance); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + + readyPromiseReject(e); + } + } + + wasmBinaryFile ??= findWasmBinary(); + + instantiateAsync( + wasmBinary, + wasmBinaryFile, + info, + receiveInstantiationResult, + ).catch(readyPromiseReject); + return {}; + } + + function ExitStatus(status) { + this.name = 'ExitStatus'; + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + + var callRuntimeCallbacks = (callbacks) => { + callbacks.forEach((f) => f(Module)); + }; + + function getValue(ptr, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': + return HEAP8[ptr]; + case 'i8': + return HEAP8[ptr]; + case 'i16': + return HEAP16[ptr >> 1]; + case 'i32': + return HEAP32[ptr >> 2]; + case 'i64': + return HEAP64[ptr >> 3]; + case 'float': + return HEAPF32[ptr >> 2]; + case 'double': + return HEAPF64[ptr >> 3]; + case '*': + return HEAPU32[ptr >> 2]; + default: + abort(`invalid type for getValue: ${type}`); + } + } + + var noExitRuntime = Module['noExitRuntime'] || true; + + function setValue(ptr, value, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': + HEAP8[ptr] = value; + break; + case 'i8': + HEAP8[ptr] = value; + break; + case 'i16': + HEAP16[ptr >> 1] = value; + break; + case 'i32': + HEAP32[ptr >> 2] = value; + break; + case 'i64': + HEAP64[ptr >> 3] = BigInt(value); + break; + case 'float': + HEAPF32[ptr >> 2] = value; + break; + case 'double': + HEAPF64[ptr >> 3] = value; + break; + case '*': + HEAPU32[ptr >> 2] = value; + break; + default: + abort(`invalid type for setValue: ${type}`); + } + } + + var stackRestore = (val) => __emscripten_stack_restore(val); + + var stackSave = () => _emscripten_stack_get_current(); + + var PATH = { + isAbs: (path) => path.charAt(0) === '/', + splitPath: (filename) => { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift('..'); + } + } + return parts; + }, + normalize: (path) => { + var isAbsolute = PATH.isAbs(path), + trailingSlash = path.substr(-1) === '/'; + + path = PATH.normalizeArray( + path.split('/').filter((p) => !!p), + !isAbsolute, + ).join('/'); + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + return (isAbsolute ? '/' : '') + path; + }, + dirname: (path) => { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return '.'; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: (path) => { + if (path === '/') return '/'; + path = PATH.normalize(path); + path = path.replace(/\/$/, ''); + var lastSlash = path.lastIndexOf('/'); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + join: (...paths) => PATH.normalize(paths.join('/')), + join2: (l, r) => PATH.normalize(l + '/' + r), + }; + + var initRandomFill = () => { + if ( + typeof crypto == 'object' && + typeof crypto['getRandomValues'] == 'function' + ) { + return (view) => crypto.getRandomValues(view); + } else abort('initRandomDevice'); + }; + var randomFill = (view) => { + return (randomFill = initRandomFill())(view); + }; + + var PATH_FS = { + resolve: (...args) => { + var resolvedPath = '', + resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? args[i] : FS.cwd(); + + if (typeof path != 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + return ''; + } + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + + resolvedPath = PATH.normalizeArray( + resolvedPath.split('/').filter((p) => !!p), + !resolvedAbsolute, + ).join('/'); + return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join('/'); + }, + }; + + var UTF8Decoder = + typeof TextDecoder != 'undefined' ? new TextDecoder() : undefined; + + var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ''; + + while (idx < endPtr) { + var u0 = heapOrArray[idx++]; + if (!(u0 & 0x80)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 0xe0) == 0xc0) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 0xf0) == 0xe0) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + u0 = + ((u0 & 7) << 18) | + (u1 << 12) | + (u2 << 6) | + (heapOrArray[idx++] & 63); + } + + if (u0 < 0x10000) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 0x10000; + str += String.fromCharCode( + 0xd800 | (ch >> 10), + 0xdc00 | (ch & 0x3ff), + ); + } + } + return str; + }; + + var FS_stdin_getChar_buffer = []; + + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var c = str.charCodeAt(i); + if (c <= 0x7f) { + len++; + } else if (c <= 0x7ff) { + len += 2; + } else if (c >= 0xd800 && c <= 0xdfff) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; + }; + + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + if (!(maxBytesToWrite > 0)) return 0; + + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 0xd800 && u <= 0xdfff) { + var u1 = str.charCodeAt(++i); + u = (0x10000 + ((u & 0x3ff) << 10)) | (u1 & 0x3ff); + } + if (u <= 0x7f) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 0x7ff) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 0xc0 | (u >> 6); + heap[outIdx++] = 0x80 | (u & 63); + } else if (u <= 0xffff) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 0xe0 | (u >> 12); + heap[outIdx++] = 0x80 | ((u >> 6) & 63); + heap[outIdx++] = 0x80 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + heap[outIdx++] = 0xf0 | (u >> 18); + heap[outIdx++] = 0x80 | ((u >> 12) & 63); + heap[outIdx++] = 0x80 | ((u >> 6) & 63); + heap[outIdx++] = 0x80 | (u & 63); + } + } + + heap[outIdx] = 0; + return outIdx - startIdx; + }; + + function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length, + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + } + var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if ( + typeof window != 'undefined' && + typeof window.prompt == 'function' + ) { + result = window.prompt('Input: '); + if (result !== null) { + result += '\n'; + } + } else { + } + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); + }; + var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops: ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ + 0x03, 0x1c, 0x7f, 0x15, 0x04, 0x00, 0x01, 0x00, 0x11, 0x13, 0x1a, + 0x00, 0x12, 0x0f, 0x17, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ], + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [24, 80]; + }, + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + }, + }; + + var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); + }; + + var alignMemory = (size, alignment) => { + return Math.ceil(size / alignment) * alignment; + }; + var mmapAlloc = (size) => { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (ptr) zeroMemory(ptr, size); + return ptr; + }; + var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, '/', 16384 | 511, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2.0 : 1.125)) >>> + 0, + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray(0, Math.min(newSize, node.usedBytes)), + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw FS.genericErrors[44]; + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir(node) { + var entries = ['.', '..']; + for (var key of Object.keys(node.contents)) { + entries.push(key); + } + return entries; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + return length; + } + } + + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length, + ); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length, + ); + } + } + HEAP8.set(contents, ptr); + } + } + return { ptr, allocated }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + + return 0; + }, + }, + }; + + var asyncLoad = (url, onload, onerror, noRunDep) => { + var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : ''; + readAsync(url).then( + (arrayBuffer) => { + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, + (err) => { + if (onerror) { + onerror(); + } else { + throw `Loading data file "${url}" failed.`; + } + }, + ); + if (dep) addRunDependency(dep); + }; + + var FS_createDataFile = ( + parent, + name, + fileData, + canRead, + canWrite, + canOwn, + ) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); + }; + + var preloadPlugins = Module['preloadPlugins'] || []; + var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + if (typeof Browser != 'undefined') Browser.init(); + + var handled = false; + preloadPlugins.forEach((plugin) => { + if (handled) return; + if (plugin['canHandle'](fullname)) { + plugin['handle'](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }; + var FS_createPreloadedFile = ( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish, + ) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn, + ); + } + onload?.(); + removeRunDependency(dep); + } + if ( + FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == 'string') { + asyncLoad(url, processData, onerror); + } else { + processData(url); + } + }; + + var FS_modeStringToFlags = (str) => { + var flagModes = { + r: 0, + 'r+': 2, + w: 512 | 64 | 1, + 'w+': 512 | 64 | 2, + a: 1024 | 64 | 1, + 'a+': 1024 | 64 | 2, + }; + var flags = flagModes[str]; + if (typeof flags == 'undefined') { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; + }; + + var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }; + + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: '/', + initialized: false, + ignorePermissions: true, + ErrnoError: class { + constructor(errno) { + this.name = 'ErrnoError'; + this.errno = errno; + } + }, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + constructor() { + this.shared = {}; + } + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + 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(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; + this.readMode = 292 | 73; + this.writeMode = 146; + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? (this.mode |= this.readMode) : (this.mode &= ~this.readMode); + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? (this.mode |= this.writeMode) : (this.mode &= ~this.writeMode); + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + path = PATH_FS.resolve(path); + + if (!path) return { path: '', node: null }; + + var defaults = { + follow_mount: true, + recurse_count: 0, + }; + opts = Object.assign(defaults, opts); + + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + + var parts = path.split('/').filter((p) => !!p); + + var current = FS.root; + var current_path = '/'; + + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + + if (FS.isMountpoint(current)) { + if (!islast || (islast && opts.follow_mount)) { + current = current.mounted.root; + } + } + + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + 1, + }); + current = lookup.node; + + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + + return { path: current_path, node: current }; + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== '/' + ? `${mount}/${path}` + : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + var node = new FS.FSNode(parent, name, mode, rdev); + + FS.hashAddNode(node); + + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = ['r', 'w', 'rw'][flag & 3]; + if (flag & 512) { + perms += 'w'; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + + if (perms.includes('r') && !(node.mode & 292)) { + return 2; + } else if (perms.includes('w') && !(node.mode & 146)) { + return 2; + } else if (perms.includes('x') && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, 'x'); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, 'wx'); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, 'wx'); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== 'r' || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: (fd) => FS.streams[fd], + createStream(stream, fd = -1) { + stream = Object.assign(new FS.FSStream(), stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + + stream.stream_ops = device.stream_ops; + + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 0xff, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice(dev, ops) { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [mount]; + + while (check.length) { + var m = check.pop(); + + mounts.push(m); + + check.push(...m.mounts); + } + + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == 'function') { + callback = populate; + populate = false; + } + + FS.syncFSRequests++; + + if (FS.syncFSRequests > 1) { + err( + `warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`, + ); + } + + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + + function doCallback(errCode) { + FS.syncFSRequests--; + return callback(errCode); + } + + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + var root = mountpoint === '/'; + var pseudo = !mountpoint; + var node; + + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + + mountpoint = lookup.path; + node = lookup.node; + + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + + var mount = { + type, + opts, + mountpoint, + mounts: [], + }; + + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + + if (node.mount) { + node.mount.mounts.push(mount); + } + } + + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + + while (current) { + var next = current.name_next; + + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + + current = next; + } + }); + + node.mounted = null; + + var idx = node.mount.mounts.indexOf(mount); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === '.' || name === '..') { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create(path, mode) { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode) { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split('/'); + var d = ''; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += '/' + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == 'undefined') { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + + var lookup, old_dir, new_dir; + + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + + var old_node = FS.lookupNode(old_dir, old_name); + + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(28); + } + + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(55); + } + + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + + if (old_node === new_node) { + return; + } + + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, 'w'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + + FS.hashRemoveNode(old_node); + + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve( + FS.getPath(link.parent), + link.node_ops.readlink(link), + ); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat(path) { + return FS.stat(path, true); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: (mode & 4095) | (node.mode & ~4095), + timestamp: Date.now(), + }); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.chmod(stream.node, mode); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + timestamp: Date.now(), + }); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.chown(stream.node, uid, gid); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, 'w'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { + size: len, + timestamp: Date.now(), + }); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + node.node_ops.setattr(node, { + timestamp: Math.max(atime, mtime), + }); + }, + open(path, flags, mode) { + if (path === '') { + throw new FS.ErrnoError(44); + } + flags = typeof flags == 'string' ? FS_modeStringToFlags(flags) : flags; + if (flags & 64) { + mode = typeof mode == 'undefined' ? 438 : mode; + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == 'object') { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + }); + node = lookup.node; + } catch (e) {} + } + + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + + if (flags & 512 && !created) { + FS.truncate(node, 0); + } + + flags &= ~(128 | 512 | 131072); + + var stream = FS.createStream({ + node, + path: FS.getPath(node), + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + + ungotten: [], + error: false, + }); + + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module['logReadFiles'] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != 'undefined'; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position, + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != 'undefined'; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn, + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags, + ); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || 'binary'; + if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === 'utf8') { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === 'binary') { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == 'string') { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error('Unsupported data type'); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, 'x'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir('/tmp'); + FS.mkdir('/home'); + FS.mkdir('/home/web_user'); + }, + createDefaultDevices() { + FS.mkdir('/dev'); + + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + }); + FS.mkdev('/dev/null', FS.makedev(1, 3)); + + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev('/dev/tty', FS.makedev(5, 0)); + FS.mkdev('/dev/tty1', FS.makedev(6, 0)); + + var randomBuffer = new Uint8Array(1024), + randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomLeft = randomFill(randomBuffer).byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice('/dev', 'random', randomByte); + FS.createDevice('/dev', 'urandom', randomByte); + + FS.mkdir('/dev/shm'); + FS.mkdir('/dev/shm/tmp'); + }, + createSpecialDirectories() { + FS.mkdir('/proc'); + var proc_self = FS.mkdir('/proc/self'); + FS.mkdir('/proc/self/fd'); + FS.mount( + { + mount() { + var node = FS.createNode(proc_self, 'fd', 16384 | 511, 73); + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { mountpoint: 'fake' }, + node_ops: { readlink: () => stream.path }, + }; + ret.parent = ret; + return ret; + }, + }; + return node; + }, + }, + {}, + '/proc/self/fd', + ); + }, + createStandardStreams(input, output, error) { + if (input) { + FS.createDevice('/dev', 'stdin', input); + } else { + FS.symlink('/dev/tty', '/dev/stdin'); + } + if (output) { + FS.createDevice('/dev', 'stdout', null, output); + } else { + FS.symlink('/dev/tty', '/dev/stdout'); + } + if (error) { + FS.createDevice('/dev', 'stderr', null, error); + } else { + FS.symlink('/dev/tty1', '/dev/stderr'); + } + + var stdin = FS.open('/dev/stdin', 0); + var stdout = FS.open('/dev/stdout', 1); + var stderr = FS.open('/dev/stderr', 1); + }, + staticInit() { + [44].forEach((code) => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ''; + }); + + FS.nameTable = new Array(4096); + + FS.mount(MEMFS, {}, '/'); + + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + + FS.filesystems = { + MEMFS: MEMFS, + }; + }, + init(input, output, error) { + FS.initialized = true; + + input ??= Module['stdin']; + output ??= Module['stdout']; + error ??= Module['stderr']; + + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === '/'; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == 'string' ? parent : FS.getPath(parent); + var parts = path.split('/').reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2( + typeof parent == 'string' ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == 'string' ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == 'string') { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2( + typeof parent == 'string' ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != 'undefined') { + 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.', + ); + } else { + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + class LazyUint8Array { + constructor() { + this.lengthKnown = false; + this.chunks = []; + } + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open('HEAD', url, false); + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + '. Status: ' + xhr.status, + ); + var datalength = Number(xhr.getResponseHeader('Content-length')); + var header; + var hasByteServing = + (header = xhr.getResponseHeader('Accept-Ranges')) && + header === 'bytes'; + var usesGzip = + (header = xhr.getResponseHeader('Content-Encoding')) && + header === 'gzip'; + + var chunkSize = 1024 * 1024; + + if (!hasByteServing) chunkSize = datalength; + + var doXHR = (from, to) => { + if (from > to) + throw new Error( + 'invalid range (' + + from + + ', ' + + to + + ') or no bytes requested!', + ); + if (to > datalength - 1) + throw new Error( + 'only ' + datalength + ' bytes available! programmer error!', + ); + + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader('Range', 'bytes=' + from + '-' + to); + + xhr.responseType = 'arraybuffer'; + if (xhr.overrideMimeType) { + xhr.overrideMimeType('text/plain; charset=x-user-defined'); + } + + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + '. Status: ' + xhr.status, + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } + return intArrayFromString(xhr.responseText || '', true); + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == 'undefined') { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == 'undefined') + throw new Error('doXHR failed!'); + return lazyArray.chunks[chunkNum]; + }); + + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + 'LazyFiles on gzip forces download of the whole file when length is accessed', + ); + } + + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + + if (typeof XMLHttpRequest != 'undefined') { + if (!ENVIRONMENT_IS_WORKER) + throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc'; + var lazyArray = new LazyUint8Array(); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url: url }; + } + + var node = FS.createFile(parent, name, properties, canRead, canWrite); + + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { ptr, allocated: true }; + }; + node.stream_ops = stream_ops; + return node; + }, + }; + + var UTF8ToString = (ptr, maxBytesToRead) => { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ''; + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat(func, path, buf) { + var stat = func(path); + HEAP32[buf >> 2] = stat.dev; + HEAP32[(buf + 4) >> 2] = stat.mode; + HEAPU32[(buf + 8) >> 2] = stat.nlink; + HEAP32[(buf + 12) >> 2] = stat.uid; + HEAP32[(buf + 16) >> 2] = stat.gid; + HEAP32[(buf + 20) >> 2] = stat.rdev; + HEAP64[(buf + 24) >> 3] = BigInt(stat.size); + HEAP32[(buf + 32) >> 2] = 4096; + HEAP32[(buf + 36) >> 2] = stat.blocks; + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(buf + 40) >> 3] = BigInt(Math.floor(atime / 1000)); + HEAPU32[(buf + 48) >> 2] = (atime % 1000) * 1000 * 1000; + HEAP64[(buf + 56) >> 3] = BigInt(Math.floor(mtime / 1000)); + HEAPU32[(buf + 64) >> 2] = (mtime % 1000) * 1000 * 1000; + HEAP64[(buf + 72) >> 3] = BigInt(Math.floor(ctime / 1000)); + HEAPU32[(buf + 80) >> 2] = (ctime % 1000) * 1000 * 1000; + HEAP64[(buf + 88) >> 3] = BigInt(stat.ino); + return 0; + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + }; + function ___syscall_chmod(path, mode) { + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_faccessat(dirfd, path, amode, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ''; + if (amode & 4) perms += 'r'; + if (amode & 2) perms += 'w'; + if (amode & 1) perms += 'x'; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fchmod(fd, mode) { + try { + FS.fchmod(fd, mode); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fchown32(fd, owner, group) { + try { + FS.fchown(fd, owner, group); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function syscallGetVarargI() { + var ret = HEAP32[+SYSCALLS.varargs >> 2]; + SYSCALLS.varargs += 4; + return ret; + } + var syscallGetVarargP = syscallGetVarargI; + + function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + case 12: { + var arg = syscallGetVarargP(); + var offset = 0; + + HEAP16[(arg + offset) >> 1] = 2; + return 0; + } + case 13: + case 14: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var INT53_MAX = 9007199254740992; + + var INT53_MIN = -9007199254740992; + var bigintToI53Checked = (num) => + num < INT53_MIN || num > INT53_MAX ? NaN : Number(num); + function ___syscall_ftruncate64(fd, length) { + length = bigintToI53Checked(length); + + try { + if (isNaN(length)) return 61; + FS.ftruncate(fd, length); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + }; + function ___syscall_getcwd(buf, size) { + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: { + if (!stream.tty) return -59; + return 0; + } + case 21505: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + HEAP32[argp >> 2] = termios.c_iflag || 0; + HEAP32[(argp + 4) >> 2] = termios.c_oflag || 0; + HEAP32[(argp + 8) >> 2] = termios.c_cflag || 0; + HEAP32[(argp + 12) >> 2] = termios.c_lflag || 0; + for (var i = 0; i < 32; i++) { + HEAP8[argp + i + 17] = termios.c_cc[i] || 0; + } + return 0; + } + return 0; + } + case 21510: + case 21511: + case 21512: { + if (!stream.tty) return -59; + return 0; + } + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = HEAP32[argp >> 2]; + var c_oflag = HEAP32[(argp + 4) >> 2]; + var c_cflag = HEAP32[(argp + 8) >> 2]; + var c_lflag = HEAP32[(argp + 12) >> 2]; + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(HEAP8[argp + i + 17]); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc, + }); + } + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + HEAP32[argp >> 2] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + HEAP16[argp >> 1] = winsize[0]; + HEAP16[(argp + 2) >> 1] = winsize[1]; + } + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + case 21515: { + if (!stream.tty) return -59; + return 0; + } + default: + return -28; + } + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_lstat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_mkdirat(dirfd, path, mode) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + + path = PATH.normalize(path); + if (path[path.length - 1] === '/') + path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_newfstatat(dirfd, path, buf, flags) { + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~6400; + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_openat(dirfd, path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = HEAP8[buf + len]; + stringToUTF8(ret, buf, bufsize + 1); + + HEAP8[buf + len] = endChar; + return len; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_rmdir(path) { + try { + path = SYSCALLS.getStr(path); + FS.rmdir(path); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_stat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_unlinkat(dirfd, path, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort('Invalid flags passed to unlinkat'); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var readI53FromI64 = (ptr) => { + return HEAPU32[ptr >> 2] + HEAP32[(ptr + 4) >> 2] * 4294967296; + }; + + function ___syscall_utimensat(dirfd, path, times, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path, true); + var now = Date.now(), + atime, + mtime; + if (!times) { + atime = now; + mtime = now; + } else { + var seconds = readI53FromI64(times); + var nanoseconds = HEAP32[(times + 8) >> 2]; + if (nanoseconds == 1073741823) { + atime = now; + } else if (nanoseconds == 1073741822) { + atime = -1; + } else { + atime = seconds * 1000 + nanoseconds / (1000 * 1000); + } + times += 16; + seconds = readI53FromI64(times); + nanoseconds = HEAP32[(times + 8) >> 2]; + if (nanoseconds == 1073741823) { + mtime = now; + } else if (nanoseconds == 1073741822) { + mtime = -1; + } else { + mtime = seconds * 1000 + nanoseconds / (1000 * 1000); + } + } + + if (mtime != -1 || atime != -1) { + FS.utime(path, atime, mtime); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var nowIsMonotonic = 1; + var __emscripten_get_now_is_monotonic = () => nowIsMonotonic; + + var isLeapYear = (year) => + year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + + var MONTH_DAYS_LEAP_CUMULATIVE = [ + 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, + ]; + + var MONTH_DAYS_REGULAR_CUMULATIVE = [ + 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, + ]; + var ydayFromDate = (date) => { + var leap = isLeapYear(date.getFullYear()); + var monthDaysCumulative = leap + ? MONTH_DAYS_LEAP_CUMULATIVE + : MONTH_DAYS_REGULAR_CUMULATIVE; + var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; + + return yday; + }; + + function __localtime_js(time, tmPtr) { + time = bigintToI53Checked(time); + + var date = new Date(time * 1000); + HEAP32[tmPtr >> 2] = date.getSeconds(); + HEAP32[(tmPtr + 4) >> 2] = date.getMinutes(); + HEAP32[(tmPtr + 8) >> 2] = date.getHours(); + HEAP32[(tmPtr + 12) >> 2] = date.getDate(); + HEAP32[(tmPtr + 16) >> 2] = date.getMonth(); + HEAP32[(tmPtr + 20) >> 2] = date.getFullYear() - 1900; + HEAP32[(tmPtr + 24) >> 2] = date.getDay(); + + var yday = ydayFromDate(date) | 0; + HEAP32[(tmPtr + 28) >> 2] = yday; + HEAP32[(tmPtr + 36) >> 2] = -(date.getTimezoneOffset() * 60); + + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = + (summerOffset != winterOffset && + date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + HEAP32[(tmPtr + 32) >> 2] = dst; + } + + function __mmap_js(len, prot, flags, fd, offset, allocated, addr) { + offset = bigintToI53Checked(offset); + + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var res = FS.mmap(stream, len, offset, prot, flags); + var ptr = res.ptr; + HEAP32[allocated >> 2] = res.allocated; + HEAPU32[addr >> 2] = ptr; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function __munmap_js(addr, len, prot, flags, fd, offset) { + offset = bigintToI53Checked(offset); + + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var __tzset_js = (timezone, daylight, std_name, dst_name) => { + var currentYear = new Date().getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + + HEAPU32[timezone >> 2] = stdTimezoneOffset * 60; + + HEAP32[daylight >> 2] = Number(winterOffset != summerOffset); + + var extractZone = (timezoneOffset) => { + var sign = timezoneOffset >= 0 ? '-' : '+'; + + var absOffset = Math.abs(timezoneOffset); + var hours = String(Math.floor(absOffset / 60)).padStart(2, '0'); + var minutes = String(absOffset % 60).padStart(2, '0'); + + return `UTC${sign}${hours}${minutes}`; + }; + + var winterName = extractZone(winterOffset); + var summerName = extractZone(summerOffset); + if (summerOffset < winterOffset) { + stringToUTF8(winterName, std_name, 17); + stringToUTF8(summerName, dst_name, 17); + } else { + stringToUTF8(winterName, dst_name, 17); + stringToUTF8(summerName, std_name, 17); + } + }; + + var _emscripten_date_now = () => Date.now(); + + var _emscripten_get_now = () => performance.now(); + + var getHeapMax = () => 2147483648; + + var growMemory = (size) => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + wasmMemory.grow(pages); + updateMemoryViews(); + return 1; + } catch (e) {} + }; + var _emscripten_resize_heap = (requestedSize) => { + var oldSize = HEAPU8.length; + + requestedSize >>>= 0; + + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + return false; + } + + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296, + ); + + var newSize = Math.min( + maxHeapSize, + alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536), + ); + + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + return false; + }; + + var ENV = {}; + + var getExecutableName = () => { + return thisProgram || './this.program'; + }; + var getEnvStrings = () => { + if (!getEnvStrings.strings) { + var lang = + ( + (typeof navigator == 'object' && + navigator.languages && + navigator.languages[0]) || + 'C' + ).replace('-', '_') + '.UTF-8'; + var env = { + USER: 'web_user', + LOGNAME: 'web_user', + PATH: '/', + PWD: '/', + HOME: '/home/web_user', + LANG: lang, + _: getExecutableName(), + }; + + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; + else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; + }; + + var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + HEAP8[buffer++] = str.charCodeAt(i); + } + + HEAP8[buffer] = 0; + }; + var _environ_get = (__environ, environ_buf) => { + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + HEAPU32[(__environ + i * 4) >> 2] = ptr; + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; + }; + + var _environ_sizes_get = (penviron_count, penviron_buf_size) => { + var strings = getEnvStrings(); + HEAPU32[penviron_count >> 2] = strings.length; + var bufSize = 0; + strings.forEach((string) => (bufSize += string.length + 1)); + HEAPU32[penviron_buf_size >> 2] = bufSize; + return 0; + }; + + function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + function _fd_fdstat_get(fd, pbuf) { + try { + var rightsBase = 0; + var rightsInheriting = 0; + var flags = 0; + { + var stream = SYSCALLS.getStreamFromFD(fd); + + var type = stream.tty + ? 2 + : FS.isDir(stream.mode) + ? 3 + : FS.isLink(stream.mode) + ? 7 + : 4; + } + HEAP8[pbuf] = type; + HEAP16[(pbuf + 2) >> 1] = flags; + HEAP64[(pbuf + 8) >> 3] = BigInt(rightsBase); + HEAP64[(pbuf + 16) >> 3] = BigInt(rightsInheriting); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[iov >> 2]; + var len = HEAPU32[(iov + 4) >> 2]; + iov += 8; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + if (typeof offset != 'undefined') { + offset += curr; + } + } + return ret; + }; + + function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[newOffset >> 3] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + function _fd_sync(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (stream.stream_ops?.fsync) { + return stream.stream_ops.fsync(stream); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[iov >> 2]; + var len = HEAPU32[(iov + 4) >> 2]; + iov += 8; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + break; + } + if (typeof offset != 'undefined') { + offset += curr; + } + } + return ret; + }; + + function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + FS.createPreloadedFile = FS_createPreloadedFile; + FS.staticInit(); + + var wasmImports = { + __syscall_chmod: ___syscall_chmod, + + __syscall_faccessat: ___syscall_faccessat, + + __syscall_fchmod: ___syscall_fchmod, + + __syscall_fchown32: ___syscall_fchown32, + + __syscall_fcntl64: ___syscall_fcntl64, + + __syscall_fstat64: ___syscall_fstat64, + + __syscall_ftruncate64: ___syscall_ftruncate64, + + __syscall_getcwd: ___syscall_getcwd, + + __syscall_ioctl: ___syscall_ioctl, + + __syscall_lstat64: ___syscall_lstat64, + + __syscall_mkdirat: ___syscall_mkdirat, + + __syscall_newfstatat: ___syscall_newfstatat, + + __syscall_openat: ___syscall_openat, + + __syscall_readlinkat: ___syscall_readlinkat, + + __syscall_rmdir: ___syscall_rmdir, + + __syscall_stat64: ___syscall_stat64, + + __syscall_unlinkat: ___syscall_unlinkat, + + __syscall_utimensat: ___syscall_utimensat, + + _emscripten_get_now_is_monotonic: __emscripten_get_now_is_monotonic, + + _localtime_js: __localtime_js, + + _mmap_js: __mmap_js, + + _munmap_js: __munmap_js, + + _tzset_js: __tzset_js, + + emscripten_date_now: _emscripten_date_now, + + emscripten_get_now: _emscripten_get_now, + + emscripten_resize_heap: _emscripten_resize_heap, + + environ_get: _environ_get, + + environ_sizes_get: _environ_sizes_get, + + fd_close: _fd_close, + + fd_fdstat_get: _fd_fdstat_get, + + fd_read: _fd_read, + + fd_seek: _fd_seek, + + fd_sync: _fd_sync, + + fd_write: _fd_write, + + memory: wasmMemory, + }; + var wasmExports = createWasm(); + var ___wasm_call_ctors = () => + (___wasm_call_ctors = wasmExports['__wasm_call_ctors'])(); + var _sqlite3_status64 = (Module['_sqlite3_status64'] = (a0, a1, a2, a3) => + (_sqlite3_status64 = Module['_sqlite3_status64'] = + wasmExports['sqlite3_status64'])(a0, a1, a2, a3)); + var _sqlite3_status = (Module['_sqlite3_status'] = (a0, a1, a2, a3) => + (_sqlite3_status = Module['_sqlite3_status'] = + wasmExports['sqlite3_status'])(a0, a1, a2, a3)); + var _sqlite3_db_status = (Module['_sqlite3_db_status'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_db_status = Module['_sqlite3_db_status'] = + wasmExports['sqlite3_db_status'])(a0, a1, a2, a3, a4)); + var _sqlite3_msize = (Module['_sqlite3_msize'] = (a0) => + (_sqlite3_msize = Module['_sqlite3_msize'] = + wasmExports['sqlite3_msize'])(a0)); + var _sqlite3_vfs_find = (Module['_sqlite3_vfs_find'] = (a0) => + (_sqlite3_vfs_find = Module['_sqlite3_vfs_find'] = + wasmExports['sqlite3_vfs_find'])(a0)); + var _sqlite3_initialize = (Module['_sqlite3_initialize'] = () => + (_sqlite3_initialize = Module['_sqlite3_initialize'] = + wasmExports['sqlite3_initialize'])()); + var _sqlite3_malloc = (Module['_sqlite3_malloc'] = (a0) => + (_sqlite3_malloc = Module['_sqlite3_malloc'] = + wasmExports['sqlite3_malloc'])(a0)); + var _sqlite3_free = (Module['_sqlite3_free'] = (a0) => + (_sqlite3_free = Module['_sqlite3_free'] = wasmExports['sqlite3_free'])( + a0, + )); + var _sqlite3_vfs_register = (Module['_sqlite3_vfs_register'] = (a0, a1) => + (_sqlite3_vfs_register = Module['_sqlite3_vfs_register'] = + wasmExports['sqlite3_vfs_register'])(a0, a1)); + var _sqlite3_vfs_unregister = (Module['_sqlite3_vfs_unregister'] = (a0) => + (_sqlite3_vfs_unregister = Module['_sqlite3_vfs_unregister'] = + wasmExports['sqlite3_vfs_unregister'])(a0)); + var _sqlite3_malloc64 = (Module['_sqlite3_malloc64'] = (a0) => + (_sqlite3_malloc64 = Module['_sqlite3_malloc64'] = + wasmExports['sqlite3_malloc64'])(a0)); + var _sqlite3_realloc = (Module['_sqlite3_realloc'] = (a0, a1) => + (_sqlite3_realloc = Module['_sqlite3_realloc'] = + wasmExports['sqlite3_realloc'])(a0, a1)); + var _sqlite3_realloc64 = (Module['_sqlite3_realloc64'] = (a0, a1) => + (_sqlite3_realloc64 = Module['_sqlite3_realloc64'] = + wasmExports['sqlite3_realloc64'])(a0, a1)); + var _sqlite3_value_text = (Module['_sqlite3_value_text'] = (a0) => + (_sqlite3_value_text = Module['_sqlite3_value_text'] = + wasmExports['sqlite3_value_text'])(a0)); + var _sqlite3_randomness = (Module['_sqlite3_randomness'] = (a0, a1) => + (_sqlite3_randomness = Module['_sqlite3_randomness'] = + wasmExports['sqlite3_randomness'])(a0, a1)); + var _sqlite3_stricmp = (Module['_sqlite3_stricmp'] = (a0, a1) => + (_sqlite3_stricmp = Module['_sqlite3_stricmp'] = + wasmExports['sqlite3_stricmp'])(a0, a1)); + var _sqlite3_strnicmp = (Module['_sqlite3_strnicmp'] = (a0, a1, a2) => + (_sqlite3_strnicmp = Module['_sqlite3_strnicmp'] = + wasmExports['sqlite3_strnicmp'])(a0, a1, a2)); + var _sqlite3_uri_parameter = (Module['_sqlite3_uri_parameter'] = (a0, a1) => + (_sqlite3_uri_parameter = Module['_sqlite3_uri_parameter'] = + wasmExports['sqlite3_uri_parameter'])(a0, a1)); + var _sqlite3_uri_boolean = (Module['_sqlite3_uri_boolean'] = (a0, a1, a2) => + (_sqlite3_uri_boolean = Module['_sqlite3_uri_boolean'] = + wasmExports['sqlite3_uri_boolean'])(a0, a1, a2)); + var _sqlite3_serialize = (Module['_sqlite3_serialize'] = (a0, a1, a2, a3) => + (_sqlite3_serialize = Module['_sqlite3_serialize'] = + wasmExports['sqlite3_serialize'])(a0, a1, a2, a3)); + var _sqlite3_prepare_v2 = (Module['_sqlite3_prepare_v2'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_prepare_v2 = Module['_sqlite3_prepare_v2'] = + wasmExports['sqlite3_prepare_v2'])(a0, a1, a2, a3, a4)); + var _sqlite3_step = (Module['_sqlite3_step'] = (a0) => + (_sqlite3_step = Module['_sqlite3_step'] = wasmExports['sqlite3_step'])( + a0, + )); + var _sqlite3_column_int64 = (Module['_sqlite3_column_int64'] = (a0, a1) => + (_sqlite3_column_int64 = Module['_sqlite3_column_int64'] = + wasmExports['sqlite3_column_int64'])(a0, a1)); + var _sqlite3_reset = (Module['_sqlite3_reset'] = (a0) => + (_sqlite3_reset = Module['_sqlite3_reset'] = + wasmExports['sqlite3_reset'])(a0)); + var _sqlite3_exec = (Module['_sqlite3_exec'] = (a0, a1, a2, a3, a4) => + (_sqlite3_exec = Module['_sqlite3_exec'] = wasmExports['sqlite3_exec'])( + a0, + a1, + a2, + a3, + a4, + )); + var _sqlite3_column_int = (Module['_sqlite3_column_int'] = (a0, a1) => + (_sqlite3_column_int = Module['_sqlite3_column_int'] = + wasmExports['sqlite3_column_int'])(a0, a1)); + var _sqlite3_finalize = (Module['_sqlite3_finalize'] = (a0) => + (_sqlite3_finalize = Module['_sqlite3_finalize'] = + wasmExports['sqlite3_finalize'])(a0)); + var _sqlite3_file_control = (Module['_sqlite3_file_control'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_file_control = Module['_sqlite3_file_control'] = + wasmExports['sqlite3_file_control'])(a0, a1, a2, a3)); + var _sqlite3_column_name = (Module['_sqlite3_column_name'] = (a0, a1) => + (_sqlite3_column_name = Module['_sqlite3_column_name'] = + wasmExports['sqlite3_column_name'])(a0, a1)); + var _sqlite3_column_text = (Module['_sqlite3_column_text'] = (a0, a1) => + (_sqlite3_column_text = Module['_sqlite3_column_text'] = + wasmExports['sqlite3_column_text'])(a0, a1)); + var _sqlite3_column_type = (Module['_sqlite3_column_type'] = (a0, a1) => + (_sqlite3_column_type = Module['_sqlite3_column_type'] = + wasmExports['sqlite3_column_type'])(a0, a1)); + var _sqlite3_errmsg = (Module['_sqlite3_errmsg'] = (a0) => + (_sqlite3_errmsg = Module['_sqlite3_errmsg'] = + wasmExports['sqlite3_errmsg'])(a0)); + var _sqlite3_deserialize = (Module['_sqlite3_deserialize'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3_deserialize = Module['_sqlite3_deserialize'] = + wasmExports['sqlite3_deserialize'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3_clear_bindings = (Module['_sqlite3_clear_bindings'] = (a0) => + (_sqlite3_clear_bindings = Module['_sqlite3_clear_bindings'] = + wasmExports['sqlite3_clear_bindings'])(a0)); + var _sqlite3_value_blob = (Module['_sqlite3_value_blob'] = (a0) => + (_sqlite3_value_blob = Module['_sqlite3_value_blob'] = + wasmExports['sqlite3_value_blob'])(a0)); + var _sqlite3_value_bytes = (Module['_sqlite3_value_bytes'] = (a0) => + (_sqlite3_value_bytes = Module['_sqlite3_value_bytes'] = + wasmExports['sqlite3_value_bytes'])(a0)); + var _sqlite3_value_double = (Module['_sqlite3_value_double'] = (a0) => + (_sqlite3_value_double = Module['_sqlite3_value_double'] = + wasmExports['sqlite3_value_double'])(a0)); + var _sqlite3_value_int = (Module['_sqlite3_value_int'] = (a0) => + (_sqlite3_value_int = Module['_sqlite3_value_int'] = + wasmExports['sqlite3_value_int'])(a0)); + var _sqlite3_value_int64 = (Module['_sqlite3_value_int64'] = (a0) => + (_sqlite3_value_int64 = Module['_sqlite3_value_int64'] = + wasmExports['sqlite3_value_int64'])(a0)); + var _sqlite3_value_subtype = (Module['_sqlite3_value_subtype'] = (a0) => + (_sqlite3_value_subtype = Module['_sqlite3_value_subtype'] = + wasmExports['sqlite3_value_subtype'])(a0)); + var _sqlite3_value_pointer = (Module['_sqlite3_value_pointer'] = (a0, a1) => + (_sqlite3_value_pointer = Module['_sqlite3_value_pointer'] = + wasmExports['sqlite3_value_pointer'])(a0, a1)); + var _sqlite3_value_type = (Module['_sqlite3_value_type'] = (a0) => + (_sqlite3_value_type = Module['_sqlite3_value_type'] = + wasmExports['sqlite3_value_type'])(a0)); + var _sqlite3_value_nochange = (Module['_sqlite3_value_nochange'] = (a0) => + (_sqlite3_value_nochange = Module['_sqlite3_value_nochange'] = + wasmExports['sqlite3_value_nochange'])(a0)); + var _sqlite3_value_frombind = (Module['_sqlite3_value_frombind'] = (a0) => + (_sqlite3_value_frombind = Module['_sqlite3_value_frombind'] = + wasmExports['sqlite3_value_frombind'])(a0)); + var _sqlite3_value_dup = (Module['_sqlite3_value_dup'] = (a0) => + (_sqlite3_value_dup = Module['_sqlite3_value_dup'] = + wasmExports['sqlite3_value_dup'])(a0)); + var _sqlite3_value_free = (Module['_sqlite3_value_free'] = (a0) => + (_sqlite3_value_free = Module['_sqlite3_value_free'] = + wasmExports['sqlite3_value_free'])(a0)); + var _sqlite3_result_blob = (Module['_sqlite3_result_blob'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_result_blob = Module['_sqlite3_result_blob'] = + wasmExports['sqlite3_result_blob'])(a0, a1, a2, a3)); + var _sqlite3_result_error_toobig = (Module['_sqlite3_result_error_toobig'] = + (a0) => + (_sqlite3_result_error_toobig = Module['_sqlite3_result_error_toobig'] = + wasmExports['sqlite3_result_error_toobig'])(a0)); + var _sqlite3_result_error_nomem = (Module['_sqlite3_result_error_nomem'] = ( + a0, + ) => + (_sqlite3_result_error_nomem = Module['_sqlite3_result_error_nomem'] = + wasmExports['sqlite3_result_error_nomem'])(a0)); + var _sqlite3_result_double = (Module['_sqlite3_result_double'] = (a0, a1) => + (_sqlite3_result_double = Module['_sqlite3_result_double'] = + wasmExports['sqlite3_result_double'])(a0, a1)); + var _sqlite3_result_error = (Module['_sqlite3_result_error'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_result_error = Module['_sqlite3_result_error'] = + wasmExports['sqlite3_result_error'])(a0, a1, a2)); + var _sqlite3_result_int = (Module['_sqlite3_result_int'] = (a0, a1) => + (_sqlite3_result_int = Module['_sqlite3_result_int'] = + wasmExports['sqlite3_result_int'])(a0, a1)); + var _sqlite3_result_int64 = (Module['_sqlite3_result_int64'] = (a0, a1) => + (_sqlite3_result_int64 = Module['_sqlite3_result_int64'] = + wasmExports['sqlite3_result_int64'])(a0, a1)); + var _sqlite3_result_null = (Module['_sqlite3_result_null'] = (a0) => + (_sqlite3_result_null = Module['_sqlite3_result_null'] = + wasmExports['sqlite3_result_null'])(a0)); + var _sqlite3_result_pointer = (Module['_sqlite3_result_pointer'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_result_pointer = Module['_sqlite3_result_pointer'] = + wasmExports['sqlite3_result_pointer'])(a0, a1, a2, a3)); + var _sqlite3_result_subtype = (Module['_sqlite3_result_subtype'] = ( + a0, + a1, + ) => + (_sqlite3_result_subtype = Module['_sqlite3_result_subtype'] = + wasmExports['sqlite3_result_subtype'])(a0, a1)); + var _sqlite3_result_text = (Module['_sqlite3_result_text'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_result_text = Module['_sqlite3_result_text'] = + wasmExports['sqlite3_result_text'])(a0, a1, a2, a3)); + var _sqlite3_result_zeroblob = (Module['_sqlite3_result_zeroblob'] = ( + a0, + a1, + ) => + (_sqlite3_result_zeroblob = Module['_sqlite3_result_zeroblob'] = + wasmExports['sqlite3_result_zeroblob'])(a0, a1)); + var _sqlite3_result_zeroblob64 = (Module['_sqlite3_result_zeroblob64'] = ( + a0, + a1, + ) => + (_sqlite3_result_zeroblob64 = Module['_sqlite3_result_zeroblob64'] = + wasmExports['sqlite3_result_zeroblob64'])(a0, a1)); + var _sqlite3_result_error_code = (Module['_sqlite3_result_error_code'] = ( + a0, + a1, + ) => + (_sqlite3_result_error_code = Module['_sqlite3_result_error_code'] = + wasmExports['sqlite3_result_error_code'])(a0, a1)); + var _sqlite3_user_data = (Module['_sqlite3_user_data'] = (a0) => + (_sqlite3_user_data = Module['_sqlite3_user_data'] = + wasmExports['sqlite3_user_data'])(a0)); + var _sqlite3_context_db_handle = (Module['_sqlite3_context_db_handle'] = ( + a0, + ) => + (_sqlite3_context_db_handle = Module['_sqlite3_context_db_handle'] = + wasmExports['sqlite3_context_db_handle'])(a0)); + var _sqlite3_vtab_nochange = (Module['_sqlite3_vtab_nochange'] = (a0) => + (_sqlite3_vtab_nochange = Module['_sqlite3_vtab_nochange'] = + wasmExports['sqlite3_vtab_nochange'])(a0)); + var _sqlite3_vtab_in_first = (Module['_sqlite3_vtab_in_first'] = (a0, a1) => + (_sqlite3_vtab_in_first = Module['_sqlite3_vtab_in_first'] = + wasmExports['sqlite3_vtab_in_first'])(a0, a1)); + var _sqlite3_vtab_in_next = (Module['_sqlite3_vtab_in_next'] = (a0, a1) => + (_sqlite3_vtab_in_next = Module['_sqlite3_vtab_in_next'] = + wasmExports['sqlite3_vtab_in_next'])(a0, a1)); + var _sqlite3_aggregate_context = (Module['_sqlite3_aggregate_context'] = ( + a0, + a1, + ) => + (_sqlite3_aggregate_context = Module['_sqlite3_aggregate_context'] = + wasmExports['sqlite3_aggregate_context'])(a0, a1)); + var _sqlite3_get_auxdata = (Module['_sqlite3_get_auxdata'] = (a0, a1) => + (_sqlite3_get_auxdata = Module['_sqlite3_get_auxdata'] = + wasmExports['sqlite3_get_auxdata'])(a0, a1)); + var _sqlite3_set_auxdata = (Module['_sqlite3_set_auxdata'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_set_auxdata = Module['_sqlite3_set_auxdata'] = + wasmExports['sqlite3_set_auxdata'])(a0, a1, a2, a3)); + var _sqlite3_column_count = (Module['_sqlite3_column_count'] = (a0) => + (_sqlite3_column_count = Module['_sqlite3_column_count'] = + wasmExports['sqlite3_column_count'])(a0)); + var _sqlite3_data_count = (Module['_sqlite3_data_count'] = (a0) => + (_sqlite3_data_count = Module['_sqlite3_data_count'] = + wasmExports['sqlite3_data_count'])(a0)); + var _sqlite3_column_blob = (Module['_sqlite3_column_blob'] = (a0, a1) => + (_sqlite3_column_blob = Module['_sqlite3_column_blob'] = + wasmExports['sqlite3_column_blob'])(a0, a1)); + var _sqlite3_column_bytes = (Module['_sqlite3_column_bytes'] = (a0, a1) => + (_sqlite3_column_bytes = Module['_sqlite3_column_bytes'] = + wasmExports['sqlite3_column_bytes'])(a0, a1)); + var _sqlite3_column_double = (Module['_sqlite3_column_double'] = (a0, a1) => + (_sqlite3_column_double = Module['_sqlite3_column_double'] = + wasmExports['sqlite3_column_double'])(a0, a1)); + var _sqlite3_column_value = (Module['_sqlite3_column_value'] = (a0, a1) => + (_sqlite3_column_value = Module['_sqlite3_column_value'] = + wasmExports['sqlite3_column_value'])(a0, a1)); + var _sqlite3_column_decltype = (Module['_sqlite3_column_decltype'] = ( + a0, + a1, + ) => + (_sqlite3_column_decltype = Module['_sqlite3_column_decltype'] = + wasmExports['sqlite3_column_decltype'])(a0, a1)); + var _sqlite3_bind_blob = (Module['_sqlite3_bind_blob'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_bind_blob = Module['_sqlite3_bind_blob'] = + wasmExports['sqlite3_bind_blob'])(a0, a1, a2, a3, a4)); + var _sqlite3_bind_double = (Module['_sqlite3_bind_double'] = (a0, a1, a2) => + (_sqlite3_bind_double = Module['_sqlite3_bind_double'] = + wasmExports['sqlite3_bind_double'])(a0, a1, a2)); + var _sqlite3_bind_int = (Module['_sqlite3_bind_int'] = (a0, a1, a2) => + (_sqlite3_bind_int = Module['_sqlite3_bind_int'] = + wasmExports['sqlite3_bind_int'])(a0, a1, a2)); + var _sqlite3_bind_int64 = (Module['_sqlite3_bind_int64'] = (a0, a1, a2) => + (_sqlite3_bind_int64 = Module['_sqlite3_bind_int64'] = + wasmExports['sqlite3_bind_int64'])(a0, a1, a2)); + var _sqlite3_bind_null = (Module['_sqlite3_bind_null'] = (a0, a1) => + (_sqlite3_bind_null = Module['_sqlite3_bind_null'] = + wasmExports['sqlite3_bind_null'])(a0, a1)); + var _sqlite3_bind_pointer = (Module['_sqlite3_bind_pointer'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_bind_pointer = Module['_sqlite3_bind_pointer'] = + wasmExports['sqlite3_bind_pointer'])(a0, a1, a2, a3, a4)); + var _sqlite3_bind_text = (Module['_sqlite3_bind_text'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_bind_text = Module['_sqlite3_bind_text'] = + wasmExports['sqlite3_bind_text'])(a0, a1, a2, a3, a4)); + var _sqlite3_bind_parameter_count = (Module[ + '_sqlite3_bind_parameter_count' + ] = (a0) => + (_sqlite3_bind_parameter_count = Module['_sqlite3_bind_parameter_count'] = + wasmExports['sqlite3_bind_parameter_count'])(a0)); + var _sqlite3_bind_parameter_name = (Module['_sqlite3_bind_parameter_name'] = + (a0, a1) => + (_sqlite3_bind_parameter_name = Module['_sqlite3_bind_parameter_name'] = + wasmExports['sqlite3_bind_parameter_name'])(a0, a1)); + var _sqlite3_bind_parameter_index = (Module[ + '_sqlite3_bind_parameter_index' + ] = (a0, a1) => + (_sqlite3_bind_parameter_index = Module['_sqlite3_bind_parameter_index'] = + wasmExports['sqlite3_bind_parameter_index'])(a0, a1)); + var _sqlite3_db_handle = (Module['_sqlite3_db_handle'] = (a0) => + (_sqlite3_db_handle = Module['_sqlite3_db_handle'] = + wasmExports['sqlite3_db_handle'])(a0)); + var _sqlite3_stmt_readonly = (Module['_sqlite3_stmt_readonly'] = (a0) => + (_sqlite3_stmt_readonly = Module['_sqlite3_stmt_readonly'] = + wasmExports['sqlite3_stmt_readonly'])(a0)); + var _sqlite3_stmt_isexplain = (Module['_sqlite3_stmt_isexplain'] = (a0) => + (_sqlite3_stmt_isexplain = Module['_sqlite3_stmt_isexplain'] = + wasmExports['sqlite3_stmt_isexplain'])(a0)); + var _sqlite3_stmt_explain = (Module['_sqlite3_stmt_explain'] = (a0, a1) => + (_sqlite3_stmt_explain = Module['_sqlite3_stmt_explain'] = + wasmExports['sqlite3_stmt_explain'])(a0, a1)); + var _sqlite3_stmt_busy = (Module['_sqlite3_stmt_busy'] = (a0) => + (_sqlite3_stmt_busy = Module['_sqlite3_stmt_busy'] = + wasmExports['sqlite3_stmt_busy'])(a0)); + var _sqlite3_stmt_status = (Module['_sqlite3_stmt_status'] = (a0, a1, a2) => + (_sqlite3_stmt_status = Module['_sqlite3_stmt_status'] = + wasmExports['sqlite3_stmt_status'])(a0, a1, a2)); + var _sqlite3_sql = (Module['_sqlite3_sql'] = (a0) => + (_sqlite3_sql = Module['_sqlite3_sql'] = wasmExports['sqlite3_sql'])(a0)); + var _sqlite3_expanded_sql = (Module['_sqlite3_expanded_sql'] = (a0) => + (_sqlite3_expanded_sql = Module['_sqlite3_expanded_sql'] = + wasmExports['sqlite3_expanded_sql'])(a0)); + var _sqlite3_preupdate_old = (Module['_sqlite3_preupdate_old'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_preupdate_old = Module['_sqlite3_preupdate_old'] = + wasmExports['sqlite3_preupdate_old'])(a0, a1, a2)); + var _sqlite3_preupdate_count = (Module['_sqlite3_preupdate_count'] = (a0) => + (_sqlite3_preupdate_count = Module['_sqlite3_preupdate_count'] = + wasmExports['sqlite3_preupdate_count'])(a0)); + var _sqlite3_preupdate_depth = (Module['_sqlite3_preupdate_depth'] = (a0) => + (_sqlite3_preupdate_depth = Module['_sqlite3_preupdate_depth'] = + wasmExports['sqlite3_preupdate_depth'])(a0)); + var _sqlite3_preupdate_blobwrite = (Module['_sqlite3_preupdate_blobwrite'] = + (a0) => + (_sqlite3_preupdate_blobwrite = Module['_sqlite3_preupdate_blobwrite'] = + wasmExports['sqlite3_preupdate_blobwrite'])(a0)); + var _sqlite3_preupdate_new = (Module['_sqlite3_preupdate_new'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_preupdate_new = Module['_sqlite3_preupdate_new'] = + wasmExports['sqlite3_preupdate_new'])(a0, a1, a2)); + var _sqlite3_value_numeric_type = (Module['_sqlite3_value_numeric_type'] = ( + a0, + ) => + (_sqlite3_value_numeric_type = Module['_sqlite3_value_numeric_type'] = + wasmExports['sqlite3_value_numeric_type'])(a0)); + var _sqlite3_set_authorizer = (Module['_sqlite3_set_authorizer'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_set_authorizer = Module['_sqlite3_set_authorizer'] = + wasmExports['sqlite3_set_authorizer'])(a0, a1, a2)); + var _sqlite3_strglob = (Module['_sqlite3_strglob'] = (a0, a1) => + (_sqlite3_strglob = Module['_sqlite3_strglob'] = + wasmExports['sqlite3_strglob'])(a0, a1)); + var _sqlite3_strlike = (Module['_sqlite3_strlike'] = (a0, a1, a2) => + (_sqlite3_strlike = Module['_sqlite3_strlike'] = + wasmExports['sqlite3_strlike'])(a0, a1, a2)); + var _sqlite3_auto_extension = (Module['_sqlite3_auto_extension'] = (a0) => + (_sqlite3_auto_extension = Module['_sqlite3_auto_extension'] = + wasmExports['sqlite3_auto_extension'])(a0)); + var _sqlite3_cancel_auto_extension = (Module[ + '_sqlite3_cancel_auto_extension' + ] = (a0) => + (_sqlite3_cancel_auto_extension = Module[ + '_sqlite3_cancel_auto_extension' + ] = + wasmExports['sqlite3_cancel_auto_extension'])(a0)); + var _sqlite3_reset_auto_extension = (Module[ + '_sqlite3_reset_auto_extension' + ] = () => + (_sqlite3_reset_auto_extension = Module['_sqlite3_reset_auto_extension'] = + wasmExports['sqlite3_reset_auto_extension'])()); + var _sqlite3_prepare_v3 = (Module['_sqlite3_prepare_v3'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3_prepare_v3 = Module['_sqlite3_prepare_v3'] = + wasmExports['sqlite3_prepare_v3'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3_create_module = (Module['_sqlite3_create_module'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_create_module = Module['_sqlite3_create_module'] = + wasmExports['sqlite3_create_module'])(a0, a1, a2, a3)); + var _sqlite3_create_module_v2 = (Module['_sqlite3_create_module_v2'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_create_module_v2 = Module['_sqlite3_create_module_v2'] = + wasmExports['sqlite3_create_module_v2'])(a0, a1, a2, a3, a4)); + var _sqlite3_drop_modules = (Module['_sqlite3_drop_modules'] = (a0, a1) => + (_sqlite3_drop_modules = Module['_sqlite3_drop_modules'] = + wasmExports['sqlite3_drop_modules'])(a0, a1)); + var _sqlite3_declare_vtab = (Module['_sqlite3_declare_vtab'] = (a0, a1) => + (_sqlite3_declare_vtab = Module['_sqlite3_declare_vtab'] = + wasmExports['sqlite3_declare_vtab'])(a0, a1)); + var _sqlite3_vtab_on_conflict = (Module['_sqlite3_vtab_on_conflict'] = ( + a0, + ) => + (_sqlite3_vtab_on_conflict = Module['_sqlite3_vtab_on_conflict'] = + wasmExports['sqlite3_vtab_on_conflict'])(a0)); + var _sqlite3_vtab_collation = (Module['_sqlite3_vtab_collation'] = ( + a0, + a1, + ) => + (_sqlite3_vtab_collation = Module['_sqlite3_vtab_collation'] = + wasmExports['sqlite3_vtab_collation'])(a0, a1)); + var _sqlite3_vtab_in = (Module['_sqlite3_vtab_in'] = (a0, a1, a2) => + (_sqlite3_vtab_in = Module['_sqlite3_vtab_in'] = + wasmExports['sqlite3_vtab_in'])(a0, a1, a2)); + var _sqlite3_vtab_rhs_value = (Module['_sqlite3_vtab_rhs_value'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_vtab_rhs_value = Module['_sqlite3_vtab_rhs_value'] = + wasmExports['sqlite3_vtab_rhs_value'])(a0, a1, a2)); + var _sqlite3_vtab_distinct = (Module['_sqlite3_vtab_distinct'] = (a0) => + (_sqlite3_vtab_distinct = Module['_sqlite3_vtab_distinct'] = + wasmExports['sqlite3_vtab_distinct'])(a0)); + var _sqlite3_keyword_name = (Module['_sqlite3_keyword_name'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_keyword_name = Module['_sqlite3_keyword_name'] = + wasmExports['sqlite3_keyword_name'])(a0, a1, a2)); + var _sqlite3_keyword_count = (Module['_sqlite3_keyword_count'] = () => + (_sqlite3_keyword_count = Module['_sqlite3_keyword_count'] = + wasmExports['sqlite3_keyword_count'])()); + var _sqlite3_keyword_check = (Module['_sqlite3_keyword_check'] = (a0, a1) => + (_sqlite3_keyword_check = Module['_sqlite3_keyword_check'] = + wasmExports['sqlite3_keyword_check'])(a0, a1)); + var _sqlite3_complete = (Module['_sqlite3_complete'] = (a0) => + (_sqlite3_complete = Module['_sqlite3_complete'] = + wasmExports['sqlite3_complete'])(a0)); + var _sqlite3_libversion = (Module['_sqlite3_libversion'] = () => + (_sqlite3_libversion = Module['_sqlite3_libversion'] = + wasmExports['sqlite3_libversion'])()); + var _sqlite3_libversion_number = (Module['_sqlite3_libversion_number'] = + () => + (_sqlite3_libversion_number = Module['_sqlite3_libversion_number'] = + wasmExports['sqlite3_libversion_number'])()); + var _sqlite3_shutdown = (Module['_sqlite3_shutdown'] = () => + (_sqlite3_shutdown = Module['_sqlite3_shutdown'] = + wasmExports['sqlite3_shutdown'])()); + var _sqlite3_last_insert_rowid = (Module['_sqlite3_last_insert_rowid'] = ( + a0, + ) => + (_sqlite3_last_insert_rowid = Module['_sqlite3_last_insert_rowid'] = + wasmExports['sqlite3_last_insert_rowid'])(a0)); + var _sqlite3_set_last_insert_rowid = (Module[ + '_sqlite3_set_last_insert_rowid' + ] = (a0, a1) => + (_sqlite3_set_last_insert_rowid = Module[ + '_sqlite3_set_last_insert_rowid' + ] = + wasmExports['sqlite3_set_last_insert_rowid'])(a0, a1)); + var _sqlite3_changes64 = (Module['_sqlite3_changes64'] = (a0) => + (_sqlite3_changes64 = Module['_sqlite3_changes64'] = + wasmExports['sqlite3_changes64'])(a0)); + var _sqlite3_changes = (Module['_sqlite3_changes'] = (a0) => + (_sqlite3_changes = Module['_sqlite3_changes'] = + wasmExports['sqlite3_changes'])(a0)); + var _sqlite3_total_changes64 = (Module['_sqlite3_total_changes64'] = (a0) => + (_sqlite3_total_changes64 = Module['_sqlite3_total_changes64'] = + wasmExports['sqlite3_total_changes64'])(a0)); + var _sqlite3_total_changes = (Module['_sqlite3_total_changes'] = (a0) => + (_sqlite3_total_changes = Module['_sqlite3_total_changes'] = + wasmExports['sqlite3_total_changes'])(a0)); + var _sqlite3_txn_state = (Module['_sqlite3_txn_state'] = (a0, a1) => + (_sqlite3_txn_state = Module['_sqlite3_txn_state'] = + wasmExports['sqlite3_txn_state'])(a0, a1)); + var _sqlite3_close_v2 = (Module['_sqlite3_close_v2'] = (a0) => + (_sqlite3_close_v2 = Module['_sqlite3_close_v2'] = + wasmExports['sqlite3_close_v2'])(a0)); + var _sqlite3_busy_handler = (Module['_sqlite3_busy_handler'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_busy_handler = Module['_sqlite3_busy_handler'] = + wasmExports['sqlite3_busy_handler'])(a0, a1, a2)); + var _sqlite3_progress_handler = (Module['_sqlite3_progress_handler'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_progress_handler = Module['_sqlite3_progress_handler'] = + wasmExports['sqlite3_progress_handler'])(a0, a1, a2, a3)); + var _sqlite3_busy_timeout = (Module['_sqlite3_busy_timeout'] = (a0, a1) => + (_sqlite3_busy_timeout = Module['_sqlite3_busy_timeout'] = + wasmExports['sqlite3_busy_timeout'])(a0, a1)); + var _sqlite3_interrupt = (Module['_sqlite3_interrupt'] = (a0) => + (_sqlite3_interrupt = Module['_sqlite3_interrupt'] = + wasmExports['sqlite3_interrupt'])(a0)); + var _sqlite3_is_interrupted = (Module['_sqlite3_is_interrupted'] = (a0) => + (_sqlite3_is_interrupted = Module['_sqlite3_is_interrupted'] = + wasmExports['sqlite3_is_interrupted'])(a0)); + var _sqlite3_create_function = (Module['_sqlite3_create_function'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (_sqlite3_create_function = Module['_sqlite3_create_function'] = + wasmExports['sqlite3_create_function'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var _sqlite3_create_function_v2 = (Module['_sqlite3_create_function_v2'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (_sqlite3_create_function_v2 = Module['_sqlite3_create_function_v2'] = + wasmExports['sqlite3_create_function_v2'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3_create_window_function = (Module[ + '_sqlite3_create_window_function' + ] = (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) => + (_sqlite3_create_window_function = Module[ + '_sqlite3_create_window_function' + ] = + wasmExports['sqlite3_create_window_function'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var _sqlite3_overload_function = (Module['_sqlite3_overload_function'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_overload_function = Module['_sqlite3_overload_function'] = + wasmExports['sqlite3_overload_function'])(a0, a1, a2)); + var _sqlite3_trace_v2 = (Module['_sqlite3_trace_v2'] = (a0, a1, a2, a3) => + (_sqlite3_trace_v2 = Module['_sqlite3_trace_v2'] = + wasmExports['sqlite3_trace_v2'])(a0, a1, a2, a3)); + var _sqlite3_commit_hook = (Module['_sqlite3_commit_hook'] = (a0, a1, a2) => + (_sqlite3_commit_hook = Module['_sqlite3_commit_hook'] = + wasmExports['sqlite3_commit_hook'])(a0, a1, a2)); + var _sqlite3_update_hook = (Module['_sqlite3_update_hook'] = (a0, a1, a2) => + (_sqlite3_update_hook = Module['_sqlite3_update_hook'] = + wasmExports['sqlite3_update_hook'])(a0, a1, a2)); + var _sqlite3_rollback_hook = (Module['_sqlite3_rollback_hook'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_rollback_hook = Module['_sqlite3_rollback_hook'] = + wasmExports['sqlite3_rollback_hook'])(a0, a1, a2)); + var _sqlite3_preupdate_hook = (Module['_sqlite3_preupdate_hook'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_preupdate_hook = Module['_sqlite3_preupdate_hook'] = + wasmExports['sqlite3_preupdate_hook'])(a0, a1, a2)); + var _sqlite3_error_offset = (Module['_sqlite3_error_offset'] = (a0) => + (_sqlite3_error_offset = Module['_sqlite3_error_offset'] = + wasmExports['sqlite3_error_offset'])(a0)); + var _sqlite3_errcode = (Module['_sqlite3_errcode'] = (a0) => + (_sqlite3_errcode = Module['_sqlite3_errcode'] = + wasmExports['sqlite3_errcode'])(a0)); + var _sqlite3_extended_errcode = (Module['_sqlite3_extended_errcode'] = ( + a0, + ) => + (_sqlite3_extended_errcode = Module['_sqlite3_extended_errcode'] = + wasmExports['sqlite3_extended_errcode'])(a0)); + var _sqlite3_errstr = (Module['_sqlite3_errstr'] = (a0) => + (_sqlite3_errstr = Module['_sqlite3_errstr'] = + wasmExports['sqlite3_errstr'])(a0)); + var _sqlite3_limit = (Module['_sqlite3_limit'] = (a0, a1, a2) => + (_sqlite3_limit = Module['_sqlite3_limit'] = + wasmExports['sqlite3_limit'])(a0, a1, a2)); + var _sqlite3_open = (Module['_sqlite3_open'] = (a0, a1) => + (_sqlite3_open = Module['_sqlite3_open'] = wasmExports['sqlite3_open'])( + a0, + a1, + )); + var _sqlite3_open_v2 = (Module['_sqlite3_open_v2'] = (a0, a1, a2, a3) => + (_sqlite3_open_v2 = Module['_sqlite3_open_v2'] = + wasmExports['sqlite3_open_v2'])(a0, a1, a2, a3)); + var _sqlite3_create_collation = (Module['_sqlite3_create_collation'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_create_collation = Module['_sqlite3_create_collation'] = + wasmExports['sqlite3_create_collation'])(a0, a1, a2, a3, a4)); + var _sqlite3_create_collation_v2 = (Module['_sqlite3_create_collation_v2'] = + (a0, a1, a2, a3, a4, a5) => + (_sqlite3_create_collation_v2 = Module['_sqlite3_create_collation_v2'] = + wasmExports['sqlite3_create_collation_v2'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3_collation_needed = (Module['_sqlite3_collation_needed'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_collation_needed = Module['_sqlite3_collation_needed'] = + wasmExports['sqlite3_collation_needed'])(a0, a1, a2)); + var _sqlite3_get_autocommit = (Module['_sqlite3_get_autocommit'] = (a0) => + (_sqlite3_get_autocommit = Module['_sqlite3_get_autocommit'] = + wasmExports['sqlite3_get_autocommit'])(a0)); + var _sqlite3_table_column_metadata = (Module[ + '_sqlite3_table_column_metadata' + ] = (a0, a1, a2, a3, a4, a5, a6, a7, a8) => + (_sqlite3_table_column_metadata = Module[ + '_sqlite3_table_column_metadata' + ] = + wasmExports['sqlite3_table_column_metadata'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3_extended_result_codes = (Module[ + '_sqlite3_extended_result_codes' + ] = (a0, a1) => + (_sqlite3_extended_result_codes = Module[ + '_sqlite3_extended_result_codes' + ] = + wasmExports['sqlite3_extended_result_codes'])(a0, a1)); + var _sqlite3_uri_key = (Module['_sqlite3_uri_key'] = (a0, a1) => + (_sqlite3_uri_key = Module['_sqlite3_uri_key'] = + wasmExports['sqlite3_uri_key'])(a0, a1)); + var _sqlite3_uri_int64 = (Module['_sqlite3_uri_int64'] = (a0, a1, a2) => + (_sqlite3_uri_int64 = Module['_sqlite3_uri_int64'] = + wasmExports['sqlite3_uri_int64'])(a0, a1, a2)); + var _sqlite3_db_name = (Module['_sqlite3_db_name'] = (a0, a1) => + (_sqlite3_db_name = Module['_sqlite3_db_name'] = + wasmExports['sqlite3_db_name'])(a0, a1)); + var _sqlite3_db_filename = (Module['_sqlite3_db_filename'] = (a0, a1) => + (_sqlite3_db_filename = Module['_sqlite3_db_filename'] = + wasmExports['sqlite3_db_filename'])(a0, a1)); + var _sqlite3_db_readonly = (Module['_sqlite3_db_readonly'] = (a0, a1) => + (_sqlite3_db_readonly = Module['_sqlite3_db_readonly'] = + wasmExports['sqlite3_db_readonly'])(a0, a1)); + var _sqlite3_compileoption_used = (Module['_sqlite3_compileoption_used'] = ( + a0, + ) => + (_sqlite3_compileoption_used = Module['_sqlite3_compileoption_used'] = + wasmExports['sqlite3_compileoption_used'])(a0)); + var _sqlite3_compileoption_get = (Module['_sqlite3_compileoption_get'] = ( + a0, + ) => + (_sqlite3_compileoption_get = Module['_sqlite3_compileoption_get'] = + wasmExports['sqlite3_compileoption_get'])(a0)); + var _sqlite3session_diff = (Module['_sqlite3session_diff'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3session_diff = Module['_sqlite3session_diff'] = + wasmExports['sqlite3session_diff'])(a0, a1, a2, a3)); + var _sqlite3session_attach = (Module['_sqlite3session_attach'] = (a0, a1) => + (_sqlite3session_attach = Module['_sqlite3session_attach'] = + wasmExports['sqlite3session_attach'])(a0, a1)); + var _sqlite3session_create = (Module['_sqlite3session_create'] = ( + a0, + a1, + a2, + ) => + (_sqlite3session_create = Module['_sqlite3session_create'] = + wasmExports['sqlite3session_create'])(a0, a1, a2)); + var _sqlite3session_delete = (Module['_sqlite3session_delete'] = (a0) => + (_sqlite3session_delete = Module['_sqlite3session_delete'] = + wasmExports['sqlite3session_delete'])(a0)); + var _sqlite3session_table_filter = (Module['_sqlite3session_table_filter'] = + (a0, a1, a2) => + (_sqlite3session_table_filter = Module['_sqlite3session_table_filter'] = + wasmExports['sqlite3session_table_filter'])(a0, a1, a2)); + var _sqlite3session_changeset = (Module['_sqlite3session_changeset'] = ( + a0, + a1, + a2, + ) => + (_sqlite3session_changeset = Module['_sqlite3session_changeset'] = + wasmExports['sqlite3session_changeset'])(a0, a1, a2)); + var _sqlite3session_changeset_strm = (Module[ + '_sqlite3session_changeset_strm' + ] = (a0, a1, a2) => + (_sqlite3session_changeset_strm = Module[ + '_sqlite3session_changeset_strm' + ] = + wasmExports['sqlite3session_changeset_strm'])(a0, a1, a2)); + var _sqlite3session_patchset_strm = (Module[ + '_sqlite3session_patchset_strm' + ] = (a0, a1, a2) => + (_sqlite3session_patchset_strm = Module['_sqlite3session_patchset_strm'] = + wasmExports['sqlite3session_patchset_strm'])(a0, a1, a2)); + var _sqlite3session_patchset = (Module['_sqlite3session_patchset'] = ( + a0, + a1, + a2, + ) => + (_sqlite3session_patchset = Module['_sqlite3session_patchset'] = + wasmExports['sqlite3session_patchset'])(a0, a1, a2)); + var _sqlite3session_enable = (Module['_sqlite3session_enable'] = (a0, a1) => + (_sqlite3session_enable = Module['_sqlite3session_enable'] = + wasmExports['sqlite3session_enable'])(a0, a1)); + var _sqlite3session_indirect = (Module['_sqlite3session_indirect'] = ( + a0, + a1, + ) => + (_sqlite3session_indirect = Module['_sqlite3session_indirect'] = + wasmExports['sqlite3session_indirect'])(a0, a1)); + var _sqlite3session_isempty = (Module['_sqlite3session_isempty'] = (a0) => + (_sqlite3session_isempty = Module['_sqlite3session_isempty'] = + wasmExports['sqlite3session_isempty'])(a0)); + var _sqlite3session_memory_used = (Module['_sqlite3session_memory_used'] = ( + a0, + ) => + (_sqlite3session_memory_used = Module['_sqlite3session_memory_used'] = + wasmExports['sqlite3session_memory_used'])(a0)); + var _sqlite3session_object_config = (Module[ + '_sqlite3session_object_config' + ] = (a0, a1, a2) => + (_sqlite3session_object_config = Module['_sqlite3session_object_config'] = + wasmExports['sqlite3session_object_config'])(a0, a1, a2)); + var _sqlite3session_changeset_size = (Module[ + '_sqlite3session_changeset_size' + ] = (a0) => + (_sqlite3session_changeset_size = Module[ + '_sqlite3session_changeset_size' + ] = + wasmExports['sqlite3session_changeset_size'])(a0)); + var _sqlite3changeset_start = (Module['_sqlite3changeset_start'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_start = Module['_sqlite3changeset_start'] = + wasmExports['sqlite3changeset_start'])(a0, a1, a2)); + var _sqlite3changeset_start_v2 = (Module['_sqlite3changeset_start_v2'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3changeset_start_v2 = Module['_sqlite3changeset_start_v2'] = + wasmExports['sqlite3changeset_start_v2'])(a0, a1, a2, a3)); + var _sqlite3changeset_start_strm = (Module['_sqlite3changeset_start_strm'] = + (a0, a1, a2) => + (_sqlite3changeset_start_strm = Module['_sqlite3changeset_start_strm'] = + wasmExports['sqlite3changeset_start_strm'])(a0, a1, a2)); + var _sqlite3changeset_start_v2_strm = (Module[ + '_sqlite3changeset_start_v2_strm' + ] = (a0, a1, a2, a3) => + (_sqlite3changeset_start_v2_strm = Module[ + '_sqlite3changeset_start_v2_strm' + ] = + wasmExports['sqlite3changeset_start_v2_strm'])(a0, a1, a2, a3)); + var _sqlite3changeset_next = (Module['_sqlite3changeset_next'] = (a0) => + (_sqlite3changeset_next = Module['_sqlite3changeset_next'] = + wasmExports['sqlite3changeset_next'])(a0)); + var _sqlite3changeset_op = (Module['_sqlite3changeset_op'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3changeset_op = Module['_sqlite3changeset_op'] = + wasmExports['sqlite3changeset_op'])(a0, a1, a2, a3, a4)); + var _sqlite3changeset_pk = (Module['_sqlite3changeset_pk'] = (a0, a1, a2) => + (_sqlite3changeset_pk = Module['_sqlite3changeset_pk'] = + wasmExports['sqlite3changeset_pk'])(a0, a1, a2)); + var _sqlite3changeset_old = (Module['_sqlite3changeset_old'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_old = Module['_sqlite3changeset_old'] = + wasmExports['sqlite3changeset_old'])(a0, a1, a2)); + var _sqlite3changeset_new = (Module['_sqlite3changeset_new'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_new = Module['_sqlite3changeset_new'] = + wasmExports['sqlite3changeset_new'])(a0, a1, a2)); + var _sqlite3changeset_conflict = (Module['_sqlite3changeset_conflict'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_conflict = Module['_sqlite3changeset_conflict'] = + wasmExports['sqlite3changeset_conflict'])(a0, a1, a2)); + var _sqlite3changeset_fk_conflicts = (Module[ + '_sqlite3changeset_fk_conflicts' + ] = (a0, a1) => + (_sqlite3changeset_fk_conflicts = Module[ + '_sqlite3changeset_fk_conflicts' + ] = + wasmExports['sqlite3changeset_fk_conflicts'])(a0, a1)); + var _sqlite3changeset_finalize = (Module['_sqlite3changeset_finalize'] = ( + a0, + ) => + (_sqlite3changeset_finalize = Module['_sqlite3changeset_finalize'] = + wasmExports['sqlite3changeset_finalize'])(a0)); + var _sqlite3changeset_invert = (Module['_sqlite3changeset_invert'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3changeset_invert = Module['_sqlite3changeset_invert'] = + wasmExports['sqlite3changeset_invert'])(a0, a1, a2, a3)); + var _sqlite3changeset_invert_strm = (Module[ + '_sqlite3changeset_invert_strm' + ] = (a0, a1, a2, a3) => + (_sqlite3changeset_invert_strm = Module['_sqlite3changeset_invert_strm'] = + wasmExports['sqlite3changeset_invert_strm'])(a0, a1, a2, a3)); + var _sqlite3changeset_apply_v2 = (Module['_sqlite3changeset_apply_v2'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (_sqlite3changeset_apply_v2 = Module['_sqlite3changeset_apply_v2'] = + wasmExports['sqlite3changeset_apply_v2'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3changeset_apply = (Module['_sqlite3changeset_apply'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3changeset_apply = Module['_sqlite3changeset_apply'] = + wasmExports['sqlite3changeset_apply'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3changeset_apply_v2_strm = (Module[ + '_sqlite3changeset_apply_v2_strm' + ] = (a0, a1, a2, a3, a4, a5, a6, a7, a8) => + (_sqlite3changeset_apply_v2_strm = Module[ + '_sqlite3changeset_apply_v2_strm' + ] = + wasmExports['sqlite3changeset_apply_v2_strm'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3changeset_apply_strm = (Module['_sqlite3changeset_apply_strm'] = + (a0, a1, a2, a3, a4, a5) => + (_sqlite3changeset_apply_strm = Module['_sqlite3changeset_apply_strm'] = + wasmExports['sqlite3changeset_apply_strm'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3changegroup_new = (Module['_sqlite3changegroup_new'] = (a0) => + (_sqlite3changegroup_new = Module['_sqlite3changegroup_new'] = + wasmExports['sqlite3changegroup_new'])(a0)); + var _sqlite3changegroup_add = (Module['_sqlite3changegroup_add'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changegroup_add = Module['_sqlite3changegroup_add'] = + wasmExports['sqlite3changegroup_add'])(a0, a1, a2)); + var _sqlite3changegroup_output = (Module['_sqlite3changegroup_output'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changegroup_output = Module['_sqlite3changegroup_output'] = + wasmExports['sqlite3changegroup_output'])(a0, a1, a2)); + var _sqlite3changegroup_add_strm = (Module['_sqlite3changegroup_add_strm'] = + (a0, a1, a2) => + (_sqlite3changegroup_add_strm = Module['_sqlite3changegroup_add_strm'] = + wasmExports['sqlite3changegroup_add_strm'])(a0, a1, a2)); + var _sqlite3changegroup_output_strm = (Module[ + '_sqlite3changegroup_output_strm' + ] = (a0, a1, a2) => + (_sqlite3changegroup_output_strm = Module[ + '_sqlite3changegroup_output_strm' + ] = + wasmExports['sqlite3changegroup_output_strm'])(a0, a1, a2)); + var _sqlite3changegroup_delete = (Module['_sqlite3changegroup_delete'] = ( + a0, + ) => + (_sqlite3changegroup_delete = Module['_sqlite3changegroup_delete'] = + wasmExports['sqlite3changegroup_delete'])(a0)); + var _sqlite3changeset_concat = (Module['_sqlite3changeset_concat'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3changeset_concat = Module['_sqlite3changeset_concat'] = + wasmExports['sqlite3changeset_concat'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3changeset_concat_strm = (Module[ + '_sqlite3changeset_concat_strm' + ] = (a0, a1, a2, a3, a4, a5) => + (_sqlite3changeset_concat_strm = Module['_sqlite3changeset_concat_strm'] = + wasmExports['sqlite3changeset_concat_strm'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3session_config = (Module['_sqlite3session_config'] = (a0, a1) => + (_sqlite3session_config = Module['_sqlite3session_config'] = + wasmExports['sqlite3session_config'])(a0, a1)); + var _sqlite3_sourceid = (Module['_sqlite3_sourceid'] = () => + (_sqlite3_sourceid = Module['_sqlite3_sourceid'] = + wasmExports['sqlite3_sourceid'])()); + var _sqlite3__wasm_pstack_ptr = (Module['_sqlite3__wasm_pstack_ptr'] = () => + (_sqlite3__wasm_pstack_ptr = Module['_sqlite3__wasm_pstack_ptr'] = + wasmExports['sqlite3__wasm_pstack_ptr'])()); + var _sqlite3__wasm_pstack_restore = (Module[ + '_sqlite3__wasm_pstack_restore' + ] = (a0) => + (_sqlite3__wasm_pstack_restore = Module['_sqlite3__wasm_pstack_restore'] = + wasmExports['sqlite3__wasm_pstack_restore'])(a0)); + var _sqlite3__wasm_pstack_alloc = (Module['_sqlite3__wasm_pstack_alloc'] = ( + a0, + ) => + (_sqlite3__wasm_pstack_alloc = Module['_sqlite3__wasm_pstack_alloc'] = + wasmExports['sqlite3__wasm_pstack_alloc'])(a0)); + var _sqlite3__wasm_pstack_remaining = (Module[ + '_sqlite3__wasm_pstack_remaining' + ] = () => + (_sqlite3__wasm_pstack_remaining = Module[ + '_sqlite3__wasm_pstack_remaining' + ] = + wasmExports['sqlite3__wasm_pstack_remaining'])()); + var _sqlite3__wasm_pstack_quota = (Module['_sqlite3__wasm_pstack_quota'] = + () => + (_sqlite3__wasm_pstack_quota = Module['_sqlite3__wasm_pstack_quota'] = + wasmExports['sqlite3__wasm_pstack_quota'])()); + var _sqlite3__wasm_db_error = (Module['_sqlite3__wasm_db_error'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_db_error = Module['_sqlite3__wasm_db_error'] = + wasmExports['sqlite3__wasm_db_error'])(a0, a1, a2)); + var _sqlite3__wasm_test_struct = (Module['_sqlite3__wasm_test_struct'] = ( + a0, + ) => + (_sqlite3__wasm_test_struct = Module['_sqlite3__wasm_test_struct'] = + wasmExports['sqlite3__wasm_test_struct'])(a0)); + var _sqlite3__wasm_enum_json = (Module['_sqlite3__wasm_enum_json'] = () => + (_sqlite3__wasm_enum_json = Module['_sqlite3__wasm_enum_json'] = + wasmExports['sqlite3__wasm_enum_json'])()); + var _sqlite3__wasm_vfs_unlink = (Module['_sqlite3__wasm_vfs_unlink'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_vfs_unlink = Module['_sqlite3__wasm_vfs_unlink'] = + wasmExports['sqlite3__wasm_vfs_unlink'])(a0, a1)); + var _sqlite3__wasm_db_vfs = (Module['_sqlite3__wasm_db_vfs'] = (a0, a1) => + (_sqlite3__wasm_db_vfs = Module['_sqlite3__wasm_db_vfs'] = + wasmExports['sqlite3__wasm_db_vfs'])(a0, a1)); + var _sqlite3__wasm_db_reset = (Module['_sqlite3__wasm_db_reset'] = (a0) => + (_sqlite3__wasm_db_reset = Module['_sqlite3__wasm_db_reset'] = + wasmExports['sqlite3__wasm_db_reset'])(a0)); + var _sqlite3__wasm_db_export_chunked = (Module[ + '_sqlite3__wasm_db_export_chunked' + ] = (a0, a1) => + (_sqlite3__wasm_db_export_chunked = Module[ + '_sqlite3__wasm_db_export_chunked' + ] = + wasmExports['sqlite3__wasm_db_export_chunked'])(a0, a1)); + var _sqlite3__wasm_db_serialize = (Module['_sqlite3__wasm_db_serialize'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3__wasm_db_serialize = Module['_sqlite3__wasm_db_serialize'] = + wasmExports['sqlite3__wasm_db_serialize'])(a0, a1, a2, a3, a4)); + var _sqlite3__wasm_vfs_create_file = (Module[ + '_sqlite3__wasm_vfs_create_file' + ] = (a0, a1, a2, a3) => + (_sqlite3__wasm_vfs_create_file = Module[ + '_sqlite3__wasm_vfs_create_file' + ] = + wasmExports['sqlite3__wasm_vfs_create_file'])(a0, a1, a2, a3)); + var _sqlite3__wasm_posix_create_file = (Module[ + '_sqlite3__wasm_posix_create_file' + ] = (a0, a1, a2) => + (_sqlite3__wasm_posix_create_file = Module[ + '_sqlite3__wasm_posix_create_file' + ] = + wasmExports['sqlite3__wasm_posix_create_file'])(a0, a1, a2)); + var _sqlite3__wasm_kvvfsMakeKeyOnPstack = (Module[ + '_sqlite3__wasm_kvvfsMakeKeyOnPstack' + ] = (a0, a1) => + (_sqlite3__wasm_kvvfsMakeKeyOnPstack = Module[ + '_sqlite3__wasm_kvvfsMakeKeyOnPstack' + ] = + wasmExports['sqlite3__wasm_kvvfsMakeKeyOnPstack'])(a0, a1)); + var _sqlite3__wasm_kvvfs_methods = (Module['_sqlite3__wasm_kvvfs_methods'] = + () => + (_sqlite3__wasm_kvvfs_methods = Module['_sqlite3__wasm_kvvfs_methods'] = + wasmExports['sqlite3__wasm_kvvfs_methods'])()); + var _sqlite3__wasm_vtab_config = (Module['_sqlite3__wasm_vtab_config'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_vtab_config = Module['_sqlite3__wasm_vtab_config'] = + wasmExports['sqlite3__wasm_vtab_config'])(a0, a1, a2)); + var _sqlite3__wasm_db_config_ip = (Module['_sqlite3__wasm_db_config_ip'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3__wasm_db_config_ip = Module['_sqlite3__wasm_db_config_ip'] = + wasmExports['sqlite3__wasm_db_config_ip'])(a0, a1, a2, a3)); + var _sqlite3__wasm_db_config_pii = (Module['_sqlite3__wasm_db_config_pii'] = + (a0, a1, a2, a3, a4) => + (_sqlite3__wasm_db_config_pii = Module['_sqlite3__wasm_db_config_pii'] = + wasmExports['sqlite3__wasm_db_config_pii'])(a0, a1, a2, a3, a4)); + var _sqlite3__wasm_db_config_s = (Module['_sqlite3__wasm_db_config_s'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_db_config_s = Module['_sqlite3__wasm_db_config_s'] = + wasmExports['sqlite3__wasm_db_config_s'])(a0, a1, a2)); + var _sqlite3__wasm_config_i = (Module['_sqlite3__wasm_config_i'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_config_i = Module['_sqlite3__wasm_config_i'] = + wasmExports['sqlite3__wasm_config_i'])(a0, a1)); + var _sqlite3__wasm_config_ii = (Module['_sqlite3__wasm_config_ii'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_config_ii = Module['_sqlite3__wasm_config_ii'] = + wasmExports['sqlite3__wasm_config_ii'])(a0, a1, a2)); + var _sqlite3__wasm_config_j = (Module['_sqlite3__wasm_config_j'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_config_j = Module['_sqlite3__wasm_config_j'] = + wasmExports['sqlite3__wasm_config_j'])(a0, a1)); + var _sqlite3__wasm_qfmt_token = (Module['_sqlite3__wasm_qfmt_token'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_qfmt_token = Module['_sqlite3__wasm_qfmt_token'] = + wasmExports['sqlite3__wasm_qfmt_token'])(a0, a1)); + var _sqlite3__wasm_init_wasmfs = (Module['_sqlite3__wasm_init_wasmfs'] = ( + a0, + ) => + (_sqlite3__wasm_init_wasmfs = Module['_sqlite3__wasm_init_wasmfs'] = + wasmExports['sqlite3__wasm_init_wasmfs'])(a0)); + var _sqlite3__wasm_test_intptr = (Module['_sqlite3__wasm_test_intptr'] = ( + a0, + ) => + (_sqlite3__wasm_test_intptr = Module['_sqlite3__wasm_test_intptr'] = + wasmExports['sqlite3__wasm_test_intptr'])(a0)); + var _sqlite3__wasm_test_voidptr = (Module['_sqlite3__wasm_test_voidptr'] = ( + a0, + ) => + (_sqlite3__wasm_test_voidptr = Module['_sqlite3__wasm_test_voidptr'] = + wasmExports['sqlite3__wasm_test_voidptr'])(a0)); + var _sqlite3__wasm_test_int64_max = (Module[ + '_sqlite3__wasm_test_int64_max' + ] = () => + (_sqlite3__wasm_test_int64_max = Module['_sqlite3__wasm_test_int64_max'] = + wasmExports['sqlite3__wasm_test_int64_max'])()); + var _sqlite3__wasm_test_int64_min = (Module[ + '_sqlite3__wasm_test_int64_min' + ] = () => + (_sqlite3__wasm_test_int64_min = Module['_sqlite3__wasm_test_int64_min'] = + wasmExports['sqlite3__wasm_test_int64_min'])()); + var _sqlite3__wasm_test_int64_times2 = (Module[ + '_sqlite3__wasm_test_int64_times2' + ] = (a0) => + (_sqlite3__wasm_test_int64_times2 = Module[ + '_sqlite3__wasm_test_int64_times2' + ] = + wasmExports['sqlite3__wasm_test_int64_times2'])(a0)); + var _sqlite3__wasm_test_int64_minmax = (Module[ + '_sqlite3__wasm_test_int64_minmax' + ] = (a0, a1) => + (_sqlite3__wasm_test_int64_minmax = Module[ + '_sqlite3__wasm_test_int64_minmax' + ] = + wasmExports['sqlite3__wasm_test_int64_minmax'])(a0, a1)); + var _sqlite3__wasm_test_int64ptr = (Module['_sqlite3__wasm_test_int64ptr'] = + (a0) => + (_sqlite3__wasm_test_int64ptr = Module['_sqlite3__wasm_test_int64ptr'] = + wasmExports['sqlite3__wasm_test_int64ptr'])(a0)); + var _sqlite3__wasm_test_stack_overflow = (Module[ + '_sqlite3__wasm_test_stack_overflow' + ] = (a0) => + (_sqlite3__wasm_test_stack_overflow = Module[ + '_sqlite3__wasm_test_stack_overflow' + ] = + wasmExports['sqlite3__wasm_test_stack_overflow'])(a0)); + var _sqlite3__wasm_test_str_hello = (Module[ + '_sqlite3__wasm_test_str_hello' + ] = (a0) => + (_sqlite3__wasm_test_str_hello = Module['_sqlite3__wasm_test_str_hello'] = + wasmExports['sqlite3__wasm_test_str_hello'])(a0)); + var _sqlite3__wasm_SQLTester_strglob = (Module[ + '_sqlite3__wasm_SQLTester_strglob' + ] = (a0, a1) => + (_sqlite3__wasm_SQLTester_strglob = Module[ + '_sqlite3__wasm_SQLTester_strglob' + ] = + wasmExports['sqlite3__wasm_SQLTester_strglob'])(a0, a1)); + var _malloc = (Module['_malloc'] = (a0) => + (_malloc = Module['_malloc'] = wasmExports['malloc'])(a0)); + var _free = (Module['_free'] = (a0) => + (_free = Module['_free'] = wasmExports['free'])(a0)); + var _realloc = (Module['_realloc'] = (a0, a1) => + (_realloc = Module['_realloc'] = wasmExports['realloc'])(a0, a1)); + var _emscripten_builtin_memalign = (a0, a1) => + (_emscripten_builtin_memalign = + wasmExports['emscripten_builtin_memalign'])(a0, a1); + var __emscripten_stack_restore = (a0) => + (__emscripten_stack_restore = wasmExports['_emscripten_stack_restore'])( + a0, + ); + var __emscripten_stack_alloc = (a0) => + (__emscripten_stack_alloc = wasmExports['_emscripten_stack_alloc'])(a0); + var _emscripten_stack_get_current = () => + (_emscripten_stack_get_current = + wasmExports['emscripten_stack_get_current'])(); + + Module['wasmMemory'] = wasmMemory; + + var calledRun; + var calledPrerun; + + dependenciesFulfilled = function runCaller() { + if (!calledRun) run(); + if (!calledRun) dependenciesFulfilled = runCaller; + }; + + function run() { + if (runDependencies > 0) { + return; + } + + if (!calledPrerun) { + calledPrerun = 1; + preRun(); + + if (runDependencies > 0) { + return; + } + } + + function doRun() { + if (calledRun) return; + calledRun = 1; + Module['calledRun'] = 1; + + if (ABORT) return; + + initRuntime(); + + readyPromiseResolve(Module); + Module['onRuntimeInitialized']?.(); + + postRun(); + } + + if (Module['setStatus']) { + Module['setStatus']('Running...'); + setTimeout(() => { + setTimeout(() => Module['setStatus'](''), 1); + doRun(); + }, 1); + } else { + doRun(); + } + } + + if (Module['preInit']) { + if (typeof Module['preInit'] == 'function') + Module['preInit'] = [Module['preInit']]; + while (Module['preInit'].length > 0) { + Module['preInit'].pop()(); + } + } + + run(); + + Module.runSQLite3PostLoadInit = function (EmscriptenModule) { + 'use strict'; + + 'use strict'; + globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap( + apiConfig = globalThis.sqlite3ApiConfig || + sqlite3ApiBootstrap.defaultConfig, + ) { + if (sqlite3ApiBootstrap.sqlite3) { + (sqlite3ApiBootstrap.sqlite3.config || console).warn( + 'sqlite3ApiBootstrap() called multiple times.', + 'Config and external initializers are ignored on calls after the first.', + ); + return sqlite3ApiBootstrap.sqlite3; + } + const config = Object.assign( + Object.create(null), + { + exports: undefined, + memory: undefined, + bigIntEnabled: (() => { + if ('undefined' !== typeof Module) { + if (!!Module.HEAPU64) return true; + } + return !!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: false, + }, + apiConfig || {}, + ); + + Object.assign( + config, + { + allocExportName: config.useStdAlloc ? 'malloc' : 'sqlite3_malloc', + deallocExportName: config.useStdAlloc ? 'free' : 'sqlite3_free', + reallocExportName: config.useStdAlloc + ? 'realloc' + : 'sqlite3_realloc', + }, + config, + ); + + ['exports', 'memory', 'wasmfsOpfsDir'].forEach((k) => { + if ('function' === typeof config[k]) { + config[k] = config[k](); + } + }); + + delete globalThis.sqlite3ApiConfig; + delete sqlite3ApiBootstrap.defaultConfig; + + const capi = Object.create(null); + + const wasm = Object.create(null); + + const __rcStr = (rc) => { + return ( + (capi.sqlite3_js_rc_str && capi.sqlite3_js_rc_str(rc)) || + 'Unknown result code #' + rc + ); + }; + + const __isInt = (n) => 'number' === typeof n && n === (n | 0); + + class SQLite3Error extends Error { + constructor(...args) { + let rc; + if (args.length) { + if (__isInt(args[0])) { + rc = args[0]; + if (1 === args.length) { + super(__rcStr(args[0])); + } else { + const rcStr = __rcStr(rc); + if ('object' === typeof args[1]) { + super(rcStr, args[1]); + } else { + args[0] = rcStr + ':'; + super(args.join(' ')); + } + } + } else { + if (2 === args.length && 'object' === typeof args[1]) { + super(...args); + } else { + super(args.join(' ')); + } + } + } + this.resultCode = rc || capi.SQLITE_ERROR; + this.name = 'SQLite3Error'; + } + } + + SQLite3Error.toss = (...args) => { + throw new SQLite3Error(...args); + }; + const toss3 = SQLite3Error.toss; + + if (config.wasmfsOpfsDir && !/^\/[^/]+$/.test(config.wasmfsOpfsDir)) { + toss3( + "config.wasmfsOpfsDir must be falsy or in the form '/dir-name'.", + ); + } + + const isInt32 = (n) => { + return ( + 'bigint' !== typeof n && + !!(n === (n | 0) && n <= 2147483647 && n >= -2147483648) + ); + }; + + const bigIntFits64 = function f(b) { + if (!f._max) { + f._max = BigInt('0x7fffffffffffffff'); + f._min = ~f._max; + } + return b >= f._min && b <= f._max; + }; + + const bigIntFits32 = (b) => b >= -0x7fffffffn - 1n && b <= 0x7fffffffn; + + const bigIntFitsDouble = function f(b) { + if (!f._min) { + f._min = Number.MIN_SAFE_INTEGER; + f._max = Number.MAX_SAFE_INTEGER; + } + return b >= f._min && b <= f._max; + }; + + const isTypedArray = (v) => { + return v && v.constructor && isInt32(v.constructor.BYTES_PER_ELEMENT) + ? v + : false; + }; + + const __SAB = + 'undefined' === typeof SharedArrayBuffer + ? function () {} + : SharedArrayBuffer; + + const isSharedTypedArray = (aTypedArray) => + aTypedArray.buffer instanceof __SAB; + + const typedArrayPart = (aTypedArray, begin, end) => { + return isSharedTypedArray(aTypedArray) + ? aTypedArray.slice(begin, end) + : aTypedArray.subarray(begin, end); + }; + + const isBindableTypedArray = (v) => { + return ( + v && + (v instanceof Uint8Array || + v instanceof Int8Array || + v instanceof ArrayBuffer) + ); + }; + + const isSQLableTypedArray = (v) => { + return ( + v && + (v instanceof Uint8Array || + v instanceof Int8Array || + v instanceof ArrayBuffer) + ); + }; + + const affirmBindableTypedArray = (v) => { + return ( + isBindableTypedArray(v) || + toss3('Value is not of a supported TypedArray type.') + ); + }; + + const utf8Decoder = new TextDecoder('utf-8'); + + const typedArrayToString = function (typedArray, begin, end) { + return utf8Decoder.decode(typedArrayPart(typedArray, begin, end)); + }; + + const flexibleString = function (v) { + if (isSQLableTypedArray(v)) { + return typedArrayToString( + v instanceof ArrayBuffer ? new Uint8Array(v) : v, + ); + } else if (Array.isArray(v)) return v.join(''); + else if (wasm.isPtr(v)) v = wasm.cstrToJs(v); + return v; + }; + + class WasmAllocError extends Error { + constructor(...args) { + if (2 === args.length && 'object' === typeof args[1]) { + super(...args); + } else if (args.length) { + super(args.join(' ')); + } else { + super('Allocation failed.'); + } + this.resultCode = capi.SQLITE_NOMEM; + this.name = 'WasmAllocError'; + } + } + + WasmAllocError.toss = (...args) => { + throw new WasmAllocError(...args); + }; + + Object.assign(capi, { + sqlite3_bind_blob: undefined, + + sqlite3_bind_text: undefined, + + sqlite3_create_function_v2: ( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + xDestroy, + ) => {}, + + sqlite3_create_function: ( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + ) => {}, + + sqlite3_create_window_function: ( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ) => {}, + + sqlite3_prepare_v3: ( + dbPtr, + sql, + sqlByteLen, + prepFlags, + stmtPtrPtr, + strPtrPtr, + ) => {}, + + sqlite3_prepare_v2: ( + dbPtr, + sql, + sqlByteLen, + stmtPtrPtr, + strPtrPtr, + ) => {}, + + sqlite3_exec: (pDb, sql, callback, pVoid, pErrMsg) => {}, + + sqlite3_randomness: (n, outPtr) => {}, + }); + + const util = { + affirmBindableTypedArray, + flexibleString, + bigIntFits32, + bigIntFits64, + bigIntFitsDouble, + isBindableTypedArray, + isInt32, + isSQLableTypedArray, + isTypedArray, + typedArrayToString, + isUIThread: () => + globalThis.window === globalThis && !!globalThis.document, + + isSharedTypedArray, + toss: function (...args) { + throw new Error(args.join(' ')); + }, + toss3, + typedArrayPart, + + affirmDbHeader: function (bytes) { + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + const header = 'SQLite format 3'; + if (header.length > bytes.byteLength) { + toss3('Input does not contain an SQLite3 database header.'); + } + for (let i = 0; i < header.length; ++i) { + if (header.charCodeAt(i) !== bytes[i]) { + toss3('Input does not contain an SQLite3 database header.'); + } + } + }, + + affirmIsDb: function (bytes) { + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + const n = bytes.byteLength; + if (n < 512 || n % 512 !== 0) { + toss3('Byte array size', n, 'is invalid for an SQLite3 db.'); + } + util.affirmDbHeader(bytes); + }, + }; + + Object.assign(wasm, { + ptrSizeof: config.wasmPtrSizeof || 4, + + ptrIR: config.wasmPtrIR || 'i32', + + bigIntEnabled: !!config.bigIntEnabled, + + exports: + config.exports || + toss3('Missing API config.exports (WASM module exports).'), + + memory: + config.memory || + config.exports['memory'] || + toss3( + 'API config object requires a WebAssembly.Memory object', + 'in either config.exports.memory (exported)', + 'or config.memory (imported).', + ), + + alloc: undefined, + + realloc: undefined, + + dealloc: undefined, + }); + + wasm.allocFromTypedArray = function (srcTypedArray) { + if (srcTypedArray instanceof ArrayBuffer) { + srcTypedArray = new Uint8Array(srcTypedArray); + } + affirmBindableTypedArray(srcTypedArray); + const pRet = wasm.alloc(srcTypedArray.byteLength || 1); + wasm + .heapForSize(srcTypedArray.constructor) + .set(srcTypedArray.byteLength ? srcTypedArray : [0], pRet); + return pRet; + }; + + { + const keyAlloc = config.allocExportName, + keyDealloc = config.deallocExportName, + keyRealloc = config.reallocExportName; + for (const key of [keyAlloc, keyDealloc, keyRealloc]) { + const f = wasm.exports[key]; + if (!(f instanceof Function)) + toss3('Missing required exports[', key, '] function.'); + } + + wasm.alloc = function f(n) { + return ( + f.impl(n) || + WasmAllocError.toss('Failed to allocate', n, ' bytes.') + ); + }; + wasm.alloc.impl = wasm.exports[keyAlloc]; + wasm.realloc = function f(m, n) { + const m2 = f.impl(m, n); + return n + ? m2 || WasmAllocError.toss('Failed to reallocate', n, ' bytes.') + : 0; + }; + wasm.realloc.impl = wasm.exports[keyRealloc]; + wasm.dealloc = wasm.exports[keyDealloc]; + } + + wasm.compileOptionUsed = function f(optName) { + if (!arguments.length) { + if (f._result) return f._result; + else if (!f._opt) { + f._rx = /^([^=]+)=(.+)/; + f._rxInt = /^-?\d+$/; + f._opt = function (opt, rv) { + const m = f._rx.exec(opt); + rv[0] = m ? m[1] : opt; + rv[1] = m ? (f._rxInt.test(m[2]) ? +m[2] : m[2]) : true; + }; + } + const rc = {}, + ov = [0, 0]; + let i = 0, + k; + while ((k = capi.sqlite3_compileoption_get(i++))) { + f._opt(k, ov); + rc[ov[0]] = ov[1]; + } + return (f._result = rc); + } else if (Array.isArray(optName)) { + const rc = {}; + optName.forEach((v) => { + rc[v] = capi.sqlite3_compileoption_used(v); + }); + return rc; + } else if ('object' === typeof optName) { + Object.keys(optName).forEach((k) => { + optName[k] = capi.sqlite3_compileoption_used(k); + }); + return optName; + } + return 'string' === typeof optName + ? !!capi.sqlite3_compileoption_used(optName) + : false; + }; + + wasm.pstack = Object.assign(Object.create(null), { + restore: wasm.exports.sqlite3__wasm_pstack_restore, + + alloc: function (n) { + if ('string' === typeof n && !(n = wasm.sizeofIR(n))) { + WasmAllocError.toss( + 'Invalid value for pstack.alloc(', + arguments[0], + ')', + ); + } + return ( + wasm.exports.sqlite3__wasm_pstack_alloc(n) || + WasmAllocError.toss( + 'Could not allocate', + n, + 'bytes from the pstack.', + ) + ); + }, + + allocChunks: function (n, sz) { + if ('string' === typeof sz && !(sz = wasm.sizeofIR(sz))) { + WasmAllocError.toss( + 'Invalid size value for allocChunks(', + arguments[1], + ')', + ); + } + const mem = wasm.pstack.alloc(n * sz); + const rc = []; + let i = 0, + offset = 0; + for (; i < n; ++i, offset += sz) rc.push(mem + offset); + return rc; + }, + + allocPtr: (n = 1, safePtrSize = true) => { + return 1 === n + ? wasm.pstack.alloc(safePtrSize ? 8 : wasm.ptrSizeof) + : wasm.pstack.allocChunks(n, safePtrSize ? 8 : wasm.ptrSizeof); + }, + + call: function (f) { + const stackPos = wasm.pstack.pointer; + try { + return f(sqlite3); + } finally { + wasm.pstack.restore(stackPos); + } + }, + }); + Object.defineProperties(wasm.pstack, { + pointer: { + configurable: false, + iterable: true, + writeable: false, + get: wasm.exports.sqlite3__wasm_pstack_ptr, + }, + + quota: { + configurable: false, + iterable: true, + writeable: false, + get: wasm.exports.sqlite3__wasm_pstack_quota, + }, + + remaining: { + configurable: false, + iterable: true, + writeable: false, + get: wasm.exports.sqlite3__wasm_pstack_remaining, + }, + }); + + capi.sqlite3_randomness = (...args) => { + if ( + 1 === args.length && + util.isTypedArray(args[0]) && + 1 === args[0].BYTES_PER_ELEMENT + ) { + const ta = args[0]; + if (0 === ta.byteLength) { + wasm.exports.sqlite3_randomness(0, 0); + return ta; + } + const stack = wasm.pstack.pointer; + try { + let n = ta.byteLength, + offset = 0; + const r = wasm.exports.sqlite3_randomness; + const heap = wasm.heap8u(); + const nAlloc = n < 512 ? n : 512; + const ptr = wasm.pstack.alloc(nAlloc); + do { + const j = n > nAlloc ? nAlloc : n; + r(j, ptr); + ta.set(typedArrayPart(heap, ptr, ptr + j), offset); + n -= j; + offset += j; + } while (n > 0); + } catch (e) { + console.error( + 'Highly unexpected (and ignored!) ' + + 'exception in sqlite3_randomness():', + e, + ); + } finally { + wasm.pstack.restore(stack); + } + return ta; + } + wasm.exports.sqlite3_randomness(...args); + }; + + let __wasmfsOpfsDir = undefined; + + capi.sqlite3_wasmfs_opfs_dir = function () { + if (undefined !== __wasmfsOpfsDir) return __wasmfsOpfsDir; + + const pdir = config.wasmfsOpfsDir; + if ( + !pdir || + !globalThis.FileSystemHandle || + !globalThis.FileSystemDirectoryHandle || + !globalThis.FileSystemFileHandle + ) { + return (__wasmfsOpfsDir = ''); + } + try { + if ( + pdir && + 0 === + wasm.xCallWrapped( + 'sqlite3__wasm_init_wasmfs', + 'i32', + ['string'], + pdir, + ) + ) { + return (__wasmfsOpfsDir = pdir); + } else { + return (__wasmfsOpfsDir = ''); + } + } catch (e) { + return (__wasmfsOpfsDir = ''); + } + }; + + capi.sqlite3_wasmfs_filename_is_persistent = function (name) { + const p = capi.sqlite3_wasmfs_opfs_dir(); + return p && name ? name.startsWith(p + '/') : false; + }; + + capi.sqlite3_js_db_uses_vfs = function (pDb, vfsName, dbName = 0) { + try { + const pK = capi.sqlite3_vfs_find(vfsName); + if (!pK) return false; + else if (!pDb) { + return pK === capi.sqlite3_vfs_find(0) ? pK : false; + } else { + return pK === capi.sqlite3_js_db_vfs(pDb, dbName) ? pK : false; + } + } catch (e) { + return false; + } + }; + + capi.sqlite3_js_vfs_list = function () { + const rc = []; + let pVfs = capi.sqlite3_vfs_find(0); + while (pVfs) { + const oVfs = new capi.sqlite3_vfs(pVfs); + rc.push(wasm.cstrToJs(oVfs.$zName)); + pVfs = oVfs.$pNext; + oVfs.dispose(); + } + return rc; + }; + + capi.sqlite3_js_db_export = function (pDb, schema = 0) { + pDb = wasm.xWrap.testConvertArg('sqlite3*', pDb); + if (!pDb) toss3('Invalid sqlite3* argument.'); + if (!wasm.bigIntEnabled) toss3('BigInt64 support is not enabled.'); + const scope = wasm.scopedAllocPush(); + let pOut; + try { + const pSize = wasm.scopedAlloc(8 + wasm.ptrSizeof); + const ppOut = pSize + 8; + + const zSchema = schema + ? wasm.isPtr(schema) + ? schema + : wasm.scopedAllocCString('' + schema) + : 0; + let rc = wasm.exports.sqlite3__wasm_db_serialize( + pDb, + zSchema, + ppOut, + pSize, + 0, + ); + if (rc) { + toss3( + 'Database serialization failed with code', + sqlite3.capi.sqlite3_js_rc_str(rc), + ); + } + pOut = wasm.peekPtr(ppOut); + const nOut = wasm.peek(pSize, 'i64'); + rc = nOut + ? wasm.heap8u().slice(pOut, pOut + Number(nOut)) + : new Uint8Array(); + return rc; + } finally { + if (pOut) wasm.exports.sqlite3_free(pOut); + wasm.scopedAllocPop(scope); + } + }; + + capi.sqlite3_js_db_vfs = (dbPointer, dbName = 0) => + util.sqlite3__wasm_db_vfs(dbPointer, dbName); + + capi.sqlite3_js_aggregate_context = (pCtx, n) => { + return ( + capi.sqlite3_aggregate_context(pCtx, n) || + (n + ? WasmAllocError.toss( + 'Cannot allocate', + n, + 'bytes for sqlite3_aggregate_context()', + ) + : 0) + ); + }; + + capi.sqlite3_js_posix_create_file = function (filename, data, dataLen) { + let pData; + if (data && wasm.isPtr(data)) { + pData = data; + } else if ( + data instanceof ArrayBuffer || + data instanceof Uint8Array + ) { + pData = wasm.allocFromTypedArray(data); + if (arguments.length < 3 || !util.isInt32(dataLen) || dataLen < 0) { + dataLen = data.byteLength; + } + } else { + SQLite3Error.toss( + 'Invalid 2nd argument for sqlite3_js_posix_create_file().', + ); + } + try { + if (!util.isInt32(dataLen) || dataLen < 0) { + SQLite3Error.toss( + 'Invalid 3rd argument for sqlite3_js_posix_create_file().', + ); + } + const rc = util.sqlite3__wasm_posix_create_file( + filename, + pData, + dataLen, + ); + if (rc) + SQLite3Error.toss( + 'Creation of file failed with sqlite3 result code', + capi.sqlite3_js_rc_str(rc), + ); + } finally { + wasm.dealloc(pData); + } + }; + + capi.sqlite3_js_vfs_create_file = function ( + vfs, + filename, + data, + dataLen, + ) { + config.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 pData; + if (data) { + if (wasm.isPtr(data)) { + pData = data; + } else if (data instanceof ArrayBuffer) { + data = new Uint8Array(data); + } + if (data instanceof Uint8Array) { + pData = wasm.allocFromTypedArray(data); + if ( + arguments.length < 4 || + !util.isInt32(dataLen) || + dataLen < 0 + ) { + dataLen = data.byteLength; + } + } else { + SQLite3Error.toss( + 'Invalid 3rd argument type for sqlite3_js_vfs_create_file().', + ); + } + } else { + pData = 0; + } + if (!util.isInt32(dataLen) || dataLen < 0) { + wasm.dealloc(pData); + SQLite3Error.toss( + 'Invalid 4th argument for sqlite3_js_vfs_create_file().', + ); + } + try { + const rc = util.sqlite3__wasm_vfs_create_file( + vfs, + filename, + pData, + dataLen, + ); + if (rc) + SQLite3Error.toss( + 'Creation of file failed with sqlite3 result code', + capi.sqlite3_js_rc_str(rc), + ); + } finally { + wasm.dealloc(pData); + } + }; + + capi.sqlite3_js_sql_to_string = (sql) => { + if ('string' === typeof sql) { + return sql; + } + const x = flexibleString(v); + return x === v ? undefined : x; + }; + + if (util.isUIThread()) { + const __kvvfsInfo = function (which) { + const rc = Object.create(null); + rc.prefix = 'kvvfs-' + which; + rc.stores = []; + if ('session' === which || '' === which) + rc.stores.push(globalThis.sessionStorage); + if ('local' === which || '' === which) + rc.stores.push(globalThis.localStorage); + return rc; + }; + + capi.sqlite3_js_kvvfs_clear = function (which = '') { + let rc = 0; + const kvinfo = __kvvfsInfo(which); + kvinfo.stores.forEach((s) => { + const toRm = []; + let i; + for (i = 0; i < s.length; ++i) { + const k = s.key(i); + if (k.startsWith(kvinfo.prefix)) toRm.push(k); + } + toRm.forEach((kk) => s.removeItem(kk)); + rc += toRm.length; + }); + return rc; + }; + + capi.sqlite3_js_kvvfs_size = function (which = '') { + let sz = 0; + const kvinfo = __kvvfsInfo(which); + kvinfo.stores.forEach((s) => { + let i; + for (i = 0; i < s.length; ++i) { + const k = s.key(i); + if (k.startsWith(kvinfo.prefix)) { + sz += k.length; + sz += s.getItem(k).length; + } + } + }); + return sz * 2; + }; + } + + capi.sqlite3_db_config = function (pDb, op, ...args) { + switch (op) { + case capi.SQLITE_DBCONFIG_ENABLE_FKEY: + case capi.SQLITE_DBCONFIG_ENABLE_TRIGGER: + case capi.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER: + case capi.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION: + case capi.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE: + case capi.SQLITE_DBCONFIG_ENABLE_QPSG: + case capi.SQLITE_DBCONFIG_TRIGGER_EQP: + case capi.SQLITE_DBCONFIG_RESET_DATABASE: + case capi.SQLITE_DBCONFIG_DEFENSIVE: + case capi.SQLITE_DBCONFIG_WRITABLE_SCHEMA: + case capi.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE: + case capi.SQLITE_DBCONFIG_DQS_DML: + case capi.SQLITE_DBCONFIG_DQS_DDL: + case capi.SQLITE_DBCONFIG_ENABLE_VIEW: + case capi.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT: + case capi.SQLITE_DBCONFIG_TRUSTED_SCHEMA: + case capi.SQLITE_DBCONFIG_STMT_SCANSTATUS: + case capi.SQLITE_DBCONFIG_REVERSE_SCANORDER: + case capi.SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE: + case capi.SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE: + case capi.SQLITE_DBCONFIG_ENABLE_COMMENTS: + if (!this.ip) { + this.ip = wasm.xWrap('sqlite3__wasm_db_config_ip', 'int', [ + 'sqlite3*', + 'int', + 'int', + '*', + ]); + } + return this.ip(pDb, op, args[0], args[1] || 0); + case capi.SQLITE_DBCONFIG_LOOKASIDE: + if (!this.pii) { + this.pii = wasm.xWrap('sqlite3__wasm_db_config_pii', 'int', [ + 'sqlite3*', + 'int', + '*', + 'int', + 'int', + ]); + } + return this.pii(pDb, op, args[0], args[1], args[2]); + case capi.SQLITE_DBCONFIG_MAINDBNAME: + if (!this.s) { + this.s = wasm.xWrap('sqlite3__wasm_db_config_s', 'int', [ + 'sqlite3*', + 'int', + 'string:static', + ]); + } + return this.s(pDb, op, args[0]); + default: + return capi.SQLITE_MISUSE; + } + }.bind(Object.create(null)); + + capi.sqlite3_value_to_js = function ( + pVal, + throwIfCannotConvert = true, + ) { + let arg; + const valType = capi.sqlite3_value_type(pVal); + switch (valType) { + case capi.SQLITE_INTEGER: + if (wasm.bigIntEnabled) { + arg = capi.sqlite3_value_int64(pVal); + if (util.bigIntFitsDouble(arg)) arg = Number(arg); + } else arg = capi.sqlite3_value_double(pVal); + break; + case capi.SQLITE_FLOAT: + arg = capi.sqlite3_value_double(pVal); + break; + case capi.SQLITE_TEXT: + arg = capi.sqlite3_value_text(pVal); + break; + case capi.SQLITE_BLOB: { + const n = capi.sqlite3_value_bytes(pVal); + const pBlob = capi.sqlite3_value_blob(pVal); + if (n && !pBlob) + sqlite3.WasmAllocError.toss( + 'Cannot allocate memory for blob argument of', + n, + 'byte(s)', + ); + arg = n ? wasm.heap8u().slice(pBlob, pBlob + Number(n)) : null; + break; + } + case capi.SQLITE_NULL: + arg = null; + break; + default: + if (throwIfCannotConvert) { + toss3( + capi.SQLITE_MISMATCH, + 'Unhandled sqlite3_value_type():', + valType, + ); + } + arg = undefined; + } + return arg; + }; + + capi.sqlite3_values_to_js = function ( + argc, + pArgv, + throwIfCannotConvert = true, + ) { + let i; + const tgt = []; + for (i = 0; i < argc; ++i) { + tgt.push( + capi.sqlite3_value_to_js( + wasm.peekPtr(pArgv + wasm.ptrSizeof * i), + throwIfCannotConvert, + ), + ); + } + return tgt; + }; + + capi.sqlite3_result_error_js = function (pCtx, e) { + if (e instanceof WasmAllocError) { + capi.sqlite3_result_error_nomem(pCtx); + } else { + capi.sqlite3_result_error(pCtx, '' + e, -1); + } + }; + + capi.sqlite3_result_js = function (pCtx, val) { + if (val instanceof Error) { + capi.sqlite3_result_error_js(pCtx, val); + return; + } + try { + switch (typeof val) { + case 'undefined': + break; + case 'boolean': + capi.sqlite3_result_int(pCtx, val ? 1 : 0); + break; + case 'bigint': + if (util.bigIntFits32(val)) { + capi.sqlite3_result_int(pCtx, Number(val)); + } else if (util.bigIntFitsDouble(val)) { + capi.sqlite3_result_double(pCtx, Number(val)); + } else if (wasm.bigIntEnabled) { + if (util.bigIntFits64(val)) + capi.sqlite3_result_int64(pCtx, val); + else + toss3( + 'BigInt value', + val.toString(), + 'is too BigInt for int64.', + ); + } else { + toss3('BigInt value', val.toString(), 'is too BigInt.'); + } + break; + case 'number': { + let f; + if (util.isInt32(val)) { + f = capi.sqlite3_result_int; + } else if ( + wasm.bigIntEnabled && + Number.isInteger(val) && + util.bigIntFits64(BigInt(val)) + ) { + f = capi.sqlite3_result_int64; + } else { + f = capi.sqlite3_result_double; + } + f(pCtx, val); + break; + } + case 'string': { + const [p, n] = wasm.allocCString(val, true); + capi.sqlite3_result_text(pCtx, p, n, capi.SQLITE_WASM_DEALLOC); + break; + } + case 'object': + if (null === val) { + capi.sqlite3_result_null(pCtx); + break; + } else if (util.isBindableTypedArray(val)) { + const pBlob = wasm.allocFromTypedArray(val); + capi.sqlite3_result_blob( + pCtx, + pBlob, + val.byteLength, + capi.SQLITE_WASM_DEALLOC, + ); + break; + } + + default: + toss3( + "Don't not how to handle this UDF result value:", + typeof val, + val, + ); + } + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + + capi.sqlite3_column_js = function ( + pStmt, + iCol, + throwIfCannotConvert = true, + ) { + const v = capi.sqlite3_column_value(pStmt, iCol); + return 0 === v + ? undefined + : capi.sqlite3_value_to_js(v, throwIfCannotConvert); + }; + + const __newOldValue = function (pObj, iCol, impl) { + impl = capi[impl]; + if (!this.ptr) this.ptr = wasm.allocPtr(); + else wasm.pokePtr(this.ptr, 0); + const rc = impl(pObj, iCol, this.ptr); + if (rc) + return SQLite3Error.toss( + rc, + arguments[2] + '() failed with code ' + rc, + ); + const pv = wasm.peekPtr(this.ptr); + return pv ? capi.sqlite3_value_to_js(pv, true) : undefined; + }.bind(Object.create(null)); + + capi.sqlite3_preupdate_new_js = (pDb, iCol) => + __newOldValue(pDb, iCol, 'sqlite3_preupdate_new'); + + capi.sqlite3_preupdate_old_js = (pDb, iCol) => + __newOldValue(pDb, iCol, 'sqlite3_preupdate_old'); + + capi.sqlite3changeset_new_js = (pChangesetIter, iCol) => + __newOldValue(pChangesetIter, iCol, 'sqlite3changeset_new'); + + capi.sqlite3changeset_old_js = (pChangesetIter, iCol) => + __newOldValue(pChangesetIter, iCol, 'sqlite3changeset_old'); + + const sqlite3 = { + WasmAllocError: WasmAllocError, + SQLite3Error: SQLite3Error, + capi, + util, + wasm, + config, + + version: Object.create(null), + + client: undefined, + + asyncPostInit: async function ff() { + if (ff.isReady instanceof Promise) return ff.isReady; + let lia = sqlite3ApiBootstrap.initializersAsync; + delete sqlite3ApiBootstrap.initializersAsync; + const postInit = async () => { + if (!sqlite3.__isUnderTest) { + delete sqlite3.util; + + delete sqlite3.StructBinder; + } + return sqlite3; + }; + const catcher = (e) => { + config.error('an async sqlite3 initializer failed:', e); + throw e; + }; + if (!lia || !lia.length) { + return (ff.isReady = postInit().catch(catcher)); + } + lia = lia.map((f) => { + return f instanceof Function ? async (x) => f(sqlite3) : f; + }); + lia.push(postInit); + let p = Promise.resolve(sqlite3); + while (lia.length) p = p.then(lia.shift()); + return (ff.isReady = p.catch(catcher)); + }, + + scriptInfo: undefined, + }; + try { + sqlite3ApiBootstrap.initializers.forEach((f) => { + f(sqlite3); + }); + } catch (e) { + console.error('sqlite3 bootstrap initializer threw:', e); + throw e; + } + delete sqlite3ApiBootstrap.initializers; + sqlite3ApiBootstrap.sqlite3 = sqlite3; + return sqlite3; + }; + + globalThis.sqlite3ApiBootstrap.initializers = []; + + globalThis.sqlite3ApiBootstrap.initializersAsync = []; + + globalThis.sqlite3ApiBootstrap.defaultConfig = Object.create(null); + + globalThis.sqlite3ApiBootstrap.sqlite3 = undefined; + + globalThis.WhWasmUtilInstaller = function (target) { + 'use strict'; + if (undefined === target.bigIntEnabled) { + target.bigIntEnabled = !!globalThis['BigInt64Array']; + } + + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + + if (!target.exports) { + Object.defineProperty(target, 'exports', { + enumerable: true, + configurable: true, + get: () => target.instance && target.instance.exports, + }); + } + + const ptrIR = target.pointerIR || 'i32'; + const ptrSizeof = (target.ptrSizeof = + 'i32' === ptrIR + ? 4 + : 'i64' === ptrIR + ? 8 + : toss('Unhandled ptrSizeof:', ptrIR)); + + const cache = Object.create(null); + + cache.heapSize = 0; + + cache.memory = null; + + cache.freeFuncIndexes = []; + + cache.scopedAlloc = []; + + cache.utf8Decoder = new TextDecoder(); + cache.utf8Encoder = new TextEncoder('utf-8'); + + target.sizeofIR = (n) => { + switch (n) { + 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 ptrSizeof; + default: + return ('' + n).endsWith('*') ? ptrSizeof : undefined; + } + }; + + const heapWrappers = function () { + if (!cache.memory) { + cache.memory = + target.memory instanceof WebAssembly.Memory + ? target.memory + : target.exports.memory; + } else if (cache.heapSize === cache.memory.buffer.byteLength) { + return cache; + } + + const b = cache.memory.buffer; + cache.HEAP8 = new Int8Array(b); + cache.HEAP8U = new Uint8Array(b); + cache.HEAP16 = new Int16Array(b); + cache.HEAP16U = new Uint16Array(b); + cache.HEAP32 = new Int32Array(b); + cache.HEAP32U = new Uint32Array(b); + if (target.bigIntEnabled) { + cache.HEAP64 = new BigInt64Array(b); + cache.HEAP64U = new BigUint64Array(b); + } + cache.HEAP32F = new Float32Array(b); + cache.HEAP64F = new Float64Array(b); + cache.heapSize = b.byteLength; + return cache; + }; + + target.heap8 = () => heapWrappers().HEAP8; + + target.heap8u = () => heapWrappers().HEAP8U; + + target.heap16 = () => heapWrappers().HEAP16; + + target.heap16u = () => heapWrappers().HEAP16U; + + target.heap32 = () => heapWrappers().HEAP32; + + target.heap32u = () => heapWrappers().HEAP32U; + + target.heapForSize = function (n, unsigned = true) { + let ctor; + const c = + cache.memory && cache.heapSize === cache.memory.buffer.byteLength + ? cache + : heapWrappers(); + switch (n) { + case Int8Array: + return c.HEAP8; + case Uint8Array: + return c.HEAP8U; + case Int16Array: + return c.HEAP16; + case Uint16Array: + return c.HEAP16U; + case Int32Array: + return c.HEAP32; + case Uint32Array: + return c.HEAP32U; + case 8: + return unsigned ? c.HEAP8U : c.HEAP8; + case 16: + return unsigned ? c.HEAP16U : c.HEAP16; + case 32: + return unsigned ? c.HEAP32U : c.HEAP32; + case 64: + if (c.HEAP64) return unsigned ? c.HEAP64U : c.HEAP64; + break; + default: + if (target.bigIntEnabled) { + if (n === globalThis['BigUint64Array']) return c.HEAP64U; + else if (n === globalThis['BigInt64Array']) return c.HEAP64; + break; + } + } + toss( + 'Invalid heapForSize() size: expecting 8, 16, 32,', + 'or (if BigInt is enabled) 64.', + ); + }; + + target.functionTable = function () { + return target.exports.__indirect_function_table; + }; + + target.functionEntry = function (fptr) { + const ft = target.functionTable(); + return fptr < ft.length ? ft.get(fptr) : undefined; + }; + + target.jsFuncToWasm = function f(func, sig) { + if (!f._) { + f._ = { + 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: 0x7c, + f32: 0x7d, + i64: 0x7e, + i32: 0x7f, + }), + + uleb128Encode: function (tgt, method, n) { + if (n < 128) tgt[method](n); + else tgt[method](n % 128 | 128, n >> 7); + }, + + rxJSig: /^(\w)\((\w*)\)$/, + + sigParams: function (sig) { + const m = f._.rxJSig.exec(sig); + return m ? m[2] : sig.substr(1); + }, + + letterType: (x) => + f._.sigTypes[x] || toss('Invalid signature letter:', x), + + pushSigType: (dest, letter) => + dest.push(f._.typeCodes[f._.letterType(letter)]), + }; + } + if ('string' === typeof func) { + const x = sig; + sig = func; + func = x; + } + const sigParams = f._.sigParams(sig); + const wasmCode = [0x01, 0x60]; + f._.uleb128Encode(wasmCode, 'push', sigParams.length); + for (const x of sigParams) f._.pushSigType(wasmCode, x); + if ('v' === sig[0]) wasmCode.push(0); + else { + wasmCode.push(1); + f._.pushSigType(wasmCode, sig[0]); + } + f._.uleb128Encode(wasmCode, 'unshift', wasmCode.length); + wasmCode.unshift( + 0x00, + 0x61, + 0x73, + 0x6d, + 0x01, + 0x00, + 0x00, + 0x00, + 0x01, + ); + wasmCode.push( + 0x02, + 0x07, + + 0x01, + 0x01, + 0x65, + 0x01, + 0x66, + 0x00, + 0x00, + 0x07, + 0x05, + + 0x01, + 0x01, + 0x66, + 0x00, + 0x00, + ); + return new WebAssembly.Instance( + new WebAssembly.Module(new Uint8Array(wasmCode)), + { + e: { f: func }, + }, + ).exports['f']; + }; + + const __installFunction = function f(func, sig, scoped) { + if (scoped && !cache.scopedAlloc.length) { + toss('No scopedAllocPush() scope is active.'); + } + if ('string' === typeof func) { + const x = sig; + sig = func; + func = x; + } + if ('string' !== typeof sig || !(func instanceof Function)) { + toss( + 'Invalid arguments: expecting (function,signature) ' + + 'or (signature,function).', + ); + } + const ft = target.functionTable(); + const oldLen = ft.length; + let ptr; + while (cache.freeFuncIndexes.length) { + ptr = cache.freeFuncIndexes.pop(); + if (ft.get(ptr)) { + ptr = null; + continue; + } else { + break; + } + } + if (!ptr) { + ptr = oldLen; + ft.grow(1); + } + try { + ft.set(ptr, func); + if (scoped) { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(ptr); + } + return ptr; + } catch (e) { + if (!(e instanceof TypeError)) { + if (ptr === oldLen) cache.freeFuncIndexes.push(oldLen); + throw e; + } + } + + try { + const fptr = target.jsFuncToWasm(func, sig); + ft.set(ptr, fptr); + if (scoped) { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(ptr); + } + } catch (e) { + if (ptr === oldLen) cache.freeFuncIndexes.push(oldLen); + throw e; + } + return ptr; + }; + + target.installFunction = (func, sig) => + __installFunction(func, sig, false); + + target.scopedInstallFunction = (func, sig) => + __installFunction(func, sig, true); + + target.uninstallFunction = function (ptr) { + if (!ptr && 0 !== ptr) return undefined; + const fi = cache.freeFuncIndexes; + const ft = target.functionTable(); + fi.push(ptr); + const rc = ft.get(ptr); + ft.set(ptr, null); + return rc; + }; + + target.peek = function f(ptr, type = 'i8') { + if (type.endsWith('*')) type = ptrIR; + const c = + cache.memory && cache.heapSize === cache.memory.buffer.byteLength + ? cache + : heapWrappers(); + const list = Array.isArray(ptr) ? [] : undefined; + let rc; + do { + if (list) ptr = arguments[0].shift(); + switch (type) { + case 'i1': + case 'i8': + rc = c.HEAP8[ptr >> 0]; + break; + case 'i16': + rc = c.HEAP16[ptr >> 1]; + break; + case 'i32': + rc = c.HEAP32[ptr >> 2]; + break; + case 'float': + case 'f32': + rc = c.HEAP32F[ptr >> 2]; + break; + case 'double': + case 'f64': + rc = Number(c.HEAP64F[ptr >> 3]); + break; + case 'i64': + if (target.bigIntEnabled) { + rc = BigInt(c.HEAP64[ptr >> 3]); + break; + } + + default: + toss('Invalid type for peek():', type); + } + if (list) list.push(rc); + } while (list && arguments[0].length); + return list || rc; + }; + + target.poke = function (ptr, value, type = 'i8') { + if (type.endsWith('*')) type = ptrIR; + const c = + cache.memory && cache.heapSize === cache.memory.buffer.byteLength + ? cache + : heapWrappers(); + for (const p of Array.isArray(ptr) ? ptr : [ptr]) { + switch (type) { + case 'i1': + case 'i8': + c.HEAP8[p >> 0] = value; + continue; + case 'i16': + c.HEAP16[p >> 1] = value; + continue; + case 'i32': + c.HEAP32[p >> 2] = value; + continue; + case 'float': + case 'f32': + c.HEAP32F[p >> 2] = value; + continue; + case 'double': + case 'f64': + c.HEAP64F[p >> 3] = value; + continue; + case 'i64': + if (c.HEAP64) { + c.HEAP64[p >> 3] = BigInt(value); + continue; + } + + default: + toss('Invalid type for poke(): ' + type); + } + } + return this; + }; + + target.peekPtr = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, ptrIR); + + target.pokePtr = (ptr, value = 0) => target.poke(ptr, value, ptrIR); + + target.peek8 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i8'); + + target.poke8 = (ptr, value) => target.poke(ptr, value, 'i8'); + + target.peek16 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i16'); + + target.poke16 = (ptr, value) => target.poke(ptr, value, 'i16'); + + target.peek32 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i32'); + + target.poke32 = (ptr, value) => target.poke(ptr, value, 'i32'); + + target.peek64 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i64'); + + target.poke64 = (ptr, value) => target.poke(ptr, value, 'i64'); + + target.peek32f = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'f32'); + + target.poke32f = (ptr, value) => target.poke(ptr, value, 'f32'); + + target.peek64f = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'f64'); + + target.poke64f = (ptr, value) => target.poke(ptr, value, 'f64'); + + target.getMemValue = target.peek; + + target.getPtrValue = target.peekPtr; + + target.setMemValue = target.poke; + + target.setPtrValue = target.pokePtr; + + target.isPtr32 = (ptr) => + 'number' === typeof ptr && ptr === (ptr | 0) && ptr >= 0; + + target.isPtr = target.isPtr32; + + target.cstrlen = function (ptr) { + if (!ptr || !target.isPtr(ptr)) return null; + const h = heapWrappers().HEAP8U; + let pos = ptr; + for (; h[pos] !== 0; ++pos) {} + return pos - ptr; + }; + + const __SAB = + 'undefined' === typeof SharedArrayBuffer + ? function () {} + : SharedArrayBuffer; + const __utf8Decode = function (arrayBuffer, begin, end) { + return cache.utf8Decoder.decode( + arrayBuffer.buffer instanceof __SAB + ? arrayBuffer.slice(begin, end) + : arrayBuffer.subarray(begin, end), + ); + }; + + target.cstrToJs = function (ptr) { + const n = target.cstrlen(ptr); + return n + ? __utf8Decode(heapWrappers().HEAP8U, ptr, ptr + n) + : null === n + ? n + : ''; + }; + + target.jstrlen = function (str) { + if ('string' !== typeof str) return null; + const n = str.length; + let len = 0; + for (let i = 0; i < n; ++i) { + let u = str.charCodeAt(i); + if (u >= 0xd800 && u <= 0xdfff) { + u = + (0x10000 + ((u & 0x3ff) << 10)) | (str.charCodeAt(++i) & 0x3ff); + } + if (u <= 0x7f) ++len; + else if (u <= 0x7ff) len += 2; + else if (u <= 0xffff) len += 3; + else len += 4; + } + return len; + }; + + target.jstrcpy = function ( + jstr, + tgt, + offset = 0, + maxBytes = -1, + addNul = true, + ) { + if ( + !tgt || + (!(tgt instanceof Int8Array) && !(tgt instanceof Uint8Array)) + ) { + toss('jstrcpy() target must be an Int8Array or Uint8Array.'); + } + if (maxBytes < 0) maxBytes = tgt.length - offset; + if (!(maxBytes > 0) || !(offset >= 0)) return 0; + let i = 0, + max = jstr.length; + const begin = offset, + end = offset + maxBytes - (addNul ? 1 : 0); + for (; i < max && offset < end; ++i) { + let u = jstr.charCodeAt(i); + if (u >= 0xd800 && u <= 0xdfff) { + u = + (0x10000 + ((u & 0x3ff) << 10)) | + (jstr.charCodeAt(++i) & 0x3ff); + } + if (u <= 0x7f) { + if (offset >= end) break; + tgt[offset++] = u; + } else if (u <= 0x7ff) { + if (offset + 1 >= end) break; + tgt[offset++] = 0xc0 | (u >> 6); + tgt[offset++] = 0x80 | (u & 0x3f); + } else if (u <= 0xffff) { + if (offset + 2 >= end) break; + tgt[offset++] = 0xe0 | (u >> 12); + tgt[offset++] = 0x80 | ((u >> 6) & 0x3f); + tgt[offset++] = 0x80 | (u & 0x3f); + } else { + if (offset + 3 >= end) break; + tgt[offset++] = 0xf0 | (u >> 18); + tgt[offset++] = 0x80 | ((u >> 12) & 0x3f); + tgt[offset++] = 0x80 | ((u >> 6) & 0x3f); + tgt[offset++] = 0x80 | (u & 0x3f); + } + } + if (addNul) tgt[offset++] = 0; + return offset - begin; + }; + + target.cstrncpy = function (tgtPtr, srcPtr, n) { + if (!tgtPtr || !srcPtr) + toss('cstrncpy() does not accept NULL strings.'); + if (n < 0) n = target.cstrlen(strPtr) + 1; + else if (!(n > 0)) return 0; + const heap = target.heap8u(); + let i = 0, + ch; + for (; i < n && (ch = heap[srcPtr + i]); ++i) { + heap[tgtPtr + i] = ch; + } + if (i < n) heap[tgtPtr + i++] = 0; + return i; + }; + + target.jstrToUintArray = (str, addNul = false) => { + return cache.utf8Encoder.encode(addNul ? str + '\0' : str); + }; + + const __affirmAlloc = (obj, funcName) => { + if ( + !(obj.alloc instanceof Function) || + !(obj.dealloc instanceof Function) + ) { + toss( + 'Object is missing alloc() and/or dealloc() function(s)', + 'required by', + funcName + '().', + ); + } + }; + + const __allocCStr = function ( + jstr, + returnWithLength, + allocator, + funcName, + ) { + __affirmAlloc(target, funcName); + if ('string' !== typeof jstr) return null; + if (0) { + const n = target.jstrlen(jstr), + ptr = allocator(n + 1); + target.jstrcpy(jstr, target.heap8u(), ptr, n + 1, true); + return returnWithLength ? [ptr, n] : ptr; + } else { + const u = cache.utf8Encoder.encode(jstr), + ptr = allocator(u.length + 1), + heap = heapWrappers().HEAP8U; + heap.set(u, ptr); + heap[ptr + u.length] = 0; + return returnWithLength ? [ptr, u.length] : ptr; + } + }; + + target.allocCString = (jstr, returnWithLength = false) => + __allocCStr(jstr, returnWithLength, target.alloc, 'allocCString()'); + + target.scopedAllocPush = function () { + __affirmAlloc(target, 'scopedAllocPush'); + const a = []; + cache.scopedAlloc.push(a); + return a; + }; + + target.scopedAllocPop = function (state) { + __affirmAlloc(target, 'scopedAllocPop'); + const n = arguments.length + ? cache.scopedAlloc.indexOf(state) + : cache.scopedAlloc.length - 1; + if (n < 0) toss('Invalid state object for scopedAllocPop().'); + if (0 === arguments.length) state = cache.scopedAlloc[n]; + cache.scopedAlloc.splice(n, 1); + for (let p; (p = state.pop()); ) { + if (target.functionEntry(p)) { + target.uninstallFunction(p); + } else target.dealloc(p); + } + }; + + target.scopedAlloc = function (n) { + if (!cache.scopedAlloc.length) { + toss('No scopedAllocPush() scope is active.'); + } + const p = target.alloc(n); + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(p); + return p; + }; + + Object.defineProperty(target.scopedAlloc, 'level', { + configurable: false, + enumerable: false, + get: () => cache.scopedAlloc.length, + set: () => toss("The 'active' property is read-only."), + }); + + target.scopedAllocCString = (jstr, returnWithLength = false) => + __allocCStr( + jstr, + returnWithLength, + target.scopedAlloc, + 'scopedAllocCString()', + ); + + const __allocMainArgv = function (isScoped, list) { + const pList = target[isScoped ? 'scopedAlloc' : 'alloc']( + (list.length + 1) * target.ptrSizeof, + ); + let i = 0; + list.forEach((e) => { + target.pokePtr( + pList + target.ptrSizeof * i++, + target[isScoped ? 'scopedAllocCString' : 'allocCString']('' + e), + ); + }); + target.pokePtr(pList + target.ptrSizeof * i, 0); + return pList; + }; + + target.scopedAllocMainArgv = (list) => __allocMainArgv(true, list); + + target.allocMainArgv = (list) => __allocMainArgv(false, list); + + target.cArgvToJs = (argc, pArgv) => { + const list = []; + for (let i = 0; i < argc; ++i) { + const arg = target.peekPtr(pArgv + target.ptrSizeof * i); + list.push(arg ? target.cstrToJs(arg) : null); + } + return list; + }; + + target.scopedAllocCall = function (func) { + target.scopedAllocPush(); + try { + return func(); + } finally { + target.scopedAllocPop(); + } + }; + + const __allocPtr = function (howMany, safePtrSize, method) { + __affirmAlloc(target, method); + const pIr = safePtrSize ? 'i64' : ptrIR; + let m = target[method](howMany * (safePtrSize ? 8 : ptrSizeof)); + target.poke(m, 0, pIr); + if (1 === howMany) { + return m; + } + const a = [m]; + for (let i = 1; i < howMany; ++i) { + m += safePtrSize ? 8 : ptrSizeof; + a[i] = m; + target.poke(m, 0, pIr); + } + return a; + }; + + target.allocPtr = (howMany = 1, safePtrSize = true) => + __allocPtr(howMany, safePtrSize, 'alloc'); + + target.scopedAllocPtr = (howMany = 1, safePtrSize = true) => + __allocPtr(howMany, safePtrSize, 'scopedAlloc'); + + target.xGet = function (name) { + return ( + target.exports[name] || toss('Cannot find exported symbol:', name) + ); + }; + + const __argcMismatch = (f, n) => + toss(f + '() requires', n, 'argument(s).'); + + target.xCall = function (fname, ...args) { + const f = fname instanceof Function ? fname : target.xGet(fname); + if (!(f instanceof Function)) + toss('Exported symbol', fname, 'is not a function.'); + if (f.length !== args.length) + __argcMismatch(f === fname ? f.name : fname, f.length); + return 2 === arguments.length && Array.isArray(arguments[1]) + ? f.apply(null, arguments[1]) + : f.apply(null, args); + }; + + cache.xWrap = Object.create(null); + cache.xWrap.convert = Object.create(null); + + cache.xWrap.convert.arg = new Map(); + + cache.xWrap.convert.result = new Map(); + const xArg = cache.xWrap.convert.arg, + xResult = cache.xWrap.convert.result; + + if (target.bigIntEnabled) { + xArg.set('i64', (i) => BigInt(i)); + } + const __xArgPtr = + 'i32' === ptrIR ? (i) => i | 0 : (i) => BigInt(i) | BigInt(0); + xArg + .set('i32', __xArgPtr) + .set('i16', (i) => (i | 0) & 0xffff) + .set('i8', (i) => (i | 0) & 0xff) + .set('f32', (i) => Number(i).valueOf()) + .set('float', xArg.get('f32')) + .set('f64', xArg.get('f32')) + .set('double', xArg.get('f64')) + .set('int', xArg.get('i32')) + .set('null', (i) => i) + .set(null, xArg.get('null')) + .set('**', __xArgPtr) + .set('*', __xArgPtr); + xResult + .set('*', __xArgPtr) + .set('pointer', __xArgPtr) + .set('number', (v) => Number(v)) + .set('void', (v) => undefined) + .set('null', (v) => v) + .set(null, xResult.get('null')); + + { + const copyToResult = [ + 'i8', + 'i16', + 'i32', + 'int', + 'f32', + 'float', + 'f64', + 'double', + ]; + if (target.bigIntEnabled) copyToResult.push('i64'); + const adaptPtr = xArg.get(ptrIR); + for (const t of copyToResult) { + xArg.set(t + '*', adaptPtr); + xResult.set(t + '*', adaptPtr); + xResult.set(t, xArg.get(t) || toss('Missing arg converter:', t)); + } + } + + const __xArgString = function (v) { + if ('string' === typeof v) return target.scopedAllocCString(v); + return v ? __xArgPtr(v) : null; + }; + xArg + .set('string', __xArgString) + .set('utf8', __xArgString) + .set('pointer', __xArgString); + + xResult + .set('string', (i) => target.cstrToJs(i)) + .set('utf8', xResult.get('string')) + .set('string:dealloc', (i) => { + try { + return i ? target.cstrToJs(i) : null; + } finally { + target.dealloc(i); + } + }) + .set('utf8:dealloc', xResult.get('string:dealloc')) + .set('json', (i) => JSON.parse(target.cstrToJs(i))) + .set('json:dealloc', (i) => { + try { + return i ? JSON.parse(target.cstrToJs(i)) : null; + } finally { + target.dealloc(i); + } + }); + + const AbstractArgAdapter = class { + constructor(opt) { + this.name = opt.name || 'unnamed adapter'; + } + + convertArg(v, argv, argIndex) { + toss('AbstractArgAdapter must be subclassed.'); + } + }; + + xArg.FuncPtrAdapter = class FuncPtrAdapter extends AbstractArgAdapter { + constructor(opt) { + super(opt); + if (xArg.FuncPtrAdapter.warnOnUse) { + console.warn( + 'xArg.FuncPtrAdapter is an internal-only API', + 'and is not intended to be invoked from', + 'client-level code. Invoked with:', + opt, + ); + } + this.name = opt.name || 'unnamed'; + this.signature = opt.signature; + if (opt.contextKey instanceof Function) { + this.contextKey = opt.contextKey; + if (!opt.bindScope) opt.bindScope = 'context'; + } + this.bindScope = + opt.bindScope || + toss( + 'FuncPtrAdapter options requires a bindScope (explicit or implied).', + ); + if (FuncPtrAdapter.bindScopes.indexOf(opt.bindScope) < 0) { + toss( + 'Invalid options.bindScope (' + + opt.bindMod + + ') for FuncPtrAdapter. ' + + 'Expecting one of: (' + + FuncPtrAdapter.bindScopes.join(', ') + + ')', + ); + } + this.isTransient = 'transient' === this.bindScope; + this.isContext = 'context' === this.bindScope; + this.isPermanent = 'permanent' === this.bindScope; + this.singleton = 'singleton' === this.bindScope ? [] : undefined; + + this.callProxy = + opt.callProxy instanceof Function ? opt.callProxy : undefined; + } + + contextKey(argv, argIndex) { + return this; + } + + contextMap(key) { + const cm = this.__cmap || (this.__cmap = new Map()); + let rc = cm.get(key); + if (undefined === rc) cm.set(key, (rc = [])); + return rc; + } + + convertArg(v, argv, argIndex) { + let pair = this.singleton; + if (!pair && this.isContext) { + pair = this.contextMap(this.contextKey(argv, argIndex)); + } + if (pair && pair[0] === v) return pair[1]; + if (v instanceof Function) { + if (this.callProxy) v = this.callProxy(v); + const fp = __installFunction(v, this.signature, this.isTransient); + if (FuncPtrAdapter.debugFuncInstall) { + FuncPtrAdapter.debugOut( + 'FuncPtrAdapter installed', + this, + this.contextKey(argv, argIndex), + '@' + fp, + v, + ); + } + if (pair) { + if (pair[1]) { + if (FuncPtrAdapter.debugFuncInstall) { + FuncPtrAdapter.debugOut( + 'FuncPtrAdapter uninstalling', + this, + this.contextKey(argv, argIndex), + '@' + pair[1], + v, + ); + } + try { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push( + pair[1], + ); + } catch (e) {} + } + pair[0] = v; + pair[1] = fp; + } + return fp; + } else if (target.isPtr(v) || null === v || undefined === v) { + if (pair && pair[1] && pair[1] !== v) { + if (FuncPtrAdapter.debugFuncInstall) { + FuncPtrAdapter.debugOut( + 'FuncPtrAdapter uninstalling', + this, + this.contextKey(argv, argIndex), + '@' + pair[1], + v, + ); + } + try { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(pair[1]); + } catch (e) {} + pair[0] = pair[1] = v | 0; + } + return v || 0; + } else { + throw new TypeError( + 'Invalid FuncPtrAdapter argument type. ' + + 'Expecting a function pointer or a ' + + (this.name ? this.name + ' ' : '') + + 'function matching signature ' + + this.signature + + '.', + ); + } + } + }; + + xArg.FuncPtrAdapter.warnOnUse = false; + + xArg.FuncPtrAdapter.debugFuncInstall = false; + + xArg.FuncPtrAdapter.debugOut = console.debug.bind(console); + + xArg.FuncPtrAdapter.bindScopes = [ + 'transient', + 'context', + 'singleton', + 'permanent', + ]; + + const __xArgAdapterCheck = (t) => + xArg.get(t) || toss('Argument adapter not found:', t); + + const __xResultAdapterCheck = (t) => + xResult.get(t) || toss('Result adapter not found:', t); + + cache.xWrap.convertArg = (t, ...args) => __xArgAdapterCheck(t)(...args); + + cache.xWrap.convertArgNoCheck = (t, ...args) => xArg.get(t)(...args); + + cache.xWrap.convertResult = (t, v) => + null === t ? v : t ? __xResultAdapterCheck(t)(v) : undefined; + + cache.xWrap.convertResultNoCheck = (t, v) => + null === t ? v : t ? xResult.get(t)(v) : undefined; + + target.xWrap = function (fArg, resultType, ...argTypes) { + if (3 === arguments.length && Array.isArray(arguments[2])) { + argTypes = arguments[2]; + } + if (target.isPtr(fArg)) { + fArg = + target.functionEntry(fArg) || + toss('Function pointer not found in WASM function table.'); + } + const fIsFunc = fArg instanceof Function; + const xf = fIsFunc ? fArg : target.xGet(fArg); + if (fIsFunc) fArg = xf.name || 'unnamed function'; + if (argTypes.length !== xf.length) __argcMismatch(fArg, xf.length); + if (null === resultType && 0 === xf.length) { + return xf; + } + if (undefined !== resultType && null !== resultType) + __xResultAdapterCheck(resultType); + for (const t of argTypes) { + if (t instanceof AbstractArgAdapter) + xArg.set(t, (...args) => t.convertArg(...args)); + else __xArgAdapterCheck(t); + } + const cxw = cache.xWrap; + if (0 === xf.length) { + return (...args) => + args.length + ? __argcMismatch(fArg, xf.length) + : cxw.convertResult(resultType, xf.call(null)); + } + return function (...args) { + if (args.length !== xf.length) __argcMismatch(fArg, xf.length); + const scope = target.scopedAllocPush(); + try { + let i = 0; + for (; i < args.length; ++i) + args[i] = cxw.convertArgNoCheck(argTypes[i], args[i], args, i); + return cxw.convertResultNoCheck(resultType, xf.apply(null, args)); + } finally { + target.scopedAllocPop(scope); + } + }; + }; + + const __xAdapter = function ( + func, + argc, + typeName, + adapter, + modeName, + xcvPart, + ) { + if ('string' === typeof typeName) { + if (1 === argc) return xcvPart.get(typeName); + else if (2 === argc) { + if (!adapter) { + xcvPart.delete(typeName); + return func; + } else if (!(adapter instanceof Function)) { + toss(modeName, 'requires a function argument.'); + } + xcvPart.set(typeName, adapter); + return func; + } + } + toss('Invalid arguments to', modeName); + }; + + target.xWrap.resultAdapter = function f(typeName, adapter) { + return __xAdapter( + f, + arguments.length, + typeName, + adapter, + 'resultAdapter()', + xResult, + ); + }; + + target.xWrap.argAdapter = function f(typeName, adapter) { + return __xAdapter( + f, + arguments.length, + typeName, + adapter, + 'argAdapter()', + xArg, + ); + }; + + target.xWrap.FuncPtrAdapter = xArg.FuncPtrAdapter; + + target.xCallWrapped = function (fArg, resultType, argTypes, ...args) { + if (Array.isArray(arguments[3])) args = arguments[3]; + return target + .xWrap(fArg, resultType, argTypes || []) + .apply(null, args || []); + }; + + target.xWrap.testConvertArg = cache.xWrap.convertArg; + + target.xWrap.testConvertResult = cache.xWrap.convertResult; + + return target; + }; + + globalThis.WhWasmUtilInstaller.yawl = function (config) { + const wfetch = () => fetch(config.uri, { credentials: 'same-origin' }); + const wui = this; + const finalThen = function (arg) { + if (config.wasmUtilTarget) { + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + const tgt = config.wasmUtilTarget; + tgt.module = arg.module; + tgt.instance = arg.instance; + + if (!tgt.instance.exports.memory) { + tgt.memory = + (config.imports && + config.imports.env && + config.imports.env.memory) || + toss("Missing 'memory' object!"); + } + if (!tgt.alloc && arg.instance.exports.malloc) { + const exports = arg.instance.exports; + tgt.alloc = function (n) { + return ( + exports.malloc(n) || toss('Allocation of', n, 'bytes failed.') + ); + }; + tgt.dealloc = function (m) { + exports.free(m); + }; + } + wui(tgt); + } + if (config.onload) config.onload(arg, config); + return arg; + }; + const loadWasm = WebAssembly.instantiateStreaming + ? function loadWasmStreaming() { + return WebAssembly.instantiateStreaming( + wfetch(), + config.imports || {}, + ).then(finalThen); + } + : function loadWasmOldSchool() { + return wfetch() + .then((response) => response.arrayBuffer()) + .then((bytes) => + WebAssembly.instantiate(bytes, config.imports || {}), + ) + .then(finalThen); + }; + return loadWasm; + }.bind(globalThis.WhWasmUtilInstaller); + + ('use strict'); + globalThis.Jaccwabyt = function StructBinderFactory(config) { + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + + if ( + !(config.heap instanceof WebAssembly.Memory) && + !(config.heap instanceof Function) + ) { + toss( + 'config.heap must be WebAssembly.Memory instance or a function.', + ); + } + ['alloc', 'dealloc'].forEach(function (k) { + config[k] instanceof Function || + toss("Config option '" + k + "' must be a function."); + }); + const SBF = StructBinderFactory; + const heap = + config.heap instanceof Function + ? config.heap + : () => new Uint8Array(config.heap.buffer), + alloc = config.alloc, + dealloc = config.dealloc, + log = config.log || console.log.bind(console), + memberPrefix = config.memberPrefix || '', + memberSuffix = config.memberSuffix || '', + bigIntEnabled = + undefined === config.bigIntEnabled + ? !!globalThis['BigInt64Array'] + : !!config.bigIntEnabled, + BigInt = globalThis['BigInt'], + BigInt64Array = globalThis['BigInt64Array'], + ptrSizeof = config.ptrSizeof || 4, + ptrIR = config.ptrIR || 'i32'; + if (!SBF.debugFlags) { + SBF.__makeDebugFlags = function (deriveFrom = null) { + if (deriveFrom && deriveFrom.__flags) + deriveFrom = deriveFrom.__flags; + const f = function f(flags) { + if (0 === arguments.length) { + return f.__flags; + } + if (flags < 0) { + delete f.__flags.getter; + delete f.__flags.setter; + delete f.__flags.alloc; + delete f.__flags.dealloc; + } else { + f.__flags.getter = 0 !== (0x01 & flags); + f.__flags.setter = 0 !== (0x02 & flags); + f.__flags.alloc = 0 !== (0x04 & flags); + f.__flags.dealloc = 0 !== (0x08 & flags); + } + return f._flags; + }; + Object.defineProperty(f, '__flags', { + iterable: false, + writable: false, + value: Object.create(deriveFrom), + }); + if (!deriveFrom) f(0); + return f; + }; + SBF.debugFlags = SBF.__makeDebugFlags(); + } + + const isLittleEndian = (function () { + const buffer = new ArrayBuffer(2); + new DataView(buffer).setInt16(0, 256, true); + + return new Int16Array(buffer)[0] === 256; + })(); + + const isFuncSig = (s) => '(' === s[1]; + + const isPtrSig = (s) => 'p' === s || 'P' === s; + const isAutoPtrSig = (s) => 'P' === s; + const sigLetter = (s) => (isFuncSig(s) ? 'p' : s[0]); + + const sigIR = function (s) { + switch (sigLetter(s)) { + case 'c': + case 'C': + return 'i8'; + case 'i': + return 'i32'; + case 'p': + case 'P': + case 's': + return ptrIR; + case 'j': + return 'i64'; + case 'f': + return 'float'; + case 'd': + return 'double'; + } + toss('Unhandled signature IR:', s); + }; + + const affirmBigIntArray = BigInt64Array + ? () => true + : () => toss('BigInt64Array is not available.'); + + const sigDVGetter = function (s) { + switch (sigLetter(s)) { + case 'p': + case 'P': + case 's': { + switch (ptrSizeof) { + case 4: + return 'getInt32'; + case 8: + return affirmBigIntArray() && 'getBigInt64'; + } + break; + } + case 'i': + return 'getInt32'; + case 'c': + return 'getInt8'; + case 'C': + return 'getUint8'; + case 'j': + return affirmBigIntArray() && 'getBigInt64'; + case 'f': + return 'getFloat32'; + case 'd': + return 'getFloat64'; + } + toss('Unhandled DataView getter for signature:', s); + }; + + const sigDVSetter = function (s) { + switch (sigLetter(s)) { + case 'p': + case 'P': + case 's': { + switch (ptrSizeof) { + case 4: + return 'setInt32'; + case 8: + return affirmBigIntArray() && 'setBigInt64'; + } + break; + } + case 'i': + return 'setInt32'; + case 'c': + return 'setInt8'; + case 'C': + return 'setUint8'; + case 'j': + return affirmBigIntArray() && 'setBigInt64'; + case 'f': + return 'setFloat32'; + case 'd': + return 'setFloat64'; + } + toss('Unhandled DataView setter for signature:', s); + }; + + const sigDVSetWrapper = function (s) { + switch (sigLetter(s)) { + case 'i': + case 'f': + case 'c': + case 'C': + case 'd': + return Number; + case 'j': + return affirmBigIntArray() && BigInt; + case 'p': + case 'P': + case 's': + switch (ptrSizeof) { + case 4: + return Number; + case 8: + return affirmBigIntArray() && BigInt; + } + break; + } + toss('Unhandled DataView set wrapper for signature:', s); + }; + + const sPropName = (s, k) => s + '::' + k; + + const __propThrowOnSet = function (structName, propName) { + return () => toss(sPropName(structName, propName), 'is read-only.'); + }; + + const __instancePointerMap = new WeakMap(); + + const xPtrPropName = '(pointer-is-external)'; + + const __freeStruct = function (ctor, obj, m) { + if (!m) m = __instancePointerMap.get(obj); + if (m) { + __instancePointerMap.delete(obj); + if (Array.isArray(obj.ondispose)) { + let x; + while ((x = obj.ondispose.shift())) { + try { + if (x instanceof Function) x.call(obj); + else if (x instanceof StructType) x.dispose(); + else if ('number' === typeof x) dealloc(x); + } catch (e) { + console.warn( + 'ondispose() for', + ctor.structName, + '@', + m, + 'threw. NOT propagating it.', + e, + ); + } + } + } else if (obj.ondispose instanceof Function) { + try { + obj.ondispose(); + } catch (e) { + console.warn( + 'ondispose() for', + ctor.structName, + '@', + m, + 'threw. NOT propagating it.', + e, + ); + } + } + delete obj.ondispose; + if (ctor.debugFlags.__flags.dealloc) { + log( + 'debug.dealloc:', + obj[xPtrPropName] ? 'EXTERNAL' : '', + ctor.structName, + 'instance:', + ctor.structInfo.sizeof, + 'bytes @' + m, + ); + } + if (!obj[xPtrPropName]) dealloc(m); + } + }; + + const rop = (v) => { + return { + configurable: false, + writable: false, + iterable: false, + value: v, + }; + }; + + const __allocStruct = function (ctor, obj, m) { + let fill = !m; + if (m) Object.defineProperty(obj, xPtrPropName, rop(m)); + else { + m = alloc(ctor.structInfo.sizeof); + if (!m) toss('Allocation of', ctor.structName, 'structure failed.'); + } + try { + if (ctor.debugFlags.__flags.alloc) { + log( + 'debug.alloc:', + fill ? '' : 'EXTERNAL', + ctor.structName, + 'instance:', + ctor.structInfo.sizeof, + 'bytes @' + m, + ); + } + if (fill) heap().fill(0, m, m + ctor.structInfo.sizeof); + __instancePointerMap.set(obj, m); + } catch (e) { + __freeStruct(ctor, obj, m); + throw e; + } + }; + + const __memoryDump = function () { + const p = this.pointer; + return p + ? new Uint8Array(heap().slice(p, p + this.structInfo.sizeof)) + : null; + }; + + const __memberKey = (k) => memberPrefix + k + memberSuffix; + const __memberKeyProp = rop(__memberKey); + + const __lookupMember = function ( + structInfo, + memberName, + tossIfNotFound = true, + ) { + let m = structInfo.members[memberName]; + if (!m && (memberPrefix || memberSuffix)) { + for (const v of Object.values(structInfo.members)) { + if (v.key === memberName) { + m = v; + break; + } + } + if (!m && tossIfNotFound) { + toss( + sPropName(structInfo.name, memberName), + 'is not a mapped struct member.', + ); + } + } + return m; + }; + + const __memberSignature = function f( + obj, + memberName, + emscriptenFormat = false, + ) { + if (!f._) + f._ = (x) => + x.replace(/[^vipPsjrdcC]/g, '').replace(/[pPscC]/g, 'i'); + const m = __lookupMember(obj.structInfo, memberName, true); + return emscriptenFormat ? f._(m.signature) : m.signature; + }; + + const __ptrPropDescriptor = { + configurable: false, + enumerable: false, + get: function () { + return __instancePointerMap.get(this); + }, + set: () => toss("Cannot assign the 'pointer' property of a struct."), + }; + + const __structMemberKeys = rop(function () { + const a = []; + for (const k of Object.keys(this.structInfo.members)) { + a.push(this.memberKey(k)); + } + return a; + }); + + const __utf8Decoder = new TextDecoder('utf-8'); + const __utf8Encoder = new TextEncoder(); + + const __SAB = + 'undefined' === typeof SharedArrayBuffer + ? function () {} + : SharedArrayBuffer; + const __utf8Decode = function (arrayBuffer, begin, end) { + return __utf8Decoder.decode( + arrayBuffer.buffer instanceof __SAB + ? arrayBuffer.slice(begin, end) + : arrayBuffer.subarray(begin, end), + ); + }; + + const __memberIsString = function ( + obj, + memberName, + tossIfNotFound = false, + ) { + const m = __lookupMember(obj.structInfo, memberName, tossIfNotFound); + return m && 1 === m.signature.length && 's' === m.signature[0] + ? m + : false; + }; + + const __affirmCStringSignature = function (member) { + if ('s' === member.signature) return; + toss( + 'Invalid member type signature for C-string value:', + JSON.stringify(member), + ); + }; + + const __memberToJsString = function f(obj, memberName) { + const m = __lookupMember(obj.structInfo, memberName, true); + __affirmCStringSignature(m); + const addr = obj[m.key]; + + if (!addr) return null; + let pos = addr; + const mem = heap(); + for (; mem[pos] !== 0; ++pos) {} + + return addr === pos ? '' : __utf8Decode(mem, addr, pos); + }; + + const __addOnDispose = function (obj, ...v) { + if (obj.ondispose) { + if (!Array.isArray(obj.ondispose)) { + obj.ondispose = [obj.ondispose]; + } + } else { + obj.ondispose = []; + } + obj.ondispose.push(...v); + }; + + const __allocCString = function (str) { + const u = __utf8Encoder.encode(str); + const mem = alloc(u.length + 1); + if (!mem) toss('Allocation error while duplicating string:', str); + const h = heap(); + + h.set(u, mem); + h[mem + u.length] = 0; + + return mem; + }; + + const __setMemberCString = function (obj, memberName, str) { + const m = __lookupMember(obj.structInfo, memberName, true); + __affirmCStringSignature(m); + + const mem = __allocCString(str); + obj[m.key] = mem; + __addOnDispose(obj, mem); + return obj; + }; + + const StructType = function ctor(structName, structInfo) { + if (arguments[2] !== rop) { + toss( + 'Do not call the StructType constructor', + 'from client-level code.', + ); + } + Object.defineProperties(this, { + structName: rop(structName), + structInfo: rop(structInfo), + }); + }; + + StructType.prototype = Object.create(null, { + dispose: rop(function () { + __freeStruct(this.constructor, this); + }), + lookupMember: rop(function (memberName, tossIfNotFound = true) { + return __lookupMember(this.structInfo, memberName, tossIfNotFound); + }), + memberToJsString: rop(function (memberName) { + return __memberToJsString(this, memberName); + }), + memberIsString: rop(function (memberName, tossIfNotFound = true) { + return __memberIsString(this, memberName, tossIfNotFound); + }), + memberKey: __memberKeyProp, + memberKeys: __structMemberKeys, + memberSignature: rop(function (memberName, emscriptenFormat = false) { + return __memberSignature(this, memberName, emscriptenFormat); + }), + memoryDump: rop(__memoryDump), + pointer: __ptrPropDescriptor, + setMemberCString: rop(function (memberName, str) { + return __setMemberCString(this, memberName, str); + }), + }); + + Object.assign(StructType.prototype, { + addOnDispose: function (...v) { + __addOnDispose(this, ...v); + return this; + }, + }); + + Object.defineProperties(StructType, { + allocCString: rop(__allocCString), + isA: rop((v) => v instanceof StructType), + hasExternalPointer: rop( + (v) => v instanceof StructType && !!v[xPtrPropName], + ), + memberKey: __memberKeyProp, + }); + + const isNumericValue = (v) => + Number.isFinite(v) || v instanceof (BigInt || Number); + + const makeMemberWrapper = function f(ctor, name, descr) { + if (!f._) { + f._ = { getters: {}, setters: {}, sw: {} }; + const a = ['i', 'c', 'C', 'p', 'P', 's', 'f', 'd', 'v()']; + if (bigIntEnabled) a.push('j'); + a.forEach(function (v) { + f._.getters[v] = sigDVGetter(v); + f._.setters[v] = sigDVSetter(v); + f._.sw[v] = sigDVSetWrapper(v); + }); + const rxSig1 = /^[ipPsjfdcC]$/, + rxSig2 = /^[vipPsjfdcC]\([ipPsjfdcC]*\)$/; + f.sigCheck = function (obj, name, key, sig) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + toss(obj.structName, 'already has a property named', key + '.'); + } + rxSig1.test(sig) || + rxSig2.test(sig) || + toss( + 'Malformed signature for', + sPropName(obj.structName, name) + ':', + sig, + ); + }; + } + const key = ctor.memberKey(name); + f.sigCheck(ctor.prototype, name, key, descr.signature); + descr.key = key; + descr.name = name; + const sigGlyph = sigLetter(descr.signature); + const xPropName = sPropName(ctor.prototype.structName, key); + const dbg = ctor.prototype.debugFlags.__flags; + + const prop = Object.create(null); + prop.configurable = false; + prop.enumerable = false; + prop.get = function () { + if (dbg.getter) { + log( + 'debug.getter:', + f._.getters[sigGlyph], + 'for', + sigIR(sigGlyph), + xPropName, + '@', + this.pointer, + '+', + descr.offset, + 'sz', + descr.sizeof, + ); + } + let rc = new DataView( + heap().buffer, + this.pointer + descr.offset, + descr.sizeof, + )[f._.getters[sigGlyph]](0, isLittleEndian); + if (dbg.getter) log('debug.getter:', xPropName, 'result =', rc); + return rc; + }; + if (descr.readOnly) { + prop.set = __propThrowOnSet(ctor.prototype.structName, key); + } else { + prop.set = function (v) { + if (dbg.setter) { + log( + 'debug.setter:', + f._.setters[sigGlyph], + 'for', + sigIR(sigGlyph), + xPropName, + '@', + this.pointer, + '+', + descr.offset, + 'sz', + descr.sizeof, + v, + ); + } + if (!this.pointer) { + toss('Cannot set struct property on disposed instance.'); + } + if (null === v) v = 0; + else + while (!isNumericValue(v)) { + if ( + isAutoPtrSig(descr.signature) && + v instanceof StructType + ) { + v = v.pointer || 0; + if (dbg.setter) + log('debug.setter:', xPropName, 'resolved to', v); + break; + } + toss('Invalid value for pointer-type', xPropName + '.'); + } + new DataView( + heap().buffer, + this.pointer + descr.offset, + descr.sizeof, + )[f._.setters[sigGlyph]](0, f._.sw[sigGlyph](v), isLittleEndian); + }; + } + Object.defineProperty(ctor.prototype, key, prop); + }; + + const StructBinder = function StructBinder(structName, structInfo) { + if (1 === arguments.length) { + structInfo = structName; + structName = structInfo.name; + } else if (!structInfo.name) { + structInfo.name = structName; + } + if (!structName) toss('Struct name is required.'); + let lastMember = false; + Object.keys(structInfo.members).forEach((k) => { + const m = structInfo.members[k]; + if (!m.sizeof) toss(structName, 'member', k, 'is missing sizeof.'); + else if (m.sizeof === 1) { + m.signature === 'c' || + m.signature === 'C' || + toss( + 'Unexpected sizeof==1 member', + sPropName(structInfo.name, k), + 'with signature', + m.signature, + ); + } else { + if (0 !== m.sizeof % 4) { + console.warn( + 'Invalid struct member description =', + m, + 'from', + structInfo, + ); + toss( + structName, + 'member', + k, + 'sizeof is not aligned. sizeof=' + m.sizeof, + ); + } + if (0 !== m.offset % 4) { + console.warn( + 'Invalid struct member description =', + m, + 'from', + structInfo, + ); + toss( + structName, + 'member', + k, + 'offset is not aligned. offset=' + m.offset, + ); + } + } + if (!lastMember || lastMember.offset < m.offset) lastMember = m; + }); + if (!lastMember) toss('No member property descriptions found.'); + else if (structInfo.sizeof < lastMember.offset + lastMember.sizeof) { + toss( + 'Invalid struct config:', + structName, + 'max member offset (' + lastMember.offset + ') ', + 'extends past end of struct (sizeof=' + structInfo.sizeof + ').', + ); + } + const debugFlags = rop(SBF.__makeDebugFlags(StructBinder.debugFlags)); + + const StructCtor = function StructCtor(externalMemory) { + if (!(this instanceof StructCtor)) { + toss( + 'The', + structName, + "constructor may only be called via 'new'.", + ); + } else if (arguments.length) { + if ( + externalMemory !== (externalMemory | 0) || + externalMemory <= 0 + ) { + toss('Invalid pointer value for', structName, 'constructor.'); + } + __allocStruct(StructCtor, this, externalMemory); + } else { + __allocStruct(StructCtor, this); + } + }; + Object.defineProperties(StructCtor, { + debugFlags: debugFlags, + isA: rop((v) => v instanceof StructCtor), + memberKey: __memberKeyProp, + memberKeys: __structMemberKeys, + methodInfoForKey: rop(function (mKey) {}), + structInfo: rop(structInfo), + structName: rop(structName), + }); + StructCtor.prototype = new StructType(structName, structInfo, rop); + Object.defineProperties(StructCtor.prototype, { + debugFlags: debugFlags, + constructor: rop(StructCtor), + }); + Object.keys(structInfo.members).forEach((name) => + makeMemberWrapper(StructCtor, name, structInfo.members[name]), + ); + return StructCtor; + }; + StructBinder.StructType = StructType; + StructBinder.config = config; + StructBinder.allocCString = __allocCString; + if (!StructBinder.debugFlags) { + StructBinder.debugFlags = SBF.__makeDebugFlags(SBF.debugFlags); + } + return StructBinder; + }; + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + 'use strict'; + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + const toss3 = sqlite3.SQLite3Error.toss; + const capi = sqlite3.capi, + wasm = sqlite3.wasm, + util = sqlite3.util; + globalThis.WhWasmUtilInstaller(wasm); + delete globalThis.WhWasmUtilInstaller; + + if (0) { + const dealloc = wasm.exports[sqlite3.config.deallocExportName]; + const nFunc = wasm.functionTable().length; + let i; + for (i = 0; i < nFunc; ++i) { + const e = wasm.functionEntry(i); + if (dealloc === e) { + capi.SQLITE_WASM_DEALLOC = i; + break; + } + } + if (dealloc !== wasm.functionEntry(capi.SQLITE_WASM_DEALLOC)) { + toss( + 'Internal error: cannot find function pointer for SQLITE_WASM_DEALLOC.', + ); + } + } + + wasm.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', undefined, '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 wasm.xWrap.FuncPtrAdapter({ + signature: 'i(pi)', + contextKey: (argv, argIndex) => argv[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 wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_commit_hook', + signature: 'i(p)', + contextKey: (argv) => argv[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 wasm.xWrap.FuncPtrAdapter({ + signature: 'i(pipp)', + bindScope: 'transient', + callProxy: (callback) => { + let aNames; + return (pVoid, nCols, pColVals, pColNames) => { + try { + const aVals = wasm.cArgvToJs(nCols, pColVals); + if (!aNames) aNames = wasm.cArgvToJs(nCols, pColNames); + return callback(aVals, aNames) | 0; + } catch (e) { + return e.resultCode || capi.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', undefined, '*'], + ['sqlite3_get_autocommit', 'int', 'sqlite3*'], + ['sqlite3_get_auxdata', '*', 'sqlite3_context*', 'int'], + ['sqlite3_initialize', undefined], + ['sqlite3_interrupt', undefined, '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', + undefined, + 'sqlite3_context*', + '*', + 'int', + '*', + ], + ['sqlite3_result_double', undefined, 'sqlite3_context*', 'f64'], + [ + 'sqlite3_result_error', + undefined, + 'sqlite3_context*', + 'string', + 'int', + ], + ['sqlite3_result_error_code', undefined, 'sqlite3_context*', 'int'], + ['sqlite3_result_error_nomem', undefined, 'sqlite3_context*'], + ['sqlite3_result_error_toobig', undefined, 'sqlite3_context*'], + ['sqlite3_result_int', undefined, 'sqlite3_context*', 'int'], + ['sqlite3_result_null', undefined, 'sqlite3_context*'], + [ + 'sqlite3_result_pointer', + undefined, + 'sqlite3_context*', + '*', + 'string:static', + '*', + ], + ['sqlite3_result_subtype', undefined, 'sqlite3_value*', 'int'], + [ + 'sqlite3_result_text', + undefined, + 'sqlite3_context*', + 'string', + 'int', + '*', + ], + ['sqlite3_result_zeroblob', undefined, 'sqlite3_context*', 'int'], + [ + 'sqlite3_rollback_hook', + 'void*', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_rollback_hook', + signature: 'v(p)', + contextKey: (argv) => argv[0], + }), + '*', + ], + ], + + [ + 'sqlite3_set_auxdata', + undefined, + [ + 'sqlite3_context*', + 'int', + '*', + true + ? '*' + : new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroyAuxData', + signature: 'v(p)', + contextKey: (argv, argIndex) => argv[0], + }), + ], + ], + ['sqlite3_shutdown', undefined], + ['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 wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_trace_v2::callback', + signature: 'i(ippp)', + contextKey: (argv, argIndex) => argv[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', undefined, '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*'], + ]; + + if (!!wasm.exports.sqlite3_progress_handler) { + wasm.bindingSignatures.push([ + 'sqlite3_progress_handler', + undefined, + [ + 'sqlite3*', + 'int', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xProgressHandler', + signature: 'i(p)', + bindScope: 'context', + contextKey: (argv, argIndex) => argv[0], + }), + '*', + ], + ]); + } + + if (!!wasm.exports.sqlite3_stmt_explain) { + wasm.bindingSignatures.push( + ['sqlite3_stmt_explain', 'int', 'sqlite3_stmt*', 'int'], + ['sqlite3_stmt_isexplain', 'int', 'sqlite3_stmt*'], + ); + } + + if (!!wasm.exports.sqlite3_set_authorizer) { + wasm.bindingSignatures.push([ + 'sqlite3_set_authorizer', + 'int', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_set_authorizer::xAuth', + signature: 'i(pi' + 'ssss)', + contextKey: (argv, argIndex) => argv[0], + callProxy: (callback) => { + return (pV, iCode, s0, s1, s2, s3) => { + try { + s0 = s0 && wasm.cstrToJs(s0); + s1 = s1 && wasm.cstrToJs(s1); + s2 = s2 && wasm.cstrToJs(s2); + s3 = s3 && wasm.cstrToJs(s3); + return callback(pV, iCode, s0, s1, s2, s3) || 0; + } catch (e) { + return e.resultCode || capi.SQLITE_ERROR; + } + }; + }, + }), + '*', + ], + ]); + } + + if (false && wasm.compileOptionUsed('SQLITE_ENABLE_NORMALIZE')) { + wasm.bindingSignatures.push([ + 'sqlite3_normalized_sql', + 'string', + 'sqlite3_stmt*', + ]); + } + + wasm.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', undefined, '*', 'i64'], + ['sqlite3_result_zeroblob64', 'int', '*', 'i64'], + ['sqlite3_serialize', '*', 'sqlite3*', 'string', '*', 'int'], + ['sqlite3_set_last_insert_rowid', undefined, ['sqlite3*', 'i64']], + ['sqlite3_status64', 'int', 'int', '*', '*', 'int'], + ['sqlite3_total_changes64', 'i64', ['sqlite3*']], + [ + 'sqlite3_update_hook', + '*', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_update_hook', + signature: 'v(iippj)', + contextKey: (argv) => argv[0], + callProxy: (callback) => { + return (p, op, z0, z1, rowid) => { + callback( + p, + op, + wasm.cstrToJs(z0), + wasm.cstrToJs(z1), + rowid, + ); + }; + }, + }), + '*', + ], + ], + ['sqlite3_uri_int64', 'i64', ['sqlite3_filename', 'string', 'i64']], + ['sqlite3_value_int64', 'i64', 'sqlite3_value*'], + ]; + + if (wasm.bigIntEnabled && !!wasm.exports.sqlite3_declare_vtab) { + wasm.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', + '**', + ], + ); + } + + if (wasm.bigIntEnabled && !!wasm.exports.sqlite3_preupdate_hook) { + wasm.bindingSignatures.int64.push( + ['sqlite3_preupdate_blobwrite', 'int', 'sqlite3*'], + ['sqlite3_preupdate_count', 'int', 'sqlite3*'], + ['sqlite3_preupdate_depth', 'int', 'sqlite3*'], + [ + 'sqlite3_preupdate_hook', + '*', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_preupdate_hook', + signature: 'v(ppippjj)', + contextKey: (argv) => argv[0], + callProxy: (callback) => { + return (p, db, op, zDb, zTbl, iKey1, iKey2) => { + callback( + p, + db, + op, + wasm.cstrToJs(zDb), + wasm.cstrToJs(zTbl), + iKey1, + iKey2, + ); + }; + }, + }), + '*', + ], + ], + ['sqlite3_preupdate_new', 'int', ['sqlite3*', 'int', '**']], + ['sqlite3_preupdate_old', 'int', ['sqlite3*', 'int', '**']], + ); + } + + if ( + wasm.bigIntEnabled && + !!wasm.exports.sqlite3changegroup_add && + !!wasm.exports.sqlite3session_create && + !!wasm.exports.sqlite3_preupdate_hook + ) { + const __ipsProxy = { + signature: 'i(ps)', + callProxy: (callback) => { + return (p, s) => { + try { + return callback(p, wasm.cstrToJs(s)) | 0; + } catch (e) { + return e.resultCode || capi.SQLITE_ERROR; + } + }; + }, + }; + + wasm.bindingSignatures.int64.push( + ...[ + [ + 'sqlite3changegroup_add', + 'int', + ['sqlite3_changegroup*', 'int', 'void*'], + ], + [ + 'sqlite3changegroup_add_strm', + 'int', + [ + 'sqlite3_changegroup*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changegroup_delete', + undefined, + ['sqlite3_changegroup*'], + ], + ['sqlite3changegroup_new', 'int', ['**']], + [ + 'sqlite3changegroup_output', + 'int', + ['sqlite3_changegroup*', 'int*', '**'], + ], + [ + 'sqlite3changegroup_output_strm', + 'int', + [ + 'sqlite3_changegroup*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xOutput', + signature: 'i(ppi)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changeset_apply', + 'int', + [ + 'sqlite3*', + 'int', + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xConflict', + signature: 'i(pip)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changeset_apply_strm', + 'int', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xConflict', + signature: 'i(pip)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changeset_apply_v2', + 'int', + [ + 'sqlite3*', + 'int', + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xConflict', + signature: 'i(pip)', + bindScope: 'transient', + }), + 'void*', + '**', + 'int*', + 'int', + ], + ], + [ + 'sqlite3changeset_apply_v2_strm', + 'int', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xInputA', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInputB', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + ], + ], + ['sqlite3changeset_start_v2', 'int', ['**', 'int', '*', 'int']], + [ + 'sqlite3changeset_start_v2_strm', + 'int', + [ + '**', + new wasm.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 wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xOutput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3session_table_filter', + undefined, + [ + 'sqlite3_session*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + ...__ipsProxy, + contextKey: (argv, argIndex) => argv[0], + }), + '*', + ], + ], + ], + ); + } + + wasm.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'], + ]; + + sqlite3.StructBinder = globalThis.Jaccwabyt({ + heap: 0 ? wasm.memory : wasm.heap8u, + alloc: wasm.alloc, + dealloc: wasm.dealloc, + bigIntEnabled: wasm.bigIntEnabled, + memberPrefix: '$', + }); + delete globalThis.Jaccwabyt; + + { + const __xString = wasm.xWrap.argAdapter('string'); + wasm.xWrap.argAdapter('string:flexible', (v) => + __xString(util.flexibleString(v)), + ); + + wasm.xWrap.argAdapter( + 'string:static', + function (v) { + if (wasm.isPtr(v)) return v; + v = '' + v; + let rc = this[v]; + return rc || (this[v] = wasm.allocCString(v)); + }.bind(Object.create(null)), + ); + + const __xArgPtr = wasm.xWrap.argAdapter('*'); + const nilType = function () {}; + wasm.xWrap.argAdapter('sqlite3_filename', __xArgPtr)( + 'sqlite3_context*', + __xArgPtr, + )('sqlite3_value*', __xArgPtr)('void*', __xArgPtr)( + 'sqlite3_changegroup*', + __xArgPtr, + )('sqlite3_changeset_iter*', __xArgPtr)( + 'sqlite3_session*', + __xArgPtr, + )('sqlite3_stmt*', (v) => + __xArgPtr( + v instanceof (sqlite3?.oo1?.Stmt || nilType) ? v.pointer : v, + ), + )('sqlite3*', (v) => + __xArgPtr( + v instanceof (sqlite3?.oo1?.DB || nilType) ? v.pointer : v, + ), + )('sqlite3_vfs*', (v) => { + if ('string' === typeof v) { + return ( + capi.sqlite3_vfs_find(v) || + sqlite3.SQLite3Error.toss( + capi.SQLITE_NOTFOUND, + 'Unknown sqlite3_vfs name:', + v, + ) + ); + } + return __xArgPtr( + v instanceof (capi.sqlite3_vfs || nilType) ? v.pointer : v, + ); + }); + if (wasm.exports.sqlite3_declare_vtab) { + wasm.xWrap.argAdapter('sqlite3_index_info*', (v) => + __xArgPtr( + v instanceof (capi.sqlite3_index_info || nilType) + ? v.pointer + : v, + ), + )('sqlite3_module*', (v) => + __xArgPtr( + v instanceof (capi.sqlite3_module || nilType) ? v.pointer : v, + ), + ); + } + + const __xRcPtr = wasm.xWrap.resultAdapter('*'); + wasm.xWrap.resultAdapter('sqlite3*', __xRcPtr)( + 'sqlite3_context*', + __xRcPtr, + )('sqlite3_stmt*', __xRcPtr)('sqlite3_value*', __xRcPtr)( + 'sqlite3_vfs*', + __xRcPtr, + )('void*', __xRcPtr); + + if (0 === wasm.exports.sqlite3_step.length) { + wasm.xWrap.doArgcCheck = false; + sqlite3.config.warn( + 'Disabling sqlite3.wasm.xWrap.doArgcCheck due to environmental quirks.', + ); + } + for (const e of wasm.bindingSignatures) { + capi[e[0]] = wasm.xWrap.apply(null, e); + } + for (const e of wasm.bindingSignatures.wasmInternal) { + util[e[0]] = wasm.xWrap.apply(null, e); + } + + const fI64Disabled = function (fname) { + return () => + toss( + fname + '() is unavailable due to lack', + 'of BigInt support in this build.', + ); + }; + for (const e of wasm.bindingSignatures.int64) { + capi[e[0]] = wasm.bigIntEnabled + ? wasm.xWrap.apply(null, e) + : fI64Disabled(e[0]); + } + + delete wasm.bindingSignatures; + + if (wasm.exports.sqlite3__wasm_db_error) { + const __db_err = wasm.xWrap( + 'sqlite3__wasm_db_error', + 'int', + 'sqlite3*', + 'int', + 'string', + ); + + util.sqlite3__wasm_db_error = function (pDb, resultCode, message) { + if (resultCode instanceof sqlite3.WasmAllocError) { + resultCode = capi.SQLITE_NOMEM; + message = 0; + } else if (resultCode instanceof Error) { + message = message || '' + resultCode; + resultCode = resultCode.resultCode || capi.SQLITE_ERROR; + } + return pDb ? __db_err(pDb, resultCode, message) : resultCode; + }; + } else { + util.sqlite3__wasm_db_error = function (pDb, errCode, msg) { + console.warn( + 'sqlite3__wasm_db_error() is not exported.', + arguments, + ); + return errCode; + }; + } + } + + { + const cJson = wasm.xCall('sqlite3__wasm_enum_json'); + if (!cJson) { + toss( + "Maintenance required: increase sqlite3__wasm_enum_json()'s", + 'static buffer size!', + ); + } + + wasm.ctype = JSON.parse(wasm.cstrToJs(cJson)); + + const defineGroups = [ + 'access', + 'authorizer', + 'blobFinalizers', + 'changeset', + 'config', + 'dataTypes', + 'dbConfig', + 'dbStatus', + 'encodings', + 'fcntl', + 'flock', + 'ioCap', + 'limits', + 'openFlags', + 'prepareFlags', + 'resultCodes', + 'sqlite3Status', + 'stmtStatus', + 'syncFlags', + 'trace', + 'txnState', + 'udfFlags', + 'version', + ]; + if (wasm.bigIntEnabled) { + defineGroups.push('serialize', 'session', 'vtab'); + } + for (const t of defineGroups) { + for (const e of Object.entries(wasm.ctype[t])) { + capi[e[0]] = e[1]; + } + } + if (!wasm.functionEntry(capi.SQLITE_WASM_DEALLOC)) { + toss( + 'Internal error: cannot resolve exported function', + 'entry SQLITE_WASM_DEALLOC (==' + capi.SQLITE_WASM_DEALLOC + ').', + ); + } + const __rcMap = Object.create(null); + for (const t of ['resultCodes']) { + for (const e of Object.entries(wasm.ctype[t])) { + __rcMap[e[1]] = e[0]; + } + } + + capi.sqlite3_js_rc_str = (rc) => __rcMap[rc]; + + const notThese = Object.assign(Object.create(null), { + WasmTestStruct: true, + + sqlite3_kvvfs_methods: !util.isUIThread(), + + sqlite3_index_info: !wasm.bigIntEnabled, + sqlite3_index_constraint: !wasm.bigIntEnabled, + sqlite3_index_orderby: !wasm.bigIntEnabled, + sqlite3_index_constraint_usage: !wasm.bigIntEnabled, + }); + for (const s of wasm.ctype.structs) { + if (!notThese[s.name]) { + capi[s.name] = sqlite3.StructBinder(s); + } + } + if (capi.sqlite3_index_info) { + for (const k of [ + 'sqlite3_index_constraint', + 'sqlite3_index_orderby', + 'sqlite3_index_constraint_usage', + ]) { + capi.sqlite3_index_info[k] = capi[k]; + delete capi[k]; + } + capi.sqlite3_vtab_config = wasm.xWrap( + 'sqlite3__wasm_vtab_config', + 'int', + ['sqlite3*', 'int', 'int'], + ); + } + } + + const __dbArgcMismatch = (pDb, f, n) => { + return util.sqlite3__wasm_db_error( + pDb, + capi.SQLITE_MISUSE, + f + '() requires ' + n + ' argument' + (1 === n ? '' : 's') + '.', + ); + }; + + const __errEncoding = (pDb) => { + return util.sqlite3__wasm_db_error( + pDb, + capi.SQLITE_FORMAT, + 'SQLITE_UTF8 is the only supported encoding.', + ); + }; + + const __argPDb = (pDb) => wasm.xWrap.argAdapter('sqlite3*')(pDb); + const __argStr = (str) => (wasm.isPtr(str) ? wasm.cstrToJs(str) : str); + const __dbCleanupMap = function (pDb, mode) { + pDb = __argPDb(pDb); + let m = this.dbMap.get(pDb); + if (!mode) { + this.dbMap.delete(pDb); + return m; + } else if (!m && mode > 0) { + this.dbMap.set(pDb, (m = Object.create(null))); + } + return m; + }.bind( + Object.assign(Object.create(null), { + dbMap: new Map(), + }), + ); + + __dbCleanupMap.addCollation = function (pDb, name) { + const m = __dbCleanupMap(pDb, 1); + if (!m.collation) m.collation = new Set(); + m.collation.add(__argStr(name).toLowerCase()); + }; + + __dbCleanupMap._addUDF = function (pDb, name, arity, map) { + name = __argStr(name).toLowerCase(); + let u = map.get(name); + if (!u) map.set(name, (u = new Set())); + u.add(arity < 0 ? -1 : arity); + }; + + __dbCleanupMap.addFunction = function (pDb, name, arity) { + const m = __dbCleanupMap(pDb, 1); + if (!m.udf) m.udf = new Map(); + this._addUDF(pDb, name, arity, m.udf); + }; + + if (wasm.exports.sqlite3_create_window_function) { + __dbCleanupMap.addWindowFunc = function (pDb, name, arity) { + const m = __dbCleanupMap(pDb, 1); + if (!m.wudf) m.wudf = new Map(); + this._addUDF(pDb, name, arity, m.wudf); + }; + } + + __dbCleanupMap.cleanup = function (pDb) { + pDb = __argPDb(pDb); + + const closeArgs = [pDb]; + for (const name 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 x = wasm.exports[name]; + if (!x) { + continue; + } + closeArgs.length = x.length; + try { + capi[name](...closeArgs); + } catch (e) { + sqlite3.config.warn( + 'close-time call of', + name + '(', + closeArgs, + ') threw:', + e, + ); + } + } + const m = __dbCleanupMap(pDb, 0); + if (!m) return; + if (m.collation) { + for (const name of m.collation) { + try { + capi.sqlite3_create_collation_v2( + pDb, + name, + capi.SQLITE_UTF8, + 0, + 0, + 0, + ); + } catch (e) {} + } + delete m.collation; + } + let i; + for (i = 0; i < 2; ++i) { + const fmap = i ? m.wudf : m.udf; + if (!fmap) continue; + const func = i + ? capi.sqlite3_create_window_function + : capi.sqlite3_create_function_v2; + for (const e of fmap) { + const name = e[0], + arities = e[1]; + const fargs = [pDb, name, 0, capi.SQLITE_UTF8, 0, 0, 0, 0, 0]; + if (i) fargs.push(0); + for (const arity of arities) { + try { + fargs[2] = arity; + func.apply(null, fargs); + } catch (e) {} + } + arities.clear(); + } + fmap.clear(); + } + delete m.udf; + delete m.wudf; + }; + + { + const __sqlite3CloseV2 = wasm.xWrap( + 'sqlite3_close_v2', + 'int', + 'sqlite3*', + ); + capi.sqlite3_close_v2 = function (pDb) { + if (1 !== arguments.length) + return __dbArgcMismatch(pDb, 'sqlite3_close_v2', 1); + if (pDb) { + try { + __dbCleanupMap.cleanup(pDb); + } catch (e) {} + } + return __sqlite3CloseV2(pDb); + }; + } + + if (capi.sqlite3session_create) { + const __sqlite3SessionDelete = wasm.xWrap( + 'sqlite3session_delete', + undefined, + ['sqlite3_session*'], + ); + capi.sqlite3session_delete = function (pSession) { + if (1 !== arguments.length) { + return __dbArgcMismatch(pDb, 'sqlite3session_delete', 1); + } else if (pSession) { + capi.sqlite3session_table_filter(pSession, 0, 0); + } + __sqlite3SessionDelete(pSession); + }; + } + + { + const contextKey = (argv, argIndex) => { + return ( + 'argv[' + + argIndex + + ']:' + + argv[0] + + ':' + + wasm.cstrToJs(argv[1]).toLowerCase() + ); + }; + const __sqlite3CreateCollationV2 = wasm.xWrap( + 'sqlite3_create_collation_v2', + 'int', + [ + 'sqlite3*', + 'string', + 'int', + '*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xCompare', + signature: 'i(pipip)', + contextKey, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroy', + signature: 'v(p)', + contextKey, + }), + ], + ); + + capi.sqlite3_create_collation_v2 = function ( + pDb, + zName, + eTextRep, + pArg, + xCompare, + xDestroy, + ) { + if (6 !== arguments.length) + return __dbArgcMismatch(pDb, 'sqlite3_create_collation_v2', 6); + else if (0 === (eTextRep & 0xf)) { + eTextRep |= capi.SQLITE_UTF8; + } else if (capi.SQLITE_UTF8 !== (eTextRep & 0xf)) { + return __errEncoding(pDb); + } + try { + const rc = __sqlite3CreateCollationV2( + pDb, + zName, + eTextRep, + pArg, + xCompare, + xDestroy, + ); + if (0 === rc && xCompare instanceof Function) { + __dbCleanupMap.addCollation(pDb, zName); + } + return rc; + } catch (e) { + return util.sqlite3__wasm_db_error(pDb, e); + } + }; + + capi.sqlite3_create_collation = ( + pDb, + zName, + eTextRep, + pArg, + xCompare, + ) => { + return 5 === arguments.length + ? capi.sqlite3_create_collation_v2( + pDb, + zName, + eTextRep, + pArg, + xCompare, + 0, + ) + : __dbArgcMismatch(pDb, 'sqlite3_create_collation', 5); + }; + } + + { + const contextKey = function (argv, argIndex) { + return ( + argv[0] + + ':' + + (argv[2] < 0 ? -1 : argv[2]) + + ':' + + argIndex + + ':' + + wasm.cstrToJs(argv[1]).toLowerCase() + ); + }; + + const __cfProxy = Object.assign(Object.create(null), { + xInverseAndStep: { + signature: 'v(pip)', + contextKey, + callProxy: (callback) => { + return (pCtx, argc, pArgv) => { + try { + callback(pCtx, ...capi.sqlite3_values_to_js(argc, pArgv)); + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + }, + }, + xFinalAndValue: { + signature: 'v(p)', + contextKey, + callProxy: (callback) => { + return (pCtx) => { + try { + capi.sqlite3_result_js(pCtx, callback(pCtx)); + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + }, + }, + xFunc: { + signature: 'v(pip)', + contextKey, + callProxy: (callback) => { + return (pCtx, argc, pArgv) => { + try { + capi.sqlite3_result_js( + pCtx, + callback(pCtx, ...capi.sqlite3_values_to_js(argc, pArgv)), + ); + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + }, + }, + xDestroy: { + signature: 'v(p)', + contextKey, + + callProxy: (callback) => { + return (pVoid) => { + try { + callback(pVoid); + } catch (e) { + console.error('UDF xDestroy method threw:', e); + } + }; + }, + }, + }); + + const __sqlite3CreateFunction = wasm.xWrap( + 'sqlite3_create_function_v2', + 'int', + [ + 'sqlite3*', + 'string', + 'int', + 'int', + '*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFunc', + ...__cfProxy.xFunc, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xStep', + ...__cfProxy.xInverseAndStep, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFinal', + ...__cfProxy.xFinalAndValue, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroy', + ...__cfProxy.xDestroy, + }), + ], + ); + + const __sqlite3CreateWindowFunction = wasm.exports + .sqlite3_create_window_function + ? wasm.xWrap('sqlite3_create_window_function', 'int', [ + 'sqlite3*', + 'string', + 'int', + 'int', + '*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xStep', + ...__cfProxy.xInverseAndStep, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFinal', + ...__cfProxy.xFinalAndValue, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xValue', + ...__cfProxy.xFinalAndValue, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInverse', + ...__cfProxy.xInverseAndStep, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroy', + ...__cfProxy.xDestroy, + }), + ]) + : undefined; + + capi.sqlite3_create_function_v2 = function f( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + pDb, + 'sqlite3_create_function_v2', + f.length, + ); + } else if (0 === (eTextRep & 0xf)) { + eTextRep |= capi.SQLITE_UTF8; + } else if (capi.SQLITE_UTF8 !== (eTextRep & 0xf)) { + return __errEncoding(pDb); + } + try { + const rc = __sqlite3CreateFunction( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + xDestroy, + ); + if ( + 0 === rc && + (xFunc instanceof Function || + xStep instanceof Function || + xFinal instanceof Function || + xDestroy instanceof Function) + ) { + __dbCleanupMap.addFunction(pDb, funcName, nArg); + } + return rc; + } catch (e) { + console.error('sqlite3_create_function_v2() setup threw:', e); + return util.sqlite3__wasm_db_error( + pDb, + e, + 'Creation of UDF threw: ' + e, + ); + } + }; + + capi.sqlite3_create_function = function f( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + ) { + return f.length === arguments.length + ? capi.sqlite3_create_function_v2( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + 0, + ) + : __dbArgcMismatch(pDb, 'sqlite3_create_function', f.length); + }; + + if (__sqlite3CreateWindowFunction) { + capi.sqlite3_create_window_function = function f( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + pDb, + 'sqlite3_create_window_function', + f.length, + ); + } else if (0 === (eTextRep & 0xf)) { + eTextRep |= capi.SQLITE_UTF8; + } else if (capi.SQLITE_UTF8 !== (eTextRep & 0xf)) { + return __errEncoding(pDb); + } + try { + const rc = __sqlite3CreateWindowFunction( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ); + if ( + 0 === rc && + (xStep instanceof Function || + xFinal instanceof Function || + xValue instanceof Function || + xInverse instanceof Function || + xDestroy instanceof Function) + ) { + __dbCleanupMap.addWindowFunc(pDb, funcName, nArg); + } + return rc; + } catch (e) { + console.error( + 'sqlite3_create_window_function() setup threw:', + e, + ); + return util.sqlite3__wasm_db_error( + pDb, + e, + 'Creation of UDF threw: ' + e, + ); + } + }; + } else { + delete capi.sqlite3_create_window_function; + } + + capi.sqlite3_create_function_v2.udfSetResult = + capi.sqlite3_create_function.udfSetResult = capi.sqlite3_result_js; + if (capi.sqlite3_create_window_function) { + capi.sqlite3_create_window_function.udfSetResult = + capi.sqlite3_result_js; + } + + capi.sqlite3_create_function_v2.udfConvertArgs = + capi.sqlite3_create_function.udfConvertArgs = + capi.sqlite3_values_to_js; + if (capi.sqlite3_create_window_function) { + capi.sqlite3_create_window_function.udfConvertArgs = + capi.sqlite3_values_to_js; + } + + capi.sqlite3_create_function_v2.udfSetError = + capi.sqlite3_create_function.udfSetError = + capi.sqlite3_result_error_js; + if (capi.sqlite3_create_window_function) { + capi.sqlite3_create_window_function.udfSetError = + capi.sqlite3_result_error_js; + } + } + + { + const __flexiString = (v, n) => { + if ('string' === typeof v) { + n = -1; + } else if (util.isSQLableTypedArray(v)) { + n = v.byteLength; + v = util.typedArrayToString( + v instanceof ArrayBuffer ? new Uint8Array(v) : v, + ); + } else if (Array.isArray(v)) { + v = v.join(''); + n = -1; + } + return [v, n]; + }; + + const __prepare = { + basic: wasm.xWrap('sqlite3_prepare_v3', 'int', [ + 'sqlite3*', + 'string', + 'int', + 'int', + '**', + '**', + ]), + + full: wasm.xWrap('sqlite3_prepare_v3', 'int', [ + 'sqlite3*', + '*', + 'int', + 'int', + '**', + '**', + ]), + }; + + capi.sqlite3_prepare_v3 = function f( + pDb, + sql, + sqlLen, + prepFlags, + ppStmt, + pzTail, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch(pDb, 'sqlite3_prepare_v3', f.length); + } + const [xSql, xSqlLen] = __flexiString(sql, sqlLen); + switch (typeof xSql) { + case 'string': + return __prepare.basic( + pDb, + xSql, + xSqlLen, + prepFlags, + ppStmt, + null, + ); + case 'number': + return __prepare.full( + pDb, + xSql, + xSqlLen, + prepFlags, + ppStmt, + pzTail, + ); + default: + return util.sqlite3__wasm_db_error( + pDb, + capi.SQLITE_MISUSE, + 'Invalid SQL argument type for sqlite3_prepare_v2/v3().', + ); + } + }; + + capi.sqlite3_prepare_v2 = function f( + pDb, + sql, + sqlLen, + ppStmt, + pzTail, + ) { + return f.length === arguments.length + ? capi.sqlite3_prepare_v3(pDb, sql, sqlLen, 0, ppStmt, pzTail) + : __dbArgcMismatch(pDb, 'sqlite3_prepare_v2', f.length); + }; + } + + { + const __bindText = wasm.xWrap('sqlite3_bind_text', 'int', [ + 'sqlite3_stmt*', + 'int', + 'string', + 'int', + '*', + ]); + const __bindBlob = wasm.xWrap('sqlite3_bind_blob', 'int', [ + 'sqlite3_stmt*', + 'int', + '*', + 'int', + '*', + ]); + + capi.sqlite3_bind_text = function f( + pStmt, + iCol, + text, + nText, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + capi.sqlite3_db_handle(pStmt), + 'sqlite3_bind_text', + f.length, + ); + } else if (wasm.isPtr(text) || null === text) { + return __bindText(pStmt, iCol, text, nText, xDestroy); + } else if (text instanceof ArrayBuffer) { + text = new Uint8Array(text); + } else if (Array.isArray(pMem)) { + text = pMem.join(''); + } + let p, n; + try { + if (util.isSQLableTypedArray(text)) { + p = wasm.allocFromTypedArray(text); + n = text.byteLength; + } else if ('string' === typeof text) { + [p, n] = wasm.allocCString(text); + } else { + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + capi.SQLITE_MISUSE, + 'Invalid 3rd argument type for sqlite3_bind_text().', + ); + } + return __bindText(pStmt, iCol, p, n, capi.SQLITE_WASM_DEALLOC); + } catch (e) { + wasm.dealloc(p); + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + e, + ); + } + }; + + capi.sqlite3_bind_blob = function f( + pStmt, + iCol, + pMem, + nMem, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + capi.sqlite3_db_handle(pStmt), + 'sqlite3_bind_blob', + f.length, + ); + } else if (wasm.isPtr(pMem) || null === pMem) { + return __bindBlob(pStmt, iCol, pMem, nMem, xDestroy); + } else if (pMem instanceof ArrayBuffer) { + pMem = new Uint8Array(pMem); + } else if (Array.isArray(pMem)) { + pMem = pMem.join(''); + } + let p, n; + try { + if (util.isBindableTypedArray(pMem)) { + p = wasm.allocFromTypedArray(pMem); + n = nMem >= 0 ? nMem : pMem.byteLength; + } else if ('string' === typeof pMem) { + [p, n] = wasm.allocCString(pMem); + } else { + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + capi.SQLITE_MISUSE, + 'Invalid 3rd argument type for sqlite3_bind_blob().', + ); + } + return __bindBlob(pStmt, iCol, p, n, capi.SQLITE_WASM_DEALLOC); + } catch (e) { + wasm.dealloc(p); + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + e, + ); + } + }; + } + + { + capi.sqlite3_config = function (op, ...args) { + if (arguments.length < 2) return capi.SQLITE_MISUSE; + switch (op) { + case capi.SQLITE_CONFIG_COVERING_INDEX_SCAN: + case capi.SQLITE_CONFIG_MEMSTATUS: + case capi.SQLITE_CONFIG_SMALL_MALLOC: + case capi.SQLITE_CONFIG_SORTERREF_SIZE: + case capi.SQLITE_CONFIG_STMTJRNL_SPILL: + case capi.SQLITE_CONFIG_URI: + return wasm.exports.sqlite3__wasm_config_i(op, args[0]); + case capi.SQLITE_CONFIG_LOOKASIDE: + return wasm.exports.sqlite3__wasm_config_ii( + op, + args[0], + args[1], + ); + case capi.SQLITE_CONFIG_MEMDB_MAXSIZE: + return wasm.exports.sqlite3__wasm_config_j(op, args[0]); + case capi.SQLITE_CONFIG_GETMALLOC: + case capi.SQLITE_CONFIG_GETMUTEX: + case capi.SQLITE_CONFIG_GETPCACHE2: + case capi.SQLITE_CONFIG_GETPCACHE: + case capi.SQLITE_CONFIG_HEAP: + case capi.SQLITE_CONFIG_LOG: + case capi.SQLITE_CONFIG_MALLOC: + case capi.SQLITE_CONFIG_MMAP_SIZE: + case capi.SQLITE_CONFIG_MULTITHREAD: + case capi.SQLITE_CONFIG_MUTEX: + case capi.SQLITE_CONFIG_PAGECACHE: + case capi.SQLITE_CONFIG_PCACHE2: + case capi.SQLITE_CONFIG_PCACHE: + case capi.SQLITE_CONFIG_PCACHE_HDRSZ: + case capi.SQLITE_CONFIG_PMASZ: + case capi.SQLITE_CONFIG_SERIALIZED: + case capi.SQLITE_CONFIG_SINGLETHREAD: + case capi.SQLITE_CONFIG_SQLLOG: + case capi.SQLITE_CONFIG_WIN32_HEAPSIZE: + default: + return capi.SQLITE_NOTFOUND; + } + }; + } + + { + const __autoExtFptr = new Set(); + + capi.sqlite3_auto_extension = function (fPtr) { + if (fPtr instanceof Function) { + fPtr = wasm.installFunction('i(ppp)', fPtr); + } else if (1 !== arguments.length || !wasm.isPtr(fPtr)) { + return capi.SQLITE_MISUSE; + } + const rc = wasm.exports.sqlite3_auto_extension(fPtr); + if (fPtr !== arguments[0]) { + if (0 === rc) __autoExtFptr.add(fPtr); + else wasm.uninstallFunction(fPtr); + } + return rc; + }; + + capi.sqlite3_cancel_auto_extension = function (fPtr) { + if (!fPtr || 1 !== arguments.length || !wasm.isPtr(fPtr)) return 0; + return wasm.exports.sqlite3_cancel_auto_extension(fPtr); + }; + + capi.sqlite3_reset_auto_extension = function () { + wasm.exports.sqlite3_reset_auto_extension(); + for (const fp of __autoExtFptr) wasm.uninstallFunction(fp); + __autoExtFptr.clear(); + }; + } + + const pKvvfs = capi.sqlite3_vfs_find('kvvfs'); + if (pKvvfs) { + if (util.isUIThread()) { + const kvvfsMethods = new capi.sqlite3_kvvfs_methods( + wasm.exports.sqlite3__wasm_kvvfs_methods(), + ); + delete capi.sqlite3_kvvfs_methods; + + const kvvfsMakeKey = + wasm.exports.sqlite3__wasm_kvvfsMakeKeyOnPstack, + pstack = wasm.pstack; + + const kvvfsStorage = (zClass) => + 115 === wasm.peek(zClass) ? sessionStorage : localStorage; + + const kvvfsImpls = { + xRead: (zClass, zKey, zBuf, nBuf) => { + const stack = pstack.pointer, + astack = wasm.scopedAllocPush(); + try { + const zXKey = kvvfsMakeKey(zClass, zKey); + if (!zXKey) return -3; + const jKey = wasm.cstrToJs(zXKey); + const jV = kvvfsStorage(zClass).getItem(jKey); + if (!jV) return -1; + const nV = jV.length; + if (nBuf <= 0) return nV; + else if (1 === nBuf) { + wasm.poke(zBuf, 0); + return nV; + } + const zV = wasm.scopedAllocCString(jV); + if (nBuf > nV + 1) nBuf = nV + 1; + wasm.heap8u().copyWithin(zBuf, zV, zV + nBuf - 1); + wasm.poke(zBuf + nBuf - 1, 0); + return nBuf - 1; + } catch (e) { + console.error('kvstorageRead()', e); + return -2; + } finally { + pstack.restore(stack); + wasm.scopedAllocPop(astack); + } + }, + xWrite: (zClass, zKey, zData) => { + const stack = pstack.pointer; + try { + const zXKey = kvvfsMakeKey(zClass, zKey); + if (!zXKey) return 1; + const jKey = wasm.cstrToJs(zXKey); + kvvfsStorage(zClass).setItem(jKey, wasm.cstrToJs(zData)); + return 0; + } catch (e) { + console.error('kvstorageWrite()', e); + return capi.SQLITE_IOERR; + } finally { + pstack.restore(stack); + } + }, + xDelete: (zClass, zKey) => { + const stack = pstack.pointer; + try { + const zXKey = kvvfsMakeKey(zClass, zKey); + if (!zXKey) return 1; + kvvfsStorage(zClass).removeItem(wasm.cstrToJs(zXKey)); + return 0; + } catch (e) { + console.error('kvstorageDelete()', e); + return capi.SQLITE_IOERR; + } finally { + pstack.restore(stack); + } + }, + }; + for (const k of Object.keys(kvvfsImpls)) { + kvvfsMethods[kvvfsMethods.memberKey(k)] = wasm.installFunction( + kvvfsMethods.memberSignature(k), + kvvfsImpls[k], + ); + } + } else { + capi.sqlite3_vfs_unregister(pKvvfs); + } + } + + wasm.xWrap.FuncPtrAdapter.warnOnUse = true; + + const StructBinder = sqlite3.StructBinder; + const installMethod = function callee( + tgt, + name, + func, + applyArgcCheck = callee.installMethodArgcCheck, + ) { + if (!(tgt instanceof StructBinder.StructType)) { + toss('Usage error: target object is-not-a StructType.'); + } else if (!(func instanceof Function) && !wasm.isPtr(func)) { + toss('Usage error: expecting a Function or WASM pointer to one.'); + } + if (1 === arguments.length) { + return (n, f) => callee(tgt, n, f, applyArgcCheck); + } + if (!callee.argcProxy) { + callee.argcProxy = function (tgt, funcName, func, sig) { + return function (...args) { + if (func.length !== arguments.length) { + toss( + 'Argument mismatch for', + tgt.structInfo.name + + '::' + + funcName + + ': Native signature is:', + sig, + ); + } + return func.apply(this, args); + }; + }; + + callee.removeFuncList = function () { + if (this.ondispose.__removeFuncList) { + this.ondispose.__removeFuncList.forEach((v, ndx) => { + if ('number' === typeof v) { + try { + wasm.uninstallFunction(v); + } catch (e) {} + } + }); + delete this.ondispose.__removeFuncList; + } + }; + } + const sigN = tgt.memberSignature(name); + if (sigN.length < 2) { + toss( + 'Member', + name, + 'does not have a function pointer signature:', + sigN, + ); + } + const memKey = tgt.memberKey(name); + const fProxy = + applyArgcCheck && !wasm.isPtr(func) + ? callee.argcProxy(tgt, memKey, func, sigN) + : func; + if (wasm.isPtr(fProxy)) { + if (fProxy && !wasm.functionEntry(fProxy)) { + toss('Pointer', fProxy, 'is not a WASM function table entry.'); + } + tgt[memKey] = fProxy; + } else { + const pFunc = wasm.installFunction( + fProxy, + tgt.memberSignature(name, true), + ); + tgt[memKey] = pFunc; + if (!tgt.ondispose || !tgt.ondispose.__removeFuncList) { + tgt.addOnDispose( + 'ondispose.__removeFuncList handler', + callee.removeFuncList, + ); + tgt.ondispose.__removeFuncList = []; + } + tgt.ondispose.__removeFuncList.push(memKey, pFunc); + } + return (n, f) => callee(tgt, n, f, applyArgcCheck); + }; + installMethod.installMethodArgcCheck = false; + + const installMethods = function ( + structInstance, + methods, + applyArgcCheck = installMethod.installMethodArgcCheck, + ) { + const seen = new Map(); + for (const k of Object.keys(methods)) { + const m = methods[k]; + const prior = seen.get(m); + if (prior) { + const mkey = structInstance.memberKey(k); + structInstance[mkey] = + structInstance[structInstance.memberKey(prior)]; + } else { + installMethod(structInstance, k, m, applyArgcCheck); + seen.set(m, k); + } + } + return structInstance; + }; + + StructBinder.StructType.prototype.installMethod = function callee( + name, + func, + applyArgcCheck = installMethod.installMethodArgcCheck, + ) { + return arguments.length < 3 && name && 'object' === typeof name + ? installMethods(this, ...arguments) + : installMethod(this, ...arguments); + }; + + StructBinder.StructType.prototype.installMethods = function ( + methods, + applyArgcCheck = installMethod.installMethodArgcCheck, + ) { + return installMethods(this, methods, applyArgcCheck); + }; + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + sqlite3.version = { + libVersion: '3.50.4', + libVersionNumber: 3050004, + sourceId: + '2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3', + downloadVersion: 3500400, + }; + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + const toss3 = (...args) => { + throw new sqlite3.SQLite3Error(...args); + }; + + const capi = sqlite3.capi, + wasm = sqlite3.wasm, + util = sqlite3.util; + + const __ptrMap = new WeakMap(); + + const __stmtMap = new WeakMap(); + + const getOwnOption = (opts, p, dflt) => { + const d = Object.getOwnPropertyDescriptor(opts, p); + return d ? d.value : dflt; + }; + + const checkSqlite3Rc = function (dbPtr, sqliteResultCode) { + if (sqliteResultCode) { + if (dbPtr instanceof DB) dbPtr = dbPtr.pointer; + toss3( + sqliteResultCode, + 'sqlite3 result code', + sqliteResultCode + ':', + dbPtr + ? capi.sqlite3_errmsg(dbPtr) + : capi.sqlite3_errstr(sqliteResultCode), + ); + } + return arguments[0]; + }; + + const __dbTraceToConsole = wasm.installFunction( + 'i(ippp)', + function (t, c, p, x) { + if (capi.SQLITE_TRACE_STMT === t) { + console.log( + 'SQL TRACE #' + ++this.counter + ' via sqlite3@' + c + ':', + wasm.cstrToJs(x), + ); + } + }.bind({ counter: 0 }), + ); + + const __vfsPostOpenCallback = Object.create(null); + + const dbCtorHelper = function ctor(...args) { + if (!ctor._name2vfs) { + ctor._name2vfs = Object.create(null); + const isWorkerThread = + 'function' === typeof importScripts + ? (n) => + toss3( + 'The VFS for', + n, + 'is only available in the main window thread.', + ) + : false; + ctor._name2vfs[':localStorage:'] = { + vfs: 'kvvfs', + filename: isWorkerThread || (() => 'local'), + }; + ctor._name2vfs[':sessionStorage:'] = { + vfs: 'kvvfs', + filename: isWorkerThread || (() => 'session'), + }; + } + const opt = ctor.normalizeArgs(...args); + let fn = opt.filename, + vfsName = opt.vfs, + flagsStr = opt.flags; + if ( + ('string' !== typeof fn && 'number' !== typeof fn) || + 'string' !== typeof flagsStr || + (vfsName && + 'string' !== typeof vfsName && + 'number' !== typeof vfsName) + ) { + sqlite3.config.error('Invalid DB ctor args', opt, arguments); + toss3('Invalid arguments for DB constructor.'); + } + let fnJs = 'number' === typeof fn ? wasm.cstrToJs(fn) : fn; + const vfsCheck = ctor._name2vfs[fnJs]; + if (vfsCheck) { + vfsName = vfsCheck.vfs; + fn = fnJs = vfsCheck.filename(fnJs); + } + let pDb, + oflags = 0; + if (flagsStr.indexOf('c') >= 0) { + oflags |= capi.SQLITE_OPEN_CREATE | capi.SQLITE_OPEN_READWRITE; + } + if (flagsStr.indexOf('w') >= 0) oflags |= capi.SQLITE_OPEN_READWRITE; + if (0 === oflags) oflags |= capi.SQLITE_OPEN_READONLY; + oflags |= capi.SQLITE_OPEN_EXRESCODE; + const stack = wasm.pstack.pointer; + try { + const pPtr = wasm.pstack.allocPtr(); + let rc = capi.sqlite3_open_v2(fn, pPtr, oflags, vfsName || 0); + pDb = wasm.peekPtr(pPtr); + checkSqlite3Rc(pDb, rc); + capi.sqlite3_extended_result_codes(pDb, 1); + if (flagsStr.indexOf('t') >= 0) { + capi.sqlite3_trace_v2( + pDb, + capi.SQLITE_TRACE_STMT, + __dbTraceToConsole, + pDb, + ); + } + } catch (e) { + if (pDb) capi.sqlite3_close_v2(pDb); + throw e; + } finally { + wasm.pstack.restore(stack); + } + this.filename = fnJs; + __ptrMap.set(this, pDb); + __stmtMap.set(this, Object.create(null)); + try { + const pVfs = + capi.sqlite3_js_db_vfs(pDb) || + toss3('Internal error: cannot get VFS for new db handle.'); + const postInitSql = __vfsPostOpenCallback[pVfs]; + if (postInitSql) { + if (postInitSql instanceof Function) { + postInitSql(this, sqlite3); + } else { + checkSqlite3Rc( + pDb, + capi.sqlite3_exec(pDb, postInitSql, 0, 0, 0), + ); + } + } + } catch (e) { + this.close(); + throw e; + } + }; + + dbCtorHelper.setVfsPostOpenCallback = function (pVfs, callback) { + if (!(callback instanceof Function)) { + toss3( + 'dbCtorHelper.setVfsPostOpenCallback() should not be used with ' + + 'a non-function argument.', + arguments, + ); + } + __vfsPostOpenCallback[pVfs] = callback; + }; + + dbCtorHelper.normalizeArgs = function ( + filename = ':memory:', + flags = 'c', + vfs = null, + ) { + const arg = {}; + if ( + 1 === arguments.length && + arguments[0] && + 'object' === typeof arguments[0] + ) { + Object.assign(arg, arguments[0]); + if (undefined === arg.flags) arg.flags = 'c'; + if (undefined === arg.vfs) arg.vfs = null; + if (undefined === arg.filename) arg.filename = ':memory:'; + } else { + arg.filename = filename; + arg.flags = flags; + arg.vfs = vfs; + } + return arg; + }; + + const DB = function (...args) { + dbCtorHelper.apply(this, args); + }; + DB.dbCtorHelper = dbCtorHelper; + + const BindTypes = { + null: 1, + number: 2, + string: 3, + boolean: 4, + blob: 5, + }; + BindTypes['undefined'] == BindTypes.null; + if (wasm.bigIntEnabled) { + BindTypes.bigint = BindTypes.number; + } + + const Stmt = function () { + if (BindTypes !== arguments[2]) { + toss3( + capi.SQLITE_MISUSE, + 'Do not call the Stmt constructor directly. Use DB.prepare().', + ); + } + this.db = arguments[0]; + __ptrMap.set(this, arguments[1]); + this.parameterCount = capi.sqlite3_bind_parameter_count(this.pointer); + }; + + const affirmDbOpen = function (db) { + if (!db.pointer) toss3('DB has been closed.'); + return db; + }; + + const affirmColIndex = function (stmt, ndx) { + if (ndx !== (ndx | 0) || ndx < 0 || ndx >= stmt.columnCount) { + toss3('Column index', ndx, 'is out of range.'); + } + return stmt; + }; + + const parseExecArgs = function (db, args) { + const out = Object.create(null); + out.opt = Object.create(null); + switch (args.length) { + case 1: + if ( + 'string' === typeof args[0] || + util.isSQLableTypedArray(args[0]) + ) { + out.sql = args[0]; + } else if (Array.isArray(args[0])) { + out.sql = args[0]; + } else if (args[0] && 'object' === typeof args[0]) { + out.opt = args[0]; + out.sql = out.opt.sql; + } + break; + case 2: + out.sql = args[0]; + out.opt = args[1]; + break; + default: + toss3('Invalid argument count for exec().'); + } + out.sql = util.flexibleString(out.sql); + if ('string' !== typeof out.sql) { + toss3('Missing SQL argument or unsupported SQL value type.'); + } + const opt = out.opt; + switch (opt.returnValue) { + case 'resultRows': + if (!opt.resultRows) opt.resultRows = []; + out.returnVal = () => opt.resultRows; + break; + case 'saveSql': + if (!opt.saveSql) opt.saveSql = []; + out.returnVal = () => opt.saveSql; + break; + case undefined: + case 'this': + out.returnVal = () => db; + break; + default: + toss3('Invalid returnValue value:', opt.returnValue); + } + if (!opt.callback && !opt.returnValue && undefined !== opt.rowMode) { + if (!opt.resultRows) opt.resultRows = []; + out.returnVal = () => opt.resultRows; + } + if (opt.callback || opt.resultRows) { + switch (undefined === opt.rowMode ? 'array' : opt.rowMode) { + case 'object': + out.cbArg = (stmt, cache) => { + if (!cache.columnNames) + cache.columnNames = stmt.getColumnNames([]); + + const row = stmt.get([]); + const rv = Object.create(null); + for (const i in cache.columnNames) + rv[cache.columnNames[i]] = row[i]; + return rv; + }; + break; + case 'array': + out.cbArg = (stmt) => stmt.get([]); + break; + case 'stmt': + if (Array.isArray(opt.resultRows)) { + toss3( + 'exec(): invalid rowMode for a resultRows array: must', + "be one of 'array', 'object',", + 'a result column number, or column name reference.', + ); + } + out.cbArg = (stmt) => stmt; + break; + default: + if (util.isInt32(opt.rowMode)) { + out.cbArg = (stmt) => stmt.get(opt.rowMode); + break; + } else if ( + 'string' === typeof opt.rowMode && + opt.rowMode.length > 1 && + '$' === opt.rowMode[0] + ) { + const $colName = opt.rowMode.substr(1); + out.cbArg = (stmt) => { + const rc = stmt.get(Object.create(null))[$colName]; + return undefined === rc + ? toss3( + capi.SQLITE_NOTFOUND, + 'exec(): unknown result column:', + $colName, + ) + : rc; + }; + break; + } + toss3('Invalid rowMode:', opt.rowMode); + } + } + return out; + }; + + const __selectFirstRow = (db, sql, bind, ...getArgs) => { + const stmt = db.prepare(sql); + try { + const rc = stmt.bind(bind).step() + ? stmt.get(...getArgs) + : undefined; + stmt.reset(); + return rc; + } finally { + stmt.finalize(); + } + }; + + const __selectAll = (db, sql, bind, rowMode) => + db.exec({ + sql, + bind, + rowMode, + returnValue: 'resultRows', + }); + + DB.checkRc = (db, resultCode) => checkSqlite3Rc(db, resultCode); + + DB.prototype = { + isOpen: function () { + return !!this.pointer; + }, + + affirmOpen: function () { + return affirmDbOpen(this); + }, + + close: function () { + if (this.pointer) { + if (this.onclose && this.onclose.before instanceof Function) { + try { + this.onclose.before(this); + } catch (e) {} + } + const pDb = this.pointer; + Object.keys(__stmtMap.get(this)).forEach((k, s) => { + if (s && s.pointer) { + try { + s.finalize(); + } catch (e) {} + } + }); + __ptrMap.delete(this); + __stmtMap.delete(this); + capi.sqlite3_close_v2(pDb); + if (this.onclose && this.onclose.after instanceof Function) { + try { + this.onclose.after(this); + } catch (e) {} + } + delete this.filename; + } + }, + + changes: function (total = false, sixtyFour = false) { + const p = affirmDbOpen(this).pointer; + if (total) { + return sixtyFour + ? capi.sqlite3_total_changes64(p) + : capi.sqlite3_total_changes(p); + } else { + return sixtyFour + ? capi.sqlite3_changes64(p) + : capi.sqlite3_changes(p); + } + }, + + dbFilename: function (dbName = 'main') { + return capi.sqlite3_db_filename(affirmDbOpen(this).pointer, dbName); + }, + + dbName: function (dbNumber = 0) { + return capi.sqlite3_db_name(affirmDbOpen(this).pointer, dbNumber); + }, + + dbVfsName: function (dbName = 0) { + let rc; + const pVfs = capi.sqlite3_js_db_vfs( + affirmDbOpen(this).pointer, + dbName, + ); + if (pVfs) { + const v = new capi.sqlite3_vfs(pVfs); + try { + rc = wasm.cstrToJs(v.$zName); + } finally { + v.dispose(); + } + } + return rc; + }, + + prepare: function (sql) { + affirmDbOpen(this); + const stack = wasm.pstack.pointer; + let ppStmt, pStmt; + try { + ppStmt = wasm.pstack.alloc(8); + DB.checkRc( + this, + capi.sqlite3_prepare_v2(this.pointer, sql, -1, ppStmt, null), + ); + pStmt = wasm.peekPtr(ppStmt); + } finally { + wasm.pstack.restore(stack); + } + if (!pStmt) toss3('Cannot prepare empty SQL.'); + const stmt = new Stmt(this, pStmt, BindTypes); + __stmtMap.get(this)[pStmt] = stmt; + return stmt; + }, + + exec: function () { + affirmDbOpen(this); + const arg = parseExecArgs(this, arguments); + if (!arg.sql) { + return toss3('exec() requires an SQL string.'); + } + const opt = arg.opt; + const callback = opt.callback; + const resultRows = Array.isArray(opt.resultRows) + ? opt.resultRows + : undefined; + let stmt; + let bind = opt.bind; + let evalFirstResult = !!( + arg.cbArg || + opt.columnNames || + resultRows + ); + const stack = wasm.scopedAllocPush(); + const saveSql = Array.isArray(opt.saveSql) + ? opt.saveSql + : undefined; + try { + const isTA = util.isSQLableTypedArray(arg.sql); + let sqlByteLen = isTA + ? arg.sql.byteLength + : wasm.jstrlen(arg.sql); + const ppStmt = wasm.scopedAlloc( + 2 * wasm.ptrSizeof + (sqlByteLen + 1), + ); + const pzTail = ppStmt + wasm.ptrSizeof; + let pSql = pzTail + wasm.ptrSizeof; + const pSqlEnd = pSql + sqlByteLen; + if (isTA) wasm.heap8().set(arg.sql, pSql); + else wasm.jstrcpy(arg.sql, wasm.heap8(), pSql, sqlByteLen, false); + wasm.poke(pSql + sqlByteLen, 0); + while (pSql && wasm.peek(pSql, 'i8')) { + wasm.pokePtr([ppStmt, pzTail], 0); + DB.checkRc( + this, + capi.sqlite3_prepare_v3( + this.pointer, + pSql, + sqlByteLen, + 0, + ppStmt, + pzTail, + ), + ); + const pStmt = wasm.peekPtr(ppStmt); + pSql = wasm.peekPtr(pzTail); + sqlByteLen = pSqlEnd - pSql; + if (!pStmt) continue; + if (saveSql) saveSql.push(capi.sqlite3_sql(pStmt).trim()); + stmt = new Stmt(this, pStmt, BindTypes); + if (bind && stmt.parameterCount) { + stmt.bind(bind); + bind = null; + } + if (evalFirstResult && stmt.columnCount) { + let gotColNames = Array.isArray(opt.columnNames) ? 0 : 1; + evalFirstResult = false; + if (arg.cbArg || resultRows) { + const cbArgCache = Object.create(null); + for (; stmt.step(); stmt._lockedByExec = false) { + if (0 === gotColNames++) { + stmt.getColumnNames( + (cbArgCache.columnNames = opt.columnNames || []), + ); + } + stmt._lockedByExec = true; + const row = arg.cbArg(stmt, cbArgCache); + if (resultRows) resultRows.push(row); + if (callback && false === callback.call(opt, row, stmt)) { + break; + } + } + stmt._lockedByExec = false; + } + if (0 === gotColNames) { + stmt.getColumnNames(opt.columnNames); + } + } else { + stmt.step(); + } + stmt.reset().finalize(); + stmt = null; + } + } finally { + wasm.scopedAllocPop(stack); + if (stmt) { + delete stmt._lockedByExec; + stmt.finalize(); + } + } + return arg.returnVal(); + }, + + createFunction: function f(name, xFunc, opt) { + const isFunc = (f) => f instanceof Function; + switch (arguments.length) { + case 1: + opt = name; + name = opt.name; + xFunc = opt.xFunc || 0; + break; + case 2: + if (!isFunc(xFunc)) { + opt = xFunc; + xFunc = opt.xFunc || 0; + } + break; + case 3: + break; + default: + break; + } + if (!opt) opt = {}; + if ('string' !== typeof name) { + toss3('Invalid arguments: missing function name.'); + } + let xStep = opt.xStep || 0; + let xFinal = opt.xFinal || 0; + const xValue = opt.xValue || 0; + const xInverse = opt.xInverse || 0; + let isWindow = undefined; + if (isFunc(xFunc)) { + isWindow = false; + if (isFunc(xStep) || isFunc(xFinal)) { + toss3('Ambiguous arguments: scalar or aggregate?'); + } + xStep = xFinal = null; + } else if (isFunc(xStep)) { + if (!isFunc(xFinal)) { + toss3('Missing xFinal() callback for aggregate or window UDF.'); + } + xFunc = null; + } else if (isFunc(xFinal)) { + toss3('Missing xStep() callback for aggregate or window UDF.'); + } else { + toss3('Missing function-type properties.'); + } + if (false === isWindow) { + if (isFunc(xValue) || isFunc(xInverse)) { + toss3( + 'xValue and xInverse are not permitted for non-window UDFs.', + ); + } + } else if (isFunc(xValue)) { + if (!isFunc(xInverse)) { + toss3('xInverse must be provided if xValue is.'); + } + isWindow = true; + } else if (isFunc(xInverse)) { + toss3('xValue must be provided if xInverse is.'); + } + const pApp = opt.pApp; + if ( + undefined !== pApp && + null !== pApp && + ('number' !== typeof pApp || !util.isInt32(pApp)) + ) { + toss3( + 'Invalid value for pApp property. Must be a legal WASM pointer value.', + ); + } + const xDestroy = opt.xDestroy || 0; + if (xDestroy && !isFunc(xDestroy)) { + toss3('xDestroy property must be a function.'); + } + let fFlags = 0; + if (getOwnOption(opt, 'deterministic')) + fFlags |= capi.SQLITE_DETERMINISTIC; + if (getOwnOption(opt, 'directOnly')) + fFlags |= capi.SQLITE_DIRECTONLY; + if (getOwnOption(opt, 'innocuous')) fFlags |= capi.SQLITE_INNOCUOUS; + name = name.toLowerCase(); + const xArity = xFunc || xStep; + const arity = getOwnOption(opt, 'arity'); + const arityArg = + 'number' === typeof arity + ? arity + : xArity.length + ? xArity.length - 1 + : 0; + let rc; + if (isWindow) { + rc = capi.sqlite3_create_window_function( + this.pointer, + name, + arityArg, + capi.SQLITE_UTF8 | fFlags, + pApp || 0, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ); + } else { + rc = capi.sqlite3_create_function_v2( + this.pointer, + name, + arityArg, + capi.SQLITE_UTF8 | fFlags, + pApp || 0, + xFunc, + xStep, + xFinal, + xDestroy, + ); + } + DB.checkRc(this, rc); + return this; + }, + + selectValue: function (sql, bind, asType) { + return __selectFirstRow(this, sql, bind, 0, asType); + }, + + selectValues: function (sql, bind, asType) { + const stmt = this.prepare(sql), + rc = []; + try { + stmt.bind(bind); + while (stmt.step()) rc.push(stmt.get(0, asType)); + stmt.reset(); + } finally { + stmt.finalize(); + } + return rc; + }, + + selectArray: function (sql, bind) { + return __selectFirstRow(this, sql, bind, []); + }, + + selectObject: function (sql, bind) { + return __selectFirstRow(this, sql, bind, {}); + }, + + selectArrays: function (sql, bind) { + return __selectAll(this, sql, bind, 'array'); + }, + + selectObjects: function (sql, bind) { + return __selectAll(this, sql, bind, 'object'); + }, + + openStatementCount: function () { + return this.pointer ? Object.keys(__stmtMap.get(this)).length : 0; + }, + + transaction: function (callback) { + let opener = 'BEGIN'; + if (arguments.length > 1) { + if (/[^a-zA-Z]/.test(arguments[0])) { + toss3( + capi.SQLITE_MISUSE, + 'Invalid argument for BEGIN qualifier.', + ); + } + opener += ' ' + arguments[0]; + callback = arguments[1]; + } + affirmDbOpen(this).exec(opener); + try { + const rc = callback(this); + this.exec('COMMIT'); + return rc; + } catch (e) { + this.exec('ROLLBACK'); + throw e; + } + }, + + savepoint: function (callback) { + affirmDbOpen(this).exec('SAVEPOINT oo1'); + try { + const rc = callback(this); + this.exec('RELEASE oo1'); + return rc; + } catch (e) { + this.exec('ROLLBACK to SAVEPOINT oo1; RELEASE SAVEPOINT oo1'); + throw e; + } + }, + + checkRc: function (resultCode) { + return checkSqlite3Rc(this, resultCode); + }, + }; + + const affirmStmtOpen = function (stmt) { + if (!stmt.pointer) toss3('Stmt has been closed.'); + return stmt; + }; + + const isSupportedBindType = function (v) { + let t = BindTypes[null === v || undefined === v ? 'null' : typeof v]; + switch (t) { + case BindTypes.boolean: + case BindTypes.null: + case BindTypes.number: + case BindTypes.string: + return t; + case BindTypes.bigint: + if (wasm.bigIntEnabled) return t; + + default: + return util.isBindableTypedArray(v) ? BindTypes.blob : undefined; + } + }; + + const affirmSupportedBindType = function (v) { + return ( + isSupportedBindType(v) || + toss3('Unsupported bind() argument type:', typeof v) + ); + }; + + const affirmParamIndex = function (stmt, key) { + const n = + 'number' === typeof key + ? key + : capi.sqlite3_bind_parameter_index(stmt.pointer, key); + if (0 === n || !util.isInt32(n)) { + toss3('Invalid bind() parameter name: ' + key); + } else if (n < 1 || n > stmt.parameterCount) + toss3('Bind index', key, 'is out of range.'); + return n; + }; + + const affirmNotLockedByExec = function (stmt, currentOpName) { + if (stmt._lockedByExec) { + toss3( + 'Operation is illegal when statement is locked:', + currentOpName, + ); + } + return stmt; + }; + + const bindOne = function f(stmt, ndx, bindType, val) { + affirmNotLockedByExec(affirmStmtOpen(stmt), 'bind()'); + if (!f._) { + f._tooBigInt = (v) => + toss3( + 'BigInt value is too big to store without precision loss:', + v, + ); + f._ = { + string: function (stmt, ndx, val, asBlob) { + const [pStr, n] = wasm.allocCString(val, true); + const f = asBlob + ? capi.sqlite3_bind_blob + : capi.sqlite3_bind_text; + return f(stmt.pointer, ndx, pStr, n, capi.SQLITE_WASM_DEALLOC); + }, + }; + } + affirmSupportedBindType(val); + ndx = affirmParamIndex(stmt, ndx); + let rc = 0; + switch ( + null === val || undefined === val ? BindTypes.null : bindType + ) { + case BindTypes.null: + rc = capi.sqlite3_bind_null(stmt.pointer, ndx); + break; + case BindTypes.string: + rc = f._.string(stmt, ndx, val, false); + break; + case BindTypes.number: { + let m; + if (util.isInt32(val)) m = capi.sqlite3_bind_int; + else if ('bigint' === typeof val) { + if (!util.bigIntFits64(val)) { + f._tooBigInt(val); + } else if (wasm.bigIntEnabled) { + m = capi.sqlite3_bind_int64; + } else if (util.bigIntFitsDouble(val)) { + val = Number(val); + m = capi.sqlite3_bind_double; + } else { + f._tooBigInt(val); + } + } else { + val = Number(val); + if (wasm.bigIntEnabled && Number.isInteger(val)) { + m = capi.sqlite3_bind_int64; + } else { + m = capi.sqlite3_bind_double; + } + } + rc = m(stmt.pointer, ndx, val); + break; + } + case BindTypes.boolean: + rc = capi.sqlite3_bind_int(stmt.pointer, ndx, val ? 1 : 0); + break; + case BindTypes.blob: { + if ('string' === typeof val) { + rc = f._.string(stmt, ndx, val, true); + break; + } else if (val instanceof ArrayBuffer) { + val = new Uint8Array(val); + } else if (!util.isBindableTypedArray(val)) { + toss3( + 'Binding a value as a blob requires', + 'that it be a string, Uint8Array, Int8Array, or ArrayBuffer.', + ); + } + const pBlob = wasm.alloc(val.byteLength || 1); + wasm.heap8().set(val.byteLength ? val : [0], pBlob); + rc = capi.sqlite3_bind_blob( + stmt.pointer, + ndx, + pBlob, + val.byteLength, + capi.SQLITE_WASM_DEALLOC, + ); + break; + } + default: + sqlite3.config.warn('Unsupported bind() argument type:', val); + toss3('Unsupported bind() argument type: ' + typeof val); + } + if (rc) DB.checkRc(stmt.db.pointer, rc); + stmt._mayGet = false; + return stmt; + }; + + Stmt.prototype = { + finalize: function () { + if (this.pointer) { + affirmNotLockedByExec(this, 'finalize()'); + const rc = capi.sqlite3_finalize(this.pointer); + delete __stmtMap.get(this.db)[this.pointer]; + __ptrMap.delete(this); + delete this._mayGet; + delete this.parameterCount; + delete this._lockedByExec; + delete this.db; + return rc; + } + }, + + clearBindings: function () { + affirmNotLockedByExec(affirmStmtOpen(this), 'clearBindings()'); + capi.sqlite3_clear_bindings(this.pointer); + this._mayGet = false; + return this; + }, + + reset: function (alsoClearBinds) { + affirmNotLockedByExec(this, 'reset()'); + if (alsoClearBinds) this.clearBindings(); + const rc = capi.sqlite3_reset(affirmStmtOpen(this).pointer); + this._mayGet = false; + checkSqlite3Rc(this.db, rc); + return this; + }, + + bind: function () { + affirmStmtOpen(this); + let ndx, arg; + switch (arguments.length) { + case 1: + ndx = 1; + arg = arguments[0]; + break; + case 2: + ndx = arguments[0]; + arg = arguments[1]; + break; + default: + toss3('Invalid bind() arguments.'); + } + if (undefined === arg) { + return this; + } else if (!this.parameterCount) { + toss3('This statement has no bindable parameters.'); + } + this._mayGet = false; + if (null === arg) { + return bindOne(this, ndx, BindTypes.null, arg); + } else if (Array.isArray(arg)) { + if (1 !== arguments.length) { + toss3( + 'When binding an array, an index argument is not permitted.', + ); + } + arg.forEach((v, i) => + bindOne(this, i + 1, affirmSupportedBindType(v), v), + ); + return this; + } else if (arg instanceof ArrayBuffer) { + arg = new Uint8Array(arg); + } + if ('object' === typeof arg && !util.isBindableTypedArray(arg)) { + if (1 !== arguments.length) { + toss3( + 'When binding an object, an index argument is not permitted.', + ); + } + Object.keys(arg).forEach((k) => + bindOne(this, k, affirmSupportedBindType(arg[k]), arg[k]), + ); + return this; + } else { + return bindOne(this, ndx, affirmSupportedBindType(arg), arg); + } + toss3('Should not reach this point.'); + }, + + bindAsBlob: function (ndx, arg) { + affirmStmtOpen(this); + if (1 === arguments.length) { + arg = ndx; + ndx = 1; + } + const t = affirmSupportedBindType(arg); + if ( + BindTypes.string !== t && + BindTypes.blob !== t && + BindTypes.null !== t + ) { + toss3('Invalid value type for bindAsBlob()'); + } + return bindOne(this, ndx, BindTypes.blob, arg); + }, + + step: function () { + affirmNotLockedByExec(this, 'step()'); + const rc = capi.sqlite3_step(affirmStmtOpen(this).pointer); + switch (rc) { + case capi.SQLITE_DONE: + return (this._mayGet = false); + case capi.SQLITE_ROW: + return (this._mayGet = true); + default: + this._mayGet = false; + sqlite3.config.warn( + 'sqlite3_step() rc=', + rc, + capi.sqlite3_js_rc_str(rc), + 'SQL =', + capi.sqlite3_sql(this.pointer), + ); + DB.checkRc(this.db.pointer, rc); + } + }, + + stepReset: function () { + this.step(); + return this.reset(); + }, + + stepFinalize: function () { + try { + const rc = this.step(); + this.reset(); + return rc; + } finally { + try { + this.finalize(); + } catch (e) {} + } + }, + + get: function (ndx, asType) { + if (!affirmStmtOpen(this)._mayGet) { + toss3('Stmt.step() has not (recently) returned true.'); + } + if (Array.isArray(ndx)) { + let i = 0; + const n = this.columnCount; + while (i < n) { + ndx[i] = this.get(i++); + } + return ndx; + } else if (ndx && 'object' === typeof ndx) { + let i = 0; + const n = this.columnCount; + while (i < n) { + ndx[capi.sqlite3_column_name(this.pointer, i)] = this.get(i++); + } + return ndx; + } + affirmColIndex(this, ndx); + switch ( + undefined === asType + ? capi.sqlite3_column_type(this.pointer, ndx) + : asType + ) { + case capi.SQLITE_NULL: + return null; + case capi.SQLITE_INTEGER: { + if (wasm.bigIntEnabled) { + const rc = capi.sqlite3_column_int64(this.pointer, ndx); + if ( + rc >= Number.MIN_SAFE_INTEGER && + rc <= Number.MAX_SAFE_INTEGER + ) { + return Number(rc).valueOf(); + } + return rc; + } else { + const rc = capi.sqlite3_column_double(this.pointer, ndx); + if ( + rc > Number.MAX_SAFE_INTEGER || + rc < Number.MIN_SAFE_INTEGER + ) { + toss3( + 'Integer is out of range for JS integer range: ' + rc, + ); + } + + return util.isInt32(rc) ? rc | 0 : rc; + } + } + case capi.SQLITE_FLOAT: + return capi.sqlite3_column_double(this.pointer, ndx); + case capi.SQLITE_TEXT: + return capi.sqlite3_column_text(this.pointer, ndx); + case capi.SQLITE_BLOB: { + const n = capi.sqlite3_column_bytes(this.pointer, ndx), + ptr = capi.sqlite3_column_blob(this.pointer, ndx), + rc = new Uint8Array(n); + + if (n) rc.set(wasm.heap8u().slice(ptr, ptr + n), 0); + + if (n && this.db._blobXfer instanceof Array) { + this.db._blobXfer.push(rc.buffer); + } + return rc; + } + default: + toss3( + "Don't know how to translate", + 'type of result column #' + ndx + '.', + ); + } + toss3('Not reached.'); + }, + + getInt: function (ndx) { + return this.get(ndx, capi.SQLITE_INTEGER); + }, + + getFloat: function (ndx) { + return this.get(ndx, capi.SQLITE_FLOAT); + }, + + getString: function (ndx) { + return this.get(ndx, capi.SQLITE_TEXT); + }, + + getBlob: function (ndx) { + return this.get(ndx, capi.SQLITE_BLOB); + }, + + getJSON: function (ndx) { + const s = this.get(ndx, capi.SQLITE_STRING); + return null === s ? s : JSON.parse(s); + }, + + getColumnName: function (ndx) { + return capi.sqlite3_column_name( + affirmColIndex(affirmStmtOpen(this), ndx).pointer, + ndx, + ); + }, + + getColumnNames: function (tgt = []) { + affirmColIndex(affirmStmtOpen(this), 0); + const n = this.columnCount; + for (let i = 0; i < n; ++i) { + tgt.push(capi.sqlite3_column_name(this.pointer, i)); + } + return tgt; + }, + + getParamIndex: function (name) { + return affirmStmtOpen(this).parameterCount + ? capi.sqlite3_bind_parameter_index(this.pointer, name) + : undefined; + }, + + getParamName: function (ndx) { + return affirmStmtOpen(this).parameterCount + ? capi.sqlite3_bind_parameter_name(this.pointer, ndx) + : undefined; + }, + + isBusy: function () { + return 0 !== capi.sqlite3_stmt_busy(affirmStmtOpen(this)); + }, + + isReadOnly: function () { + return 0 !== capi.sqlite3_stmt_readonly(affirmStmtOpen(this)); + }, + }; + + { + const prop = { + enumerable: true, + get: function () { + return __ptrMap.get(this); + }, + set: () => toss3('The pointer property is read-only.'), + }; + Object.defineProperty(Stmt.prototype, 'pointer', prop); + Object.defineProperty(DB.prototype, 'pointer', prop); + } + + Object.defineProperty(Stmt.prototype, 'columnCount', { + enumerable: false, + get: function () { + return capi.sqlite3_column_count(this.pointer); + }, + set: () => toss3('The columnCount property is read-only.'), + }); + + sqlite3.oo1 = { + DB, + Stmt, + }; + + if (util.isUIThread()) { + sqlite3.oo1.JsStorageDb = function (storageName = 'session') { + const opt = dbCtorHelper.normalizeArgs(...arguments); + storageName = opt.filename; + if ('session' !== storageName && 'local' !== storageName) { + toss3("JsStorageDb db name must be one of 'session' or 'local'."); + } + opt.vfs = 'kvvfs'; + dbCtorHelper.call(this, opt); + }; + const jdb = sqlite3.oo1.JsStorageDb; + jdb.prototype = Object.create(DB.prototype); + + jdb.clearStorage = capi.sqlite3_js_kvvfs_clear; + + jdb.prototype.clearStorage = function () { + return jdb.clearStorage(affirmDbOpen(this).filename); + }; + + jdb.storageSize = capi.sqlite3_js_kvvfs_size; + + jdb.prototype.storageSize = function () { + return jdb.storageSize(affirmDbOpen(this).filename); + }; + } + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const util = sqlite3.util; + sqlite3.initWorker1API = function () { + 'use strict'; + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + if (!(globalThis.WorkerGlobalScope instanceof Function)) { + toss('initWorker1API() must be run from a Worker thread.'); + } + const sqlite3 = this.sqlite3 || toss('Missing this.sqlite3 object.'); + const DB = sqlite3.oo1.DB; + + const getDbId = function (db) { + let id = wState.idMap.get(db); + if (id) return id; + id = 'db#' + ++wState.idSeq + '@' + db.pointer; + + wState.idMap.set(db, id); + return id; + }; + + const wState = { + dbList: [], + + idSeq: 0, + + idMap: new WeakMap(), + + xfer: [], + open: function (opt) { + const db = new DB(opt); + this.dbs[getDbId(db)] = db; + if (this.dbList.indexOf(db) < 0) this.dbList.push(db); + return db; + }, + close: function (db, alsoUnlink) { + if (db) { + delete this.dbs[getDbId(db)]; + const filename = db.filename; + const pVfs = util.sqlite3__wasm_db_vfs(db.pointer, 0); + db.close(); + const ddNdx = this.dbList.indexOf(db); + if (ddNdx >= 0) this.dbList.splice(ddNdx, 1); + if (alsoUnlink && filename && pVfs) { + util.sqlite3__wasm_vfs_unlink(pVfs, filename); + } + } + }, + + post: function (msg, xferList) { + if (xferList && xferList.length) { + globalThis.postMessage(msg, Array.from(xferList)); + xferList.length = 0; + } else { + globalThis.postMessage(msg); + } + }, + + dbs: Object.create(null), + + getDb: function (id, require = true) { + return ( + this.dbs[id] || + (require ? toss('Unknown (or closed) DB ID:', id) : undefined) + ); + }, + }; + + const affirmDbOpen = function (db = wState.dbList[0]) { + return db && db.pointer ? db : toss('DB is not opened.'); + }; + + const getMsgDb = function (msgData, affirmExists = true) { + const db = wState.getDb(msgData.dbId, false) || wState.dbList[0]; + return affirmExists ? affirmDbOpen(db) : db; + }; + + const getDefaultDbId = function () { + return wState.dbList[0] && getDbId(wState.dbList[0]); + }; + + const isSpecialDbFilename = (n) => { + return '' === n || ':' === n[0]; + }; + + const wMsgHandler = { + open: function (ev) { + const oargs = Object.create(null), + args = ev.args || Object.create(null); + if (args.simulateError) { + toss('Throwing because of simulateError flag.'); + } + const rc = Object.create(null); + oargs.vfs = args.vfs; + oargs.filename = args.filename || ''; + const db = wState.open(oargs); + rc.filename = db.filename; + rc.persistent = !!sqlite3.capi.sqlite3_js_db_uses_vfs( + db.pointer, + 'opfs', + ); + rc.dbId = getDbId(db); + rc.vfs = db.dbVfsName(); + return rc; + }, + + close: function (ev) { + const db = getMsgDb(ev, false); + const response = { + filename: db && db.filename, + }; + if (db) { + const doUnlink = + ev.args && 'object' === typeof ev.args + ? !!ev.args.unlink + : false; + wState.close(db, doUnlink); + } + return response; + }, + + exec: function (ev) { + const rc = + 'string' === typeof ev.args + ? { sql: ev.args } + : ev.args || Object.create(null); + if ('stmt' === rc.rowMode) { + toss( + "Invalid rowMode for 'exec': stmt mode", + 'does not work in the Worker API.', + ); + } else if (!rc.sql) { + toss("'exec' requires input SQL."); + } + const db = getMsgDb(ev); + if (rc.callback || Array.isArray(rc.resultRows)) { + db._blobXfer = wState.xfer; + } + const theCallback = rc.callback; + let rowNumber = 0; + const hadColNames = !!rc.columnNames; + if ('string' === typeof theCallback) { + if (!hadColNames) rc.columnNames = []; + + rc.callback = function (row, stmt) { + wState.post( + { + type: theCallback, + columnNames: rc.columnNames, + rowNumber: ++rowNumber, + row: row, + }, + wState.xfer, + ); + }; + } + try { + const changeCount = !!rc.countChanges + ? db.changes(true, 64 === rc.countChanges) + : undefined; + db.exec(rc); + if (undefined !== changeCount) { + rc.changeCount = + db.changes(true, 64 === rc.countChanges) - changeCount; + } + const lastInsertRowId = !!rc.lastInsertRowId + ? sqlite3.capi.sqlite3_last_insert_rowid(db) + : undefined; + if (undefined !== lastInsertRowId) { + rc.lastInsertRowId = lastInsertRowId; + } + if (rc.callback instanceof Function) { + rc.callback = theCallback; + + wState.post({ + type: theCallback, + columnNames: rc.columnNames, + rowNumber: null, + row: undefined, + }); + } + } finally { + delete db._blobXfer; + if (rc.callback) rc.callback = theCallback; + } + return rc; + }, + + 'config-get': function () { + const rc = Object.create(null), + src = sqlite3.config; + ['bigIntEnabled'].forEach(function (k) { + if (Object.getOwnPropertyDescriptor(src, k)) rc[k] = src[k]; + }); + rc.version = sqlite3.version; + rc.vfsList = sqlite3.capi.sqlite3_js_vfs_list(); + return rc; + }, + + export: function (ev) { + const db = getMsgDb(ev); + const response = { + byteArray: sqlite3.capi.sqlite3_js_db_export(db.pointer), + filename: db.filename, + mimetype: 'application/x-sqlite3', + }; + wState.xfer.push(response.byteArray.buffer); + return response; + }, + + toss: function (ev) { + toss('Testing worker exception'); + }, + }; + + globalThis.onmessage = async function (ev) { + ev = ev.data; + let result, + dbId = ev.dbId, + evType = ev.type; + const arrivalTime = performance.now(); + try { + if ( + wMsgHandler.hasOwnProperty(evType) && + wMsgHandler[evType] instanceof Function + ) { + result = await wMsgHandler[evType](ev); + } else { + toss('Unknown db worker message type:', ev.type); + } + } catch (err) { + evType = 'error'; + result = { + operation: ev.type, + message: err.message, + errorClass: err.name, + input: ev, + }; + if (err.stack) { + result.stack = + 'string' === typeof err.stack + ? err.stack.split(/\n\s*/) + : err.stack; + } + if (0) + sqlite3.config.warn( + 'Worker is propagating an exception to main thread.', + 'Reporting it _here_ for the stack trace:', + err, + result, + ); + } + if (!dbId) { + dbId = result.dbId || getDefaultDbId(); + } + + wState.post( + { + type: evType, + dbId: dbId, + messageId: ev.messageId, + workerReceivedTime: arrivalTime, + workerRespondTime: performance.now(), + departureTime: ev.departureTime, + + result: result, + }, + wState.xfer, + ); + }; + globalThis.postMessage({ + type: 'sqlite3-api', + result: 'worker1-ready', + }); + }.bind({ sqlite3 }); + }); + + ('use strict'); + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const wasm = sqlite3.wasm, + capi = sqlite3.capi, + toss = sqlite3.util.toss3; + const vfs = Object.create(null); + sqlite3.vfs = vfs; + + capi.sqlite3_vfs.prototype.registerVfs = function (asDefault = false) { + if (!(this instanceof sqlite3.capi.sqlite3_vfs)) { + toss('Expecting a sqlite3_vfs-type argument.'); + } + const rc = capi.sqlite3_vfs_register(this, asDefault ? 1 : 0); + if (rc) { + toss('sqlite3_vfs_register(', this, ') failed with rc', rc); + } + if (this.pointer !== capi.sqlite3_vfs_find(this.$zName)) { + toss( + 'BUG: sqlite3_vfs_find(vfs.$zName) failed for just-installed VFS', + this, + ); + } + return this; + }; + + vfs.installVfs = function (opt) { + let count = 0; + const propList = ['io', 'vfs']; + for (const key of propList) { + const o = opt[key]; + if (o) { + ++count; + o.struct.installMethods(o.methods, !!o.applyArgcCheck); + if ('vfs' === key) { + if (!o.struct.$zName && 'string' === typeof o.name) { + o.struct.addOnDispose( + (o.struct.$zName = wasm.allocCString(o.name)), + ); + } + o.struct.registerVfs(!!o.asDefault); + } + } + } + if (!count) + toss( + 'Misuse: installVfs() options object requires at least', + 'one of:', + propList, + ); + return this; + }; + }); + + ('use strict'); + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + if (!sqlite3.wasm.exports.sqlite3_declare_vtab) { + return; + } + const wasm = sqlite3.wasm, + capi = sqlite3.capi, + toss = sqlite3.util.toss3; + const vtab = Object.create(null); + sqlite3.vtab = vtab; + + const sii = capi.sqlite3_index_info; + + sii.prototype.nthConstraint = function (n, asPtr = false) { + if (n < 0 || n >= this.$nConstraint) return false; + const ptr = + this.$aConstraint + + sii.sqlite3_index_constraint.structInfo.sizeof * n; + return asPtr ? ptr : new sii.sqlite3_index_constraint(ptr); + }; + + sii.prototype.nthConstraintUsage = function (n, asPtr = false) { + if (n < 0 || n >= this.$nConstraint) return false; + const ptr = + this.$aConstraintUsage + + sii.sqlite3_index_constraint_usage.structInfo.sizeof * n; + return asPtr ? ptr : new sii.sqlite3_index_constraint_usage(ptr); + }; + + sii.prototype.nthOrderBy = function (n, asPtr = false) { + if (n < 0 || n >= this.$nOrderBy) return false; + const ptr = + this.$aOrderBy + sii.sqlite3_index_orderby.structInfo.sizeof * n; + return asPtr ? ptr : new sii.sqlite3_index_orderby(ptr); + }; + + const __xWrapFactory = function (methodName, StructType) { + return function (ptr, removeMapping = false) { + if (0 === arguments.length) ptr = new StructType(); + if (ptr instanceof StructType) { + this.set(ptr.pointer, ptr); + return ptr; + } else if (!wasm.isPtr(ptr)) { + sqlite3.SQLite3Error.toss( + 'Invalid argument to', + methodName + '()', + ); + } + let rc = this.get(ptr); + if (removeMapping) this.delete(ptr); + return rc; + }.bind(new Map()); + }; + + const StructPtrMapper = function (name, StructType) { + const __xWrap = __xWrapFactory(name, StructType); + + return Object.assign(Object.create(null), { + StructType, + + create: (ppOut) => { + const rc = __xWrap(); + wasm.pokePtr(ppOut, rc.pointer); + return rc; + }, + + get: (pCObj) => __xWrap(pCObj), + + unget: (pCObj) => __xWrap(pCObj, true), + + dispose: (pCObj) => { + const o = __xWrap(pCObj, true); + if (o) o.dispose(); + }, + }); + }; + + vtab.xVtab = StructPtrMapper('xVtab', capi.sqlite3_vtab); + + vtab.xCursor = StructPtrMapper('xCursor', capi.sqlite3_vtab_cursor); + + vtab.xIndexInfo = (pIdxInfo) => new capi.sqlite3_index_info(pIdxInfo); + + vtab.xError = function f(methodName, err, defaultRc) { + if (f.errorReporter instanceof Function) { + try { + f.errorReporter( + 'sqlite3_module::' + methodName + '(): ' + err.message, + ); + } catch (e) {} + } + let rc; + if (err instanceof sqlite3.WasmAllocError) rc = capi.SQLITE_NOMEM; + else if (arguments.length > 2) rc = defaultRc; + else if (err instanceof sqlite3.SQLite3Error) rc = err.resultCode; + return rc || capi.SQLITE_ERROR; + }; + vtab.xError.errorReporter = 1 ? console.error.bind(console) : false; + + vtab.xRowid = (ppRowid64, value) => wasm.poke(ppRowid64, value, 'i64'); + + vtab.setupModule = function (opt) { + let createdMod = false; + const mod = + this instanceof capi.sqlite3_module + ? this + : opt.struct || (createdMod = new capi.sqlite3_module()); + try { + const methods = opt.methods || toss("Missing 'methods' object."); + for (const e of Object.entries({ + xConnect: 'xCreate', + xDisconnect: 'xDestroy', + })) { + const k = e[0], + v = e[1]; + if (true === methods[k]) methods[k] = methods[v]; + else if (true === methods[v]) methods[v] = methods[k]; + } + if (opt.catchExceptions) { + const fwrap = function (methodName, func) { + if (['xConnect', 'xCreate'].indexOf(methodName) >= 0) { + return function (pDb, pAux, argc, argv, ppVtab, pzErr) { + try { + return func(...arguments) || 0; + } catch (e) { + if (!(e instanceof sqlite3.WasmAllocError)) { + wasm.dealloc(wasm.peekPtr(pzErr)); + wasm.pokePtr(pzErr, wasm.allocCString(e.message)); + } + return vtab.xError(methodName, e); + } + }; + } else { + return function (...args) { + try { + return func(...args) || 0; + } catch (e) { + return vtab.xError(methodName, e); + } + }; + } + }; + const mnames = [ + 'xCreate', + 'xConnect', + 'xBestIndex', + 'xDisconnect', + 'xDestroy', + 'xOpen', + 'xClose', + 'xFilter', + 'xNext', + 'xEof', + 'xColumn', + 'xRowid', + 'xUpdate', + 'xBegin', + 'xSync', + 'xCommit', + 'xRollback', + 'xFindFunction', + 'xRename', + 'xSavepoint', + 'xRelease', + 'xRollbackTo', + 'xShadowName', + ]; + const remethods = Object.create(null); + for (const k of mnames) { + const m = methods[k]; + if (!(m instanceof Function)) continue; + else if ('xConnect' === k && methods.xCreate === m) { + remethods[k] = methods.xCreate; + } else if ('xCreate' === k && methods.xConnect === m) { + remethods[k] = methods.xConnect; + } else { + remethods[k] = fwrap(k, m); + } + } + mod.installMethods(remethods, false); + } else { + mod.installMethods(methods, !!opt.applyArgcCheck); + } + if (0 === mod.$iVersion) { + let v; + if ('number' === typeof opt.iVersion) v = opt.iVersion; + else if (mod.$xShadowName) v = 3; + else if (mod.$xSavePoint || mod.$xRelease || mod.$xRollbackTo) + v = 2; + else v = 1; + mod.$iVersion = v; + } + } catch (e) { + if (createdMod) createdMod.dispose(); + throw e; + } + return mod; + }; + + capi.sqlite3_module.prototype.setupModule = function (opt) { + return vtab.setupModule.call(this, opt); + }; + }); + + ('use strict'); + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const installOpfsVfs = function callee(options) { + 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', + ), + ); + } else if ('undefined' === typeof WorkerGlobalScope) { + return Promise.reject( + new Error( + 'The OPFS sqlite3_vfs cannot run in the main thread ' + + 'because it requires Atomics.wait().', + ), + ); + } else if ( + !globalThis.FileSystemHandle || + !globalThis.FileSystemDirectoryHandle || + !globalThis.FileSystemFileHandle || + !globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle || + !navigator?.storage?.getDirectory + ) { + return Promise.reject(new Error('Missing required OPFS APIs.')); + } + if (!options || 'object' !== typeof options) { + options = Object.create(null); + } + const urlParams = new URL(globalThis.location.href).searchParams; + if (urlParams.has('opfs-disable')) { + return Promise.resolve(sqlite3); + } + if (undefined === options.verbose) { + options.verbose = urlParams.has('opfs-verbose') + ? +urlParams.get('opfs-verbose') || 2 + : 1; + } + if (undefined === options.sanityChecks) { + options.sanityChecks = urlParams.has('opfs-sanity-check'); + } + if (undefined === options.proxyUri) { + options.proxyUri = callee.defaultProxyUri; + } + + if ('function' === typeof options.proxyUri) { + options.proxyUri = options.proxyUri(); + } + const thePromise = new Promise(function ( + promiseResolve_, + promiseReject_, + ) { + const loggers = [ + sqlite3.config.error, + sqlite3.config.warn, + sqlite3.config.log, + ]; + const logImpl = (level, ...args) => { + if (options.verbose > level) + loggers[level]('OPFS syncer:', ...args); + }; + const log = (...args) => logImpl(2, ...args); + const warn = (...args) => logImpl(1, ...args); + const error = (...args) => logImpl(0, ...args); + const toss = sqlite3.util.toss; + const capi = sqlite3.capi; + const util = sqlite3.util; + const wasm = sqlite3.wasm; + const sqlite3_vfs = capi.sqlite3_vfs; + const sqlite3_file = capi.sqlite3_file; + const sqlite3_io_methods = capi.sqlite3_io_methods; + + const opfsUtil = Object.create(null); + + const thisThreadHasOPFS = () => { + return ( + globalThis.FileSystemHandle && + globalThis.FileSystemDirectoryHandle && + globalThis.FileSystemFileHandle && + globalThis.FileSystemFileHandle.prototype + .createSyncAccessHandle && + navigator?.storage?.getDirectory + ); + }; + + opfsUtil.metrics = { + dump: function () { + let k, + n = 0, + t = 0, + w = 0; + for (k in state.opIds) { + const m = metrics[k]; + n += m.count; + t += m.time; + w += m.wait; + m.avgTime = m.count && m.time ? m.time / m.count : 0; + m.avgWait = m.count && m.wait ? m.wait / m.count : 0; + } + sqlite3.config.log( + globalThis.location.href, + 'metrics for', + globalThis.location.href, + ':', + metrics, + '\nTotal of', + n, + 'op(s) for', + t, + 'ms (incl. ' + w + ' ms of waiting on the async side)', + ); + sqlite3.config.log('Serialization metrics:', metrics.s11n); + W.postMessage({ type: 'opfs-async-metrics' }); + }, + reset: function () { + let k; + const r = (m) => (m.count = m.time = m.wait = 0); + for (k in state.opIds) { + r((metrics[k] = Object.create(null))); + } + let s = (metrics.s11n = Object.create(null)); + s = s.serialize = Object.create(null); + s.count = s.time = 0; + s = metrics.s11n.deserialize = Object.create(null); + s.count = s.time = 0; + }, + }; + const opfsIoMethods = new sqlite3_io_methods(); + const opfsVfs = new sqlite3_vfs().addOnDispose(() => + opfsIoMethods.dispose(), + ); + let promiseWasRejected = undefined; + const promiseReject = (err) => { + promiseWasRejected = true; + opfsVfs.dispose(); + return promiseReject_(err); + }; + const promiseResolve = () => { + promiseWasRejected = false; + return promiseResolve_(sqlite3); + }; + const W = new Worker(options.proxyUri); + setTimeout(() => { + if (undefined === promiseWasRejected) { + promiseReject( + new Error( + 'Timeout while waiting for OPFS async proxy worker.', + ), + ); + } + }, 4000); + W._originalOnError = W.onerror; + W.onerror = function (err) { + error('Error initializing OPFS asyncer:', err); + promiseReject( + new Error( + 'Loading OPFS async Worker failed for unknown reasons.', + ), + ); + }; + const pDVfs = capi.sqlite3_vfs_find(null); + const dVfs = pDVfs ? new sqlite3_vfs(pDVfs) : null; + opfsIoMethods.$iVersion = 1; + opfsVfs.$iVersion = 2; + opfsVfs.$szOsFile = capi.sqlite3_file.structInfo.sizeof; + opfsVfs.$mxPathname = 1024; + opfsVfs.$zName = wasm.allocCString('opfs'); + + opfsVfs.$xDlOpen = + opfsVfs.$xDlError = + opfsVfs.$xDlSym = + opfsVfs.$xDlClose = + null; + opfsVfs.addOnDispose( + '$zName', + opfsVfs.$zName, + 'cleanup default VFS wrapper', + () => (dVfs ? dVfs.dispose() : null), + ); + + const state = Object.create(null); + state.verbose = options.verbose; + state.littleEndian = (() => { + const buffer = new ArrayBuffer(2); + new DataView(buffer).setInt16(0, 256, true); + + return new Int16Array(buffer)[0] === 256; + })(); + + state.asyncIdleWaitTime = 150; + + state.asyncS11nExceptions = 1; + + state.fileBufferSize = 1024 * 64; + state.sabS11nOffset = state.fileBufferSize; + + state.sabS11nSize = opfsVfs.$mxPathname * 2; + + state.sabIO = new SharedArrayBuffer( + state.fileBufferSize + state.sabS11nSize, + ); + state.opIds = Object.create(null); + const metrics = Object.create(null); + { + let i = 0; + + state.opIds.whichOp = i++; + + state.opIds.rc = i++; + + state.opIds.xAccess = i++; + state.opIds.xClose = i++; + state.opIds.xDelete = i++; + state.opIds.xDeleteNoWait = i++; + state.opIds.xFileSize = i++; + state.opIds.xLock = i++; + state.opIds.xOpen = i++; + state.opIds.xRead = i++; + state.opIds.xSleep = i++; + state.opIds.xSync = i++; + state.opIds.xTruncate = i++; + state.opIds.xUnlock = i++; + state.opIds.xWrite = i++; + state.opIds.mkdir = i++; + state.opIds['opfs-async-metrics'] = i++; + state.opIds['opfs-async-shutdown'] = i++; + + state.opIds.retry = i++; + state.sabOP = new SharedArrayBuffer(i * 4); + opfsUtil.metrics.reset(); + } + + state.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((k) => { + if (undefined === (state.sq3Codes[k] = capi[k])) { + toss('Maintenance required: not found:', k); + } + }); + state.opfsFlags = Object.assign(Object.create(null), { + OPFS_UNLOCK_ASAP: 0x01, + + OPFS_UNLINK_BEFORE_OPEN: 0x02, + + defaultUnlockAsap: false, + }); + + const opRun = (op, ...args) => { + const opNdx = state.opIds[op] || toss('Invalid op ID:', op); + state.s11n.serialize(...args); + Atomics.store(state.sabOPView, state.opIds.rc, -1); + Atomics.store(state.sabOPView, state.opIds.whichOp, opNdx); + Atomics.notify(state.sabOPView, state.opIds.whichOp); + const t = performance.now(); + while ( + 'not-equal' !== + Atomics.wait(state.sabOPView, state.opIds.rc, -1) + ) {} + + const rc = Atomics.load(state.sabOPView, state.opIds.rc); + metrics[op].wait += performance.now() - t; + if (rc && state.asyncS11nExceptions) { + const err = state.s11n.deserialize(); + if (err) error(op + '() async error:', ...err); + } + return rc; + }; + + opfsUtil.debug = { + asyncShutdown: () => { + warn( + 'Shutting down OPFS async listener. The OPFS VFS will no longer work.', + ); + opRun('opfs-async-shutdown'); + }, + asyncRestart: () => { + warn( + 'Attempting to restart OPFS VFS async listener. Might work, might not.', + ); + W.postMessage({ type: 'opfs-async-restart' }); + }, + }; + + const initS11n = () => { + if (state.s11n) return state.s11n; + const textDecoder = new TextDecoder(), + textEncoder = new TextEncoder('utf-8'), + viewU8 = new Uint8Array( + state.sabIO, + state.sabS11nOffset, + state.sabS11nSize, + ), + viewDV = new DataView( + state.sabIO, + state.sabS11nOffset, + state.sabS11nSize, + ); + state.s11n = Object.create(null); + + const TypeIds = Object.create(null); + TypeIds.number = { + id: 1, + size: 8, + getter: 'getFloat64', + setter: 'setFloat64', + }; + TypeIds.bigint = { + id: 2, + size: 8, + getter: 'getBigInt64', + setter: 'setBigInt64', + }; + TypeIds.boolean = { + id: 3, + size: 4, + getter: 'getInt32', + setter: 'setInt32', + }; + TypeIds.string = { id: 4 }; + + const getTypeId = (v) => + TypeIds[typeof v] || + toss( + 'Maintenance required: this value type cannot be serialized.', + v, + ); + const getTypeIdById = (tid) => { + switch (tid) { + case TypeIds.number.id: + return TypeIds.number; + case TypeIds.bigint.id: + return TypeIds.bigint; + case TypeIds.boolean.id: + return TypeIds.boolean; + case TypeIds.string.id: + return TypeIds.string; + default: + toss('Invalid type ID:', tid); + } + }; + + state.s11n.deserialize = function (clear = false) { + ++metrics.s11n.deserialize.count; + const t = performance.now(); + const argc = viewU8[0]; + const rc = argc ? [] : null; + if (argc) { + const typeIds = []; + let offset = 1, + i, + n, + v; + for (i = 0; i < argc; ++i, ++offset) { + typeIds.push(getTypeIdById(viewU8[offset])); + } + for (i = 0; i < argc; ++i) { + const t = typeIds[i]; + if (t.getter) { + v = viewDV[t.getter](offset, state.littleEndian); + offset += t.size; + } else { + n = viewDV.getInt32(offset, state.littleEndian); + offset += 4; + v = textDecoder.decode(viewU8.slice(offset, offset + n)); + offset += n; + } + rc.push(v); + } + } + if (clear) viewU8[0] = 0; + + metrics.s11n.deserialize.time += performance.now() - t; + return rc; + }; + + state.s11n.serialize = function (...args) { + const t = performance.now(); + ++metrics.s11n.serialize.count; + if (args.length) { + const typeIds = []; + let i = 0, + offset = 1; + viewU8[0] = args.length & 0xff; + for (; i < args.length; ++i, ++offset) { + typeIds.push(getTypeId(args[i])); + viewU8[offset] = typeIds[i].id; + } + for (i = 0; i < args.length; ++i) { + const t = typeIds[i]; + if (t.setter) { + viewDV[t.setter](offset, args[i], state.littleEndian); + offset += t.size; + } else { + const s = textEncoder.encode(args[i]); + viewDV.setInt32(offset, s.byteLength, state.littleEndian); + offset += 4; + viewU8.set(s, offset); + offset += s.byteLength; + } + } + } else { + viewU8[0] = 0; + } + metrics.s11n.serialize.time += performance.now() - t; + }; + return state.s11n; + }; + + const randomFilename = function f(len = 16) { + if (!f._chars) { + f._chars = + 'abcdefghijklmnopqrstuvwxyz' + + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + + '012346789'; + f._n = f._chars.length; + } + const a = []; + let i = 0; + for (; i < len; ++i) { + const ndx = (Math.random() * (f._n * 64)) % f._n | 0; + a[i] = f._chars[ndx]; + } + return a.join(''); + }; + + const __openFiles = Object.create(null); + + const opTimer = Object.create(null); + opTimer.op = undefined; + opTimer.start = undefined; + const mTimeStart = (op) => { + opTimer.start = performance.now(); + opTimer.op = op; + ++metrics[op].count; + }; + const mTimeEnd = () => + (metrics[opTimer.op].time += performance.now() - opTimer.start); + + const ioSyncWrappers = { + xCheckReservedLock: function (pFile, pOut) { + wasm.poke(pOut, 0, 'i32'); + return 0; + }, + xClose: function (pFile) { + mTimeStart('xClose'); + let rc = 0; + const f = __openFiles[pFile]; + if (f) { + delete __openFiles[pFile]; + rc = opRun('xClose', pFile); + if (f.sq3File) f.sq3File.dispose(); + } + mTimeEnd(); + return rc; + }, + xDeviceCharacteristics: function (pFile) { + return capi.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN; + }, + xFileControl: function (pFile, opId, pArg) { + return capi.SQLITE_NOTFOUND; + }, + xFileSize: function (pFile, pSz64) { + mTimeStart('xFileSize'); + let rc = opRun('xFileSize', pFile); + if (0 == rc) { + try { + const sz = state.s11n.deserialize()[0]; + wasm.poke(pSz64, sz, 'i64'); + } catch (e) { + error('Unexpected error reading xFileSize() result:', e); + rc = state.sq3Codes.SQLITE_IOERR; + } + } + mTimeEnd(); + return rc; + }, + xLock: function (pFile, lockType) { + mTimeStart('xLock'); + const f = __openFiles[pFile]; + let rc = 0; + + if (!f.lockType) { + rc = opRun('xLock', pFile, lockType); + if (0 === rc) f.lockType = lockType; + } else { + f.lockType = lockType; + } + mTimeEnd(); + return rc; + }, + xRead: function (pFile, pDest, n, offset64) { + mTimeStart('xRead'); + const f = __openFiles[pFile]; + let rc; + try { + rc = opRun('xRead', pFile, n, Number(offset64)); + if (0 === rc || capi.SQLITE_IOERR_SHORT_READ === rc) { + wasm.heap8u().set(f.sabView.subarray(0, n), pDest); + } + } catch (e) { + error('xRead(', arguments, ') failed:', e, f); + rc = capi.SQLITE_IOERR_READ; + } + mTimeEnd(); + return rc; + }, + xSync: function (pFile, flags) { + mTimeStart('xSync'); + ++metrics.xSync.count; + const rc = opRun('xSync', pFile, flags); + mTimeEnd(); + return rc; + }, + xTruncate: function (pFile, sz64) { + mTimeStart('xTruncate'); + const rc = opRun('xTruncate', pFile, Number(sz64)); + mTimeEnd(); + return rc; + }, + xUnlock: function (pFile, lockType) { + mTimeStart('xUnlock'); + const f = __openFiles[pFile]; + let rc = 0; + if (capi.SQLITE_LOCK_NONE === lockType && f.lockType) { + rc = opRun('xUnlock', pFile, lockType); + } + if (0 === rc) f.lockType = lockType; + mTimeEnd(); + return rc; + }, + xWrite: function (pFile, pSrc, n, offset64) { + mTimeStart('xWrite'); + const f = __openFiles[pFile]; + let rc; + try { + f.sabView.set(wasm.heap8u().subarray(pSrc, pSrc + n)); + rc = opRun('xWrite', pFile, n, Number(offset64)); + } catch (e) { + error('xWrite(', arguments, ') failed:', e, f); + rc = capi.SQLITE_IOERR_WRITE; + } + mTimeEnd(); + return rc; + }, + }; + + const vfsSyncWrappers = { + xAccess: function (pVfs, zName, flags, pOut) { + mTimeStart('xAccess'); + const rc = opRun('xAccess', wasm.cstrToJs(zName)); + wasm.poke(pOut, rc ? 0 : 1, 'i32'); + mTimeEnd(); + return 0; + }, + xCurrentTime: function (pVfs, pOut) { + wasm.poke( + pOut, + 2440587.5 + new Date().getTime() / 86400000, + 'double', + ); + return 0; + }, + xCurrentTimeInt64: function (pVfs, pOut) { + wasm.poke( + pOut, + 2440587.5 * 86400000 + new Date().getTime(), + 'i64', + ); + return 0; + }, + xDelete: function (pVfs, zName, doSyncDir) { + mTimeStart('xDelete'); + const rc = opRun( + 'xDelete', + wasm.cstrToJs(zName), + doSyncDir, + false, + ); + mTimeEnd(); + return rc; + }, + xFullPathname: function (pVfs, zName, nOut, pOut) { + const i = wasm.cstrncpy(pOut, zName, nOut); + return i < nOut ? 0 : capi.SQLITE_CANTOPEN; + }, + xGetLastError: function (pVfs, nOut, pOut) { + warn('OPFS xGetLastError() has nothing sensible to return.'); + return 0; + }, + + xOpen: function f(pVfs, zName, pFile, flags, pOutFlags) { + mTimeStart('xOpen'); + let opfsFlags = 0; + if (0 === zName) { + zName = randomFilename(); + } else if (wasm.isPtr(zName)) { + if (capi.sqlite3_uri_boolean(zName, 'opfs-unlock-asap', 0)) { + opfsFlags |= state.opfsFlags.OPFS_UNLOCK_ASAP; + } + if ( + capi.sqlite3_uri_boolean(zName, 'delete-before-open', 0) + ) { + opfsFlags |= state.opfsFlags.OPFS_UNLINK_BEFORE_OPEN; + } + zName = wasm.cstrToJs(zName); + } + const fh = Object.create(null); + fh.fid = pFile; + fh.filename = zName; + fh.sab = new SharedArrayBuffer(state.fileBufferSize); + fh.flags = flags; + fh.readOnly = + !(sqlite3.SQLITE_OPEN_CREATE & flags) && + !!(flags & capi.SQLITE_OPEN_READONLY); + const rc = opRun('xOpen', pFile, zName, flags, opfsFlags); + if (!rc) { + if (fh.readOnly) { + wasm.poke(pOutFlags, capi.SQLITE_OPEN_READONLY, 'i32'); + } + __openFiles[pFile] = fh; + fh.sabView = state.sabFileBufView; + fh.sq3File = new sqlite3_file(pFile); + fh.sq3File.$pMethods = opfsIoMethods.pointer; + fh.lockType = capi.SQLITE_LOCK_NONE; + } + mTimeEnd(); + return rc; + }, + }; + + if (dVfs) { + opfsVfs.$xRandomness = dVfs.$xRandomness; + opfsVfs.$xSleep = dVfs.$xSleep; + } + if (!opfsVfs.$xRandomness) { + vfsSyncWrappers.xRandomness = function (pVfs, nOut, pOut) { + const heap = wasm.heap8u(); + let i = 0; + for (; i < nOut; ++i) + heap[pOut + i] = (Math.random() * 255000) & 0xff; + return i; + }; + } + if (!opfsVfs.$xSleep) { + vfsSyncWrappers.xSleep = function (pVfs, ms) { + Atomics.wait(state.sabOPView, state.opIds.xSleep, 0, ms); + return 0; + }; + } + + opfsUtil.getResolvedPath = function (filename, splitIt) { + const p = new URL(filename, 'file://irrelevant').pathname; + return splitIt ? p.split('/').filter((v) => !!v) : p; + }; + + opfsUtil.getDirForFilename = async function f( + absFilename, + createDirs = false, + ) { + const path = opfsUtil.getResolvedPath(absFilename, true); + const filename = path.pop(); + let dh = opfsUtil.rootDirectory; + for (const dirName of path) { + if (dirName) { + dh = await dh.getDirectoryHandle(dirName, { + create: !!createDirs, + }); + } + } + return [dh, filename]; + }; + + opfsUtil.mkdir = async function (absDirName) { + try { + await opfsUtil.getDirForFilename( + absDirName + '/filepart', + true, + ); + return true; + } catch (e) { + return false; + } + }; + + opfsUtil.entryExists = async function (fsEntryName) { + try { + const [dh, fn] = await opfsUtil.getDirForFilename(fsEntryName); + await dh.getFileHandle(fn); + return true; + } catch (e) { + return false; + } + }; + + opfsUtil.randomFilename = randomFilename; + + opfsUtil.treeList = async function () { + const doDir = async function callee(dirHandle, tgt) { + tgt.name = dirHandle.name; + tgt.dirs = []; + tgt.files = []; + for await (const handle of dirHandle.values()) { + if ('directory' === handle.kind) { + const subDir = Object.create(null); + tgt.dirs.push(subDir); + await callee(handle, subDir); + } else { + tgt.files.push(handle.name); + } + } + }; + const root = Object.create(null); + await doDir(opfsUtil.rootDirectory, root); + return root; + }; + + opfsUtil.rmfr = async function () { + const dir = opfsUtil.rootDirectory, + opt = { recurse: true }; + for await (const handle of dir.values()) { + dir.removeEntry(handle.name, opt); + } + }; + + opfsUtil.unlink = async function ( + fsEntryName, + recursive = false, + throwOnError = false, + ) { + try { + const [hDir, filenamePart] = await opfsUtil.getDirForFilename( + fsEntryName, + false, + ); + await hDir.removeEntry(filenamePart, { recursive }); + return true; + } catch (e) { + if (throwOnError) { + throw new Error( + 'unlink(', + arguments[0], + ') failed: ' + e.message, + { + cause: e, + }, + ); + } + return false; + } + }; + + opfsUtil.traverse = async function (opt) { + const defaultOpt = { + recursive: true, + directory: opfsUtil.rootDirectory, + }; + if ('function' === typeof opt) { + opt = { callback: opt }; + } + opt = Object.assign(defaultOpt, opt || {}); + const doDir = async function callee(dirHandle, depth) { + for await (const handle of dirHandle.values()) { + if (false === opt.callback(handle, dirHandle, depth)) + return false; + else if (opt.recursive && 'directory' === handle.kind) { + if (false === (await callee(handle, depth + 1))) break; + } + } + }; + doDir(opt.directory, 0); + }; + + const importDbChunked = async function (filename, callback) { + const [hDir, fnamePart] = await opfsUtil.getDirForFilename( + filename, + true, + ); + const hFile = await hDir.getFileHandle(fnamePart, { + create: true, + }); + let sah = await hFile.createSyncAccessHandle(); + let nWrote = 0, + chunk, + checkedHeader = false, + err = false; + try { + sah.truncate(0); + while (undefined !== (chunk = await callback())) { + if (chunk instanceof ArrayBuffer) + chunk = new Uint8Array(chunk); + if (0 === nWrote && chunk.byteLength >= 15) { + util.affirmDbHeader(chunk); + checkedHeader = true; + } + sah.write(chunk, { at: nWrote }); + nWrote += chunk.byteLength; + } + if (nWrote < 512 || 0 !== nWrote % 512) { + toss( + 'Input size', + nWrote, + 'is not correct for an SQLite database.', + ); + } + if (!checkedHeader) { + const header = new Uint8Array(20); + sah.read(header, { at: 0 }); + util.affirmDbHeader(header); + } + sah.write(new Uint8Array([1, 1]), { at: 18 }); + return nWrote; + } catch (e) { + await sah.close(); + sah = undefined; + await hDir.removeEntry(fnamePart).catch(() => {}); + throw e; + } finally { + if (sah) await sah.close(); + } + }; + + opfsUtil.importDb = async function (filename, bytes) { + if (bytes instanceof Function) { + return importDbChunked(filename, bytes); + } + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + util.affirmIsDb(bytes); + const n = bytes.byteLength; + const [hDir, fnamePart] = await opfsUtil.getDirForFilename( + filename, + true, + ); + let sah, + err, + nWrote = 0; + try { + const hFile = await hDir.getFileHandle(fnamePart, { + create: true, + }); + sah = await hFile.createSyncAccessHandle(); + sah.truncate(0); + nWrote = sah.write(bytes, { at: 0 }); + if (nWrote != n) { + toss( + 'Expected to write ' + + n + + ' bytes but wrote ' + + nWrote + + '.', + ); + } + sah.write(new Uint8Array([1, 1]), { at: 18 }); + return nWrote; + } catch (e) { + if (sah) { + await sah.close(); + sah = undefined; + } + await hDir.removeEntry(fnamePart).catch(() => {}); + throw e; + } finally { + if (sah) await sah.close(); + } + }; + + if (sqlite3.oo1) { + const OpfsDb = function (...args) { + const opt = sqlite3.oo1.DB.dbCtorHelper.normalizeArgs(...args); + opt.vfs = opfsVfs.$zName; + sqlite3.oo1.DB.dbCtorHelper.call(this, opt); + }; + OpfsDb.prototype = Object.create(sqlite3.oo1.DB.prototype); + sqlite3.oo1.OpfsDb = OpfsDb; + OpfsDb.importDb = opfsUtil.importDb; + sqlite3.oo1.DB.dbCtorHelper.setVfsPostOpenCallback( + opfsVfs.pointer, + function (oo1Db, sqlite3) { + sqlite3.capi.sqlite3_busy_timeout(oo1Db, 10000); + }, + ); + } + + const sanityCheck = function () { + const scope = wasm.scopedAllocPush(); + const sq3File = new sqlite3_file(); + try { + const fid = sq3File.pointer; + const openFlags = + capi.SQLITE_OPEN_CREATE | + capi.SQLITE_OPEN_READWRITE | + capi.SQLITE_OPEN_MAIN_DB; + const pOut = wasm.scopedAlloc(8); + const dbFile = '/sanity/check/file' + randomFilename(8); + const zDbFile = wasm.scopedAllocCString(dbFile); + let rc; + state.s11n.serialize('This is ä string.'); + rc = state.s11n.deserialize(); + log('deserialize() says:', rc); + if ('This is ä string.' !== rc[0]) toss('String d13n error.'); + vfsSyncWrappers.xAccess(opfsVfs.pointer, zDbFile, 0, pOut); + rc = wasm.peek(pOut, 'i32'); + log('xAccess(', dbFile, ') exists ?=', rc); + rc = vfsSyncWrappers.xOpen( + opfsVfs.pointer, + zDbFile, + fid, + openFlags, + pOut, + ); + log( + 'open rc =', + rc, + 'state.sabOPView[xOpen] =', + state.sabOPView[state.opIds.xOpen], + ); + if (0 !== rc) { + error('open failed with code', rc); + return; + } + vfsSyncWrappers.xAccess(opfsVfs.pointer, zDbFile, 0, pOut); + rc = wasm.peek(pOut, 'i32'); + if (!rc) toss('xAccess() failed to detect file.'); + rc = ioSyncWrappers.xSync(sq3File.pointer, 0); + if (rc) toss('sync failed w/ rc', rc); + rc = ioSyncWrappers.xTruncate(sq3File.pointer, 1024); + if (rc) toss('truncate failed w/ rc', rc); + wasm.poke(pOut, 0, 'i64'); + rc = ioSyncWrappers.xFileSize(sq3File.pointer, pOut); + if (rc) toss('xFileSize failed w/ rc', rc); + log('xFileSize says:', wasm.peek(pOut, 'i64')); + rc = ioSyncWrappers.xWrite(sq3File.pointer, zDbFile, 10, 1); + if (rc) toss('xWrite() failed!'); + const readBuf = wasm.scopedAlloc(16); + rc = ioSyncWrappers.xRead(sq3File.pointer, readBuf, 6, 2); + wasm.poke(readBuf + 6, 0); + let jRead = wasm.cstrToJs(readBuf); + log('xRead() got:', jRead); + if ('sanity' !== jRead) toss('Unexpected xRead() value.'); + if (vfsSyncWrappers.xSleep) { + log('xSleep()ing before close()ing...'); + vfsSyncWrappers.xSleep(opfsVfs.pointer, 2000); + log('waking up from xSleep()'); + } + rc = ioSyncWrappers.xClose(fid); + log('xClose rc =', rc, 'sabOPView =', state.sabOPView); + log('Deleting file:', dbFile); + vfsSyncWrappers.xDelete(opfsVfs.pointer, zDbFile, 0x1234); + vfsSyncWrappers.xAccess(opfsVfs.pointer, zDbFile, 0, pOut); + rc = wasm.peek(pOut, 'i32'); + if (rc) + toss( + 'Expecting 0 from xAccess(', + dbFile, + ') after xDelete().', + ); + warn('End of OPFS sanity checks.'); + } finally { + sq3File.dispose(); + wasm.scopedAllocPop(scope); + } + }; + + W.onmessage = function ({ data }) { + switch (data.type) { + case 'opfs-unavailable': + promiseReject(new Error(data.payload.join(' '))); + break; + case 'opfs-async-loaded': + W.postMessage({ type: 'opfs-async-init', args: state }); + break; + case 'opfs-async-inited': { + if (true === promiseWasRejected) { + break; + } + try { + sqlite3.vfs.installVfs({ + io: { struct: opfsIoMethods, methods: ioSyncWrappers }, + vfs: { struct: opfsVfs, methods: vfsSyncWrappers }, + }); + state.sabOPView = new Int32Array(state.sabOP); + state.sabFileBufView = new Uint8Array( + state.sabIO, + 0, + state.fileBufferSize, + ); + state.sabS11nView = new Uint8Array( + state.sabIO, + state.sabS11nOffset, + state.sabS11nSize, + ); + initS11n(); + if (options.sanityChecks) { + warn( + 'Running sanity checks because of opfs-sanity-check URL arg...', + ); + sanityCheck(); + } + if (thisThreadHasOPFS()) { + navigator.storage + .getDirectory() + .then((d) => { + W.onerror = W._originalOnError; + delete W._originalOnError; + sqlite3.opfs = opfsUtil; + opfsUtil.rootDirectory = d; + log('End of OPFS sqlite3_vfs setup.', opfsVfs); + promiseResolve(); + }) + .catch(promiseReject); + } else { + promiseResolve(); + } + } catch (e) { + error(e); + promiseReject(e); + } + break; + } + default: { + const errMsg = + 'Unexpected message from the OPFS async worker: ' + + JSON.stringify(data); + error(errMsg); + promiseReject(new Error(errMsg)); + break; + } + } + }; + }); + return thePromise; + }; + installOpfsVfs.defaultProxyUri = 'sqlite3-opfs-async-proxy.js'; + globalThis.sqlite3ApiBootstrap.initializersAsync.push( + async (sqlite3) => { + try { + let proxyJs = installOpfsVfs.defaultProxyUri; + if (sqlite3.scriptInfo.sqlite3Dir) { + installOpfsVfs.defaultProxyUri = + sqlite3.scriptInfo.sqlite3Dir + proxyJs; + } + return installOpfsVfs().catch((e) => { + sqlite3.config.warn( + 'Ignoring inability to install OPFS sqlite3_vfs:', + e.message, + ); + }); + } catch (e) { + sqlite3.config.error('installOpfsVfs() exception:', e); + return Promise.reject(e); + } + }, + ); + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + 'use strict'; + const toss = sqlite3.util.toss; + const toss3 = sqlite3.util.toss3; + const initPromises = Object.create(null); + const capi = sqlite3.capi; + const util = sqlite3.util; + const wasm = sqlite3.wasm; + + const SECTOR_SIZE = 4096; + const HEADER_MAX_PATH_SIZE = 512; + const HEADER_FLAGS_SIZE = 4; + const HEADER_DIGEST_SIZE = 8; + const HEADER_CORPUS_SIZE = HEADER_MAX_PATH_SIZE + HEADER_FLAGS_SIZE; + const HEADER_OFFSET_FLAGS = HEADER_MAX_PATH_SIZE; + const HEADER_OFFSET_DIGEST = HEADER_CORPUS_SIZE; + const HEADER_OFFSET_DATA = SECTOR_SIZE; + + const PERSISTENT_FILE_TYPES = + capi.SQLITE_OPEN_MAIN_DB | + capi.SQLITE_OPEN_MAIN_JOURNAL | + capi.SQLITE_OPEN_SUPER_JOURNAL | + capi.SQLITE_OPEN_WAL; + const FLAG_COMPUTE_DIGEST_V2 = capi.SQLITE_OPEN_MEMORY; + const OPAQUE_DIR_NAME = '.opaque'; + + const getRandomName = () => Math.random().toString(36).slice(2); + + const textDecoder = new TextDecoder(); + const textEncoder = new TextEncoder(); + + const optionDefaults = Object.assign(Object.create(null), { + name: 'opfs-sahpool', + directory: undefined, + initialCapacity: 6, + clearOnInit: false, + + verbosity: 2, + forceReinitIfPreviouslyFailed: false, + }); + + const loggers = [ + sqlite3.config.error, + sqlite3.config.warn, + sqlite3.config.log, + ]; + const log = sqlite3.config.log; + const warn = sqlite3.config.warn; + const error = sqlite3.config.error; + + const __mapVfsToPool = new Map(); + const getPoolForVfs = (pVfs) => __mapVfsToPool.get(pVfs); + const setPoolForVfs = (pVfs, pool) => { + if (pool) __mapVfsToPool.set(pVfs, pool); + else __mapVfsToPool.delete(pVfs); + }; + + const __mapSqlite3File = new Map(); + const getPoolForPFile = (pFile) => __mapSqlite3File.get(pFile); + const setPoolForPFile = (pFile, pool) => { + if (pool) __mapSqlite3File.set(pFile, pool); + else __mapSqlite3File.delete(pFile); + }; + + const ioMethods = { + xCheckReservedLock: function (pFile, pOut) { + const pool = getPoolForPFile(pFile); + pool.log('xCheckReservedLock'); + pool.storeErr(); + wasm.poke32(pOut, 1); + return 0; + }, + xClose: function (pFile) { + const pool = getPoolForPFile(pFile); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + if (file) { + try { + pool.log(`xClose ${file.path}`); + pool.mapS3FileToOFile(pFile, false); + file.sah.flush(); + if (file.flags & capi.SQLITE_OPEN_DELETEONCLOSE) { + pool.deletePath(file.path); + } + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + } + return 0; + }, + xDeviceCharacteristics: function (pFile) { + return capi.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN; + }, + xFileControl: function (pFile, opId, pArg) { + return capi.SQLITE_NOTFOUND; + }, + xFileSize: function (pFile, pSz64) { + const pool = getPoolForPFile(pFile); + pool.log(`xFileSize`); + const file = pool.getOFileForS3File(pFile); + const size = file.sah.getSize() - HEADER_OFFSET_DATA; + + wasm.poke64(pSz64, BigInt(size)); + return 0; + }, + xLock: function (pFile, lockType) { + const pool = getPoolForPFile(pFile); + pool.log(`xLock ${lockType}`); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + file.lockType = lockType; + return 0; + }, + xRead: function (pFile, pDest, n, offset64) { + const pool = getPoolForPFile(pFile); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + pool.log(`xRead ${file.path} ${n} @ ${offset64}`); + try { + const nRead = file.sah.read( + wasm.heap8u().subarray(pDest, pDest + n), + { at: HEADER_OFFSET_DATA + Number(offset64) }, + ); + if (nRead < n) { + wasm.heap8u().fill(0, pDest + nRead, pDest + n); + return capi.SQLITE_IOERR_SHORT_READ; + } + return 0; + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + }, + xSectorSize: function (pFile) { + return SECTOR_SIZE; + }, + xSync: function (pFile, flags) { + const pool = getPoolForPFile(pFile); + pool.log(`xSync ${flags}`); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + + try { + file.sah.flush(); + return 0; + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + }, + xTruncate: function (pFile, sz64) { + const pool = getPoolForPFile(pFile); + pool.log(`xTruncate ${sz64}`); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + + try { + file.sah.truncate(HEADER_OFFSET_DATA + Number(sz64)); + return 0; + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + }, + xUnlock: function (pFile, lockType) { + const pool = getPoolForPFile(pFile); + pool.log('xUnlock'); + const file = pool.getOFileForS3File(pFile); + file.lockType = lockType; + return 0; + }, + xWrite: function (pFile, pSrc, n, offset64) { + const pool = getPoolForPFile(pFile); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + pool.log(`xWrite ${file.path} ${n} ${offset64}`); + try { + const nBytes = file.sah.write( + wasm.heap8u().subarray(pSrc, pSrc + n), + { at: HEADER_OFFSET_DATA + Number(offset64) }, + ); + return n === nBytes ? 0 : toss('Unknown write() failure.'); + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + }, + }; + + const opfsIoMethods = new capi.sqlite3_io_methods(); + opfsIoMethods.$iVersion = 1; + sqlite3.vfs.installVfs({ + io: { struct: opfsIoMethods, methods: ioMethods }, + }); + + const vfsMethods = { + xAccess: function (pVfs, zName, flags, pOut) { + const pool = getPoolForVfs(pVfs); + pool.storeErr(); + try { + const name = pool.getPath(zName); + wasm.poke32(pOut, pool.hasFilename(name) ? 1 : 0); + } catch (e) { + wasm.poke32(pOut, 0); + } + return 0; + }, + xCurrentTime: function (pVfs, pOut) { + wasm.poke( + pOut, + 2440587.5 + new Date().getTime() / 86400000, + 'double', + ); + return 0; + }, + xCurrentTimeInt64: function (pVfs, pOut) { + wasm.poke(pOut, 2440587.5 * 86400000 + new Date().getTime(), 'i64'); + return 0; + }, + xDelete: function (pVfs, zName, doSyncDir) { + const pool = getPoolForVfs(pVfs); + pool.log(`xDelete ${wasm.cstrToJs(zName)}`); + pool.storeErr(); + try { + pool.deletePath(pool.getPath(zName)); + return 0; + } catch (e) { + pool.storeErr(e); + return capi.SQLITE_IOERR_DELETE; + } + }, + xFullPathname: function (pVfs, zName, nOut, pOut) { + const i = wasm.cstrncpy(pOut, zName, nOut); + return i < nOut ? 0 : capi.SQLITE_CANTOPEN; + }, + xGetLastError: function (pVfs, nOut, pOut) { + const pool = getPoolForVfs(pVfs); + const e = pool.popErr(); + pool.log(`xGetLastError ${nOut} e =`, e); + if (e) { + const scope = wasm.scopedAllocPush(); + try { + const [cMsg, n] = wasm.scopedAllocCString(e.message, true); + wasm.cstrncpy(pOut, cMsg, nOut); + if (n > nOut) wasm.poke8(pOut + nOut - 1, 0); + } catch (e) { + return capi.SQLITE_NOMEM; + } finally { + wasm.scopedAllocPop(scope); + } + } + return e ? e.sqlite3Rc || capi.SQLITE_IOERR : 0; + }, + + xOpen: function f(pVfs, zName, pFile, flags, pOutFlags) { + const pool = getPoolForVfs(pVfs); + try { + flags &= ~FLAG_COMPUTE_DIGEST_V2; + pool.log(`xOpen ${wasm.cstrToJs(zName)} ${flags}`); + + const path = + zName && wasm.peek8(zName) + ? pool.getPath(zName) + : getRandomName(); + let sah = pool.getSAHForPath(path); + if (!sah && flags & capi.SQLITE_OPEN_CREATE) { + if (pool.getFileCount() < pool.getCapacity()) { + sah = pool.nextAvailableSAH(); + pool.setAssociatedPath(sah, path, flags); + } else { + toss('SAH pool is full. Cannot create file', path); + } + } + if (!sah) { + toss('file not found:', path); + } + + const file = { path, flags, sah }; + pool.mapS3FileToOFile(pFile, file); + file.lockType = capi.SQLITE_LOCK_NONE; + const sq3File = new capi.sqlite3_file(pFile); + sq3File.$pMethods = opfsIoMethods.pointer; + sq3File.dispose(); + wasm.poke32(pOutFlags, flags); + return 0; + } catch (e) { + pool.storeErr(e); + return capi.SQLITE_CANTOPEN; + } + }, + }; + + const createOpfsVfs = function (vfsName) { + if (sqlite3.capi.sqlite3_vfs_find(vfsName)) { + toss3('VFS name is already registered:', vfsName); + } + const opfsVfs = new capi.sqlite3_vfs(); + + const pDVfs = capi.sqlite3_vfs_find(null); + const dVfs = pDVfs ? new capi.sqlite3_vfs(pDVfs) : null; + opfsVfs.$iVersion = 2; + opfsVfs.$szOsFile = capi.sqlite3_file.structInfo.sizeof; + opfsVfs.$mxPathname = HEADER_MAX_PATH_SIZE; + opfsVfs.addOnDispose( + (opfsVfs.$zName = wasm.allocCString(vfsName)), + () => setPoolForVfs(opfsVfs.pointer, 0), + ); + + if (dVfs) { + opfsVfs.$xRandomness = dVfs.$xRandomness; + opfsVfs.$xSleep = dVfs.$xSleep; + dVfs.dispose(); + } + if (!opfsVfs.$xRandomness && !vfsMethods.xRandomness) { + vfsMethods.xRandomness = function (pVfs, nOut, pOut) { + const heap = wasm.heap8u(); + let i = 0; + for (; i < nOut; ++i) + heap[pOut + i] = (Math.random() * 255000) & 0xff; + return i; + }; + } + if (!opfsVfs.$xSleep && !vfsMethods.xSleep) { + vfsMethods.xSleep = (pVfs, ms) => 0; + } + sqlite3.vfs.installVfs({ + vfs: { struct: opfsVfs, methods: vfsMethods }, + }); + return opfsVfs; + }; + + class OpfsSAHPool { + vfsDir; + + #dhVfsRoot; + + #dhOpaque; + + #dhVfsParent; + + #mapSAHToName = new Map(); + + #mapFilenameToSAH = new Map(); + + #availableSAH = new Set(); + + #mapS3FileToOFile_ = new Map(); + + #apBody = new Uint8Array(HEADER_CORPUS_SIZE); + + #dvBody; + + #cVfs; + + #verbosity; + + constructor(options = Object.create(null)) { + this.#verbosity = options.verbosity ?? optionDefaults.verbosity; + this.vfsName = options.name || optionDefaults.name; + this.#cVfs = createOpfsVfs(this.vfsName); + setPoolForVfs(this.#cVfs.pointer, this); + this.vfsDir = options.directory || '.' + this.vfsName; + this.#dvBody = new DataView( + this.#apBody.buffer, + this.#apBody.byteOffset, + ); + this.isReady = this.reset( + !!(options.clearOnInit ?? optionDefaults.clearOnInit), + ).then(() => { + if (this.$error) throw this.$error; + return this.getCapacity() + ? Promise.resolve(undefined) + : this.addCapacity( + options.initialCapacity || optionDefaults.initialCapacity, + ); + }); + } + + #logImpl(level, ...args) { + if (this.#verbosity > level) + loggers[level](this.vfsName + ':', ...args); + } + log(...args) { + this.#logImpl(2, ...args); + } + warn(...args) { + this.#logImpl(1, ...args); + } + error(...args) { + this.#logImpl(0, ...args); + } + + getVfs() { + return this.#cVfs; + } + + getCapacity() { + return this.#mapSAHToName.size; + } + + getFileCount() { + return this.#mapFilenameToSAH.size; + } + + getFileNames() { + const rc = []; + for (const n of this.#mapFilenameToSAH.keys()) rc.push(n); + return rc; + } + + async addCapacity(n) { + for (let i = 0; i < n; ++i) { + const name = getRandomName(); + const h = await this.#dhOpaque.getFileHandle(name, { + create: true, + }); + const ah = await h.createSyncAccessHandle(); + this.#mapSAHToName.set(ah, name); + this.setAssociatedPath(ah, '', 0); + } + return this.getCapacity(); + } + + async reduceCapacity(n) { + let nRm = 0; + for (const ah of Array.from(this.#availableSAH)) { + if (nRm === n || this.getFileCount() === this.getCapacity()) { + break; + } + const name = this.#mapSAHToName.get(ah); + + ah.close(); + await this.#dhOpaque.removeEntry(name); + this.#mapSAHToName.delete(ah); + this.#availableSAH.delete(ah); + ++nRm; + } + return nRm; + } + + releaseAccessHandles() { + for (const ah of this.#mapSAHToName.keys()) ah.close(); + this.#mapSAHToName.clear(); + this.#mapFilenameToSAH.clear(); + this.#availableSAH.clear(); + } + + async acquireAccessHandles(clearFiles = false) { + const files = []; + for await (const [name, h] of this.#dhOpaque) { + if ('file' === h.kind) { + files.push([name, h]); + } + } + return Promise.all( + files.map(async ([name, h]) => { + try { + const ah = await h.createSyncAccessHandle(); + this.#mapSAHToName.set(ah, name); + if (clearFiles) { + ah.truncate(HEADER_OFFSET_DATA); + this.setAssociatedPath(ah, '', 0); + } else { + const path = this.getAssociatedPath(ah); + if (path) { + this.#mapFilenameToSAH.set(path, ah); + } else { + this.#availableSAH.add(ah); + } + } + } catch (e) { + this.storeErr(e); + this.releaseAccessHandles(); + throw e; + } + }), + ); + } + + getAssociatedPath(sah) { + sah.read(this.#apBody, { at: 0 }); + + const flags = this.#dvBody.getUint32(HEADER_OFFSET_FLAGS); + if ( + this.#apBody[0] && + (flags & capi.SQLITE_OPEN_DELETEONCLOSE || + (flags & PERSISTENT_FILE_TYPES) === 0) + ) { + warn( + `Removing file with unexpected flags ${flags.toString(16)}`, + this.#apBody, + ); + this.setAssociatedPath(sah, '', 0); + return ''; + } + + const fileDigest = new Uint32Array(HEADER_DIGEST_SIZE / 4); + sah.read(fileDigest, { at: HEADER_OFFSET_DIGEST }); + const compDigest = this.computeDigest(this.#apBody, flags); + + if (fileDigest.every((v, i) => v === compDigest[i])) { + const pathBytes = this.#apBody.findIndex((v) => 0 === v); + if (0 === pathBytes) { + sah.truncate(HEADER_OFFSET_DATA); + } + + return pathBytes + ? textDecoder.decode(this.#apBody.subarray(0, pathBytes)) + : ''; + } else { + warn('Disassociating file with bad digest.'); + this.setAssociatedPath(sah, '', 0); + return ''; + } + } + + setAssociatedPath(sah, path, flags) { + const enc = textEncoder.encodeInto(path, this.#apBody); + if (HEADER_MAX_PATH_SIZE <= enc.written + 1) { + toss('Path too long:', path); + } + if (path && flags) { + flags |= FLAG_COMPUTE_DIGEST_V2; + } + this.#apBody.fill(0, enc.written, HEADER_MAX_PATH_SIZE); + this.#dvBody.setUint32(HEADER_OFFSET_FLAGS, flags); + const digest = this.computeDigest(this.#apBody, flags); + + sah.write(this.#apBody, { at: 0 }); + sah.write(digest, { at: HEADER_OFFSET_DIGEST }); + sah.flush(); + + if (path) { + this.#mapFilenameToSAH.set(path, sah); + this.#availableSAH.delete(sah); + } else { + sah.truncate(HEADER_OFFSET_DATA); + this.#availableSAH.add(sah); + } + } + + computeDigest(byteArray, fileFlags) { + if (fileFlags & FLAG_COMPUTE_DIGEST_V2) { + let h1 = 0xdeadbeef; + let h2 = 0x41c6ce57; + for (const v of byteArray) { + h1 = Math.imul(h1 ^ v, 2654435761); + h2 = Math.imul(h2 ^ v, 104729); + } + return new Uint32Array([h1 >>> 0, h2 >>> 0]); + } else { + return new Uint32Array([0, 0]); + } + } + + async reset(clearFiles) { + await this.isReady; + let h = await navigator.storage.getDirectory(); + let prev, prevName; + for (const d of this.vfsDir.split('/')) { + if (d) { + prev = h; + h = await h.getDirectoryHandle(d, { create: true }); + } + } + this.#dhVfsRoot = h; + this.#dhVfsParent = prev; + this.#dhOpaque = await this.#dhVfsRoot.getDirectoryHandle( + OPAQUE_DIR_NAME, + { create: true }, + ); + this.releaseAccessHandles(); + return this.acquireAccessHandles(clearFiles); + } + + getPath(arg) { + if (wasm.isPtr(arg)) arg = wasm.cstrToJs(arg); + return ( + arg instanceof URL ? arg : new URL(arg, 'file://localhost/') + ).pathname; + } + + deletePath(path) { + const sah = this.#mapFilenameToSAH.get(path); + if (sah) { + this.#mapFilenameToSAH.delete(path); + this.setAssociatedPath(sah, '', 0); + } + return !!sah; + } + + storeErr(e, code) { + if (e) { + e.sqlite3Rc = code || capi.SQLITE_IOERR; + this.error(e); + } + this.$error = e; + return code; + } + + popErr() { + const rc = this.$error; + this.$error = undefined; + return rc; + } + + nextAvailableSAH() { + const [rc] = this.#availableSAH.keys(); + return rc; + } + + getOFileForS3File(pFile) { + return this.#mapS3FileToOFile_.get(pFile); + } + + mapS3FileToOFile(pFile, file) { + if (file) { + this.#mapS3FileToOFile_.set(pFile, file); + setPoolForPFile(pFile, this); + } else { + this.#mapS3FileToOFile_.delete(pFile); + setPoolForPFile(pFile, false); + } + } + + hasFilename(name) { + return this.#mapFilenameToSAH.has(name); + } + + getSAHForPath(path) { + return this.#mapFilenameToSAH.get(path); + } + + async removeVfs() { + if (!this.#cVfs.pointer || !this.#dhOpaque) return false; + capi.sqlite3_vfs_unregister(this.#cVfs.pointer); + this.#cVfs.dispose(); + delete initPromises[this.vfsName]; + try { + this.releaseAccessHandles(); + await this.#dhVfsRoot.removeEntry(OPAQUE_DIR_NAME, { + recursive: true, + }); + this.#dhOpaque = undefined; + await this.#dhVfsParent.removeEntry(this.#dhVfsRoot.name, { + recursive: true, + }); + this.#dhVfsRoot = this.#dhVfsParent = undefined; + } catch (e) { + sqlite3.config.error( + this.vfsName, + 'removeVfs() failed with no recovery strategy:', + e, + ); + } + return true; + } + + pauseVfs() { + if (this.#mapS3FileToOFile_.size > 0) { + sqlite3.SQLite3Error.toss( + capi.SQLITE_MISUSE, + 'Cannot pause VFS', + this.vfsName, + 'because it has opened files.', + ); + } + if (this.#mapSAHToName.size > 0) { + capi.sqlite3_vfs_unregister(this.vfsName); + this.releaseAccessHandles(); + } + return this; + } + + isPaused() { + return 0 === this.#mapSAHToName.size; + } + + async unpauseVfs() { + if (0 === this.#mapSAHToName.size) { + return this.acquireAccessHandles(false).then( + () => capi.sqlite3_vfs_register(this.#cVfs, 0), + this, + ); + } + return this; + } + + exportFile(name) { + const sah = + this.#mapFilenameToSAH.get(name) || toss('File not found:', name); + const n = sah.getSize() - HEADER_OFFSET_DATA; + const b = new Uint8Array(n > 0 ? n : 0); + if (n > 0) { + const nRead = sah.read(b, { at: HEADER_OFFSET_DATA }); + if (nRead != n) { + toss( + 'Expected to read ' + n + ' bytes but read ' + nRead + '.', + ); + } + } + return b; + } + + async importDbChunked(name, callback) { + const sah = + this.#mapFilenameToSAH.get(name) || + this.nextAvailableSAH() || + toss('No available handles to import to.'); + sah.truncate(0); + let nWrote = 0, + chunk, + checkedHeader = false, + err = false; + try { + while (undefined !== (chunk = await callback())) { + if (chunk instanceof ArrayBuffer) chunk = new Uint8Array(chunk); + if (0 === nWrote && chunk.byteLength >= 15) { + util.affirmDbHeader(chunk); + checkedHeader = true; + } + sah.write(chunk, { at: HEADER_OFFSET_DATA + nWrote }); + nWrote += chunk.byteLength; + } + if (nWrote < 512 || 0 !== nWrote % 512) { + toss( + 'Input size', + nWrote, + 'is not correct for an SQLite database.', + ); + } + if (!checkedHeader) { + const header = new Uint8Array(20); + sah.read(header, { at: 0 }); + util.affirmDbHeader(header); + } + sah.write(new Uint8Array([1, 1]), { + at: HEADER_OFFSET_DATA + 18, + }); + } catch (e) { + this.setAssociatedPath(sah, '', 0); + throw e; + } + this.setAssociatedPath(sah, name, capi.SQLITE_OPEN_MAIN_DB); + return nWrote; + } + + importDb(name, bytes) { + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + else if (bytes instanceof Function) + return this.importDbChunked(name, bytes); + const sah = + this.#mapFilenameToSAH.get(name) || + this.nextAvailableSAH() || + toss('No available handles to import to.'); + const n = bytes.byteLength; + if (n < 512 || n % 512 != 0) { + toss('Byte array size is invalid for an SQLite db.'); + } + const header = 'SQLite format 3'; + for (let i = 0; i < header.length; ++i) { + if (header.charCodeAt(i) !== bytes[i]) { + toss('Input does not contain an SQLite database header.'); + } + } + const nWrote = sah.write(bytes, { at: HEADER_OFFSET_DATA }); + if (nWrote != n) { + this.setAssociatedPath(sah, '', 0); + toss( + 'Expected to write ' + n + ' bytes but wrote ' + nWrote + '.', + ); + } else { + sah.write(new Uint8Array([1, 1]), { + at: HEADER_OFFSET_DATA + 18, + }); + this.setAssociatedPath(sah, name, capi.SQLITE_OPEN_MAIN_DB); + } + return nWrote; + } + } + + class OpfsSAHPoolUtil { + #p; + + constructor(sahPool) { + this.#p = sahPool; + this.vfsName = sahPool.vfsName; + } + + async addCapacity(n) { + return this.#p.addCapacity(n); + } + + async reduceCapacity(n) { + return this.#p.reduceCapacity(n); + } + + getCapacity() { + return this.#p.getCapacity(this.#p); + } + + getFileCount() { + return this.#p.getFileCount(); + } + getFileNames() { + return this.#p.getFileNames(); + } + + async reserveMinimumCapacity(min) { + const c = this.#p.getCapacity(); + return c < min ? this.#p.addCapacity(min - c) : c; + } + + exportFile(name) { + return this.#p.exportFile(name); + } + + importDb(name, bytes) { + return this.#p.importDb(name, bytes); + } + + async wipeFiles() { + return this.#p.reset(true); + } + + unlink(filename) { + return this.#p.deletePath(filename); + } + + async removeVfs() { + return this.#p.removeVfs(); + } + + pauseVfs() { + this.#p.pauseVfs(); + return this; + } + async unpauseVfs() { + return this.#p.unpauseVfs().then(() => this); + } + isPaused() { + return this.#p.isPaused(); + } + } + + const apiVersionCheck = async () => { + const dh = await navigator.storage.getDirectory(); + const fn = '.opfs-sahpool-sync-check-' + getRandomName(); + const fh = await dh.getFileHandle(fn, { create: true }); + const ah = await fh.createSyncAccessHandle(); + const close = ah.close(); + await close; + await dh.removeEntry(fn); + if (close?.then) { + toss( + 'The local OPFS API is too old for opfs-sahpool:', + 'it has an async FileSystemSyncAccessHandle.close() method.', + ); + } + return true; + }; + + sqlite3.installOpfsSAHPoolVfs = async function ( + options = Object.create(null), + ) { + options = Object.assign( + Object.create(null), + optionDefaults, + options || {}, + ); + const vfsName = options.name; + if (options.$testThrowPhase1) { + throw options.$testThrowPhase1; + } + if (initPromises[vfsName]) { + try { + const p = await initPromises[vfsName]; + + return p; + } catch (e) { + if (options.forceReinitIfPreviouslyFailed) { + delete initPromises[vfsName]; + } else { + throw e; + } + } + } + if ( + !globalThis.FileSystemHandle || + !globalThis.FileSystemDirectoryHandle || + !globalThis.FileSystemFileHandle || + !globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle || + !navigator?.storage?.getDirectory + ) { + return (initPromises[vfsName] = Promise.reject( + new Error('Missing required OPFS APIs.'), + )); + } + + return (initPromises[vfsName] = apiVersionCheck() + .then(async function () { + if (options.$testThrowPhase2) { + throw options.$testThrowPhase2; + } + const thePool = new OpfsSAHPool(options); + return thePool.isReady + .then(async () => { + const poolUtil = new OpfsSAHPoolUtil(thePool); + if (sqlite3.oo1) { + const oo1 = sqlite3.oo1; + const theVfs = thePool.getVfs(); + const OpfsSAHPoolDb = function (...args) { + const opt = oo1.DB.dbCtorHelper.normalizeArgs(...args); + opt.vfs = theVfs.$zName; + oo1.DB.dbCtorHelper.call(this, opt); + }; + OpfsSAHPoolDb.prototype = Object.create(oo1.DB.prototype); + poolUtil.OpfsSAHPoolDb = OpfsSAHPoolDb; + } + thePool.log('VFS initialized.'); + return poolUtil; + }) + .catch(async (e) => { + await thePool.removeVfs().catch(() => {}); + throw e; + }); + }) + .catch((err) => { + return (initPromises[vfsName] = Promise.reject(err)); + })); + }; + }); + + ('use strict'); + if ('undefined' !== typeof Module) { + const SABC = Object.assign( + Object.create(null), + { + exports: + 'undefined' === typeof wasmExports ? Module['asm'] : wasmExports, + memory: Module.wasmMemory, + }, + globalThis.sqlite3ApiConfig || {}, + ); + + globalThis.sqlite3ApiConfig = SABC; + let sqlite3; + try { + sqlite3 = globalThis.sqlite3ApiBootstrap(); + } catch (e) { + console.error('sqlite3ApiBootstrap() error:', e); + throw e; + } finally { + delete globalThis.sqlite3ApiBootstrap; + delete globalThis.sqlite3ApiConfig; + } + + Module.sqlite3 = sqlite3; + } 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.', + ); + } + }; + + moduleRtn = readyPromise; + + return moduleRtn; + }; +})(); +if (typeof exports === 'object' && typeof module === 'object') + module.exports = sqlite3InitModule; +else if (typeof define === 'function' && define['amd']) + define([], () => sqlite3InitModule); + +(function () { + const originalInit = sqlite3InitModule; + if (!originalInit) { + throw new Error( + 'Expecting globalThis.sqlite3InitModule to be defined by the Emscripten build.', + ); + } + + const initModuleState = (globalThis.sqlite3InitModuleState = Object.assign( + Object.create(null), + { + moduleScript: globalThis?.document?.currentScript, + isWorker: 'undefined' !== typeof WorkerGlobalScope, + location: globalThis.location, + urlParams: globalThis?.location?.href + ? new URL(globalThis.location.href).searchParams + : new URLSearchParams(), + }, + )); + initModuleState.debugModule = initModuleState.urlParams.has( + 'sqlite3.debugModule', + ) + ? (...args) => console.warn('sqlite3.debugModule:', ...args) + : () => {}; + + if (initModuleState.urlParams.has('sqlite3.dir')) { + initModuleState.sqlite3Dir = + initModuleState.urlParams.get('sqlite3.dir') + '/'; + } else if (initModuleState.moduleScript) { + const li = initModuleState.moduleScript.src.split('/'); + li.pop(); + initModuleState.sqlite3Dir = li.join('/') + '/'; + } + + globalThis.sqlite3InitModule = function ff(...args) { + return originalInit(...args) + .then((EmscriptenModule) => { + EmscriptenModule.runSQLite3PostLoadInit(EmscriptenModule); + const s = EmscriptenModule.sqlite3; + s.scriptInfo = initModuleState; + + if (ff.__isUnderTest) s.__isUnderTest = true; + const f = s.asyncPostInit; + delete s.asyncPostInit; + const rv = f(); + return rv; + }) + .catch((e) => { + console.error('Exception loading sqlite3 module:', e); + throw e; + }); + }; + globalThis.sqlite3InitModule.ready = originalInit.ready; + + if (globalThis.sqlite3InitModuleState.moduleScript) { + const sim = globalThis.sqlite3InitModuleState; + let src = sim.moduleScript.src.split('/'); + src.pop(); + sim.scriptDir = src.join('/') + '/'; + } + initModuleState.debugModule('sqlite3InitModuleState =', initModuleState); + if (0) { + console.warn('Replaced sqlite3InitModule()'); + console.warn('globalThis.location.href =', globalThis.location.href); + if ('undefined' !== typeof document) { + console.warn( + 'document.currentScript.src =', + document?.currentScript?.src, + ); + } + } + + if (typeof exports === 'object' && typeof module === 'object') { + module.exports = sqlite3InitModule; + } else if (typeof exports === 'object') { + exports['sqlite3InitModule'] = sqlite3InitModule; + } + + return globalThis.sqlite3InitModule; +})(); diff --git a/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.mjs b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.mjs new file mode 100644 index 0000000..f80d10b --- /dev/null +++ b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.mjs @@ -0,0 +1,14039 @@ +/* + ** LICENSE for the sqlite3 WebAssembly/JavaScript APIs. + ** + ** This bundle (typically released as sqlite3.js or sqlite3.mjs) + ** is an amalgamation of JavaScript source code from two projects: + ** + ** 1) https://emscripten.org: the Emscripten "glue code" is covered by + ** the terms of the MIT license and University of Illinois/NCSA + ** Open Source License, as described at: + ** + ** https://emscripten.org/docs/introducing_emscripten/emscripten_license.html + ** + ** 2) https://sqlite.org: all code and documentation labeled as being + ** from this source are released under the same terms as the sqlite3 + ** C library: + ** + ** 2022-10-16 + ** + ** The author disclaims copyright to this source code. In place of a + ** legal notice, here is a blessing: + ** + ** * May you do good and not evil. + ** * May you find forgiveness for yourself and forgive others. + ** * May you share freely, never taking more than you give. + */ +/* + ** This code was built from sqlite3 version... + ** + ** SQLITE_VERSION "3.50.4" + ** SQLITE_VERSION_NUMBER 3050004 + ** SQLITE_SOURCE_ID "2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3" + ** + ** Using the Emscripten SDK version 3.1.70. + */ + +var sqlite3InitModule = (() => { + var _scriptName = import.meta.url; + + return function (moduleArg = {}) { + var moduleRtn; + + var Module = moduleArg; + + var readyPromiseResolve, readyPromiseReject; + var readyPromise = new Promise((resolve, reject) => { + readyPromiseResolve = resolve; + readyPromiseReject = reject; + }); + + var ENVIRONMENT_IS_WEB = typeof window == 'object'; + var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function'; + + var ENVIRONMENT_IS_NODE = + typeof process == 'object' && + typeof process.versions == 'object' && + typeof process.versions.node == 'string' && + process.type != 'renderer'; + var ENVIRONMENT_IS_SHELL = + !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; + + const sqlite3InitModuleState = + globalThis.sqlite3InitModuleState || + Object.assign(Object.create(null), { + debugModule: () => {}, + }); + delete globalThis.sqlite3InitModuleState; + sqlite3InitModuleState.debugModule( + 'globalThis.location =', + globalThis.location, + ); + + Module['locateFile'] = function (path, prefix) { + return new URL(path, import.meta.url).href; + }.bind(sqlite3InitModuleState); + + var moduleOverrides = Object.assign({}, Module); + + var arguments_ = []; + var thisProgram = './this.program'; + var quit_ = (status, toThrow) => { + throw toThrow; + }; + + var scriptDirectory = ''; + function locateFile(path) { + if (Module['locateFile']) { + return Module['locateFile'](path, scriptDirectory); + } + return scriptDirectory + path; + } + + var readAsync, readBinary; + + if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { + if (ENVIRONMENT_IS_WORKER) { + scriptDirectory = self.location.href; + } else if (typeof document != 'undefined' && document.currentScript) { + scriptDirectory = document.currentScript.src; + } + + if (_scriptName) { + scriptDirectory = _scriptName; + } + + if (scriptDirectory.startsWith('blob:')) { + scriptDirectory = ''; + } else { + scriptDirectory = scriptDirectory.substr( + 0, + scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/') + 1, + ); + } + + { + if (ENVIRONMENT_IS_WORKER) { + readBinary = (url) => { + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + xhr.responseType = 'arraybuffer'; + xhr.send(null); + return new Uint8Array(xhr.response); + }; + } + + readAsync = (url) => { + return fetch(url, { credentials: 'same-origin' }).then((response) => { + if (response.ok) { + return response.arrayBuffer(); + } + return Promise.reject( + new Error(response.status + ' : ' + response.url), + ); + }); + }; + } + } else { + } + + var out = Module['print'] || console.log.bind(console); + var err = Module['printErr'] || console.error.bind(console); + + Object.assign(Module, moduleOverrides); + + moduleOverrides = null; + + if (Module['arguments']) arguments_ = Module['arguments']; + + if (Module['thisProgram']) thisProgram = Module['thisProgram']; + + var wasmBinary = Module['wasmBinary']; + + var wasmMemory; + + var ABORT = false; + + var EXITSTATUS; + + function assert(condition, text) { + if (!condition) { + abort(text); + } + } + + var HEAP, + HEAP8, + HEAPU8, + HEAP16, + HEAPU16, + HEAP32, + HEAPU32, + HEAPF32, + HEAP64, + HEAPU64, + HEAPF64; + + function updateMemoryViews() { + var b = wasmMemory.buffer; + Module['HEAP8'] = HEAP8 = new Int8Array(b); + Module['HEAP16'] = HEAP16 = new Int16Array(b); + Module['HEAPU8'] = HEAPU8 = new Uint8Array(b); + Module['HEAPU16'] = HEAPU16 = new Uint16Array(b); + Module['HEAP32'] = HEAP32 = new Int32Array(b); + Module['HEAPU32'] = HEAPU32 = new Uint32Array(b); + Module['HEAPF32'] = HEAPF32 = new Float32Array(b); + Module['HEAPF64'] = HEAPF64 = new Float64Array(b); + Module['HEAP64'] = HEAP64 = new BigInt64Array(b); + Module['HEAPU64'] = HEAPU64 = new BigUint64Array(b); + } + + if (Module['wasmMemory']) { + wasmMemory = Module['wasmMemory']; + } else { + var INITIAL_MEMORY = Module['INITIAL_MEMORY'] || 16777216; + + wasmMemory = new WebAssembly.Memory({ + initial: INITIAL_MEMORY / 65536, + + maximum: 32768, + }); + } + + updateMemoryViews(); + + var __ATPRERUN__ = []; + var __ATINIT__ = []; + var __ATEXIT__ = []; + var __ATPOSTRUN__ = []; + + var runtimeInitialized = false; + + function preRun() { + var preRuns = Module['preRun']; + if (preRuns) { + if (typeof preRuns == 'function') preRuns = [preRuns]; + preRuns.forEach(addOnPreRun); + } + callRuntimeCallbacks(__ATPRERUN__); + } + + function initRuntime() { + runtimeInitialized = true; + + if (!Module['noFSInit'] && !FS.initialized) FS.init(); + FS.ignorePermissions = false; + + TTY.init(); + callRuntimeCallbacks(__ATINIT__); + } + + function postRun() { + var postRuns = Module['postRun']; + if (postRuns) { + if (typeof postRuns == 'function') postRuns = [postRuns]; + postRuns.forEach(addOnPostRun); + } + + callRuntimeCallbacks(__ATPOSTRUN__); + } + + function addOnPreRun(cb) { + __ATPRERUN__.unshift(cb); + } + + function addOnInit(cb) { + __ATINIT__.unshift(cb); + } + + function addOnExit(cb) {} + + function addOnPostRun(cb) { + __ATPOSTRUN__.unshift(cb); + } + + var runDependencies = 0; + var runDependencyWatcher = null; + var dependenciesFulfilled = null; + + function getUniqueRunDependency(id) { + return id; + } + + function addRunDependency(id) { + runDependencies++; + + Module['monitorRunDependencies']?.(runDependencies); + } + + function removeRunDependency(id) { + runDependencies--; + + Module['monitorRunDependencies']?.(runDependencies); + + if (runDependencies == 0) { + if (runDependencyWatcher !== null) { + clearInterval(runDependencyWatcher); + runDependencyWatcher = null; + } + if (dependenciesFulfilled) { + var callback = dependenciesFulfilled; + dependenciesFulfilled = null; + callback(); + } + } + } + + function abort(what) { + Module['onAbort']?.(what); + + what = 'Aborted(' + what + ')'; + + err(what); + + ABORT = true; + + what += '. Build with -sASSERTIONS for more info.'; + + var e = new WebAssembly.RuntimeError(what); + + readyPromiseReject(e); + + throw e; + } + + var dataURIPrefix = 'data:application/octet-stream;base64,'; + + var isDataURI = (filename) => filename.startsWith(dataURIPrefix); + + var isFileURI = (filename) => filename.startsWith('file://'); + + function findWasmBinary() { + if (Module['locateFile']) { + var f = 'sqlite3.wasm'; + if (!isDataURI(f)) { + return locateFile(f); + } + return f; + } + + return new URL('sqlite3.wasm', import.meta.url).href; + } + + var wasmBinaryFile; + + function getBinarySync(file) { + if (file == wasmBinaryFile && wasmBinary) { + return new Uint8Array(wasmBinary); + } + if (readBinary) { + return readBinary(file); + } + throw 'both async and sync fetching of the wasm failed'; + } + + function getBinaryPromise(binaryFile) { + if (!wasmBinary) { + return readAsync(binaryFile).then( + (response) => new Uint8Array(response), + + () => getBinarySync(binaryFile), + ); + } + + return Promise.resolve().then(() => getBinarySync(binaryFile)); + } + + function instantiateArrayBuffer(binaryFile, imports, receiver) { + return getBinaryPromise(binaryFile) + .then((binary) => { + return WebAssembly.instantiate(binary, imports); + }) + .then(receiver, (reason) => { + err(`failed to asynchronously prepare wasm: ${reason}`); + + abort(reason); + }); + } + + function instantiateAsync(binary, binaryFile, imports, callback) { + if ( + !binary && + typeof WebAssembly.instantiateStreaming == 'function' && + !isDataURI(binaryFile) && + typeof fetch == 'function' + ) { + return fetch(binaryFile, { credentials: 'same-origin' }).then( + (response) => { + var result = WebAssembly.instantiateStreaming(response, imports); + + return result.then(callback, function (reason) { + err(`wasm streaming compile failed: ${reason}`); + err('falling back to ArrayBuffer instantiation'); + return instantiateArrayBuffer(binaryFile, imports, callback); + }); + }, + ); + } + return instantiateArrayBuffer(binaryFile, imports, callback); + } + + function getWasmImports() { + return { + env: wasmImports, + wasi_snapshot_preview1: wasmImports, + }; + } + + function createWasm() { + var info = getWasmImports(); + + function receiveInstance(instance, module) { + wasmExports = instance.exports; + + addOnInit(wasmExports['__wasm_call_ctors']); + + removeRunDependency('wasm-instantiate'); + return wasmExports; + } + + addRunDependency('wasm-instantiate'); + + function receiveInstantiationResult(result) { + receiveInstance(result['instance']); + } + + if (Module['instantiateWasm']) { + try { + return Module['instantiateWasm'](info, receiveInstance); + } catch (e) { + err(`Module.instantiateWasm callback failed with error: ${e}`); + + readyPromiseReject(e); + } + } + + wasmBinaryFile ??= findWasmBinary(); + + instantiateAsync( + wasmBinary, + wasmBinaryFile, + info, + receiveInstantiationResult, + ).catch(readyPromiseReject); + return {}; + } + + function ExitStatus(status) { + this.name = 'ExitStatus'; + this.message = `Program terminated with exit(${status})`; + this.status = status; + } + + var callRuntimeCallbacks = (callbacks) => { + callbacks.forEach((f) => f(Module)); + }; + + function getValue(ptr, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': + return HEAP8[ptr]; + case 'i8': + return HEAP8[ptr]; + case 'i16': + return HEAP16[ptr >> 1]; + case 'i32': + return HEAP32[ptr >> 2]; + case 'i64': + return HEAP64[ptr >> 3]; + case 'float': + return HEAPF32[ptr >> 2]; + case 'double': + return HEAPF64[ptr >> 3]; + case '*': + return HEAPU32[ptr >> 2]; + default: + abort(`invalid type for getValue: ${type}`); + } + } + + var noExitRuntime = Module['noExitRuntime'] || true; + + function setValue(ptr, value, type = 'i8') { + if (type.endsWith('*')) type = '*'; + switch (type) { + case 'i1': + HEAP8[ptr] = value; + break; + case 'i8': + HEAP8[ptr] = value; + break; + case 'i16': + HEAP16[ptr >> 1] = value; + break; + case 'i32': + HEAP32[ptr >> 2] = value; + break; + case 'i64': + HEAP64[ptr >> 3] = BigInt(value); + break; + case 'float': + HEAPF32[ptr >> 2] = value; + break; + case 'double': + HEAPF64[ptr >> 3] = value; + break; + case '*': + HEAPU32[ptr >> 2] = value; + break; + default: + abort(`invalid type for setValue: ${type}`); + } + } + + var stackRestore = (val) => __emscripten_stack_restore(val); + + var stackSave = () => _emscripten_stack_get_current(); + + var PATH = { + isAbs: (path) => path.charAt(0) === '/', + splitPath: (filename) => { + var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; + return splitPathRe.exec(filename).slice(1); + }, + normalizeArray: (parts, allowAboveRoot) => { + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } + + if (allowAboveRoot) { + for (; up; up--) { + parts.unshift('..'); + } + } + return parts; + }, + normalize: (path) => { + var isAbsolute = PATH.isAbs(path), + trailingSlash = path.substr(-1) === '/'; + + path = PATH.normalizeArray( + path.split('/').filter((p) => !!p), + !isAbsolute, + ).join('/'); + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + return (isAbsolute ? '/' : '') + path; + }, + dirname: (path) => { + var result = PATH.splitPath(path), + root = result[0], + dir = result[1]; + if (!root && !dir) { + return '.'; + } + if (dir) { + dir = dir.substr(0, dir.length - 1); + } + return root + dir; + }, + basename: (path) => { + if (path === '/') return '/'; + path = PATH.normalize(path); + path = path.replace(/\/$/, ''); + var lastSlash = path.lastIndexOf('/'); + if (lastSlash === -1) return path; + return path.substr(lastSlash + 1); + }, + join: (...paths) => PATH.normalize(paths.join('/')), + join2: (l, r) => PATH.normalize(l + '/' + r), + }; + + var initRandomFill = () => { + if ( + typeof crypto == 'object' && + typeof crypto['getRandomValues'] == 'function' + ) { + return (view) => crypto.getRandomValues(view); + } else abort('initRandomDevice'); + }; + var randomFill = (view) => { + return (randomFill = initRandomFill())(view); + }; + + var PATH_FS = { + resolve: (...args) => { + var resolvedPath = '', + resolvedAbsolute = false; + for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = i >= 0 ? args[i] : FS.cwd(); + + if (typeof path != 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + return ''; + } + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = PATH.isAbs(path); + } + + resolvedPath = PATH.normalizeArray( + resolvedPath.split('/').filter((p) => !!p), + !resolvedAbsolute, + ).join('/'); + return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'; + }, + relative: (from, to) => { + from = PATH_FS.resolve(from).substr(1); + to = PATH_FS.resolve(to).substr(1); + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } + if (start > end) return []; + return arr.slice(start, end - start + 1); + } + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + return outputParts.join('/'); + }, + }; + + var UTF8Decoder = + typeof TextDecoder != 'undefined' ? new TextDecoder() : undefined; + + var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => { + var endIdx = idx + maxBytesToRead; + var endPtr = idx; + + while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; + + if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { + return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); + } + var str = ''; + + while (idx < endPtr) { + var u0 = heapOrArray[idx++]; + if (!(u0 & 0x80)) { + str += String.fromCharCode(u0); + continue; + } + var u1 = heapOrArray[idx++] & 63; + if ((u0 & 0xe0) == 0xc0) { + str += String.fromCharCode(((u0 & 31) << 6) | u1); + continue; + } + var u2 = heapOrArray[idx++] & 63; + if ((u0 & 0xf0) == 0xe0) { + u0 = ((u0 & 15) << 12) | (u1 << 6) | u2; + } else { + u0 = + ((u0 & 7) << 18) | + (u1 << 12) | + (u2 << 6) | + (heapOrArray[idx++] & 63); + } + + if (u0 < 0x10000) { + str += String.fromCharCode(u0); + } else { + var ch = u0 - 0x10000; + str += String.fromCharCode( + 0xd800 | (ch >> 10), + 0xdc00 | (ch & 0x3ff), + ); + } + } + return str; + }; + + var FS_stdin_getChar_buffer = []; + + var lengthBytesUTF8 = (str) => { + var len = 0; + for (var i = 0; i < str.length; ++i) { + var c = str.charCodeAt(i); + if (c <= 0x7f) { + len++; + } else if (c <= 0x7ff) { + len += 2; + } else if (c >= 0xd800 && c <= 0xdfff) { + len += 4; + ++i; + } else { + len += 3; + } + } + return len; + }; + + var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => { + if (!(maxBytesToWrite > 0)) return 0; + + var startIdx = outIdx; + var endIdx = outIdx + maxBytesToWrite - 1; + for (var i = 0; i < str.length; ++i) { + var u = str.charCodeAt(i); + if (u >= 0xd800 && u <= 0xdfff) { + var u1 = str.charCodeAt(++i); + u = (0x10000 + ((u & 0x3ff) << 10)) | (u1 & 0x3ff); + } + if (u <= 0x7f) { + if (outIdx >= endIdx) break; + heap[outIdx++] = u; + } else if (u <= 0x7ff) { + if (outIdx + 1 >= endIdx) break; + heap[outIdx++] = 0xc0 | (u >> 6); + heap[outIdx++] = 0x80 | (u & 63); + } else if (u <= 0xffff) { + if (outIdx + 2 >= endIdx) break; + heap[outIdx++] = 0xe0 | (u >> 12); + heap[outIdx++] = 0x80 | ((u >> 6) & 63); + heap[outIdx++] = 0x80 | (u & 63); + } else { + if (outIdx + 3 >= endIdx) break; + heap[outIdx++] = 0xf0 | (u >> 18); + heap[outIdx++] = 0x80 | ((u >> 12) & 63); + heap[outIdx++] = 0x80 | ((u >> 6) & 63); + heap[outIdx++] = 0x80 | (u & 63); + } + } + + heap[outIdx] = 0; + return outIdx - startIdx; + }; + + function intArrayFromString(stringy, dontAddNull, length) { + var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; + var u8array = new Array(len); + var numBytesWritten = stringToUTF8Array( + stringy, + u8array, + 0, + u8array.length, + ); + if (dontAddNull) u8array.length = numBytesWritten; + return u8array; + } + var FS_stdin_getChar = () => { + if (!FS_stdin_getChar_buffer.length) { + var result = null; + if ( + typeof window != 'undefined' && + typeof window.prompt == 'function' + ) { + result = window.prompt('Input: '); + if (result !== null) { + result += '\n'; + } + } else { + } + if (!result) { + return null; + } + FS_stdin_getChar_buffer = intArrayFromString(result, true); + } + return FS_stdin_getChar_buffer.shift(); + }; + var TTY = { + ttys: [], + init() {}, + shutdown() {}, + register(dev, ops) { + TTY.ttys[dev] = { input: [], output: [], ops: ops }; + FS.registerDevice(dev, TTY.stream_ops); + }, + stream_ops: { + open(stream) { + var tty = TTY.ttys[stream.node.rdev]; + if (!tty) { + throw new FS.ErrnoError(43); + } + stream.tty = tty; + stream.seekable = false; + }, + close(stream) { + stream.tty.ops.fsync(stream.tty); + }, + fsync(stream) { + stream.tty.ops.fsync(stream.tty); + }, + read(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.get_char) { + throw new FS.ErrnoError(60); + } + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = stream.tty.ops.get_char(stream.tty); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + if (!stream.tty || !stream.tty.ops.put_char) { + throw new FS.ErrnoError(60); + } + try { + for (var i = 0; i < length; i++) { + stream.tty.ops.put_char(stream.tty, buffer[offset + i]); + } + } catch (e) { + throw new FS.ErrnoError(29); + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }, + default_tty_ops: { + get_char(tty) { + return FS_stdin_getChar(); + }, + put_char(tty, val) { + if (val === null || val === 10) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + out(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + ioctl_tcgets(tty) { + return { + c_iflag: 25856, + c_oflag: 5, + c_cflag: 191, + c_lflag: 35387, + c_cc: [ + 0x03, 0x1c, 0x7f, 0x15, 0x04, 0x00, 0x01, 0x00, 0x11, 0x13, 0x1a, + 0x00, 0x12, 0x0f, 0x17, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + ], + }; + }, + ioctl_tcsets(tty, optional_actions, data) { + return 0; + }, + ioctl_tiocgwinsz(tty) { + return [24, 80]; + }, + }, + default_tty1_ops: { + put_char(tty, val) { + if (val === null || val === 10) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } else { + if (val != 0) tty.output.push(val); + } + }, + fsync(tty) { + if (tty.output && tty.output.length > 0) { + err(UTF8ArrayToString(tty.output)); + tty.output = []; + } + }, + }, + }; + + var zeroMemory = (address, size) => { + HEAPU8.fill(0, address, address + size); + }; + + var alignMemory = (size, alignment) => { + return Math.ceil(size / alignment) * alignment; + }; + var mmapAlloc = (size) => { + size = alignMemory(size, 65536); + var ptr = _emscripten_builtin_memalign(65536, size); + if (ptr) zeroMemory(ptr, size); + return ptr; + }; + var MEMFS = { + ops_table: null, + mount(mount) { + return MEMFS.createNode(null, '/', 16384 | 511, 0); + }, + createNode(parent, name, mode, dev) { + if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { + throw new FS.ErrnoError(63); + } + MEMFS.ops_table ||= { + dir: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + lookup: MEMFS.node_ops.lookup, + mknod: MEMFS.node_ops.mknod, + rename: MEMFS.node_ops.rename, + unlink: MEMFS.node_ops.unlink, + rmdir: MEMFS.node_ops.rmdir, + readdir: MEMFS.node_ops.readdir, + symlink: MEMFS.node_ops.symlink, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + }, + }, + file: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: { + llseek: MEMFS.stream_ops.llseek, + read: MEMFS.stream_ops.read, + write: MEMFS.stream_ops.write, + allocate: MEMFS.stream_ops.allocate, + mmap: MEMFS.stream_ops.mmap, + msync: MEMFS.stream_ops.msync, + }, + }, + link: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + readlink: MEMFS.node_ops.readlink, + }, + stream: {}, + }, + chrdev: { + node: { + getattr: MEMFS.node_ops.getattr, + setattr: MEMFS.node_ops.setattr, + }, + stream: FS.chrdev_stream_ops, + }, + }; + var node = FS.createNode(parent, name, mode, dev); + if (FS.isDir(node.mode)) { + node.node_ops = MEMFS.ops_table.dir.node; + node.stream_ops = MEMFS.ops_table.dir.stream; + node.contents = {}; + } else if (FS.isFile(node.mode)) { + node.node_ops = MEMFS.ops_table.file.node; + node.stream_ops = MEMFS.ops_table.file.stream; + node.usedBytes = 0; + + node.contents = null; + } else if (FS.isLink(node.mode)) { + node.node_ops = MEMFS.ops_table.link.node; + node.stream_ops = MEMFS.ops_table.link.stream; + } else if (FS.isChrdev(node.mode)) { + node.node_ops = MEMFS.ops_table.chrdev.node; + node.stream_ops = MEMFS.ops_table.chrdev.stream; + } + node.timestamp = Date.now(); + + if (parent) { + parent.contents[name] = node; + parent.timestamp = node.timestamp; + } + return node; + }, + getFileDataAsTypedArray(node) { + if (!node.contents) return new Uint8Array(0); + if (node.contents.subarray) + return node.contents.subarray(0, node.usedBytes); + return new Uint8Array(node.contents); + }, + expandFileStorage(node, newCapacity) { + var prevCapacity = node.contents ? node.contents.length : 0; + if (prevCapacity >= newCapacity) return; + + var CAPACITY_DOUBLING_MAX = 1024 * 1024; + newCapacity = Math.max( + newCapacity, + (prevCapacity * + (prevCapacity < CAPACITY_DOUBLING_MAX ? 2.0 : 1.125)) >>> + 0, + ); + if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256); + var oldContents = node.contents; + node.contents = new Uint8Array(newCapacity); + if (node.usedBytes > 0) + node.contents.set(oldContents.subarray(0, node.usedBytes), 0); + }, + resizeFileStorage(node, newSize) { + if (node.usedBytes == newSize) return; + if (newSize == 0) { + node.contents = null; + node.usedBytes = 0; + } else { + var oldContents = node.contents; + node.contents = new Uint8Array(newSize); + if (oldContents) { + node.contents.set( + oldContents.subarray(0, Math.min(newSize, node.usedBytes)), + ); + } + node.usedBytes = newSize; + } + }, + node_ops: { + getattr(node) { + var attr = {}; + + attr.dev = FS.isChrdev(node.mode) ? node.id : 1; + attr.ino = node.id; + attr.mode = node.mode; + attr.nlink = 1; + attr.uid = 0; + attr.gid = 0; + attr.rdev = node.rdev; + if (FS.isDir(node.mode)) { + attr.size = 4096; + } else if (FS.isFile(node.mode)) { + attr.size = node.usedBytes; + } else if (FS.isLink(node.mode)) { + attr.size = node.link.length; + } else { + attr.size = 0; + } + attr.atime = new Date(node.timestamp); + attr.mtime = new Date(node.timestamp); + attr.ctime = new Date(node.timestamp); + + attr.blksize = 4096; + attr.blocks = Math.ceil(attr.size / attr.blksize); + return attr; + }, + setattr(node, attr) { + if (attr.mode !== undefined) { + node.mode = attr.mode; + } + if (attr.timestamp !== undefined) { + node.timestamp = attr.timestamp; + } + if (attr.size !== undefined) { + MEMFS.resizeFileStorage(node, attr.size); + } + }, + lookup(parent, name) { + throw FS.genericErrors[44]; + }, + mknod(parent, name, mode, dev) { + return MEMFS.createNode(parent, name, mode, dev); + }, + rename(old_node, new_dir, new_name) { + if (FS.isDir(old_node.mode)) { + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + if (new_node) { + for (var i in new_node.contents) { + throw new FS.ErrnoError(55); + } + } + } + + delete old_node.parent.contents[old_node.name]; + old_node.parent.timestamp = Date.now(); + old_node.name = new_name; + new_dir.contents[new_name] = old_node; + new_dir.timestamp = old_node.parent.timestamp; + }, + unlink(parent, name) { + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + rmdir(parent, name) { + var node = FS.lookupNode(parent, name); + for (var i in node.contents) { + throw new FS.ErrnoError(55); + } + delete parent.contents[name]; + parent.timestamp = Date.now(); + }, + readdir(node) { + var entries = ['.', '..']; + for (var key of Object.keys(node.contents)) { + entries.push(key); + } + return entries; + }, + symlink(parent, newname, oldpath) { + var node = MEMFS.createNode(parent, newname, 511 | 40960, 0); + node.link = oldpath; + return node; + }, + readlink(node) { + if (!FS.isLink(node.mode)) { + throw new FS.ErrnoError(28); + } + return node.link; + }, + }, + stream_ops: { + read(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= stream.node.usedBytes) return 0; + var size = Math.min(stream.node.usedBytes - position, length); + if (size > 8 && contents.subarray) { + buffer.set(contents.subarray(position, position + size), offset); + } else { + for (var i = 0; i < size; i++) + buffer[offset + i] = contents[position + i]; + } + return size; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (buffer.buffer === HEAP8.buffer) { + canOwn = false; + } + + if (!length) return 0; + var node = stream.node; + node.timestamp = Date.now(); + + if (buffer.subarray && (!node.contents || node.contents.subarray)) { + if (canOwn) { + node.contents = buffer.subarray(offset, offset + length); + node.usedBytes = length; + return length; + } else if (node.usedBytes === 0 && position === 0) { + node.contents = buffer.slice(offset, offset + length); + node.usedBytes = length; + return length; + } else if (position + length <= node.usedBytes) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + return length; + } + } + + MEMFS.expandFileStorage(node, position + length); + if (node.contents.subarray && buffer.subarray) { + node.contents.set( + buffer.subarray(offset, offset + length), + position, + ); + } else { + for (var i = 0; i < length; i++) { + node.contents[position + i] = buffer[offset + i]; + } + } + node.usedBytes = Math.max(node.usedBytes, position + length); + return length; + }, + llseek(stream, offset, whence) { + var position = offset; + if (whence === 1) { + position += stream.position; + } else if (whence === 2) { + if (FS.isFile(stream.node.mode)) { + position += stream.node.usedBytes; + } + } + if (position < 0) { + throw new FS.ErrnoError(28); + } + return position; + }, + allocate(stream, offset, length) { + MEMFS.expandFileStorage(stream.node, offset + length); + stream.node.usedBytes = Math.max( + stream.node.usedBytes, + offset + length, + ); + }, + mmap(stream, length, position, prot, flags) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + var ptr; + var allocated; + var contents = stream.node.contents; + + if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) { + allocated = false; + ptr = contents.byteOffset; + } else { + allocated = true; + ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + if (contents) { + if (position > 0 || position + length < contents.length) { + if (contents.subarray) { + contents = contents.subarray(position, position + length); + } else { + contents = Array.prototype.slice.call( + contents, + position, + position + length, + ); + } + } + HEAP8.set(contents, ptr); + } + } + return { ptr, allocated }; + }, + msync(stream, buffer, offset, length, mmapFlags) { + MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false); + + return 0; + }, + }, + }; + + var asyncLoad = (url, onload, onerror, noRunDep) => { + var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : ''; + readAsync(url).then( + (arrayBuffer) => { + onload(new Uint8Array(arrayBuffer)); + if (dep) removeRunDependency(dep); + }, + (err) => { + if (onerror) { + onerror(); + } else { + throw `Loading data file "${url}" failed.`; + } + }, + ); + if (dep) addRunDependency(dep); + }; + + var FS_createDataFile = ( + parent, + name, + fileData, + canRead, + canWrite, + canOwn, + ) => { + FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn); + }; + + var preloadPlugins = Module['preloadPlugins'] || []; + var FS_handledByPreloadPlugin = (byteArray, fullname, finish, onerror) => { + if (typeof Browser != 'undefined') Browser.init(); + + var handled = false; + preloadPlugins.forEach((plugin) => { + if (handled) return; + if (plugin['canHandle'](fullname)) { + plugin['handle'](byteArray, fullname, finish, onerror); + handled = true; + } + }); + return handled; + }; + var FS_createPreloadedFile = ( + parent, + name, + url, + canRead, + canWrite, + onload, + onerror, + dontCreateFile, + canOwn, + preFinish, + ) => { + var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent; + var dep = getUniqueRunDependency(`cp ${fullname}`); + function processData(byteArray) { + function finish(byteArray) { + preFinish?.(); + if (!dontCreateFile) { + FS_createDataFile( + parent, + name, + byteArray, + canRead, + canWrite, + canOwn, + ); + } + onload?.(); + removeRunDependency(dep); + } + if ( + FS_handledByPreloadPlugin(byteArray, fullname, finish, () => { + onerror?.(); + removeRunDependency(dep); + }) + ) { + return; + } + finish(byteArray); + } + addRunDependency(dep); + if (typeof url == 'string') { + asyncLoad(url, processData, onerror); + } else { + processData(url); + } + }; + + var FS_modeStringToFlags = (str) => { + var flagModes = { + r: 0, + 'r+': 2, + w: 512 | 64 | 1, + 'w+': 512 | 64 | 2, + a: 1024 | 64 | 1, + 'a+': 1024 | 64 | 2, + }; + var flags = flagModes[str]; + if (typeof flags == 'undefined') { + throw new Error(`Unknown file open mode: ${str}`); + } + return flags; + }; + + var FS_getMode = (canRead, canWrite) => { + var mode = 0; + if (canRead) mode |= 292 | 73; + if (canWrite) mode |= 146; + return mode; + }; + + var FS = { + root: null, + mounts: [], + devices: {}, + streams: [], + nextInode: 1, + nameTable: null, + currentPath: '/', + initialized: false, + ignorePermissions: true, + ErrnoError: class { + constructor(errno) { + this.name = 'ErrnoError'; + this.errno = errno; + } + }, + genericErrors: {}, + filesystems: null, + syncFSRequests: 0, + readFiles: {}, + FSStream: class { + constructor() { + this.shared = {}; + } + get object() { + return this.node; + } + set object(val) { + this.node = val; + } + 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(val) { + this.shared.flags = val; + } + get position() { + return this.shared.position; + } + set position(val) { + this.shared.position = val; + } + }, + FSNode: class { + constructor(parent, name, mode, rdev) { + if (!parent) { + parent = this; + } + this.parent = parent; + this.mount = parent.mount; + this.mounted = null; + this.id = FS.nextInode++; + this.name = name; + this.mode = mode; + this.node_ops = {}; + this.stream_ops = {}; + this.rdev = rdev; + this.readMode = 292 | 73; + this.writeMode = 146; + } + get read() { + return (this.mode & this.readMode) === this.readMode; + } + set read(val) { + val ? (this.mode |= this.readMode) : (this.mode &= ~this.readMode); + } + get write() { + return (this.mode & this.writeMode) === this.writeMode; + } + set write(val) { + val ? (this.mode |= this.writeMode) : (this.mode &= ~this.writeMode); + } + get isFolder() { + return FS.isDir(this.mode); + } + get isDevice() { + return FS.isChrdev(this.mode); + } + }, + lookupPath(path, opts = {}) { + path = PATH_FS.resolve(path); + + if (!path) return { path: '', node: null }; + + var defaults = { + follow_mount: true, + recurse_count: 0, + }; + opts = Object.assign(defaults, opts); + + if (opts.recurse_count > 8) { + throw new FS.ErrnoError(32); + } + + var parts = path.split('/').filter((p) => !!p); + + var current = FS.root; + var current_path = '/'; + + for (var i = 0; i < parts.length; i++) { + var islast = i === parts.length - 1; + if (islast && opts.parent) { + break; + } + + current = FS.lookupNode(current, parts[i]); + current_path = PATH.join2(current_path, parts[i]); + + if (FS.isMountpoint(current)) { + if (!islast || (islast && opts.follow_mount)) { + current = current.mounted.root; + } + } + + if (!islast || opts.follow) { + var count = 0; + while (FS.isLink(current.mode)) { + var link = FS.readlink(current_path); + current_path = PATH_FS.resolve(PATH.dirname(current_path), link); + + var lookup = FS.lookupPath(current_path, { + recurse_count: opts.recurse_count + 1, + }); + current = lookup.node; + + if (count++ > 40) { + throw new FS.ErrnoError(32); + } + } + } + } + + return { path: current_path, node: current }; + }, + getPath(node) { + var path; + while (true) { + if (FS.isRoot(node)) { + var mount = node.mount.mountpoint; + if (!path) return mount; + return mount[mount.length - 1] !== '/' + ? `${mount}/${path}` + : mount + path; + } + path = path ? `${node.name}/${path}` : node.name; + node = node.parent; + } + }, + hashName(parentid, name) { + var hash = 0; + + for (var i = 0; i < name.length; i++) { + hash = ((hash << 5) - hash + name.charCodeAt(i)) | 0; + } + return ((parentid + hash) >>> 0) % FS.nameTable.length; + }, + hashAddNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + node.name_next = FS.nameTable[hash]; + FS.nameTable[hash] = node; + }, + hashRemoveNode(node) { + var hash = FS.hashName(node.parent.id, node.name); + if (FS.nameTable[hash] === node) { + FS.nameTable[hash] = node.name_next; + } else { + var current = FS.nameTable[hash]; + while (current) { + if (current.name_next === node) { + current.name_next = node.name_next; + break; + } + current = current.name_next; + } + } + }, + lookupNode(parent, name) { + var errCode = FS.mayLookup(parent); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + var hash = FS.hashName(parent.id, name); + for (var node = FS.nameTable[hash]; node; node = node.name_next) { + var nodeName = node.name; + if (node.parent.id === parent.id && nodeName === name) { + return node; + } + } + + return FS.lookup(parent, name); + }, + createNode(parent, name, mode, rdev) { + var node = new FS.FSNode(parent, name, mode, rdev); + + FS.hashAddNode(node); + + return node; + }, + destroyNode(node) { + FS.hashRemoveNode(node); + }, + isRoot(node) { + return node === node.parent; + }, + isMountpoint(node) { + return !!node.mounted; + }, + isFile(mode) { + return (mode & 61440) === 32768; + }, + isDir(mode) { + return (mode & 61440) === 16384; + }, + isLink(mode) { + return (mode & 61440) === 40960; + }, + isChrdev(mode) { + return (mode & 61440) === 8192; + }, + isBlkdev(mode) { + return (mode & 61440) === 24576; + }, + isFIFO(mode) { + return (mode & 61440) === 4096; + }, + isSocket(mode) { + return (mode & 49152) === 49152; + }, + flagsToPermissionString(flag) { + var perms = ['r', 'w', 'rw'][flag & 3]; + if (flag & 512) { + perms += 'w'; + } + return perms; + }, + nodePermissions(node, perms) { + if (FS.ignorePermissions) { + return 0; + } + + if (perms.includes('r') && !(node.mode & 292)) { + return 2; + } else if (perms.includes('w') && !(node.mode & 146)) { + return 2; + } else if (perms.includes('x') && !(node.mode & 73)) { + return 2; + } + return 0; + }, + mayLookup(dir) { + if (!FS.isDir(dir.mode)) return 54; + var errCode = FS.nodePermissions(dir, 'x'); + if (errCode) return errCode; + if (!dir.node_ops.lookup) return 2; + return 0; + }, + mayCreate(dir, name) { + try { + var node = FS.lookupNode(dir, name); + return 20; + } catch (e) {} + return FS.nodePermissions(dir, 'wx'); + }, + mayDelete(dir, name, isdir) { + var node; + try { + node = FS.lookupNode(dir, name); + } catch (e) { + return e.errno; + } + var errCode = FS.nodePermissions(dir, 'wx'); + if (errCode) { + return errCode; + } + if (isdir) { + if (!FS.isDir(node.mode)) { + return 54; + } + if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) { + return 10; + } + } else { + if (FS.isDir(node.mode)) { + return 31; + } + } + return 0; + }, + mayOpen(node, flags) { + if (!node) { + return 44; + } + if (FS.isLink(node.mode)) { + return 32; + } else if (FS.isDir(node.mode)) { + if (FS.flagsToPermissionString(flags) !== 'r' || flags & 512) { + return 31; + } + } + return FS.nodePermissions(node, FS.flagsToPermissionString(flags)); + }, + MAX_OPEN_FDS: 4096, + nextfd() { + for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) { + if (!FS.streams[fd]) { + return fd; + } + } + throw new FS.ErrnoError(33); + }, + getStreamChecked(fd) { + var stream = FS.getStream(fd); + if (!stream) { + throw new FS.ErrnoError(8); + } + return stream; + }, + getStream: (fd) => FS.streams[fd], + createStream(stream, fd = -1) { + stream = Object.assign(new FS.FSStream(), stream); + if (fd == -1) { + fd = FS.nextfd(); + } + stream.fd = fd; + FS.streams[fd] = stream; + return stream; + }, + closeStream(fd) { + FS.streams[fd] = null; + }, + dupStream(origStream, fd = -1) { + var stream = FS.createStream(origStream, fd); + stream.stream_ops?.dup?.(stream); + return stream; + }, + chrdev_stream_ops: { + open(stream) { + var device = FS.getDevice(stream.node.rdev); + + stream.stream_ops = device.stream_ops; + + stream.stream_ops.open?.(stream); + }, + llseek() { + throw new FS.ErrnoError(70); + }, + }, + major: (dev) => dev >> 8, + minor: (dev) => dev & 0xff, + makedev: (ma, mi) => (ma << 8) | mi, + registerDevice(dev, ops) { + FS.devices[dev] = { stream_ops: ops }; + }, + getDevice: (dev) => FS.devices[dev], + getMounts(mount) { + var mounts = []; + var check = [mount]; + + while (check.length) { + var m = check.pop(); + + mounts.push(m); + + check.push(...m.mounts); + } + + return mounts; + }, + syncfs(populate, callback) { + if (typeof populate == 'function') { + callback = populate; + populate = false; + } + + FS.syncFSRequests++; + + if (FS.syncFSRequests > 1) { + err( + `warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`, + ); + } + + var mounts = FS.getMounts(FS.root.mount); + var completed = 0; + + function doCallback(errCode) { + FS.syncFSRequests--; + return callback(errCode); + } + + function done(errCode) { + if (errCode) { + if (!done.errored) { + done.errored = true; + return doCallback(errCode); + } + return; + } + if (++completed >= mounts.length) { + doCallback(null); + } + } + + mounts.forEach((mount) => { + if (!mount.type.syncfs) { + return done(null); + } + mount.type.syncfs(mount, populate, done); + }); + }, + mount(type, opts, mountpoint) { + var root = mountpoint === '/'; + var pseudo = !mountpoint; + var node; + + if (root && FS.root) { + throw new FS.ErrnoError(10); + } else if (!root && !pseudo) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + + mountpoint = lookup.path; + node = lookup.node; + + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + + if (!FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + } + + var mount = { + type, + opts, + mountpoint, + mounts: [], + }; + + var mountRoot = type.mount(mount); + mountRoot.mount = mount; + mount.root = mountRoot; + + if (root) { + FS.root = mountRoot; + } else if (node) { + node.mounted = mount; + + if (node.mount) { + node.mount.mounts.push(mount); + } + } + + return mountRoot; + }, + unmount(mountpoint) { + var lookup = FS.lookupPath(mountpoint, { follow_mount: false }); + + if (!FS.isMountpoint(lookup.node)) { + throw new FS.ErrnoError(28); + } + + var node = lookup.node; + var mount = node.mounted; + var mounts = FS.getMounts(mount); + + Object.keys(FS.nameTable).forEach((hash) => { + var current = FS.nameTable[hash]; + + while (current) { + var next = current.name_next; + + if (mounts.includes(current.mount)) { + FS.destroyNode(current); + } + + current = next; + } + }); + + node.mounted = null; + + var idx = node.mount.mounts.indexOf(mount); + node.mount.mounts.splice(idx, 1); + }, + lookup(parent, name) { + return parent.node_ops.lookup(parent, name); + }, + mknod(path, mode, dev) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + if (!name || name === '.' || name === '..') { + throw new FS.ErrnoError(28); + } + var errCode = FS.mayCreate(parent, name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.mknod) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.mknod(parent, name, mode, dev); + }, + create(path, mode) { + mode = mode !== undefined ? mode : 438; + mode &= 4095; + mode |= 32768; + return FS.mknod(path, mode, 0); + }, + mkdir(path, mode) { + mode = mode !== undefined ? mode : 511; + mode &= 511 | 512; + mode |= 16384; + return FS.mknod(path, mode, 0); + }, + mkdirTree(path, mode) { + var dirs = path.split('/'); + var d = ''; + for (var i = 0; i < dirs.length; ++i) { + if (!dirs[i]) continue; + d += '/' + dirs[i]; + try { + FS.mkdir(d, mode); + } catch (e) { + if (e.errno != 20) throw e; + } + } + }, + mkdev(path, mode, dev) { + if (typeof dev == 'undefined') { + dev = mode; + mode = 438; + } + mode |= 8192; + return FS.mknod(path, mode, dev); + }, + symlink(oldpath, newpath) { + if (!PATH_FS.resolve(oldpath)) { + throw new FS.ErrnoError(44); + } + var lookup = FS.lookupPath(newpath, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var newname = PATH.basename(newpath); + var errCode = FS.mayCreate(parent, newname); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.symlink) { + throw new FS.ErrnoError(63); + } + return parent.node_ops.symlink(parent, newname, oldpath); + }, + rename(old_path, new_path) { + var old_dirname = PATH.dirname(old_path); + var new_dirname = PATH.dirname(new_path); + var old_name = PATH.basename(old_path); + var new_name = PATH.basename(new_path); + + var lookup, old_dir, new_dir; + + lookup = FS.lookupPath(old_path, { parent: true }); + old_dir = lookup.node; + lookup = FS.lookupPath(new_path, { parent: true }); + new_dir = lookup.node; + + if (!old_dir || !new_dir) throw new FS.ErrnoError(44); + + if (old_dir.mount !== new_dir.mount) { + throw new FS.ErrnoError(75); + } + + var old_node = FS.lookupNode(old_dir, old_name); + + var relative = PATH_FS.relative(old_path, new_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(28); + } + + relative = PATH_FS.relative(new_path, old_dirname); + if (relative.charAt(0) !== '.') { + throw new FS.ErrnoError(55); + } + + var new_node; + try { + new_node = FS.lookupNode(new_dir, new_name); + } catch (e) {} + + if (old_node === new_node) { + return; + } + + var isdir = FS.isDir(old_node.mode); + var errCode = FS.mayDelete(old_dir, old_name, isdir); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + + errCode = new_node + ? FS.mayDelete(new_dir, new_name, isdir) + : FS.mayCreate(new_dir, new_name); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!old_dir.node_ops.rename) { + throw new FS.ErrnoError(63); + } + if ( + FS.isMountpoint(old_node) || + (new_node && FS.isMountpoint(new_node)) + ) { + throw new FS.ErrnoError(10); + } + + if (new_dir !== old_dir) { + errCode = FS.nodePermissions(old_dir, 'w'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + + FS.hashRemoveNode(old_node); + + try { + old_dir.node_ops.rename(old_node, new_dir, new_name); + + old_node.parent = new_dir; + } catch (e) { + throw e; + } finally { + FS.hashAddNode(old_node); + } + }, + rmdir(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, true); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.rmdir) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.rmdir(parent, name); + FS.destroyNode(node); + }, + readdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node.node_ops.readdir) { + throw new FS.ErrnoError(54); + } + return node.node_ops.readdir(node); + }, + unlink(path) { + var lookup = FS.lookupPath(path, { parent: true }); + var parent = lookup.node; + if (!parent) { + throw new FS.ErrnoError(44); + } + var name = PATH.basename(path); + var node = FS.lookupNode(parent, name); + var errCode = FS.mayDelete(parent, name, false); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + if (!parent.node_ops.unlink) { + throw new FS.ErrnoError(63); + } + if (FS.isMountpoint(node)) { + throw new FS.ErrnoError(10); + } + parent.node_ops.unlink(parent, name); + FS.destroyNode(node); + }, + readlink(path) { + var lookup = FS.lookupPath(path); + var link = lookup.node; + if (!link) { + throw new FS.ErrnoError(44); + } + if (!link.node_ops.readlink) { + throw new FS.ErrnoError(28); + } + return PATH_FS.resolve( + FS.getPath(link.parent), + link.node_ops.readlink(link), + ); + }, + stat(path, dontFollow) { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + var node = lookup.node; + if (!node) { + throw new FS.ErrnoError(44); + } + if (!node.node_ops.getattr) { + throw new FS.ErrnoError(63); + } + return node.node_ops.getattr(node); + }, + lstat(path) { + return FS.stat(path, true); + }, + chmod(path, mode, dontFollow) { + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + mode: (mode & 4095) | (node.mode & ~4095), + timestamp: Date.now(), + }); + }, + lchmod(path, mode) { + FS.chmod(path, mode, true); + }, + fchmod(fd, mode) { + var stream = FS.getStreamChecked(fd); + FS.chmod(stream.node, mode); + }, + chown(path, uid, gid, dontFollow) { + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: !dontFollow }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + node.node_ops.setattr(node, { + timestamp: Date.now(), + }); + }, + lchown(path, uid, gid) { + FS.chown(path, uid, gid, true); + }, + fchown(fd, uid, gid) { + var stream = FS.getStreamChecked(fd); + FS.chown(stream.node, uid, gid); + }, + truncate(path, len) { + if (len < 0) { + throw new FS.ErrnoError(28); + } + var node; + if (typeof path == 'string') { + var lookup = FS.lookupPath(path, { follow: true }); + node = lookup.node; + } else { + node = path; + } + if (!node.node_ops.setattr) { + throw new FS.ErrnoError(63); + } + if (FS.isDir(node.mode)) { + throw new FS.ErrnoError(31); + } + if (!FS.isFile(node.mode)) { + throw new FS.ErrnoError(28); + } + var errCode = FS.nodePermissions(node, 'w'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + node.node_ops.setattr(node, { + size: len, + timestamp: Date.now(), + }); + }, + ftruncate(fd, len) { + var stream = FS.getStreamChecked(fd); + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(28); + } + FS.truncate(stream.node, len); + }, + utime(path, atime, mtime) { + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + node.node_ops.setattr(node, { + timestamp: Math.max(atime, mtime), + }); + }, + open(path, flags, mode) { + if (path === '') { + throw new FS.ErrnoError(44); + } + flags = typeof flags == 'string' ? FS_modeStringToFlags(flags) : flags; + if (flags & 64) { + mode = typeof mode == 'undefined' ? 438 : mode; + mode = (mode & 4095) | 32768; + } else { + mode = 0; + } + var node; + if (typeof path == 'object') { + node = path; + } else { + path = PATH.normalize(path); + try { + var lookup = FS.lookupPath(path, { + follow: !(flags & 131072), + }); + node = lookup.node; + } catch (e) {} + } + + var created = false; + if (flags & 64) { + if (node) { + if (flags & 128) { + throw new FS.ErrnoError(20); + } + } else { + node = FS.mknod(path, mode, 0); + created = true; + } + } + if (!node) { + throw new FS.ErrnoError(44); + } + + if (FS.isChrdev(node.mode)) { + flags &= ~512; + } + + if (flags & 65536 && !FS.isDir(node.mode)) { + throw new FS.ErrnoError(54); + } + + if (!created) { + var errCode = FS.mayOpen(node, flags); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + } + + if (flags & 512 && !created) { + FS.truncate(node, 0); + } + + flags &= ~(128 | 512 | 131072); + + var stream = FS.createStream({ + node, + path: FS.getPath(node), + flags, + seekable: true, + position: 0, + stream_ops: node.stream_ops, + + ungotten: [], + error: false, + }); + + if (stream.stream_ops.open) { + stream.stream_ops.open(stream); + } + if (Module['logReadFiles'] && !(flags & 1)) { + if (!(path in FS.readFiles)) { + FS.readFiles[path] = 1; + } + } + return stream; + }, + close(stream) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (stream.getdents) stream.getdents = null; + try { + if (stream.stream_ops.close) { + stream.stream_ops.close(stream); + } + } catch (e) { + throw e; + } finally { + FS.closeStream(stream.fd); + } + stream.fd = null; + }, + isClosed(stream) { + return stream.fd === null; + }, + llseek(stream, offset, whence) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (!stream.seekable || !stream.stream_ops.llseek) { + throw new FS.ErrnoError(70); + } + if (whence != 0 && whence != 1 && whence != 2) { + throw new FS.ErrnoError(28); + } + stream.position = stream.stream_ops.llseek(stream, offset, whence); + stream.ungotten = []; + return stream.position; + }, + read(stream, buffer, offset, length, position) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.read) { + throw new FS.ErrnoError(28); + } + var seeking = typeof position != 'undefined'; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesRead = stream.stream_ops.read( + stream, + buffer, + offset, + length, + position, + ); + if (!seeking) stream.position += bytesRead; + return bytesRead; + }, + write(stream, buffer, offset, length, position, canOwn) { + if (length < 0 || position < 0) { + throw new FS.ErrnoError(28); + } + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(31); + } + if (!stream.stream_ops.write) { + throw new FS.ErrnoError(28); + } + if (stream.seekable && stream.flags & 1024) { + FS.llseek(stream, 0, 2); + } + var seeking = typeof position != 'undefined'; + if (!seeking) { + position = stream.position; + } else if (!stream.seekable) { + throw new FS.ErrnoError(70); + } + var bytesWritten = stream.stream_ops.write( + stream, + buffer, + offset, + length, + position, + canOwn, + ); + if (!seeking) stream.position += bytesWritten; + return bytesWritten; + }, + allocate(stream, offset, length) { + if (FS.isClosed(stream)) { + throw new FS.ErrnoError(8); + } + if (offset < 0 || length <= 0) { + throw new FS.ErrnoError(28); + } + if ((stream.flags & 2097155) === 0) { + throw new FS.ErrnoError(8); + } + if (!FS.isFile(stream.node.mode) && !FS.isDir(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (!stream.stream_ops.allocate) { + throw new FS.ErrnoError(138); + } + stream.stream_ops.allocate(stream, offset, length); + }, + mmap(stream, length, position, prot, flags) { + if ( + (prot & 2) !== 0 && + (flags & 2) === 0 && + (stream.flags & 2097155) !== 2 + ) { + throw new FS.ErrnoError(2); + } + if ((stream.flags & 2097155) === 1) { + throw new FS.ErrnoError(2); + } + if (!stream.stream_ops.mmap) { + throw new FS.ErrnoError(43); + } + if (!length) { + throw new FS.ErrnoError(28); + } + return stream.stream_ops.mmap(stream, length, position, prot, flags); + }, + msync(stream, buffer, offset, length, mmapFlags) { + if (!stream.stream_ops.msync) { + return 0; + } + return stream.stream_ops.msync( + stream, + buffer, + offset, + length, + mmapFlags, + ); + }, + ioctl(stream, cmd, arg) { + if (!stream.stream_ops.ioctl) { + throw new FS.ErrnoError(59); + } + return stream.stream_ops.ioctl(stream, cmd, arg); + }, + readFile(path, opts = {}) { + opts.flags = opts.flags || 0; + opts.encoding = opts.encoding || 'binary'; + if (opts.encoding !== 'utf8' && opts.encoding !== 'binary') { + throw new Error(`Invalid encoding type "${opts.encoding}"`); + } + var ret; + var stream = FS.open(path, opts.flags); + var stat = FS.stat(path); + var length = stat.size; + var buf = new Uint8Array(length); + FS.read(stream, buf, 0, length, 0); + if (opts.encoding === 'utf8') { + ret = UTF8ArrayToString(buf); + } else if (opts.encoding === 'binary') { + ret = buf; + } + FS.close(stream); + return ret; + }, + writeFile(path, data, opts = {}) { + opts.flags = opts.flags || 577; + var stream = FS.open(path, opts.flags, opts.mode); + if (typeof data == 'string') { + var buf = new Uint8Array(lengthBytesUTF8(data) + 1); + var actualNumBytes = stringToUTF8Array(data, buf, 0, buf.length); + FS.write(stream, buf, 0, actualNumBytes, undefined, opts.canOwn); + } else if (ArrayBuffer.isView(data)) { + FS.write(stream, data, 0, data.byteLength, undefined, opts.canOwn); + } else { + throw new Error('Unsupported data type'); + } + FS.close(stream); + }, + cwd: () => FS.currentPath, + chdir(path) { + var lookup = FS.lookupPath(path, { follow: true }); + if (lookup.node === null) { + throw new FS.ErrnoError(44); + } + if (!FS.isDir(lookup.node.mode)) { + throw new FS.ErrnoError(54); + } + var errCode = FS.nodePermissions(lookup.node, 'x'); + if (errCode) { + throw new FS.ErrnoError(errCode); + } + FS.currentPath = lookup.path; + }, + createDefaultDirectories() { + FS.mkdir('/tmp'); + FS.mkdir('/home'); + FS.mkdir('/home/web_user'); + }, + createDefaultDevices() { + FS.mkdir('/dev'); + + FS.registerDevice(FS.makedev(1, 3), { + read: () => 0, + write: (stream, buffer, offset, length, pos) => length, + }); + FS.mkdev('/dev/null', FS.makedev(1, 3)); + + TTY.register(FS.makedev(5, 0), TTY.default_tty_ops); + TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops); + FS.mkdev('/dev/tty', FS.makedev(5, 0)); + FS.mkdev('/dev/tty1', FS.makedev(6, 0)); + + var randomBuffer = new Uint8Array(1024), + randomLeft = 0; + var randomByte = () => { + if (randomLeft === 0) { + randomLeft = randomFill(randomBuffer).byteLength; + } + return randomBuffer[--randomLeft]; + }; + FS.createDevice('/dev', 'random', randomByte); + FS.createDevice('/dev', 'urandom', randomByte); + + FS.mkdir('/dev/shm'); + FS.mkdir('/dev/shm/tmp'); + }, + createSpecialDirectories() { + FS.mkdir('/proc'); + var proc_self = FS.mkdir('/proc/self'); + FS.mkdir('/proc/self/fd'); + FS.mount( + { + mount() { + var node = FS.createNode(proc_self, 'fd', 16384 | 511, 73); + node.node_ops = { + lookup(parent, name) { + var fd = +name; + var stream = FS.getStreamChecked(fd); + var ret = { + parent: null, + mount: { mountpoint: 'fake' }, + node_ops: { readlink: () => stream.path }, + }; + ret.parent = ret; + return ret; + }, + }; + return node; + }, + }, + {}, + '/proc/self/fd', + ); + }, + createStandardStreams(input, output, error) { + if (input) { + FS.createDevice('/dev', 'stdin', input); + } else { + FS.symlink('/dev/tty', '/dev/stdin'); + } + if (output) { + FS.createDevice('/dev', 'stdout', null, output); + } else { + FS.symlink('/dev/tty', '/dev/stdout'); + } + if (error) { + FS.createDevice('/dev', 'stderr', null, error); + } else { + FS.symlink('/dev/tty1', '/dev/stderr'); + } + + var stdin = FS.open('/dev/stdin', 0); + var stdout = FS.open('/dev/stdout', 1); + var stderr = FS.open('/dev/stderr', 1); + }, + staticInit() { + [44].forEach((code) => { + FS.genericErrors[code] = new FS.ErrnoError(code); + FS.genericErrors[code].stack = ''; + }); + + FS.nameTable = new Array(4096); + + FS.mount(MEMFS, {}, '/'); + + FS.createDefaultDirectories(); + FS.createDefaultDevices(); + FS.createSpecialDirectories(); + + FS.filesystems = { + MEMFS: MEMFS, + }; + }, + init(input, output, error) { + FS.initialized = true; + + input ??= Module['stdin']; + output ??= Module['stdout']; + error ??= Module['stderr']; + + FS.createStandardStreams(input, output, error); + }, + quit() { + FS.initialized = false; + + for (var i = 0; i < FS.streams.length; i++) { + var stream = FS.streams[i]; + if (!stream) { + continue; + } + FS.close(stream); + } + }, + findObject(path, dontResolveLastLink) { + var ret = FS.analyzePath(path, dontResolveLastLink); + if (!ret.exists) { + return null; + } + return ret.object; + }, + analyzePath(path, dontResolveLastLink) { + try { + var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + path = lookup.path; + } catch (e) {} + var ret = { + isRoot: false, + exists: false, + error: 0, + name: null, + path: null, + object: null, + parentExists: false, + parentPath: null, + parentObject: null, + }; + try { + var lookup = FS.lookupPath(path, { parent: true }); + ret.parentExists = true; + ret.parentPath = lookup.path; + ret.parentObject = lookup.node; + ret.name = PATH.basename(path); + lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); + ret.exists = true; + ret.path = lookup.path; + ret.object = lookup.node; + ret.name = lookup.node.name; + ret.isRoot = lookup.path === '/'; + } catch (e) { + ret.error = e.errno; + } + return ret; + }, + createPath(parent, path, canRead, canWrite) { + parent = typeof parent == 'string' ? parent : FS.getPath(parent); + var parts = path.split('/').reverse(); + while (parts.length) { + var part = parts.pop(); + if (!part) continue; + var current = PATH.join2(parent, part); + try { + FS.mkdir(current); + } catch (e) {} + parent = current; + } + return current; + }, + createFile(parent, name, properties, canRead, canWrite) { + var path = PATH.join2( + typeof parent == 'string' ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(canRead, canWrite); + return FS.create(path, mode); + }, + createDataFile(parent, name, data, canRead, canWrite, canOwn) { + var path = name; + if (parent) { + parent = typeof parent == 'string' ? parent : FS.getPath(parent); + path = name ? PATH.join2(parent, name) : parent; + } + var mode = FS_getMode(canRead, canWrite); + var node = FS.create(path, mode); + if (data) { + if (typeof data == 'string') { + var arr = new Array(data.length); + for (var i = 0, len = data.length; i < len; ++i) + arr[i] = data.charCodeAt(i); + data = arr; + } + + FS.chmod(node, mode | 146); + var stream = FS.open(node, 577); + FS.write(stream, data, 0, data.length, 0, canOwn); + FS.close(stream); + FS.chmod(node, mode); + } + }, + createDevice(parent, name, input, output) { + var path = PATH.join2( + typeof parent == 'string' ? parent : FS.getPath(parent), + name, + ); + var mode = FS_getMode(!!input, !!output); + FS.createDevice.major ??= 64; + var dev = FS.makedev(FS.createDevice.major++, 0); + + FS.registerDevice(dev, { + open(stream) { + stream.seekable = false; + }, + close(stream) { + if (output?.buffer?.length) { + output(10); + } + }, + read(stream, buffer, offset, length, pos) { + var bytesRead = 0; + for (var i = 0; i < length; i++) { + var result; + try { + result = input(); + } catch (e) { + throw new FS.ErrnoError(29); + } + if (result === undefined && bytesRead === 0) { + throw new FS.ErrnoError(6); + } + if (result === null || result === undefined) break; + bytesRead++; + buffer[offset + i] = result; + } + if (bytesRead) { + stream.node.timestamp = Date.now(); + } + return bytesRead; + }, + write(stream, buffer, offset, length, pos) { + for (var i = 0; i < length; i++) { + try { + output(buffer[offset + i]); + } catch (e) { + throw new FS.ErrnoError(29); + } + } + if (length) { + stream.node.timestamp = Date.now(); + } + return i; + }, + }); + return FS.mkdev(path, mode, dev); + }, + forceLoadFile(obj) { + if (obj.isDevice || obj.isFolder || obj.link || obj.contents) + return true; + if (typeof XMLHttpRequest != 'undefined') { + 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.', + ); + } else { + try { + obj.contents = readBinary(obj.url); + obj.usedBytes = obj.contents.length; + } catch (e) { + throw new FS.ErrnoError(29); + } + } + }, + createLazyFile(parent, name, url, canRead, canWrite) { + class LazyUint8Array { + constructor() { + this.lengthKnown = false; + this.chunks = []; + } + get(idx) { + if (idx > this.length - 1 || idx < 0) { + return undefined; + } + var chunkOffset = idx % this.chunkSize; + var chunkNum = (idx / this.chunkSize) | 0; + return this.getter(chunkNum)[chunkOffset]; + } + setDataGetter(getter) { + this.getter = getter; + } + cacheLength() { + var xhr = new XMLHttpRequest(); + xhr.open('HEAD', url, false); + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + '. Status: ' + xhr.status, + ); + var datalength = Number(xhr.getResponseHeader('Content-length')); + var header; + var hasByteServing = + (header = xhr.getResponseHeader('Accept-Ranges')) && + header === 'bytes'; + var usesGzip = + (header = xhr.getResponseHeader('Content-Encoding')) && + header === 'gzip'; + + var chunkSize = 1024 * 1024; + + if (!hasByteServing) chunkSize = datalength; + + var doXHR = (from, to) => { + if (from > to) + throw new Error( + 'invalid range (' + + from + + ', ' + + to + + ') or no bytes requested!', + ); + if (to > datalength - 1) + throw new Error( + 'only ' + datalength + ' bytes available! programmer error!', + ); + + var xhr = new XMLHttpRequest(); + xhr.open('GET', url, false); + if (datalength !== chunkSize) + xhr.setRequestHeader('Range', 'bytes=' + from + '-' + to); + + xhr.responseType = 'arraybuffer'; + if (xhr.overrideMimeType) { + xhr.overrideMimeType('text/plain; charset=x-user-defined'); + } + + xhr.send(null); + if ( + !((xhr.status >= 200 && xhr.status < 300) || xhr.status === 304) + ) + throw new Error( + "Couldn't load " + url + '. Status: ' + xhr.status, + ); + if (xhr.response !== undefined) { + return new Uint8Array(xhr.response || []); + } + return intArrayFromString(xhr.responseText || '', true); + }; + var lazyArray = this; + lazyArray.setDataGetter((chunkNum) => { + var start = chunkNum * chunkSize; + var end = (chunkNum + 1) * chunkSize - 1; + end = Math.min(end, datalength - 1); + if (typeof lazyArray.chunks[chunkNum] == 'undefined') { + lazyArray.chunks[chunkNum] = doXHR(start, end); + } + if (typeof lazyArray.chunks[chunkNum] == 'undefined') + throw new Error('doXHR failed!'); + return lazyArray.chunks[chunkNum]; + }); + + if (usesGzip || !datalength) { + chunkSize = datalength = 1; + datalength = this.getter(0).length; + chunkSize = datalength; + out( + 'LazyFiles on gzip forces download of the whole file when length is accessed', + ); + } + + this._length = datalength; + this._chunkSize = chunkSize; + this.lengthKnown = true; + } + get length() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._length; + } + get chunkSize() { + if (!this.lengthKnown) { + this.cacheLength(); + } + return this._chunkSize; + } + } + + if (typeof XMLHttpRequest != 'undefined') { + if (!ENVIRONMENT_IS_WORKER) + throw 'Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc'; + var lazyArray = new LazyUint8Array(); + var properties = { isDevice: false, contents: lazyArray }; + } else { + var properties = { isDevice: false, url: url }; + } + + var node = FS.createFile(parent, name, properties, canRead, canWrite); + + if (properties.contents) { + node.contents = properties.contents; + } else if (properties.url) { + node.contents = null; + node.url = properties.url; + } + + Object.defineProperties(node, { + usedBytes: { + get: function () { + return this.contents.length; + }, + }, + }); + + var stream_ops = {}; + var keys = Object.keys(node.stream_ops); + keys.forEach((key) => { + var fn = node.stream_ops[key]; + stream_ops[key] = (...args) => { + FS.forceLoadFile(node); + return fn(...args); + }; + }); + function writeChunks(stream, buffer, offset, length, position) { + var contents = stream.node.contents; + if (position >= contents.length) return 0; + var size = Math.min(contents.length - position, length); + if (contents.slice) { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents[position + i]; + } + } else { + for (var i = 0; i < size; i++) { + buffer[offset + i] = contents.get(position + i); + } + } + return size; + } + + stream_ops.read = (stream, buffer, offset, length, position) => { + FS.forceLoadFile(node); + return writeChunks(stream, buffer, offset, length, position); + }; + + stream_ops.mmap = (stream, length, position, prot, flags) => { + FS.forceLoadFile(node); + var ptr = mmapAlloc(length); + if (!ptr) { + throw new FS.ErrnoError(48); + } + writeChunks(stream, HEAP8, ptr, length, position); + return { ptr, allocated: true }; + }; + node.stream_ops = stream_ops; + return node; + }, + }; + + var UTF8ToString = (ptr, maxBytesToRead) => { + return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ''; + }; + var SYSCALLS = { + DEFAULT_POLLMASK: 5, + calculateAt(dirfd, path, allowEmpty) { + if (PATH.isAbs(path)) { + return path; + } + + var dir; + if (dirfd === -100) { + dir = FS.cwd(); + } else { + var dirstream = SYSCALLS.getStreamFromFD(dirfd); + dir = dirstream.path; + } + if (path.length == 0) { + if (!allowEmpty) { + throw new FS.ErrnoError(44); + } + return dir; + } + return PATH.join2(dir, path); + }, + doStat(func, path, buf) { + var stat = func(path); + HEAP32[buf >> 2] = stat.dev; + HEAP32[(buf + 4) >> 2] = stat.mode; + HEAPU32[(buf + 8) >> 2] = stat.nlink; + HEAP32[(buf + 12) >> 2] = stat.uid; + HEAP32[(buf + 16) >> 2] = stat.gid; + HEAP32[(buf + 20) >> 2] = stat.rdev; + HEAP64[(buf + 24) >> 3] = BigInt(stat.size); + HEAP32[(buf + 32) >> 2] = 4096; + HEAP32[(buf + 36) >> 2] = stat.blocks; + var atime = stat.atime.getTime(); + var mtime = stat.mtime.getTime(); + var ctime = stat.ctime.getTime(); + HEAP64[(buf + 40) >> 3] = BigInt(Math.floor(atime / 1000)); + HEAPU32[(buf + 48) >> 2] = (atime % 1000) * 1000 * 1000; + HEAP64[(buf + 56) >> 3] = BigInt(Math.floor(mtime / 1000)); + HEAPU32[(buf + 64) >> 2] = (mtime % 1000) * 1000 * 1000; + HEAP64[(buf + 72) >> 3] = BigInt(Math.floor(ctime / 1000)); + HEAPU32[(buf + 80) >> 2] = (ctime % 1000) * 1000 * 1000; + HEAP64[(buf + 88) >> 3] = BigInt(stat.ino); + return 0; + }, + doMsync(addr, stream, len, flags, offset) { + if (!FS.isFile(stream.node.mode)) { + throw new FS.ErrnoError(43); + } + if (flags & 2) { + return 0; + } + var buffer = HEAPU8.slice(addr, addr + len); + FS.msync(stream, buffer, offset, len, flags); + }, + getStreamFromFD(fd) { + var stream = FS.getStreamChecked(fd); + return stream; + }, + varargs: undefined, + getStr(ptr) { + var ret = UTF8ToString(ptr); + return ret; + }, + }; + function ___syscall_chmod(path, mode) { + try { + path = SYSCALLS.getStr(path); + FS.chmod(path, mode); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_faccessat(dirfd, path, amode, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (amode & ~7) { + return -28; + } + var lookup = FS.lookupPath(path, { follow: true }); + var node = lookup.node; + if (!node) { + return -44; + } + var perms = ''; + if (amode & 4) perms += 'r'; + if (amode & 2) perms += 'w'; + if (amode & 1) perms += 'x'; + if (perms && FS.nodePermissions(node, perms)) { + return -2; + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fchmod(fd, mode) { + try { + FS.fchmod(fd, mode); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fchown32(fd, owner, group) { + try { + FS.fchown(fd, owner, group); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function syscallGetVarargI() { + var ret = HEAP32[+SYSCALLS.varargs >> 2]; + SYSCALLS.varargs += 4; + return ret; + } + var syscallGetVarargP = syscallGetVarargI; + + function ___syscall_fcntl64(fd, cmd, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (cmd) { + case 0: { + var arg = syscallGetVarargI(); + if (arg < 0) { + return -28; + } + while (FS.streams[arg]) { + arg++; + } + var newStream; + newStream = FS.dupStream(stream, arg); + return newStream.fd; + } + case 1: + case 2: + return 0; + case 3: + return stream.flags; + case 4: { + var arg = syscallGetVarargI(); + stream.flags |= arg; + return 0; + } + case 12: { + var arg = syscallGetVarargP(); + var offset = 0; + + HEAP16[(arg + offset) >> 1] = 2; + return 0; + } + case 13: + case 14: + return 0; + } + return -28; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_fstat64(fd, buf) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + return SYSCALLS.doStat(FS.stat, stream.path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var INT53_MAX = 9007199254740992; + + var INT53_MIN = -9007199254740992; + var bigintToI53Checked = (num) => + num < INT53_MIN || num > INT53_MAX ? NaN : Number(num); + function ___syscall_ftruncate64(fd, length) { + length = bigintToI53Checked(length); + + try { + if (isNaN(length)) return 61; + FS.ftruncate(fd, length); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var stringToUTF8 = (str, outPtr, maxBytesToWrite) => { + return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); + }; + function ___syscall_getcwd(buf, size) { + try { + if (size === 0) return -28; + var cwd = FS.cwd(); + var cwdLengthInBytes = lengthBytesUTF8(cwd) + 1; + if (size < cwdLengthInBytes) return -68; + stringToUTF8(cwd, buf, size); + return cwdLengthInBytes; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_ioctl(fd, op, varargs) { + SYSCALLS.varargs = varargs; + try { + var stream = SYSCALLS.getStreamFromFD(fd); + switch (op) { + case 21509: { + if (!stream.tty) return -59; + return 0; + } + case 21505: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcgets) { + var termios = stream.tty.ops.ioctl_tcgets(stream); + var argp = syscallGetVarargP(); + HEAP32[argp >> 2] = termios.c_iflag || 0; + HEAP32[(argp + 4) >> 2] = termios.c_oflag || 0; + HEAP32[(argp + 8) >> 2] = termios.c_cflag || 0; + HEAP32[(argp + 12) >> 2] = termios.c_lflag || 0; + for (var i = 0; i < 32; i++) { + HEAP8[argp + i + 17] = termios.c_cc[i] || 0; + } + return 0; + } + return 0; + } + case 21510: + case 21511: + case 21512: { + if (!stream.tty) return -59; + return 0; + } + case 21506: + case 21507: + case 21508: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tcsets) { + var argp = syscallGetVarargP(); + var c_iflag = HEAP32[argp >> 2]; + var c_oflag = HEAP32[(argp + 4) >> 2]; + var c_cflag = HEAP32[(argp + 8) >> 2]; + var c_lflag = HEAP32[(argp + 12) >> 2]; + var c_cc = []; + for (var i = 0; i < 32; i++) { + c_cc.push(HEAP8[argp + i + 17]); + } + return stream.tty.ops.ioctl_tcsets(stream.tty, op, { + c_iflag, + c_oflag, + c_cflag, + c_lflag, + c_cc, + }); + } + return 0; + } + case 21519: { + if (!stream.tty) return -59; + var argp = syscallGetVarargP(); + HEAP32[argp >> 2] = 0; + return 0; + } + case 21520: { + if (!stream.tty) return -59; + return -28; + } + case 21531: { + var argp = syscallGetVarargP(); + return FS.ioctl(stream, op, argp); + } + case 21523: { + if (!stream.tty) return -59; + if (stream.tty.ops.ioctl_tiocgwinsz) { + var winsize = stream.tty.ops.ioctl_tiocgwinsz(stream.tty); + var argp = syscallGetVarargP(); + HEAP16[argp >> 1] = winsize[0]; + HEAP16[(argp + 2) >> 1] = winsize[1]; + } + return 0; + } + case 21524: { + if (!stream.tty) return -59; + return 0; + } + case 21515: { + if (!stream.tty) return -59; + return 0; + } + default: + return -28; + } + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_lstat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.lstat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_mkdirat(dirfd, path, mode) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + + path = PATH.normalize(path); + if (path[path.length - 1] === '/') + path = path.substr(0, path.length - 1); + FS.mkdir(path, mode, 0); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_newfstatat(dirfd, path, buf, flags) { + try { + path = SYSCALLS.getStr(path); + var nofollow = flags & 256; + var allowEmpty = flags & 4096; + flags = flags & ~6400; + path = SYSCALLS.calculateAt(dirfd, path, allowEmpty); + return SYSCALLS.doStat(nofollow ? FS.lstat : FS.stat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_openat(dirfd, path, flags, varargs) { + SYSCALLS.varargs = varargs; + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + var mode = varargs ? syscallGetVarargI() : 0; + return FS.open(path, flags, mode).fd; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_readlinkat(dirfd, path, buf, bufsize) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (bufsize <= 0) return -28; + var ret = FS.readlink(path); + + var len = Math.min(bufsize, lengthBytesUTF8(ret)); + var endChar = HEAP8[buf + len]; + stringToUTF8(ret, buf, bufsize + 1); + + HEAP8[buf + len] = endChar; + return len; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_rmdir(path) { + try { + path = SYSCALLS.getStr(path); + FS.rmdir(path); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_stat64(path, buf) { + try { + path = SYSCALLS.getStr(path); + return SYSCALLS.doStat(FS.stat, path, buf); + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function ___syscall_unlinkat(dirfd, path, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path); + if (flags === 0) { + FS.unlink(path); + } else if (flags === 512) { + FS.rmdir(path); + } else { + abort('Invalid flags passed to unlinkat'); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var readI53FromI64 = (ptr) => { + return HEAPU32[ptr >> 2] + HEAP32[(ptr + 4) >> 2] * 4294967296; + }; + + function ___syscall_utimensat(dirfd, path, times, flags) { + try { + path = SYSCALLS.getStr(path); + path = SYSCALLS.calculateAt(dirfd, path, true); + var now = Date.now(), + atime, + mtime; + if (!times) { + atime = now; + mtime = now; + } else { + var seconds = readI53FromI64(times); + var nanoseconds = HEAP32[(times + 8) >> 2]; + if (nanoseconds == 1073741823) { + atime = now; + } else if (nanoseconds == 1073741822) { + atime = -1; + } else { + atime = seconds * 1000 + nanoseconds / (1000 * 1000); + } + times += 16; + seconds = readI53FromI64(times); + nanoseconds = HEAP32[(times + 8) >> 2]; + if (nanoseconds == 1073741823) { + mtime = now; + } else if (nanoseconds == 1073741822) { + mtime = -1; + } else { + mtime = seconds * 1000 + nanoseconds / (1000 * 1000); + } + } + + if (mtime != -1 || atime != -1) { + FS.utime(path, atime, mtime); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var nowIsMonotonic = 1; + var __emscripten_get_now_is_monotonic = () => nowIsMonotonic; + + var isLeapYear = (year) => + year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + + var MONTH_DAYS_LEAP_CUMULATIVE = [ + 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, + ]; + + var MONTH_DAYS_REGULAR_CUMULATIVE = [ + 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, + ]; + var ydayFromDate = (date) => { + var leap = isLeapYear(date.getFullYear()); + var monthDaysCumulative = leap + ? MONTH_DAYS_LEAP_CUMULATIVE + : MONTH_DAYS_REGULAR_CUMULATIVE; + var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1; + + return yday; + }; + + function __localtime_js(time, tmPtr) { + time = bigintToI53Checked(time); + + var date = new Date(time * 1000); + HEAP32[tmPtr >> 2] = date.getSeconds(); + HEAP32[(tmPtr + 4) >> 2] = date.getMinutes(); + HEAP32[(tmPtr + 8) >> 2] = date.getHours(); + HEAP32[(tmPtr + 12) >> 2] = date.getDate(); + HEAP32[(tmPtr + 16) >> 2] = date.getMonth(); + HEAP32[(tmPtr + 20) >> 2] = date.getFullYear() - 1900; + HEAP32[(tmPtr + 24) >> 2] = date.getDay(); + + var yday = ydayFromDate(date) | 0; + HEAP32[(tmPtr + 28) >> 2] = yday; + HEAP32[(tmPtr + 36) >> 2] = -(date.getTimezoneOffset() * 60); + + var start = new Date(date.getFullYear(), 0, 1); + var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); + var winterOffset = start.getTimezoneOffset(); + var dst = + (summerOffset != winterOffset && + date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; + HEAP32[(tmPtr + 32) >> 2] = dst; + } + + function __mmap_js(len, prot, flags, fd, offset, allocated, addr) { + offset = bigintToI53Checked(offset); + + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + var res = FS.mmap(stream, len, offset, prot, flags); + var ptr = res.ptr; + HEAP32[allocated >> 2] = res.allocated; + HEAPU32[addr >> 2] = ptr; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + function __munmap_js(addr, len, prot, flags, fd, offset) { + offset = bigintToI53Checked(offset); + + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (prot & 2) { + SYSCALLS.doMsync(addr, stream, len, flags, offset); + } + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return -e.errno; + } + } + + var __tzset_js = (timezone, daylight, std_name, dst_name) => { + var currentYear = new Date().getFullYear(); + var winter = new Date(currentYear, 0, 1); + var summer = new Date(currentYear, 6, 1); + var winterOffset = winter.getTimezoneOffset(); + var summerOffset = summer.getTimezoneOffset(); + + var stdTimezoneOffset = Math.max(winterOffset, summerOffset); + + HEAPU32[timezone >> 2] = stdTimezoneOffset * 60; + + HEAP32[daylight >> 2] = Number(winterOffset != summerOffset); + + var extractZone = (timezoneOffset) => { + var sign = timezoneOffset >= 0 ? '-' : '+'; + + var absOffset = Math.abs(timezoneOffset); + var hours = String(Math.floor(absOffset / 60)).padStart(2, '0'); + var minutes = String(absOffset % 60).padStart(2, '0'); + + return `UTC${sign}${hours}${minutes}`; + }; + + var winterName = extractZone(winterOffset); + var summerName = extractZone(summerOffset); + if (summerOffset < winterOffset) { + stringToUTF8(winterName, std_name, 17); + stringToUTF8(summerName, dst_name, 17); + } else { + stringToUTF8(winterName, dst_name, 17); + stringToUTF8(summerName, std_name, 17); + } + }; + + var _emscripten_date_now = () => Date.now(); + + var _emscripten_get_now = () => performance.now(); + + var getHeapMax = () => 2147483648; + + var growMemory = (size) => { + var b = wasmMemory.buffer; + var pages = ((size - b.byteLength + 65535) / 65536) | 0; + try { + wasmMemory.grow(pages); + updateMemoryViews(); + return 1; + } catch (e) {} + }; + var _emscripten_resize_heap = (requestedSize) => { + var oldSize = HEAPU8.length; + + requestedSize >>>= 0; + + var maxHeapSize = getHeapMax(); + if (requestedSize > maxHeapSize) { + return false; + } + + for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { + var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown); + + overGrownHeapSize = Math.min( + overGrownHeapSize, + requestedSize + 100663296, + ); + + var newSize = Math.min( + maxHeapSize, + alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536), + ); + + var replacement = growMemory(newSize); + if (replacement) { + return true; + } + } + return false; + }; + + var ENV = {}; + + var getExecutableName = () => { + return thisProgram || './this.program'; + }; + var getEnvStrings = () => { + if (!getEnvStrings.strings) { + var lang = + ( + (typeof navigator == 'object' && + navigator.languages && + navigator.languages[0]) || + 'C' + ).replace('-', '_') + '.UTF-8'; + var env = { + USER: 'web_user', + LOGNAME: 'web_user', + PATH: '/', + PWD: '/', + HOME: '/home/web_user', + LANG: lang, + _: getExecutableName(), + }; + + for (var x in ENV) { + if (ENV[x] === undefined) delete env[x]; + else env[x] = ENV[x]; + } + var strings = []; + for (var x in env) { + strings.push(`${x}=${env[x]}`); + } + getEnvStrings.strings = strings; + } + return getEnvStrings.strings; + }; + + var stringToAscii = (str, buffer) => { + for (var i = 0; i < str.length; ++i) { + HEAP8[buffer++] = str.charCodeAt(i); + } + + HEAP8[buffer] = 0; + }; + var _environ_get = (__environ, environ_buf) => { + var bufSize = 0; + getEnvStrings().forEach((string, i) => { + var ptr = environ_buf + bufSize; + HEAPU32[(__environ + i * 4) >> 2] = ptr; + stringToAscii(string, ptr); + bufSize += string.length + 1; + }); + return 0; + }; + + var _environ_sizes_get = (penviron_count, penviron_buf_size) => { + var strings = getEnvStrings(); + HEAPU32[penviron_count >> 2] = strings.length; + var bufSize = 0; + strings.forEach((string) => (bufSize += string.length + 1)); + HEAPU32[penviron_buf_size >> 2] = bufSize; + return 0; + }; + + function _fd_close(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + FS.close(stream); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + function _fd_fdstat_get(fd, pbuf) { + try { + var rightsBase = 0; + var rightsInheriting = 0; + var flags = 0; + { + var stream = SYSCALLS.getStreamFromFD(fd); + + var type = stream.tty + ? 2 + : FS.isDir(stream.mode) + ? 3 + : FS.isLink(stream.mode) + ? 7 + : 4; + } + HEAP8[pbuf] = type; + HEAP16[(pbuf + 2) >> 1] = flags; + HEAP64[(pbuf + 8) >> 3] = BigInt(rightsBase); + HEAP64[(pbuf + 16) >> 3] = BigInt(rightsInheriting); + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + var doReadv = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[iov >> 2]; + var len = HEAPU32[(iov + 4) >> 2]; + iov += 8; + var curr = FS.read(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) break; + if (typeof offset != 'undefined') { + offset += curr; + } + } + return ret; + }; + + function _fd_read(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doReadv(stream, iov, iovcnt); + HEAPU32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + function _fd_seek(fd, offset, whence, newOffset) { + offset = bigintToI53Checked(offset); + + try { + if (isNaN(offset)) return 61; + var stream = SYSCALLS.getStreamFromFD(fd); + FS.llseek(stream, offset, whence); + HEAP64[newOffset >> 3] = BigInt(stream.position); + if (stream.getdents && offset === 0 && whence === 0) + stream.getdents = null; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + function _fd_sync(fd) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + if (stream.stream_ops?.fsync) { + return stream.stream_ops.fsync(stream); + } + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + var doWritev = (stream, iov, iovcnt, offset) => { + var ret = 0; + for (var i = 0; i < iovcnt; i++) { + var ptr = HEAPU32[iov >> 2]; + var len = HEAPU32[(iov + 4) >> 2]; + iov += 8; + var curr = FS.write(stream, HEAP8, ptr, len, offset); + if (curr < 0) return -1; + ret += curr; + if (curr < len) { + break; + } + if (typeof offset != 'undefined') { + offset += curr; + } + } + return ret; + }; + + function _fd_write(fd, iov, iovcnt, pnum) { + try { + var stream = SYSCALLS.getStreamFromFD(fd); + var num = doWritev(stream, iov, iovcnt); + HEAPU32[pnum >> 2] = num; + return 0; + } catch (e) { + if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; + return e.errno; + } + } + + FS.createPreloadedFile = FS_createPreloadedFile; + FS.staticInit(); + + var wasmImports = { + __syscall_chmod: ___syscall_chmod, + + __syscall_faccessat: ___syscall_faccessat, + + __syscall_fchmod: ___syscall_fchmod, + + __syscall_fchown32: ___syscall_fchown32, + + __syscall_fcntl64: ___syscall_fcntl64, + + __syscall_fstat64: ___syscall_fstat64, + + __syscall_ftruncate64: ___syscall_ftruncate64, + + __syscall_getcwd: ___syscall_getcwd, + + __syscall_ioctl: ___syscall_ioctl, + + __syscall_lstat64: ___syscall_lstat64, + + __syscall_mkdirat: ___syscall_mkdirat, + + __syscall_newfstatat: ___syscall_newfstatat, + + __syscall_openat: ___syscall_openat, + + __syscall_readlinkat: ___syscall_readlinkat, + + __syscall_rmdir: ___syscall_rmdir, + + __syscall_stat64: ___syscall_stat64, + + __syscall_unlinkat: ___syscall_unlinkat, + + __syscall_utimensat: ___syscall_utimensat, + + _emscripten_get_now_is_monotonic: __emscripten_get_now_is_monotonic, + + _localtime_js: __localtime_js, + + _mmap_js: __mmap_js, + + _munmap_js: __munmap_js, + + _tzset_js: __tzset_js, + + emscripten_date_now: _emscripten_date_now, + + emscripten_get_now: _emscripten_get_now, + + emscripten_resize_heap: _emscripten_resize_heap, + + environ_get: _environ_get, + + environ_sizes_get: _environ_sizes_get, + + fd_close: _fd_close, + + fd_fdstat_get: _fd_fdstat_get, + + fd_read: _fd_read, + + fd_seek: _fd_seek, + + fd_sync: _fd_sync, + + fd_write: _fd_write, + + memory: wasmMemory, + }; + var wasmExports = createWasm(); + var ___wasm_call_ctors = () => + (___wasm_call_ctors = wasmExports['__wasm_call_ctors'])(); + var _sqlite3_status64 = (Module['_sqlite3_status64'] = (a0, a1, a2, a3) => + (_sqlite3_status64 = Module['_sqlite3_status64'] = + wasmExports['sqlite3_status64'])(a0, a1, a2, a3)); + var _sqlite3_status = (Module['_sqlite3_status'] = (a0, a1, a2, a3) => + (_sqlite3_status = Module['_sqlite3_status'] = + wasmExports['sqlite3_status'])(a0, a1, a2, a3)); + var _sqlite3_db_status = (Module['_sqlite3_db_status'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_db_status = Module['_sqlite3_db_status'] = + wasmExports['sqlite3_db_status'])(a0, a1, a2, a3, a4)); + var _sqlite3_msize = (Module['_sqlite3_msize'] = (a0) => + (_sqlite3_msize = Module['_sqlite3_msize'] = + wasmExports['sqlite3_msize'])(a0)); + var _sqlite3_vfs_find = (Module['_sqlite3_vfs_find'] = (a0) => + (_sqlite3_vfs_find = Module['_sqlite3_vfs_find'] = + wasmExports['sqlite3_vfs_find'])(a0)); + var _sqlite3_initialize = (Module['_sqlite3_initialize'] = () => + (_sqlite3_initialize = Module['_sqlite3_initialize'] = + wasmExports['sqlite3_initialize'])()); + var _sqlite3_malloc = (Module['_sqlite3_malloc'] = (a0) => + (_sqlite3_malloc = Module['_sqlite3_malloc'] = + wasmExports['sqlite3_malloc'])(a0)); + var _sqlite3_free = (Module['_sqlite3_free'] = (a0) => + (_sqlite3_free = Module['_sqlite3_free'] = wasmExports['sqlite3_free'])( + a0, + )); + var _sqlite3_vfs_register = (Module['_sqlite3_vfs_register'] = (a0, a1) => + (_sqlite3_vfs_register = Module['_sqlite3_vfs_register'] = + wasmExports['sqlite3_vfs_register'])(a0, a1)); + var _sqlite3_vfs_unregister = (Module['_sqlite3_vfs_unregister'] = (a0) => + (_sqlite3_vfs_unregister = Module['_sqlite3_vfs_unregister'] = + wasmExports['sqlite3_vfs_unregister'])(a0)); + var _sqlite3_malloc64 = (Module['_sqlite3_malloc64'] = (a0) => + (_sqlite3_malloc64 = Module['_sqlite3_malloc64'] = + wasmExports['sqlite3_malloc64'])(a0)); + var _sqlite3_realloc = (Module['_sqlite3_realloc'] = (a0, a1) => + (_sqlite3_realloc = Module['_sqlite3_realloc'] = + wasmExports['sqlite3_realloc'])(a0, a1)); + var _sqlite3_realloc64 = (Module['_sqlite3_realloc64'] = (a0, a1) => + (_sqlite3_realloc64 = Module['_sqlite3_realloc64'] = + wasmExports['sqlite3_realloc64'])(a0, a1)); + var _sqlite3_value_text = (Module['_sqlite3_value_text'] = (a0) => + (_sqlite3_value_text = Module['_sqlite3_value_text'] = + wasmExports['sqlite3_value_text'])(a0)); + var _sqlite3_randomness = (Module['_sqlite3_randomness'] = (a0, a1) => + (_sqlite3_randomness = Module['_sqlite3_randomness'] = + wasmExports['sqlite3_randomness'])(a0, a1)); + var _sqlite3_stricmp = (Module['_sqlite3_stricmp'] = (a0, a1) => + (_sqlite3_stricmp = Module['_sqlite3_stricmp'] = + wasmExports['sqlite3_stricmp'])(a0, a1)); + var _sqlite3_strnicmp = (Module['_sqlite3_strnicmp'] = (a0, a1, a2) => + (_sqlite3_strnicmp = Module['_sqlite3_strnicmp'] = + wasmExports['sqlite3_strnicmp'])(a0, a1, a2)); + var _sqlite3_uri_parameter = (Module['_sqlite3_uri_parameter'] = (a0, a1) => + (_sqlite3_uri_parameter = Module['_sqlite3_uri_parameter'] = + wasmExports['sqlite3_uri_parameter'])(a0, a1)); + var _sqlite3_uri_boolean = (Module['_sqlite3_uri_boolean'] = (a0, a1, a2) => + (_sqlite3_uri_boolean = Module['_sqlite3_uri_boolean'] = + wasmExports['sqlite3_uri_boolean'])(a0, a1, a2)); + var _sqlite3_serialize = (Module['_sqlite3_serialize'] = (a0, a1, a2, a3) => + (_sqlite3_serialize = Module['_sqlite3_serialize'] = + wasmExports['sqlite3_serialize'])(a0, a1, a2, a3)); + var _sqlite3_prepare_v2 = (Module['_sqlite3_prepare_v2'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_prepare_v2 = Module['_sqlite3_prepare_v2'] = + wasmExports['sqlite3_prepare_v2'])(a0, a1, a2, a3, a4)); + var _sqlite3_step = (Module['_sqlite3_step'] = (a0) => + (_sqlite3_step = Module['_sqlite3_step'] = wasmExports['sqlite3_step'])( + a0, + )); + var _sqlite3_column_int64 = (Module['_sqlite3_column_int64'] = (a0, a1) => + (_sqlite3_column_int64 = Module['_sqlite3_column_int64'] = + wasmExports['sqlite3_column_int64'])(a0, a1)); + var _sqlite3_reset = (Module['_sqlite3_reset'] = (a0) => + (_sqlite3_reset = Module['_sqlite3_reset'] = + wasmExports['sqlite3_reset'])(a0)); + var _sqlite3_exec = (Module['_sqlite3_exec'] = (a0, a1, a2, a3, a4) => + (_sqlite3_exec = Module['_sqlite3_exec'] = wasmExports['sqlite3_exec'])( + a0, + a1, + a2, + a3, + a4, + )); + var _sqlite3_column_int = (Module['_sqlite3_column_int'] = (a0, a1) => + (_sqlite3_column_int = Module['_sqlite3_column_int'] = + wasmExports['sqlite3_column_int'])(a0, a1)); + var _sqlite3_finalize = (Module['_sqlite3_finalize'] = (a0) => + (_sqlite3_finalize = Module['_sqlite3_finalize'] = + wasmExports['sqlite3_finalize'])(a0)); + var _sqlite3_file_control = (Module['_sqlite3_file_control'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_file_control = Module['_sqlite3_file_control'] = + wasmExports['sqlite3_file_control'])(a0, a1, a2, a3)); + var _sqlite3_column_name = (Module['_sqlite3_column_name'] = (a0, a1) => + (_sqlite3_column_name = Module['_sqlite3_column_name'] = + wasmExports['sqlite3_column_name'])(a0, a1)); + var _sqlite3_column_text = (Module['_sqlite3_column_text'] = (a0, a1) => + (_sqlite3_column_text = Module['_sqlite3_column_text'] = + wasmExports['sqlite3_column_text'])(a0, a1)); + var _sqlite3_column_type = (Module['_sqlite3_column_type'] = (a0, a1) => + (_sqlite3_column_type = Module['_sqlite3_column_type'] = + wasmExports['sqlite3_column_type'])(a0, a1)); + var _sqlite3_errmsg = (Module['_sqlite3_errmsg'] = (a0) => + (_sqlite3_errmsg = Module['_sqlite3_errmsg'] = + wasmExports['sqlite3_errmsg'])(a0)); + var _sqlite3_deserialize = (Module['_sqlite3_deserialize'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3_deserialize = Module['_sqlite3_deserialize'] = + wasmExports['sqlite3_deserialize'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3_clear_bindings = (Module['_sqlite3_clear_bindings'] = (a0) => + (_sqlite3_clear_bindings = Module['_sqlite3_clear_bindings'] = + wasmExports['sqlite3_clear_bindings'])(a0)); + var _sqlite3_value_blob = (Module['_sqlite3_value_blob'] = (a0) => + (_sqlite3_value_blob = Module['_sqlite3_value_blob'] = + wasmExports['sqlite3_value_blob'])(a0)); + var _sqlite3_value_bytes = (Module['_sqlite3_value_bytes'] = (a0) => + (_sqlite3_value_bytes = Module['_sqlite3_value_bytes'] = + wasmExports['sqlite3_value_bytes'])(a0)); + var _sqlite3_value_double = (Module['_sqlite3_value_double'] = (a0) => + (_sqlite3_value_double = Module['_sqlite3_value_double'] = + wasmExports['sqlite3_value_double'])(a0)); + var _sqlite3_value_int = (Module['_sqlite3_value_int'] = (a0) => + (_sqlite3_value_int = Module['_sqlite3_value_int'] = + wasmExports['sqlite3_value_int'])(a0)); + var _sqlite3_value_int64 = (Module['_sqlite3_value_int64'] = (a0) => + (_sqlite3_value_int64 = Module['_sqlite3_value_int64'] = + wasmExports['sqlite3_value_int64'])(a0)); + var _sqlite3_value_subtype = (Module['_sqlite3_value_subtype'] = (a0) => + (_sqlite3_value_subtype = Module['_sqlite3_value_subtype'] = + wasmExports['sqlite3_value_subtype'])(a0)); + var _sqlite3_value_pointer = (Module['_sqlite3_value_pointer'] = (a0, a1) => + (_sqlite3_value_pointer = Module['_sqlite3_value_pointer'] = + wasmExports['sqlite3_value_pointer'])(a0, a1)); + var _sqlite3_value_type = (Module['_sqlite3_value_type'] = (a0) => + (_sqlite3_value_type = Module['_sqlite3_value_type'] = + wasmExports['sqlite3_value_type'])(a0)); + var _sqlite3_value_nochange = (Module['_sqlite3_value_nochange'] = (a0) => + (_sqlite3_value_nochange = Module['_sqlite3_value_nochange'] = + wasmExports['sqlite3_value_nochange'])(a0)); + var _sqlite3_value_frombind = (Module['_sqlite3_value_frombind'] = (a0) => + (_sqlite3_value_frombind = Module['_sqlite3_value_frombind'] = + wasmExports['sqlite3_value_frombind'])(a0)); + var _sqlite3_value_dup = (Module['_sqlite3_value_dup'] = (a0) => + (_sqlite3_value_dup = Module['_sqlite3_value_dup'] = + wasmExports['sqlite3_value_dup'])(a0)); + var _sqlite3_value_free = (Module['_sqlite3_value_free'] = (a0) => + (_sqlite3_value_free = Module['_sqlite3_value_free'] = + wasmExports['sqlite3_value_free'])(a0)); + var _sqlite3_result_blob = (Module['_sqlite3_result_blob'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_result_blob = Module['_sqlite3_result_blob'] = + wasmExports['sqlite3_result_blob'])(a0, a1, a2, a3)); + var _sqlite3_result_error_toobig = (Module['_sqlite3_result_error_toobig'] = + (a0) => + (_sqlite3_result_error_toobig = Module['_sqlite3_result_error_toobig'] = + wasmExports['sqlite3_result_error_toobig'])(a0)); + var _sqlite3_result_error_nomem = (Module['_sqlite3_result_error_nomem'] = ( + a0, + ) => + (_sqlite3_result_error_nomem = Module['_sqlite3_result_error_nomem'] = + wasmExports['sqlite3_result_error_nomem'])(a0)); + var _sqlite3_result_double = (Module['_sqlite3_result_double'] = (a0, a1) => + (_sqlite3_result_double = Module['_sqlite3_result_double'] = + wasmExports['sqlite3_result_double'])(a0, a1)); + var _sqlite3_result_error = (Module['_sqlite3_result_error'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_result_error = Module['_sqlite3_result_error'] = + wasmExports['sqlite3_result_error'])(a0, a1, a2)); + var _sqlite3_result_int = (Module['_sqlite3_result_int'] = (a0, a1) => + (_sqlite3_result_int = Module['_sqlite3_result_int'] = + wasmExports['sqlite3_result_int'])(a0, a1)); + var _sqlite3_result_int64 = (Module['_sqlite3_result_int64'] = (a0, a1) => + (_sqlite3_result_int64 = Module['_sqlite3_result_int64'] = + wasmExports['sqlite3_result_int64'])(a0, a1)); + var _sqlite3_result_null = (Module['_sqlite3_result_null'] = (a0) => + (_sqlite3_result_null = Module['_sqlite3_result_null'] = + wasmExports['sqlite3_result_null'])(a0)); + var _sqlite3_result_pointer = (Module['_sqlite3_result_pointer'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_result_pointer = Module['_sqlite3_result_pointer'] = + wasmExports['sqlite3_result_pointer'])(a0, a1, a2, a3)); + var _sqlite3_result_subtype = (Module['_sqlite3_result_subtype'] = ( + a0, + a1, + ) => + (_sqlite3_result_subtype = Module['_sqlite3_result_subtype'] = + wasmExports['sqlite3_result_subtype'])(a0, a1)); + var _sqlite3_result_text = (Module['_sqlite3_result_text'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_result_text = Module['_sqlite3_result_text'] = + wasmExports['sqlite3_result_text'])(a0, a1, a2, a3)); + var _sqlite3_result_zeroblob = (Module['_sqlite3_result_zeroblob'] = ( + a0, + a1, + ) => + (_sqlite3_result_zeroblob = Module['_sqlite3_result_zeroblob'] = + wasmExports['sqlite3_result_zeroblob'])(a0, a1)); + var _sqlite3_result_zeroblob64 = (Module['_sqlite3_result_zeroblob64'] = ( + a0, + a1, + ) => + (_sqlite3_result_zeroblob64 = Module['_sqlite3_result_zeroblob64'] = + wasmExports['sqlite3_result_zeroblob64'])(a0, a1)); + var _sqlite3_result_error_code = (Module['_sqlite3_result_error_code'] = ( + a0, + a1, + ) => + (_sqlite3_result_error_code = Module['_sqlite3_result_error_code'] = + wasmExports['sqlite3_result_error_code'])(a0, a1)); + var _sqlite3_user_data = (Module['_sqlite3_user_data'] = (a0) => + (_sqlite3_user_data = Module['_sqlite3_user_data'] = + wasmExports['sqlite3_user_data'])(a0)); + var _sqlite3_context_db_handle = (Module['_sqlite3_context_db_handle'] = ( + a0, + ) => + (_sqlite3_context_db_handle = Module['_sqlite3_context_db_handle'] = + wasmExports['sqlite3_context_db_handle'])(a0)); + var _sqlite3_vtab_nochange = (Module['_sqlite3_vtab_nochange'] = (a0) => + (_sqlite3_vtab_nochange = Module['_sqlite3_vtab_nochange'] = + wasmExports['sqlite3_vtab_nochange'])(a0)); + var _sqlite3_vtab_in_first = (Module['_sqlite3_vtab_in_first'] = (a0, a1) => + (_sqlite3_vtab_in_first = Module['_sqlite3_vtab_in_first'] = + wasmExports['sqlite3_vtab_in_first'])(a0, a1)); + var _sqlite3_vtab_in_next = (Module['_sqlite3_vtab_in_next'] = (a0, a1) => + (_sqlite3_vtab_in_next = Module['_sqlite3_vtab_in_next'] = + wasmExports['sqlite3_vtab_in_next'])(a0, a1)); + var _sqlite3_aggregate_context = (Module['_sqlite3_aggregate_context'] = ( + a0, + a1, + ) => + (_sqlite3_aggregate_context = Module['_sqlite3_aggregate_context'] = + wasmExports['sqlite3_aggregate_context'])(a0, a1)); + var _sqlite3_get_auxdata = (Module['_sqlite3_get_auxdata'] = (a0, a1) => + (_sqlite3_get_auxdata = Module['_sqlite3_get_auxdata'] = + wasmExports['sqlite3_get_auxdata'])(a0, a1)); + var _sqlite3_set_auxdata = (Module['_sqlite3_set_auxdata'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_set_auxdata = Module['_sqlite3_set_auxdata'] = + wasmExports['sqlite3_set_auxdata'])(a0, a1, a2, a3)); + var _sqlite3_column_count = (Module['_sqlite3_column_count'] = (a0) => + (_sqlite3_column_count = Module['_sqlite3_column_count'] = + wasmExports['sqlite3_column_count'])(a0)); + var _sqlite3_data_count = (Module['_sqlite3_data_count'] = (a0) => + (_sqlite3_data_count = Module['_sqlite3_data_count'] = + wasmExports['sqlite3_data_count'])(a0)); + var _sqlite3_column_blob = (Module['_sqlite3_column_blob'] = (a0, a1) => + (_sqlite3_column_blob = Module['_sqlite3_column_blob'] = + wasmExports['sqlite3_column_blob'])(a0, a1)); + var _sqlite3_column_bytes = (Module['_sqlite3_column_bytes'] = (a0, a1) => + (_sqlite3_column_bytes = Module['_sqlite3_column_bytes'] = + wasmExports['sqlite3_column_bytes'])(a0, a1)); + var _sqlite3_column_double = (Module['_sqlite3_column_double'] = (a0, a1) => + (_sqlite3_column_double = Module['_sqlite3_column_double'] = + wasmExports['sqlite3_column_double'])(a0, a1)); + var _sqlite3_column_value = (Module['_sqlite3_column_value'] = (a0, a1) => + (_sqlite3_column_value = Module['_sqlite3_column_value'] = + wasmExports['sqlite3_column_value'])(a0, a1)); + var _sqlite3_column_decltype = (Module['_sqlite3_column_decltype'] = ( + a0, + a1, + ) => + (_sqlite3_column_decltype = Module['_sqlite3_column_decltype'] = + wasmExports['sqlite3_column_decltype'])(a0, a1)); + var _sqlite3_bind_blob = (Module['_sqlite3_bind_blob'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_bind_blob = Module['_sqlite3_bind_blob'] = + wasmExports['sqlite3_bind_blob'])(a0, a1, a2, a3, a4)); + var _sqlite3_bind_double = (Module['_sqlite3_bind_double'] = (a0, a1, a2) => + (_sqlite3_bind_double = Module['_sqlite3_bind_double'] = + wasmExports['sqlite3_bind_double'])(a0, a1, a2)); + var _sqlite3_bind_int = (Module['_sqlite3_bind_int'] = (a0, a1, a2) => + (_sqlite3_bind_int = Module['_sqlite3_bind_int'] = + wasmExports['sqlite3_bind_int'])(a0, a1, a2)); + var _sqlite3_bind_int64 = (Module['_sqlite3_bind_int64'] = (a0, a1, a2) => + (_sqlite3_bind_int64 = Module['_sqlite3_bind_int64'] = + wasmExports['sqlite3_bind_int64'])(a0, a1, a2)); + var _sqlite3_bind_null = (Module['_sqlite3_bind_null'] = (a0, a1) => + (_sqlite3_bind_null = Module['_sqlite3_bind_null'] = + wasmExports['sqlite3_bind_null'])(a0, a1)); + var _sqlite3_bind_pointer = (Module['_sqlite3_bind_pointer'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_bind_pointer = Module['_sqlite3_bind_pointer'] = + wasmExports['sqlite3_bind_pointer'])(a0, a1, a2, a3, a4)); + var _sqlite3_bind_text = (Module['_sqlite3_bind_text'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_bind_text = Module['_sqlite3_bind_text'] = + wasmExports['sqlite3_bind_text'])(a0, a1, a2, a3, a4)); + var _sqlite3_bind_parameter_count = (Module[ + '_sqlite3_bind_parameter_count' + ] = (a0) => + (_sqlite3_bind_parameter_count = Module['_sqlite3_bind_parameter_count'] = + wasmExports['sqlite3_bind_parameter_count'])(a0)); + var _sqlite3_bind_parameter_name = (Module['_sqlite3_bind_parameter_name'] = + (a0, a1) => + (_sqlite3_bind_parameter_name = Module['_sqlite3_bind_parameter_name'] = + wasmExports['sqlite3_bind_parameter_name'])(a0, a1)); + var _sqlite3_bind_parameter_index = (Module[ + '_sqlite3_bind_parameter_index' + ] = (a0, a1) => + (_sqlite3_bind_parameter_index = Module['_sqlite3_bind_parameter_index'] = + wasmExports['sqlite3_bind_parameter_index'])(a0, a1)); + var _sqlite3_db_handle = (Module['_sqlite3_db_handle'] = (a0) => + (_sqlite3_db_handle = Module['_sqlite3_db_handle'] = + wasmExports['sqlite3_db_handle'])(a0)); + var _sqlite3_stmt_readonly = (Module['_sqlite3_stmt_readonly'] = (a0) => + (_sqlite3_stmt_readonly = Module['_sqlite3_stmt_readonly'] = + wasmExports['sqlite3_stmt_readonly'])(a0)); + var _sqlite3_stmt_isexplain = (Module['_sqlite3_stmt_isexplain'] = (a0) => + (_sqlite3_stmt_isexplain = Module['_sqlite3_stmt_isexplain'] = + wasmExports['sqlite3_stmt_isexplain'])(a0)); + var _sqlite3_stmt_explain = (Module['_sqlite3_stmt_explain'] = (a0, a1) => + (_sqlite3_stmt_explain = Module['_sqlite3_stmt_explain'] = + wasmExports['sqlite3_stmt_explain'])(a0, a1)); + var _sqlite3_stmt_busy = (Module['_sqlite3_stmt_busy'] = (a0) => + (_sqlite3_stmt_busy = Module['_sqlite3_stmt_busy'] = + wasmExports['sqlite3_stmt_busy'])(a0)); + var _sqlite3_stmt_status = (Module['_sqlite3_stmt_status'] = (a0, a1, a2) => + (_sqlite3_stmt_status = Module['_sqlite3_stmt_status'] = + wasmExports['sqlite3_stmt_status'])(a0, a1, a2)); + var _sqlite3_sql = (Module['_sqlite3_sql'] = (a0) => + (_sqlite3_sql = Module['_sqlite3_sql'] = wasmExports['sqlite3_sql'])(a0)); + var _sqlite3_expanded_sql = (Module['_sqlite3_expanded_sql'] = (a0) => + (_sqlite3_expanded_sql = Module['_sqlite3_expanded_sql'] = + wasmExports['sqlite3_expanded_sql'])(a0)); + var _sqlite3_preupdate_old = (Module['_sqlite3_preupdate_old'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_preupdate_old = Module['_sqlite3_preupdate_old'] = + wasmExports['sqlite3_preupdate_old'])(a0, a1, a2)); + var _sqlite3_preupdate_count = (Module['_sqlite3_preupdate_count'] = (a0) => + (_sqlite3_preupdate_count = Module['_sqlite3_preupdate_count'] = + wasmExports['sqlite3_preupdate_count'])(a0)); + var _sqlite3_preupdate_depth = (Module['_sqlite3_preupdate_depth'] = (a0) => + (_sqlite3_preupdate_depth = Module['_sqlite3_preupdate_depth'] = + wasmExports['sqlite3_preupdate_depth'])(a0)); + var _sqlite3_preupdate_blobwrite = (Module['_sqlite3_preupdate_blobwrite'] = + (a0) => + (_sqlite3_preupdate_blobwrite = Module['_sqlite3_preupdate_blobwrite'] = + wasmExports['sqlite3_preupdate_blobwrite'])(a0)); + var _sqlite3_preupdate_new = (Module['_sqlite3_preupdate_new'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_preupdate_new = Module['_sqlite3_preupdate_new'] = + wasmExports['sqlite3_preupdate_new'])(a0, a1, a2)); + var _sqlite3_value_numeric_type = (Module['_sqlite3_value_numeric_type'] = ( + a0, + ) => + (_sqlite3_value_numeric_type = Module['_sqlite3_value_numeric_type'] = + wasmExports['sqlite3_value_numeric_type'])(a0)); + var _sqlite3_set_authorizer = (Module['_sqlite3_set_authorizer'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_set_authorizer = Module['_sqlite3_set_authorizer'] = + wasmExports['sqlite3_set_authorizer'])(a0, a1, a2)); + var _sqlite3_strglob = (Module['_sqlite3_strglob'] = (a0, a1) => + (_sqlite3_strglob = Module['_sqlite3_strglob'] = + wasmExports['sqlite3_strglob'])(a0, a1)); + var _sqlite3_strlike = (Module['_sqlite3_strlike'] = (a0, a1, a2) => + (_sqlite3_strlike = Module['_sqlite3_strlike'] = + wasmExports['sqlite3_strlike'])(a0, a1, a2)); + var _sqlite3_auto_extension = (Module['_sqlite3_auto_extension'] = (a0) => + (_sqlite3_auto_extension = Module['_sqlite3_auto_extension'] = + wasmExports['sqlite3_auto_extension'])(a0)); + var _sqlite3_cancel_auto_extension = (Module[ + '_sqlite3_cancel_auto_extension' + ] = (a0) => + (_sqlite3_cancel_auto_extension = Module[ + '_sqlite3_cancel_auto_extension' + ] = + wasmExports['sqlite3_cancel_auto_extension'])(a0)); + var _sqlite3_reset_auto_extension = (Module[ + '_sqlite3_reset_auto_extension' + ] = () => + (_sqlite3_reset_auto_extension = Module['_sqlite3_reset_auto_extension'] = + wasmExports['sqlite3_reset_auto_extension'])()); + var _sqlite3_prepare_v3 = (Module['_sqlite3_prepare_v3'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3_prepare_v3 = Module['_sqlite3_prepare_v3'] = + wasmExports['sqlite3_prepare_v3'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3_create_module = (Module['_sqlite3_create_module'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_create_module = Module['_sqlite3_create_module'] = + wasmExports['sqlite3_create_module'])(a0, a1, a2, a3)); + var _sqlite3_create_module_v2 = (Module['_sqlite3_create_module_v2'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_create_module_v2 = Module['_sqlite3_create_module_v2'] = + wasmExports['sqlite3_create_module_v2'])(a0, a1, a2, a3, a4)); + var _sqlite3_drop_modules = (Module['_sqlite3_drop_modules'] = (a0, a1) => + (_sqlite3_drop_modules = Module['_sqlite3_drop_modules'] = + wasmExports['sqlite3_drop_modules'])(a0, a1)); + var _sqlite3_declare_vtab = (Module['_sqlite3_declare_vtab'] = (a0, a1) => + (_sqlite3_declare_vtab = Module['_sqlite3_declare_vtab'] = + wasmExports['sqlite3_declare_vtab'])(a0, a1)); + var _sqlite3_vtab_on_conflict = (Module['_sqlite3_vtab_on_conflict'] = ( + a0, + ) => + (_sqlite3_vtab_on_conflict = Module['_sqlite3_vtab_on_conflict'] = + wasmExports['sqlite3_vtab_on_conflict'])(a0)); + var _sqlite3_vtab_collation = (Module['_sqlite3_vtab_collation'] = ( + a0, + a1, + ) => + (_sqlite3_vtab_collation = Module['_sqlite3_vtab_collation'] = + wasmExports['sqlite3_vtab_collation'])(a0, a1)); + var _sqlite3_vtab_in = (Module['_sqlite3_vtab_in'] = (a0, a1, a2) => + (_sqlite3_vtab_in = Module['_sqlite3_vtab_in'] = + wasmExports['sqlite3_vtab_in'])(a0, a1, a2)); + var _sqlite3_vtab_rhs_value = (Module['_sqlite3_vtab_rhs_value'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_vtab_rhs_value = Module['_sqlite3_vtab_rhs_value'] = + wasmExports['sqlite3_vtab_rhs_value'])(a0, a1, a2)); + var _sqlite3_vtab_distinct = (Module['_sqlite3_vtab_distinct'] = (a0) => + (_sqlite3_vtab_distinct = Module['_sqlite3_vtab_distinct'] = + wasmExports['sqlite3_vtab_distinct'])(a0)); + var _sqlite3_keyword_name = (Module['_sqlite3_keyword_name'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_keyword_name = Module['_sqlite3_keyword_name'] = + wasmExports['sqlite3_keyword_name'])(a0, a1, a2)); + var _sqlite3_keyword_count = (Module['_sqlite3_keyword_count'] = () => + (_sqlite3_keyword_count = Module['_sqlite3_keyword_count'] = + wasmExports['sqlite3_keyword_count'])()); + var _sqlite3_keyword_check = (Module['_sqlite3_keyword_check'] = (a0, a1) => + (_sqlite3_keyword_check = Module['_sqlite3_keyword_check'] = + wasmExports['sqlite3_keyword_check'])(a0, a1)); + var _sqlite3_complete = (Module['_sqlite3_complete'] = (a0) => + (_sqlite3_complete = Module['_sqlite3_complete'] = + wasmExports['sqlite3_complete'])(a0)); + var _sqlite3_libversion = (Module['_sqlite3_libversion'] = () => + (_sqlite3_libversion = Module['_sqlite3_libversion'] = + wasmExports['sqlite3_libversion'])()); + var _sqlite3_libversion_number = (Module['_sqlite3_libversion_number'] = + () => + (_sqlite3_libversion_number = Module['_sqlite3_libversion_number'] = + wasmExports['sqlite3_libversion_number'])()); + var _sqlite3_shutdown = (Module['_sqlite3_shutdown'] = () => + (_sqlite3_shutdown = Module['_sqlite3_shutdown'] = + wasmExports['sqlite3_shutdown'])()); + var _sqlite3_last_insert_rowid = (Module['_sqlite3_last_insert_rowid'] = ( + a0, + ) => + (_sqlite3_last_insert_rowid = Module['_sqlite3_last_insert_rowid'] = + wasmExports['sqlite3_last_insert_rowid'])(a0)); + var _sqlite3_set_last_insert_rowid = (Module[ + '_sqlite3_set_last_insert_rowid' + ] = (a0, a1) => + (_sqlite3_set_last_insert_rowid = Module[ + '_sqlite3_set_last_insert_rowid' + ] = + wasmExports['sqlite3_set_last_insert_rowid'])(a0, a1)); + var _sqlite3_changes64 = (Module['_sqlite3_changes64'] = (a0) => + (_sqlite3_changes64 = Module['_sqlite3_changes64'] = + wasmExports['sqlite3_changes64'])(a0)); + var _sqlite3_changes = (Module['_sqlite3_changes'] = (a0) => + (_sqlite3_changes = Module['_sqlite3_changes'] = + wasmExports['sqlite3_changes'])(a0)); + var _sqlite3_total_changes64 = (Module['_sqlite3_total_changes64'] = (a0) => + (_sqlite3_total_changes64 = Module['_sqlite3_total_changes64'] = + wasmExports['sqlite3_total_changes64'])(a0)); + var _sqlite3_total_changes = (Module['_sqlite3_total_changes'] = (a0) => + (_sqlite3_total_changes = Module['_sqlite3_total_changes'] = + wasmExports['sqlite3_total_changes'])(a0)); + var _sqlite3_txn_state = (Module['_sqlite3_txn_state'] = (a0, a1) => + (_sqlite3_txn_state = Module['_sqlite3_txn_state'] = + wasmExports['sqlite3_txn_state'])(a0, a1)); + var _sqlite3_close_v2 = (Module['_sqlite3_close_v2'] = (a0) => + (_sqlite3_close_v2 = Module['_sqlite3_close_v2'] = + wasmExports['sqlite3_close_v2'])(a0)); + var _sqlite3_busy_handler = (Module['_sqlite3_busy_handler'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_busy_handler = Module['_sqlite3_busy_handler'] = + wasmExports['sqlite3_busy_handler'])(a0, a1, a2)); + var _sqlite3_progress_handler = (Module['_sqlite3_progress_handler'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3_progress_handler = Module['_sqlite3_progress_handler'] = + wasmExports['sqlite3_progress_handler'])(a0, a1, a2, a3)); + var _sqlite3_busy_timeout = (Module['_sqlite3_busy_timeout'] = (a0, a1) => + (_sqlite3_busy_timeout = Module['_sqlite3_busy_timeout'] = + wasmExports['sqlite3_busy_timeout'])(a0, a1)); + var _sqlite3_interrupt = (Module['_sqlite3_interrupt'] = (a0) => + (_sqlite3_interrupt = Module['_sqlite3_interrupt'] = + wasmExports['sqlite3_interrupt'])(a0)); + var _sqlite3_is_interrupted = (Module['_sqlite3_is_interrupted'] = (a0) => + (_sqlite3_is_interrupted = Module['_sqlite3_is_interrupted'] = + wasmExports['sqlite3_is_interrupted'])(a0)); + var _sqlite3_create_function = (Module['_sqlite3_create_function'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + ) => + (_sqlite3_create_function = Module['_sqlite3_create_function'] = + wasmExports['sqlite3_create_function'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + )); + var _sqlite3_create_function_v2 = (Module['_sqlite3_create_function_v2'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (_sqlite3_create_function_v2 = Module['_sqlite3_create_function_v2'] = + wasmExports['sqlite3_create_function_v2'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3_create_window_function = (Module[ + '_sqlite3_create_window_function' + ] = (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) => + (_sqlite3_create_window_function = Module[ + '_sqlite3_create_window_function' + ] = + wasmExports['sqlite3_create_window_function'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + )); + var _sqlite3_overload_function = (Module['_sqlite3_overload_function'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_overload_function = Module['_sqlite3_overload_function'] = + wasmExports['sqlite3_overload_function'])(a0, a1, a2)); + var _sqlite3_trace_v2 = (Module['_sqlite3_trace_v2'] = (a0, a1, a2, a3) => + (_sqlite3_trace_v2 = Module['_sqlite3_trace_v2'] = + wasmExports['sqlite3_trace_v2'])(a0, a1, a2, a3)); + var _sqlite3_commit_hook = (Module['_sqlite3_commit_hook'] = (a0, a1, a2) => + (_sqlite3_commit_hook = Module['_sqlite3_commit_hook'] = + wasmExports['sqlite3_commit_hook'])(a0, a1, a2)); + var _sqlite3_update_hook = (Module['_sqlite3_update_hook'] = (a0, a1, a2) => + (_sqlite3_update_hook = Module['_sqlite3_update_hook'] = + wasmExports['sqlite3_update_hook'])(a0, a1, a2)); + var _sqlite3_rollback_hook = (Module['_sqlite3_rollback_hook'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_rollback_hook = Module['_sqlite3_rollback_hook'] = + wasmExports['sqlite3_rollback_hook'])(a0, a1, a2)); + var _sqlite3_preupdate_hook = (Module['_sqlite3_preupdate_hook'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_preupdate_hook = Module['_sqlite3_preupdate_hook'] = + wasmExports['sqlite3_preupdate_hook'])(a0, a1, a2)); + var _sqlite3_error_offset = (Module['_sqlite3_error_offset'] = (a0) => + (_sqlite3_error_offset = Module['_sqlite3_error_offset'] = + wasmExports['sqlite3_error_offset'])(a0)); + var _sqlite3_errcode = (Module['_sqlite3_errcode'] = (a0) => + (_sqlite3_errcode = Module['_sqlite3_errcode'] = + wasmExports['sqlite3_errcode'])(a0)); + var _sqlite3_extended_errcode = (Module['_sqlite3_extended_errcode'] = ( + a0, + ) => + (_sqlite3_extended_errcode = Module['_sqlite3_extended_errcode'] = + wasmExports['sqlite3_extended_errcode'])(a0)); + var _sqlite3_errstr = (Module['_sqlite3_errstr'] = (a0) => + (_sqlite3_errstr = Module['_sqlite3_errstr'] = + wasmExports['sqlite3_errstr'])(a0)); + var _sqlite3_limit = (Module['_sqlite3_limit'] = (a0, a1, a2) => + (_sqlite3_limit = Module['_sqlite3_limit'] = + wasmExports['sqlite3_limit'])(a0, a1, a2)); + var _sqlite3_open = (Module['_sqlite3_open'] = (a0, a1) => + (_sqlite3_open = Module['_sqlite3_open'] = wasmExports['sqlite3_open'])( + a0, + a1, + )); + var _sqlite3_open_v2 = (Module['_sqlite3_open_v2'] = (a0, a1, a2, a3) => + (_sqlite3_open_v2 = Module['_sqlite3_open_v2'] = + wasmExports['sqlite3_open_v2'])(a0, a1, a2, a3)); + var _sqlite3_create_collation = (Module['_sqlite3_create_collation'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3_create_collation = Module['_sqlite3_create_collation'] = + wasmExports['sqlite3_create_collation'])(a0, a1, a2, a3, a4)); + var _sqlite3_create_collation_v2 = (Module['_sqlite3_create_collation_v2'] = + (a0, a1, a2, a3, a4, a5) => + (_sqlite3_create_collation_v2 = Module['_sqlite3_create_collation_v2'] = + wasmExports['sqlite3_create_collation_v2'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3_collation_needed = (Module['_sqlite3_collation_needed'] = ( + a0, + a1, + a2, + ) => + (_sqlite3_collation_needed = Module['_sqlite3_collation_needed'] = + wasmExports['sqlite3_collation_needed'])(a0, a1, a2)); + var _sqlite3_get_autocommit = (Module['_sqlite3_get_autocommit'] = (a0) => + (_sqlite3_get_autocommit = Module['_sqlite3_get_autocommit'] = + wasmExports['sqlite3_get_autocommit'])(a0)); + var _sqlite3_table_column_metadata = (Module[ + '_sqlite3_table_column_metadata' + ] = (a0, a1, a2, a3, a4, a5, a6, a7, a8) => + (_sqlite3_table_column_metadata = Module[ + '_sqlite3_table_column_metadata' + ] = + wasmExports['sqlite3_table_column_metadata'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3_extended_result_codes = (Module[ + '_sqlite3_extended_result_codes' + ] = (a0, a1) => + (_sqlite3_extended_result_codes = Module[ + '_sqlite3_extended_result_codes' + ] = + wasmExports['sqlite3_extended_result_codes'])(a0, a1)); + var _sqlite3_uri_key = (Module['_sqlite3_uri_key'] = (a0, a1) => + (_sqlite3_uri_key = Module['_sqlite3_uri_key'] = + wasmExports['sqlite3_uri_key'])(a0, a1)); + var _sqlite3_uri_int64 = (Module['_sqlite3_uri_int64'] = (a0, a1, a2) => + (_sqlite3_uri_int64 = Module['_sqlite3_uri_int64'] = + wasmExports['sqlite3_uri_int64'])(a0, a1, a2)); + var _sqlite3_db_name = (Module['_sqlite3_db_name'] = (a0, a1) => + (_sqlite3_db_name = Module['_sqlite3_db_name'] = + wasmExports['sqlite3_db_name'])(a0, a1)); + var _sqlite3_db_filename = (Module['_sqlite3_db_filename'] = (a0, a1) => + (_sqlite3_db_filename = Module['_sqlite3_db_filename'] = + wasmExports['sqlite3_db_filename'])(a0, a1)); + var _sqlite3_db_readonly = (Module['_sqlite3_db_readonly'] = (a0, a1) => + (_sqlite3_db_readonly = Module['_sqlite3_db_readonly'] = + wasmExports['sqlite3_db_readonly'])(a0, a1)); + var _sqlite3_compileoption_used = (Module['_sqlite3_compileoption_used'] = ( + a0, + ) => + (_sqlite3_compileoption_used = Module['_sqlite3_compileoption_used'] = + wasmExports['sqlite3_compileoption_used'])(a0)); + var _sqlite3_compileoption_get = (Module['_sqlite3_compileoption_get'] = ( + a0, + ) => + (_sqlite3_compileoption_get = Module['_sqlite3_compileoption_get'] = + wasmExports['sqlite3_compileoption_get'])(a0)); + var _sqlite3session_diff = (Module['_sqlite3session_diff'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3session_diff = Module['_sqlite3session_diff'] = + wasmExports['sqlite3session_diff'])(a0, a1, a2, a3)); + var _sqlite3session_attach = (Module['_sqlite3session_attach'] = (a0, a1) => + (_sqlite3session_attach = Module['_sqlite3session_attach'] = + wasmExports['sqlite3session_attach'])(a0, a1)); + var _sqlite3session_create = (Module['_sqlite3session_create'] = ( + a0, + a1, + a2, + ) => + (_sqlite3session_create = Module['_sqlite3session_create'] = + wasmExports['sqlite3session_create'])(a0, a1, a2)); + var _sqlite3session_delete = (Module['_sqlite3session_delete'] = (a0) => + (_sqlite3session_delete = Module['_sqlite3session_delete'] = + wasmExports['sqlite3session_delete'])(a0)); + var _sqlite3session_table_filter = (Module['_sqlite3session_table_filter'] = + (a0, a1, a2) => + (_sqlite3session_table_filter = Module['_sqlite3session_table_filter'] = + wasmExports['sqlite3session_table_filter'])(a0, a1, a2)); + var _sqlite3session_changeset = (Module['_sqlite3session_changeset'] = ( + a0, + a1, + a2, + ) => + (_sqlite3session_changeset = Module['_sqlite3session_changeset'] = + wasmExports['sqlite3session_changeset'])(a0, a1, a2)); + var _sqlite3session_changeset_strm = (Module[ + '_sqlite3session_changeset_strm' + ] = (a0, a1, a2) => + (_sqlite3session_changeset_strm = Module[ + '_sqlite3session_changeset_strm' + ] = + wasmExports['sqlite3session_changeset_strm'])(a0, a1, a2)); + var _sqlite3session_patchset_strm = (Module[ + '_sqlite3session_patchset_strm' + ] = (a0, a1, a2) => + (_sqlite3session_patchset_strm = Module['_sqlite3session_patchset_strm'] = + wasmExports['sqlite3session_patchset_strm'])(a0, a1, a2)); + var _sqlite3session_patchset = (Module['_sqlite3session_patchset'] = ( + a0, + a1, + a2, + ) => + (_sqlite3session_patchset = Module['_sqlite3session_patchset'] = + wasmExports['sqlite3session_patchset'])(a0, a1, a2)); + var _sqlite3session_enable = (Module['_sqlite3session_enable'] = (a0, a1) => + (_sqlite3session_enable = Module['_sqlite3session_enable'] = + wasmExports['sqlite3session_enable'])(a0, a1)); + var _sqlite3session_indirect = (Module['_sqlite3session_indirect'] = ( + a0, + a1, + ) => + (_sqlite3session_indirect = Module['_sqlite3session_indirect'] = + wasmExports['sqlite3session_indirect'])(a0, a1)); + var _sqlite3session_isempty = (Module['_sqlite3session_isempty'] = (a0) => + (_sqlite3session_isempty = Module['_sqlite3session_isempty'] = + wasmExports['sqlite3session_isempty'])(a0)); + var _sqlite3session_memory_used = (Module['_sqlite3session_memory_used'] = ( + a0, + ) => + (_sqlite3session_memory_used = Module['_sqlite3session_memory_used'] = + wasmExports['sqlite3session_memory_used'])(a0)); + var _sqlite3session_object_config = (Module[ + '_sqlite3session_object_config' + ] = (a0, a1, a2) => + (_sqlite3session_object_config = Module['_sqlite3session_object_config'] = + wasmExports['sqlite3session_object_config'])(a0, a1, a2)); + var _sqlite3session_changeset_size = (Module[ + '_sqlite3session_changeset_size' + ] = (a0) => + (_sqlite3session_changeset_size = Module[ + '_sqlite3session_changeset_size' + ] = + wasmExports['sqlite3session_changeset_size'])(a0)); + var _sqlite3changeset_start = (Module['_sqlite3changeset_start'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_start = Module['_sqlite3changeset_start'] = + wasmExports['sqlite3changeset_start'])(a0, a1, a2)); + var _sqlite3changeset_start_v2 = (Module['_sqlite3changeset_start_v2'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3changeset_start_v2 = Module['_sqlite3changeset_start_v2'] = + wasmExports['sqlite3changeset_start_v2'])(a0, a1, a2, a3)); + var _sqlite3changeset_start_strm = (Module['_sqlite3changeset_start_strm'] = + (a0, a1, a2) => + (_sqlite3changeset_start_strm = Module['_sqlite3changeset_start_strm'] = + wasmExports['sqlite3changeset_start_strm'])(a0, a1, a2)); + var _sqlite3changeset_start_v2_strm = (Module[ + '_sqlite3changeset_start_v2_strm' + ] = (a0, a1, a2, a3) => + (_sqlite3changeset_start_v2_strm = Module[ + '_sqlite3changeset_start_v2_strm' + ] = + wasmExports['sqlite3changeset_start_v2_strm'])(a0, a1, a2, a3)); + var _sqlite3changeset_next = (Module['_sqlite3changeset_next'] = (a0) => + (_sqlite3changeset_next = Module['_sqlite3changeset_next'] = + wasmExports['sqlite3changeset_next'])(a0)); + var _sqlite3changeset_op = (Module['_sqlite3changeset_op'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3changeset_op = Module['_sqlite3changeset_op'] = + wasmExports['sqlite3changeset_op'])(a0, a1, a2, a3, a4)); + var _sqlite3changeset_pk = (Module['_sqlite3changeset_pk'] = (a0, a1, a2) => + (_sqlite3changeset_pk = Module['_sqlite3changeset_pk'] = + wasmExports['sqlite3changeset_pk'])(a0, a1, a2)); + var _sqlite3changeset_old = (Module['_sqlite3changeset_old'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_old = Module['_sqlite3changeset_old'] = + wasmExports['sqlite3changeset_old'])(a0, a1, a2)); + var _sqlite3changeset_new = (Module['_sqlite3changeset_new'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_new = Module['_sqlite3changeset_new'] = + wasmExports['sqlite3changeset_new'])(a0, a1, a2)); + var _sqlite3changeset_conflict = (Module['_sqlite3changeset_conflict'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changeset_conflict = Module['_sqlite3changeset_conflict'] = + wasmExports['sqlite3changeset_conflict'])(a0, a1, a2)); + var _sqlite3changeset_fk_conflicts = (Module[ + '_sqlite3changeset_fk_conflicts' + ] = (a0, a1) => + (_sqlite3changeset_fk_conflicts = Module[ + '_sqlite3changeset_fk_conflicts' + ] = + wasmExports['sqlite3changeset_fk_conflicts'])(a0, a1)); + var _sqlite3changeset_finalize = (Module['_sqlite3changeset_finalize'] = ( + a0, + ) => + (_sqlite3changeset_finalize = Module['_sqlite3changeset_finalize'] = + wasmExports['sqlite3changeset_finalize'])(a0)); + var _sqlite3changeset_invert = (Module['_sqlite3changeset_invert'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3changeset_invert = Module['_sqlite3changeset_invert'] = + wasmExports['sqlite3changeset_invert'])(a0, a1, a2, a3)); + var _sqlite3changeset_invert_strm = (Module[ + '_sqlite3changeset_invert_strm' + ] = (a0, a1, a2, a3) => + (_sqlite3changeset_invert_strm = Module['_sqlite3changeset_invert_strm'] = + wasmExports['sqlite3changeset_invert_strm'])(a0, a1, a2, a3)); + var _sqlite3changeset_apply_v2 = (Module['_sqlite3changeset_apply_v2'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + ) => + (_sqlite3changeset_apply_v2 = Module['_sqlite3changeset_apply_v2'] = + wasmExports['sqlite3changeset_apply_v2'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3changeset_apply = (Module['_sqlite3changeset_apply'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3changeset_apply = Module['_sqlite3changeset_apply'] = + wasmExports['sqlite3changeset_apply'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3changeset_apply_v2_strm = (Module[ + '_sqlite3changeset_apply_v2_strm' + ] = (a0, a1, a2, a3, a4, a5, a6, a7, a8) => + (_sqlite3changeset_apply_v2_strm = Module[ + '_sqlite3changeset_apply_v2_strm' + ] = + wasmExports['sqlite3changeset_apply_v2_strm'])( + a0, + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + )); + var _sqlite3changeset_apply_strm = (Module['_sqlite3changeset_apply_strm'] = + (a0, a1, a2, a3, a4, a5) => + (_sqlite3changeset_apply_strm = Module['_sqlite3changeset_apply_strm'] = + wasmExports['sqlite3changeset_apply_strm'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3changegroup_new = (Module['_sqlite3changegroup_new'] = (a0) => + (_sqlite3changegroup_new = Module['_sqlite3changegroup_new'] = + wasmExports['sqlite3changegroup_new'])(a0)); + var _sqlite3changegroup_add = (Module['_sqlite3changegroup_add'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changegroup_add = Module['_sqlite3changegroup_add'] = + wasmExports['sqlite3changegroup_add'])(a0, a1, a2)); + var _sqlite3changegroup_output = (Module['_sqlite3changegroup_output'] = ( + a0, + a1, + a2, + ) => + (_sqlite3changegroup_output = Module['_sqlite3changegroup_output'] = + wasmExports['sqlite3changegroup_output'])(a0, a1, a2)); + var _sqlite3changegroup_add_strm = (Module['_sqlite3changegroup_add_strm'] = + (a0, a1, a2) => + (_sqlite3changegroup_add_strm = Module['_sqlite3changegroup_add_strm'] = + wasmExports['sqlite3changegroup_add_strm'])(a0, a1, a2)); + var _sqlite3changegroup_output_strm = (Module[ + '_sqlite3changegroup_output_strm' + ] = (a0, a1, a2) => + (_sqlite3changegroup_output_strm = Module[ + '_sqlite3changegroup_output_strm' + ] = + wasmExports['sqlite3changegroup_output_strm'])(a0, a1, a2)); + var _sqlite3changegroup_delete = (Module['_sqlite3changegroup_delete'] = ( + a0, + ) => + (_sqlite3changegroup_delete = Module['_sqlite3changegroup_delete'] = + wasmExports['sqlite3changegroup_delete'])(a0)); + var _sqlite3changeset_concat = (Module['_sqlite3changeset_concat'] = ( + a0, + a1, + a2, + a3, + a4, + a5, + ) => + (_sqlite3changeset_concat = Module['_sqlite3changeset_concat'] = + wasmExports['sqlite3changeset_concat'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3changeset_concat_strm = (Module[ + '_sqlite3changeset_concat_strm' + ] = (a0, a1, a2, a3, a4, a5) => + (_sqlite3changeset_concat_strm = Module['_sqlite3changeset_concat_strm'] = + wasmExports['sqlite3changeset_concat_strm'])(a0, a1, a2, a3, a4, a5)); + var _sqlite3session_config = (Module['_sqlite3session_config'] = (a0, a1) => + (_sqlite3session_config = Module['_sqlite3session_config'] = + wasmExports['sqlite3session_config'])(a0, a1)); + var _sqlite3_sourceid = (Module['_sqlite3_sourceid'] = () => + (_sqlite3_sourceid = Module['_sqlite3_sourceid'] = + wasmExports['sqlite3_sourceid'])()); + var _sqlite3__wasm_pstack_ptr = (Module['_sqlite3__wasm_pstack_ptr'] = () => + (_sqlite3__wasm_pstack_ptr = Module['_sqlite3__wasm_pstack_ptr'] = + wasmExports['sqlite3__wasm_pstack_ptr'])()); + var _sqlite3__wasm_pstack_restore = (Module[ + '_sqlite3__wasm_pstack_restore' + ] = (a0) => + (_sqlite3__wasm_pstack_restore = Module['_sqlite3__wasm_pstack_restore'] = + wasmExports['sqlite3__wasm_pstack_restore'])(a0)); + var _sqlite3__wasm_pstack_alloc = (Module['_sqlite3__wasm_pstack_alloc'] = ( + a0, + ) => + (_sqlite3__wasm_pstack_alloc = Module['_sqlite3__wasm_pstack_alloc'] = + wasmExports['sqlite3__wasm_pstack_alloc'])(a0)); + var _sqlite3__wasm_pstack_remaining = (Module[ + '_sqlite3__wasm_pstack_remaining' + ] = () => + (_sqlite3__wasm_pstack_remaining = Module[ + '_sqlite3__wasm_pstack_remaining' + ] = + wasmExports['sqlite3__wasm_pstack_remaining'])()); + var _sqlite3__wasm_pstack_quota = (Module['_sqlite3__wasm_pstack_quota'] = + () => + (_sqlite3__wasm_pstack_quota = Module['_sqlite3__wasm_pstack_quota'] = + wasmExports['sqlite3__wasm_pstack_quota'])()); + var _sqlite3__wasm_db_error = (Module['_sqlite3__wasm_db_error'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_db_error = Module['_sqlite3__wasm_db_error'] = + wasmExports['sqlite3__wasm_db_error'])(a0, a1, a2)); + var _sqlite3__wasm_test_struct = (Module['_sqlite3__wasm_test_struct'] = ( + a0, + ) => + (_sqlite3__wasm_test_struct = Module['_sqlite3__wasm_test_struct'] = + wasmExports['sqlite3__wasm_test_struct'])(a0)); + var _sqlite3__wasm_enum_json = (Module['_sqlite3__wasm_enum_json'] = () => + (_sqlite3__wasm_enum_json = Module['_sqlite3__wasm_enum_json'] = + wasmExports['sqlite3__wasm_enum_json'])()); + var _sqlite3__wasm_vfs_unlink = (Module['_sqlite3__wasm_vfs_unlink'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_vfs_unlink = Module['_sqlite3__wasm_vfs_unlink'] = + wasmExports['sqlite3__wasm_vfs_unlink'])(a0, a1)); + var _sqlite3__wasm_db_vfs = (Module['_sqlite3__wasm_db_vfs'] = (a0, a1) => + (_sqlite3__wasm_db_vfs = Module['_sqlite3__wasm_db_vfs'] = + wasmExports['sqlite3__wasm_db_vfs'])(a0, a1)); + var _sqlite3__wasm_db_reset = (Module['_sqlite3__wasm_db_reset'] = (a0) => + (_sqlite3__wasm_db_reset = Module['_sqlite3__wasm_db_reset'] = + wasmExports['sqlite3__wasm_db_reset'])(a0)); + var _sqlite3__wasm_db_export_chunked = (Module[ + '_sqlite3__wasm_db_export_chunked' + ] = (a0, a1) => + (_sqlite3__wasm_db_export_chunked = Module[ + '_sqlite3__wasm_db_export_chunked' + ] = + wasmExports['sqlite3__wasm_db_export_chunked'])(a0, a1)); + var _sqlite3__wasm_db_serialize = (Module['_sqlite3__wasm_db_serialize'] = ( + a0, + a1, + a2, + a3, + a4, + ) => + (_sqlite3__wasm_db_serialize = Module['_sqlite3__wasm_db_serialize'] = + wasmExports['sqlite3__wasm_db_serialize'])(a0, a1, a2, a3, a4)); + var _sqlite3__wasm_vfs_create_file = (Module[ + '_sqlite3__wasm_vfs_create_file' + ] = (a0, a1, a2, a3) => + (_sqlite3__wasm_vfs_create_file = Module[ + '_sqlite3__wasm_vfs_create_file' + ] = + wasmExports['sqlite3__wasm_vfs_create_file'])(a0, a1, a2, a3)); + var _sqlite3__wasm_posix_create_file = (Module[ + '_sqlite3__wasm_posix_create_file' + ] = (a0, a1, a2) => + (_sqlite3__wasm_posix_create_file = Module[ + '_sqlite3__wasm_posix_create_file' + ] = + wasmExports['sqlite3__wasm_posix_create_file'])(a0, a1, a2)); + var _sqlite3__wasm_kvvfsMakeKeyOnPstack = (Module[ + '_sqlite3__wasm_kvvfsMakeKeyOnPstack' + ] = (a0, a1) => + (_sqlite3__wasm_kvvfsMakeKeyOnPstack = Module[ + '_sqlite3__wasm_kvvfsMakeKeyOnPstack' + ] = + wasmExports['sqlite3__wasm_kvvfsMakeKeyOnPstack'])(a0, a1)); + var _sqlite3__wasm_kvvfs_methods = (Module['_sqlite3__wasm_kvvfs_methods'] = + () => + (_sqlite3__wasm_kvvfs_methods = Module['_sqlite3__wasm_kvvfs_methods'] = + wasmExports['sqlite3__wasm_kvvfs_methods'])()); + var _sqlite3__wasm_vtab_config = (Module['_sqlite3__wasm_vtab_config'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_vtab_config = Module['_sqlite3__wasm_vtab_config'] = + wasmExports['sqlite3__wasm_vtab_config'])(a0, a1, a2)); + var _sqlite3__wasm_db_config_ip = (Module['_sqlite3__wasm_db_config_ip'] = ( + a0, + a1, + a2, + a3, + ) => + (_sqlite3__wasm_db_config_ip = Module['_sqlite3__wasm_db_config_ip'] = + wasmExports['sqlite3__wasm_db_config_ip'])(a0, a1, a2, a3)); + var _sqlite3__wasm_db_config_pii = (Module['_sqlite3__wasm_db_config_pii'] = + (a0, a1, a2, a3, a4) => + (_sqlite3__wasm_db_config_pii = Module['_sqlite3__wasm_db_config_pii'] = + wasmExports['sqlite3__wasm_db_config_pii'])(a0, a1, a2, a3, a4)); + var _sqlite3__wasm_db_config_s = (Module['_sqlite3__wasm_db_config_s'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_db_config_s = Module['_sqlite3__wasm_db_config_s'] = + wasmExports['sqlite3__wasm_db_config_s'])(a0, a1, a2)); + var _sqlite3__wasm_config_i = (Module['_sqlite3__wasm_config_i'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_config_i = Module['_sqlite3__wasm_config_i'] = + wasmExports['sqlite3__wasm_config_i'])(a0, a1)); + var _sqlite3__wasm_config_ii = (Module['_sqlite3__wasm_config_ii'] = ( + a0, + a1, + a2, + ) => + (_sqlite3__wasm_config_ii = Module['_sqlite3__wasm_config_ii'] = + wasmExports['sqlite3__wasm_config_ii'])(a0, a1, a2)); + var _sqlite3__wasm_config_j = (Module['_sqlite3__wasm_config_j'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_config_j = Module['_sqlite3__wasm_config_j'] = + wasmExports['sqlite3__wasm_config_j'])(a0, a1)); + var _sqlite3__wasm_qfmt_token = (Module['_sqlite3__wasm_qfmt_token'] = ( + a0, + a1, + ) => + (_sqlite3__wasm_qfmt_token = Module['_sqlite3__wasm_qfmt_token'] = + wasmExports['sqlite3__wasm_qfmt_token'])(a0, a1)); + var _sqlite3__wasm_init_wasmfs = (Module['_sqlite3__wasm_init_wasmfs'] = ( + a0, + ) => + (_sqlite3__wasm_init_wasmfs = Module['_sqlite3__wasm_init_wasmfs'] = + wasmExports['sqlite3__wasm_init_wasmfs'])(a0)); + var _sqlite3__wasm_test_intptr = (Module['_sqlite3__wasm_test_intptr'] = ( + a0, + ) => + (_sqlite3__wasm_test_intptr = Module['_sqlite3__wasm_test_intptr'] = + wasmExports['sqlite3__wasm_test_intptr'])(a0)); + var _sqlite3__wasm_test_voidptr = (Module['_sqlite3__wasm_test_voidptr'] = ( + a0, + ) => + (_sqlite3__wasm_test_voidptr = Module['_sqlite3__wasm_test_voidptr'] = + wasmExports['sqlite3__wasm_test_voidptr'])(a0)); + var _sqlite3__wasm_test_int64_max = (Module[ + '_sqlite3__wasm_test_int64_max' + ] = () => + (_sqlite3__wasm_test_int64_max = Module['_sqlite3__wasm_test_int64_max'] = + wasmExports['sqlite3__wasm_test_int64_max'])()); + var _sqlite3__wasm_test_int64_min = (Module[ + '_sqlite3__wasm_test_int64_min' + ] = () => + (_sqlite3__wasm_test_int64_min = Module['_sqlite3__wasm_test_int64_min'] = + wasmExports['sqlite3__wasm_test_int64_min'])()); + var _sqlite3__wasm_test_int64_times2 = (Module[ + '_sqlite3__wasm_test_int64_times2' + ] = (a0) => + (_sqlite3__wasm_test_int64_times2 = Module[ + '_sqlite3__wasm_test_int64_times2' + ] = + wasmExports['sqlite3__wasm_test_int64_times2'])(a0)); + var _sqlite3__wasm_test_int64_minmax = (Module[ + '_sqlite3__wasm_test_int64_minmax' + ] = (a0, a1) => + (_sqlite3__wasm_test_int64_minmax = Module[ + '_sqlite3__wasm_test_int64_minmax' + ] = + wasmExports['sqlite3__wasm_test_int64_minmax'])(a0, a1)); + var _sqlite3__wasm_test_int64ptr = (Module['_sqlite3__wasm_test_int64ptr'] = + (a0) => + (_sqlite3__wasm_test_int64ptr = Module['_sqlite3__wasm_test_int64ptr'] = + wasmExports['sqlite3__wasm_test_int64ptr'])(a0)); + var _sqlite3__wasm_test_stack_overflow = (Module[ + '_sqlite3__wasm_test_stack_overflow' + ] = (a0) => + (_sqlite3__wasm_test_stack_overflow = Module[ + '_sqlite3__wasm_test_stack_overflow' + ] = + wasmExports['sqlite3__wasm_test_stack_overflow'])(a0)); + var _sqlite3__wasm_test_str_hello = (Module[ + '_sqlite3__wasm_test_str_hello' + ] = (a0) => + (_sqlite3__wasm_test_str_hello = Module['_sqlite3__wasm_test_str_hello'] = + wasmExports['sqlite3__wasm_test_str_hello'])(a0)); + var _sqlite3__wasm_SQLTester_strglob = (Module[ + '_sqlite3__wasm_SQLTester_strglob' + ] = (a0, a1) => + (_sqlite3__wasm_SQLTester_strglob = Module[ + '_sqlite3__wasm_SQLTester_strglob' + ] = + wasmExports['sqlite3__wasm_SQLTester_strglob'])(a0, a1)); + var _malloc = (Module['_malloc'] = (a0) => + (_malloc = Module['_malloc'] = wasmExports['malloc'])(a0)); + var _free = (Module['_free'] = (a0) => + (_free = Module['_free'] = wasmExports['free'])(a0)); + var _realloc = (Module['_realloc'] = (a0, a1) => + (_realloc = Module['_realloc'] = wasmExports['realloc'])(a0, a1)); + var _emscripten_builtin_memalign = (a0, a1) => + (_emscripten_builtin_memalign = + wasmExports['emscripten_builtin_memalign'])(a0, a1); + var __emscripten_stack_restore = (a0) => + (__emscripten_stack_restore = wasmExports['_emscripten_stack_restore'])( + a0, + ); + var __emscripten_stack_alloc = (a0) => + (__emscripten_stack_alloc = wasmExports['_emscripten_stack_alloc'])(a0); + var _emscripten_stack_get_current = () => + (_emscripten_stack_get_current = + wasmExports['emscripten_stack_get_current'])(); + + Module['wasmMemory'] = wasmMemory; + + var calledRun; + var calledPrerun; + + dependenciesFulfilled = function runCaller() { + if (!calledRun) run(); + if (!calledRun) dependenciesFulfilled = runCaller; + }; + + function run() { + if (runDependencies > 0) { + return; + } + + if (!calledPrerun) { + calledPrerun = 1; + preRun(); + + if (runDependencies > 0) { + return; + } + } + + function doRun() { + if (calledRun) return; + calledRun = 1; + Module['calledRun'] = 1; + + if (ABORT) return; + + initRuntime(); + + readyPromiseResolve(Module); + Module['onRuntimeInitialized']?.(); + + postRun(); + } + + if (Module['setStatus']) { + Module['setStatus']('Running...'); + setTimeout(() => { + setTimeout(() => Module['setStatus'](''), 1); + doRun(); + }, 1); + } else { + doRun(); + } + } + + if (Module['preInit']) { + if (typeof Module['preInit'] == 'function') + Module['preInit'] = [Module['preInit']]; + while (Module['preInit'].length > 0) { + Module['preInit'].pop()(); + } + } + + run(); + + Module.runSQLite3PostLoadInit = function (EmscriptenModule) { + 'use strict'; + + 'use strict'; + globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap( + apiConfig = globalThis.sqlite3ApiConfig || + sqlite3ApiBootstrap.defaultConfig, + ) { + if (sqlite3ApiBootstrap.sqlite3) { + (sqlite3ApiBootstrap.sqlite3.config || console).warn( + 'sqlite3ApiBootstrap() called multiple times.', + 'Config and external initializers are ignored on calls after the first.', + ); + return sqlite3ApiBootstrap.sqlite3; + } + const config = Object.assign( + Object.create(null), + { + exports: undefined, + memory: undefined, + bigIntEnabled: (() => { + if ('undefined' !== typeof Module) { + if (!!Module.HEAPU64) return true; + } + return !!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: false, + }, + apiConfig || {}, + ); + + Object.assign( + config, + { + allocExportName: config.useStdAlloc ? 'malloc' : 'sqlite3_malloc', + deallocExportName: config.useStdAlloc ? 'free' : 'sqlite3_free', + reallocExportName: config.useStdAlloc + ? 'realloc' + : 'sqlite3_realloc', + }, + config, + ); + + ['exports', 'memory', 'wasmfsOpfsDir'].forEach((k) => { + if ('function' === typeof config[k]) { + config[k] = config[k](); + } + }); + + delete globalThis.sqlite3ApiConfig; + delete sqlite3ApiBootstrap.defaultConfig; + + const capi = Object.create(null); + + const wasm = Object.create(null); + + const __rcStr = (rc) => { + return ( + (capi.sqlite3_js_rc_str && capi.sqlite3_js_rc_str(rc)) || + 'Unknown result code #' + rc + ); + }; + + const __isInt = (n) => 'number' === typeof n && n === (n | 0); + + class SQLite3Error extends Error { + constructor(...args) { + let rc; + if (args.length) { + if (__isInt(args[0])) { + rc = args[0]; + if (1 === args.length) { + super(__rcStr(args[0])); + } else { + const rcStr = __rcStr(rc); + if ('object' === typeof args[1]) { + super(rcStr, args[1]); + } else { + args[0] = rcStr + ':'; + super(args.join(' ')); + } + } + } else { + if (2 === args.length && 'object' === typeof args[1]) { + super(...args); + } else { + super(args.join(' ')); + } + } + } + this.resultCode = rc || capi.SQLITE_ERROR; + this.name = 'SQLite3Error'; + } + } + + SQLite3Error.toss = (...args) => { + throw new SQLite3Error(...args); + }; + const toss3 = SQLite3Error.toss; + + if (config.wasmfsOpfsDir && !/^\/[^/]+$/.test(config.wasmfsOpfsDir)) { + toss3( + "config.wasmfsOpfsDir must be falsy or in the form '/dir-name'.", + ); + } + + const isInt32 = (n) => { + return ( + 'bigint' !== typeof n && + !!(n === (n | 0) && n <= 2147483647 && n >= -2147483648) + ); + }; + + const bigIntFits64 = function f(b) { + if (!f._max) { + f._max = BigInt('0x7fffffffffffffff'); + f._min = ~f._max; + } + return b >= f._min && b <= f._max; + }; + + const bigIntFits32 = (b) => b >= -0x7fffffffn - 1n && b <= 0x7fffffffn; + + const bigIntFitsDouble = function f(b) { + if (!f._min) { + f._min = Number.MIN_SAFE_INTEGER; + f._max = Number.MAX_SAFE_INTEGER; + } + return b >= f._min && b <= f._max; + }; + + const isTypedArray = (v) => { + return v && v.constructor && isInt32(v.constructor.BYTES_PER_ELEMENT) + ? v + : false; + }; + + const __SAB = + 'undefined' === typeof SharedArrayBuffer + ? function () {} + : SharedArrayBuffer; + + const isSharedTypedArray = (aTypedArray) => + aTypedArray.buffer instanceof __SAB; + + const typedArrayPart = (aTypedArray, begin, end) => { + return isSharedTypedArray(aTypedArray) + ? aTypedArray.slice(begin, end) + : aTypedArray.subarray(begin, end); + }; + + const isBindableTypedArray = (v) => { + return ( + v && + (v instanceof Uint8Array || + v instanceof Int8Array || + v instanceof ArrayBuffer) + ); + }; + + const isSQLableTypedArray = (v) => { + return ( + v && + (v instanceof Uint8Array || + v instanceof Int8Array || + v instanceof ArrayBuffer) + ); + }; + + const affirmBindableTypedArray = (v) => { + return ( + isBindableTypedArray(v) || + toss3('Value is not of a supported TypedArray type.') + ); + }; + + const utf8Decoder = new TextDecoder('utf-8'); + + const typedArrayToString = function (typedArray, begin, end) { + return utf8Decoder.decode(typedArrayPart(typedArray, begin, end)); + }; + + const flexibleString = function (v) { + if (isSQLableTypedArray(v)) { + return typedArrayToString( + v instanceof ArrayBuffer ? new Uint8Array(v) : v, + ); + } else if (Array.isArray(v)) return v.join(''); + else if (wasm.isPtr(v)) v = wasm.cstrToJs(v); + return v; + }; + + class WasmAllocError extends Error { + constructor(...args) { + if (2 === args.length && 'object' === typeof args[1]) { + super(...args); + } else if (args.length) { + super(args.join(' ')); + } else { + super('Allocation failed.'); + } + this.resultCode = capi.SQLITE_NOMEM; + this.name = 'WasmAllocError'; + } + } + + WasmAllocError.toss = (...args) => { + throw new WasmAllocError(...args); + }; + + Object.assign(capi, { + sqlite3_bind_blob: undefined, + + sqlite3_bind_text: undefined, + + sqlite3_create_function_v2: ( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + xDestroy, + ) => {}, + + sqlite3_create_function: ( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + ) => {}, + + sqlite3_create_window_function: ( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ) => {}, + + sqlite3_prepare_v3: ( + dbPtr, + sql, + sqlByteLen, + prepFlags, + stmtPtrPtr, + strPtrPtr, + ) => {}, + + sqlite3_prepare_v2: ( + dbPtr, + sql, + sqlByteLen, + stmtPtrPtr, + strPtrPtr, + ) => {}, + + sqlite3_exec: (pDb, sql, callback, pVoid, pErrMsg) => {}, + + sqlite3_randomness: (n, outPtr) => {}, + }); + + const util = { + affirmBindableTypedArray, + flexibleString, + bigIntFits32, + bigIntFits64, + bigIntFitsDouble, + isBindableTypedArray, + isInt32, + isSQLableTypedArray, + isTypedArray, + typedArrayToString, + isUIThread: () => + globalThis.window === globalThis && !!globalThis.document, + + isSharedTypedArray, + toss: function (...args) { + throw new Error(args.join(' ')); + }, + toss3, + typedArrayPart, + + affirmDbHeader: function (bytes) { + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + const header = 'SQLite format 3'; + if (header.length > bytes.byteLength) { + toss3('Input does not contain an SQLite3 database header.'); + } + for (let i = 0; i < header.length; ++i) { + if (header.charCodeAt(i) !== bytes[i]) { + toss3('Input does not contain an SQLite3 database header.'); + } + } + }, + + affirmIsDb: function (bytes) { + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + const n = bytes.byteLength; + if (n < 512 || n % 512 !== 0) { + toss3('Byte array size', n, 'is invalid for an SQLite3 db.'); + } + util.affirmDbHeader(bytes); + }, + }; + + Object.assign(wasm, { + ptrSizeof: config.wasmPtrSizeof || 4, + + ptrIR: config.wasmPtrIR || 'i32', + + bigIntEnabled: !!config.bigIntEnabled, + + exports: + config.exports || + toss3('Missing API config.exports (WASM module exports).'), + + memory: + config.memory || + config.exports['memory'] || + toss3( + 'API config object requires a WebAssembly.Memory object', + 'in either config.exports.memory (exported)', + 'or config.memory (imported).', + ), + + alloc: undefined, + + realloc: undefined, + + dealloc: undefined, + }); + + wasm.allocFromTypedArray = function (srcTypedArray) { + if (srcTypedArray instanceof ArrayBuffer) { + srcTypedArray = new Uint8Array(srcTypedArray); + } + affirmBindableTypedArray(srcTypedArray); + const pRet = wasm.alloc(srcTypedArray.byteLength || 1); + wasm + .heapForSize(srcTypedArray.constructor) + .set(srcTypedArray.byteLength ? srcTypedArray : [0], pRet); + return pRet; + }; + + { + const keyAlloc = config.allocExportName, + keyDealloc = config.deallocExportName, + keyRealloc = config.reallocExportName; + for (const key of [keyAlloc, keyDealloc, keyRealloc]) { + const f = wasm.exports[key]; + if (!(f instanceof Function)) + toss3('Missing required exports[', key, '] function.'); + } + + wasm.alloc = function f(n) { + return ( + f.impl(n) || + WasmAllocError.toss('Failed to allocate', n, ' bytes.') + ); + }; + wasm.alloc.impl = wasm.exports[keyAlloc]; + wasm.realloc = function f(m, n) { + const m2 = f.impl(m, n); + return n + ? m2 || WasmAllocError.toss('Failed to reallocate', n, ' bytes.') + : 0; + }; + wasm.realloc.impl = wasm.exports[keyRealloc]; + wasm.dealloc = wasm.exports[keyDealloc]; + } + + wasm.compileOptionUsed = function f(optName) { + if (!arguments.length) { + if (f._result) return f._result; + else if (!f._opt) { + f._rx = /^([^=]+)=(.+)/; + f._rxInt = /^-?\d+$/; + f._opt = function (opt, rv) { + const m = f._rx.exec(opt); + rv[0] = m ? m[1] : opt; + rv[1] = m ? (f._rxInt.test(m[2]) ? +m[2] : m[2]) : true; + }; + } + const rc = {}, + ov = [0, 0]; + let i = 0, + k; + while ((k = capi.sqlite3_compileoption_get(i++))) { + f._opt(k, ov); + rc[ov[0]] = ov[1]; + } + return (f._result = rc); + } else if (Array.isArray(optName)) { + const rc = {}; + optName.forEach((v) => { + rc[v] = capi.sqlite3_compileoption_used(v); + }); + return rc; + } else if ('object' === typeof optName) { + Object.keys(optName).forEach((k) => { + optName[k] = capi.sqlite3_compileoption_used(k); + }); + return optName; + } + return 'string' === typeof optName + ? !!capi.sqlite3_compileoption_used(optName) + : false; + }; + + wasm.pstack = Object.assign(Object.create(null), { + restore: wasm.exports.sqlite3__wasm_pstack_restore, + + alloc: function (n) { + if ('string' === typeof n && !(n = wasm.sizeofIR(n))) { + WasmAllocError.toss( + 'Invalid value for pstack.alloc(', + arguments[0], + ')', + ); + } + return ( + wasm.exports.sqlite3__wasm_pstack_alloc(n) || + WasmAllocError.toss( + 'Could not allocate', + n, + 'bytes from the pstack.', + ) + ); + }, + + allocChunks: function (n, sz) { + if ('string' === typeof sz && !(sz = wasm.sizeofIR(sz))) { + WasmAllocError.toss( + 'Invalid size value for allocChunks(', + arguments[1], + ')', + ); + } + const mem = wasm.pstack.alloc(n * sz); + const rc = []; + let i = 0, + offset = 0; + for (; i < n; ++i, offset += sz) rc.push(mem + offset); + return rc; + }, + + allocPtr: (n = 1, safePtrSize = true) => { + return 1 === n + ? wasm.pstack.alloc(safePtrSize ? 8 : wasm.ptrSizeof) + : wasm.pstack.allocChunks(n, safePtrSize ? 8 : wasm.ptrSizeof); + }, + + call: function (f) { + const stackPos = wasm.pstack.pointer; + try { + return f(sqlite3); + } finally { + wasm.pstack.restore(stackPos); + } + }, + }); + Object.defineProperties(wasm.pstack, { + pointer: { + configurable: false, + iterable: true, + writeable: false, + get: wasm.exports.sqlite3__wasm_pstack_ptr, + }, + + quota: { + configurable: false, + iterable: true, + writeable: false, + get: wasm.exports.sqlite3__wasm_pstack_quota, + }, + + remaining: { + configurable: false, + iterable: true, + writeable: false, + get: wasm.exports.sqlite3__wasm_pstack_remaining, + }, + }); + + capi.sqlite3_randomness = (...args) => { + if ( + 1 === args.length && + util.isTypedArray(args[0]) && + 1 === args[0].BYTES_PER_ELEMENT + ) { + const ta = args[0]; + if (0 === ta.byteLength) { + wasm.exports.sqlite3_randomness(0, 0); + return ta; + } + const stack = wasm.pstack.pointer; + try { + let n = ta.byteLength, + offset = 0; + const r = wasm.exports.sqlite3_randomness; + const heap = wasm.heap8u(); + const nAlloc = n < 512 ? n : 512; + const ptr = wasm.pstack.alloc(nAlloc); + do { + const j = n > nAlloc ? nAlloc : n; + r(j, ptr); + ta.set(typedArrayPart(heap, ptr, ptr + j), offset); + n -= j; + offset += j; + } while (n > 0); + } catch (e) { + console.error( + 'Highly unexpected (and ignored!) ' + + 'exception in sqlite3_randomness():', + e, + ); + } finally { + wasm.pstack.restore(stack); + } + return ta; + } + wasm.exports.sqlite3_randomness(...args); + }; + + let __wasmfsOpfsDir = undefined; + + capi.sqlite3_wasmfs_opfs_dir = function () { + if (undefined !== __wasmfsOpfsDir) return __wasmfsOpfsDir; + + const pdir = config.wasmfsOpfsDir; + if ( + !pdir || + !globalThis.FileSystemHandle || + !globalThis.FileSystemDirectoryHandle || + !globalThis.FileSystemFileHandle + ) { + return (__wasmfsOpfsDir = ''); + } + try { + if ( + pdir && + 0 === + wasm.xCallWrapped( + 'sqlite3__wasm_init_wasmfs', + 'i32', + ['string'], + pdir, + ) + ) { + return (__wasmfsOpfsDir = pdir); + } else { + return (__wasmfsOpfsDir = ''); + } + } catch (e) { + return (__wasmfsOpfsDir = ''); + } + }; + + capi.sqlite3_wasmfs_filename_is_persistent = function (name) { + const p = capi.sqlite3_wasmfs_opfs_dir(); + return p && name ? name.startsWith(p + '/') : false; + }; + + capi.sqlite3_js_db_uses_vfs = function (pDb, vfsName, dbName = 0) { + try { + const pK = capi.sqlite3_vfs_find(vfsName); + if (!pK) return false; + else if (!pDb) { + return pK === capi.sqlite3_vfs_find(0) ? pK : false; + } else { + return pK === capi.sqlite3_js_db_vfs(pDb, dbName) ? pK : false; + } + } catch (e) { + return false; + } + }; + + capi.sqlite3_js_vfs_list = function () { + const rc = []; + let pVfs = capi.sqlite3_vfs_find(0); + while (pVfs) { + const oVfs = new capi.sqlite3_vfs(pVfs); + rc.push(wasm.cstrToJs(oVfs.$zName)); + pVfs = oVfs.$pNext; + oVfs.dispose(); + } + return rc; + }; + + capi.sqlite3_js_db_export = function (pDb, schema = 0) { + pDb = wasm.xWrap.testConvertArg('sqlite3*', pDb); + if (!pDb) toss3('Invalid sqlite3* argument.'); + if (!wasm.bigIntEnabled) toss3('BigInt64 support is not enabled.'); + const scope = wasm.scopedAllocPush(); + let pOut; + try { + const pSize = wasm.scopedAlloc(8 + wasm.ptrSizeof); + const ppOut = pSize + 8; + + const zSchema = schema + ? wasm.isPtr(schema) + ? schema + : wasm.scopedAllocCString('' + schema) + : 0; + let rc = wasm.exports.sqlite3__wasm_db_serialize( + pDb, + zSchema, + ppOut, + pSize, + 0, + ); + if (rc) { + toss3( + 'Database serialization failed with code', + sqlite3.capi.sqlite3_js_rc_str(rc), + ); + } + pOut = wasm.peekPtr(ppOut); + const nOut = wasm.peek(pSize, 'i64'); + rc = nOut + ? wasm.heap8u().slice(pOut, pOut + Number(nOut)) + : new Uint8Array(); + return rc; + } finally { + if (pOut) wasm.exports.sqlite3_free(pOut); + wasm.scopedAllocPop(scope); + } + }; + + capi.sqlite3_js_db_vfs = (dbPointer, dbName = 0) => + util.sqlite3__wasm_db_vfs(dbPointer, dbName); + + capi.sqlite3_js_aggregate_context = (pCtx, n) => { + return ( + capi.sqlite3_aggregate_context(pCtx, n) || + (n + ? WasmAllocError.toss( + 'Cannot allocate', + n, + 'bytes for sqlite3_aggregate_context()', + ) + : 0) + ); + }; + + capi.sqlite3_js_posix_create_file = function (filename, data, dataLen) { + let pData; + if (data && wasm.isPtr(data)) { + pData = data; + } else if ( + data instanceof ArrayBuffer || + data instanceof Uint8Array + ) { + pData = wasm.allocFromTypedArray(data); + if (arguments.length < 3 || !util.isInt32(dataLen) || dataLen < 0) { + dataLen = data.byteLength; + } + } else { + SQLite3Error.toss( + 'Invalid 2nd argument for sqlite3_js_posix_create_file().', + ); + } + try { + if (!util.isInt32(dataLen) || dataLen < 0) { + SQLite3Error.toss( + 'Invalid 3rd argument for sqlite3_js_posix_create_file().', + ); + } + const rc = util.sqlite3__wasm_posix_create_file( + filename, + pData, + dataLen, + ); + if (rc) + SQLite3Error.toss( + 'Creation of file failed with sqlite3 result code', + capi.sqlite3_js_rc_str(rc), + ); + } finally { + wasm.dealloc(pData); + } + }; + + capi.sqlite3_js_vfs_create_file = function ( + vfs, + filename, + data, + dataLen, + ) { + config.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 pData; + if (data) { + if (wasm.isPtr(data)) { + pData = data; + } else if (data instanceof ArrayBuffer) { + data = new Uint8Array(data); + } + if (data instanceof Uint8Array) { + pData = wasm.allocFromTypedArray(data); + if ( + arguments.length < 4 || + !util.isInt32(dataLen) || + dataLen < 0 + ) { + dataLen = data.byteLength; + } + } else { + SQLite3Error.toss( + 'Invalid 3rd argument type for sqlite3_js_vfs_create_file().', + ); + } + } else { + pData = 0; + } + if (!util.isInt32(dataLen) || dataLen < 0) { + wasm.dealloc(pData); + SQLite3Error.toss( + 'Invalid 4th argument for sqlite3_js_vfs_create_file().', + ); + } + try { + const rc = util.sqlite3__wasm_vfs_create_file( + vfs, + filename, + pData, + dataLen, + ); + if (rc) + SQLite3Error.toss( + 'Creation of file failed with sqlite3 result code', + capi.sqlite3_js_rc_str(rc), + ); + } finally { + wasm.dealloc(pData); + } + }; + + capi.sqlite3_js_sql_to_string = (sql) => { + if ('string' === typeof sql) { + return sql; + } + const x = flexibleString(v); + return x === v ? undefined : x; + }; + + if (util.isUIThread()) { + const __kvvfsInfo = function (which) { + const rc = Object.create(null); + rc.prefix = 'kvvfs-' + which; + rc.stores = []; + if ('session' === which || '' === which) + rc.stores.push(globalThis.sessionStorage); + if ('local' === which || '' === which) + rc.stores.push(globalThis.localStorage); + return rc; + }; + + capi.sqlite3_js_kvvfs_clear = function (which = '') { + let rc = 0; + const kvinfo = __kvvfsInfo(which); + kvinfo.stores.forEach((s) => { + const toRm = []; + let i; + for (i = 0; i < s.length; ++i) { + const k = s.key(i); + if (k.startsWith(kvinfo.prefix)) toRm.push(k); + } + toRm.forEach((kk) => s.removeItem(kk)); + rc += toRm.length; + }); + return rc; + }; + + capi.sqlite3_js_kvvfs_size = function (which = '') { + let sz = 0; + const kvinfo = __kvvfsInfo(which); + kvinfo.stores.forEach((s) => { + let i; + for (i = 0; i < s.length; ++i) { + const k = s.key(i); + if (k.startsWith(kvinfo.prefix)) { + sz += k.length; + sz += s.getItem(k).length; + } + } + }); + return sz * 2; + }; + } + + capi.sqlite3_db_config = function (pDb, op, ...args) { + switch (op) { + case capi.SQLITE_DBCONFIG_ENABLE_FKEY: + case capi.SQLITE_DBCONFIG_ENABLE_TRIGGER: + case capi.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER: + case capi.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION: + case capi.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE: + case capi.SQLITE_DBCONFIG_ENABLE_QPSG: + case capi.SQLITE_DBCONFIG_TRIGGER_EQP: + case capi.SQLITE_DBCONFIG_RESET_DATABASE: + case capi.SQLITE_DBCONFIG_DEFENSIVE: + case capi.SQLITE_DBCONFIG_WRITABLE_SCHEMA: + case capi.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE: + case capi.SQLITE_DBCONFIG_DQS_DML: + case capi.SQLITE_DBCONFIG_DQS_DDL: + case capi.SQLITE_DBCONFIG_ENABLE_VIEW: + case capi.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT: + case capi.SQLITE_DBCONFIG_TRUSTED_SCHEMA: + case capi.SQLITE_DBCONFIG_STMT_SCANSTATUS: + case capi.SQLITE_DBCONFIG_REVERSE_SCANORDER: + case capi.SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE: + case capi.SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE: + case capi.SQLITE_DBCONFIG_ENABLE_COMMENTS: + if (!this.ip) { + this.ip = wasm.xWrap('sqlite3__wasm_db_config_ip', 'int', [ + 'sqlite3*', + 'int', + 'int', + '*', + ]); + } + return this.ip(pDb, op, args[0], args[1] || 0); + case capi.SQLITE_DBCONFIG_LOOKASIDE: + if (!this.pii) { + this.pii = wasm.xWrap('sqlite3__wasm_db_config_pii', 'int', [ + 'sqlite3*', + 'int', + '*', + 'int', + 'int', + ]); + } + return this.pii(pDb, op, args[0], args[1], args[2]); + case capi.SQLITE_DBCONFIG_MAINDBNAME: + if (!this.s) { + this.s = wasm.xWrap('sqlite3__wasm_db_config_s', 'int', [ + 'sqlite3*', + 'int', + 'string:static', + ]); + } + return this.s(pDb, op, args[0]); + default: + return capi.SQLITE_MISUSE; + } + }.bind(Object.create(null)); + + capi.sqlite3_value_to_js = function ( + pVal, + throwIfCannotConvert = true, + ) { + let arg; + const valType = capi.sqlite3_value_type(pVal); + switch (valType) { + case capi.SQLITE_INTEGER: + if (wasm.bigIntEnabled) { + arg = capi.sqlite3_value_int64(pVal); + if (util.bigIntFitsDouble(arg)) arg = Number(arg); + } else arg = capi.sqlite3_value_double(pVal); + break; + case capi.SQLITE_FLOAT: + arg = capi.sqlite3_value_double(pVal); + break; + case capi.SQLITE_TEXT: + arg = capi.sqlite3_value_text(pVal); + break; + case capi.SQLITE_BLOB: { + const n = capi.sqlite3_value_bytes(pVal); + const pBlob = capi.sqlite3_value_blob(pVal); + if (n && !pBlob) + sqlite3.WasmAllocError.toss( + 'Cannot allocate memory for blob argument of', + n, + 'byte(s)', + ); + arg = n ? wasm.heap8u().slice(pBlob, pBlob + Number(n)) : null; + break; + } + case capi.SQLITE_NULL: + arg = null; + break; + default: + if (throwIfCannotConvert) { + toss3( + capi.SQLITE_MISMATCH, + 'Unhandled sqlite3_value_type():', + valType, + ); + } + arg = undefined; + } + return arg; + }; + + capi.sqlite3_values_to_js = function ( + argc, + pArgv, + throwIfCannotConvert = true, + ) { + let i; + const tgt = []; + for (i = 0; i < argc; ++i) { + tgt.push( + capi.sqlite3_value_to_js( + wasm.peekPtr(pArgv + wasm.ptrSizeof * i), + throwIfCannotConvert, + ), + ); + } + return tgt; + }; + + capi.sqlite3_result_error_js = function (pCtx, e) { + if (e instanceof WasmAllocError) { + capi.sqlite3_result_error_nomem(pCtx); + } else { + capi.sqlite3_result_error(pCtx, '' + e, -1); + } + }; + + capi.sqlite3_result_js = function (pCtx, val) { + if (val instanceof Error) { + capi.sqlite3_result_error_js(pCtx, val); + return; + } + try { + switch (typeof val) { + case 'undefined': + break; + case 'boolean': + capi.sqlite3_result_int(pCtx, val ? 1 : 0); + break; + case 'bigint': + if (util.bigIntFits32(val)) { + capi.sqlite3_result_int(pCtx, Number(val)); + } else if (util.bigIntFitsDouble(val)) { + capi.sqlite3_result_double(pCtx, Number(val)); + } else if (wasm.bigIntEnabled) { + if (util.bigIntFits64(val)) + capi.sqlite3_result_int64(pCtx, val); + else + toss3( + 'BigInt value', + val.toString(), + 'is too BigInt for int64.', + ); + } else { + toss3('BigInt value', val.toString(), 'is too BigInt.'); + } + break; + case 'number': { + let f; + if (util.isInt32(val)) { + f = capi.sqlite3_result_int; + } else if ( + wasm.bigIntEnabled && + Number.isInteger(val) && + util.bigIntFits64(BigInt(val)) + ) { + f = capi.sqlite3_result_int64; + } else { + f = capi.sqlite3_result_double; + } + f(pCtx, val); + break; + } + case 'string': { + const [p, n] = wasm.allocCString(val, true); + capi.sqlite3_result_text(pCtx, p, n, capi.SQLITE_WASM_DEALLOC); + break; + } + case 'object': + if (null === val) { + capi.sqlite3_result_null(pCtx); + break; + } else if (util.isBindableTypedArray(val)) { + const pBlob = wasm.allocFromTypedArray(val); + capi.sqlite3_result_blob( + pCtx, + pBlob, + val.byteLength, + capi.SQLITE_WASM_DEALLOC, + ); + break; + } + + default: + toss3( + "Don't not how to handle this UDF result value:", + typeof val, + val, + ); + } + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + + capi.sqlite3_column_js = function ( + pStmt, + iCol, + throwIfCannotConvert = true, + ) { + const v = capi.sqlite3_column_value(pStmt, iCol); + return 0 === v + ? undefined + : capi.sqlite3_value_to_js(v, throwIfCannotConvert); + }; + + const __newOldValue = function (pObj, iCol, impl) { + impl = capi[impl]; + if (!this.ptr) this.ptr = wasm.allocPtr(); + else wasm.pokePtr(this.ptr, 0); + const rc = impl(pObj, iCol, this.ptr); + if (rc) + return SQLite3Error.toss( + rc, + arguments[2] + '() failed with code ' + rc, + ); + const pv = wasm.peekPtr(this.ptr); + return pv ? capi.sqlite3_value_to_js(pv, true) : undefined; + }.bind(Object.create(null)); + + capi.sqlite3_preupdate_new_js = (pDb, iCol) => + __newOldValue(pDb, iCol, 'sqlite3_preupdate_new'); + + capi.sqlite3_preupdate_old_js = (pDb, iCol) => + __newOldValue(pDb, iCol, 'sqlite3_preupdate_old'); + + capi.sqlite3changeset_new_js = (pChangesetIter, iCol) => + __newOldValue(pChangesetIter, iCol, 'sqlite3changeset_new'); + + capi.sqlite3changeset_old_js = (pChangesetIter, iCol) => + __newOldValue(pChangesetIter, iCol, 'sqlite3changeset_old'); + + const sqlite3 = { + WasmAllocError: WasmAllocError, + SQLite3Error: SQLite3Error, + capi, + util, + wasm, + config, + + version: Object.create(null), + + client: undefined, + + asyncPostInit: async function ff() { + if (ff.isReady instanceof Promise) return ff.isReady; + let lia = sqlite3ApiBootstrap.initializersAsync; + delete sqlite3ApiBootstrap.initializersAsync; + const postInit = async () => { + if (!sqlite3.__isUnderTest) { + delete sqlite3.util; + + delete sqlite3.StructBinder; + } + return sqlite3; + }; + const catcher = (e) => { + config.error('an async sqlite3 initializer failed:', e); + throw e; + }; + if (!lia || !lia.length) { + return (ff.isReady = postInit().catch(catcher)); + } + lia = lia.map((f) => { + return f instanceof Function ? async (x) => f(sqlite3) : f; + }); + lia.push(postInit); + let p = Promise.resolve(sqlite3); + while (lia.length) p = p.then(lia.shift()); + return (ff.isReady = p.catch(catcher)); + }, + + scriptInfo: undefined, + }; + try { + sqlite3ApiBootstrap.initializers.forEach((f) => { + f(sqlite3); + }); + } catch (e) { + console.error('sqlite3 bootstrap initializer threw:', e); + throw e; + } + delete sqlite3ApiBootstrap.initializers; + sqlite3ApiBootstrap.sqlite3 = sqlite3; + return sqlite3; + }; + + globalThis.sqlite3ApiBootstrap.initializers = []; + + globalThis.sqlite3ApiBootstrap.initializersAsync = []; + + globalThis.sqlite3ApiBootstrap.defaultConfig = Object.create(null); + + globalThis.sqlite3ApiBootstrap.sqlite3 = undefined; + + globalThis.WhWasmUtilInstaller = function (target) { + 'use strict'; + if (undefined === target.bigIntEnabled) { + target.bigIntEnabled = !!globalThis['BigInt64Array']; + } + + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + + if (!target.exports) { + Object.defineProperty(target, 'exports', { + enumerable: true, + configurable: true, + get: () => target.instance && target.instance.exports, + }); + } + + const ptrIR = target.pointerIR || 'i32'; + const ptrSizeof = (target.ptrSizeof = + 'i32' === ptrIR + ? 4 + : 'i64' === ptrIR + ? 8 + : toss('Unhandled ptrSizeof:', ptrIR)); + + const cache = Object.create(null); + + cache.heapSize = 0; + + cache.memory = null; + + cache.freeFuncIndexes = []; + + cache.scopedAlloc = []; + + cache.utf8Decoder = new TextDecoder(); + cache.utf8Encoder = new TextEncoder('utf-8'); + + target.sizeofIR = (n) => { + switch (n) { + 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 ptrSizeof; + default: + return ('' + n).endsWith('*') ? ptrSizeof : undefined; + } + }; + + const heapWrappers = function () { + if (!cache.memory) { + cache.memory = + target.memory instanceof WebAssembly.Memory + ? target.memory + : target.exports.memory; + } else if (cache.heapSize === cache.memory.buffer.byteLength) { + return cache; + } + + const b = cache.memory.buffer; + cache.HEAP8 = new Int8Array(b); + cache.HEAP8U = new Uint8Array(b); + cache.HEAP16 = new Int16Array(b); + cache.HEAP16U = new Uint16Array(b); + cache.HEAP32 = new Int32Array(b); + cache.HEAP32U = new Uint32Array(b); + if (target.bigIntEnabled) { + cache.HEAP64 = new BigInt64Array(b); + cache.HEAP64U = new BigUint64Array(b); + } + cache.HEAP32F = new Float32Array(b); + cache.HEAP64F = new Float64Array(b); + cache.heapSize = b.byteLength; + return cache; + }; + + target.heap8 = () => heapWrappers().HEAP8; + + target.heap8u = () => heapWrappers().HEAP8U; + + target.heap16 = () => heapWrappers().HEAP16; + + target.heap16u = () => heapWrappers().HEAP16U; + + target.heap32 = () => heapWrappers().HEAP32; + + target.heap32u = () => heapWrappers().HEAP32U; + + target.heapForSize = function (n, unsigned = true) { + let ctor; + const c = + cache.memory && cache.heapSize === cache.memory.buffer.byteLength + ? cache + : heapWrappers(); + switch (n) { + case Int8Array: + return c.HEAP8; + case Uint8Array: + return c.HEAP8U; + case Int16Array: + return c.HEAP16; + case Uint16Array: + return c.HEAP16U; + case Int32Array: + return c.HEAP32; + case Uint32Array: + return c.HEAP32U; + case 8: + return unsigned ? c.HEAP8U : c.HEAP8; + case 16: + return unsigned ? c.HEAP16U : c.HEAP16; + case 32: + return unsigned ? c.HEAP32U : c.HEAP32; + case 64: + if (c.HEAP64) return unsigned ? c.HEAP64U : c.HEAP64; + break; + default: + if (target.bigIntEnabled) { + if (n === globalThis['BigUint64Array']) return c.HEAP64U; + else if (n === globalThis['BigInt64Array']) return c.HEAP64; + break; + } + } + toss( + 'Invalid heapForSize() size: expecting 8, 16, 32,', + 'or (if BigInt is enabled) 64.', + ); + }; + + target.functionTable = function () { + return target.exports.__indirect_function_table; + }; + + target.functionEntry = function (fptr) { + const ft = target.functionTable(); + return fptr < ft.length ? ft.get(fptr) : undefined; + }; + + target.jsFuncToWasm = function f(func, sig) { + if (!f._) { + f._ = { + 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: 0x7c, + f32: 0x7d, + i64: 0x7e, + i32: 0x7f, + }), + + uleb128Encode: function (tgt, method, n) { + if (n < 128) tgt[method](n); + else tgt[method](n % 128 | 128, n >> 7); + }, + + rxJSig: /^(\w)\((\w*)\)$/, + + sigParams: function (sig) { + const m = f._.rxJSig.exec(sig); + return m ? m[2] : sig.substr(1); + }, + + letterType: (x) => + f._.sigTypes[x] || toss('Invalid signature letter:', x), + + pushSigType: (dest, letter) => + dest.push(f._.typeCodes[f._.letterType(letter)]), + }; + } + if ('string' === typeof func) { + const x = sig; + sig = func; + func = x; + } + const sigParams = f._.sigParams(sig); + const wasmCode = [0x01, 0x60]; + f._.uleb128Encode(wasmCode, 'push', sigParams.length); + for (const x of sigParams) f._.pushSigType(wasmCode, x); + if ('v' === sig[0]) wasmCode.push(0); + else { + wasmCode.push(1); + f._.pushSigType(wasmCode, sig[0]); + } + f._.uleb128Encode(wasmCode, 'unshift', wasmCode.length); + wasmCode.unshift( + 0x00, + 0x61, + 0x73, + 0x6d, + 0x01, + 0x00, + 0x00, + 0x00, + 0x01, + ); + wasmCode.push( + 0x02, + 0x07, + + 0x01, + 0x01, + 0x65, + 0x01, + 0x66, + 0x00, + 0x00, + 0x07, + 0x05, + + 0x01, + 0x01, + 0x66, + 0x00, + 0x00, + ); + return new WebAssembly.Instance( + new WebAssembly.Module(new Uint8Array(wasmCode)), + { + e: { f: func }, + }, + ).exports['f']; + }; + + const __installFunction = function f(func, sig, scoped) { + if (scoped && !cache.scopedAlloc.length) { + toss('No scopedAllocPush() scope is active.'); + } + if ('string' === typeof func) { + const x = sig; + sig = func; + func = x; + } + if ('string' !== typeof sig || !(func instanceof Function)) { + toss( + 'Invalid arguments: expecting (function,signature) ' + + 'or (signature,function).', + ); + } + const ft = target.functionTable(); + const oldLen = ft.length; + let ptr; + while (cache.freeFuncIndexes.length) { + ptr = cache.freeFuncIndexes.pop(); + if (ft.get(ptr)) { + ptr = null; + continue; + } else { + break; + } + } + if (!ptr) { + ptr = oldLen; + ft.grow(1); + } + try { + ft.set(ptr, func); + if (scoped) { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(ptr); + } + return ptr; + } catch (e) { + if (!(e instanceof TypeError)) { + if (ptr === oldLen) cache.freeFuncIndexes.push(oldLen); + throw e; + } + } + + try { + const fptr = target.jsFuncToWasm(func, sig); + ft.set(ptr, fptr); + if (scoped) { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(ptr); + } + } catch (e) { + if (ptr === oldLen) cache.freeFuncIndexes.push(oldLen); + throw e; + } + return ptr; + }; + + target.installFunction = (func, sig) => + __installFunction(func, sig, false); + + target.scopedInstallFunction = (func, sig) => + __installFunction(func, sig, true); + + target.uninstallFunction = function (ptr) { + if (!ptr && 0 !== ptr) return undefined; + const fi = cache.freeFuncIndexes; + const ft = target.functionTable(); + fi.push(ptr); + const rc = ft.get(ptr); + ft.set(ptr, null); + return rc; + }; + + target.peek = function f(ptr, type = 'i8') { + if (type.endsWith('*')) type = ptrIR; + const c = + cache.memory && cache.heapSize === cache.memory.buffer.byteLength + ? cache + : heapWrappers(); + const list = Array.isArray(ptr) ? [] : undefined; + let rc; + do { + if (list) ptr = arguments[0].shift(); + switch (type) { + case 'i1': + case 'i8': + rc = c.HEAP8[ptr >> 0]; + break; + case 'i16': + rc = c.HEAP16[ptr >> 1]; + break; + case 'i32': + rc = c.HEAP32[ptr >> 2]; + break; + case 'float': + case 'f32': + rc = c.HEAP32F[ptr >> 2]; + break; + case 'double': + case 'f64': + rc = Number(c.HEAP64F[ptr >> 3]); + break; + case 'i64': + if (target.bigIntEnabled) { + rc = BigInt(c.HEAP64[ptr >> 3]); + break; + } + + default: + toss('Invalid type for peek():', type); + } + if (list) list.push(rc); + } while (list && arguments[0].length); + return list || rc; + }; + + target.poke = function (ptr, value, type = 'i8') { + if (type.endsWith('*')) type = ptrIR; + const c = + cache.memory && cache.heapSize === cache.memory.buffer.byteLength + ? cache + : heapWrappers(); + for (const p of Array.isArray(ptr) ? ptr : [ptr]) { + switch (type) { + case 'i1': + case 'i8': + c.HEAP8[p >> 0] = value; + continue; + case 'i16': + c.HEAP16[p >> 1] = value; + continue; + case 'i32': + c.HEAP32[p >> 2] = value; + continue; + case 'float': + case 'f32': + c.HEAP32F[p >> 2] = value; + continue; + case 'double': + case 'f64': + c.HEAP64F[p >> 3] = value; + continue; + case 'i64': + if (c.HEAP64) { + c.HEAP64[p >> 3] = BigInt(value); + continue; + } + + default: + toss('Invalid type for poke(): ' + type); + } + } + return this; + }; + + target.peekPtr = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, ptrIR); + + target.pokePtr = (ptr, value = 0) => target.poke(ptr, value, ptrIR); + + target.peek8 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i8'); + + target.poke8 = (ptr, value) => target.poke(ptr, value, 'i8'); + + target.peek16 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i16'); + + target.poke16 = (ptr, value) => target.poke(ptr, value, 'i16'); + + target.peek32 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i32'); + + target.poke32 = (ptr, value) => target.poke(ptr, value, 'i32'); + + target.peek64 = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'i64'); + + target.poke64 = (ptr, value) => target.poke(ptr, value, 'i64'); + + target.peek32f = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'f32'); + + target.poke32f = (ptr, value) => target.poke(ptr, value, 'f32'); + + target.peek64f = (...ptr) => + target.peek(1 === ptr.length ? ptr[0] : ptr, 'f64'); + + target.poke64f = (ptr, value) => target.poke(ptr, value, 'f64'); + + target.getMemValue = target.peek; + + target.getPtrValue = target.peekPtr; + + target.setMemValue = target.poke; + + target.setPtrValue = target.pokePtr; + + target.isPtr32 = (ptr) => + 'number' === typeof ptr && ptr === (ptr | 0) && ptr >= 0; + + target.isPtr = target.isPtr32; + + target.cstrlen = function (ptr) { + if (!ptr || !target.isPtr(ptr)) return null; + const h = heapWrappers().HEAP8U; + let pos = ptr; + for (; h[pos] !== 0; ++pos) {} + return pos - ptr; + }; + + const __SAB = + 'undefined' === typeof SharedArrayBuffer + ? function () {} + : SharedArrayBuffer; + const __utf8Decode = function (arrayBuffer, begin, end) { + return cache.utf8Decoder.decode( + arrayBuffer.buffer instanceof __SAB + ? arrayBuffer.slice(begin, end) + : arrayBuffer.subarray(begin, end), + ); + }; + + target.cstrToJs = function (ptr) { + const n = target.cstrlen(ptr); + return n + ? __utf8Decode(heapWrappers().HEAP8U, ptr, ptr + n) + : null === n + ? n + : ''; + }; + + target.jstrlen = function (str) { + if ('string' !== typeof str) return null; + const n = str.length; + let len = 0; + for (let i = 0; i < n; ++i) { + let u = str.charCodeAt(i); + if (u >= 0xd800 && u <= 0xdfff) { + u = + (0x10000 + ((u & 0x3ff) << 10)) | (str.charCodeAt(++i) & 0x3ff); + } + if (u <= 0x7f) ++len; + else if (u <= 0x7ff) len += 2; + else if (u <= 0xffff) len += 3; + else len += 4; + } + return len; + }; + + target.jstrcpy = function ( + jstr, + tgt, + offset = 0, + maxBytes = -1, + addNul = true, + ) { + if ( + !tgt || + (!(tgt instanceof Int8Array) && !(tgt instanceof Uint8Array)) + ) { + toss('jstrcpy() target must be an Int8Array or Uint8Array.'); + } + if (maxBytes < 0) maxBytes = tgt.length - offset; + if (!(maxBytes > 0) || !(offset >= 0)) return 0; + let i = 0, + max = jstr.length; + const begin = offset, + end = offset + maxBytes - (addNul ? 1 : 0); + for (; i < max && offset < end; ++i) { + let u = jstr.charCodeAt(i); + if (u >= 0xd800 && u <= 0xdfff) { + u = + (0x10000 + ((u & 0x3ff) << 10)) | + (jstr.charCodeAt(++i) & 0x3ff); + } + if (u <= 0x7f) { + if (offset >= end) break; + tgt[offset++] = u; + } else if (u <= 0x7ff) { + if (offset + 1 >= end) break; + tgt[offset++] = 0xc0 | (u >> 6); + tgt[offset++] = 0x80 | (u & 0x3f); + } else if (u <= 0xffff) { + if (offset + 2 >= end) break; + tgt[offset++] = 0xe0 | (u >> 12); + tgt[offset++] = 0x80 | ((u >> 6) & 0x3f); + tgt[offset++] = 0x80 | (u & 0x3f); + } else { + if (offset + 3 >= end) break; + tgt[offset++] = 0xf0 | (u >> 18); + tgt[offset++] = 0x80 | ((u >> 12) & 0x3f); + tgt[offset++] = 0x80 | ((u >> 6) & 0x3f); + tgt[offset++] = 0x80 | (u & 0x3f); + } + } + if (addNul) tgt[offset++] = 0; + return offset - begin; + }; + + target.cstrncpy = function (tgtPtr, srcPtr, n) { + if (!tgtPtr || !srcPtr) + toss('cstrncpy() does not accept NULL strings.'); + if (n < 0) n = target.cstrlen(strPtr) + 1; + else if (!(n > 0)) return 0; + const heap = target.heap8u(); + let i = 0, + ch; + for (; i < n && (ch = heap[srcPtr + i]); ++i) { + heap[tgtPtr + i] = ch; + } + if (i < n) heap[tgtPtr + i++] = 0; + return i; + }; + + target.jstrToUintArray = (str, addNul = false) => { + return cache.utf8Encoder.encode(addNul ? str + '\0' : str); + }; + + const __affirmAlloc = (obj, funcName) => { + if ( + !(obj.alloc instanceof Function) || + !(obj.dealloc instanceof Function) + ) { + toss( + 'Object is missing alloc() and/or dealloc() function(s)', + 'required by', + funcName + '().', + ); + } + }; + + const __allocCStr = function ( + jstr, + returnWithLength, + allocator, + funcName, + ) { + __affirmAlloc(target, funcName); + if ('string' !== typeof jstr) return null; + if (0) { + const n = target.jstrlen(jstr), + ptr = allocator(n + 1); + target.jstrcpy(jstr, target.heap8u(), ptr, n + 1, true); + return returnWithLength ? [ptr, n] : ptr; + } else { + const u = cache.utf8Encoder.encode(jstr), + ptr = allocator(u.length + 1), + heap = heapWrappers().HEAP8U; + heap.set(u, ptr); + heap[ptr + u.length] = 0; + return returnWithLength ? [ptr, u.length] : ptr; + } + }; + + target.allocCString = (jstr, returnWithLength = false) => + __allocCStr(jstr, returnWithLength, target.alloc, 'allocCString()'); + + target.scopedAllocPush = function () { + __affirmAlloc(target, 'scopedAllocPush'); + const a = []; + cache.scopedAlloc.push(a); + return a; + }; + + target.scopedAllocPop = function (state) { + __affirmAlloc(target, 'scopedAllocPop'); + const n = arguments.length + ? cache.scopedAlloc.indexOf(state) + : cache.scopedAlloc.length - 1; + if (n < 0) toss('Invalid state object for scopedAllocPop().'); + if (0 === arguments.length) state = cache.scopedAlloc[n]; + cache.scopedAlloc.splice(n, 1); + for (let p; (p = state.pop()); ) { + if (target.functionEntry(p)) { + target.uninstallFunction(p); + } else target.dealloc(p); + } + }; + + target.scopedAlloc = function (n) { + if (!cache.scopedAlloc.length) { + toss('No scopedAllocPush() scope is active.'); + } + const p = target.alloc(n); + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(p); + return p; + }; + + Object.defineProperty(target.scopedAlloc, 'level', { + configurable: false, + enumerable: false, + get: () => cache.scopedAlloc.length, + set: () => toss("The 'active' property is read-only."), + }); + + target.scopedAllocCString = (jstr, returnWithLength = false) => + __allocCStr( + jstr, + returnWithLength, + target.scopedAlloc, + 'scopedAllocCString()', + ); + + const __allocMainArgv = function (isScoped, list) { + const pList = target[isScoped ? 'scopedAlloc' : 'alloc']( + (list.length + 1) * target.ptrSizeof, + ); + let i = 0; + list.forEach((e) => { + target.pokePtr( + pList + target.ptrSizeof * i++, + target[isScoped ? 'scopedAllocCString' : 'allocCString']('' + e), + ); + }); + target.pokePtr(pList + target.ptrSizeof * i, 0); + return pList; + }; + + target.scopedAllocMainArgv = (list) => __allocMainArgv(true, list); + + target.allocMainArgv = (list) => __allocMainArgv(false, list); + + target.cArgvToJs = (argc, pArgv) => { + const list = []; + for (let i = 0; i < argc; ++i) { + const arg = target.peekPtr(pArgv + target.ptrSizeof * i); + list.push(arg ? target.cstrToJs(arg) : null); + } + return list; + }; + + target.scopedAllocCall = function (func) { + target.scopedAllocPush(); + try { + return func(); + } finally { + target.scopedAllocPop(); + } + }; + + const __allocPtr = function (howMany, safePtrSize, method) { + __affirmAlloc(target, method); + const pIr = safePtrSize ? 'i64' : ptrIR; + let m = target[method](howMany * (safePtrSize ? 8 : ptrSizeof)); + target.poke(m, 0, pIr); + if (1 === howMany) { + return m; + } + const a = [m]; + for (let i = 1; i < howMany; ++i) { + m += safePtrSize ? 8 : ptrSizeof; + a[i] = m; + target.poke(m, 0, pIr); + } + return a; + }; + + target.allocPtr = (howMany = 1, safePtrSize = true) => + __allocPtr(howMany, safePtrSize, 'alloc'); + + target.scopedAllocPtr = (howMany = 1, safePtrSize = true) => + __allocPtr(howMany, safePtrSize, 'scopedAlloc'); + + target.xGet = function (name) { + return ( + target.exports[name] || toss('Cannot find exported symbol:', name) + ); + }; + + const __argcMismatch = (f, n) => + toss(f + '() requires', n, 'argument(s).'); + + target.xCall = function (fname, ...args) { + const f = fname instanceof Function ? fname : target.xGet(fname); + if (!(f instanceof Function)) + toss('Exported symbol', fname, 'is not a function.'); + if (f.length !== args.length) + __argcMismatch(f === fname ? f.name : fname, f.length); + return 2 === arguments.length && Array.isArray(arguments[1]) + ? f.apply(null, arguments[1]) + : f.apply(null, args); + }; + + cache.xWrap = Object.create(null); + cache.xWrap.convert = Object.create(null); + + cache.xWrap.convert.arg = new Map(); + + cache.xWrap.convert.result = new Map(); + const xArg = cache.xWrap.convert.arg, + xResult = cache.xWrap.convert.result; + + if (target.bigIntEnabled) { + xArg.set('i64', (i) => BigInt(i)); + } + const __xArgPtr = + 'i32' === ptrIR ? (i) => i | 0 : (i) => BigInt(i) | BigInt(0); + xArg + .set('i32', __xArgPtr) + .set('i16', (i) => (i | 0) & 0xffff) + .set('i8', (i) => (i | 0) & 0xff) + .set('f32', (i) => Number(i).valueOf()) + .set('float', xArg.get('f32')) + .set('f64', xArg.get('f32')) + .set('double', xArg.get('f64')) + .set('int', xArg.get('i32')) + .set('null', (i) => i) + .set(null, xArg.get('null')) + .set('**', __xArgPtr) + .set('*', __xArgPtr); + xResult + .set('*', __xArgPtr) + .set('pointer', __xArgPtr) + .set('number', (v) => Number(v)) + .set('void', (v) => undefined) + .set('null', (v) => v) + .set(null, xResult.get('null')); + + { + const copyToResult = [ + 'i8', + 'i16', + 'i32', + 'int', + 'f32', + 'float', + 'f64', + 'double', + ]; + if (target.bigIntEnabled) copyToResult.push('i64'); + const adaptPtr = xArg.get(ptrIR); + for (const t of copyToResult) { + xArg.set(t + '*', adaptPtr); + xResult.set(t + '*', adaptPtr); + xResult.set(t, xArg.get(t) || toss('Missing arg converter:', t)); + } + } + + const __xArgString = function (v) { + if ('string' === typeof v) return target.scopedAllocCString(v); + return v ? __xArgPtr(v) : null; + }; + xArg + .set('string', __xArgString) + .set('utf8', __xArgString) + .set('pointer', __xArgString); + + xResult + .set('string', (i) => target.cstrToJs(i)) + .set('utf8', xResult.get('string')) + .set('string:dealloc', (i) => { + try { + return i ? target.cstrToJs(i) : null; + } finally { + target.dealloc(i); + } + }) + .set('utf8:dealloc', xResult.get('string:dealloc')) + .set('json', (i) => JSON.parse(target.cstrToJs(i))) + .set('json:dealloc', (i) => { + try { + return i ? JSON.parse(target.cstrToJs(i)) : null; + } finally { + target.dealloc(i); + } + }); + + const AbstractArgAdapter = class { + constructor(opt) { + this.name = opt.name || 'unnamed adapter'; + } + + convertArg(v, argv, argIndex) { + toss('AbstractArgAdapter must be subclassed.'); + } + }; + + xArg.FuncPtrAdapter = class FuncPtrAdapter extends AbstractArgAdapter { + constructor(opt) { + super(opt); + if (xArg.FuncPtrAdapter.warnOnUse) { + console.warn( + 'xArg.FuncPtrAdapter is an internal-only API', + 'and is not intended to be invoked from', + 'client-level code. Invoked with:', + opt, + ); + } + this.name = opt.name || 'unnamed'; + this.signature = opt.signature; + if (opt.contextKey instanceof Function) { + this.contextKey = opt.contextKey; + if (!opt.bindScope) opt.bindScope = 'context'; + } + this.bindScope = + opt.bindScope || + toss( + 'FuncPtrAdapter options requires a bindScope (explicit or implied).', + ); + if (FuncPtrAdapter.bindScopes.indexOf(opt.bindScope) < 0) { + toss( + 'Invalid options.bindScope (' + + opt.bindMod + + ') for FuncPtrAdapter. ' + + 'Expecting one of: (' + + FuncPtrAdapter.bindScopes.join(', ') + + ')', + ); + } + this.isTransient = 'transient' === this.bindScope; + this.isContext = 'context' === this.bindScope; + this.isPermanent = 'permanent' === this.bindScope; + this.singleton = 'singleton' === this.bindScope ? [] : undefined; + + this.callProxy = + opt.callProxy instanceof Function ? opt.callProxy : undefined; + } + + contextKey(argv, argIndex) { + return this; + } + + contextMap(key) { + const cm = this.__cmap || (this.__cmap = new Map()); + let rc = cm.get(key); + if (undefined === rc) cm.set(key, (rc = [])); + return rc; + } + + convertArg(v, argv, argIndex) { + let pair = this.singleton; + if (!pair && this.isContext) { + pair = this.contextMap(this.contextKey(argv, argIndex)); + } + if (pair && pair[0] === v) return pair[1]; + if (v instanceof Function) { + if (this.callProxy) v = this.callProxy(v); + const fp = __installFunction(v, this.signature, this.isTransient); + if (FuncPtrAdapter.debugFuncInstall) { + FuncPtrAdapter.debugOut( + 'FuncPtrAdapter installed', + this, + this.contextKey(argv, argIndex), + '@' + fp, + v, + ); + } + if (pair) { + if (pair[1]) { + if (FuncPtrAdapter.debugFuncInstall) { + FuncPtrAdapter.debugOut( + 'FuncPtrAdapter uninstalling', + this, + this.contextKey(argv, argIndex), + '@' + pair[1], + v, + ); + } + try { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push( + pair[1], + ); + } catch (e) {} + } + pair[0] = v; + pair[1] = fp; + } + return fp; + } else if (target.isPtr(v) || null === v || undefined === v) { + if (pair && pair[1] && pair[1] !== v) { + if (FuncPtrAdapter.debugFuncInstall) { + FuncPtrAdapter.debugOut( + 'FuncPtrAdapter uninstalling', + this, + this.contextKey(argv, argIndex), + '@' + pair[1], + v, + ); + } + try { + cache.scopedAlloc[cache.scopedAlloc.length - 1].push(pair[1]); + } catch (e) {} + pair[0] = pair[1] = v | 0; + } + return v || 0; + } else { + throw new TypeError( + 'Invalid FuncPtrAdapter argument type. ' + + 'Expecting a function pointer or a ' + + (this.name ? this.name + ' ' : '') + + 'function matching signature ' + + this.signature + + '.', + ); + } + } + }; + + xArg.FuncPtrAdapter.warnOnUse = false; + + xArg.FuncPtrAdapter.debugFuncInstall = false; + + xArg.FuncPtrAdapter.debugOut = console.debug.bind(console); + + xArg.FuncPtrAdapter.bindScopes = [ + 'transient', + 'context', + 'singleton', + 'permanent', + ]; + + const __xArgAdapterCheck = (t) => + xArg.get(t) || toss('Argument adapter not found:', t); + + const __xResultAdapterCheck = (t) => + xResult.get(t) || toss('Result adapter not found:', t); + + cache.xWrap.convertArg = (t, ...args) => __xArgAdapterCheck(t)(...args); + + cache.xWrap.convertArgNoCheck = (t, ...args) => xArg.get(t)(...args); + + cache.xWrap.convertResult = (t, v) => + null === t ? v : t ? __xResultAdapterCheck(t)(v) : undefined; + + cache.xWrap.convertResultNoCheck = (t, v) => + null === t ? v : t ? xResult.get(t)(v) : undefined; + + target.xWrap = function (fArg, resultType, ...argTypes) { + if (3 === arguments.length && Array.isArray(arguments[2])) { + argTypes = arguments[2]; + } + if (target.isPtr(fArg)) { + fArg = + target.functionEntry(fArg) || + toss('Function pointer not found in WASM function table.'); + } + const fIsFunc = fArg instanceof Function; + const xf = fIsFunc ? fArg : target.xGet(fArg); + if (fIsFunc) fArg = xf.name || 'unnamed function'; + if (argTypes.length !== xf.length) __argcMismatch(fArg, xf.length); + if (null === resultType && 0 === xf.length) { + return xf; + } + if (undefined !== resultType && null !== resultType) + __xResultAdapterCheck(resultType); + for (const t of argTypes) { + if (t instanceof AbstractArgAdapter) + xArg.set(t, (...args) => t.convertArg(...args)); + else __xArgAdapterCheck(t); + } + const cxw = cache.xWrap; + if (0 === xf.length) { + return (...args) => + args.length + ? __argcMismatch(fArg, xf.length) + : cxw.convertResult(resultType, xf.call(null)); + } + return function (...args) { + if (args.length !== xf.length) __argcMismatch(fArg, xf.length); + const scope = target.scopedAllocPush(); + try { + let i = 0; + for (; i < args.length; ++i) + args[i] = cxw.convertArgNoCheck(argTypes[i], args[i], args, i); + return cxw.convertResultNoCheck(resultType, xf.apply(null, args)); + } finally { + target.scopedAllocPop(scope); + } + }; + }; + + const __xAdapter = function ( + func, + argc, + typeName, + adapter, + modeName, + xcvPart, + ) { + if ('string' === typeof typeName) { + if (1 === argc) return xcvPart.get(typeName); + else if (2 === argc) { + if (!adapter) { + xcvPart.delete(typeName); + return func; + } else if (!(adapter instanceof Function)) { + toss(modeName, 'requires a function argument.'); + } + xcvPart.set(typeName, adapter); + return func; + } + } + toss('Invalid arguments to', modeName); + }; + + target.xWrap.resultAdapter = function f(typeName, adapter) { + return __xAdapter( + f, + arguments.length, + typeName, + adapter, + 'resultAdapter()', + xResult, + ); + }; + + target.xWrap.argAdapter = function f(typeName, adapter) { + return __xAdapter( + f, + arguments.length, + typeName, + adapter, + 'argAdapter()', + xArg, + ); + }; + + target.xWrap.FuncPtrAdapter = xArg.FuncPtrAdapter; + + target.xCallWrapped = function (fArg, resultType, argTypes, ...args) { + if (Array.isArray(arguments[3])) args = arguments[3]; + return target + .xWrap(fArg, resultType, argTypes || []) + .apply(null, args || []); + }; + + target.xWrap.testConvertArg = cache.xWrap.convertArg; + + target.xWrap.testConvertResult = cache.xWrap.convertResult; + + return target; + }; + + globalThis.WhWasmUtilInstaller.yawl = function (config) { + const wfetch = () => fetch(config.uri, { credentials: 'same-origin' }); + const wui = this; + const finalThen = function (arg) { + if (config.wasmUtilTarget) { + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + const tgt = config.wasmUtilTarget; + tgt.module = arg.module; + tgt.instance = arg.instance; + + if (!tgt.instance.exports.memory) { + tgt.memory = + (config.imports && + config.imports.env && + config.imports.env.memory) || + toss("Missing 'memory' object!"); + } + if (!tgt.alloc && arg.instance.exports.malloc) { + const exports = arg.instance.exports; + tgt.alloc = function (n) { + return ( + exports.malloc(n) || toss('Allocation of', n, 'bytes failed.') + ); + }; + tgt.dealloc = function (m) { + exports.free(m); + }; + } + wui(tgt); + } + if (config.onload) config.onload(arg, config); + return arg; + }; + const loadWasm = WebAssembly.instantiateStreaming + ? function loadWasmStreaming() { + return WebAssembly.instantiateStreaming( + wfetch(), + config.imports || {}, + ).then(finalThen); + } + : function loadWasmOldSchool() { + return wfetch() + .then((response) => response.arrayBuffer()) + .then((bytes) => + WebAssembly.instantiate(bytes, config.imports || {}), + ) + .then(finalThen); + }; + return loadWasm; + }.bind(globalThis.WhWasmUtilInstaller); + + ('use strict'); + globalThis.Jaccwabyt = function StructBinderFactory(config) { + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + + if ( + !(config.heap instanceof WebAssembly.Memory) && + !(config.heap instanceof Function) + ) { + toss( + 'config.heap must be WebAssembly.Memory instance or a function.', + ); + } + ['alloc', 'dealloc'].forEach(function (k) { + config[k] instanceof Function || + toss("Config option '" + k + "' must be a function."); + }); + const SBF = StructBinderFactory; + const heap = + config.heap instanceof Function + ? config.heap + : () => new Uint8Array(config.heap.buffer), + alloc = config.alloc, + dealloc = config.dealloc, + log = config.log || console.log.bind(console), + memberPrefix = config.memberPrefix || '', + memberSuffix = config.memberSuffix || '', + bigIntEnabled = + undefined === config.bigIntEnabled + ? !!globalThis['BigInt64Array'] + : !!config.bigIntEnabled, + BigInt = globalThis['BigInt'], + BigInt64Array = globalThis['BigInt64Array'], + ptrSizeof = config.ptrSizeof || 4, + ptrIR = config.ptrIR || 'i32'; + if (!SBF.debugFlags) { + SBF.__makeDebugFlags = function (deriveFrom = null) { + if (deriveFrom && deriveFrom.__flags) + deriveFrom = deriveFrom.__flags; + const f = function f(flags) { + if (0 === arguments.length) { + return f.__flags; + } + if (flags < 0) { + delete f.__flags.getter; + delete f.__flags.setter; + delete f.__flags.alloc; + delete f.__flags.dealloc; + } else { + f.__flags.getter = 0 !== (0x01 & flags); + f.__flags.setter = 0 !== (0x02 & flags); + f.__flags.alloc = 0 !== (0x04 & flags); + f.__flags.dealloc = 0 !== (0x08 & flags); + } + return f._flags; + }; + Object.defineProperty(f, '__flags', { + iterable: false, + writable: false, + value: Object.create(deriveFrom), + }); + if (!deriveFrom) f(0); + return f; + }; + SBF.debugFlags = SBF.__makeDebugFlags(); + } + + const isLittleEndian = (function () { + const buffer = new ArrayBuffer(2); + new DataView(buffer).setInt16(0, 256, true); + + return new Int16Array(buffer)[0] === 256; + })(); + + const isFuncSig = (s) => '(' === s[1]; + + const isPtrSig = (s) => 'p' === s || 'P' === s; + const isAutoPtrSig = (s) => 'P' === s; + const sigLetter = (s) => (isFuncSig(s) ? 'p' : s[0]); + + const sigIR = function (s) { + switch (sigLetter(s)) { + case 'c': + case 'C': + return 'i8'; + case 'i': + return 'i32'; + case 'p': + case 'P': + case 's': + return ptrIR; + case 'j': + return 'i64'; + case 'f': + return 'float'; + case 'd': + return 'double'; + } + toss('Unhandled signature IR:', s); + }; + + const affirmBigIntArray = BigInt64Array + ? () => true + : () => toss('BigInt64Array is not available.'); + + const sigDVGetter = function (s) { + switch (sigLetter(s)) { + case 'p': + case 'P': + case 's': { + switch (ptrSizeof) { + case 4: + return 'getInt32'; + case 8: + return affirmBigIntArray() && 'getBigInt64'; + } + break; + } + case 'i': + return 'getInt32'; + case 'c': + return 'getInt8'; + case 'C': + return 'getUint8'; + case 'j': + return affirmBigIntArray() && 'getBigInt64'; + case 'f': + return 'getFloat32'; + case 'd': + return 'getFloat64'; + } + toss('Unhandled DataView getter for signature:', s); + }; + + const sigDVSetter = function (s) { + switch (sigLetter(s)) { + case 'p': + case 'P': + case 's': { + switch (ptrSizeof) { + case 4: + return 'setInt32'; + case 8: + return affirmBigIntArray() && 'setBigInt64'; + } + break; + } + case 'i': + return 'setInt32'; + case 'c': + return 'setInt8'; + case 'C': + return 'setUint8'; + case 'j': + return affirmBigIntArray() && 'setBigInt64'; + case 'f': + return 'setFloat32'; + case 'd': + return 'setFloat64'; + } + toss('Unhandled DataView setter for signature:', s); + }; + + const sigDVSetWrapper = function (s) { + switch (sigLetter(s)) { + case 'i': + case 'f': + case 'c': + case 'C': + case 'd': + return Number; + case 'j': + return affirmBigIntArray() && BigInt; + case 'p': + case 'P': + case 's': + switch (ptrSizeof) { + case 4: + return Number; + case 8: + return affirmBigIntArray() && BigInt; + } + break; + } + toss('Unhandled DataView set wrapper for signature:', s); + }; + + const sPropName = (s, k) => s + '::' + k; + + const __propThrowOnSet = function (structName, propName) { + return () => toss(sPropName(structName, propName), 'is read-only.'); + }; + + const __instancePointerMap = new WeakMap(); + + const xPtrPropName = '(pointer-is-external)'; + + const __freeStruct = function (ctor, obj, m) { + if (!m) m = __instancePointerMap.get(obj); + if (m) { + __instancePointerMap.delete(obj); + if (Array.isArray(obj.ondispose)) { + let x; + while ((x = obj.ondispose.shift())) { + try { + if (x instanceof Function) x.call(obj); + else if (x instanceof StructType) x.dispose(); + else if ('number' === typeof x) dealloc(x); + } catch (e) { + console.warn( + 'ondispose() for', + ctor.structName, + '@', + m, + 'threw. NOT propagating it.', + e, + ); + } + } + } else if (obj.ondispose instanceof Function) { + try { + obj.ondispose(); + } catch (e) { + console.warn( + 'ondispose() for', + ctor.structName, + '@', + m, + 'threw. NOT propagating it.', + e, + ); + } + } + delete obj.ondispose; + if (ctor.debugFlags.__flags.dealloc) { + log( + 'debug.dealloc:', + obj[xPtrPropName] ? 'EXTERNAL' : '', + ctor.structName, + 'instance:', + ctor.structInfo.sizeof, + 'bytes @' + m, + ); + } + if (!obj[xPtrPropName]) dealloc(m); + } + }; + + const rop = (v) => { + return { + configurable: false, + writable: false, + iterable: false, + value: v, + }; + }; + + const __allocStruct = function (ctor, obj, m) { + let fill = !m; + if (m) Object.defineProperty(obj, xPtrPropName, rop(m)); + else { + m = alloc(ctor.structInfo.sizeof); + if (!m) toss('Allocation of', ctor.structName, 'structure failed.'); + } + try { + if (ctor.debugFlags.__flags.alloc) { + log( + 'debug.alloc:', + fill ? '' : 'EXTERNAL', + ctor.structName, + 'instance:', + ctor.structInfo.sizeof, + 'bytes @' + m, + ); + } + if (fill) heap().fill(0, m, m + ctor.structInfo.sizeof); + __instancePointerMap.set(obj, m); + } catch (e) { + __freeStruct(ctor, obj, m); + throw e; + } + }; + + const __memoryDump = function () { + const p = this.pointer; + return p + ? new Uint8Array(heap().slice(p, p + this.structInfo.sizeof)) + : null; + }; + + const __memberKey = (k) => memberPrefix + k + memberSuffix; + const __memberKeyProp = rop(__memberKey); + + const __lookupMember = function ( + structInfo, + memberName, + tossIfNotFound = true, + ) { + let m = structInfo.members[memberName]; + if (!m && (memberPrefix || memberSuffix)) { + for (const v of Object.values(structInfo.members)) { + if (v.key === memberName) { + m = v; + break; + } + } + if (!m && tossIfNotFound) { + toss( + sPropName(structInfo.name, memberName), + 'is not a mapped struct member.', + ); + } + } + return m; + }; + + const __memberSignature = function f( + obj, + memberName, + emscriptenFormat = false, + ) { + if (!f._) + f._ = (x) => + x.replace(/[^vipPsjrdcC]/g, '').replace(/[pPscC]/g, 'i'); + const m = __lookupMember(obj.structInfo, memberName, true); + return emscriptenFormat ? f._(m.signature) : m.signature; + }; + + const __ptrPropDescriptor = { + configurable: false, + enumerable: false, + get: function () { + return __instancePointerMap.get(this); + }, + set: () => toss("Cannot assign the 'pointer' property of a struct."), + }; + + const __structMemberKeys = rop(function () { + const a = []; + for (const k of Object.keys(this.structInfo.members)) { + a.push(this.memberKey(k)); + } + return a; + }); + + const __utf8Decoder = new TextDecoder('utf-8'); + const __utf8Encoder = new TextEncoder(); + + const __SAB = + 'undefined' === typeof SharedArrayBuffer + ? function () {} + : SharedArrayBuffer; + const __utf8Decode = function (arrayBuffer, begin, end) { + return __utf8Decoder.decode( + arrayBuffer.buffer instanceof __SAB + ? arrayBuffer.slice(begin, end) + : arrayBuffer.subarray(begin, end), + ); + }; + + const __memberIsString = function ( + obj, + memberName, + tossIfNotFound = false, + ) { + const m = __lookupMember(obj.structInfo, memberName, tossIfNotFound); + return m && 1 === m.signature.length && 's' === m.signature[0] + ? m + : false; + }; + + const __affirmCStringSignature = function (member) { + if ('s' === member.signature) return; + toss( + 'Invalid member type signature for C-string value:', + JSON.stringify(member), + ); + }; + + const __memberToJsString = function f(obj, memberName) { + const m = __lookupMember(obj.structInfo, memberName, true); + __affirmCStringSignature(m); + const addr = obj[m.key]; + + if (!addr) return null; + let pos = addr; + const mem = heap(); + for (; mem[pos] !== 0; ++pos) {} + + return addr === pos ? '' : __utf8Decode(mem, addr, pos); + }; + + const __addOnDispose = function (obj, ...v) { + if (obj.ondispose) { + if (!Array.isArray(obj.ondispose)) { + obj.ondispose = [obj.ondispose]; + } + } else { + obj.ondispose = []; + } + obj.ondispose.push(...v); + }; + + const __allocCString = function (str) { + const u = __utf8Encoder.encode(str); + const mem = alloc(u.length + 1); + if (!mem) toss('Allocation error while duplicating string:', str); + const h = heap(); + + h.set(u, mem); + h[mem + u.length] = 0; + + return mem; + }; + + const __setMemberCString = function (obj, memberName, str) { + const m = __lookupMember(obj.structInfo, memberName, true); + __affirmCStringSignature(m); + + const mem = __allocCString(str); + obj[m.key] = mem; + __addOnDispose(obj, mem); + return obj; + }; + + const StructType = function ctor(structName, structInfo) { + if (arguments[2] !== rop) { + toss( + 'Do not call the StructType constructor', + 'from client-level code.', + ); + } + Object.defineProperties(this, { + structName: rop(structName), + structInfo: rop(structInfo), + }); + }; + + StructType.prototype = Object.create(null, { + dispose: rop(function () { + __freeStruct(this.constructor, this); + }), + lookupMember: rop(function (memberName, tossIfNotFound = true) { + return __lookupMember(this.structInfo, memberName, tossIfNotFound); + }), + memberToJsString: rop(function (memberName) { + return __memberToJsString(this, memberName); + }), + memberIsString: rop(function (memberName, tossIfNotFound = true) { + return __memberIsString(this, memberName, tossIfNotFound); + }), + memberKey: __memberKeyProp, + memberKeys: __structMemberKeys, + memberSignature: rop(function (memberName, emscriptenFormat = false) { + return __memberSignature(this, memberName, emscriptenFormat); + }), + memoryDump: rop(__memoryDump), + pointer: __ptrPropDescriptor, + setMemberCString: rop(function (memberName, str) { + return __setMemberCString(this, memberName, str); + }), + }); + + Object.assign(StructType.prototype, { + addOnDispose: function (...v) { + __addOnDispose(this, ...v); + return this; + }, + }); + + Object.defineProperties(StructType, { + allocCString: rop(__allocCString), + isA: rop((v) => v instanceof StructType), + hasExternalPointer: rop( + (v) => v instanceof StructType && !!v[xPtrPropName], + ), + memberKey: __memberKeyProp, + }); + + const isNumericValue = (v) => + Number.isFinite(v) || v instanceof (BigInt || Number); + + const makeMemberWrapper = function f(ctor, name, descr) { + if (!f._) { + f._ = { getters: {}, setters: {}, sw: {} }; + const a = ['i', 'c', 'C', 'p', 'P', 's', 'f', 'd', 'v()']; + if (bigIntEnabled) a.push('j'); + a.forEach(function (v) { + f._.getters[v] = sigDVGetter(v); + f._.setters[v] = sigDVSetter(v); + f._.sw[v] = sigDVSetWrapper(v); + }); + const rxSig1 = /^[ipPsjfdcC]$/, + rxSig2 = /^[vipPsjfdcC]\([ipPsjfdcC]*\)$/; + f.sigCheck = function (obj, name, key, sig) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + toss(obj.structName, 'already has a property named', key + '.'); + } + rxSig1.test(sig) || + rxSig2.test(sig) || + toss( + 'Malformed signature for', + sPropName(obj.structName, name) + ':', + sig, + ); + }; + } + const key = ctor.memberKey(name); + f.sigCheck(ctor.prototype, name, key, descr.signature); + descr.key = key; + descr.name = name; + const sigGlyph = sigLetter(descr.signature); + const xPropName = sPropName(ctor.prototype.structName, key); + const dbg = ctor.prototype.debugFlags.__flags; + + const prop = Object.create(null); + prop.configurable = false; + prop.enumerable = false; + prop.get = function () { + if (dbg.getter) { + log( + 'debug.getter:', + f._.getters[sigGlyph], + 'for', + sigIR(sigGlyph), + xPropName, + '@', + this.pointer, + '+', + descr.offset, + 'sz', + descr.sizeof, + ); + } + let rc = new DataView( + heap().buffer, + this.pointer + descr.offset, + descr.sizeof, + )[f._.getters[sigGlyph]](0, isLittleEndian); + if (dbg.getter) log('debug.getter:', xPropName, 'result =', rc); + return rc; + }; + if (descr.readOnly) { + prop.set = __propThrowOnSet(ctor.prototype.structName, key); + } else { + prop.set = function (v) { + if (dbg.setter) { + log( + 'debug.setter:', + f._.setters[sigGlyph], + 'for', + sigIR(sigGlyph), + xPropName, + '@', + this.pointer, + '+', + descr.offset, + 'sz', + descr.sizeof, + v, + ); + } + if (!this.pointer) { + toss('Cannot set struct property on disposed instance.'); + } + if (null === v) v = 0; + else + while (!isNumericValue(v)) { + if ( + isAutoPtrSig(descr.signature) && + v instanceof StructType + ) { + v = v.pointer || 0; + if (dbg.setter) + log('debug.setter:', xPropName, 'resolved to', v); + break; + } + toss('Invalid value for pointer-type', xPropName + '.'); + } + new DataView( + heap().buffer, + this.pointer + descr.offset, + descr.sizeof, + )[f._.setters[sigGlyph]](0, f._.sw[sigGlyph](v), isLittleEndian); + }; + } + Object.defineProperty(ctor.prototype, key, prop); + }; + + const StructBinder = function StructBinder(structName, structInfo) { + if (1 === arguments.length) { + structInfo = structName; + structName = structInfo.name; + } else if (!structInfo.name) { + structInfo.name = structName; + } + if (!structName) toss('Struct name is required.'); + let lastMember = false; + Object.keys(structInfo.members).forEach((k) => { + const m = structInfo.members[k]; + if (!m.sizeof) toss(structName, 'member', k, 'is missing sizeof.'); + else if (m.sizeof === 1) { + m.signature === 'c' || + m.signature === 'C' || + toss( + 'Unexpected sizeof==1 member', + sPropName(structInfo.name, k), + 'with signature', + m.signature, + ); + } else { + if (0 !== m.sizeof % 4) { + console.warn( + 'Invalid struct member description =', + m, + 'from', + structInfo, + ); + toss( + structName, + 'member', + k, + 'sizeof is not aligned. sizeof=' + m.sizeof, + ); + } + if (0 !== m.offset % 4) { + console.warn( + 'Invalid struct member description =', + m, + 'from', + structInfo, + ); + toss( + structName, + 'member', + k, + 'offset is not aligned. offset=' + m.offset, + ); + } + } + if (!lastMember || lastMember.offset < m.offset) lastMember = m; + }); + if (!lastMember) toss('No member property descriptions found.'); + else if (structInfo.sizeof < lastMember.offset + lastMember.sizeof) { + toss( + 'Invalid struct config:', + structName, + 'max member offset (' + lastMember.offset + ') ', + 'extends past end of struct (sizeof=' + structInfo.sizeof + ').', + ); + } + const debugFlags = rop(SBF.__makeDebugFlags(StructBinder.debugFlags)); + + const StructCtor = function StructCtor(externalMemory) { + if (!(this instanceof StructCtor)) { + toss( + 'The', + structName, + "constructor may only be called via 'new'.", + ); + } else if (arguments.length) { + if ( + externalMemory !== (externalMemory | 0) || + externalMemory <= 0 + ) { + toss('Invalid pointer value for', structName, 'constructor.'); + } + __allocStruct(StructCtor, this, externalMemory); + } else { + __allocStruct(StructCtor, this); + } + }; + Object.defineProperties(StructCtor, { + debugFlags: debugFlags, + isA: rop((v) => v instanceof StructCtor), + memberKey: __memberKeyProp, + memberKeys: __structMemberKeys, + methodInfoForKey: rop(function (mKey) {}), + structInfo: rop(structInfo), + structName: rop(structName), + }); + StructCtor.prototype = new StructType(structName, structInfo, rop); + Object.defineProperties(StructCtor.prototype, { + debugFlags: debugFlags, + constructor: rop(StructCtor), + }); + Object.keys(structInfo.members).forEach((name) => + makeMemberWrapper(StructCtor, name, structInfo.members[name]), + ); + return StructCtor; + }; + StructBinder.StructType = StructType; + StructBinder.config = config; + StructBinder.allocCString = __allocCString; + if (!StructBinder.debugFlags) { + StructBinder.debugFlags = SBF.__makeDebugFlags(SBF.debugFlags); + } + return StructBinder; + }; + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + 'use strict'; + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + const toss3 = sqlite3.SQLite3Error.toss; + const capi = sqlite3.capi, + wasm = sqlite3.wasm, + util = sqlite3.util; + globalThis.WhWasmUtilInstaller(wasm); + delete globalThis.WhWasmUtilInstaller; + + if (0) { + const dealloc = wasm.exports[sqlite3.config.deallocExportName]; + const nFunc = wasm.functionTable().length; + let i; + for (i = 0; i < nFunc; ++i) { + const e = wasm.functionEntry(i); + if (dealloc === e) { + capi.SQLITE_WASM_DEALLOC = i; + break; + } + } + if (dealloc !== wasm.functionEntry(capi.SQLITE_WASM_DEALLOC)) { + toss( + 'Internal error: cannot find function pointer for SQLITE_WASM_DEALLOC.', + ); + } + } + + wasm.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', undefined, '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 wasm.xWrap.FuncPtrAdapter({ + signature: 'i(pi)', + contextKey: (argv, argIndex) => argv[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 wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_commit_hook', + signature: 'i(p)', + contextKey: (argv) => argv[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 wasm.xWrap.FuncPtrAdapter({ + signature: 'i(pipp)', + bindScope: 'transient', + callProxy: (callback) => { + let aNames; + return (pVoid, nCols, pColVals, pColNames) => { + try { + const aVals = wasm.cArgvToJs(nCols, pColVals); + if (!aNames) aNames = wasm.cArgvToJs(nCols, pColNames); + return callback(aVals, aNames) | 0; + } catch (e) { + return e.resultCode || capi.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', undefined, '*'], + ['sqlite3_get_autocommit', 'int', 'sqlite3*'], + ['sqlite3_get_auxdata', '*', 'sqlite3_context*', 'int'], + ['sqlite3_initialize', undefined], + ['sqlite3_interrupt', undefined, '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', + undefined, + 'sqlite3_context*', + '*', + 'int', + '*', + ], + ['sqlite3_result_double', undefined, 'sqlite3_context*', 'f64'], + [ + 'sqlite3_result_error', + undefined, + 'sqlite3_context*', + 'string', + 'int', + ], + ['sqlite3_result_error_code', undefined, 'sqlite3_context*', 'int'], + ['sqlite3_result_error_nomem', undefined, 'sqlite3_context*'], + ['sqlite3_result_error_toobig', undefined, 'sqlite3_context*'], + ['sqlite3_result_int', undefined, 'sqlite3_context*', 'int'], + ['sqlite3_result_null', undefined, 'sqlite3_context*'], + [ + 'sqlite3_result_pointer', + undefined, + 'sqlite3_context*', + '*', + 'string:static', + '*', + ], + ['sqlite3_result_subtype', undefined, 'sqlite3_value*', 'int'], + [ + 'sqlite3_result_text', + undefined, + 'sqlite3_context*', + 'string', + 'int', + '*', + ], + ['sqlite3_result_zeroblob', undefined, 'sqlite3_context*', 'int'], + [ + 'sqlite3_rollback_hook', + 'void*', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_rollback_hook', + signature: 'v(p)', + contextKey: (argv) => argv[0], + }), + '*', + ], + ], + + [ + 'sqlite3_set_auxdata', + undefined, + [ + 'sqlite3_context*', + 'int', + '*', + true + ? '*' + : new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroyAuxData', + signature: 'v(p)', + contextKey: (argv, argIndex) => argv[0], + }), + ], + ], + ['sqlite3_shutdown', undefined], + ['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 wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_trace_v2::callback', + signature: 'i(ippp)', + contextKey: (argv, argIndex) => argv[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', undefined, '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*'], + ]; + + if (!!wasm.exports.sqlite3_progress_handler) { + wasm.bindingSignatures.push([ + 'sqlite3_progress_handler', + undefined, + [ + 'sqlite3*', + 'int', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xProgressHandler', + signature: 'i(p)', + bindScope: 'context', + contextKey: (argv, argIndex) => argv[0], + }), + '*', + ], + ]); + } + + if (!!wasm.exports.sqlite3_stmt_explain) { + wasm.bindingSignatures.push( + ['sqlite3_stmt_explain', 'int', 'sqlite3_stmt*', 'int'], + ['sqlite3_stmt_isexplain', 'int', 'sqlite3_stmt*'], + ); + } + + if (!!wasm.exports.sqlite3_set_authorizer) { + wasm.bindingSignatures.push([ + 'sqlite3_set_authorizer', + 'int', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_set_authorizer::xAuth', + signature: 'i(pi' + 'ssss)', + contextKey: (argv, argIndex) => argv[0], + callProxy: (callback) => { + return (pV, iCode, s0, s1, s2, s3) => { + try { + s0 = s0 && wasm.cstrToJs(s0); + s1 = s1 && wasm.cstrToJs(s1); + s2 = s2 && wasm.cstrToJs(s2); + s3 = s3 && wasm.cstrToJs(s3); + return callback(pV, iCode, s0, s1, s2, s3) || 0; + } catch (e) { + return e.resultCode || capi.SQLITE_ERROR; + } + }; + }, + }), + '*', + ], + ]); + } + + if (false && wasm.compileOptionUsed('SQLITE_ENABLE_NORMALIZE')) { + wasm.bindingSignatures.push([ + 'sqlite3_normalized_sql', + 'string', + 'sqlite3_stmt*', + ]); + } + + wasm.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', undefined, '*', 'i64'], + ['sqlite3_result_zeroblob64', 'int', '*', 'i64'], + ['sqlite3_serialize', '*', 'sqlite3*', 'string', '*', 'int'], + ['sqlite3_set_last_insert_rowid', undefined, ['sqlite3*', 'i64']], + ['sqlite3_status64', 'int', 'int', '*', '*', 'int'], + ['sqlite3_total_changes64', 'i64', ['sqlite3*']], + [ + 'sqlite3_update_hook', + '*', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_update_hook', + signature: 'v(iippj)', + contextKey: (argv) => argv[0], + callProxy: (callback) => { + return (p, op, z0, z1, rowid) => { + callback( + p, + op, + wasm.cstrToJs(z0), + wasm.cstrToJs(z1), + rowid, + ); + }; + }, + }), + '*', + ], + ], + ['sqlite3_uri_int64', 'i64', ['sqlite3_filename', 'string', 'i64']], + ['sqlite3_value_int64', 'i64', 'sqlite3_value*'], + ]; + + if (wasm.bigIntEnabled && !!wasm.exports.sqlite3_declare_vtab) { + wasm.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', + '**', + ], + ); + } + + if (wasm.bigIntEnabled && !!wasm.exports.sqlite3_preupdate_hook) { + wasm.bindingSignatures.int64.push( + ['sqlite3_preupdate_blobwrite', 'int', 'sqlite3*'], + ['sqlite3_preupdate_count', 'int', 'sqlite3*'], + ['sqlite3_preupdate_depth', 'int', 'sqlite3*'], + [ + 'sqlite3_preupdate_hook', + '*', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'sqlite3_preupdate_hook', + signature: 'v(ppippjj)', + contextKey: (argv) => argv[0], + callProxy: (callback) => { + return (p, db, op, zDb, zTbl, iKey1, iKey2) => { + callback( + p, + db, + op, + wasm.cstrToJs(zDb), + wasm.cstrToJs(zTbl), + iKey1, + iKey2, + ); + }; + }, + }), + '*', + ], + ], + ['sqlite3_preupdate_new', 'int', ['sqlite3*', 'int', '**']], + ['sqlite3_preupdate_old', 'int', ['sqlite3*', 'int', '**']], + ); + } + + if ( + wasm.bigIntEnabled && + !!wasm.exports.sqlite3changegroup_add && + !!wasm.exports.sqlite3session_create && + !!wasm.exports.sqlite3_preupdate_hook + ) { + const __ipsProxy = { + signature: 'i(ps)', + callProxy: (callback) => { + return (p, s) => { + try { + return callback(p, wasm.cstrToJs(s)) | 0; + } catch (e) { + return e.resultCode || capi.SQLITE_ERROR; + } + }; + }, + }; + + wasm.bindingSignatures.int64.push( + ...[ + [ + 'sqlite3changegroup_add', + 'int', + ['sqlite3_changegroup*', 'int', 'void*'], + ], + [ + 'sqlite3changegroup_add_strm', + 'int', + [ + 'sqlite3_changegroup*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changegroup_delete', + undefined, + ['sqlite3_changegroup*'], + ], + ['sqlite3changegroup_new', 'int', ['**']], + [ + 'sqlite3changegroup_output', + 'int', + ['sqlite3_changegroup*', 'int*', '**'], + ], + [ + 'sqlite3changegroup_output_strm', + 'int', + [ + 'sqlite3_changegroup*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xOutput', + signature: 'i(ppi)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changeset_apply', + 'int', + [ + 'sqlite3*', + 'int', + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xConflict', + signature: 'i(pip)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changeset_apply_strm', + 'int', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xConflict', + signature: 'i(pip)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3changeset_apply_v2', + 'int', + [ + 'sqlite3*', + 'int', + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xConflict', + signature: 'i(pip)', + bindScope: 'transient', + }), + 'void*', + '**', + 'int*', + 'int', + ], + ], + [ + 'sqlite3changeset_apply_v2_strm', + 'int', + [ + 'sqlite3*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + bindScope: 'transient', + ...__ipsProxy, + }), + new wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xInputA', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInputB', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + new wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xInput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + ], + ], + ['sqlite3changeset_start_v2', 'int', ['**', 'int', '*', 'int']], + [ + 'sqlite3changeset_start_v2_strm', + 'int', + [ + '**', + new wasm.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 wasm.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 wasm.xWrap.FuncPtrAdapter({ + name: 'xOutput', + signature: 'i(ppp)', + bindScope: 'transient', + }), + 'void*', + ], + ], + [ + 'sqlite3session_table_filter', + undefined, + [ + 'sqlite3_session*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFilter', + ...__ipsProxy, + contextKey: (argv, argIndex) => argv[0], + }), + '*', + ], + ], + ], + ); + } + + wasm.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'], + ]; + + sqlite3.StructBinder = globalThis.Jaccwabyt({ + heap: 0 ? wasm.memory : wasm.heap8u, + alloc: wasm.alloc, + dealloc: wasm.dealloc, + bigIntEnabled: wasm.bigIntEnabled, + memberPrefix: '$', + }); + delete globalThis.Jaccwabyt; + + { + const __xString = wasm.xWrap.argAdapter('string'); + wasm.xWrap.argAdapter('string:flexible', (v) => + __xString(util.flexibleString(v)), + ); + + wasm.xWrap.argAdapter( + 'string:static', + function (v) { + if (wasm.isPtr(v)) return v; + v = '' + v; + let rc = this[v]; + return rc || (this[v] = wasm.allocCString(v)); + }.bind(Object.create(null)), + ); + + const __xArgPtr = wasm.xWrap.argAdapter('*'); + const nilType = function () {}; + wasm.xWrap.argAdapter('sqlite3_filename', __xArgPtr)( + 'sqlite3_context*', + __xArgPtr, + )('sqlite3_value*', __xArgPtr)('void*', __xArgPtr)( + 'sqlite3_changegroup*', + __xArgPtr, + )('sqlite3_changeset_iter*', __xArgPtr)( + 'sqlite3_session*', + __xArgPtr, + )('sqlite3_stmt*', (v) => + __xArgPtr( + v instanceof (sqlite3?.oo1?.Stmt || nilType) ? v.pointer : v, + ), + )('sqlite3*', (v) => + __xArgPtr( + v instanceof (sqlite3?.oo1?.DB || nilType) ? v.pointer : v, + ), + )('sqlite3_vfs*', (v) => { + if ('string' === typeof v) { + return ( + capi.sqlite3_vfs_find(v) || + sqlite3.SQLite3Error.toss( + capi.SQLITE_NOTFOUND, + 'Unknown sqlite3_vfs name:', + v, + ) + ); + } + return __xArgPtr( + v instanceof (capi.sqlite3_vfs || nilType) ? v.pointer : v, + ); + }); + if (wasm.exports.sqlite3_declare_vtab) { + wasm.xWrap.argAdapter('sqlite3_index_info*', (v) => + __xArgPtr( + v instanceof (capi.sqlite3_index_info || nilType) + ? v.pointer + : v, + ), + )('sqlite3_module*', (v) => + __xArgPtr( + v instanceof (capi.sqlite3_module || nilType) ? v.pointer : v, + ), + ); + } + + const __xRcPtr = wasm.xWrap.resultAdapter('*'); + wasm.xWrap.resultAdapter('sqlite3*', __xRcPtr)( + 'sqlite3_context*', + __xRcPtr, + )('sqlite3_stmt*', __xRcPtr)('sqlite3_value*', __xRcPtr)( + 'sqlite3_vfs*', + __xRcPtr, + )('void*', __xRcPtr); + + if (0 === wasm.exports.sqlite3_step.length) { + wasm.xWrap.doArgcCheck = false; + sqlite3.config.warn( + 'Disabling sqlite3.wasm.xWrap.doArgcCheck due to environmental quirks.', + ); + } + for (const e of wasm.bindingSignatures) { + capi[e[0]] = wasm.xWrap.apply(null, e); + } + for (const e of wasm.bindingSignatures.wasmInternal) { + util[e[0]] = wasm.xWrap.apply(null, e); + } + + const fI64Disabled = function (fname) { + return () => + toss( + fname + '() is unavailable due to lack', + 'of BigInt support in this build.', + ); + }; + for (const e of wasm.bindingSignatures.int64) { + capi[e[0]] = wasm.bigIntEnabled + ? wasm.xWrap.apply(null, e) + : fI64Disabled(e[0]); + } + + delete wasm.bindingSignatures; + + if (wasm.exports.sqlite3__wasm_db_error) { + const __db_err = wasm.xWrap( + 'sqlite3__wasm_db_error', + 'int', + 'sqlite3*', + 'int', + 'string', + ); + + util.sqlite3__wasm_db_error = function (pDb, resultCode, message) { + if (resultCode instanceof sqlite3.WasmAllocError) { + resultCode = capi.SQLITE_NOMEM; + message = 0; + } else if (resultCode instanceof Error) { + message = message || '' + resultCode; + resultCode = resultCode.resultCode || capi.SQLITE_ERROR; + } + return pDb ? __db_err(pDb, resultCode, message) : resultCode; + }; + } else { + util.sqlite3__wasm_db_error = function (pDb, errCode, msg) { + console.warn( + 'sqlite3__wasm_db_error() is not exported.', + arguments, + ); + return errCode; + }; + } + } + + { + const cJson = wasm.xCall('sqlite3__wasm_enum_json'); + if (!cJson) { + toss( + "Maintenance required: increase sqlite3__wasm_enum_json()'s", + 'static buffer size!', + ); + } + + wasm.ctype = JSON.parse(wasm.cstrToJs(cJson)); + + const defineGroups = [ + 'access', + 'authorizer', + 'blobFinalizers', + 'changeset', + 'config', + 'dataTypes', + 'dbConfig', + 'dbStatus', + 'encodings', + 'fcntl', + 'flock', + 'ioCap', + 'limits', + 'openFlags', + 'prepareFlags', + 'resultCodes', + 'sqlite3Status', + 'stmtStatus', + 'syncFlags', + 'trace', + 'txnState', + 'udfFlags', + 'version', + ]; + if (wasm.bigIntEnabled) { + defineGroups.push('serialize', 'session', 'vtab'); + } + for (const t of defineGroups) { + for (const e of Object.entries(wasm.ctype[t])) { + capi[e[0]] = e[1]; + } + } + if (!wasm.functionEntry(capi.SQLITE_WASM_DEALLOC)) { + toss( + 'Internal error: cannot resolve exported function', + 'entry SQLITE_WASM_DEALLOC (==' + capi.SQLITE_WASM_DEALLOC + ').', + ); + } + const __rcMap = Object.create(null); + for (const t of ['resultCodes']) { + for (const e of Object.entries(wasm.ctype[t])) { + __rcMap[e[1]] = e[0]; + } + } + + capi.sqlite3_js_rc_str = (rc) => __rcMap[rc]; + + const notThese = Object.assign(Object.create(null), { + WasmTestStruct: true, + + sqlite3_kvvfs_methods: !util.isUIThread(), + + sqlite3_index_info: !wasm.bigIntEnabled, + sqlite3_index_constraint: !wasm.bigIntEnabled, + sqlite3_index_orderby: !wasm.bigIntEnabled, + sqlite3_index_constraint_usage: !wasm.bigIntEnabled, + }); + for (const s of wasm.ctype.structs) { + if (!notThese[s.name]) { + capi[s.name] = sqlite3.StructBinder(s); + } + } + if (capi.sqlite3_index_info) { + for (const k of [ + 'sqlite3_index_constraint', + 'sqlite3_index_orderby', + 'sqlite3_index_constraint_usage', + ]) { + capi.sqlite3_index_info[k] = capi[k]; + delete capi[k]; + } + capi.sqlite3_vtab_config = wasm.xWrap( + 'sqlite3__wasm_vtab_config', + 'int', + ['sqlite3*', 'int', 'int'], + ); + } + } + + const __dbArgcMismatch = (pDb, f, n) => { + return util.sqlite3__wasm_db_error( + pDb, + capi.SQLITE_MISUSE, + f + '() requires ' + n + ' argument' + (1 === n ? '' : 's') + '.', + ); + }; + + const __errEncoding = (pDb) => { + return util.sqlite3__wasm_db_error( + pDb, + capi.SQLITE_FORMAT, + 'SQLITE_UTF8 is the only supported encoding.', + ); + }; + + const __argPDb = (pDb) => wasm.xWrap.argAdapter('sqlite3*')(pDb); + const __argStr = (str) => (wasm.isPtr(str) ? wasm.cstrToJs(str) : str); + const __dbCleanupMap = function (pDb, mode) { + pDb = __argPDb(pDb); + let m = this.dbMap.get(pDb); + if (!mode) { + this.dbMap.delete(pDb); + return m; + } else if (!m && mode > 0) { + this.dbMap.set(pDb, (m = Object.create(null))); + } + return m; + }.bind( + Object.assign(Object.create(null), { + dbMap: new Map(), + }), + ); + + __dbCleanupMap.addCollation = function (pDb, name) { + const m = __dbCleanupMap(pDb, 1); + if (!m.collation) m.collation = new Set(); + m.collation.add(__argStr(name).toLowerCase()); + }; + + __dbCleanupMap._addUDF = function (pDb, name, arity, map) { + name = __argStr(name).toLowerCase(); + let u = map.get(name); + if (!u) map.set(name, (u = new Set())); + u.add(arity < 0 ? -1 : arity); + }; + + __dbCleanupMap.addFunction = function (pDb, name, arity) { + const m = __dbCleanupMap(pDb, 1); + if (!m.udf) m.udf = new Map(); + this._addUDF(pDb, name, arity, m.udf); + }; + + if (wasm.exports.sqlite3_create_window_function) { + __dbCleanupMap.addWindowFunc = function (pDb, name, arity) { + const m = __dbCleanupMap(pDb, 1); + if (!m.wudf) m.wudf = new Map(); + this._addUDF(pDb, name, arity, m.wudf); + }; + } + + __dbCleanupMap.cleanup = function (pDb) { + pDb = __argPDb(pDb); + + const closeArgs = [pDb]; + for (const name 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 x = wasm.exports[name]; + if (!x) { + continue; + } + closeArgs.length = x.length; + try { + capi[name](...closeArgs); + } catch (e) { + sqlite3.config.warn( + 'close-time call of', + name + '(', + closeArgs, + ') threw:', + e, + ); + } + } + const m = __dbCleanupMap(pDb, 0); + if (!m) return; + if (m.collation) { + for (const name of m.collation) { + try { + capi.sqlite3_create_collation_v2( + pDb, + name, + capi.SQLITE_UTF8, + 0, + 0, + 0, + ); + } catch (e) {} + } + delete m.collation; + } + let i; + for (i = 0; i < 2; ++i) { + const fmap = i ? m.wudf : m.udf; + if (!fmap) continue; + const func = i + ? capi.sqlite3_create_window_function + : capi.sqlite3_create_function_v2; + for (const e of fmap) { + const name = e[0], + arities = e[1]; + const fargs = [pDb, name, 0, capi.SQLITE_UTF8, 0, 0, 0, 0, 0]; + if (i) fargs.push(0); + for (const arity of arities) { + try { + fargs[2] = arity; + func.apply(null, fargs); + } catch (e) {} + } + arities.clear(); + } + fmap.clear(); + } + delete m.udf; + delete m.wudf; + }; + + { + const __sqlite3CloseV2 = wasm.xWrap( + 'sqlite3_close_v2', + 'int', + 'sqlite3*', + ); + capi.sqlite3_close_v2 = function (pDb) { + if (1 !== arguments.length) + return __dbArgcMismatch(pDb, 'sqlite3_close_v2', 1); + if (pDb) { + try { + __dbCleanupMap.cleanup(pDb); + } catch (e) {} + } + return __sqlite3CloseV2(pDb); + }; + } + + if (capi.sqlite3session_create) { + const __sqlite3SessionDelete = wasm.xWrap( + 'sqlite3session_delete', + undefined, + ['sqlite3_session*'], + ); + capi.sqlite3session_delete = function (pSession) { + if (1 !== arguments.length) { + return __dbArgcMismatch(pDb, 'sqlite3session_delete', 1); + } else if (pSession) { + capi.sqlite3session_table_filter(pSession, 0, 0); + } + __sqlite3SessionDelete(pSession); + }; + } + + { + const contextKey = (argv, argIndex) => { + return ( + 'argv[' + + argIndex + + ']:' + + argv[0] + + ':' + + wasm.cstrToJs(argv[1]).toLowerCase() + ); + }; + const __sqlite3CreateCollationV2 = wasm.xWrap( + 'sqlite3_create_collation_v2', + 'int', + [ + 'sqlite3*', + 'string', + 'int', + '*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xCompare', + signature: 'i(pipip)', + contextKey, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroy', + signature: 'v(p)', + contextKey, + }), + ], + ); + + capi.sqlite3_create_collation_v2 = function ( + pDb, + zName, + eTextRep, + pArg, + xCompare, + xDestroy, + ) { + if (6 !== arguments.length) + return __dbArgcMismatch(pDb, 'sqlite3_create_collation_v2', 6); + else if (0 === (eTextRep & 0xf)) { + eTextRep |= capi.SQLITE_UTF8; + } else if (capi.SQLITE_UTF8 !== (eTextRep & 0xf)) { + return __errEncoding(pDb); + } + try { + const rc = __sqlite3CreateCollationV2( + pDb, + zName, + eTextRep, + pArg, + xCompare, + xDestroy, + ); + if (0 === rc && xCompare instanceof Function) { + __dbCleanupMap.addCollation(pDb, zName); + } + return rc; + } catch (e) { + return util.sqlite3__wasm_db_error(pDb, e); + } + }; + + capi.sqlite3_create_collation = ( + pDb, + zName, + eTextRep, + pArg, + xCompare, + ) => { + return 5 === arguments.length + ? capi.sqlite3_create_collation_v2( + pDb, + zName, + eTextRep, + pArg, + xCompare, + 0, + ) + : __dbArgcMismatch(pDb, 'sqlite3_create_collation', 5); + }; + } + + { + const contextKey = function (argv, argIndex) { + return ( + argv[0] + + ':' + + (argv[2] < 0 ? -1 : argv[2]) + + ':' + + argIndex + + ':' + + wasm.cstrToJs(argv[1]).toLowerCase() + ); + }; + + const __cfProxy = Object.assign(Object.create(null), { + xInverseAndStep: { + signature: 'v(pip)', + contextKey, + callProxy: (callback) => { + return (pCtx, argc, pArgv) => { + try { + callback(pCtx, ...capi.sqlite3_values_to_js(argc, pArgv)); + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + }, + }, + xFinalAndValue: { + signature: 'v(p)', + contextKey, + callProxy: (callback) => { + return (pCtx) => { + try { + capi.sqlite3_result_js(pCtx, callback(pCtx)); + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + }, + }, + xFunc: { + signature: 'v(pip)', + contextKey, + callProxy: (callback) => { + return (pCtx, argc, pArgv) => { + try { + capi.sqlite3_result_js( + pCtx, + callback(pCtx, ...capi.sqlite3_values_to_js(argc, pArgv)), + ); + } catch (e) { + capi.sqlite3_result_error_js(pCtx, e); + } + }; + }, + }, + xDestroy: { + signature: 'v(p)', + contextKey, + + callProxy: (callback) => { + return (pVoid) => { + try { + callback(pVoid); + } catch (e) { + console.error('UDF xDestroy method threw:', e); + } + }; + }, + }, + }); + + const __sqlite3CreateFunction = wasm.xWrap( + 'sqlite3_create_function_v2', + 'int', + [ + 'sqlite3*', + 'string', + 'int', + 'int', + '*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFunc', + ...__cfProxy.xFunc, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xStep', + ...__cfProxy.xInverseAndStep, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFinal', + ...__cfProxy.xFinalAndValue, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroy', + ...__cfProxy.xDestroy, + }), + ], + ); + + const __sqlite3CreateWindowFunction = wasm.exports + .sqlite3_create_window_function + ? wasm.xWrap('sqlite3_create_window_function', 'int', [ + 'sqlite3*', + 'string', + 'int', + 'int', + '*', + new wasm.xWrap.FuncPtrAdapter({ + name: 'xStep', + ...__cfProxy.xInverseAndStep, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xFinal', + ...__cfProxy.xFinalAndValue, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xValue', + ...__cfProxy.xFinalAndValue, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xInverse', + ...__cfProxy.xInverseAndStep, + }), + new wasm.xWrap.FuncPtrAdapter({ + name: 'xDestroy', + ...__cfProxy.xDestroy, + }), + ]) + : undefined; + + capi.sqlite3_create_function_v2 = function f( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + pDb, + 'sqlite3_create_function_v2', + f.length, + ); + } else if (0 === (eTextRep & 0xf)) { + eTextRep |= capi.SQLITE_UTF8; + } else if (capi.SQLITE_UTF8 !== (eTextRep & 0xf)) { + return __errEncoding(pDb); + } + try { + const rc = __sqlite3CreateFunction( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + xDestroy, + ); + if ( + 0 === rc && + (xFunc instanceof Function || + xStep instanceof Function || + xFinal instanceof Function || + xDestroy instanceof Function) + ) { + __dbCleanupMap.addFunction(pDb, funcName, nArg); + } + return rc; + } catch (e) { + console.error('sqlite3_create_function_v2() setup threw:', e); + return util.sqlite3__wasm_db_error( + pDb, + e, + 'Creation of UDF threw: ' + e, + ); + } + }; + + capi.sqlite3_create_function = function f( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + ) { + return f.length === arguments.length + ? capi.sqlite3_create_function_v2( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xFunc, + xStep, + xFinal, + 0, + ) + : __dbArgcMismatch(pDb, 'sqlite3_create_function', f.length); + }; + + if (__sqlite3CreateWindowFunction) { + capi.sqlite3_create_window_function = function f( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + pDb, + 'sqlite3_create_window_function', + f.length, + ); + } else if (0 === (eTextRep & 0xf)) { + eTextRep |= capi.SQLITE_UTF8; + } else if (capi.SQLITE_UTF8 !== (eTextRep & 0xf)) { + return __errEncoding(pDb); + } + try { + const rc = __sqlite3CreateWindowFunction( + pDb, + funcName, + nArg, + eTextRep, + pApp, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ); + if ( + 0 === rc && + (xStep instanceof Function || + xFinal instanceof Function || + xValue instanceof Function || + xInverse instanceof Function || + xDestroy instanceof Function) + ) { + __dbCleanupMap.addWindowFunc(pDb, funcName, nArg); + } + return rc; + } catch (e) { + console.error( + 'sqlite3_create_window_function() setup threw:', + e, + ); + return util.sqlite3__wasm_db_error( + pDb, + e, + 'Creation of UDF threw: ' + e, + ); + } + }; + } else { + delete capi.sqlite3_create_window_function; + } + + capi.sqlite3_create_function_v2.udfSetResult = + capi.sqlite3_create_function.udfSetResult = capi.sqlite3_result_js; + if (capi.sqlite3_create_window_function) { + capi.sqlite3_create_window_function.udfSetResult = + capi.sqlite3_result_js; + } + + capi.sqlite3_create_function_v2.udfConvertArgs = + capi.sqlite3_create_function.udfConvertArgs = + capi.sqlite3_values_to_js; + if (capi.sqlite3_create_window_function) { + capi.sqlite3_create_window_function.udfConvertArgs = + capi.sqlite3_values_to_js; + } + + capi.sqlite3_create_function_v2.udfSetError = + capi.sqlite3_create_function.udfSetError = + capi.sqlite3_result_error_js; + if (capi.sqlite3_create_window_function) { + capi.sqlite3_create_window_function.udfSetError = + capi.sqlite3_result_error_js; + } + } + + { + const __flexiString = (v, n) => { + if ('string' === typeof v) { + n = -1; + } else if (util.isSQLableTypedArray(v)) { + n = v.byteLength; + v = util.typedArrayToString( + v instanceof ArrayBuffer ? new Uint8Array(v) : v, + ); + } else if (Array.isArray(v)) { + v = v.join(''); + n = -1; + } + return [v, n]; + }; + + const __prepare = { + basic: wasm.xWrap('sqlite3_prepare_v3', 'int', [ + 'sqlite3*', + 'string', + 'int', + 'int', + '**', + '**', + ]), + + full: wasm.xWrap('sqlite3_prepare_v3', 'int', [ + 'sqlite3*', + '*', + 'int', + 'int', + '**', + '**', + ]), + }; + + capi.sqlite3_prepare_v3 = function f( + pDb, + sql, + sqlLen, + prepFlags, + ppStmt, + pzTail, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch(pDb, 'sqlite3_prepare_v3', f.length); + } + const [xSql, xSqlLen] = __flexiString(sql, sqlLen); + switch (typeof xSql) { + case 'string': + return __prepare.basic( + pDb, + xSql, + xSqlLen, + prepFlags, + ppStmt, + null, + ); + case 'number': + return __prepare.full( + pDb, + xSql, + xSqlLen, + prepFlags, + ppStmt, + pzTail, + ); + default: + return util.sqlite3__wasm_db_error( + pDb, + capi.SQLITE_MISUSE, + 'Invalid SQL argument type for sqlite3_prepare_v2/v3().', + ); + } + }; + + capi.sqlite3_prepare_v2 = function f( + pDb, + sql, + sqlLen, + ppStmt, + pzTail, + ) { + return f.length === arguments.length + ? capi.sqlite3_prepare_v3(pDb, sql, sqlLen, 0, ppStmt, pzTail) + : __dbArgcMismatch(pDb, 'sqlite3_prepare_v2', f.length); + }; + } + + { + const __bindText = wasm.xWrap('sqlite3_bind_text', 'int', [ + 'sqlite3_stmt*', + 'int', + 'string', + 'int', + '*', + ]); + const __bindBlob = wasm.xWrap('sqlite3_bind_blob', 'int', [ + 'sqlite3_stmt*', + 'int', + '*', + 'int', + '*', + ]); + + capi.sqlite3_bind_text = function f( + pStmt, + iCol, + text, + nText, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + capi.sqlite3_db_handle(pStmt), + 'sqlite3_bind_text', + f.length, + ); + } else if (wasm.isPtr(text) || null === text) { + return __bindText(pStmt, iCol, text, nText, xDestroy); + } else if (text instanceof ArrayBuffer) { + text = new Uint8Array(text); + } else if (Array.isArray(pMem)) { + text = pMem.join(''); + } + let p, n; + try { + if (util.isSQLableTypedArray(text)) { + p = wasm.allocFromTypedArray(text); + n = text.byteLength; + } else if ('string' === typeof text) { + [p, n] = wasm.allocCString(text); + } else { + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + capi.SQLITE_MISUSE, + 'Invalid 3rd argument type for sqlite3_bind_text().', + ); + } + return __bindText(pStmt, iCol, p, n, capi.SQLITE_WASM_DEALLOC); + } catch (e) { + wasm.dealloc(p); + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + e, + ); + } + }; + + capi.sqlite3_bind_blob = function f( + pStmt, + iCol, + pMem, + nMem, + xDestroy, + ) { + if (f.length !== arguments.length) { + return __dbArgcMismatch( + capi.sqlite3_db_handle(pStmt), + 'sqlite3_bind_blob', + f.length, + ); + } else if (wasm.isPtr(pMem) || null === pMem) { + return __bindBlob(pStmt, iCol, pMem, nMem, xDestroy); + } else if (pMem instanceof ArrayBuffer) { + pMem = new Uint8Array(pMem); + } else if (Array.isArray(pMem)) { + pMem = pMem.join(''); + } + let p, n; + try { + if (util.isBindableTypedArray(pMem)) { + p = wasm.allocFromTypedArray(pMem); + n = nMem >= 0 ? nMem : pMem.byteLength; + } else if ('string' === typeof pMem) { + [p, n] = wasm.allocCString(pMem); + } else { + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + capi.SQLITE_MISUSE, + 'Invalid 3rd argument type for sqlite3_bind_blob().', + ); + } + return __bindBlob(pStmt, iCol, p, n, capi.SQLITE_WASM_DEALLOC); + } catch (e) { + wasm.dealloc(p); + return util.sqlite3__wasm_db_error( + capi.sqlite3_db_handle(pStmt), + e, + ); + } + }; + } + + { + capi.sqlite3_config = function (op, ...args) { + if (arguments.length < 2) return capi.SQLITE_MISUSE; + switch (op) { + case capi.SQLITE_CONFIG_COVERING_INDEX_SCAN: + case capi.SQLITE_CONFIG_MEMSTATUS: + case capi.SQLITE_CONFIG_SMALL_MALLOC: + case capi.SQLITE_CONFIG_SORTERREF_SIZE: + case capi.SQLITE_CONFIG_STMTJRNL_SPILL: + case capi.SQLITE_CONFIG_URI: + return wasm.exports.sqlite3__wasm_config_i(op, args[0]); + case capi.SQLITE_CONFIG_LOOKASIDE: + return wasm.exports.sqlite3__wasm_config_ii( + op, + args[0], + args[1], + ); + case capi.SQLITE_CONFIG_MEMDB_MAXSIZE: + return wasm.exports.sqlite3__wasm_config_j(op, args[0]); + case capi.SQLITE_CONFIG_GETMALLOC: + case capi.SQLITE_CONFIG_GETMUTEX: + case capi.SQLITE_CONFIG_GETPCACHE2: + case capi.SQLITE_CONFIG_GETPCACHE: + case capi.SQLITE_CONFIG_HEAP: + case capi.SQLITE_CONFIG_LOG: + case capi.SQLITE_CONFIG_MALLOC: + case capi.SQLITE_CONFIG_MMAP_SIZE: + case capi.SQLITE_CONFIG_MULTITHREAD: + case capi.SQLITE_CONFIG_MUTEX: + case capi.SQLITE_CONFIG_PAGECACHE: + case capi.SQLITE_CONFIG_PCACHE2: + case capi.SQLITE_CONFIG_PCACHE: + case capi.SQLITE_CONFIG_PCACHE_HDRSZ: + case capi.SQLITE_CONFIG_PMASZ: + case capi.SQLITE_CONFIG_SERIALIZED: + case capi.SQLITE_CONFIG_SINGLETHREAD: + case capi.SQLITE_CONFIG_SQLLOG: + case capi.SQLITE_CONFIG_WIN32_HEAPSIZE: + default: + return capi.SQLITE_NOTFOUND; + } + }; + } + + { + const __autoExtFptr = new Set(); + + capi.sqlite3_auto_extension = function (fPtr) { + if (fPtr instanceof Function) { + fPtr = wasm.installFunction('i(ppp)', fPtr); + } else if (1 !== arguments.length || !wasm.isPtr(fPtr)) { + return capi.SQLITE_MISUSE; + } + const rc = wasm.exports.sqlite3_auto_extension(fPtr); + if (fPtr !== arguments[0]) { + if (0 === rc) __autoExtFptr.add(fPtr); + else wasm.uninstallFunction(fPtr); + } + return rc; + }; + + capi.sqlite3_cancel_auto_extension = function (fPtr) { + if (!fPtr || 1 !== arguments.length || !wasm.isPtr(fPtr)) return 0; + return wasm.exports.sqlite3_cancel_auto_extension(fPtr); + }; + + capi.sqlite3_reset_auto_extension = function () { + wasm.exports.sqlite3_reset_auto_extension(); + for (const fp of __autoExtFptr) wasm.uninstallFunction(fp); + __autoExtFptr.clear(); + }; + } + + const pKvvfs = capi.sqlite3_vfs_find('kvvfs'); + if (pKvvfs) { + if (util.isUIThread()) { + const kvvfsMethods = new capi.sqlite3_kvvfs_methods( + wasm.exports.sqlite3__wasm_kvvfs_methods(), + ); + delete capi.sqlite3_kvvfs_methods; + + const kvvfsMakeKey = + wasm.exports.sqlite3__wasm_kvvfsMakeKeyOnPstack, + pstack = wasm.pstack; + + const kvvfsStorage = (zClass) => + 115 === wasm.peek(zClass) ? sessionStorage : localStorage; + + const kvvfsImpls = { + xRead: (zClass, zKey, zBuf, nBuf) => { + const stack = pstack.pointer, + astack = wasm.scopedAllocPush(); + try { + const zXKey = kvvfsMakeKey(zClass, zKey); + if (!zXKey) return -3; + const jKey = wasm.cstrToJs(zXKey); + const jV = kvvfsStorage(zClass).getItem(jKey); + if (!jV) return -1; + const nV = jV.length; + if (nBuf <= 0) return nV; + else if (1 === nBuf) { + wasm.poke(zBuf, 0); + return nV; + } + const zV = wasm.scopedAllocCString(jV); + if (nBuf > nV + 1) nBuf = nV + 1; + wasm.heap8u().copyWithin(zBuf, zV, zV + nBuf - 1); + wasm.poke(zBuf + nBuf - 1, 0); + return nBuf - 1; + } catch (e) { + console.error('kvstorageRead()', e); + return -2; + } finally { + pstack.restore(stack); + wasm.scopedAllocPop(astack); + } + }, + xWrite: (zClass, zKey, zData) => { + const stack = pstack.pointer; + try { + const zXKey = kvvfsMakeKey(zClass, zKey); + if (!zXKey) return 1; + const jKey = wasm.cstrToJs(zXKey); + kvvfsStorage(zClass).setItem(jKey, wasm.cstrToJs(zData)); + return 0; + } catch (e) { + console.error('kvstorageWrite()', e); + return capi.SQLITE_IOERR; + } finally { + pstack.restore(stack); + } + }, + xDelete: (zClass, zKey) => { + const stack = pstack.pointer; + try { + const zXKey = kvvfsMakeKey(zClass, zKey); + if (!zXKey) return 1; + kvvfsStorage(zClass).removeItem(wasm.cstrToJs(zXKey)); + return 0; + } catch (e) { + console.error('kvstorageDelete()', e); + return capi.SQLITE_IOERR; + } finally { + pstack.restore(stack); + } + }, + }; + for (const k of Object.keys(kvvfsImpls)) { + kvvfsMethods[kvvfsMethods.memberKey(k)] = wasm.installFunction( + kvvfsMethods.memberSignature(k), + kvvfsImpls[k], + ); + } + } else { + capi.sqlite3_vfs_unregister(pKvvfs); + } + } + + wasm.xWrap.FuncPtrAdapter.warnOnUse = true; + + const StructBinder = sqlite3.StructBinder; + const installMethod = function callee( + tgt, + name, + func, + applyArgcCheck = callee.installMethodArgcCheck, + ) { + if (!(tgt instanceof StructBinder.StructType)) { + toss('Usage error: target object is-not-a StructType.'); + } else if (!(func instanceof Function) && !wasm.isPtr(func)) { + toss('Usage error: expecting a Function or WASM pointer to one.'); + } + if (1 === arguments.length) { + return (n, f) => callee(tgt, n, f, applyArgcCheck); + } + if (!callee.argcProxy) { + callee.argcProxy = function (tgt, funcName, func, sig) { + return function (...args) { + if (func.length !== arguments.length) { + toss( + 'Argument mismatch for', + tgt.structInfo.name + + '::' + + funcName + + ': Native signature is:', + sig, + ); + } + return func.apply(this, args); + }; + }; + + callee.removeFuncList = function () { + if (this.ondispose.__removeFuncList) { + this.ondispose.__removeFuncList.forEach((v, ndx) => { + if ('number' === typeof v) { + try { + wasm.uninstallFunction(v); + } catch (e) {} + } + }); + delete this.ondispose.__removeFuncList; + } + }; + } + const sigN = tgt.memberSignature(name); + if (sigN.length < 2) { + toss( + 'Member', + name, + 'does not have a function pointer signature:', + sigN, + ); + } + const memKey = tgt.memberKey(name); + const fProxy = + applyArgcCheck && !wasm.isPtr(func) + ? callee.argcProxy(tgt, memKey, func, sigN) + : func; + if (wasm.isPtr(fProxy)) { + if (fProxy && !wasm.functionEntry(fProxy)) { + toss('Pointer', fProxy, 'is not a WASM function table entry.'); + } + tgt[memKey] = fProxy; + } else { + const pFunc = wasm.installFunction( + fProxy, + tgt.memberSignature(name, true), + ); + tgt[memKey] = pFunc; + if (!tgt.ondispose || !tgt.ondispose.__removeFuncList) { + tgt.addOnDispose( + 'ondispose.__removeFuncList handler', + callee.removeFuncList, + ); + tgt.ondispose.__removeFuncList = []; + } + tgt.ondispose.__removeFuncList.push(memKey, pFunc); + } + return (n, f) => callee(tgt, n, f, applyArgcCheck); + }; + installMethod.installMethodArgcCheck = false; + + const installMethods = function ( + structInstance, + methods, + applyArgcCheck = installMethod.installMethodArgcCheck, + ) { + const seen = new Map(); + for (const k of Object.keys(methods)) { + const m = methods[k]; + const prior = seen.get(m); + if (prior) { + const mkey = structInstance.memberKey(k); + structInstance[mkey] = + structInstance[structInstance.memberKey(prior)]; + } else { + installMethod(structInstance, k, m, applyArgcCheck); + seen.set(m, k); + } + } + return structInstance; + }; + + StructBinder.StructType.prototype.installMethod = function callee( + name, + func, + applyArgcCheck = installMethod.installMethodArgcCheck, + ) { + return arguments.length < 3 && name && 'object' === typeof name + ? installMethods(this, ...arguments) + : installMethod(this, ...arguments); + }; + + StructBinder.StructType.prototype.installMethods = function ( + methods, + applyArgcCheck = installMethod.installMethodArgcCheck, + ) { + return installMethods(this, methods, applyArgcCheck); + }; + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + sqlite3.version = { + libVersion: '3.50.4', + libVersionNumber: 3050004, + sourceId: + '2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3', + downloadVersion: 3500400, + }; + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + const toss3 = (...args) => { + throw new sqlite3.SQLite3Error(...args); + }; + + const capi = sqlite3.capi, + wasm = sqlite3.wasm, + util = sqlite3.util; + + const __ptrMap = new WeakMap(); + + const __stmtMap = new WeakMap(); + + const getOwnOption = (opts, p, dflt) => { + const d = Object.getOwnPropertyDescriptor(opts, p); + return d ? d.value : dflt; + }; + + const checkSqlite3Rc = function (dbPtr, sqliteResultCode) { + if (sqliteResultCode) { + if (dbPtr instanceof DB) dbPtr = dbPtr.pointer; + toss3( + sqliteResultCode, + 'sqlite3 result code', + sqliteResultCode + ':', + dbPtr + ? capi.sqlite3_errmsg(dbPtr) + : capi.sqlite3_errstr(sqliteResultCode), + ); + } + return arguments[0]; + }; + + const __dbTraceToConsole = wasm.installFunction( + 'i(ippp)', + function (t, c, p, x) { + if (capi.SQLITE_TRACE_STMT === t) { + console.log( + 'SQL TRACE #' + ++this.counter + ' via sqlite3@' + c + ':', + wasm.cstrToJs(x), + ); + } + }.bind({ counter: 0 }), + ); + + const __vfsPostOpenCallback = Object.create(null); + + const dbCtorHelper = function ctor(...args) { + if (!ctor._name2vfs) { + ctor._name2vfs = Object.create(null); + const isWorkerThread = + 'function' === typeof importScripts + ? (n) => + toss3( + 'The VFS for', + n, + 'is only available in the main window thread.', + ) + : false; + ctor._name2vfs[':localStorage:'] = { + vfs: 'kvvfs', + filename: isWorkerThread || (() => 'local'), + }; + ctor._name2vfs[':sessionStorage:'] = { + vfs: 'kvvfs', + filename: isWorkerThread || (() => 'session'), + }; + } + const opt = ctor.normalizeArgs(...args); + let fn = opt.filename, + vfsName = opt.vfs, + flagsStr = opt.flags; + if ( + ('string' !== typeof fn && 'number' !== typeof fn) || + 'string' !== typeof flagsStr || + (vfsName && + 'string' !== typeof vfsName && + 'number' !== typeof vfsName) + ) { + sqlite3.config.error('Invalid DB ctor args', opt, arguments); + toss3('Invalid arguments for DB constructor.'); + } + let fnJs = 'number' === typeof fn ? wasm.cstrToJs(fn) : fn; + const vfsCheck = ctor._name2vfs[fnJs]; + if (vfsCheck) { + vfsName = vfsCheck.vfs; + fn = fnJs = vfsCheck.filename(fnJs); + } + let pDb, + oflags = 0; + if (flagsStr.indexOf('c') >= 0) { + oflags |= capi.SQLITE_OPEN_CREATE | capi.SQLITE_OPEN_READWRITE; + } + if (flagsStr.indexOf('w') >= 0) oflags |= capi.SQLITE_OPEN_READWRITE; + if (0 === oflags) oflags |= capi.SQLITE_OPEN_READONLY; + oflags |= capi.SQLITE_OPEN_EXRESCODE; + const stack = wasm.pstack.pointer; + try { + const pPtr = wasm.pstack.allocPtr(); + let rc = capi.sqlite3_open_v2(fn, pPtr, oflags, vfsName || 0); + pDb = wasm.peekPtr(pPtr); + checkSqlite3Rc(pDb, rc); + capi.sqlite3_extended_result_codes(pDb, 1); + if (flagsStr.indexOf('t') >= 0) { + capi.sqlite3_trace_v2( + pDb, + capi.SQLITE_TRACE_STMT, + __dbTraceToConsole, + pDb, + ); + } + } catch (e) { + if (pDb) capi.sqlite3_close_v2(pDb); + throw e; + } finally { + wasm.pstack.restore(stack); + } + this.filename = fnJs; + __ptrMap.set(this, pDb); + __stmtMap.set(this, Object.create(null)); + try { + const pVfs = + capi.sqlite3_js_db_vfs(pDb) || + toss3('Internal error: cannot get VFS for new db handle.'); + const postInitSql = __vfsPostOpenCallback[pVfs]; + if (postInitSql) { + if (postInitSql instanceof Function) { + postInitSql(this, sqlite3); + } else { + checkSqlite3Rc( + pDb, + capi.sqlite3_exec(pDb, postInitSql, 0, 0, 0), + ); + } + } + } catch (e) { + this.close(); + throw e; + } + }; + + dbCtorHelper.setVfsPostOpenCallback = function (pVfs, callback) { + if (!(callback instanceof Function)) { + toss3( + 'dbCtorHelper.setVfsPostOpenCallback() should not be used with ' + + 'a non-function argument.', + arguments, + ); + } + __vfsPostOpenCallback[pVfs] = callback; + }; + + dbCtorHelper.normalizeArgs = function ( + filename = ':memory:', + flags = 'c', + vfs = null, + ) { + const arg = {}; + if ( + 1 === arguments.length && + arguments[0] && + 'object' === typeof arguments[0] + ) { + Object.assign(arg, arguments[0]); + if (undefined === arg.flags) arg.flags = 'c'; + if (undefined === arg.vfs) arg.vfs = null; + if (undefined === arg.filename) arg.filename = ':memory:'; + } else { + arg.filename = filename; + arg.flags = flags; + arg.vfs = vfs; + } + return arg; + }; + + const DB = function (...args) { + dbCtorHelper.apply(this, args); + }; + DB.dbCtorHelper = dbCtorHelper; + + const BindTypes = { + null: 1, + number: 2, + string: 3, + boolean: 4, + blob: 5, + }; + BindTypes['undefined'] == BindTypes.null; + if (wasm.bigIntEnabled) { + BindTypes.bigint = BindTypes.number; + } + + const Stmt = function () { + if (BindTypes !== arguments[2]) { + toss3( + capi.SQLITE_MISUSE, + 'Do not call the Stmt constructor directly. Use DB.prepare().', + ); + } + this.db = arguments[0]; + __ptrMap.set(this, arguments[1]); + this.parameterCount = capi.sqlite3_bind_parameter_count(this.pointer); + }; + + const affirmDbOpen = function (db) { + if (!db.pointer) toss3('DB has been closed.'); + return db; + }; + + const affirmColIndex = function (stmt, ndx) { + if (ndx !== (ndx | 0) || ndx < 0 || ndx >= stmt.columnCount) { + toss3('Column index', ndx, 'is out of range.'); + } + return stmt; + }; + + const parseExecArgs = function (db, args) { + const out = Object.create(null); + out.opt = Object.create(null); + switch (args.length) { + case 1: + if ( + 'string' === typeof args[0] || + util.isSQLableTypedArray(args[0]) + ) { + out.sql = args[0]; + } else if (Array.isArray(args[0])) { + out.sql = args[0]; + } else if (args[0] && 'object' === typeof args[0]) { + out.opt = args[0]; + out.sql = out.opt.sql; + } + break; + case 2: + out.sql = args[0]; + out.opt = args[1]; + break; + default: + toss3('Invalid argument count for exec().'); + } + out.sql = util.flexibleString(out.sql); + if ('string' !== typeof out.sql) { + toss3('Missing SQL argument or unsupported SQL value type.'); + } + const opt = out.opt; + switch (opt.returnValue) { + case 'resultRows': + if (!opt.resultRows) opt.resultRows = []; + out.returnVal = () => opt.resultRows; + break; + case 'saveSql': + if (!opt.saveSql) opt.saveSql = []; + out.returnVal = () => opt.saveSql; + break; + case undefined: + case 'this': + out.returnVal = () => db; + break; + default: + toss3('Invalid returnValue value:', opt.returnValue); + } + if (!opt.callback && !opt.returnValue && undefined !== opt.rowMode) { + if (!opt.resultRows) opt.resultRows = []; + out.returnVal = () => opt.resultRows; + } + if (opt.callback || opt.resultRows) { + switch (undefined === opt.rowMode ? 'array' : opt.rowMode) { + case 'object': + out.cbArg = (stmt, cache) => { + if (!cache.columnNames) + cache.columnNames = stmt.getColumnNames([]); + + const row = stmt.get([]); + const rv = Object.create(null); + for (const i in cache.columnNames) + rv[cache.columnNames[i]] = row[i]; + return rv; + }; + break; + case 'array': + out.cbArg = (stmt) => stmt.get([]); + break; + case 'stmt': + if (Array.isArray(opt.resultRows)) { + toss3( + 'exec(): invalid rowMode for a resultRows array: must', + "be one of 'array', 'object',", + 'a result column number, or column name reference.', + ); + } + out.cbArg = (stmt) => stmt; + break; + default: + if (util.isInt32(opt.rowMode)) { + out.cbArg = (stmt) => stmt.get(opt.rowMode); + break; + } else if ( + 'string' === typeof opt.rowMode && + opt.rowMode.length > 1 && + '$' === opt.rowMode[0] + ) { + const $colName = opt.rowMode.substr(1); + out.cbArg = (stmt) => { + const rc = stmt.get(Object.create(null))[$colName]; + return undefined === rc + ? toss3( + capi.SQLITE_NOTFOUND, + 'exec(): unknown result column:', + $colName, + ) + : rc; + }; + break; + } + toss3('Invalid rowMode:', opt.rowMode); + } + } + return out; + }; + + const __selectFirstRow = (db, sql, bind, ...getArgs) => { + const stmt = db.prepare(sql); + try { + const rc = stmt.bind(bind).step() + ? stmt.get(...getArgs) + : undefined; + stmt.reset(); + return rc; + } finally { + stmt.finalize(); + } + }; + + const __selectAll = (db, sql, bind, rowMode) => + db.exec({ + sql, + bind, + rowMode, + returnValue: 'resultRows', + }); + + DB.checkRc = (db, resultCode) => checkSqlite3Rc(db, resultCode); + + DB.prototype = { + isOpen: function () { + return !!this.pointer; + }, + + affirmOpen: function () { + return affirmDbOpen(this); + }, + + close: function () { + if (this.pointer) { + if (this.onclose && this.onclose.before instanceof Function) { + try { + this.onclose.before(this); + } catch (e) {} + } + const pDb = this.pointer; + Object.keys(__stmtMap.get(this)).forEach((k, s) => { + if (s && s.pointer) { + try { + s.finalize(); + } catch (e) {} + } + }); + __ptrMap.delete(this); + __stmtMap.delete(this); + capi.sqlite3_close_v2(pDb); + if (this.onclose && this.onclose.after instanceof Function) { + try { + this.onclose.after(this); + } catch (e) {} + } + delete this.filename; + } + }, + + changes: function (total = false, sixtyFour = false) { + const p = affirmDbOpen(this).pointer; + if (total) { + return sixtyFour + ? capi.sqlite3_total_changes64(p) + : capi.sqlite3_total_changes(p); + } else { + return sixtyFour + ? capi.sqlite3_changes64(p) + : capi.sqlite3_changes(p); + } + }, + + dbFilename: function (dbName = 'main') { + return capi.sqlite3_db_filename(affirmDbOpen(this).pointer, dbName); + }, + + dbName: function (dbNumber = 0) { + return capi.sqlite3_db_name(affirmDbOpen(this).pointer, dbNumber); + }, + + dbVfsName: function (dbName = 0) { + let rc; + const pVfs = capi.sqlite3_js_db_vfs( + affirmDbOpen(this).pointer, + dbName, + ); + if (pVfs) { + const v = new capi.sqlite3_vfs(pVfs); + try { + rc = wasm.cstrToJs(v.$zName); + } finally { + v.dispose(); + } + } + return rc; + }, + + prepare: function (sql) { + affirmDbOpen(this); + const stack = wasm.pstack.pointer; + let ppStmt, pStmt; + try { + ppStmt = wasm.pstack.alloc(8); + DB.checkRc( + this, + capi.sqlite3_prepare_v2(this.pointer, sql, -1, ppStmt, null), + ); + pStmt = wasm.peekPtr(ppStmt); + } finally { + wasm.pstack.restore(stack); + } + if (!pStmt) toss3('Cannot prepare empty SQL.'); + const stmt = new Stmt(this, pStmt, BindTypes); + __stmtMap.get(this)[pStmt] = stmt; + return stmt; + }, + + exec: function () { + affirmDbOpen(this); + const arg = parseExecArgs(this, arguments); + if (!arg.sql) { + return toss3('exec() requires an SQL string.'); + } + const opt = arg.opt; + const callback = opt.callback; + const resultRows = Array.isArray(opt.resultRows) + ? opt.resultRows + : undefined; + let stmt; + let bind = opt.bind; + let evalFirstResult = !!( + arg.cbArg || + opt.columnNames || + resultRows + ); + const stack = wasm.scopedAllocPush(); + const saveSql = Array.isArray(opt.saveSql) + ? opt.saveSql + : undefined; + try { + const isTA = util.isSQLableTypedArray(arg.sql); + let sqlByteLen = isTA + ? arg.sql.byteLength + : wasm.jstrlen(arg.sql); + const ppStmt = wasm.scopedAlloc( + 2 * wasm.ptrSizeof + (sqlByteLen + 1), + ); + const pzTail = ppStmt + wasm.ptrSizeof; + let pSql = pzTail + wasm.ptrSizeof; + const pSqlEnd = pSql + sqlByteLen; + if (isTA) wasm.heap8().set(arg.sql, pSql); + else wasm.jstrcpy(arg.sql, wasm.heap8(), pSql, sqlByteLen, false); + wasm.poke(pSql + sqlByteLen, 0); + while (pSql && wasm.peek(pSql, 'i8')) { + wasm.pokePtr([ppStmt, pzTail], 0); + DB.checkRc( + this, + capi.sqlite3_prepare_v3( + this.pointer, + pSql, + sqlByteLen, + 0, + ppStmt, + pzTail, + ), + ); + const pStmt = wasm.peekPtr(ppStmt); + pSql = wasm.peekPtr(pzTail); + sqlByteLen = pSqlEnd - pSql; + if (!pStmt) continue; + if (saveSql) saveSql.push(capi.sqlite3_sql(pStmt).trim()); + stmt = new Stmt(this, pStmt, BindTypes); + if (bind && stmt.parameterCount) { + stmt.bind(bind); + bind = null; + } + if (evalFirstResult && stmt.columnCount) { + let gotColNames = Array.isArray(opt.columnNames) ? 0 : 1; + evalFirstResult = false; + if (arg.cbArg || resultRows) { + const cbArgCache = Object.create(null); + for (; stmt.step(); stmt._lockedByExec = false) { + if (0 === gotColNames++) { + stmt.getColumnNames( + (cbArgCache.columnNames = opt.columnNames || []), + ); + } + stmt._lockedByExec = true; + const row = arg.cbArg(stmt, cbArgCache); + if (resultRows) resultRows.push(row); + if (callback && false === callback.call(opt, row, stmt)) { + break; + } + } + stmt._lockedByExec = false; + } + if (0 === gotColNames) { + stmt.getColumnNames(opt.columnNames); + } + } else { + stmt.step(); + } + stmt.reset().finalize(); + stmt = null; + } + } finally { + wasm.scopedAllocPop(stack); + if (stmt) { + delete stmt._lockedByExec; + stmt.finalize(); + } + } + return arg.returnVal(); + }, + + createFunction: function f(name, xFunc, opt) { + const isFunc = (f) => f instanceof Function; + switch (arguments.length) { + case 1: + opt = name; + name = opt.name; + xFunc = opt.xFunc || 0; + break; + case 2: + if (!isFunc(xFunc)) { + opt = xFunc; + xFunc = opt.xFunc || 0; + } + break; + case 3: + break; + default: + break; + } + if (!opt) opt = {}; + if ('string' !== typeof name) { + toss3('Invalid arguments: missing function name.'); + } + let xStep = opt.xStep || 0; + let xFinal = opt.xFinal || 0; + const xValue = opt.xValue || 0; + const xInverse = opt.xInverse || 0; + let isWindow = undefined; + if (isFunc(xFunc)) { + isWindow = false; + if (isFunc(xStep) || isFunc(xFinal)) { + toss3('Ambiguous arguments: scalar or aggregate?'); + } + xStep = xFinal = null; + } else if (isFunc(xStep)) { + if (!isFunc(xFinal)) { + toss3('Missing xFinal() callback for aggregate or window UDF.'); + } + xFunc = null; + } else if (isFunc(xFinal)) { + toss3('Missing xStep() callback for aggregate or window UDF.'); + } else { + toss3('Missing function-type properties.'); + } + if (false === isWindow) { + if (isFunc(xValue) || isFunc(xInverse)) { + toss3( + 'xValue and xInverse are not permitted for non-window UDFs.', + ); + } + } else if (isFunc(xValue)) { + if (!isFunc(xInverse)) { + toss3('xInverse must be provided if xValue is.'); + } + isWindow = true; + } else if (isFunc(xInverse)) { + toss3('xValue must be provided if xInverse is.'); + } + const pApp = opt.pApp; + if ( + undefined !== pApp && + null !== pApp && + ('number' !== typeof pApp || !util.isInt32(pApp)) + ) { + toss3( + 'Invalid value for pApp property. Must be a legal WASM pointer value.', + ); + } + const xDestroy = opt.xDestroy || 0; + if (xDestroy && !isFunc(xDestroy)) { + toss3('xDestroy property must be a function.'); + } + let fFlags = 0; + if (getOwnOption(opt, 'deterministic')) + fFlags |= capi.SQLITE_DETERMINISTIC; + if (getOwnOption(opt, 'directOnly')) + fFlags |= capi.SQLITE_DIRECTONLY; + if (getOwnOption(opt, 'innocuous')) fFlags |= capi.SQLITE_INNOCUOUS; + name = name.toLowerCase(); + const xArity = xFunc || xStep; + const arity = getOwnOption(opt, 'arity'); + const arityArg = + 'number' === typeof arity + ? arity + : xArity.length + ? xArity.length - 1 + : 0; + let rc; + if (isWindow) { + rc = capi.sqlite3_create_window_function( + this.pointer, + name, + arityArg, + capi.SQLITE_UTF8 | fFlags, + pApp || 0, + xStep, + xFinal, + xValue, + xInverse, + xDestroy, + ); + } else { + rc = capi.sqlite3_create_function_v2( + this.pointer, + name, + arityArg, + capi.SQLITE_UTF8 | fFlags, + pApp || 0, + xFunc, + xStep, + xFinal, + xDestroy, + ); + } + DB.checkRc(this, rc); + return this; + }, + + selectValue: function (sql, bind, asType) { + return __selectFirstRow(this, sql, bind, 0, asType); + }, + + selectValues: function (sql, bind, asType) { + const stmt = this.prepare(sql), + rc = []; + try { + stmt.bind(bind); + while (stmt.step()) rc.push(stmt.get(0, asType)); + stmt.reset(); + } finally { + stmt.finalize(); + } + return rc; + }, + + selectArray: function (sql, bind) { + return __selectFirstRow(this, sql, bind, []); + }, + + selectObject: function (sql, bind) { + return __selectFirstRow(this, sql, bind, {}); + }, + + selectArrays: function (sql, bind) { + return __selectAll(this, sql, bind, 'array'); + }, + + selectObjects: function (sql, bind) { + return __selectAll(this, sql, bind, 'object'); + }, + + openStatementCount: function () { + return this.pointer ? Object.keys(__stmtMap.get(this)).length : 0; + }, + + transaction: function (callback) { + let opener = 'BEGIN'; + if (arguments.length > 1) { + if (/[^a-zA-Z]/.test(arguments[0])) { + toss3( + capi.SQLITE_MISUSE, + 'Invalid argument for BEGIN qualifier.', + ); + } + opener += ' ' + arguments[0]; + callback = arguments[1]; + } + affirmDbOpen(this).exec(opener); + try { + const rc = callback(this); + this.exec('COMMIT'); + return rc; + } catch (e) { + this.exec('ROLLBACK'); + throw e; + } + }, + + savepoint: function (callback) { + affirmDbOpen(this).exec('SAVEPOINT oo1'); + try { + const rc = callback(this); + this.exec('RELEASE oo1'); + return rc; + } catch (e) { + this.exec('ROLLBACK to SAVEPOINT oo1; RELEASE SAVEPOINT oo1'); + throw e; + } + }, + + checkRc: function (resultCode) { + return checkSqlite3Rc(this, resultCode); + }, + }; + + const affirmStmtOpen = function (stmt) { + if (!stmt.pointer) toss3('Stmt has been closed.'); + return stmt; + }; + + const isSupportedBindType = function (v) { + let t = BindTypes[null === v || undefined === v ? 'null' : typeof v]; + switch (t) { + case BindTypes.boolean: + case BindTypes.null: + case BindTypes.number: + case BindTypes.string: + return t; + case BindTypes.bigint: + if (wasm.bigIntEnabled) return t; + + default: + return util.isBindableTypedArray(v) ? BindTypes.blob : undefined; + } + }; + + const affirmSupportedBindType = function (v) { + return ( + isSupportedBindType(v) || + toss3('Unsupported bind() argument type:', typeof v) + ); + }; + + const affirmParamIndex = function (stmt, key) { + const n = + 'number' === typeof key + ? key + : capi.sqlite3_bind_parameter_index(stmt.pointer, key); + if (0 === n || !util.isInt32(n)) { + toss3('Invalid bind() parameter name: ' + key); + } else if (n < 1 || n > stmt.parameterCount) + toss3('Bind index', key, 'is out of range.'); + return n; + }; + + const affirmNotLockedByExec = function (stmt, currentOpName) { + if (stmt._lockedByExec) { + toss3( + 'Operation is illegal when statement is locked:', + currentOpName, + ); + } + return stmt; + }; + + const bindOne = function f(stmt, ndx, bindType, val) { + affirmNotLockedByExec(affirmStmtOpen(stmt), 'bind()'); + if (!f._) { + f._tooBigInt = (v) => + toss3( + 'BigInt value is too big to store without precision loss:', + v, + ); + f._ = { + string: function (stmt, ndx, val, asBlob) { + const [pStr, n] = wasm.allocCString(val, true); + const f = asBlob + ? capi.sqlite3_bind_blob + : capi.sqlite3_bind_text; + return f(stmt.pointer, ndx, pStr, n, capi.SQLITE_WASM_DEALLOC); + }, + }; + } + affirmSupportedBindType(val); + ndx = affirmParamIndex(stmt, ndx); + let rc = 0; + switch ( + null === val || undefined === val ? BindTypes.null : bindType + ) { + case BindTypes.null: + rc = capi.sqlite3_bind_null(stmt.pointer, ndx); + break; + case BindTypes.string: + rc = f._.string(stmt, ndx, val, false); + break; + case BindTypes.number: { + let m; + if (util.isInt32(val)) m = capi.sqlite3_bind_int; + else if ('bigint' === typeof val) { + if (!util.bigIntFits64(val)) { + f._tooBigInt(val); + } else if (wasm.bigIntEnabled) { + m = capi.sqlite3_bind_int64; + } else if (util.bigIntFitsDouble(val)) { + val = Number(val); + m = capi.sqlite3_bind_double; + } else { + f._tooBigInt(val); + } + } else { + val = Number(val); + if (wasm.bigIntEnabled && Number.isInteger(val)) { + m = capi.sqlite3_bind_int64; + } else { + m = capi.sqlite3_bind_double; + } + } + rc = m(stmt.pointer, ndx, val); + break; + } + case BindTypes.boolean: + rc = capi.sqlite3_bind_int(stmt.pointer, ndx, val ? 1 : 0); + break; + case BindTypes.blob: { + if ('string' === typeof val) { + rc = f._.string(stmt, ndx, val, true); + break; + } else if (val instanceof ArrayBuffer) { + val = new Uint8Array(val); + } else if (!util.isBindableTypedArray(val)) { + toss3( + 'Binding a value as a blob requires', + 'that it be a string, Uint8Array, Int8Array, or ArrayBuffer.', + ); + } + const pBlob = wasm.alloc(val.byteLength || 1); + wasm.heap8().set(val.byteLength ? val : [0], pBlob); + rc = capi.sqlite3_bind_blob( + stmt.pointer, + ndx, + pBlob, + val.byteLength, + capi.SQLITE_WASM_DEALLOC, + ); + break; + } + default: + sqlite3.config.warn('Unsupported bind() argument type:', val); + toss3('Unsupported bind() argument type: ' + typeof val); + } + if (rc) DB.checkRc(stmt.db.pointer, rc); + stmt._mayGet = false; + return stmt; + }; + + Stmt.prototype = { + finalize: function () { + if (this.pointer) { + affirmNotLockedByExec(this, 'finalize()'); + const rc = capi.sqlite3_finalize(this.pointer); + delete __stmtMap.get(this.db)[this.pointer]; + __ptrMap.delete(this); + delete this._mayGet; + delete this.parameterCount; + delete this._lockedByExec; + delete this.db; + return rc; + } + }, + + clearBindings: function () { + affirmNotLockedByExec(affirmStmtOpen(this), 'clearBindings()'); + capi.sqlite3_clear_bindings(this.pointer); + this._mayGet = false; + return this; + }, + + reset: function (alsoClearBinds) { + affirmNotLockedByExec(this, 'reset()'); + if (alsoClearBinds) this.clearBindings(); + const rc = capi.sqlite3_reset(affirmStmtOpen(this).pointer); + this._mayGet = false; + checkSqlite3Rc(this.db, rc); + return this; + }, + + bind: function () { + affirmStmtOpen(this); + let ndx, arg; + switch (arguments.length) { + case 1: + ndx = 1; + arg = arguments[0]; + break; + case 2: + ndx = arguments[0]; + arg = arguments[1]; + break; + default: + toss3('Invalid bind() arguments.'); + } + if (undefined === arg) { + return this; + } else if (!this.parameterCount) { + toss3('This statement has no bindable parameters.'); + } + this._mayGet = false; + if (null === arg) { + return bindOne(this, ndx, BindTypes.null, arg); + } else if (Array.isArray(arg)) { + if (1 !== arguments.length) { + toss3( + 'When binding an array, an index argument is not permitted.', + ); + } + arg.forEach((v, i) => + bindOne(this, i + 1, affirmSupportedBindType(v), v), + ); + return this; + } else if (arg instanceof ArrayBuffer) { + arg = new Uint8Array(arg); + } + if ('object' === typeof arg && !util.isBindableTypedArray(arg)) { + if (1 !== arguments.length) { + toss3( + 'When binding an object, an index argument is not permitted.', + ); + } + Object.keys(arg).forEach((k) => + bindOne(this, k, affirmSupportedBindType(arg[k]), arg[k]), + ); + return this; + } else { + return bindOne(this, ndx, affirmSupportedBindType(arg), arg); + } + toss3('Should not reach this point.'); + }, + + bindAsBlob: function (ndx, arg) { + affirmStmtOpen(this); + if (1 === arguments.length) { + arg = ndx; + ndx = 1; + } + const t = affirmSupportedBindType(arg); + if ( + BindTypes.string !== t && + BindTypes.blob !== t && + BindTypes.null !== t + ) { + toss3('Invalid value type for bindAsBlob()'); + } + return bindOne(this, ndx, BindTypes.blob, arg); + }, + + step: function () { + affirmNotLockedByExec(this, 'step()'); + const rc = capi.sqlite3_step(affirmStmtOpen(this).pointer); + switch (rc) { + case capi.SQLITE_DONE: + return (this._mayGet = false); + case capi.SQLITE_ROW: + return (this._mayGet = true); + default: + this._mayGet = false; + sqlite3.config.warn( + 'sqlite3_step() rc=', + rc, + capi.sqlite3_js_rc_str(rc), + 'SQL =', + capi.sqlite3_sql(this.pointer), + ); + DB.checkRc(this.db.pointer, rc); + } + }, + + stepReset: function () { + this.step(); + return this.reset(); + }, + + stepFinalize: function () { + try { + const rc = this.step(); + this.reset(); + return rc; + } finally { + try { + this.finalize(); + } catch (e) {} + } + }, + + get: function (ndx, asType) { + if (!affirmStmtOpen(this)._mayGet) { + toss3('Stmt.step() has not (recently) returned true.'); + } + if (Array.isArray(ndx)) { + let i = 0; + const n = this.columnCount; + while (i < n) { + ndx[i] = this.get(i++); + } + return ndx; + } else if (ndx && 'object' === typeof ndx) { + let i = 0; + const n = this.columnCount; + while (i < n) { + ndx[capi.sqlite3_column_name(this.pointer, i)] = this.get(i++); + } + return ndx; + } + affirmColIndex(this, ndx); + switch ( + undefined === asType + ? capi.sqlite3_column_type(this.pointer, ndx) + : asType + ) { + case capi.SQLITE_NULL: + return null; + case capi.SQLITE_INTEGER: { + if (wasm.bigIntEnabled) { + const rc = capi.sqlite3_column_int64(this.pointer, ndx); + if ( + rc >= Number.MIN_SAFE_INTEGER && + rc <= Number.MAX_SAFE_INTEGER + ) { + return Number(rc).valueOf(); + } + return rc; + } else { + const rc = capi.sqlite3_column_double(this.pointer, ndx); + if ( + rc > Number.MAX_SAFE_INTEGER || + rc < Number.MIN_SAFE_INTEGER + ) { + toss3( + 'Integer is out of range for JS integer range: ' + rc, + ); + } + + return util.isInt32(rc) ? rc | 0 : rc; + } + } + case capi.SQLITE_FLOAT: + return capi.sqlite3_column_double(this.pointer, ndx); + case capi.SQLITE_TEXT: + return capi.sqlite3_column_text(this.pointer, ndx); + case capi.SQLITE_BLOB: { + const n = capi.sqlite3_column_bytes(this.pointer, ndx), + ptr = capi.sqlite3_column_blob(this.pointer, ndx), + rc = new Uint8Array(n); + + if (n) rc.set(wasm.heap8u().slice(ptr, ptr + n), 0); + + if (n && this.db._blobXfer instanceof Array) { + this.db._blobXfer.push(rc.buffer); + } + return rc; + } + default: + toss3( + "Don't know how to translate", + 'type of result column #' + ndx + '.', + ); + } + toss3('Not reached.'); + }, + + getInt: function (ndx) { + return this.get(ndx, capi.SQLITE_INTEGER); + }, + + getFloat: function (ndx) { + return this.get(ndx, capi.SQLITE_FLOAT); + }, + + getString: function (ndx) { + return this.get(ndx, capi.SQLITE_TEXT); + }, + + getBlob: function (ndx) { + return this.get(ndx, capi.SQLITE_BLOB); + }, + + getJSON: function (ndx) { + const s = this.get(ndx, capi.SQLITE_STRING); + return null === s ? s : JSON.parse(s); + }, + + getColumnName: function (ndx) { + return capi.sqlite3_column_name( + affirmColIndex(affirmStmtOpen(this), ndx).pointer, + ndx, + ); + }, + + getColumnNames: function (tgt = []) { + affirmColIndex(affirmStmtOpen(this), 0); + const n = this.columnCount; + for (let i = 0; i < n; ++i) { + tgt.push(capi.sqlite3_column_name(this.pointer, i)); + } + return tgt; + }, + + getParamIndex: function (name) { + return affirmStmtOpen(this).parameterCount + ? capi.sqlite3_bind_parameter_index(this.pointer, name) + : undefined; + }, + + getParamName: function (ndx) { + return affirmStmtOpen(this).parameterCount + ? capi.sqlite3_bind_parameter_name(this.pointer, ndx) + : undefined; + }, + + isBusy: function () { + return 0 !== capi.sqlite3_stmt_busy(affirmStmtOpen(this)); + }, + + isReadOnly: function () { + return 0 !== capi.sqlite3_stmt_readonly(affirmStmtOpen(this)); + }, + }; + + { + const prop = { + enumerable: true, + get: function () { + return __ptrMap.get(this); + }, + set: () => toss3('The pointer property is read-only.'), + }; + Object.defineProperty(Stmt.prototype, 'pointer', prop); + Object.defineProperty(DB.prototype, 'pointer', prop); + } + + Object.defineProperty(Stmt.prototype, 'columnCount', { + enumerable: false, + get: function () { + return capi.sqlite3_column_count(this.pointer); + }, + set: () => toss3('The columnCount property is read-only.'), + }); + + sqlite3.oo1 = { + DB, + Stmt, + }; + + if (util.isUIThread()) { + sqlite3.oo1.JsStorageDb = function (storageName = 'session') { + const opt = dbCtorHelper.normalizeArgs(...arguments); + storageName = opt.filename; + if ('session' !== storageName && 'local' !== storageName) { + toss3("JsStorageDb db name must be one of 'session' or 'local'."); + } + opt.vfs = 'kvvfs'; + dbCtorHelper.call(this, opt); + }; + const jdb = sqlite3.oo1.JsStorageDb; + jdb.prototype = Object.create(DB.prototype); + + jdb.clearStorage = capi.sqlite3_js_kvvfs_clear; + + jdb.prototype.clearStorage = function () { + return jdb.clearStorage(affirmDbOpen(this).filename); + }; + + jdb.storageSize = capi.sqlite3_js_kvvfs_size; + + jdb.prototype.storageSize = function () { + return jdb.storageSize(affirmDbOpen(this).filename); + }; + } + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const util = sqlite3.util; + sqlite3.initWorker1API = function () { + 'use strict'; + const toss = (...args) => { + throw new Error(args.join(' ')); + }; + if (!(globalThis.WorkerGlobalScope instanceof Function)) { + toss('initWorker1API() must be run from a Worker thread.'); + } + const sqlite3 = this.sqlite3 || toss('Missing this.sqlite3 object.'); + const DB = sqlite3.oo1.DB; + + const getDbId = function (db) { + let id = wState.idMap.get(db); + if (id) return id; + id = 'db#' + ++wState.idSeq + '@' + db.pointer; + + wState.idMap.set(db, id); + return id; + }; + + const wState = { + dbList: [], + + idSeq: 0, + + idMap: new WeakMap(), + + xfer: [], + open: function (opt) { + const db = new DB(opt); + this.dbs[getDbId(db)] = db; + if (this.dbList.indexOf(db) < 0) this.dbList.push(db); + return db; + }, + close: function (db, alsoUnlink) { + if (db) { + delete this.dbs[getDbId(db)]; + const filename = db.filename; + const pVfs = util.sqlite3__wasm_db_vfs(db.pointer, 0); + db.close(); + const ddNdx = this.dbList.indexOf(db); + if (ddNdx >= 0) this.dbList.splice(ddNdx, 1); + if (alsoUnlink && filename && pVfs) { + util.sqlite3__wasm_vfs_unlink(pVfs, filename); + } + } + }, + + post: function (msg, xferList) { + if (xferList && xferList.length) { + globalThis.postMessage(msg, Array.from(xferList)); + xferList.length = 0; + } else { + globalThis.postMessage(msg); + } + }, + + dbs: Object.create(null), + + getDb: function (id, require = true) { + return ( + this.dbs[id] || + (require ? toss('Unknown (or closed) DB ID:', id) : undefined) + ); + }, + }; + + const affirmDbOpen = function (db = wState.dbList[0]) { + return db && db.pointer ? db : toss('DB is not opened.'); + }; + + const getMsgDb = function (msgData, affirmExists = true) { + const db = wState.getDb(msgData.dbId, false) || wState.dbList[0]; + return affirmExists ? affirmDbOpen(db) : db; + }; + + const getDefaultDbId = function () { + return wState.dbList[0] && getDbId(wState.dbList[0]); + }; + + const isSpecialDbFilename = (n) => { + return '' === n || ':' === n[0]; + }; + + const wMsgHandler = { + open: function (ev) { + const oargs = Object.create(null), + args = ev.args || Object.create(null); + if (args.simulateError) { + toss('Throwing because of simulateError flag.'); + } + const rc = Object.create(null); + oargs.vfs = args.vfs; + oargs.filename = args.filename || ''; + const db = wState.open(oargs); + rc.filename = db.filename; + rc.persistent = !!sqlite3.capi.sqlite3_js_db_uses_vfs( + db.pointer, + 'opfs', + ); + rc.dbId = getDbId(db); + rc.vfs = db.dbVfsName(); + return rc; + }, + + close: function (ev) { + const db = getMsgDb(ev, false); + const response = { + filename: db && db.filename, + }; + if (db) { + const doUnlink = + ev.args && 'object' === typeof ev.args + ? !!ev.args.unlink + : false; + wState.close(db, doUnlink); + } + return response; + }, + + exec: function (ev) { + const rc = + 'string' === typeof ev.args + ? { sql: ev.args } + : ev.args || Object.create(null); + if ('stmt' === rc.rowMode) { + toss( + "Invalid rowMode for 'exec': stmt mode", + 'does not work in the Worker API.', + ); + } else if (!rc.sql) { + toss("'exec' requires input SQL."); + } + const db = getMsgDb(ev); + if (rc.callback || Array.isArray(rc.resultRows)) { + db._blobXfer = wState.xfer; + } + const theCallback = rc.callback; + let rowNumber = 0; + const hadColNames = !!rc.columnNames; + if ('string' === typeof theCallback) { + if (!hadColNames) rc.columnNames = []; + + rc.callback = function (row, stmt) { + wState.post( + { + type: theCallback, + columnNames: rc.columnNames, + rowNumber: ++rowNumber, + row: row, + }, + wState.xfer, + ); + }; + } + try { + const changeCount = !!rc.countChanges + ? db.changes(true, 64 === rc.countChanges) + : undefined; + db.exec(rc); + if (undefined !== changeCount) { + rc.changeCount = + db.changes(true, 64 === rc.countChanges) - changeCount; + } + const lastInsertRowId = !!rc.lastInsertRowId + ? sqlite3.capi.sqlite3_last_insert_rowid(db) + : undefined; + if (undefined !== lastInsertRowId) { + rc.lastInsertRowId = lastInsertRowId; + } + if (rc.callback instanceof Function) { + rc.callback = theCallback; + + wState.post({ + type: theCallback, + columnNames: rc.columnNames, + rowNumber: null, + row: undefined, + }); + } + } finally { + delete db._blobXfer; + if (rc.callback) rc.callback = theCallback; + } + return rc; + }, + + 'config-get': function () { + const rc = Object.create(null), + src = sqlite3.config; + ['bigIntEnabled'].forEach(function (k) { + if (Object.getOwnPropertyDescriptor(src, k)) rc[k] = src[k]; + }); + rc.version = sqlite3.version; + rc.vfsList = sqlite3.capi.sqlite3_js_vfs_list(); + return rc; + }, + + export: function (ev) { + const db = getMsgDb(ev); + const response = { + byteArray: sqlite3.capi.sqlite3_js_db_export(db.pointer), + filename: db.filename, + mimetype: 'application/x-sqlite3', + }; + wState.xfer.push(response.byteArray.buffer); + return response; + }, + + toss: function (ev) { + toss('Testing worker exception'); + }, + }; + + globalThis.onmessage = async function (ev) { + ev = ev.data; + let result, + dbId = ev.dbId, + evType = ev.type; + const arrivalTime = performance.now(); + try { + if ( + wMsgHandler.hasOwnProperty(evType) && + wMsgHandler[evType] instanceof Function + ) { + result = await wMsgHandler[evType](ev); + } else { + toss('Unknown db worker message type:', ev.type); + } + } catch (err) { + evType = 'error'; + result = { + operation: ev.type, + message: err.message, + errorClass: err.name, + input: ev, + }; + if (err.stack) { + result.stack = + 'string' === typeof err.stack + ? err.stack.split(/\n\s*/) + : err.stack; + } + if (0) + sqlite3.config.warn( + 'Worker is propagating an exception to main thread.', + 'Reporting it _here_ for the stack trace:', + err, + result, + ); + } + if (!dbId) { + dbId = result.dbId || getDefaultDbId(); + } + + wState.post( + { + type: evType, + dbId: dbId, + messageId: ev.messageId, + workerReceivedTime: arrivalTime, + workerRespondTime: performance.now(), + departureTime: ev.departureTime, + + result: result, + }, + wState.xfer, + ); + }; + globalThis.postMessage({ + type: 'sqlite3-api', + result: 'worker1-ready', + }); + }.bind({ sqlite3 }); + }); + + ('use strict'); + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const wasm = sqlite3.wasm, + capi = sqlite3.capi, + toss = sqlite3.util.toss3; + const vfs = Object.create(null); + sqlite3.vfs = vfs; + + capi.sqlite3_vfs.prototype.registerVfs = function (asDefault = false) { + if (!(this instanceof sqlite3.capi.sqlite3_vfs)) { + toss('Expecting a sqlite3_vfs-type argument.'); + } + const rc = capi.sqlite3_vfs_register(this, asDefault ? 1 : 0); + if (rc) { + toss('sqlite3_vfs_register(', this, ') failed with rc', rc); + } + if (this.pointer !== capi.sqlite3_vfs_find(this.$zName)) { + toss( + 'BUG: sqlite3_vfs_find(vfs.$zName) failed for just-installed VFS', + this, + ); + } + return this; + }; + + vfs.installVfs = function (opt) { + let count = 0; + const propList = ['io', 'vfs']; + for (const key of propList) { + const o = opt[key]; + if (o) { + ++count; + o.struct.installMethods(o.methods, !!o.applyArgcCheck); + if ('vfs' === key) { + if (!o.struct.$zName && 'string' === typeof o.name) { + o.struct.addOnDispose( + (o.struct.$zName = wasm.allocCString(o.name)), + ); + } + o.struct.registerVfs(!!o.asDefault); + } + } + } + if (!count) + toss( + 'Misuse: installVfs() options object requires at least', + 'one of:', + propList, + ); + return this; + }; + }); + + ('use strict'); + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + if (!sqlite3.wasm.exports.sqlite3_declare_vtab) { + return; + } + const wasm = sqlite3.wasm, + capi = sqlite3.capi, + toss = sqlite3.util.toss3; + const vtab = Object.create(null); + sqlite3.vtab = vtab; + + const sii = capi.sqlite3_index_info; + + sii.prototype.nthConstraint = function (n, asPtr = false) { + if (n < 0 || n >= this.$nConstraint) return false; + const ptr = + this.$aConstraint + + sii.sqlite3_index_constraint.structInfo.sizeof * n; + return asPtr ? ptr : new sii.sqlite3_index_constraint(ptr); + }; + + sii.prototype.nthConstraintUsage = function (n, asPtr = false) { + if (n < 0 || n >= this.$nConstraint) return false; + const ptr = + this.$aConstraintUsage + + sii.sqlite3_index_constraint_usage.structInfo.sizeof * n; + return asPtr ? ptr : new sii.sqlite3_index_constraint_usage(ptr); + }; + + sii.prototype.nthOrderBy = function (n, asPtr = false) { + if (n < 0 || n >= this.$nOrderBy) return false; + const ptr = + this.$aOrderBy + sii.sqlite3_index_orderby.structInfo.sizeof * n; + return asPtr ? ptr : new sii.sqlite3_index_orderby(ptr); + }; + + const __xWrapFactory = function (methodName, StructType) { + return function (ptr, removeMapping = false) { + if (0 === arguments.length) ptr = new StructType(); + if (ptr instanceof StructType) { + this.set(ptr.pointer, ptr); + return ptr; + } else if (!wasm.isPtr(ptr)) { + sqlite3.SQLite3Error.toss( + 'Invalid argument to', + methodName + '()', + ); + } + let rc = this.get(ptr); + if (removeMapping) this.delete(ptr); + return rc; + }.bind(new Map()); + }; + + const StructPtrMapper = function (name, StructType) { + const __xWrap = __xWrapFactory(name, StructType); + + return Object.assign(Object.create(null), { + StructType, + + create: (ppOut) => { + const rc = __xWrap(); + wasm.pokePtr(ppOut, rc.pointer); + return rc; + }, + + get: (pCObj) => __xWrap(pCObj), + + unget: (pCObj) => __xWrap(pCObj, true), + + dispose: (pCObj) => { + const o = __xWrap(pCObj, true); + if (o) o.dispose(); + }, + }); + }; + + vtab.xVtab = StructPtrMapper('xVtab', capi.sqlite3_vtab); + + vtab.xCursor = StructPtrMapper('xCursor', capi.sqlite3_vtab_cursor); + + vtab.xIndexInfo = (pIdxInfo) => new capi.sqlite3_index_info(pIdxInfo); + + vtab.xError = function f(methodName, err, defaultRc) { + if (f.errorReporter instanceof Function) { + try { + f.errorReporter( + 'sqlite3_module::' + methodName + '(): ' + err.message, + ); + } catch (e) {} + } + let rc; + if (err instanceof sqlite3.WasmAllocError) rc = capi.SQLITE_NOMEM; + else if (arguments.length > 2) rc = defaultRc; + else if (err instanceof sqlite3.SQLite3Error) rc = err.resultCode; + return rc || capi.SQLITE_ERROR; + }; + vtab.xError.errorReporter = 1 ? console.error.bind(console) : false; + + vtab.xRowid = (ppRowid64, value) => wasm.poke(ppRowid64, value, 'i64'); + + vtab.setupModule = function (opt) { + let createdMod = false; + const mod = + this instanceof capi.sqlite3_module + ? this + : opt.struct || (createdMod = new capi.sqlite3_module()); + try { + const methods = opt.methods || toss("Missing 'methods' object."); + for (const e of Object.entries({ + xConnect: 'xCreate', + xDisconnect: 'xDestroy', + })) { + const k = e[0], + v = e[1]; + if (true === methods[k]) methods[k] = methods[v]; + else if (true === methods[v]) methods[v] = methods[k]; + } + if (opt.catchExceptions) { + const fwrap = function (methodName, func) { + if (['xConnect', 'xCreate'].indexOf(methodName) >= 0) { + return function (pDb, pAux, argc, argv, ppVtab, pzErr) { + try { + return func(...arguments) || 0; + } catch (e) { + if (!(e instanceof sqlite3.WasmAllocError)) { + wasm.dealloc(wasm.peekPtr(pzErr)); + wasm.pokePtr(pzErr, wasm.allocCString(e.message)); + } + return vtab.xError(methodName, e); + } + }; + } else { + return function (...args) { + try { + return func(...args) || 0; + } catch (e) { + return vtab.xError(methodName, e); + } + }; + } + }; + const mnames = [ + 'xCreate', + 'xConnect', + 'xBestIndex', + 'xDisconnect', + 'xDestroy', + 'xOpen', + 'xClose', + 'xFilter', + 'xNext', + 'xEof', + 'xColumn', + 'xRowid', + 'xUpdate', + 'xBegin', + 'xSync', + 'xCommit', + 'xRollback', + 'xFindFunction', + 'xRename', + 'xSavepoint', + 'xRelease', + 'xRollbackTo', + 'xShadowName', + ]; + const remethods = Object.create(null); + for (const k of mnames) { + const m = methods[k]; + if (!(m instanceof Function)) continue; + else if ('xConnect' === k && methods.xCreate === m) { + remethods[k] = methods.xCreate; + } else if ('xCreate' === k && methods.xConnect === m) { + remethods[k] = methods.xConnect; + } else { + remethods[k] = fwrap(k, m); + } + } + mod.installMethods(remethods, false); + } else { + mod.installMethods(methods, !!opt.applyArgcCheck); + } + if (0 === mod.$iVersion) { + let v; + if ('number' === typeof opt.iVersion) v = opt.iVersion; + else if (mod.$xShadowName) v = 3; + else if (mod.$xSavePoint || mod.$xRelease || mod.$xRollbackTo) + v = 2; + else v = 1; + mod.$iVersion = v; + } + } catch (e) { + if (createdMod) createdMod.dispose(); + throw e; + } + return mod; + }; + + capi.sqlite3_module.prototype.setupModule = function (opt) { + return vtab.setupModule.call(this, opt); + }; + }); + + ('use strict'); + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + const installOpfsVfs = function callee(options) { + 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', + ), + ); + } else if ('undefined' === typeof WorkerGlobalScope) { + return Promise.reject( + new Error( + 'The OPFS sqlite3_vfs cannot run in the main thread ' + + 'because it requires Atomics.wait().', + ), + ); + } else if ( + !globalThis.FileSystemHandle || + !globalThis.FileSystemDirectoryHandle || + !globalThis.FileSystemFileHandle || + !globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle || + !navigator?.storage?.getDirectory + ) { + return Promise.reject(new Error('Missing required OPFS APIs.')); + } + if (!options || 'object' !== typeof options) { + options = Object.create(null); + } + const urlParams = new URL(globalThis.location.href).searchParams; + if (urlParams.has('opfs-disable')) { + return Promise.resolve(sqlite3); + } + if (undefined === options.verbose) { + options.verbose = urlParams.has('opfs-verbose') + ? +urlParams.get('opfs-verbose') || 2 + : 1; + } + if (undefined === options.sanityChecks) { + options.sanityChecks = urlParams.has('opfs-sanity-check'); + } + if (undefined === options.proxyUri) { + options.proxyUri = callee.defaultProxyUri; + } + + if ('function' === typeof options.proxyUri) { + options.proxyUri = options.proxyUri(); + } + const thePromise = new Promise(function ( + promiseResolve_, + promiseReject_, + ) { + const loggers = [ + sqlite3.config.error, + sqlite3.config.warn, + sqlite3.config.log, + ]; + const logImpl = (level, ...args) => { + if (options.verbose > level) + loggers[level]('OPFS syncer:', ...args); + }; + const log = (...args) => logImpl(2, ...args); + const warn = (...args) => logImpl(1, ...args); + const error = (...args) => logImpl(0, ...args); + const toss = sqlite3.util.toss; + const capi = sqlite3.capi; + const util = sqlite3.util; + const wasm = sqlite3.wasm; + const sqlite3_vfs = capi.sqlite3_vfs; + const sqlite3_file = capi.sqlite3_file; + const sqlite3_io_methods = capi.sqlite3_io_methods; + + const opfsUtil = Object.create(null); + + const thisThreadHasOPFS = () => { + return ( + globalThis.FileSystemHandle && + globalThis.FileSystemDirectoryHandle && + globalThis.FileSystemFileHandle && + globalThis.FileSystemFileHandle.prototype + .createSyncAccessHandle && + navigator?.storage?.getDirectory + ); + }; + + opfsUtil.metrics = { + dump: function () { + let k, + n = 0, + t = 0, + w = 0; + for (k in state.opIds) { + const m = metrics[k]; + n += m.count; + t += m.time; + w += m.wait; + m.avgTime = m.count && m.time ? m.time / m.count : 0; + m.avgWait = m.count && m.wait ? m.wait / m.count : 0; + } + sqlite3.config.log( + globalThis.location.href, + 'metrics for', + globalThis.location.href, + ':', + metrics, + '\nTotal of', + n, + 'op(s) for', + t, + 'ms (incl. ' + w + ' ms of waiting on the async side)', + ); + sqlite3.config.log('Serialization metrics:', metrics.s11n); + W.postMessage({ type: 'opfs-async-metrics' }); + }, + reset: function () { + let k; + const r = (m) => (m.count = m.time = m.wait = 0); + for (k in state.opIds) { + r((metrics[k] = Object.create(null))); + } + let s = (metrics.s11n = Object.create(null)); + s = s.serialize = Object.create(null); + s.count = s.time = 0; + s = metrics.s11n.deserialize = Object.create(null); + s.count = s.time = 0; + }, + }; + const opfsIoMethods = new sqlite3_io_methods(); + const opfsVfs = new sqlite3_vfs().addOnDispose(() => + opfsIoMethods.dispose(), + ); + let promiseWasRejected = undefined; + const promiseReject = (err) => { + promiseWasRejected = true; + opfsVfs.dispose(); + return promiseReject_(err); + }; + const promiseResolve = () => { + promiseWasRejected = false; + return promiseResolve_(sqlite3); + }; + const W = new Worker(new URL(options.proxyUri, import.meta.url)); + setTimeout(() => { + if (undefined === promiseWasRejected) { + promiseReject( + new Error( + 'Timeout while waiting for OPFS async proxy worker.', + ), + ); + } + }, 4000); + W._originalOnError = W.onerror; + W.onerror = function (err) { + error('Error initializing OPFS asyncer:', err); + promiseReject( + new Error( + 'Loading OPFS async Worker failed for unknown reasons.', + ), + ); + }; + const pDVfs = capi.sqlite3_vfs_find(null); + const dVfs = pDVfs ? new sqlite3_vfs(pDVfs) : null; + opfsIoMethods.$iVersion = 1; + opfsVfs.$iVersion = 2; + opfsVfs.$szOsFile = capi.sqlite3_file.structInfo.sizeof; + opfsVfs.$mxPathname = 1024; + opfsVfs.$zName = wasm.allocCString('opfs'); + + opfsVfs.$xDlOpen = + opfsVfs.$xDlError = + opfsVfs.$xDlSym = + opfsVfs.$xDlClose = + null; + opfsVfs.addOnDispose( + '$zName', + opfsVfs.$zName, + 'cleanup default VFS wrapper', + () => (dVfs ? dVfs.dispose() : null), + ); + + const state = Object.create(null); + state.verbose = options.verbose; + state.littleEndian = (() => { + const buffer = new ArrayBuffer(2); + new DataView(buffer).setInt16(0, 256, true); + + return new Int16Array(buffer)[0] === 256; + })(); + + state.asyncIdleWaitTime = 150; + + state.asyncS11nExceptions = 1; + + state.fileBufferSize = 1024 * 64; + state.sabS11nOffset = state.fileBufferSize; + + state.sabS11nSize = opfsVfs.$mxPathname * 2; + + state.sabIO = new SharedArrayBuffer( + state.fileBufferSize + state.sabS11nSize, + ); + state.opIds = Object.create(null); + const metrics = Object.create(null); + { + let i = 0; + + state.opIds.whichOp = i++; + + state.opIds.rc = i++; + + state.opIds.xAccess = i++; + state.opIds.xClose = i++; + state.opIds.xDelete = i++; + state.opIds.xDeleteNoWait = i++; + state.opIds.xFileSize = i++; + state.opIds.xLock = i++; + state.opIds.xOpen = i++; + state.opIds.xRead = i++; + state.opIds.xSleep = i++; + state.opIds.xSync = i++; + state.opIds.xTruncate = i++; + state.opIds.xUnlock = i++; + state.opIds.xWrite = i++; + state.opIds.mkdir = i++; + state.opIds['opfs-async-metrics'] = i++; + state.opIds['opfs-async-shutdown'] = i++; + + state.opIds.retry = i++; + state.sabOP = new SharedArrayBuffer(i * 4); + opfsUtil.metrics.reset(); + } + + state.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((k) => { + if (undefined === (state.sq3Codes[k] = capi[k])) { + toss('Maintenance required: not found:', k); + } + }); + state.opfsFlags = Object.assign(Object.create(null), { + OPFS_UNLOCK_ASAP: 0x01, + + OPFS_UNLINK_BEFORE_OPEN: 0x02, + + defaultUnlockAsap: false, + }); + + const opRun = (op, ...args) => { + const opNdx = state.opIds[op] || toss('Invalid op ID:', op); + state.s11n.serialize(...args); + Atomics.store(state.sabOPView, state.opIds.rc, -1); + Atomics.store(state.sabOPView, state.opIds.whichOp, opNdx); + Atomics.notify(state.sabOPView, state.opIds.whichOp); + const t = performance.now(); + while ( + 'not-equal' !== + Atomics.wait(state.sabOPView, state.opIds.rc, -1) + ) {} + + const rc = Atomics.load(state.sabOPView, state.opIds.rc); + metrics[op].wait += performance.now() - t; + if (rc && state.asyncS11nExceptions) { + const err = state.s11n.deserialize(); + if (err) error(op + '() async error:', ...err); + } + return rc; + }; + + opfsUtil.debug = { + asyncShutdown: () => { + warn( + 'Shutting down OPFS async listener. The OPFS VFS will no longer work.', + ); + opRun('opfs-async-shutdown'); + }, + asyncRestart: () => { + warn( + 'Attempting to restart OPFS VFS async listener. Might work, might not.', + ); + W.postMessage({ type: 'opfs-async-restart' }); + }, + }; + + const initS11n = () => { + if (state.s11n) return state.s11n; + const textDecoder = new TextDecoder(), + textEncoder = new TextEncoder('utf-8'), + viewU8 = new Uint8Array( + state.sabIO, + state.sabS11nOffset, + state.sabS11nSize, + ), + viewDV = new DataView( + state.sabIO, + state.sabS11nOffset, + state.sabS11nSize, + ); + state.s11n = Object.create(null); + + const TypeIds = Object.create(null); + TypeIds.number = { + id: 1, + size: 8, + getter: 'getFloat64', + setter: 'setFloat64', + }; + TypeIds.bigint = { + id: 2, + size: 8, + getter: 'getBigInt64', + setter: 'setBigInt64', + }; + TypeIds.boolean = { + id: 3, + size: 4, + getter: 'getInt32', + setter: 'setInt32', + }; + TypeIds.string = { id: 4 }; + + const getTypeId = (v) => + TypeIds[typeof v] || + toss( + 'Maintenance required: this value type cannot be serialized.', + v, + ); + const getTypeIdById = (tid) => { + switch (tid) { + case TypeIds.number.id: + return TypeIds.number; + case TypeIds.bigint.id: + return TypeIds.bigint; + case TypeIds.boolean.id: + return TypeIds.boolean; + case TypeIds.string.id: + return TypeIds.string; + default: + toss('Invalid type ID:', tid); + } + }; + + state.s11n.deserialize = function (clear = false) { + ++metrics.s11n.deserialize.count; + const t = performance.now(); + const argc = viewU8[0]; + const rc = argc ? [] : null; + if (argc) { + const typeIds = []; + let offset = 1, + i, + n, + v; + for (i = 0; i < argc; ++i, ++offset) { + typeIds.push(getTypeIdById(viewU8[offset])); + } + for (i = 0; i < argc; ++i) { + const t = typeIds[i]; + if (t.getter) { + v = viewDV[t.getter](offset, state.littleEndian); + offset += t.size; + } else { + n = viewDV.getInt32(offset, state.littleEndian); + offset += 4; + v = textDecoder.decode(viewU8.slice(offset, offset + n)); + offset += n; + } + rc.push(v); + } + } + if (clear) viewU8[0] = 0; + + metrics.s11n.deserialize.time += performance.now() - t; + return rc; + }; + + state.s11n.serialize = function (...args) { + const t = performance.now(); + ++metrics.s11n.serialize.count; + if (args.length) { + const typeIds = []; + let i = 0, + offset = 1; + viewU8[0] = args.length & 0xff; + for (; i < args.length; ++i, ++offset) { + typeIds.push(getTypeId(args[i])); + viewU8[offset] = typeIds[i].id; + } + for (i = 0; i < args.length; ++i) { + const t = typeIds[i]; + if (t.setter) { + viewDV[t.setter](offset, args[i], state.littleEndian); + offset += t.size; + } else { + const s = textEncoder.encode(args[i]); + viewDV.setInt32(offset, s.byteLength, state.littleEndian); + offset += 4; + viewU8.set(s, offset); + offset += s.byteLength; + } + } + } else { + viewU8[0] = 0; + } + metrics.s11n.serialize.time += performance.now() - t; + }; + return state.s11n; + }; + + const randomFilename = function f(len = 16) { + if (!f._chars) { + f._chars = + 'abcdefghijklmnopqrstuvwxyz' + + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + + '012346789'; + f._n = f._chars.length; + } + const a = []; + let i = 0; + for (; i < len; ++i) { + const ndx = (Math.random() * (f._n * 64)) % f._n | 0; + a[i] = f._chars[ndx]; + } + return a.join(''); + }; + + const __openFiles = Object.create(null); + + const opTimer = Object.create(null); + opTimer.op = undefined; + opTimer.start = undefined; + const mTimeStart = (op) => { + opTimer.start = performance.now(); + opTimer.op = op; + ++metrics[op].count; + }; + const mTimeEnd = () => + (metrics[opTimer.op].time += performance.now() - opTimer.start); + + const ioSyncWrappers = { + xCheckReservedLock: function (pFile, pOut) { + wasm.poke(pOut, 0, 'i32'); + return 0; + }, + xClose: function (pFile) { + mTimeStart('xClose'); + let rc = 0; + const f = __openFiles[pFile]; + if (f) { + delete __openFiles[pFile]; + rc = opRun('xClose', pFile); + if (f.sq3File) f.sq3File.dispose(); + } + mTimeEnd(); + return rc; + }, + xDeviceCharacteristics: function (pFile) { + return capi.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN; + }, + xFileControl: function (pFile, opId, pArg) { + return capi.SQLITE_NOTFOUND; + }, + xFileSize: function (pFile, pSz64) { + mTimeStart('xFileSize'); + let rc = opRun('xFileSize', pFile); + if (0 == rc) { + try { + const sz = state.s11n.deserialize()[0]; + wasm.poke(pSz64, sz, 'i64'); + } catch (e) { + error('Unexpected error reading xFileSize() result:', e); + rc = state.sq3Codes.SQLITE_IOERR; + } + } + mTimeEnd(); + return rc; + }, + xLock: function (pFile, lockType) { + mTimeStart('xLock'); + const f = __openFiles[pFile]; + let rc = 0; + + if (!f.lockType) { + rc = opRun('xLock', pFile, lockType); + if (0 === rc) f.lockType = lockType; + } else { + f.lockType = lockType; + } + mTimeEnd(); + return rc; + }, + xRead: function (pFile, pDest, n, offset64) { + mTimeStart('xRead'); + const f = __openFiles[pFile]; + let rc; + try { + rc = opRun('xRead', pFile, n, Number(offset64)); + if (0 === rc || capi.SQLITE_IOERR_SHORT_READ === rc) { + wasm.heap8u().set(f.sabView.subarray(0, n), pDest); + } + } catch (e) { + error('xRead(', arguments, ') failed:', e, f); + rc = capi.SQLITE_IOERR_READ; + } + mTimeEnd(); + return rc; + }, + xSync: function (pFile, flags) { + mTimeStart('xSync'); + ++metrics.xSync.count; + const rc = opRun('xSync', pFile, flags); + mTimeEnd(); + return rc; + }, + xTruncate: function (pFile, sz64) { + mTimeStart('xTruncate'); + const rc = opRun('xTruncate', pFile, Number(sz64)); + mTimeEnd(); + return rc; + }, + xUnlock: function (pFile, lockType) { + mTimeStart('xUnlock'); + const f = __openFiles[pFile]; + let rc = 0; + if (capi.SQLITE_LOCK_NONE === lockType && f.lockType) { + rc = opRun('xUnlock', pFile, lockType); + } + if (0 === rc) f.lockType = lockType; + mTimeEnd(); + return rc; + }, + xWrite: function (pFile, pSrc, n, offset64) { + mTimeStart('xWrite'); + const f = __openFiles[pFile]; + let rc; + try { + f.sabView.set(wasm.heap8u().subarray(pSrc, pSrc + n)); + rc = opRun('xWrite', pFile, n, Number(offset64)); + } catch (e) { + error('xWrite(', arguments, ') failed:', e, f); + rc = capi.SQLITE_IOERR_WRITE; + } + mTimeEnd(); + return rc; + }, + }; + + const vfsSyncWrappers = { + xAccess: function (pVfs, zName, flags, pOut) { + mTimeStart('xAccess'); + const rc = opRun('xAccess', wasm.cstrToJs(zName)); + wasm.poke(pOut, rc ? 0 : 1, 'i32'); + mTimeEnd(); + return 0; + }, + xCurrentTime: function (pVfs, pOut) { + wasm.poke( + pOut, + 2440587.5 + new Date().getTime() / 86400000, + 'double', + ); + return 0; + }, + xCurrentTimeInt64: function (pVfs, pOut) { + wasm.poke( + pOut, + 2440587.5 * 86400000 + new Date().getTime(), + 'i64', + ); + return 0; + }, + xDelete: function (pVfs, zName, doSyncDir) { + mTimeStart('xDelete'); + const rc = opRun( + 'xDelete', + wasm.cstrToJs(zName), + doSyncDir, + false, + ); + mTimeEnd(); + return rc; + }, + xFullPathname: function (pVfs, zName, nOut, pOut) { + const i = wasm.cstrncpy(pOut, zName, nOut); + return i < nOut ? 0 : capi.SQLITE_CANTOPEN; + }, + xGetLastError: function (pVfs, nOut, pOut) { + warn('OPFS xGetLastError() has nothing sensible to return.'); + return 0; + }, + + xOpen: function f(pVfs, zName, pFile, flags, pOutFlags) { + mTimeStart('xOpen'); + let opfsFlags = 0; + if (0 === zName) { + zName = randomFilename(); + } else if (wasm.isPtr(zName)) { + if (capi.sqlite3_uri_boolean(zName, 'opfs-unlock-asap', 0)) { + opfsFlags |= state.opfsFlags.OPFS_UNLOCK_ASAP; + } + if ( + capi.sqlite3_uri_boolean(zName, 'delete-before-open', 0) + ) { + opfsFlags |= state.opfsFlags.OPFS_UNLINK_BEFORE_OPEN; + } + zName = wasm.cstrToJs(zName); + } + const fh = Object.create(null); + fh.fid = pFile; + fh.filename = zName; + fh.sab = new SharedArrayBuffer(state.fileBufferSize); + fh.flags = flags; + fh.readOnly = + !(sqlite3.SQLITE_OPEN_CREATE & flags) && + !!(flags & capi.SQLITE_OPEN_READONLY); + const rc = opRun('xOpen', pFile, zName, flags, opfsFlags); + if (!rc) { + if (fh.readOnly) { + wasm.poke(pOutFlags, capi.SQLITE_OPEN_READONLY, 'i32'); + } + __openFiles[pFile] = fh; + fh.sabView = state.sabFileBufView; + fh.sq3File = new sqlite3_file(pFile); + fh.sq3File.$pMethods = opfsIoMethods.pointer; + fh.lockType = capi.SQLITE_LOCK_NONE; + } + mTimeEnd(); + return rc; + }, + }; + + if (dVfs) { + opfsVfs.$xRandomness = dVfs.$xRandomness; + opfsVfs.$xSleep = dVfs.$xSleep; + } + if (!opfsVfs.$xRandomness) { + vfsSyncWrappers.xRandomness = function (pVfs, nOut, pOut) { + const heap = wasm.heap8u(); + let i = 0; + for (; i < nOut; ++i) + heap[pOut + i] = (Math.random() * 255000) & 0xff; + return i; + }; + } + if (!opfsVfs.$xSleep) { + vfsSyncWrappers.xSleep = function (pVfs, ms) { + Atomics.wait(state.sabOPView, state.opIds.xSleep, 0, ms); + return 0; + }; + } + + opfsUtil.getResolvedPath = function (filename, splitIt) { + const p = new URL(filename, 'file://irrelevant').pathname; + return splitIt ? p.split('/').filter((v) => !!v) : p; + }; + + opfsUtil.getDirForFilename = async function f( + absFilename, + createDirs = false, + ) { + const path = opfsUtil.getResolvedPath(absFilename, true); + const filename = path.pop(); + let dh = opfsUtil.rootDirectory; + for (const dirName of path) { + if (dirName) { + dh = await dh.getDirectoryHandle(dirName, { + create: !!createDirs, + }); + } + } + return [dh, filename]; + }; + + opfsUtil.mkdir = async function (absDirName) { + try { + await opfsUtil.getDirForFilename( + absDirName + '/filepart', + true, + ); + return true; + } catch (e) { + return false; + } + }; + + opfsUtil.entryExists = async function (fsEntryName) { + try { + const [dh, fn] = await opfsUtil.getDirForFilename(fsEntryName); + await dh.getFileHandle(fn); + return true; + } catch (e) { + return false; + } + }; + + opfsUtil.randomFilename = randomFilename; + + opfsUtil.treeList = async function () { + const doDir = async function callee(dirHandle, tgt) { + tgt.name = dirHandle.name; + tgt.dirs = []; + tgt.files = []; + for await (const handle of dirHandle.values()) { + if ('directory' === handle.kind) { + const subDir = Object.create(null); + tgt.dirs.push(subDir); + await callee(handle, subDir); + } else { + tgt.files.push(handle.name); + } + } + }; + const root = Object.create(null); + await doDir(opfsUtil.rootDirectory, root); + return root; + }; + + opfsUtil.rmfr = async function () { + const dir = opfsUtil.rootDirectory, + opt = { recurse: true }; + for await (const handle of dir.values()) { + dir.removeEntry(handle.name, opt); + } + }; + + opfsUtil.unlink = async function ( + fsEntryName, + recursive = false, + throwOnError = false, + ) { + try { + const [hDir, filenamePart] = await opfsUtil.getDirForFilename( + fsEntryName, + false, + ); + await hDir.removeEntry(filenamePart, { recursive }); + return true; + } catch (e) { + if (throwOnError) { + throw new Error( + 'unlink(', + arguments[0], + ') failed: ' + e.message, + { + cause: e, + }, + ); + } + return false; + } + }; + + opfsUtil.traverse = async function (opt) { + const defaultOpt = { + recursive: true, + directory: opfsUtil.rootDirectory, + }; + if ('function' === typeof opt) { + opt = { callback: opt }; + } + opt = Object.assign(defaultOpt, opt || {}); + const doDir = async function callee(dirHandle, depth) { + for await (const handle of dirHandle.values()) { + if (false === opt.callback(handle, dirHandle, depth)) + return false; + else if (opt.recursive && 'directory' === handle.kind) { + if (false === (await callee(handle, depth + 1))) break; + } + } + }; + doDir(opt.directory, 0); + }; + + const importDbChunked = async function (filename, callback) { + const [hDir, fnamePart] = await opfsUtil.getDirForFilename( + filename, + true, + ); + const hFile = await hDir.getFileHandle(fnamePart, { + create: true, + }); + let sah = await hFile.createSyncAccessHandle(); + let nWrote = 0, + chunk, + checkedHeader = false, + err = false; + try { + sah.truncate(0); + while (undefined !== (chunk = await callback())) { + if (chunk instanceof ArrayBuffer) + chunk = new Uint8Array(chunk); + if (0 === nWrote && chunk.byteLength >= 15) { + util.affirmDbHeader(chunk); + checkedHeader = true; + } + sah.write(chunk, { at: nWrote }); + nWrote += chunk.byteLength; + } + if (nWrote < 512 || 0 !== nWrote % 512) { + toss( + 'Input size', + nWrote, + 'is not correct for an SQLite database.', + ); + } + if (!checkedHeader) { + const header = new Uint8Array(20); + sah.read(header, { at: 0 }); + util.affirmDbHeader(header); + } + sah.write(new Uint8Array([1, 1]), { at: 18 }); + return nWrote; + } catch (e) { + await sah.close(); + sah = undefined; + await hDir.removeEntry(fnamePart).catch(() => {}); + throw e; + } finally { + if (sah) await sah.close(); + } + }; + + opfsUtil.importDb = async function (filename, bytes) { + if (bytes instanceof Function) { + return importDbChunked(filename, bytes); + } + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + util.affirmIsDb(bytes); + const n = bytes.byteLength; + const [hDir, fnamePart] = await opfsUtil.getDirForFilename( + filename, + true, + ); + let sah, + err, + nWrote = 0; + try { + const hFile = await hDir.getFileHandle(fnamePart, { + create: true, + }); + sah = await hFile.createSyncAccessHandle(); + sah.truncate(0); + nWrote = sah.write(bytes, { at: 0 }); + if (nWrote != n) { + toss( + 'Expected to write ' + + n + + ' bytes but wrote ' + + nWrote + + '.', + ); + } + sah.write(new Uint8Array([1, 1]), { at: 18 }); + return nWrote; + } catch (e) { + if (sah) { + await sah.close(); + sah = undefined; + } + await hDir.removeEntry(fnamePart).catch(() => {}); + throw e; + } finally { + if (sah) await sah.close(); + } + }; + + if (sqlite3.oo1) { + const OpfsDb = function (...args) { + const opt = sqlite3.oo1.DB.dbCtorHelper.normalizeArgs(...args); + opt.vfs = opfsVfs.$zName; + sqlite3.oo1.DB.dbCtorHelper.call(this, opt); + }; + OpfsDb.prototype = Object.create(sqlite3.oo1.DB.prototype); + sqlite3.oo1.OpfsDb = OpfsDb; + OpfsDb.importDb = opfsUtil.importDb; + sqlite3.oo1.DB.dbCtorHelper.setVfsPostOpenCallback( + opfsVfs.pointer, + function (oo1Db, sqlite3) { + sqlite3.capi.sqlite3_busy_timeout(oo1Db, 10000); + }, + ); + } + + const sanityCheck = function () { + const scope = wasm.scopedAllocPush(); + const sq3File = new sqlite3_file(); + try { + const fid = sq3File.pointer; + const openFlags = + capi.SQLITE_OPEN_CREATE | + capi.SQLITE_OPEN_READWRITE | + capi.SQLITE_OPEN_MAIN_DB; + const pOut = wasm.scopedAlloc(8); + const dbFile = '/sanity/check/file' + randomFilename(8); + const zDbFile = wasm.scopedAllocCString(dbFile); + let rc; + state.s11n.serialize('This is ä string.'); + rc = state.s11n.deserialize(); + log('deserialize() says:', rc); + if ('This is ä string.' !== rc[0]) toss('String d13n error.'); + vfsSyncWrappers.xAccess(opfsVfs.pointer, zDbFile, 0, pOut); + rc = wasm.peek(pOut, 'i32'); + log('xAccess(', dbFile, ') exists ?=', rc); + rc = vfsSyncWrappers.xOpen( + opfsVfs.pointer, + zDbFile, + fid, + openFlags, + pOut, + ); + log( + 'open rc =', + rc, + 'state.sabOPView[xOpen] =', + state.sabOPView[state.opIds.xOpen], + ); + if (0 !== rc) { + error('open failed with code', rc); + return; + } + vfsSyncWrappers.xAccess(opfsVfs.pointer, zDbFile, 0, pOut); + rc = wasm.peek(pOut, 'i32'); + if (!rc) toss('xAccess() failed to detect file.'); + rc = ioSyncWrappers.xSync(sq3File.pointer, 0); + if (rc) toss('sync failed w/ rc', rc); + rc = ioSyncWrappers.xTruncate(sq3File.pointer, 1024); + if (rc) toss('truncate failed w/ rc', rc); + wasm.poke(pOut, 0, 'i64'); + rc = ioSyncWrappers.xFileSize(sq3File.pointer, pOut); + if (rc) toss('xFileSize failed w/ rc', rc); + log('xFileSize says:', wasm.peek(pOut, 'i64')); + rc = ioSyncWrappers.xWrite(sq3File.pointer, zDbFile, 10, 1); + if (rc) toss('xWrite() failed!'); + const readBuf = wasm.scopedAlloc(16); + rc = ioSyncWrappers.xRead(sq3File.pointer, readBuf, 6, 2); + wasm.poke(readBuf + 6, 0); + let jRead = wasm.cstrToJs(readBuf); + log('xRead() got:', jRead); + if ('sanity' !== jRead) toss('Unexpected xRead() value.'); + if (vfsSyncWrappers.xSleep) { + log('xSleep()ing before close()ing...'); + vfsSyncWrappers.xSleep(opfsVfs.pointer, 2000); + log('waking up from xSleep()'); + } + rc = ioSyncWrappers.xClose(fid); + log('xClose rc =', rc, 'sabOPView =', state.sabOPView); + log('Deleting file:', dbFile); + vfsSyncWrappers.xDelete(opfsVfs.pointer, zDbFile, 0x1234); + vfsSyncWrappers.xAccess(opfsVfs.pointer, zDbFile, 0, pOut); + rc = wasm.peek(pOut, 'i32'); + if (rc) + toss( + 'Expecting 0 from xAccess(', + dbFile, + ') after xDelete().', + ); + warn('End of OPFS sanity checks.'); + } finally { + sq3File.dispose(); + wasm.scopedAllocPop(scope); + } + }; + + W.onmessage = function ({ data }) { + switch (data.type) { + case 'opfs-unavailable': + promiseReject(new Error(data.payload.join(' '))); + break; + case 'opfs-async-loaded': + W.postMessage({ type: 'opfs-async-init', args: state }); + break; + case 'opfs-async-inited': { + if (true === promiseWasRejected) { + break; + } + try { + sqlite3.vfs.installVfs({ + io: { struct: opfsIoMethods, methods: ioSyncWrappers }, + vfs: { struct: opfsVfs, methods: vfsSyncWrappers }, + }); + state.sabOPView = new Int32Array(state.sabOP); + state.sabFileBufView = new Uint8Array( + state.sabIO, + 0, + state.fileBufferSize, + ); + state.sabS11nView = new Uint8Array( + state.sabIO, + state.sabS11nOffset, + state.sabS11nSize, + ); + initS11n(); + if (options.sanityChecks) { + warn( + 'Running sanity checks because of opfs-sanity-check URL arg...', + ); + sanityCheck(); + } + if (thisThreadHasOPFS()) { + navigator.storage + .getDirectory() + .then((d) => { + W.onerror = W._originalOnError; + delete W._originalOnError; + sqlite3.opfs = opfsUtil; + opfsUtil.rootDirectory = d; + log('End of OPFS sqlite3_vfs setup.', opfsVfs); + promiseResolve(); + }) + .catch(promiseReject); + } else { + promiseResolve(); + } + } catch (e) { + error(e); + promiseReject(e); + } + break; + } + default: { + const errMsg = + 'Unexpected message from the OPFS async worker: ' + + JSON.stringify(data); + error(errMsg); + promiseReject(new Error(errMsg)); + break; + } + } + }; + }); + return thePromise; + }; + installOpfsVfs.defaultProxyUri = 'sqlite3-opfs-async-proxy.js'; + globalThis.sqlite3ApiBootstrap.initializersAsync.push( + async (sqlite3) => { + try { + let proxyJs = installOpfsVfs.defaultProxyUri; + if (sqlite3.scriptInfo.sqlite3Dir) { + installOpfsVfs.defaultProxyUri = + sqlite3.scriptInfo.sqlite3Dir + proxyJs; + } + return installOpfsVfs().catch((e) => { + sqlite3.config.warn( + 'Ignoring inability to install OPFS sqlite3_vfs:', + e.message, + ); + }); + } catch (e) { + sqlite3.config.error('installOpfsVfs() exception:', e); + return Promise.reject(e); + } + }, + ); + }); + + globalThis.sqlite3ApiBootstrap.initializers.push(function (sqlite3) { + 'use strict'; + const toss = sqlite3.util.toss; + const toss3 = sqlite3.util.toss3; + const initPromises = Object.create(null); + const capi = sqlite3.capi; + const util = sqlite3.util; + const wasm = sqlite3.wasm; + + const SECTOR_SIZE = 4096; + const HEADER_MAX_PATH_SIZE = 512; + const HEADER_FLAGS_SIZE = 4; + const HEADER_DIGEST_SIZE = 8; + const HEADER_CORPUS_SIZE = HEADER_MAX_PATH_SIZE + HEADER_FLAGS_SIZE; + const HEADER_OFFSET_FLAGS = HEADER_MAX_PATH_SIZE; + const HEADER_OFFSET_DIGEST = HEADER_CORPUS_SIZE; + const HEADER_OFFSET_DATA = SECTOR_SIZE; + + const PERSISTENT_FILE_TYPES = + capi.SQLITE_OPEN_MAIN_DB | + capi.SQLITE_OPEN_MAIN_JOURNAL | + capi.SQLITE_OPEN_SUPER_JOURNAL | + capi.SQLITE_OPEN_WAL; + const FLAG_COMPUTE_DIGEST_V2 = capi.SQLITE_OPEN_MEMORY; + const OPAQUE_DIR_NAME = '.opaque'; + + const getRandomName = () => Math.random().toString(36).slice(2); + + const textDecoder = new TextDecoder(); + const textEncoder = new TextEncoder(); + + const optionDefaults = Object.assign(Object.create(null), { + name: 'opfs-sahpool', + directory: undefined, + initialCapacity: 6, + clearOnInit: false, + + verbosity: 2, + forceReinitIfPreviouslyFailed: false, + }); + + const loggers = [ + sqlite3.config.error, + sqlite3.config.warn, + sqlite3.config.log, + ]; + const log = sqlite3.config.log; + const warn = sqlite3.config.warn; + const error = sqlite3.config.error; + + const __mapVfsToPool = new Map(); + const getPoolForVfs = (pVfs) => __mapVfsToPool.get(pVfs); + const setPoolForVfs = (pVfs, pool) => { + if (pool) __mapVfsToPool.set(pVfs, pool); + else __mapVfsToPool.delete(pVfs); + }; + + const __mapSqlite3File = new Map(); + const getPoolForPFile = (pFile) => __mapSqlite3File.get(pFile); + const setPoolForPFile = (pFile, pool) => { + if (pool) __mapSqlite3File.set(pFile, pool); + else __mapSqlite3File.delete(pFile); + }; + + const ioMethods = { + xCheckReservedLock: function (pFile, pOut) { + const pool = getPoolForPFile(pFile); + pool.log('xCheckReservedLock'); + pool.storeErr(); + wasm.poke32(pOut, 1); + return 0; + }, + xClose: function (pFile) { + const pool = getPoolForPFile(pFile); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + if (file) { + try { + pool.log(`xClose ${file.path}`); + pool.mapS3FileToOFile(pFile, false); + file.sah.flush(); + if (file.flags & capi.SQLITE_OPEN_DELETEONCLOSE) { + pool.deletePath(file.path); + } + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + } + return 0; + }, + xDeviceCharacteristics: function (pFile) { + return capi.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN; + }, + xFileControl: function (pFile, opId, pArg) { + return capi.SQLITE_NOTFOUND; + }, + xFileSize: function (pFile, pSz64) { + const pool = getPoolForPFile(pFile); + pool.log(`xFileSize`); + const file = pool.getOFileForS3File(pFile); + const size = file.sah.getSize() - HEADER_OFFSET_DATA; + + wasm.poke64(pSz64, BigInt(size)); + return 0; + }, + xLock: function (pFile, lockType) { + const pool = getPoolForPFile(pFile); + pool.log(`xLock ${lockType}`); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + file.lockType = lockType; + return 0; + }, + xRead: function (pFile, pDest, n, offset64) { + const pool = getPoolForPFile(pFile); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + pool.log(`xRead ${file.path} ${n} @ ${offset64}`); + try { + const nRead = file.sah.read( + wasm.heap8u().subarray(pDest, pDest + n), + { at: HEADER_OFFSET_DATA + Number(offset64) }, + ); + if (nRead < n) { + wasm.heap8u().fill(0, pDest + nRead, pDest + n); + return capi.SQLITE_IOERR_SHORT_READ; + } + return 0; + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + }, + xSectorSize: function (pFile) { + return SECTOR_SIZE; + }, + xSync: function (pFile, flags) { + const pool = getPoolForPFile(pFile); + pool.log(`xSync ${flags}`); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + + try { + file.sah.flush(); + return 0; + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + }, + xTruncate: function (pFile, sz64) { + const pool = getPoolForPFile(pFile); + pool.log(`xTruncate ${sz64}`); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + + try { + file.sah.truncate(HEADER_OFFSET_DATA + Number(sz64)); + return 0; + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + }, + xUnlock: function (pFile, lockType) { + const pool = getPoolForPFile(pFile); + pool.log('xUnlock'); + const file = pool.getOFileForS3File(pFile); + file.lockType = lockType; + return 0; + }, + xWrite: function (pFile, pSrc, n, offset64) { + const pool = getPoolForPFile(pFile); + pool.storeErr(); + const file = pool.getOFileForS3File(pFile); + pool.log(`xWrite ${file.path} ${n} ${offset64}`); + try { + const nBytes = file.sah.write( + wasm.heap8u().subarray(pSrc, pSrc + n), + { at: HEADER_OFFSET_DATA + Number(offset64) }, + ); + return n === nBytes ? 0 : toss('Unknown write() failure.'); + } catch (e) { + return pool.storeErr(e, capi.SQLITE_IOERR); + } + }, + }; + + const opfsIoMethods = new capi.sqlite3_io_methods(); + opfsIoMethods.$iVersion = 1; + sqlite3.vfs.installVfs({ + io: { struct: opfsIoMethods, methods: ioMethods }, + }); + + const vfsMethods = { + xAccess: function (pVfs, zName, flags, pOut) { + const pool = getPoolForVfs(pVfs); + pool.storeErr(); + try { + const name = pool.getPath(zName); + wasm.poke32(pOut, pool.hasFilename(name) ? 1 : 0); + } catch (e) { + wasm.poke32(pOut, 0); + } + return 0; + }, + xCurrentTime: function (pVfs, pOut) { + wasm.poke( + pOut, + 2440587.5 + new Date().getTime() / 86400000, + 'double', + ); + return 0; + }, + xCurrentTimeInt64: function (pVfs, pOut) { + wasm.poke(pOut, 2440587.5 * 86400000 + new Date().getTime(), 'i64'); + return 0; + }, + xDelete: function (pVfs, zName, doSyncDir) { + const pool = getPoolForVfs(pVfs); + pool.log(`xDelete ${wasm.cstrToJs(zName)}`); + pool.storeErr(); + try { + pool.deletePath(pool.getPath(zName)); + return 0; + } catch (e) { + pool.storeErr(e); + return capi.SQLITE_IOERR_DELETE; + } + }, + xFullPathname: function (pVfs, zName, nOut, pOut) { + const i = wasm.cstrncpy(pOut, zName, nOut); + return i < nOut ? 0 : capi.SQLITE_CANTOPEN; + }, + xGetLastError: function (pVfs, nOut, pOut) { + const pool = getPoolForVfs(pVfs); + const e = pool.popErr(); + pool.log(`xGetLastError ${nOut} e =`, e); + if (e) { + const scope = wasm.scopedAllocPush(); + try { + const [cMsg, n] = wasm.scopedAllocCString(e.message, true); + wasm.cstrncpy(pOut, cMsg, nOut); + if (n > nOut) wasm.poke8(pOut + nOut - 1, 0); + } catch (e) { + return capi.SQLITE_NOMEM; + } finally { + wasm.scopedAllocPop(scope); + } + } + return e ? e.sqlite3Rc || capi.SQLITE_IOERR : 0; + }, + + xOpen: function f(pVfs, zName, pFile, flags, pOutFlags) { + const pool = getPoolForVfs(pVfs); + try { + flags &= ~FLAG_COMPUTE_DIGEST_V2; + pool.log(`xOpen ${wasm.cstrToJs(zName)} ${flags}`); + + const path = + zName && wasm.peek8(zName) + ? pool.getPath(zName) + : getRandomName(); + let sah = pool.getSAHForPath(path); + if (!sah && flags & capi.SQLITE_OPEN_CREATE) { + if (pool.getFileCount() < pool.getCapacity()) { + sah = pool.nextAvailableSAH(); + pool.setAssociatedPath(sah, path, flags); + } else { + toss('SAH pool is full. Cannot create file', path); + } + } + if (!sah) { + toss('file not found:', path); + } + + const file = { path, flags, sah }; + pool.mapS3FileToOFile(pFile, file); + file.lockType = capi.SQLITE_LOCK_NONE; + const sq3File = new capi.sqlite3_file(pFile); + sq3File.$pMethods = opfsIoMethods.pointer; + sq3File.dispose(); + wasm.poke32(pOutFlags, flags); + return 0; + } catch (e) { + pool.storeErr(e); + return capi.SQLITE_CANTOPEN; + } + }, + }; + + const createOpfsVfs = function (vfsName) { + if (sqlite3.capi.sqlite3_vfs_find(vfsName)) { + toss3('VFS name is already registered:', vfsName); + } + const opfsVfs = new capi.sqlite3_vfs(); + + const pDVfs = capi.sqlite3_vfs_find(null); + const dVfs = pDVfs ? new capi.sqlite3_vfs(pDVfs) : null; + opfsVfs.$iVersion = 2; + opfsVfs.$szOsFile = capi.sqlite3_file.structInfo.sizeof; + opfsVfs.$mxPathname = HEADER_MAX_PATH_SIZE; + opfsVfs.addOnDispose( + (opfsVfs.$zName = wasm.allocCString(vfsName)), + () => setPoolForVfs(opfsVfs.pointer, 0), + ); + + if (dVfs) { + opfsVfs.$xRandomness = dVfs.$xRandomness; + opfsVfs.$xSleep = dVfs.$xSleep; + dVfs.dispose(); + } + if (!opfsVfs.$xRandomness && !vfsMethods.xRandomness) { + vfsMethods.xRandomness = function (pVfs, nOut, pOut) { + const heap = wasm.heap8u(); + let i = 0; + for (; i < nOut; ++i) + heap[pOut + i] = (Math.random() * 255000) & 0xff; + return i; + }; + } + if (!opfsVfs.$xSleep && !vfsMethods.xSleep) { + vfsMethods.xSleep = (pVfs, ms) => 0; + } + sqlite3.vfs.installVfs({ + vfs: { struct: opfsVfs, methods: vfsMethods }, + }); + return opfsVfs; + }; + + class OpfsSAHPool { + vfsDir; + + #dhVfsRoot; + + #dhOpaque; + + #dhVfsParent; + + #mapSAHToName = new Map(); + + #mapFilenameToSAH = new Map(); + + #availableSAH = new Set(); + + #mapS3FileToOFile_ = new Map(); + + #apBody = new Uint8Array(HEADER_CORPUS_SIZE); + + #dvBody; + + #cVfs; + + #verbosity; + + constructor(options = Object.create(null)) { + this.#verbosity = options.verbosity ?? optionDefaults.verbosity; + this.vfsName = options.name || optionDefaults.name; + this.#cVfs = createOpfsVfs(this.vfsName); + setPoolForVfs(this.#cVfs.pointer, this); + this.vfsDir = options.directory || '.' + this.vfsName; + this.#dvBody = new DataView( + this.#apBody.buffer, + this.#apBody.byteOffset, + ); + this.isReady = this.reset( + !!(options.clearOnInit ?? optionDefaults.clearOnInit), + ).then(() => { + if (this.$error) throw this.$error; + return this.getCapacity() + ? Promise.resolve(undefined) + : this.addCapacity( + options.initialCapacity || optionDefaults.initialCapacity, + ); + }); + } + + #logImpl(level, ...args) { + if (this.#verbosity > level) + loggers[level](this.vfsName + ':', ...args); + } + log(...args) { + this.#logImpl(2, ...args); + } + warn(...args) { + this.#logImpl(1, ...args); + } + error(...args) { + this.#logImpl(0, ...args); + } + + getVfs() { + return this.#cVfs; + } + + getCapacity() { + return this.#mapSAHToName.size; + } + + getFileCount() { + return this.#mapFilenameToSAH.size; + } + + getFileNames() { + const rc = []; + for (const n of this.#mapFilenameToSAH.keys()) rc.push(n); + return rc; + } + + async addCapacity(n) { + for (let i = 0; i < n; ++i) { + const name = getRandomName(); + const h = await this.#dhOpaque.getFileHandle(name, { + create: true, + }); + const ah = await h.createSyncAccessHandle(); + this.#mapSAHToName.set(ah, name); + this.setAssociatedPath(ah, '', 0); + } + return this.getCapacity(); + } + + async reduceCapacity(n) { + let nRm = 0; + for (const ah of Array.from(this.#availableSAH)) { + if (nRm === n || this.getFileCount() === this.getCapacity()) { + break; + } + const name = this.#mapSAHToName.get(ah); + + ah.close(); + await this.#dhOpaque.removeEntry(name); + this.#mapSAHToName.delete(ah); + this.#availableSAH.delete(ah); + ++nRm; + } + return nRm; + } + + releaseAccessHandles() { + for (const ah of this.#mapSAHToName.keys()) ah.close(); + this.#mapSAHToName.clear(); + this.#mapFilenameToSAH.clear(); + this.#availableSAH.clear(); + } + + async acquireAccessHandles(clearFiles = false) { + const files = []; + for await (const [name, h] of this.#dhOpaque) { + if ('file' === h.kind) { + files.push([name, h]); + } + } + return Promise.all( + files.map(async ([name, h]) => { + try { + const ah = await h.createSyncAccessHandle(); + this.#mapSAHToName.set(ah, name); + if (clearFiles) { + ah.truncate(HEADER_OFFSET_DATA); + this.setAssociatedPath(ah, '', 0); + } else { + const path = this.getAssociatedPath(ah); + if (path) { + this.#mapFilenameToSAH.set(path, ah); + } else { + this.#availableSAH.add(ah); + } + } + } catch (e) { + this.storeErr(e); + this.releaseAccessHandles(); + throw e; + } + }), + ); + } + + getAssociatedPath(sah) { + sah.read(this.#apBody, { at: 0 }); + + const flags = this.#dvBody.getUint32(HEADER_OFFSET_FLAGS); + if ( + this.#apBody[0] && + (flags & capi.SQLITE_OPEN_DELETEONCLOSE || + (flags & PERSISTENT_FILE_TYPES) === 0) + ) { + warn( + `Removing file with unexpected flags ${flags.toString(16)}`, + this.#apBody, + ); + this.setAssociatedPath(sah, '', 0); + return ''; + } + + const fileDigest = new Uint32Array(HEADER_DIGEST_SIZE / 4); + sah.read(fileDigest, { at: HEADER_OFFSET_DIGEST }); + const compDigest = this.computeDigest(this.#apBody, flags); + + if (fileDigest.every((v, i) => v === compDigest[i])) { + const pathBytes = this.#apBody.findIndex((v) => 0 === v); + if (0 === pathBytes) { + sah.truncate(HEADER_OFFSET_DATA); + } + + return pathBytes + ? textDecoder.decode(this.#apBody.subarray(0, pathBytes)) + : ''; + } else { + warn('Disassociating file with bad digest.'); + this.setAssociatedPath(sah, '', 0); + return ''; + } + } + + setAssociatedPath(sah, path, flags) { + const enc = textEncoder.encodeInto(path, this.#apBody); + if (HEADER_MAX_PATH_SIZE <= enc.written + 1) { + toss('Path too long:', path); + } + if (path && flags) { + flags |= FLAG_COMPUTE_DIGEST_V2; + } + this.#apBody.fill(0, enc.written, HEADER_MAX_PATH_SIZE); + this.#dvBody.setUint32(HEADER_OFFSET_FLAGS, flags); + const digest = this.computeDigest(this.#apBody, flags); + + sah.write(this.#apBody, { at: 0 }); + sah.write(digest, { at: HEADER_OFFSET_DIGEST }); + sah.flush(); + + if (path) { + this.#mapFilenameToSAH.set(path, sah); + this.#availableSAH.delete(sah); + } else { + sah.truncate(HEADER_OFFSET_DATA); + this.#availableSAH.add(sah); + } + } + + computeDigest(byteArray, fileFlags) { + if (fileFlags & FLAG_COMPUTE_DIGEST_V2) { + let h1 = 0xdeadbeef; + let h2 = 0x41c6ce57; + for (const v of byteArray) { + h1 = Math.imul(h1 ^ v, 2654435761); + h2 = Math.imul(h2 ^ v, 104729); + } + return new Uint32Array([h1 >>> 0, h2 >>> 0]); + } else { + return new Uint32Array([0, 0]); + } + } + + async reset(clearFiles) { + await this.isReady; + let h = await navigator.storage.getDirectory(); + let prev, prevName; + for (const d of this.vfsDir.split('/')) { + if (d) { + prev = h; + h = await h.getDirectoryHandle(d, { create: true }); + } + } + this.#dhVfsRoot = h; + this.#dhVfsParent = prev; + this.#dhOpaque = await this.#dhVfsRoot.getDirectoryHandle( + OPAQUE_DIR_NAME, + { create: true }, + ); + this.releaseAccessHandles(); + return this.acquireAccessHandles(clearFiles); + } + + getPath(arg) { + if (wasm.isPtr(arg)) arg = wasm.cstrToJs(arg); + return ( + arg instanceof URL ? arg : new URL(arg, 'file://localhost/') + ).pathname; + } + + deletePath(path) { + const sah = this.#mapFilenameToSAH.get(path); + if (sah) { + this.#mapFilenameToSAH.delete(path); + this.setAssociatedPath(sah, '', 0); + } + return !!sah; + } + + storeErr(e, code) { + if (e) { + e.sqlite3Rc = code || capi.SQLITE_IOERR; + this.error(e); + } + this.$error = e; + return code; + } + + popErr() { + const rc = this.$error; + this.$error = undefined; + return rc; + } + + nextAvailableSAH() { + const [rc] = this.#availableSAH.keys(); + return rc; + } + + getOFileForS3File(pFile) { + return this.#mapS3FileToOFile_.get(pFile); + } + + mapS3FileToOFile(pFile, file) { + if (file) { + this.#mapS3FileToOFile_.set(pFile, file); + setPoolForPFile(pFile, this); + } else { + this.#mapS3FileToOFile_.delete(pFile); + setPoolForPFile(pFile, false); + } + } + + hasFilename(name) { + return this.#mapFilenameToSAH.has(name); + } + + getSAHForPath(path) { + return this.#mapFilenameToSAH.get(path); + } + + async removeVfs() { + if (!this.#cVfs.pointer || !this.#dhOpaque) return false; + capi.sqlite3_vfs_unregister(this.#cVfs.pointer); + this.#cVfs.dispose(); + delete initPromises[this.vfsName]; + try { + this.releaseAccessHandles(); + await this.#dhVfsRoot.removeEntry(OPAQUE_DIR_NAME, { + recursive: true, + }); + this.#dhOpaque = undefined; + await this.#dhVfsParent.removeEntry(this.#dhVfsRoot.name, { + recursive: true, + }); + this.#dhVfsRoot = this.#dhVfsParent = undefined; + } catch (e) { + sqlite3.config.error( + this.vfsName, + 'removeVfs() failed with no recovery strategy:', + e, + ); + } + return true; + } + + pauseVfs() { + if (this.#mapS3FileToOFile_.size > 0) { + sqlite3.SQLite3Error.toss( + capi.SQLITE_MISUSE, + 'Cannot pause VFS', + this.vfsName, + 'because it has opened files.', + ); + } + if (this.#mapSAHToName.size > 0) { + capi.sqlite3_vfs_unregister(this.vfsName); + this.releaseAccessHandles(); + } + return this; + } + + isPaused() { + return 0 === this.#mapSAHToName.size; + } + + async unpauseVfs() { + if (0 === this.#mapSAHToName.size) { + return this.acquireAccessHandles(false).then( + () => capi.sqlite3_vfs_register(this.#cVfs, 0), + this, + ); + } + return this; + } + + exportFile(name) { + const sah = + this.#mapFilenameToSAH.get(name) || toss('File not found:', name); + const n = sah.getSize() - HEADER_OFFSET_DATA; + const b = new Uint8Array(n > 0 ? n : 0); + if (n > 0) { + const nRead = sah.read(b, { at: HEADER_OFFSET_DATA }); + if (nRead != n) { + toss( + 'Expected to read ' + n + ' bytes but read ' + nRead + '.', + ); + } + } + return b; + } + + async importDbChunked(name, callback) { + const sah = + this.#mapFilenameToSAH.get(name) || + this.nextAvailableSAH() || + toss('No available handles to import to.'); + sah.truncate(0); + let nWrote = 0, + chunk, + checkedHeader = false, + err = false; + try { + while (undefined !== (chunk = await callback())) { + if (chunk instanceof ArrayBuffer) chunk = new Uint8Array(chunk); + if (0 === nWrote && chunk.byteLength >= 15) { + util.affirmDbHeader(chunk); + checkedHeader = true; + } + sah.write(chunk, { at: HEADER_OFFSET_DATA + nWrote }); + nWrote += chunk.byteLength; + } + if (nWrote < 512 || 0 !== nWrote % 512) { + toss( + 'Input size', + nWrote, + 'is not correct for an SQLite database.', + ); + } + if (!checkedHeader) { + const header = new Uint8Array(20); + sah.read(header, { at: 0 }); + util.affirmDbHeader(header); + } + sah.write(new Uint8Array([1, 1]), { + at: HEADER_OFFSET_DATA + 18, + }); + } catch (e) { + this.setAssociatedPath(sah, '', 0); + throw e; + } + this.setAssociatedPath(sah, name, capi.SQLITE_OPEN_MAIN_DB); + return nWrote; + } + + importDb(name, bytes) { + if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes); + else if (bytes instanceof Function) + return this.importDbChunked(name, bytes); + const sah = + this.#mapFilenameToSAH.get(name) || + this.nextAvailableSAH() || + toss('No available handles to import to.'); + const n = bytes.byteLength; + if (n < 512 || n % 512 != 0) { + toss('Byte array size is invalid for an SQLite db.'); + } + const header = 'SQLite format 3'; + for (let i = 0; i < header.length; ++i) { + if (header.charCodeAt(i) !== bytes[i]) { + toss('Input does not contain an SQLite database header.'); + } + } + const nWrote = sah.write(bytes, { at: HEADER_OFFSET_DATA }); + if (nWrote != n) { + this.setAssociatedPath(sah, '', 0); + toss( + 'Expected to write ' + n + ' bytes but wrote ' + nWrote + '.', + ); + } else { + sah.write(new Uint8Array([1, 1]), { + at: HEADER_OFFSET_DATA + 18, + }); + this.setAssociatedPath(sah, name, capi.SQLITE_OPEN_MAIN_DB); + } + return nWrote; + } + } + + class OpfsSAHPoolUtil { + #p; + + constructor(sahPool) { + this.#p = sahPool; + this.vfsName = sahPool.vfsName; + } + + async addCapacity(n) { + return this.#p.addCapacity(n); + } + + async reduceCapacity(n) { + return this.#p.reduceCapacity(n); + } + + getCapacity() { + return this.#p.getCapacity(this.#p); + } + + getFileCount() { + return this.#p.getFileCount(); + } + getFileNames() { + return this.#p.getFileNames(); + } + + async reserveMinimumCapacity(min) { + const c = this.#p.getCapacity(); + return c < min ? this.#p.addCapacity(min - c) : c; + } + + exportFile(name) { + return this.#p.exportFile(name); + } + + importDb(name, bytes) { + return this.#p.importDb(name, bytes); + } + + async wipeFiles() { + return this.#p.reset(true); + } + + unlink(filename) { + return this.#p.deletePath(filename); + } + + async removeVfs() { + return this.#p.removeVfs(); + } + + pauseVfs() { + this.#p.pauseVfs(); + return this; + } + async unpauseVfs() { + return this.#p.unpauseVfs().then(() => this); + } + isPaused() { + return this.#p.isPaused(); + } + } + + const apiVersionCheck = async () => { + const dh = await navigator.storage.getDirectory(); + const fn = '.opfs-sahpool-sync-check-' + getRandomName(); + const fh = await dh.getFileHandle(fn, { create: true }); + const ah = await fh.createSyncAccessHandle(); + const close = ah.close(); + await close; + await dh.removeEntry(fn); + if (close?.then) { + toss( + 'The local OPFS API is too old for opfs-sahpool:', + 'it has an async FileSystemSyncAccessHandle.close() method.', + ); + } + return true; + }; + + sqlite3.installOpfsSAHPoolVfs = async function ( + options = Object.create(null), + ) { + options = Object.assign( + Object.create(null), + optionDefaults, + options || {}, + ); + const vfsName = options.name; + if (options.$testThrowPhase1) { + throw options.$testThrowPhase1; + } + if (initPromises[vfsName]) { + try { + const p = await initPromises[vfsName]; + + return p; + } catch (e) { + if (options.forceReinitIfPreviouslyFailed) { + delete initPromises[vfsName]; + } else { + throw e; + } + } + } + if ( + !globalThis.FileSystemHandle || + !globalThis.FileSystemDirectoryHandle || + !globalThis.FileSystemFileHandle || + !globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle || + !navigator?.storage?.getDirectory + ) { + return (initPromises[vfsName] = Promise.reject( + new Error('Missing required OPFS APIs.'), + )); + } + + return (initPromises[vfsName] = apiVersionCheck() + .then(async function () { + if (options.$testThrowPhase2) { + throw options.$testThrowPhase2; + } + const thePool = new OpfsSAHPool(options); + return thePool.isReady + .then(async () => { + const poolUtil = new OpfsSAHPoolUtil(thePool); + if (sqlite3.oo1) { + const oo1 = sqlite3.oo1; + const theVfs = thePool.getVfs(); + const OpfsSAHPoolDb = function (...args) { + const opt = oo1.DB.dbCtorHelper.normalizeArgs(...args); + opt.vfs = theVfs.$zName; + oo1.DB.dbCtorHelper.call(this, opt); + }; + OpfsSAHPoolDb.prototype = Object.create(oo1.DB.prototype); + poolUtil.OpfsSAHPoolDb = OpfsSAHPoolDb; + } + thePool.log('VFS initialized.'); + return poolUtil; + }) + .catch(async (e) => { + await thePool.removeVfs().catch(() => {}); + throw e; + }); + }) + .catch((err) => { + return (initPromises[vfsName] = Promise.reject(err)); + })); + }; + }); + + ('use strict'); + if ('undefined' !== typeof Module) { + const SABC = Object.assign( + Object.create(null), + { + exports: + 'undefined' === typeof wasmExports ? Module['asm'] : wasmExports, + memory: Module.wasmMemory, + }, + globalThis.sqlite3ApiConfig || {}, + ); + + globalThis.sqlite3ApiConfig = SABC; + let sqlite3; + try { + sqlite3 = globalThis.sqlite3ApiBootstrap(); + } catch (e) { + console.error('sqlite3ApiBootstrap() error:', e); + throw e; + } finally { + delete globalThis.sqlite3ApiBootstrap; + delete globalThis.sqlite3ApiConfig; + } + + Module.sqlite3 = sqlite3; + } 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.', + ); + } + }; + + moduleRtn = readyPromise; + + return moduleRtn; + }; +})(); + +const toExportForESM = (function () { + const originalInit = sqlite3InitModule; + if (!originalInit) { + throw new Error( + 'Expecting globalThis.sqlite3InitModule to be defined by the Emscripten build.', + ); + } + + const initModuleState = (globalThis.sqlite3InitModuleState = Object.assign( + Object.create(null), + { + moduleScript: globalThis?.document?.currentScript, + isWorker: 'undefined' !== typeof WorkerGlobalScope, + location: globalThis.location, + urlParams: globalThis?.location?.href + ? new URL(globalThis.location.href).searchParams + : new URLSearchParams(), + }, + )); + initModuleState.debugModule = initModuleState.urlParams.has( + 'sqlite3.debugModule', + ) + ? (...args) => console.warn('sqlite3.debugModule:', ...args) + : () => {}; + + if (initModuleState.urlParams.has('sqlite3.dir')) { + initModuleState.sqlite3Dir = + initModuleState.urlParams.get('sqlite3.dir') + '/'; + } else if (initModuleState.moduleScript) { + const li = initModuleState.moduleScript.src.split('/'); + li.pop(); + initModuleState.sqlite3Dir = li.join('/') + '/'; + } + + globalThis.sqlite3InitModule = function ff(...args) { + return originalInit(...args) + .then((EmscriptenModule) => { + EmscriptenModule.runSQLite3PostLoadInit(EmscriptenModule); + const s = EmscriptenModule.sqlite3; + s.scriptInfo = initModuleState; + + if (ff.__isUnderTest) s.__isUnderTest = true; + const f = s.asyncPostInit; + delete s.asyncPostInit; + const rv = f(); + return rv; + }) + .catch((e) => { + console.error('Exception loading sqlite3 module:', e); + throw e; + }); + }; + globalThis.sqlite3InitModule.ready = originalInit.ready; + + if (globalThis.sqlite3InitModuleState.moduleScript) { + const sim = globalThis.sqlite3InitModuleState; + let src = sim.moduleScript.src.split('/'); + src.pop(); + sim.scriptDir = src.join('/') + '/'; + } + initModuleState.debugModule('sqlite3InitModuleState =', initModuleState); + if (0) { + console.warn('Replaced sqlite3InitModule()'); + console.warn('globalThis.location.href =', globalThis.location.href); + if ('undefined' !== typeof document) { + console.warn( + 'document.currentScript.src =', + document?.currentScript?.src, + ); + } + } + return globalThis.sqlite3InitModule; +})(); +sqlite3InitModule = toExportForESM; +export default sqlite3InitModule; diff --git a/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.wasm b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.wasm new file mode 100644 index 0000000..f001d7a Binary files /dev/null and b/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.wasm differ diff --git a/node_modules/@types/estree/LICENSE b/node_modules/@types/estree/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/node_modules/@types/estree/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/estree/README.md b/node_modules/@types/estree/README.md new file mode 100644 index 0000000..eda7980 --- /dev/null +++ b/node_modules/@types/estree/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/estree` + +# Summary +This package contains type definitions for estree (https://github.com/estree/estree). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree. + +### Additional Details + * Last updated: Wed, 06 May 2026 21:01:00 GMT + * Dependencies: none + +# Credits +These definitions were written by [RReverser](https://github.com/RReverser). diff --git a/node_modules/@types/estree/flow.d.ts b/node_modules/@types/estree/flow.d.ts new file mode 100644 index 0000000..9d001a9 --- /dev/null +++ b/node_modules/@types/estree/flow.d.ts @@ -0,0 +1,167 @@ +declare namespace ESTree { + interface FlowTypeAnnotation extends Node {} + + interface FlowBaseTypeAnnotation extends FlowTypeAnnotation {} + + interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {} + + interface FlowDeclaration extends Declaration {} + + interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface ArrayTypeAnnotation extends FlowTypeAnnotation { + elementType: FlowTypeAnnotation; + } + + interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface ClassImplements extends Node { + id: Identifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface ClassProperty { + key: Expression; + value?: Expression | null; + typeAnnotation?: TypeAnnotation | null; + computed: boolean; + static: boolean; + } + + interface DeclareClass extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + body: ObjectTypeAnnotation; + extends: InterfaceExtends[]; + } + + interface DeclareFunction extends FlowDeclaration { + id: Identifier; + } + + interface DeclareModule extends FlowDeclaration { + id: Literal | Identifier; + body: BlockStatement; + } + + interface DeclareVariable extends FlowDeclaration { + id: Identifier; + } + + interface FunctionTypeAnnotation extends FlowTypeAnnotation { + params: FunctionTypeParam[]; + returnType: FlowTypeAnnotation; + rest?: FunctionTypeParam | null; + typeParameters?: TypeParameterDeclaration | null; + } + + interface FunctionTypeParam { + name: Identifier; + typeAnnotation: FlowTypeAnnotation; + optional: boolean; + } + + interface GenericTypeAnnotation extends FlowTypeAnnotation { + id: Identifier | QualifiedTypeIdentifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface InterfaceExtends extends Node { + id: Identifier | QualifiedTypeIdentifier; + typeParameters?: TypeParameterInstantiation | null; + } + + interface InterfaceDeclaration extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + extends: InterfaceExtends[]; + body: ObjectTypeAnnotation; + } + + interface IntersectionTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface NullableTypeAnnotation extends FlowTypeAnnotation { + typeAnnotation: TypeAnnotation; + } + + interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} + + interface StringTypeAnnotation extends FlowBaseTypeAnnotation {} + + interface TupleTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface TypeofTypeAnnotation extends FlowTypeAnnotation { + argument: FlowTypeAnnotation; + } + + interface TypeAlias extends FlowDeclaration { + id: Identifier; + typeParameters?: TypeParameterDeclaration | null; + right: FlowTypeAnnotation; + } + + interface TypeAnnotation extends Node { + typeAnnotation: FlowTypeAnnotation; + } + + interface TypeCastExpression extends Expression { + expression: Expression; + typeAnnotation: TypeAnnotation; + } + + interface TypeParameterDeclaration extends Node { + params: Identifier[]; + } + + interface TypeParameterInstantiation extends Node { + params: FlowTypeAnnotation[]; + } + + interface ObjectTypeAnnotation extends FlowTypeAnnotation { + properties: ObjectTypeProperty[]; + indexers: ObjectTypeIndexer[]; + callProperties: ObjectTypeCallProperty[]; + } + + interface ObjectTypeCallProperty extends Node { + value: FunctionTypeAnnotation; + static: boolean; + } + + interface ObjectTypeIndexer extends Node { + id: Identifier; + key: FlowTypeAnnotation; + value: FlowTypeAnnotation; + static: boolean; + } + + interface ObjectTypeProperty extends Node { + key: Expression; + value: FlowTypeAnnotation; + optional: boolean; + static: boolean; + } + + interface QualifiedTypeIdentifier extends Node { + qualification: Identifier | QualifiedTypeIdentifier; + id: Identifier; + } + + interface UnionTypeAnnotation extends FlowTypeAnnotation { + types: FlowTypeAnnotation[]; + } + + interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {} +} diff --git a/node_modules/@types/estree/index.d.ts b/node_modules/@types/estree/index.d.ts new file mode 100644 index 0000000..7d4ab36 --- /dev/null +++ b/node_modules/@types/estree/index.d.ts @@ -0,0 +1,694 @@ +// This definition file follows a somewhat unusual format. ESTree allows +// runtime type checks based on the `type` parameter. In order to explain this +// to typescript we want to use discriminated union types: +// https://github.com/Microsoft/TypeScript/pull/9163 +// +// For ESTree this is a bit tricky because the high level interfaces like +// Node or Function are pulling double duty. We want to pass common fields down +// to the interfaces that extend them (like Identifier or +// ArrowFunctionExpression), but you can't extend a type union or enforce +// common fields on them. So we've split the high level interfaces into two +// types, a base type which passes down inherited fields, and a type union of +// all types which extend the base type. Only the type union is exported, and +// the union is how other types refer to the collection of inheriting types. +// +// This makes the definitions file here somewhat more difficult to maintain, +// but it has the notable advantage of making ESTree much easier to use as +// an end user. + +export interface BaseNodeWithoutComments { + // Every leaf interface that extends BaseNode must specify a type property. + // The type property should be a string literal. For example, Identifier + // has: `type: "Identifier"` + type: string; + loc?: SourceLocation | null | undefined; + range?: [number, number] | undefined; +} + +export interface BaseNode extends BaseNodeWithoutComments { + leadingComments?: Comment[] | undefined; + trailingComments?: Comment[] | undefined; +} + +export interface NodeMap { + AssignmentProperty: AssignmentProperty; + CatchClause: CatchClause; + Class: Class; + ClassBody: ClassBody; + Expression: Expression; + Function: Function; + Identifier: Identifier; + Literal: Literal; + MethodDefinition: MethodDefinition; + ModuleDeclaration: ModuleDeclaration; + ModuleSpecifier: ModuleSpecifier; + Pattern: Pattern; + PrivateIdentifier: PrivateIdentifier; + Program: Program; + Property: Property; + PropertyDefinition: PropertyDefinition; + SpreadElement: SpreadElement; + Statement: Statement; + Super: Super; + SwitchCase: SwitchCase; + TemplateElement: TemplateElement; + VariableDeclarator: VariableDeclarator; +} + +export type Node = NodeMap[keyof NodeMap]; + +export interface Comment extends BaseNodeWithoutComments { + type: "Line" | "Block"; + value: string; +} + +export interface SourceLocation { + source?: string | null | undefined; + start: Position; + end: Position; +} + +export interface Position { + /** >= 1 */ + line: number; + /** >= 0 */ + column: number; +} + +export interface Program extends BaseNode { + type: "Program"; + sourceType: "script" | "module"; + body: Array; + comments?: Comment[] | undefined; +} + +export interface Directive extends BaseNode { + type: "ExpressionStatement"; + expression: Literal; + directive: string; +} + +export interface BaseFunction extends BaseNode { + params: Pattern[]; + generator?: boolean | undefined; + async?: boolean | undefined; + // The body is either BlockStatement or Expression because arrow functions + // can have a body that's either. FunctionDeclarations and + // FunctionExpressions have only BlockStatement bodies. + body: BlockStatement | Expression; +} + +export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression; + +export type Statement = + | ExpressionStatement + | BlockStatement + | StaticBlock + | EmptyStatement + | DebuggerStatement + | WithStatement + | ReturnStatement + | LabeledStatement + | BreakStatement + | ContinueStatement + | IfStatement + | SwitchStatement + | ThrowStatement + | TryStatement + | WhileStatement + | DoWhileStatement + | ForStatement + | ForInStatement + | ForOfStatement + | Declaration; + +export interface BaseStatement extends BaseNode {} + +export interface EmptyStatement extends BaseStatement { + type: "EmptyStatement"; +} + +export interface BlockStatement extends BaseStatement { + type: "BlockStatement"; + body: Statement[]; + innerComments?: Comment[] | undefined; +} + +export interface StaticBlock extends Omit { + type: "StaticBlock"; +} + +export interface ExpressionStatement extends BaseStatement { + type: "ExpressionStatement"; + expression: Expression; +} + +export interface IfStatement extends BaseStatement { + type: "IfStatement"; + test: Expression; + consequent: Statement; + alternate?: Statement | null | undefined; +} + +export interface LabeledStatement extends BaseStatement { + type: "LabeledStatement"; + label: Identifier; + body: Statement; +} + +export interface BreakStatement extends BaseStatement { + type: "BreakStatement"; + label?: Identifier | null | undefined; +} + +export interface ContinueStatement extends BaseStatement { + type: "ContinueStatement"; + label?: Identifier | null | undefined; +} + +export interface WithStatement extends BaseStatement { + type: "WithStatement"; + object: Expression; + body: Statement; +} + +export interface SwitchStatement extends BaseStatement { + type: "SwitchStatement"; + discriminant: Expression; + cases: SwitchCase[]; +} + +export interface ReturnStatement extends BaseStatement { + type: "ReturnStatement"; + argument?: Expression | null | undefined; +} + +export interface ThrowStatement extends BaseStatement { + type: "ThrowStatement"; + argument: Expression; +} + +export interface TryStatement extends BaseStatement { + type: "TryStatement"; + block: BlockStatement; + handler?: CatchClause | null | undefined; + finalizer?: BlockStatement | null | undefined; +} + +export interface WhileStatement extends BaseStatement { + type: "WhileStatement"; + test: Expression; + body: Statement; +} + +export interface DoWhileStatement extends BaseStatement { + type: "DoWhileStatement"; + body: Statement; + test: Expression; +} + +export interface ForStatement extends BaseStatement { + type: "ForStatement"; + init?: VariableDeclaration | Expression | null | undefined; + test?: Expression | null | undefined; + update?: Expression | null | undefined; + body: Statement; +} + +export interface BaseForXStatement extends BaseStatement { + left: VariableDeclaration | Pattern; + right: Expression; + body: Statement; +} + +export interface ForInStatement extends BaseForXStatement { + type: "ForInStatement"; +} + +export interface DebuggerStatement extends BaseStatement { + type: "DebuggerStatement"; +} + +export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration; + +export interface BaseDeclaration extends BaseStatement {} + +export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration { + type: "FunctionDeclaration"; + /** It is null when a function declaration is a part of the `export default function` statement */ + id: Identifier | null; + body: BlockStatement; +} + +export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration { + id: Identifier; +} + +export interface VariableDeclaration extends BaseDeclaration { + type: "VariableDeclaration"; + declarations: VariableDeclarator[]; + kind: "var" | "let" | "const" | "using" | "await using"; +} + +export interface VariableDeclarator extends BaseNode { + type: "VariableDeclarator"; + id: Pattern; + init?: Expression | null | undefined; +} + +export interface ExpressionMap { + ArrayExpression: ArrayExpression; + ArrowFunctionExpression: ArrowFunctionExpression; + AssignmentExpression: AssignmentExpression; + AwaitExpression: AwaitExpression; + BinaryExpression: BinaryExpression; + CallExpression: CallExpression; + ChainExpression: ChainExpression; + ClassExpression: ClassExpression; + ConditionalExpression: ConditionalExpression; + FunctionExpression: FunctionExpression; + Identifier: Identifier; + ImportExpression: ImportExpression; + Literal: Literal; + LogicalExpression: LogicalExpression; + MemberExpression: MemberExpression; + MetaProperty: MetaProperty; + NewExpression: NewExpression; + ObjectExpression: ObjectExpression; + SequenceExpression: SequenceExpression; + TaggedTemplateExpression: TaggedTemplateExpression; + TemplateLiteral: TemplateLiteral; + ThisExpression: ThisExpression; + UnaryExpression: UnaryExpression; + UpdateExpression: UpdateExpression; + YieldExpression: YieldExpression; +} + +export type Expression = ExpressionMap[keyof ExpressionMap]; + +export interface BaseExpression extends BaseNode {} + +export type ChainElement = SimpleCallExpression | MemberExpression; + +export interface ChainExpression extends BaseExpression { + type: "ChainExpression"; + expression: ChainElement; +} + +export interface ThisExpression extends BaseExpression { + type: "ThisExpression"; +} + +export interface ArrayExpression extends BaseExpression { + type: "ArrayExpression"; + elements: Array; +} + +export interface ObjectExpression extends BaseExpression { + type: "ObjectExpression"; + properties: Array; +} + +export interface PrivateIdentifier extends BaseNode { + type: "PrivateIdentifier"; + name: string; +} + +export interface Property extends BaseNode { + type: "Property"; + key: Expression; + value: Expression | Pattern; // Could be an AssignmentProperty + kind: "init" | "get" | "set"; + method: boolean; + shorthand: boolean; + computed: boolean; +} + +export interface PropertyDefinition extends BaseNode { + type: "PropertyDefinition"; + key: Expression | PrivateIdentifier; + value?: Expression | null | undefined; + computed: boolean; + static: boolean; +} + +export interface FunctionExpression extends BaseFunction, BaseExpression { + id?: Identifier | null | undefined; + type: "FunctionExpression"; + body: BlockStatement; +} + +export interface SequenceExpression extends BaseExpression { + type: "SequenceExpression"; + expressions: Expression[]; +} + +export interface UnaryExpression extends BaseExpression { + type: "UnaryExpression"; + operator: UnaryOperator; + prefix: true; + argument: Expression; +} + +export interface BinaryExpression extends BaseExpression { + type: "BinaryExpression"; + operator: BinaryOperator; + left: Expression | PrivateIdentifier; + right: Expression; +} + +export interface AssignmentExpression extends BaseExpression { + type: "AssignmentExpression"; + operator: AssignmentOperator; + left: Pattern | MemberExpression; + right: Expression; +} + +export interface UpdateExpression extends BaseExpression { + type: "UpdateExpression"; + operator: UpdateOperator; + argument: Expression; + prefix: boolean; +} + +export interface LogicalExpression extends BaseExpression { + type: "LogicalExpression"; + operator: LogicalOperator; + left: Expression; + right: Expression; +} + +export interface ConditionalExpression extends BaseExpression { + type: "ConditionalExpression"; + test: Expression; + alternate: Expression; + consequent: Expression; +} + +export interface BaseCallExpression extends BaseExpression { + callee: Expression | Super; + arguments: Array; +} +export type CallExpression = SimpleCallExpression | NewExpression; + +export interface SimpleCallExpression extends BaseCallExpression { + type: "CallExpression"; + optional: boolean; +} + +export interface NewExpression extends BaseCallExpression { + type: "NewExpression"; +} + +export interface MemberExpression extends BaseExpression, BasePattern { + type: "MemberExpression"; + object: Expression | Super; + property: Expression | PrivateIdentifier; + computed: boolean; + optional: boolean; +} + +export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression; + +export interface BasePattern extends BaseNode {} + +export interface SwitchCase extends BaseNode { + type: "SwitchCase"; + test?: Expression | null | undefined; + consequent: Statement[]; +} + +export interface CatchClause extends BaseNode { + type: "CatchClause"; + param: Pattern | null; + body: BlockStatement; +} + +export interface Identifier extends BaseNode, BaseExpression, BasePattern { + type: "Identifier"; + name: string; +} + +export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral; + +export interface SimpleLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value: string | boolean | number | null; + raw?: string | undefined; +} + +export interface RegExpLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value?: RegExp | null | undefined; + regex: { + pattern: string; + flags: string; + }; + raw?: string | undefined; +} + +export interface BigIntLiteral extends BaseNode, BaseExpression { + type: "Literal"; + value?: bigint | null | undefined; + bigint: string; + raw?: string | undefined; +} + +export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; + +export type BinaryOperator = + | "==" + | "!=" + | "===" + | "!==" + | "<" + | "<=" + | ">" + | ">=" + | "<<" + | ">>" + | ">>>" + | "+" + | "-" + | "*" + | "/" + | "%" + | "**" + | "|" + | "^" + | "&" + | "in" + | "instanceof"; + +export type LogicalOperator = "||" | "&&" | "??"; + +export type AssignmentOperator = + | "=" + | "+=" + | "-=" + | "*=" + | "/=" + | "%=" + | "**=" + | "<<=" + | ">>=" + | ">>>=" + | "|=" + | "^=" + | "&=" + | "||=" + | "&&=" + | "??="; + +export type UpdateOperator = "++" | "--"; + +export interface ForOfStatement extends BaseForXStatement { + type: "ForOfStatement"; + await: boolean; +} + +export interface Super extends BaseNode { + type: "Super"; +} + +export interface SpreadElement extends BaseNode { + type: "SpreadElement"; + argument: Expression; +} + +export interface ArrowFunctionExpression extends BaseExpression, BaseFunction { + type: "ArrowFunctionExpression"; + expression: boolean; + body: BlockStatement | Expression; +} + +export interface YieldExpression extends BaseExpression { + type: "YieldExpression"; + argument?: Expression | null | undefined; + delegate: boolean; +} + +export interface TemplateLiteral extends BaseExpression { + type: "TemplateLiteral"; + quasis: TemplateElement[]; + expressions: Expression[]; +} + +export interface TaggedTemplateExpression extends BaseExpression { + type: "TaggedTemplateExpression"; + tag: Expression; + quasi: TemplateLiteral; +} + +export interface TemplateElement extends BaseNode { + type: "TemplateElement"; + tail: boolean; + value: { + /** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */ + cooked?: string | null | undefined; + raw: string; + }; +} + +export interface AssignmentProperty extends Property { + value: Pattern; + kind: "init"; + method: boolean; // false +} + +export interface ObjectPattern extends BasePattern { + type: "ObjectPattern"; + properties: Array; +} + +export interface ArrayPattern extends BasePattern { + type: "ArrayPattern"; + elements: Array; +} + +export interface RestElement extends BasePattern { + type: "RestElement"; + argument: Pattern; +} + +export interface AssignmentPattern extends BasePattern { + type: "AssignmentPattern"; + left: Pattern; + right: Expression; +} + +export type Class = ClassDeclaration | ClassExpression; +export interface BaseClass extends BaseNode { + superClass?: Expression | null | undefined; + body: ClassBody; +} + +export interface ClassBody extends BaseNode { + type: "ClassBody"; + body: Array; +} + +export interface MethodDefinition extends BaseNode { + type: "MethodDefinition"; + key: Expression | PrivateIdentifier; + value: FunctionExpression; + kind: "constructor" | "method" | "get" | "set"; + computed: boolean; + static: boolean; +} + +export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration { + type: "ClassDeclaration"; + /** It is null when a class declaration is a part of the `export default class` statement */ + id: Identifier | null; +} + +export interface ClassDeclaration extends MaybeNamedClassDeclaration { + id: Identifier; +} + +export interface ClassExpression extends BaseClass, BaseExpression { + type: "ClassExpression"; + id?: Identifier | null | undefined; +} + +export interface MetaProperty extends BaseExpression { + type: "MetaProperty"; + meta: Identifier; + property: Identifier; +} + +export type ModuleDeclaration = + | ImportDeclaration + | ExportNamedDeclaration + | ExportDefaultDeclaration + | ExportAllDeclaration; +export interface BaseModuleDeclaration extends BaseNode {} + +export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier; +export interface BaseModuleSpecifier extends BaseNode { + local: Identifier; +} + +export interface ImportDeclaration extends BaseModuleDeclaration { + type: "ImportDeclaration"; + specifiers: Array; + attributes: ImportAttribute[]; + source: Literal; +} + +export interface ImportSpecifier extends BaseModuleSpecifier { + type: "ImportSpecifier"; + imported: Identifier | Literal; +} + +export interface ImportAttribute extends BaseNode { + type: "ImportAttribute"; + key: Identifier | Literal; + value: Literal; +} + +export interface ImportExpression extends BaseExpression { + type: "ImportExpression"; + source: Expression; + options?: Expression | null | undefined; +} + +export interface ImportDefaultSpecifier extends BaseModuleSpecifier { + type: "ImportDefaultSpecifier"; +} + +export interface ImportNamespaceSpecifier extends BaseModuleSpecifier { + type: "ImportNamespaceSpecifier"; +} + +export interface ExportNamedDeclaration extends BaseModuleDeclaration { + type: "ExportNamedDeclaration"; + declaration?: Declaration | null | undefined; + specifiers: ExportSpecifier[]; + attributes: ImportAttribute[]; + source?: Literal | null | undefined; +} + +export interface ExportSpecifier extends Omit { + type: "ExportSpecifier"; + local: Identifier | Literal; + exported: Identifier | Literal; +} + +export interface ExportDefaultDeclaration extends BaseModuleDeclaration { + type: "ExportDefaultDeclaration"; + declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression; +} + +export interface ExportAllDeclaration extends BaseModuleDeclaration { + type: "ExportAllDeclaration"; + exported: Identifier | Literal | null; + attributes: ImportAttribute[]; + source: Literal; +} + +export interface AwaitExpression extends BaseExpression { + type: "AwaitExpression"; + argument: Expression; +} diff --git a/node_modules/@types/estree/package.json b/node_modules/@types/estree/package.json new file mode 100644 index 0000000..367a5d9 --- /dev/null +++ b/node_modules/@types/estree/package.json @@ -0,0 +1,27 @@ +{ + "name": "@types/estree", + "version": "1.0.9", + "description": "TypeScript definitions for estree", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree", + "license": "MIT", + "contributors": [ + { + "name": "RReverser", + "githubUsername": "RReverser", + "url": "https://github.com/RReverser" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/estree" + }, + "scripts": {}, + "dependencies": {}, + "peerDependencies": {}, + "typesPublisherContentHash": "db16da859cb0bee641414117047a4becba2e9f39d3e14a6745f887c47ef68482", + "typeScriptVersion": "5.3", + "nonNpm": true +} \ No newline at end of file diff --git a/node_modules/esbuild/LICENSE.md b/node_modules/esbuild/LICENSE.md new file mode 100644 index 0000000..2027e8d --- /dev/null +++ b/node_modules/esbuild/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Evan Wallace + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/esbuild/README.md b/node_modules/esbuild/README.md new file mode 100644 index 0000000..93863d1 --- /dev/null +++ b/node_modules/esbuild/README.md @@ -0,0 +1,3 @@ +# esbuild + +This is a JavaScript bundler and minifier. See https://github.com/evanw/esbuild and the [JavaScript API documentation](https://esbuild.github.io/api/) for details. diff --git a/node_modules/esbuild/bin/esbuild b/node_modules/esbuild/bin/esbuild new file mode 100755 index 0000000..63a0ee0 Binary files /dev/null and b/node_modules/esbuild/bin/esbuild differ diff --git a/node_modules/esbuild/install.js b/node_modules/esbuild/install.js new file mode 100644 index 0000000..ee09eff --- /dev/null +++ b/node_modules/esbuild/install.js @@ -0,0 +1,300 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); + +// lib/npm/node-platform.ts +var fs = require("fs"); +var os = require("os"); +var path = require("path"); +var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH; +var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild"; +var knownWindowsPackages = { + "win32 arm64 LE": "@esbuild/win32-arm64", + "win32 ia32 LE": "@esbuild/win32-ia32", + "win32 x64 LE": "@esbuild/win32-x64" +}; +var knownUnixlikePackages = { + "aix ppc64 BE": "@esbuild/aix-ppc64", + "android arm64 LE": "@esbuild/android-arm64", + "darwin arm64 LE": "@esbuild/darwin-arm64", + "darwin x64 LE": "@esbuild/darwin-x64", + "freebsd arm64 LE": "@esbuild/freebsd-arm64", + "freebsd x64 LE": "@esbuild/freebsd-x64", + "linux arm LE": "@esbuild/linux-arm", + "linux arm64 LE": "@esbuild/linux-arm64", + "linux ia32 LE": "@esbuild/linux-ia32", + "linux mips64el LE": "@esbuild/linux-mips64el", + "linux ppc64 LE": "@esbuild/linux-ppc64", + "linux riscv64 LE": "@esbuild/linux-riscv64", + "linux s390x BE": "@esbuild/linux-s390x", + "linux x64 LE": "@esbuild/linux-x64", + "linux loong64 LE": "@esbuild/linux-loong64", + "netbsd arm64 LE": "@esbuild/netbsd-arm64", + "netbsd x64 LE": "@esbuild/netbsd-x64", + "openbsd arm64 LE": "@esbuild/openbsd-arm64", + "openbsd x64 LE": "@esbuild/openbsd-x64", + "sunos x64 LE": "@esbuild/sunos-x64" +}; +var knownWebAssemblyFallbackPackages = { + "android arm LE": "@esbuild/android-arm", + "android x64 LE": "@esbuild/android-x64", + "openharmony arm64 LE": "@esbuild/openharmony-arm64" +}; +function pkgAndSubpathForCurrentPlatform() { + let pkg; + let subpath; + let isWASM = false; + let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`; + if (platformKey in knownWindowsPackages) { + pkg = knownWindowsPackages[platformKey]; + subpath = "esbuild.exe"; + } else if (platformKey in knownUnixlikePackages) { + pkg = knownUnixlikePackages[platformKey]; + subpath = "bin/esbuild"; + } else if (platformKey in knownWebAssemblyFallbackPackages) { + pkg = knownWebAssemblyFallbackPackages[platformKey]; + subpath = "bin/esbuild"; + isWASM = true; + } else { + throw new Error(`Unsupported platform: ${platformKey}`); + } + return { pkg, subpath, isWASM }; +} +function downloadedBinPath(pkg, subpath) { + const esbuildLibDir = path.dirname(require.resolve("esbuild")); + return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`); +} + +// lib/npm/node-install.ts +var fs2 = require("fs"); +var os2 = require("os"); +var path2 = require("path"); +var zlib = require("zlib"); +var https = require("https"); +var crypto = require("crypto"); +var child_process = require("child_process"); +var packageJSON = require(path2.join(__dirname, "package.json")); +var toPath = path2.join(__dirname, "bin", "esbuild"); +var isToPathJS = true; +function validateBinaryVersion(...command) { + command.push("--version"); + let stdout; + try { + stdout = child_process.execFileSync(command.shift(), command, { + // Without this, this install script strangely crashes with the error + // "EACCES: permission denied, write" but only on Ubuntu Linux when node is + // installed from the Snap Store. This is not a problem when you download + // the official version of node. The problem appears to be that stderr + // (i.e. file descriptor 2) isn't writable? + // + // More info: + // - https://snapcraft.io/ (what the Snap Store is) + // - https://nodejs.org/dist/ (download the official version of node) + // - https://github.com/evanw/esbuild/issues/1711#issuecomment-1027554035 + // + stdio: "pipe" + }).toString().trim(); + } catch (err) { + if (os2.platform() === "darwin" && /_SecTrustEvaluateWithError/.test(err + "")) { + let os3 = "this version of macOS"; + try { + os3 = "macOS " + child_process.execFileSync("sw_vers", ["-productVersion"]).toString().trim(); + } catch { + } + throw new Error(`The "esbuild" package cannot be installed because ${os3} is too outdated. + +The Go compiler (which esbuild relies on) no longer supports ${os3}, +which means the "esbuild" binary executable can't be run. You can either: + + * Update your version of macOS to one that the Go compiler supports + * Use the "esbuild-wasm" package instead of the "esbuild" package + * Build esbuild yourself using an older version of the Go compiler +`); + } + throw err; + } + if (stdout !== packageJSON.version) { + throw new Error(`Expected ${JSON.stringify(packageJSON.version)} but got ${JSON.stringify(stdout)}`); + } +} +function isYarn() { + const { npm_config_user_agent } = process.env; + if (npm_config_user_agent) { + return /\byarn\//.test(npm_config_user_agent); + } + return false; +} +function fetch(url) { + return new Promise((resolve, reject) => { + https.get(url, (res) => { + if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location) + return fetch(res.headers.location).then(resolve, reject); + if (res.statusCode !== 200) + return reject(new Error(`Server responded with ${res.statusCode}`)); + let chunks = []; + res.on("data", (chunk) => chunks.push(chunk)); + res.on("end", () => resolve(Buffer.concat(chunks))); + }).on("error", reject); + }); +} +function extractFileFromTarGzip(buffer, subpath) { + try { + buffer = zlib.unzipSync(buffer); + } catch (err) { + throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`); + } + let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, ""); + let offset = 0; + subpath = `package/${subpath}`; + while (offset < buffer.length) { + let name = str(offset, 100); + let size = parseInt(str(offset + 124, 12), 8); + offset += 512; + if (!isNaN(size) && size >= 0) { + if (name === subpath) return buffer.subarray(offset, offset + size); + offset += size + 511 & ~511; + } + } + throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`); +} +function installUsingNPM(pkg, subpath, binPath) { + const env = { ...process.env, npm_config_global: void 0 }; + const esbuildLibDir = path2.dirname(require.resolve("esbuild")); + const installDir = path2.join(esbuildLibDir, "npm-install"); + fs2.mkdirSync(installDir); + try { + fs2.writeFileSync(path2.join(installDir, "package.json"), "{}"); + child_process.execSync( + `npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${packageJSON.version}`, + { cwd: installDir, stdio: "pipe", env } + ); + const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath); + binaryIntegrityCheck(pkg, subpath, fs2.readFileSync(installedBinPath)); + fs2.renameSync(installedBinPath, binPath); + } finally { + try { + removeRecursive(installDir); + } catch { + } + } +} +function removeRecursive(dir) { + for (const entry of fs2.readdirSync(dir)) { + const entryPath = path2.join(dir, entry); + let stats; + try { + stats = fs2.lstatSync(entryPath); + } catch { + continue; + } + if (stats.isDirectory()) removeRecursive(entryPath); + else fs2.unlinkSync(entryPath); + } + fs2.rmdirSync(dir); +} +function applyManualBinaryPathOverride(overridePath) { + const pathString = JSON.stringify(overridePath); + fs2.writeFileSync(toPath, `#!/usr/bin/env node +require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' }); +`); + const libMain = path2.join(__dirname, "lib", "main.js"); + const code = fs2.readFileSync(libMain, "utf8"); + fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString}; +${code}`); +} +function maybeOptimizePackage(binPath, isWASM) { + if (os2.platform() !== "win32" && !isYarn() && !isWASM) { + const tempPath = path2.join(__dirname, "bin-esbuild"); + try { + fs2.linkSync(binPath, tempPath); + fs2.renameSync(tempPath, toPath); + isToPathJS = false; + fs2.unlinkSync(tempPath); + } catch { + } + } +} +function binaryIntegrityCheck(pkg, subpath, bytes) { + const hash = crypto.createHash("sha256").update(bytes).digest("hex"); + const key = `${pkg}/${subpath}`; + const expected = packageJSON["esbuild.binaryHashes"][key]; + if (!expected) throw new Error(`Missing hash for "${key}"`); + if (hash !== expected) throw new Error(`"${hash.slice(0, 8)}..." doesn't match "${expected.slice(0, 8)}..." for "${pkg}"`); +} +async function downloadDirectlyFromNPM(pkg, subpath, binPath) { + const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${packageJSON.version}.tgz`; + console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`); + try { + const bytes = extractFileFromTarGzip(await fetch(url), subpath); + binaryIntegrityCheck(pkg, subpath, bytes); + fs2.writeFileSync(binPath, bytes); + fs2.chmodSync(binPath, 493); + } catch (e) { + console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`); + throw e; + } +} +async function checkAndPreparePackage() { + if (isValidBinaryPath(ESBUILD_BINARY_PATH)) { + if (!fs2.existsSync(ESBUILD_BINARY_PATH)) { + console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`); + } else { + applyManualBinaryPathOverride(ESBUILD_BINARY_PATH); + return; + } + } + const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform(); + let binPath; + try { + binPath = require.resolve(`${pkg}/${subpath}`); + } catch (e) { + console.error(`[esbuild] Failed to find package "${pkg}" on the file system + +This can happen if you use the "--no-optional" flag. The "optionalDependencies" +package.json feature is used by esbuild to install the correct binary executable +for your current platform. This install script will now attempt to work around +this. If that fails, you need to remove the "--no-optional" flag to use esbuild. +`); + if (isWASM) throw new Error(`Failed to install package "${pkg}"`); + binPath = downloadedBinPath(pkg, subpath); + try { + console.error(`[esbuild] Trying to install package "${pkg}" using npm`); + installUsingNPM(pkg, subpath, binPath); + } catch (e2) { + console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`); + try { + await downloadDirectlyFromNPM(pkg, subpath, binPath); + } catch (e3) { + throw new Error(`Failed to install package "${pkg}"`); + } + } + } + maybeOptimizePackage(binPath, isWASM); +} +checkAndPreparePackage().then(() => { + if (isToPathJS) { + validateBinaryVersion(process.execPath, toPath); + } else { + validateBinaryVersion(toPath); + } +}); diff --git a/node_modules/esbuild/lib/main.d.ts b/node_modules/esbuild/lib/main.d.ts new file mode 100644 index 0000000..9d9974b --- /dev/null +++ b/node_modules/esbuild/lib/main.d.ts @@ -0,0 +1,720 @@ +export type Platform = 'browser' | 'node' | 'neutral' +export type Format = 'iife' | 'cjs' | 'esm' +export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx' +export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent' +export type LogStyle = 'default' | 'visualstudio' +export type Charset = 'ascii' | 'utf8' +export type Drop = 'console' | 'debugger' +export type AbsPaths = 'code' | 'log' | 'metafile' + +interface CommonOptions { + /** Documentation: https://esbuild.github.io/api/#sourcemap */ + sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both' + /** Documentation: https://esbuild.github.io/api/#legal-comments */ + legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external' + /** Documentation: https://esbuild.github.io/api/#source-root */ + sourceRoot?: string + /** Documentation: https://esbuild.github.io/api/#sources-content */ + sourcesContent?: boolean + + /** Documentation: https://esbuild.github.io/api/#format */ + format?: Format + /** Documentation: https://esbuild.github.io/api/#global-name */ + globalName?: string + /** Documentation: https://esbuild.github.io/api/#target */ + target?: string | string[] + /** Documentation: https://esbuild.github.io/api/#supported */ + supported?: Record + /** Documentation: https://esbuild.github.io/api/#platform */ + platform?: Platform + + /** Documentation: https://esbuild.github.io/api/#mangle-props */ + mangleProps?: RegExp + /** Documentation: https://esbuild.github.io/api/#mangle-props */ + reserveProps?: RegExp + /** Documentation: https://esbuild.github.io/api/#mangle-props */ + mangleQuoted?: boolean + /** Documentation: https://esbuild.github.io/api/#mangle-props */ + mangleCache?: Record + /** Documentation: https://esbuild.github.io/api/#drop */ + drop?: Drop[] + /** Documentation: https://esbuild.github.io/api/#drop-labels */ + dropLabels?: string[] + /** Documentation: https://esbuild.github.io/api/#minify */ + minify?: boolean + /** Documentation: https://esbuild.github.io/api/#minify */ + minifyWhitespace?: boolean + /** Documentation: https://esbuild.github.io/api/#minify */ + minifyIdentifiers?: boolean + /** Documentation: https://esbuild.github.io/api/#minify */ + minifySyntax?: boolean + /** Documentation: https://esbuild.github.io/api/#line-limit */ + lineLimit?: number + /** Documentation: https://esbuild.github.io/api/#charset */ + charset?: Charset + /** Documentation: https://esbuild.github.io/api/#tree-shaking */ + treeShaking?: boolean + /** Documentation: https://esbuild.github.io/api/#ignore-annotations */ + ignoreAnnotations?: boolean + + /** Documentation: https://esbuild.github.io/api/#jsx */ + jsx?: 'transform' | 'preserve' | 'automatic' + /** Documentation: https://esbuild.github.io/api/#jsx-factory */ + jsxFactory?: string + /** Documentation: https://esbuild.github.io/api/#jsx-fragment */ + jsxFragment?: string + /** Documentation: https://esbuild.github.io/api/#jsx-import-source */ + jsxImportSource?: string + /** Documentation: https://esbuild.github.io/api/#jsx-development */ + jsxDev?: boolean + /** Documentation: https://esbuild.github.io/api/#jsx-side-effects */ + jsxSideEffects?: boolean + + /** Documentation: https://esbuild.github.io/api/#define */ + define?: { [key: string]: string } + /** Documentation: https://esbuild.github.io/api/#pure */ + pure?: string[] + /** Documentation: https://esbuild.github.io/api/#keep-names */ + keepNames?: boolean + + /** Documentation: https://esbuild.github.io/api/#abs-paths */ + absPaths?: AbsPaths[] + /** Documentation: https://esbuild.github.io/api/#color */ + color?: boolean + /** Documentation: https://esbuild.github.io/api/#log-level */ + logLevel?: LogLevel + /** Documentation: https://esbuild.github.io/api/#log-limit */ + logLimit?: number + /** Documentation: https://esbuild.github.io/api/#log-override */ + logOverride?: Record + /** Documentation: https://esbuild.github.io/api/#log-style */ + logStyle?: LogStyle + + /** Documentation: https://esbuild.github.io/api/#tsconfig-raw */ + tsconfigRaw?: string | TsconfigRaw +} + +export interface TsconfigRaw { + compilerOptions?: { + alwaysStrict?: boolean + baseUrl?: string + experimentalDecorators?: boolean + importsNotUsedAsValues?: 'remove' | 'preserve' | 'error' + jsx?: 'preserve' | 'react-native' | 'react' | 'react-jsx' | 'react-jsxdev' + jsxFactory?: string + jsxFragmentFactory?: string + jsxImportSource?: string + paths?: Record + preserveValueImports?: boolean + strict?: boolean + target?: string + useDefineForClassFields?: boolean + verbatimModuleSyntax?: boolean + } +} + +export interface BuildOptions extends CommonOptions { + /** Documentation: https://esbuild.github.io/api/#bundle */ + bundle?: boolean + /** Documentation: https://esbuild.github.io/api/#splitting */ + splitting?: boolean + /** Documentation: https://esbuild.github.io/api/#preserve-symlinks */ + preserveSymlinks?: boolean + /** Documentation: https://esbuild.github.io/api/#outfile */ + outfile?: string + /** Documentation: https://esbuild.github.io/api/#metafile */ + metafile?: boolean + /** Documentation: https://esbuild.github.io/api/#outdir */ + outdir?: string + /** Documentation: https://esbuild.github.io/api/#outbase */ + outbase?: string + /** Documentation: https://esbuild.github.io/api/#external */ + external?: string[] + /** Documentation: https://esbuild.github.io/api/#packages */ + packages?: 'bundle' | 'external' + /** Documentation: https://esbuild.github.io/api/#alias */ + alias?: Record + /** Documentation: https://esbuild.github.io/api/#loader */ + loader?: { [ext: string]: Loader } + /** Documentation: https://esbuild.github.io/api/#resolve-extensions */ + resolveExtensions?: string[] + /** Documentation: https://esbuild.github.io/api/#main-fields */ + mainFields?: string[] + /** Documentation: https://esbuild.github.io/api/#conditions */ + conditions?: string[] + /** Documentation: https://esbuild.github.io/api/#write */ + write?: boolean + /** Documentation: https://esbuild.github.io/api/#allow-overwrite */ + allowOverwrite?: boolean + /** Documentation: https://esbuild.github.io/api/#tsconfig */ + tsconfig?: string + /** Documentation: https://esbuild.github.io/api/#out-extension */ + outExtension?: { [ext: string]: string } + /** Documentation: https://esbuild.github.io/api/#public-path */ + publicPath?: string + /** Documentation: https://esbuild.github.io/api/#entry-names */ + entryNames?: string + /** Documentation: https://esbuild.github.io/api/#chunk-names */ + chunkNames?: string + /** Documentation: https://esbuild.github.io/api/#asset-names */ + assetNames?: string + /** Documentation: https://esbuild.github.io/api/#inject */ + inject?: string[] + /** Documentation: https://esbuild.github.io/api/#banner */ + banner?: { [type: string]: string } + /** Documentation: https://esbuild.github.io/api/#footer */ + footer?: { [type: string]: string } + /** Documentation: https://esbuild.github.io/api/#entry-points */ + entryPoints?: (string | { in: string, out: string })[] | Record + /** Documentation: https://esbuild.github.io/api/#stdin */ + stdin?: StdinOptions + /** Documentation: https://esbuild.github.io/plugins/ */ + plugins?: Plugin[] + /** Documentation: https://esbuild.github.io/api/#working-directory */ + absWorkingDir?: string + /** Documentation: https://esbuild.github.io/api/#node-paths */ + nodePaths?: string[]; // The "NODE_PATH" variable from Node.js +} + +export interface StdinOptions { + contents: string | Uint8Array + resolveDir?: string + sourcefile?: string + loader?: Loader +} + +export interface Message { + id: string + pluginName: string + text: string + location: Location | null + notes: Note[] + + /** + * Optional user-specified data that is passed through unmodified. You can + * use this to stash the original error, for example. + */ + detail: any +} + +export interface Note { + text: string + location: Location | null +} + +export interface Location { + file: string + namespace: string + /** 1-based */ + line: number + /** 0-based, in bytes */ + column: number + /** in bytes */ + length: number + lineText: string + suggestion: string +} + +export interface OutputFile { + path: string + contents: Uint8Array + hash: string + /** "contents" as text (changes automatically with "contents") */ + readonly text: string +} + +export interface BuildResult { + errors: Message[] + warnings: Message[] + /** Only when "write: false" */ + outputFiles: OutputFile[] | (ProvidedOptions['write'] extends false ? never : undefined) + /** Only when "metafile: true" */ + metafile: Metafile | (ProvidedOptions['metafile'] extends true ? never : undefined) + /** Only when "mangleCache" is present */ + mangleCache: Record | (ProvidedOptions['mangleCache'] extends Object ? never : undefined) +} + +export interface BuildFailure extends Error { + errors: Message[] + warnings: Message[] +} + +/** Documentation: https://esbuild.github.io/api/#serve-arguments */ +export interface ServeOptions { + port?: number + host?: string + servedir?: string + keyfile?: string + certfile?: string + fallback?: string + cors?: CORSOptions + onRequest?: (args: ServeOnRequestArgs) => void +} + +/** Documentation: https://esbuild.github.io/api/#cors */ +export interface CORSOptions { + origin?: string | string[] +} + +export interface ServeOnRequestArgs { + remoteAddress: string + method: string + path: string + status: number + /** The time to generate the response, not to send it */ + timeInMS: number +} + +/** Documentation: https://esbuild.github.io/api/#serve-return-values */ +export interface ServeResult { + port: number + hosts: string[] +} + +export interface TransformOptions extends CommonOptions { + /** Documentation: https://esbuild.github.io/api/#sourcefile */ + sourcefile?: string + /** Documentation: https://esbuild.github.io/api/#loader */ + loader?: Loader + /** Documentation: https://esbuild.github.io/api/#banner */ + banner?: string + /** Documentation: https://esbuild.github.io/api/#footer */ + footer?: string +} + +export interface TransformResult { + code: string + map: string + warnings: Message[] + /** Only when "mangleCache" is present */ + mangleCache: Record | (ProvidedOptions['mangleCache'] extends Object ? never : undefined) + /** Only when "legalComments" is "external" */ + legalComments: string | (ProvidedOptions['legalComments'] extends 'external' ? never : undefined) +} + +export interface TransformFailure extends Error { + errors: Message[] + warnings: Message[] +} + +export interface Plugin { + name: string + setup: (build: PluginBuild) => (void | Promise) +} + +export interface PluginBuild { + /** Documentation: https://esbuild.github.io/plugins/#build-options */ + initialOptions: BuildOptions + + /** Documentation: https://esbuild.github.io/plugins/#resolve */ + resolve(path: string, options?: ResolveOptions): Promise + + /** Documentation: https://esbuild.github.io/plugins/#on-start */ + onStart(callback: () => + (OnStartResult | null | void | Promise)): void + + /** Documentation: https://esbuild.github.io/plugins/#on-end */ + onEnd(callback: (result: BuildResult) => + (OnEndResult | null | void | Promise)): void + + /** Documentation: https://esbuild.github.io/plugins/#on-resolve */ + onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) => + (OnResolveResult | null | undefined | Promise)): void + + /** Documentation: https://esbuild.github.io/plugins/#on-load */ + onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) => + (OnLoadResult | null | undefined | Promise)): void + + /** Documentation: https://esbuild.github.io/plugins/#on-dispose */ + onDispose(callback: () => void): void + + // This is a full copy of the esbuild library in case you need it + esbuild: { + context: typeof context, + build: typeof build, + buildSync: typeof buildSync, + transform: typeof transform, + transformSync: typeof transformSync, + formatMessages: typeof formatMessages, + formatMessagesSync: typeof formatMessagesSync, + analyzeMetafile: typeof analyzeMetafile, + analyzeMetafileSync: typeof analyzeMetafileSync, + initialize: typeof initialize, + version: typeof version, + } +} + +/** Documentation: https://esbuild.github.io/plugins/#resolve-options */ +export interface ResolveOptions { + pluginName?: string + importer?: string + namespace?: string + resolveDir?: string + kind?: ImportKind + pluginData?: any + with?: Record +} + +/** Documentation: https://esbuild.github.io/plugins/#resolve-results */ +export interface ResolveResult { + errors: Message[] + warnings: Message[] + + path: string + external: boolean + sideEffects: boolean + namespace: string + suffix: string + pluginData: any +} + +export interface OnStartResult { + errors?: PartialMessage[] + warnings?: PartialMessage[] +} + +export interface OnEndResult { + errors?: PartialMessage[] + warnings?: PartialMessage[] +} + +/** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */ +export interface OnResolveOptions { + filter: RegExp + namespace?: string +} + +/** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */ +export interface OnResolveArgs { + path: string + importer: string + namespace: string + resolveDir: string + kind: ImportKind + pluginData: any + with: Record +} + +export type ImportKind = + | 'entry-point' + + // JS + | 'import-statement' + | 'require-call' + | 'dynamic-import' + | 'require-resolve' + + // CSS + | 'import-rule' + | 'composes-from' + | 'url-token' + +/** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */ +export interface OnResolveResult { + pluginName?: string + + errors?: PartialMessage[] + warnings?: PartialMessage[] + + path?: string + external?: boolean + sideEffects?: boolean + namespace?: string + suffix?: string + pluginData?: any + + watchFiles?: string[] + watchDirs?: string[] +} + +/** Documentation: https://esbuild.github.io/plugins/#on-load-options */ +export interface OnLoadOptions { + filter: RegExp + namespace?: string +} + +/** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */ +export interface OnLoadArgs { + path: string + namespace: string + suffix: string + pluginData: any + with: Record +} + +/** Documentation: https://esbuild.github.io/plugins/#on-load-results */ +export interface OnLoadResult { + pluginName?: string + + errors?: PartialMessage[] + warnings?: PartialMessage[] + + contents?: string | Uint8Array + resolveDir?: string + loader?: Loader + pluginData?: any + + watchFiles?: string[] + watchDirs?: string[] +} + +export interface PartialMessage { + id?: string + pluginName?: string + text?: string + location?: Partial | null + notes?: PartialNote[] + detail?: any +} + +export interface PartialNote { + text?: string + location?: Partial | null +} + +/** Documentation: https://esbuild.github.io/api/#metafile */ +export interface Metafile { + inputs: { + [path: string]: { + bytes: number + imports: { + path: string + kind: ImportKind + external?: boolean + original?: string + with?: Record + }[] + format?: 'cjs' | 'esm' + with?: Record + } + } + outputs: { + [path: string]: { + bytes: number + inputs: { + [path: string]: { + bytesInOutput: number + } + } + imports: { + path: string + kind: ImportKind | 'file-loader' + external?: boolean + }[] + exports: string[] + entryPoint?: string + cssBundle?: string + } + } +} + +export interface FormatMessagesOptions { + kind: 'error' | 'warning' + color?: boolean + terminalWidth?: number + logStyle?: LogStyle +} + +export interface AnalyzeMetafileOptions { + color?: boolean + verbose?: boolean +} + +/** Documentation: https://esbuild.github.io/api/#watch-arguments */ +export interface WatchOptions { + delay?: number // In milliseconds +} + +export interface BuildContext { + /** Documentation: https://esbuild.github.io/api/#rebuild */ + rebuild(): Promise> + + /** Documentation: https://esbuild.github.io/api/#watch */ + watch(options?: WatchOptions): Promise + + /** Documentation: https://esbuild.github.io/api/#serve */ + serve(options?: ServeOptions): Promise + + cancel(): Promise + dispose(): Promise +} + +// This is a TypeScript type-level function which replaces any keys in "In" +// that aren't in "Out" with "never". We use this to reject properties with +// typos in object literals. See: https://stackoverflow.com/questions/49580725 +type SameShape = In & { [Key in Exclude]: never } + +/** + * This function invokes the "esbuild" command-line tool for you. It returns a + * promise that either resolves with a "BuildResult" object or rejects with a + * "BuildFailure" object. + * + * - Works in node: yes + * - Works in browser: yes + * + * Documentation: https://esbuild.github.io/api/#build + */ +export declare function build(options: SameShape): Promise> + +/** + * This is the advanced long-running form of "build" that supports additional + * features such as watch mode and a local development server. + * + * - Works in node: yes + * - Works in browser: no + * + * Documentation: https://esbuild.github.io/api/#build + */ +export declare function context(options: SameShape): Promise> + +/** + * This function transforms a single JavaScript file. It can be used to minify + * JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript + * to older JavaScript. It returns a promise that is either resolved with a + * "TransformResult" object or rejected with a "TransformFailure" object. + * + * - Works in node: yes + * - Works in browser: yes + * + * Documentation: https://esbuild.github.io/api/#transform + */ +export declare function transform(input: string | Uint8Array, options?: SameShape): Promise> + +/** + * Converts log messages to formatted message strings suitable for printing in + * the terminal. This allows you to reuse the built-in behavior of esbuild's + * log message formatter. This is a batch-oriented API for efficiency. + * + * - Works in node: yes + * - Works in browser: yes + */ +export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise + +/** + * Pretty-prints an analysis of the metafile JSON to a string. This is just for + * convenience to be able to match esbuild's pretty-printing exactly. If you want + * to customize it, you can just inspect the data in the metafile yourself. + * + * - Works in node: yes + * - Works in browser: yes + * + * Documentation: https://esbuild.github.io/api/#analyze + */ +export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise + +/** + * A synchronous version of "build". + * + * - Works in node: yes + * - Works in browser: no + * + * Documentation: https://esbuild.github.io/api/#build + */ +export declare function buildSync(options: SameShape): BuildResult + +/** + * A synchronous version of "transform". + * + * - Works in node: yes + * - Works in browser: no + * + * Documentation: https://esbuild.github.io/api/#transform + */ +export declare function transformSync(input: string | Uint8Array, options?: SameShape): TransformResult + +/** + * A synchronous version of "formatMessages". + * + * - Works in node: yes + * - Works in browser: no + */ +export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[] + +/** + * A synchronous version of "analyzeMetafile". + * + * - Works in node: yes + * - Works in browser: no + * + * Documentation: https://esbuild.github.io/api/#analyze + */ +export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string + +/** + * This configures the browser-based version of esbuild. It is necessary to + * call this first and wait for the returned promise to be resolved before + * making other API calls when using esbuild in the browser. + * + * - Works in node: yes + * - Works in browser: yes ("options" is required) + * + * Documentation: https://esbuild.github.io/api/#browser + */ +export declare function initialize(options: InitializeOptions): Promise + +export interface InitializeOptions { + /** + * The URL of the "esbuild.wasm" file. This must be provided when running + * esbuild in the browser. + */ + wasmURL?: string | URL + + /** + * The result of calling "new WebAssembly.Module(buffer)" where "buffer" + * is a typed array or ArrayBuffer containing the binary code of the + * "esbuild.wasm" file. + * + * You can use this as an alternative to "wasmURL" for environments where it's + * not possible to download the WebAssembly module. + */ + wasmModule?: WebAssembly.Module + + /** + * By default esbuild runs the WebAssembly-based browser API in a web worker + * to avoid blocking the UI thread. This can be disabled by setting "worker" + * to false. + */ + worker?: boolean +} + +export let version: string + +// Call this function to terminate esbuild's child process. The child process +// is not terminated and re-created after each API call because it's more +// efficient to keep it around when there are multiple API calls. +// +// In node this happens automatically before the parent node process exits. So +// you only need to call this if you know you will not make any more esbuild +// API calls and you want to clean up resources. +// +// Unlike node, Deno lacks the necessary APIs to clean up child processes +// automatically. You must manually call stop() in Deno when you're done +// using esbuild or Deno will continue running forever. +// +// Another reason you might want to call this is if you are using esbuild from +// within a Deno test. Deno fails tests that create a child process without +// killing it before the test ends, so you have to call this function (and +// await the returned promise) in every Deno test that uses esbuild. +export declare function stop(): Promise + +// Note: These declarations exist to avoid type errors when you omit "dom" from +// "lib" in your "tsconfig.json" file. TypeScript confusingly declares the +// global "WebAssembly" type in "lib.dom.d.ts" even though it has nothing to do +// with the browser DOM and is present in many non-browser JavaScript runtimes +// (e.g. node and deno). Declaring it here allows esbuild's API to be used in +// these scenarios. +// +// There's an open issue about getting this problem corrected (although these +// declarations will need to remain even if this is fixed for backward +// compatibility with older TypeScript versions): +// +// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826 +// +declare global { + namespace WebAssembly { + interface Module { + } + } + interface URL { + } +} diff --git a/node_modules/esbuild/lib/main.js b/node_modules/esbuild/lib/main.js new file mode 100644 index 0000000..6126744 --- /dev/null +++ b/node_modules/esbuild/lib/main.js @@ -0,0 +1,2536 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// lib/npm/node.ts +var node_exports = {}; +__export(node_exports, { + analyzeMetafile: () => analyzeMetafile, + analyzeMetafileSync: () => analyzeMetafileSync, + build: () => build, + buildSync: () => buildSync, + context: () => context, + default: () => node_default, + formatMessages: () => formatMessages, + formatMessagesSync: () => formatMessagesSync, + initialize: () => initialize, + stop: () => stop, + transform: () => transform, + transformSync: () => transformSync, + version: () => version +}); +module.exports = __toCommonJS(node_exports); + +// lib/shared/stdio_protocol.ts +function encodePacket(packet) { + let visit = (value) => { + if (value === null) { + bb.write8(0); + } else if (typeof value === "boolean") { + bb.write8(1); + bb.write8(+value); + } else if (typeof value === "number") { + bb.write8(2); + bb.write32(value | 0); + } else if (typeof value === "string") { + bb.write8(3); + bb.write(encodeUTF8(value)); + } else if (value instanceof Uint8Array) { + bb.write8(4); + bb.write(value); + } else if (value instanceof Array) { + bb.write8(5); + bb.write32(value.length); + for (let item of value) { + visit(item); + } + } else { + let keys = Object.keys(value); + bb.write8(6); + bb.write32(keys.length); + for (let key of keys) { + bb.write(encodeUTF8(key)); + visit(value[key]); + } + } + }; + let bb = new ByteBuffer(); + bb.write32(0); + bb.write32(packet.id << 1 | +!packet.isRequest); + visit(packet.value); + writeUInt32LE(bb.buf, bb.len - 4, 0); + return bb.buf.subarray(0, bb.len); +} +function decodePacket(bytes) { + let visit = () => { + switch (bb.read8()) { + case 0: + return null; + case 1: + return !!bb.read8(); + case 2: + return bb.read32(); + case 3: + return decodeUTF8(bb.read()); + case 4: + return bb.read(); + case 5: { + let count = bb.read32(); + let value2 = []; + for (let i = 0; i < count; i++) { + value2.push(visit()); + } + return value2; + } + case 6: { + let count = bb.read32(); + let value2 = {}; + for (let i = 0; i < count; i++) { + value2[decodeUTF8(bb.read())] = visit(); + } + return value2; + } + default: + throw new Error("Invalid packet"); + } + }; + let bb = new ByteBuffer(bytes); + let id = bb.read32(); + let isRequest = (id & 1) === 0; + id >>>= 1; + let value = visit(); + if (bb.ptr !== bytes.length) { + throw new Error("Invalid packet"); + } + return { id, isRequest, value }; +} +var ByteBuffer = class { + constructor(buf = new Uint8Array(1024)) { + this.buf = buf; + this.len = 0; + this.ptr = 0; + } + _write(delta) { + if (this.len + delta > this.buf.length) { + let clone = new Uint8Array((this.len + delta) * 2); + clone.set(this.buf); + this.buf = clone; + } + this.len += delta; + return this.len - delta; + } + write8(value) { + let offset = this._write(1); + this.buf[offset] = value; + } + write32(value) { + let offset = this._write(4); + writeUInt32LE(this.buf, value, offset); + } + write(bytes) { + let offset = this._write(4 + bytes.length); + writeUInt32LE(this.buf, bytes.length, offset); + this.buf.set(bytes, offset + 4); + } + _read(delta) { + if (this.ptr + delta > this.buf.length) { + throw new Error("Invalid packet"); + } + this.ptr += delta; + return this.ptr - delta; + } + read8() { + return this.buf[this._read(1)]; + } + read32() { + return readUInt32LE(this.buf, this._read(4)); + } + read() { + let length = this.read32(); + let bytes = new Uint8Array(length); + let ptr = this._read(bytes.length); + bytes.set(this.buf.subarray(ptr, ptr + length)); + return bytes; + } +}; +var encodeUTF8; +var decodeUTF8; +var encodeInvariant; +if (typeof TextEncoder !== "undefined" && typeof TextDecoder !== "undefined") { + let encoder = new TextEncoder(); + let decoder = new TextDecoder(); + encodeUTF8 = (text) => encoder.encode(text); + decodeUTF8 = (bytes) => decoder.decode(bytes); + encodeInvariant = 'new TextEncoder().encode("")'; +} else if (typeof Buffer !== "undefined") { + encodeUTF8 = (text) => Buffer.from(text); + decodeUTF8 = (bytes) => { + let { buffer, byteOffset, byteLength } = bytes; + return Buffer.from(buffer, byteOffset, byteLength).toString(); + }; + encodeInvariant = 'Buffer.from("")'; +} else { + throw new Error("No UTF-8 codec found"); +} +if (!(encodeUTF8("") instanceof Uint8Array)) + throw new Error(`Invariant violation: "${encodeInvariant} instanceof Uint8Array" is incorrectly false + +This indicates that your JavaScript environment is broken. You cannot use +esbuild in this environment because esbuild relies on this invariant. This +is not a problem with esbuild. You need to fix your environment instead. +`); +function readUInt32LE(buffer, offset) { + return (buffer[offset++] | buffer[offset++] << 8 | buffer[offset++] << 16 | buffer[offset++] << 24) >>> 0; +} +function writeUInt32LE(buffer, value, offset) { + buffer[offset++] = value; + buffer[offset++] = value >> 8; + buffer[offset++] = value >> 16; + buffer[offset++] = value >> 24; +} + +// lib/shared/uint8array_json_parser.ts +var fromCharCode = String.fromCharCode; +function throwSyntaxError(bytes, index, message) { + const c = bytes[index]; + let line = 1; + let column = 0; + for (let i = 0; i < index; i++) { + if (bytes[i] === 10 /* Newline */) { + line++; + column = 0; + } else { + column++; + } + } + throw new SyntaxError( + message ? message : index === bytes.length ? "Unexpected end of input while parsing JSON" : c >= 32 && c <= 126 ? `Unexpected character ${fromCharCode(c)} in JSON at position ${index} (line ${line}, column ${column})` : `Unexpected byte 0x${c.toString(16)} in JSON at position ${index} (line ${line}, column ${column})` + ); +} +function JSON_parse(bytes) { + if (!(bytes instanceof Uint8Array)) { + throw new Error(`JSON input must be a Uint8Array`); + } + const propertyStack = []; + const objectStack = []; + const stateStack = []; + const length = bytes.length; + let property = null; + let state = 0 /* TopLevel */; + let object; + let i = 0; + while (i < length) { + let c = bytes[i++]; + if (c <= 32 /* Space */) { + continue; + } + let value; + if (state === 2 /* Object */ && property === null && c !== 34 /* Quote */ && c !== 125 /* CloseBrace */) { + throwSyntaxError(bytes, --i); + } + switch (c) { + // True + case 116 /* LowerT */: { + if (bytes[i++] !== 114 /* LowerR */ || bytes[i++] !== 117 /* LowerU */ || bytes[i++] !== 101 /* LowerE */) { + throwSyntaxError(bytes, --i); + } + value = true; + break; + } + // False + case 102 /* LowerF */: { + if (bytes[i++] !== 97 /* LowerA */ || bytes[i++] !== 108 /* LowerL */ || bytes[i++] !== 115 /* LowerS */ || bytes[i++] !== 101 /* LowerE */) { + throwSyntaxError(bytes, --i); + } + value = false; + break; + } + // Null + case 110 /* LowerN */: { + if (bytes[i++] !== 117 /* LowerU */ || bytes[i++] !== 108 /* LowerL */ || bytes[i++] !== 108 /* LowerL */) { + throwSyntaxError(bytes, --i); + } + value = null; + break; + } + // Number begin + case 45 /* Minus */: + case 46 /* Dot */: + case 48 /* Digit0 */: + case 49 /* Digit1 */: + case 50 /* Digit2 */: + case 51 /* Digit3 */: + case 52 /* Digit4 */: + case 53 /* Digit5 */: + case 54 /* Digit6 */: + case 55 /* Digit7 */: + case 56 /* Digit8 */: + case 57 /* Digit9 */: { + let index = i; + value = fromCharCode(c); + c = bytes[i]; + while (true) { + switch (c) { + case 43 /* Plus */: + case 45 /* Minus */: + case 46 /* Dot */: + case 48 /* Digit0 */: + case 49 /* Digit1 */: + case 50 /* Digit2 */: + case 51 /* Digit3 */: + case 52 /* Digit4 */: + case 53 /* Digit5 */: + case 54 /* Digit6 */: + case 55 /* Digit7 */: + case 56 /* Digit8 */: + case 57 /* Digit9 */: + case 101 /* LowerE */: + case 69 /* UpperE */: { + value += fromCharCode(c); + c = bytes[++i]; + continue; + } + } + break; + } + value = +value; + if (isNaN(value)) { + throwSyntaxError(bytes, --index, "Invalid number"); + } + break; + } + // String begin + case 34 /* Quote */: { + value = ""; + while (true) { + if (i >= length) { + throwSyntaxError(bytes, length); + } + c = bytes[i++]; + if (c === 34 /* Quote */) { + break; + } else if (c === 92 /* Backslash */) { + switch (bytes[i++]) { + // Normal escape sequence + case 34 /* Quote */: + value += '"'; + break; + case 47 /* Slash */: + value += "/"; + break; + case 92 /* Backslash */: + value += "\\"; + break; + case 98 /* LowerB */: + value += "\b"; + break; + case 102 /* LowerF */: + value += "\f"; + break; + case 110 /* LowerN */: + value += "\n"; + break; + case 114 /* LowerR */: + value += "\r"; + break; + case 116 /* LowerT */: + value += " "; + break; + // Unicode escape sequence + case 117 /* LowerU */: { + let code = 0; + for (let j = 0; j < 4; j++) { + c = bytes[i++]; + code <<= 4; + if (c >= 48 /* Digit0 */ && c <= 57 /* Digit9 */) code |= c - 48 /* Digit0 */; + else if (c >= 97 /* LowerA */ && c <= 102 /* LowerF */) code |= c + (10 - 97 /* LowerA */); + else if (c >= 65 /* UpperA */ && c <= 70 /* UpperF */) code |= c + (10 - 65 /* UpperA */); + else throwSyntaxError(bytes, --i); + } + value += fromCharCode(code); + break; + } + // Invalid escape sequence + default: + throwSyntaxError(bytes, --i); + break; + } + } else if (c <= 127) { + value += fromCharCode(c); + } else if ((c & 224) === 192) { + value += fromCharCode((c & 31) << 6 | bytes[i++] & 63); + } else if ((c & 240) === 224) { + value += fromCharCode((c & 15) << 12 | (bytes[i++] & 63) << 6 | bytes[i++] & 63); + } else if ((c & 248) == 240) { + let codePoint = (c & 7) << 18 | (bytes[i++] & 63) << 12 | (bytes[i++] & 63) << 6 | bytes[i++] & 63; + if (codePoint > 65535) { + codePoint -= 65536; + value += fromCharCode(codePoint >> 10 & 1023 | 55296); + codePoint = 56320 | codePoint & 1023; + } + value += fromCharCode(codePoint); + } + } + value[0]; + break; + } + // Array begin + case 91 /* OpenBracket */: { + value = []; + propertyStack.push(property); + objectStack.push(object); + stateStack.push(state); + property = null; + object = value; + state = 1 /* Array */; + continue; + } + // Object begin + case 123 /* OpenBrace */: { + value = {}; + propertyStack.push(property); + objectStack.push(object); + stateStack.push(state); + property = null; + object = value; + state = 2 /* Object */; + continue; + } + // Array end + case 93 /* CloseBracket */: { + if (state !== 1 /* Array */) { + throwSyntaxError(bytes, --i); + } + value = object; + property = propertyStack.pop(); + object = objectStack.pop(); + state = stateStack.pop(); + break; + } + // Object end + case 125 /* CloseBrace */: { + if (state !== 2 /* Object */) { + throwSyntaxError(bytes, --i); + } + value = object; + property = propertyStack.pop(); + object = objectStack.pop(); + state = stateStack.pop(); + break; + } + default: { + throwSyntaxError(bytes, --i); + } + } + c = bytes[i]; + while (c <= 32 /* Space */) { + c = bytes[++i]; + } + switch (state) { + case 0 /* TopLevel */: { + if (i === length) { + return value; + } + break; + } + case 1 /* Array */: { + object.push(value); + if (c === 44 /* Comma */) { + i++; + continue; + } + if (c === 93 /* CloseBracket */) { + continue; + } + break; + } + case 2 /* Object */: { + if (property === null) { + property = value; + if (c === 58 /* Colon */) { + i++; + continue; + } + } else { + object[property] = value; + property = null; + if (c === 44 /* Comma */) { + i++; + continue; + } + if (c === 125 /* CloseBrace */) { + continue; + } + } + break; + } + } + break; + } + throwSyntaxError(bytes, i); +} + +// lib/shared/common.ts +var quote = JSON.stringify; +var buildLogLevelDefault = "warning"; +var transformLogLevelDefault = "silent"; +function validateAndJoinStringArray(values, what) { + const toJoin = []; + for (const value of values) { + validateStringValue(value, what); + if (value.indexOf(",") >= 0) throw new Error(`Invalid ${what}: ${value}`); + toJoin.push(value); + } + return toJoin.join(","); +} +var canBeAnything = () => null; +var mustBeBoolean = (value) => typeof value === "boolean" ? null : "a boolean"; +var mustBeString = (value) => typeof value === "string" ? null : "a string"; +var mustBeRegExp = (value) => value instanceof RegExp ? null : "a RegExp object"; +var mustBeInteger = (value) => typeof value === "number" && value === (value | 0) ? null : "an integer"; +var mustBeValidPortNumber = (value) => typeof value === "number" && value === (value | 0) && value >= 0 && value <= 65535 ? null : "a valid port number"; +var mustBeFunction = (value) => typeof value === "function" ? null : "a function"; +var mustBeArray = (value) => Array.isArray(value) ? null : "an array"; +var mustBeArrayOfStrings = (value) => Array.isArray(value) && value.every((x) => typeof x === "string") ? null : "an array of strings"; +var mustBeObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? null : "an object"; +var mustBeEntryPoints = (value) => typeof value === "object" && value !== null ? null : "an array or an object"; +var mustBeWebAssemblyModule = (value) => value instanceof WebAssembly.Module ? null : "a WebAssembly.Module"; +var mustBeObjectOrNull = (value) => typeof value === "object" && !Array.isArray(value) ? null : "an object or null"; +var mustBeStringOrBoolean = (value) => typeof value === "string" || typeof value === "boolean" ? null : "a string or a boolean"; +var mustBeStringOrObject = (value) => typeof value === "string" || typeof value === "object" && value !== null && !Array.isArray(value) ? null : "a string or an object"; +var mustBeStringOrArrayOfStrings = (value) => typeof value === "string" || Array.isArray(value) && value.every((x) => typeof x === "string") ? null : "a string or an array of strings"; +var mustBeStringOrUint8Array = (value) => typeof value === "string" || value instanceof Uint8Array ? null : "a string or a Uint8Array"; +var mustBeStringOrURL = (value) => typeof value === "string" || value instanceof URL ? null : "a string or a URL"; +function getFlag(object, keys, key, mustBeFn) { + let value = object[key]; + keys[key + ""] = true; + if (value === void 0) return void 0; + let mustBe = mustBeFn(value); + if (mustBe !== null) throw new Error(`${quote(key)} must be ${mustBe}`); + return value; +} +function checkForInvalidFlags(object, keys, where) { + for (let key in object) { + if (!(key in keys)) { + throw new Error(`Invalid option ${where}: ${quote(key)}`); + } + } +} +function validateInitializeOptions(options) { + let keys = /* @__PURE__ */ Object.create(null); + let wasmURL = getFlag(options, keys, "wasmURL", mustBeStringOrURL); + let wasmModule = getFlag(options, keys, "wasmModule", mustBeWebAssemblyModule); + let worker = getFlag(options, keys, "worker", mustBeBoolean); + checkForInvalidFlags(options, keys, "in initialize() call"); + return { + wasmURL, + wasmModule, + worker + }; +} +function validateMangleCache(mangleCache) { + let validated; + if (mangleCache !== void 0) { + validated = /* @__PURE__ */ Object.create(null); + for (let key in mangleCache) { + let value = mangleCache[key]; + if (typeof value === "string" || value === false) { + validated[key] = value; + } else { + throw new Error(`Expected ${quote(key)} in mangle cache to map to either a string or false`); + } + } + } + return validated; +} +function pushLogFlags(flags, options, keys, isTTY2, logLevelDefault) { + let color = getFlag(options, keys, "color", mustBeBoolean); + let logLevel = getFlag(options, keys, "logLevel", mustBeString); + let logLimit = getFlag(options, keys, "logLimit", mustBeInteger); + let logStyle = getFlag(options, keys, "logStyle", mustBeString); + if (color !== void 0) flags.push(`--color=${color}`); + else if (isTTY2) flags.push(`--color=true`); + flags.push(`--log-level=${logLevel || logLevelDefault}`); + flags.push(`--log-limit=${logLimit || 0}`); + if (logStyle) flags.push(`--log-style=${logStyle}`); +} +function validateStringValue(value, what, key) { + if (typeof value !== "string") { + throw new Error(`Expected value for ${what}${key !== void 0 ? " " + quote(key) : ""} to be a string, got ${typeof value} instead`); + } + return value; +} +function pushCommonFlags(flags, options, keys) { + let legalComments = getFlag(options, keys, "legalComments", mustBeString); + let sourceRoot = getFlag(options, keys, "sourceRoot", mustBeString); + let sourcesContent = getFlag(options, keys, "sourcesContent", mustBeBoolean); + let target = getFlag(options, keys, "target", mustBeStringOrArrayOfStrings); + let format = getFlag(options, keys, "format", mustBeString); + let globalName = getFlag(options, keys, "globalName", mustBeString); + let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp); + let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp); + let mangleQuoted = getFlag(options, keys, "mangleQuoted", mustBeBoolean); + let minify = getFlag(options, keys, "minify", mustBeBoolean); + let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean); + let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean); + let minifyIdentifiers = getFlag(options, keys, "minifyIdentifiers", mustBeBoolean); + let lineLimit = getFlag(options, keys, "lineLimit", mustBeInteger); + let drop = getFlag(options, keys, "drop", mustBeArrayOfStrings); + let dropLabels = getFlag(options, keys, "dropLabels", mustBeArrayOfStrings); + let charset = getFlag(options, keys, "charset", mustBeString); + let treeShaking = getFlag(options, keys, "treeShaking", mustBeBoolean); + let ignoreAnnotations = getFlag(options, keys, "ignoreAnnotations", mustBeBoolean); + let jsx = getFlag(options, keys, "jsx", mustBeString); + let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString); + let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString); + let jsxImportSource = getFlag(options, keys, "jsxImportSource", mustBeString); + let jsxDev = getFlag(options, keys, "jsxDev", mustBeBoolean); + let jsxSideEffects = getFlag(options, keys, "jsxSideEffects", mustBeBoolean); + let define = getFlag(options, keys, "define", mustBeObject); + let logOverride = getFlag(options, keys, "logOverride", mustBeObject); + let supported = getFlag(options, keys, "supported", mustBeObject); + let pure = getFlag(options, keys, "pure", mustBeArrayOfStrings); + let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean); + let platform = getFlag(options, keys, "platform", mustBeString); + let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject); + let absPaths = getFlag(options, keys, "absPaths", mustBeArrayOfStrings); + if (legalComments) flags.push(`--legal-comments=${legalComments}`); + if (sourceRoot !== void 0) flags.push(`--source-root=${sourceRoot}`); + if (sourcesContent !== void 0) flags.push(`--sources-content=${sourcesContent}`); + if (target) flags.push(`--target=${validateAndJoinStringArray(Array.isArray(target) ? target : [target], "target")}`); + if (format) flags.push(`--format=${format}`); + if (globalName) flags.push(`--global-name=${globalName}`); + if (platform) flags.push(`--platform=${platform}`); + if (tsconfigRaw) flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`); + if (minify) flags.push("--minify"); + if (minifySyntax) flags.push("--minify-syntax"); + if (minifyWhitespace) flags.push("--minify-whitespace"); + if (minifyIdentifiers) flags.push("--minify-identifiers"); + if (lineLimit) flags.push(`--line-limit=${lineLimit}`); + if (charset) flags.push(`--charset=${charset}`); + if (treeShaking !== void 0) flags.push(`--tree-shaking=${treeShaking}`); + if (ignoreAnnotations) flags.push(`--ignore-annotations`); + if (drop) for (let what of drop) flags.push(`--drop:${validateStringValue(what, "drop")}`); + if (dropLabels) flags.push(`--drop-labels=${validateAndJoinStringArray(dropLabels, "drop label")}`); + if (absPaths) flags.push(`--abs-paths=${validateAndJoinStringArray(absPaths, "abs paths")}`); + if (mangleProps) flags.push(`--mangle-props=${jsRegExpToGoRegExp(mangleProps)}`); + if (reserveProps) flags.push(`--reserve-props=${jsRegExpToGoRegExp(reserveProps)}`); + if (mangleQuoted !== void 0) flags.push(`--mangle-quoted=${mangleQuoted}`); + if (jsx) flags.push(`--jsx=${jsx}`); + if (jsxFactory) flags.push(`--jsx-factory=${jsxFactory}`); + if (jsxFragment) flags.push(`--jsx-fragment=${jsxFragment}`); + if (jsxImportSource) flags.push(`--jsx-import-source=${jsxImportSource}`); + if (jsxDev) flags.push(`--jsx-dev`); + if (jsxSideEffects) flags.push(`--jsx-side-effects`); + if (define) { + for (let key in define) { + if (key.indexOf("=") >= 0) throw new Error(`Invalid define: ${key}`); + flags.push(`--define:${key}=${validateStringValue(define[key], "define", key)}`); + } + } + if (logOverride) { + for (let key in logOverride) { + if (key.indexOf("=") >= 0) throw new Error(`Invalid log override: ${key}`); + flags.push(`--log-override:${key}=${validateStringValue(logOverride[key], "log override", key)}`); + } + } + if (supported) { + for (let key in supported) { + if (key.indexOf("=") >= 0) throw new Error(`Invalid supported: ${key}`); + const value = supported[key]; + if (typeof value !== "boolean") throw new Error(`Expected value for supported ${quote(key)} to be a boolean, got ${typeof value} instead`); + flags.push(`--supported:${key}=${value}`); + } + } + if (pure) for (let fn of pure) flags.push(`--pure:${validateStringValue(fn, "pure")}`); + if (keepNames) flags.push(`--keep-names`); +} +function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeDefault) { + var _a2; + let flags = []; + let entries = []; + let keys = /* @__PURE__ */ Object.create(null); + let stdinContents = null; + let stdinResolveDir = null; + pushLogFlags(flags, options, keys, isTTY2, logLevelDefault); + pushCommonFlags(flags, options, keys); + let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean); + let bundle = getFlag(options, keys, "bundle", mustBeBoolean); + let splitting = getFlag(options, keys, "splitting", mustBeBoolean); + let preserveSymlinks = getFlag(options, keys, "preserveSymlinks", mustBeBoolean); + let metafile = getFlag(options, keys, "metafile", mustBeBoolean); + let outfile = getFlag(options, keys, "outfile", mustBeString); + let outdir = getFlag(options, keys, "outdir", mustBeString); + let outbase = getFlag(options, keys, "outbase", mustBeString); + let tsconfig = getFlag(options, keys, "tsconfig", mustBeString); + let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArrayOfStrings); + let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArrayOfStrings); + let mainFields = getFlag(options, keys, "mainFields", mustBeArrayOfStrings); + let conditions = getFlag(options, keys, "conditions", mustBeArrayOfStrings); + let external = getFlag(options, keys, "external", mustBeArrayOfStrings); + let packages = getFlag(options, keys, "packages", mustBeString); + let alias = getFlag(options, keys, "alias", mustBeObject); + let loader = getFlag(options, keys, "loader", mustBeObject); + let outExtension = getFlag(options, keys, "outExtension", mustBeObject); + let publicPath = getFlag(options, keys, "publicPath", mustBeString); + let entryNames = getFlag(options, keys, "entryNames", mustBeString); + let chunkNames = getFlag(options, keys, "chunkNames", mustBeString); + let assetNames = getFlag(options, keys, "assetNames", mustBeString); + let inject = getFlag(options, keys, "inject", mustBeArrayOfStrings); + let banner = getFlag(options, keys, "banner", mustBeObject); + let footer = getFlag(options, keys, "footer", mustBeObject); + let entryPoints = getFlag(options, keys, "entryPoints", mustBeEntryPoints); + let absWorkingDir = getFlag(options, keys, "absWorkingDir", mustBeString); + let stdin = getFlag(options, keys, "stdin", mustBeObject); + let write = (_a2 = getFlag(options, keys, "write", mustBeBoolean)) != null ? _a2 : writeDefault; + let allowOverwrite = getFlag(options, keys, "allowOverwrite", mustBeBoolean); + let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject); + keys.plugins = true; + checkForInvalidFlags(options, keys, `in ${callName}() call`); + if (sourcemap) flags.push(`--sourcemap${sourcemap === true ? "" : `=${sourcemap}`}`); + if (bundle) flags.push("--bundle"); + if (allowOverwrite) flags.push("--allow-overwrite"); + if (splitting) flags.push("--splitting"); + if (preserveSymlinks) flags.push("--preserve-symlinks"); + if (metafile) flags.push(`--metafile`); + if (outfile) flags.push(`--outfile=${outfile}`); + if (outdir) flags.push(`--outdir=${outdir}`); + if (outbase) flags.push(`--outbase=${outbase}`); + if (tsconfig) flags.push(`--tsconfig=${tsconfig}`); + if (packages) flags.push(`--packages=${packages}`); + if (resolveExtensions) flags.push(`--resolve-extensions=${validateAndJoinStringArray(resolveExtensions, "resolve extension")}`); + if (publicPath) flags.push(`--public-path=${publicPath}`); + if (entryNames) flags.push(`--entry-names=${entryNames}`); + if (chunkNames) flags.push(`--chunk-names=${chunkNames}`); + if (assetNames) flags.push(`--asset-names=${assetNames}`); + if (mainFields) flags.push(`--main-fields=${validateAndJoinStringArray(mainFields, "main field")}`); + if (conditions) flags.push(`--conditions=${validateAndJoinStringArray(conditions, "condition")}`); + if (external) for (let name of external) flags.push(`--external:${validateStringValue(name, "external")}`); + if (alias) { + for (let old in alias) { + if (old.indexOf("=") >= 0) throw new Error(`Invalid package name in alias: ${old}`); + flags.push(`--alias:${old}=${validateStringValue(alias[old], "alias", old)}`); + } + } + if (banner) { + for (let type in banner) { + if (type.indexOf("=") >= 0) throw new Error(`Invalid banner file type: ${type}`); + flags.push(`--banner:${type}=${validateStringValue(banner[type], "banner", type)}`); + } + } + if (footer) { + for (let type in footer) { + if (type.indexOf("=") >= 0) throw new Error(`Invalid footer file type: ${type}`); + flags.push(`--footer:${type}=${validateStringValue(footer[type], "footer", type)}`); + } + } + if (inject) for (let path3 of inject) flags.push(`--inject:${validateStringValue(path3, "inject")}`); + if (loader) { + for (let ext in loader) { + if (ext.indexOf("=") >= 0) throw new Error(`Invalid loader extension: ${ext}`); + flags.push(`--loader:${ext}=${validateStringValue(loader[ext], "loader", ext)}`); + } + } + if (outExtension) { + for (let ext in outExtension) { + if (ext.indexOf("=") >= 0) throw new Error(`Invalid out extension: ${ext}`); + flags.push(`--out-extension:${ext}=${validateStringValue(outExtension[ext], "out extension", ext)}`); + } + } + if (entryPoints) { + if (Array.isArray(entryPoints)) { + for (let i = 0, n = entryPoints.length; i < n; i++) { + let entryPoint = entryPoints[i]; + if (typeof entryPoint === "object" && entryPoint !== null) { + let entryPointKeys = /* @__PURE__ */ Object.create(null); + let input = getFlag(entryPoint, entryPointKeys, "in", mustBeString); + let output = getFlag(entryPoint, entryPointKeys, "out", mustBeString); + checkForInvalidFlags(entryPoint, entryPointKeys, "in entry point at index " + i); + if (input === void 0) throw new Error('Missing property "in" for entry point at index ' + i); + if (output === void 0) throw new Error('Missing property "out" for entry point at index ' + i); + entries.push([output, input]); + } else { + entries.push(["", validateStringValue(entryPoint, "entry point at index " + i)]); + } + } + } else { + for (let key in entryPoints) { + entries.push([key, validateStringValue(entryPoints[key], "entry point", key)]); + } + } + } + if (stdin) { + let stdinKeys = /* @__PURE__ */ Object.create(null); + let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array); + let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString); + let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString); + let loader2 = getFlag(stdin, stdinKeys, "loader", mustBeString); + checkForInvalidFlags(stdin, stdinKeys, 'in "stdin" object'); + if (sourcefile) flags.push(`--sourcefile=${sourcefile}`); + if (loader2) flags.push(`--loader=${loader2}`); + if (resolveDir) stdinResolveDir = resolveDir; + if (typeof contents === "string") stdinContents = encodeUTF8(contents); + else if (contents instanceof Uint8Array) stdinContents = contents; + } + let nodePaths = []; + if (nodePathsInput) { + for (let value of nodePathsInput) { + value += ""; + nodePaths.push(value); + } + } + return { + entries, + flags, + write, + stdinContents, + stdinResolveDir, + absWorkingDir, + nodePaths, + mangleCache: validateMangleCache(mangleCache) + }; +} +function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) { + let flags = []; + let keys = /* @__PURE__ */ Object.create(null); + pushLogFlags(flags, options, keys, isTTY2, logLevelDefault); + pushCommonFlags(flags, options, keys); + let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean); + let sourcefile = getFlag(options, keys, "sourcefile", mustBeString); + let loader = getFlag(options, keys, "loader", mustBeString); + let banner = getFlag(options, keys, "banner", mustBeString); + let footer = getFlag(options, keys, "footer", mustBeString); + let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject); + checkForInvalidFlags(options, keys, `in ${callName}() call`); + if (sourcemap) flags.push(`--sourcemap=${sourcemap === true ? "external" : sourcemap}`); + if (sourcefile) flags.push(`--sourcefile=${sourcefile}`); + if (loader) flags.push(`--loader=${loader}`); + if (banner) flags.push(`--banner=${banner}`); + if (footer) flags.push(`--footer=${footer}`); + return { + flags, + mangleCache: validateMangleCache(mangleCache) + }; +} +function createChannel(streamIn) { + const requestCallbacksByKey = {}; + const closeData = { didClose: false, reason: "" }; + let responseCallbacks = {}; + let nextRequestID = 0; + let nextBuildKey = 0; + let stdout = new Uint8Array(16 * 1024); + let stdoutUsed = 0; + let readFromStdout = (chunk) => { + let limit = stdoutUsed + chunk.length; + if (limit > stdout.length) { + let swap = new Uint8Array(limit * 2); + swap.set(stdout); + stdout = swap; + } + stdout.set(chunk, stdoutUsed); + stdoutUsed += chunk.length; + let offset = 0; + while (offset + 4 <= stdoutUsed) { + let length = readUInt32LE(stdout, offset); + if (offset + 4 + length > stdoutUsed) { + break; + } + offset += 4; + handleIncomingPacket(stdout.subarray(offset, offset + length)); + offset += length; + } + if (offset > 0) { + stdout.copyWithin(0, offset, stdoutUsed); + stdoutUsed -= offset; + } + }; + let afterClose = (error) => { + closeData.didClose = true; + if (error) closeData.reason = ": " + (error.message || error); + const text = "The service was stopped" + closeData.reason; + for (let id in responseCallbacks) { + responseCallbacks[id](text, null); + } + responseCallbacks = {}; + }; + let sendRequest = (refs, value, callback) => { + if (closeData.didClose) return callback("The service is no longer running" + closeData.reason, null); + let id = nextRequestID++; + responseCallbacks[id] = (error, response) => { + try { + callback(error, response); + } finally { + if (refs) refs.unref(); + } + }; + if (refs) refs.ref(); + streamIn.writeToStdin(encodePacket({ id, isRequest: true, value })); + }; + let sendResponse = (id, value) => { + if (closeData.didClose) throw new Error("The service is no longer running" + closeData.reason); + streamIn.writeToStdin(encodePacket({ id, isRequest: false, value })); + }; + let handleRequest = async (id, request) => { + try { + if (request.command === "ping") { + sendResponse(id, {}); + return; + } + if (typeof request.key === "number") { + const requestCallbacks = requestCallbacksByKey[request.key]; + if (!requestCallbacks) { + return; + } + const callback = requestCallbacks[request.command]; + if (callback) { + await callback(id, request); + return; + } + } + throw new Error(`Invalid command: ` + request.command); + } catch (e) { + const errors = [extractErrorMessageV8(e, streamIn, null, void 0, "")]; + try { + sendResponse(id, { errors }); + } catch { + } + } + }; + let isFirstPacket = true; + let handleIncomingPacket = (bytes) => { + if (isFirstPacket) { + isFirstPacket = false; + let binaryVersion = String.fromCharCode(...bytes); + if (binaryVersion !== "0.28.2") { + throw new Error(`Cannot start service: Host version "${"0.28.2"}" does not match binary version ${quote(binaryVersion)}`); + } + return; + } + let packet = decodePacket(bytes); + if (packet.isRequest) { + handleRequest(packet.id, packet.value); + } else { + let callback = responseCallbacks[packet.id]; + delete responseCallbacks[packet.id]; + if (packet.value.error) callback(packet.value.error, {}); + else callback(null, packet.value); + } + }; + let buildOrContext = ({ callName, refs, options, isTTY: isTTY2, defaultWD: defaultWD2, callback }) => { + let refCount = 0; + const buildKey = nextBuildKey++; + const requestCallbacks = {}; + const buildRefs = { + ref() { + if (++refCount === 1) { + if (refs) refs.ref(); + } + }, + unref() { + if (--refCount === 0) { + delete requestCallbacksByKey[buildKey]; + if (refs) refs.unref(); + } + } + }; + requestCallbacksByKey[buildKey] = requestCallbacks; + buildRefs.ref(); + buildOrContextImpl( + callName, + buildKey, + sendRequest, + sendResponse, + buildRefs, + streamIn, + requestCallbacks, + options, + isTTY2, + defaultWD2, + (err, res) => { + try { + callback(err, res); + } finally { + buildRefs.unref(); + } + } + ); + }; + let transform2 = ({ callName, refs, input, options, isTTY: isTTY2, fs: fs3, callback }) => { + const details = createObjectStash(); + let start = (inputPath) => { + try { + if (typeof input !== "string" && !(input instanceof Uint8Array)) + throw new Error('The input to "transform" must be a string or a Uint8Array'); + let { + flags, + mangleCache + } = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault); + let request = { + command: "transform", + flags, + inputFS: inputPath !== null, + input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input + }; + if (mangleCache) request.mangleCache = mangleCache; + sendRequest(refs, request, (error, response) => { + if (error) return callback(new Error(error), null); + let errors = replaceDetailsInMessages(response.errors, details); + let warnings = replaceDetailsInMessages(response.warnings, details); + let outstanding = 1; + let next = () => { + if (--outstanding === 0) { + let result = { + warnings, + code: response.code, + map: response.map, + mangleCache: void 0, + legalComments: void 0 + }; + if ("legalComments" in response) result.legalComments = response == null ? void 0 : response.legalComments; + if (response.mangleCache) result.mangleCache = response == null ? void 0 : response.mangleCache; + callback(null, result); + } + }; + if (errors.length > 0) return callback(failureErrorWithLog("Transform failed", errors, warnings), null); + if (response.codeFS) { + outstanding++; + fs3.readFile(response.code, (err, contents) => { + if (err !== null) { + callback(err, null); + } else { + response.code = contents; + next(); + } + }); + } + if (response.mapFS) { + outstanding++; + fs3.readFile(response.map, (err, contents) => { + if (err !== null) { + callback(err, null); + } else { + response.map = contents; + next(); + } + }); + } + next(); + }); + } catch (e) { + let flags = []; + try { + pushLogFlags(flags, options, {}, isTTY2, transformLogLevelDefault); + } catch { + } + const error = extractErrorMessageV8(e, streamIn, details, void 0, ""); + sendRequest(refs, { command: "error", flags, error }, () => { + error.detail = details.load(error.detail); + callback(failureErrorWithLog("Transform failed", [error], []), null); + }); + } + }; + if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) { + let next = start; + start = () => fs3.writeFile(input, next); + } + start(null); + }; + let formatMessages2 = ({ callName, refs, messages, options, callback }) => { + if (!options) throw new Error(`Missing second argument in ${callName}() call`); + let keys = {}; + let kind = getFlag(options, keys, "kind", mustBeString); + let color = getFlag(options, keys, "color", mustBeBoolean); + let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger); + let logStyle = getFlag(options, keys, "logStyle", mustBeString); + checkForInvalidFlags(options, keys, `in ${callName}() call`); + if (kind === void 0) throw new Error(`Missing "kind" in ${callName}() call`); + if (kind !== "error" && kind !== "warning") throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`); + let request = { + command: "format-msgs", + messages: sanitizeMessages(messages, "messages", null, "", terminalWidth), + isWarning: kind === "warning" + }; + if (color !== void 0) request.color = color; + if (terminalWidth !== void 0) request.terminalWidth = terminalWidth; + if (logStyle !== void 0) request.logStyle = logStyle; + sendRequest(refs, request, (error, response) => { + if (error) return callback(new Error(error), null); + callback(null, response.messages); + }); + }; + let analyzeMetafile2 = ({ callName, refs, metafile, options, callback }) => { + if (options === void 0) options = {}; + let keys = {}; + let color = getFlag(options, keys, "color", mustBeBoolean); + let verbose = getFlag(options, keys, "verbose", mustBeBoolean); + checkForInvalidFlags(options, keys, `in ${callName}() call`); + let request = { + command: "analyze-metafile", + metafile + }; + if (color !== void 0) request.color = color; + if (verbose !== void 0) request.verbose = verbose; + sendRequest(refs, request, (error, response) => { + if (error) return callback(new Error(error), null); + callback(null, response.result); + }); + }; + return { + readFromStdout, + afterClose, + service: { + buildOrContext, + transform: transform2, + formatMessages: formatMessages2, + analyzeMetafile: analyzeMetafile2 + } + }; +} +function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, options, isTTY2, defaultWD2, callback) { + const details = createObjectStash(); + const isContext = callName === "context"; + const handleError = (e, pluginName) => { + const flags = []; + try { + pushLogFlags(flags, options, {}, isTTY2, buildLogLevelDefault); + } catch { + } + const message = extractErrorMessageV8(e, streamIn, details, void 0, pluginName); + sendRequest(refs, { command: "error", flags, error: message }, () => { + message.detail = details.load(message.detail); + callback(failureErrorWithLog(isContext ? "Context failed" : "Build failed", [message], []), null); + }); + }; + let plugins; + if (typeof options === "object") { + const value = options.plugins; + if (value !== void 0) { + if (!Array.isArray(value)) return handleError(new Error(`"plugins" must be an array`), ""); + plugins = value; + } + } + if (plugins && plugins.length > 0) { + if (streamIn.isSync) return handleError(new Error("Cannot use plugins in synchronous API calls"), ""); + handlePlugins( + buildKey, + sendRequest, + sendResponse, + refs, + streamIn, + requestCallbacks, + options, + plugins, + details + ).then( + (result) => { + if (!result.ok) return handleError(result.error, result.pluginName); + try { + buildOrContextContinue(result.requestPlugins, result.runOnEndCallbacks, result.scheduleOnDisposeCallbacks); + } catch (e) { + handleError(e, ""); + } + }, + (e) => handleError(e, "") + ); + return; + } + try { + buildOrContextContinue(null, (result, done) => done([], []), () => { + }); + } catch (e) { + handleError(e, ""); + } + function buildOrContextContinue(requestPlugins, runOnEndCallbacks, scheduleOnDisposeCallbacks) { + const writeDefault = streamIn.hasFS; + const { + entries, + flags, + write, + stdinContents, + stdinResolveDir, + absWorkingDir, + nodePaths, + mangleCache + } = flagsForBuildOptions(callName, options, isTTY2, buildLogLevelDefault, writeDefault); + if (write && !streamIn.hasFS) throw new Error(`The "write" option is unavailable in this environment`); + const request = { + command: "build", + key: buildKey, + entries, + flags, + write, + stdinContents, + stdinResolveDir, + absWorkingDir: absWorkingDir || defaultWD2, + nodePaths, + context: isContext + }; + if (requestPlugins) request.plugins = requestPlugins; + if (mangleCache) request.mangleCache = mangleCache; + const buildResponseToResult = (response, callback2) => { + const result = { + errors: replaceDetailsInMessages(response.errors, details), + warnings: replaceDetailsInMessages(response.warnings, details), + outputFiles: void 0, + metafile: void 0, + mangleCache: void 0 + }; + const originalErrors = result.errors.slice(); + const originalWarnings = result.warnings.slice(); + if (response.outputFiles) result.outputFiles = response.outputFiles.map(convertOutputFiles); + if (response.metafile && response.metafile.length) result.metafile = parseJSON(response.metafile); + if (response.mangleCache) result.mangleCache = response.mangleCache; + if (response.writeToStdout !== void 0) console.log(decodeUTF8(response.writeToStdout).replace(/\n$/, "")); + runOnEndCallbacks(result, (onEndErrors, onEndWarnings) => { + if (originalErrors.length > 0 || onEndErrors.length > 0) { + const error = failureErrorWithLog("Build failed", originalErrors.concat(onEndErrors), originalWarnings.concat(onEndWarnings)); + return callback2(error, null, onEndErrors, onEndWarnings); + } + callback2(null, result, onEndErrors, onEndWarnings); + }); + }; + let latestResultPromise; + let provideLatestResult; + if (isContext) + requestCallbacks["on-end"] = (id, request2) => new Promise((resolve) => { + buildResponseToResult(request2, (err, result, onEndErrors, onEndWarnings) => { + const response = { + errors: onEndErrors, + warnings: onEndWarnings + }; + if (provideLatestResult) provideLatestResult(err, result); + latestResultPromise = void 0; + provideLatestResult = void 0; + sendResponse(id, response); + resolve(); + }); + }); + sendRequest(refs, request, (error, response) => { + if (error) return callback(new Error(error), null); + if (!isContext) { + return buildResponseToResult(response, (err, res) => { + scheduleOnDisposeCallbacks(); + return callback(err, res); + }); + } + if (response.errors.length > 0) { + return callback(failureErrorWithLog("Context failed", response.errors, response.warnings), null); + } + let didDispose = false; + const result = { + rebuild: () => { + if (!latestResultPromise) latestResultPromise = new Promise((resolve, reject) => { + let settlePromise; + provideLatestResult = (err, result2) => { + if (!settlePromise) settlePromise = () => err ? reject(err) : resolve(result2); + }; + const triggerAnotherBuild = () => { + const request2 = { + command: "rebuild", + key: buildKey + }; + sendRequest(refs, request2, (error2, response2) => { + if (error2) { + reject(new Error(error2)); + } else if (settlePromise) { + settlePromise(); + } else { + triggerAnotherBuild(); + } + }); + }; + triggerAnotherBuild(); + }); + return latestResultPromise; + }, + watch: (options2 = {}) => new Promise((resolve, reject) => { + if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`); + const keys = {}; + const delay = getFlag(options2, keys, "delay", mustBeInteger); + checkForInvalidFlags(options2, keys, `in watch() call`); + const request2 = { + command: "watch", + key: buildKey + }; + if (delay) request2.delay = delay; + sendRequest(refs, request2, (error2) => { + if (error2) reject(new Error(error2)); + else resolve(void 0); + }); + }), + serve: (options2 = {}) => new Promise((resolve, reject) => { + if (!streamIn.hasFS) throw new Error(`Cannot use the "serve" API in this environment`); + const keys = {}; + const port = getFlag(options2, keys, "port", mustBeValidPortNumber); + const host = getFlag(options2, keys, "host", mustBeString); + const servedir = getFlag(options2, keys, "servedir", mustBeString); + const keyfile = getFlag(options2, keys, "keyfile", mustBeString); + const certfile = getFlag(options2, keys, "certfile", mustBeString); + const fallback = getFlag(options2, keys, "fallback", mustBeString); + const cors = getFlag(options2, keys, "cors", mustBeObject); + const onRequest = getFlag(options2, keys, "onRequest", mustBeFunction); + checkForInvalidFlags(options2, keys, `in serve() call`); + const request2 = { + command: "serve", + key: buildKey, + onRequest: !!onRequest + }; + if (port !== void 0) request2.port = port; + if (host !== void 0) request2.host = host; + if (servedir !== void 0) request2.servedir = servedir; + if (keyfile !== void 0) request2.keyfile = keyfile; + if (certfile !== void 0) request2.certfile = certfile; + if (fallback !== void 0) request2.fallback = fallback; + if (cors) { + const corsKeys = {}; + const origin = getFlag(cors, corsKeys, "origin", mustBeStringOrArrayOfStrings); + checkForInvalidFlags(cors, corsKeys, `on "cors" object`); + if (Array.isArray(origin)) request2.corsOrigin = origin; + else if (origin !== void 0) request2.corsOrigin = [origin]; + } + sendRequest(refs, request2, (error2, response2) => { + if (error2) return reject(new Error(error2)); + if (onRequest) { + requestCallbacks["serve-request"] = (id, request3) => { + onRequest(request3.args); + sendResponse(id, {}); + }; + } + resolve(response2); + }); + }), + cancel: () => new Promise((resolve) => { + if (didDispose) return resolve(); + const request2 = { + command: "cancel", + key: buildKey + }; + sendRequest(refs, request2, () => { + resolve(); + }); + }), + dispose: () => new Promise((resolve) => { + if (didDispose) return resolve(); + didDispose = true; + const request2 = { + command: "dispose", + key: buildKey + }; + sendRequest(refs, request2, () => { + resolve(); + scheduleOnDisposeCallbacks(); + refs.unref(); + }); + }) + }; + refs.ref(); + callback(null, result); + }); + } +} +var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, initialOptions, plugins, details) => { + let onStartCallbacks = []; + let onEndCallbacks = []; + let onResolveCallbacks = {}; + let onLoadCallbacks = {}; + let onDisposeCallbacks = []; + let nextCallbackID = 0; + let i = 0; + let requestPlugins = []; + let isSetupDone = false; + plugins = [...plugins]; + for (let item of plugins) { + let keys = {}; + if (typeof item !== "object") throw new Error(`Plugin at index ${i} must be an object`); + const name = getFlag(item, keys, "name", mustBeString); + if (typeof name !== "string" || name === "") throw new Error(`Plugin at index ${i} is missing a name`); + try { + let setup = getFlag(item, keys, "setup", mustBeFunction); + if (typeof setup !== "function") throw new Error(`Plugin is missing a setup function`); + checkForInvalidFlags(item, keys, `on plugin ${quote(name)}`); + let plugin = { + name, + onStart: false, + onEnd: false, + onResolve: [], + onLoad: [] + }; + i++; + let resolve = (path3, options = {}) => { + if (!isSetupDone) throw new Error('Cannot call "resolve" before plugin setup has completed'); + if (typeof path3 !== "string") throw new Error(`The path to resolve must be a string`); + let keys2 = /* @__PURE__ */ Object.create(null); + let pluginName = getFlag(options, keys2, "pluginName", mustBeString); + let importer = getFlag(options, keys2, "importer", mustBeString); + let namespace = getFlag(options, keys2, "namespace", mustBeString); + let resolveDir = getFlag(options, keys2, "resolveDir", mustBeString); + let kind = getFlag(options, keys2, "kind", mustBeString); + let pluginData = getFlag(options, keys2, "pluginData", canBeAnything); + let importAttributes = getFlag(options, keys2, "with", mustBeObject); + checkForInvalidFlags(options, keys2, "in resolve() call"); + return new Promise((resolve2, reject) => { + const request = { + command: "resolve", + path: path3, + key: buildKey, + pluginName: name + }; + if (pluginName != null) request.pluginName = pluginName; + if (importer != null) request.importer = importer; + if (namespace != null) request.namespace = namespace; + if (resolveDir != null) request.resolveDir = resolveDir; + if (kind != null) request.kind = kind; + else throw new Error(`Must specify "kind" when calling "resolve"`); + if (pluginData != null) request.pluginData = details.store(pluginData); + if (importAttributes != null) request.with = sanitizeStringMap(importAttributes, "with"); + sendRequest(refs, request, (error, response) => { + if (error !== null) reject(new Error(error)); + else resolve2({ + errors: replaceDetailsInMessages(response.errors, details), + warnings: replaceDetailsInMessages(response.warnings, details), + path: response.path, + external: response.external, + sideEffects: response.sideEffects, + namespace: response.namespace, + suffix: response.suffix, + pluginData: details.load(response.pluginData) + }); + }); + }); + }; + let promise = setup({ + initialOptions, + resolve, + onStart(callback) { + let registeredText = `This error came from the "onStart" callback registered here:`; + let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart"); + onStartCallbacks.push({ name, callback, note: registeredNote }); + plugin.onStart = true; + }, + onEnd(callback) { + let registeredText = `This error came from the "onEnd" callback registered here:`; + let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onEnd"); + onEndCallbacks.push({ name, callback, note: registeredNote }); + plugin.onEnd = true; + }, + onResolve(options, callback) { + let registeredText = `This error came from the "onResolve" callback registered here:`; + let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onResolve"); + let keys2 = {}; + let filter = getFlag(options, keys2, "filter", mustBeRegExp); + let namespace = getFlag(options, keys2, "namespace", mustBeString); + checkForInvalidFlags(options, keys2, `in onResolve() call for plugin ${quote(name)}`); + if (filter == null) throw new Error(`onResolve() call is missing a filter`); + let id = nextCallbackID++; + onResolveCallbacks[id] = { name, callback, note: registeredNote }; + plugin.onResolve.push({ id, filter: jsRegExpToGoRegExp(filter), namespace: namespace || "" }); + }, + onLoad(options, callback) { + let registeredText = `This error came from the "onLoad" callback registered here:`; + let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onLoad"); + let keys2 = {}; + let filter = getFlag(options, keys2, "filter", mustBeRegExp); + let namespace = getFlag(options, keys2, "namespace", mustBeString); + checkForInvalidFlags(options, keys2, `in onLoad() call for plugin ${quote(name)}`); + if (filter == null) throw new Error(`onLoad() call is missing a filter`); + let id = nextCallbackID++; + onLoadCallbacks[id] = { name, callback, note: registeredNote }; + plugin.onLoad.push({ id, filter: jsRegExpToGoRegExp(filter), namespace: namespace || "" }); + }, + onDispose(callback) { + onDisposeCallbacks.push(callback); + }, + esbuild: streamIn.esbuild + }); + if (promise) await promise; + requestPlugins.push(plugin); + } catch (e) { + return { ok: false, error: e, pluginName: name }; + } + } + requestCallbacks["on-start"] = async (id, request) => { + details.clear(); + let response = { errors: [], warnings: [] }; + await Promise.all(onStartCallbacks.map(async ({ name, callback, note }) => { + try { + let result = await callback(); + if (result != null) { + if (typeof result !== "object") throw new Error(`Expected onStart() callback in plugin ${quote(name)} to return an object`); + let keys = {}; + let errors = getFlag(result, keys, "errors", mustBeArray); + let warnings = getFlag(result, keys, "warnings", mustBeArray); + checkForInvalidFlags(result, keys, `from onStart() callback in plugin ${quote(name)}`); + if (errors != null) response.errors.push(...sanitizeMessages(errors, "errors", details, name, void 0)); + if (warnings != null) response.warnings.push(...sanitizeMessages(warnings, "warnings", details, name, void 0)); + } + } catch (e) { + response.errors.push(extractErrorMessageV8(e, streamIn, details, note && note(), name)); + } + })); + sendResponse(id, response); + }; + requestCallbacks["on-resolve"] = async (id, request) => { + let response = {}, name = "", callback, note; + for (let id2 of request.ids) { + try { + ({ name, callback, note } = onResolveCallbacks[id2]); + let result = await callback({ + path: request.path, + importer: request.importer, + namespace: request.namespace, + resolveDir: request.resolveDir, + kind: request.kind, + pluginData: details.load(request.pluginData), + with: request.with + }); + if (result != null) { + if (typeof result !== "object") throw new Error(`Expected onResolve() callback in plugin ${quote(name)} to return an object`); + let keys = {}; + let pluginName = getFlag(result, keys, "pluginName", mustBeString); + let path3 = getFlag(result, keys, "path", mustBeString); + let namespace = getFlag(result, keys, "namespace", mustBeString); + let suffix = getFlag(result, keys, "suffix", mustBeString); + let external = getFlag(result, keys, "external", mustBeBoolean); + let sideEffects = getFlag(result, keys, "sideEffects", mustBeBoolean); + let pluginData = getFlag(result, keys, "pluginData", canBeAnything); + let errors = getFlag(result, keys, "errors", mustBeArray); + let warnings = getFlag(result, keys, "warnings", mustBeArray); + let watchFiles = getFlag(result, keys, "watchFiles", mustBeArrayOfStrings); + let watchDirs = getFlag(result, keys, "watchDirs", mustBeArrayOfStrings); + checkForInvalidFlags(result, keys, `from onResolve() callback in plugin ${quote(name)}`); + response.id = id2; + if (pluginName != null) response.pluginName = pluginName; + if (path3 != null) response.path = path3; + if (namespace != null) response.namespace = namespace; + if (suffix != null) response.suffix = suffix; + if (external != null) response.external = external; + if (sideEffects != null) response.sideEffects = sideEffects; + if (pluginData != null) response.pluginData = details.store(pluginData); + if (errors != null) response.errors = sanitizeMessages(errors, "errors", details, name, void 0); + if (warnings != null) response.warnings = sanitizeMessages(warnings, "warnings", details, name, void 0); + if (watchFiles != null) response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles"); + if (watchDirs != null) response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs"); + break; + } + } catch (e) { + response = { id: id2, errors: [extractErrorMessageV8(e, streamIn, details, note && note(), name)] }; + break; + } + } + sendResponse(id, response); + }; + requestCallbacks["on-load"] = async (id, request) => { + let response = {}, name = "", callback, note; + for (let id2 of request.ids) { + try { + ({ name, callback, note } = onLoadCallbacks[id2]); + let result = await callback({ + path: request.path, + namespace: request.namespace, + suffix: request.suffix, + pluginData: details.load(request.pluginData), + with: request.with + }); + if (result != null) { + if (typeof result !== "object") throw new Error(`Expected onLoad() callback in plugin ${quote(name)} to return an object`); + let keys = {}; + let pluginName = getFlag(result, keys, "pluginName", mustBeString); + let contents = getFlag(result, keys, "contents", mustBeStringOrUint8Array); + let resolveDir = getFlag(result, keys, "resolveDir", mustBeString); + let pluginData = getFlag(result, keys, "pluginData", canBeAnything); + let loader = getFlag(result, keys, "loader", mustBeString); + let errors = getFlag(result, keys, "errors", mustBeArray); + let warnings = getFlag(result, keys, "warnings", mustBeArray); + let watchFiles = getFlag(result, keys, "watchFiles", mustBeArrayOfStrings); + let watchDirs = getFlag(result, keys, "watchDirs", mustBeArrayOfStrings); + checkForInvalidFlags(result, keys, `from onLoad() callback in plugin ${quote(name)}`); + response.id = id2; + if (pluginName != null) response.pluginName = pluginName; + if (contents instanceof Uint8Array) response.contents = contents; + else if (contents != null) response.contents = encodeUTF8(contents); + if (resolveDir != null) response.resolveDir = resolveDir; + if (pluginData != null) response.pluginData = details.store(pluginData); + if (loader != null) response.loader = loader; + if (errors != null) response.errors = sanitizeMessages(errors, "errors", details, name, void 0); + if (warnings != null) response.warnings = sanitizeMessages(warnings, "warnings", details, name, void 0); + if (watchFiles != null) response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles"); + if (watchDirs != null) response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs"); + break; + } + } catch (e) { + response = { id: id2, errors: [extractErrorMessageV8(e, streamIn, details, note && note(), name)] }; + break; + } + } + sendResponse(id, response); + }; + let runOnEndCallbacks = (result, done) => done([], []); + if (onEndCallbacks.length > 0) { + runOnEndCallbacks = (result, done) => { + (async () => { + const onEndErrors = []; + const onEndWarnings = []; + for (const { name, callback, note } of onEndCallbacks) { + let newErrors; + let newWarnings; + try { + const value = await callback(result); + if (value != null) { + if (typeof value !== "object") throw new Error(`Expected onEnd() callback in plugin ${quote(name)} to return an object`); + let keys = {}; + let errors = getFlag(value, keys, "errors", mustBeArray); + let warnings = getFlag(value, keys, "warnings", mustBeArray); + checkForInvalidFlags(value, keys, `from onEnd() callback in plugin ${quote(name)}`); + if (errors != null) newErrors = sanitizeMessages(errors, "errors", details, name, void 0); + if (warnings != null) newWarnings = sanitizeMessages(warnings, "warnings", details, name, void 0); + } + } catch (e) { + newErrors = [extractErrorMessageV8(e, streamIn, details, note && note(), name)]; + } + if (newErrors) { + onEndErrors.push(...newErrors); + try { + result.errors.push(...newErrors); + } catch { + } + } + if (newWarnings) { + onEndWarnings.push(...newWarnings); + try { + result.warnings.push(...newWarnings); + } catch { + } + } + } + done(onEndErrors, onEndWarnings); + })(); + }; + } + let scheduleOnDisposeCallbacks = () => { + for (const cb of onDisposeCallbacks) { + setTimeout(() => cb(), 0); + } + }; + isSetupDone = true; + return { + ok: true, + requestPlugins, + runOnEndCallbacks, + scheduleOnDisposeCallbacks + }; +}; +function createObjectStash() { + const map = /* @__PURE__ */ new Map(); + let nextID = 0; + return { + clear() { + map.clear(); + }, + load(id) { + return map.get(id); + }, + store(value) { + if (value === void 0) return -1; + const id = nextID++; + map.set(id, value); + return id; + } + }; +} +function extractCallerV8(e, streamIn, ident) { + let note; + let tried = false; + return () => { + if (tried) return note; + tried = true; + try { + let lines = (e.stack + "").split("\n"); + lines.splice(1, 1); + let location = parseStackLinesV8(streamIn, lines, ident); + if (location) { + note = { text: e.message, location }; + return note; + } + } catch { + } + }; +} +function extractErrorMessageV8(e, streamIn, stash, note, pluginName) { + let text = "Internal error"; + let location = null; + try { + text = (e && e.message || e) + ""; + } catch { + } + try { + location = parseStackLinesV8(streamIn, (e.stack + "").split("\n"), ""); + } catch { + } + return { id: "", pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 }; +} +function parseStackLinesV8(streamIn, lines, ident) { + let at = " at "; + if (streamIn.readFileSync && !lines[0].startsWith(at) && lines[1].startsWith(at)) { + for (let i = 1; i < lines.length; i++) { + let line = lines[i]; + if (!line.startsWith(at)) continue; + line = line.slice(at.length); + while (true) { + let match = /^(?:new |async )?\S+ \((.*)\)$/.exec(line); + if (match) { + line = match[1]; + continue; + } + match = /^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(line); + if (match) { + line = match[1]; + continue; + } + match = /^(\S+):(\d+):(\d+)$/.exec(line); + if (match) { + let contents; + try { + contents = streamIn.readFileSync(match[1], "utf8"); + } catch { + break; + } + let lineText = contents.split(/\r\n|\r|\n|\u2028|\u2029/)[+match[2] - 1] || ""; + let column = +match[3] - 1; + let length = lineText.slice(column, column + ident.length) === ident ? ident.length : 0; + return { + file: match[1], + namespace: "file", + line: +match[2], + column: encodeUTF8(lineText.slice(0, column)).length, + length: encodeUTF8(lineText.slice(column, column + length)).length, + lineText: lineText + "\n" + lines.slice(1).join("\n"), + suggestion: "" + }; + } + break; + } + } + } + return null; +} +function failureErrorWithLog(text, errors, warnings) { + let limit = 5; + text += errors.length < 1 ? "" : ` with ${errors.length} error${errors.length < 2 ? "" : "s"}:` + errors.slice(0, limit + 1).map((e, i) => { + if (i === limit) return "\n..."; + if (!e.location) return ` +error: ${e.text}`; + let { file, line, column } = e.location; + let pluginText = e.pluginName ? `[plugin: ${e.pluginName}] ` : ""; + return ` +${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`; + }).join(""); + let error = new Error(text); + for (const [key, value] of [["errors", errors], ["warnings", warnings]]) { + Object.defineProperty(error, key, { + configurable: true, + enumerable: true, + get: () => value, + set: (value2) => Object.defineProperty(error, key, { + configurable: true, + enumerable: true, + value: value2 + }) + }); + } + return error; +} +function replaceDetailsInMessages(messages, stash) { + for (const message of messages) { + message.detail = stash.load(message.detail); + } + return messages; +} +function sanitizeLocation(location, where, terminalWidth) { + if (location == null) return null; + let keys = {}; + let file = getFlag(location, keys, "file", mustBeString); + let namespace = getFlag(location, keys, "namespace", mustBeString); + let line = getFlag(location, keys, "line", mustBeInteger); + let column = getFlag(location, keys, "column", mustBeInteger); + let length = getFlag(location, keys, "length", mustBeInteger); + let lineText = getFlag(location, keys, "lineText", mustBeString); + let suggestion = getFlag(location, keys, "suggestion", mustBeString); + checkForInvalidFlags(location, keys, where); + if (lineText) { + const relevantASCII = lineText.slice( + 0, + (column && column > 0 ? column : 0) + (length && length > 0 ? length : 0) + (terminalWidth && terminalWidth > 0 ? terminalWidth : 80) + ); + if (!/[\x7F-\uFFFF]/.test(relevantASCII) && !/\n/.test(lineText)) { + lineText = relevantASCII; + } + } + return { + file: file || "", + namespace: namespace || "", + line: line || 0, + column: column || 0, + length: length || 0, + lineText: lineText || "", + suggestion: suggestion || "" + }; +} +function sanitizeMessages(messages, property, stash, fallbackPluginName, terminalWidth) { + let messagesClone = []; + let index = 0; + for (const message of messages) { + let keys = {}; + let id = getFlag(message, keys, "id", mustBeString); + let pluginName = getFlag(message, keys, "pluginName", mustBeString); + let text = getFlag(message, keys, "text", mustBeString); + let location = getFlag(message, keys, "location", mustBeObjectOrNull); + let notes = getFlag(message, keys, "notes", mustBeArray); + let detail = getFlag(message, keys, "detail", canBeAnything); + let where = `in element ${index} of "${property}"`; + checkForInvalidFlags(message, keys, where); + let notesClone = []; + if (notes) { + for (const note of notes) { + let noteKeys = {}; + let noteText = getFlag(note, noteKeys, "text", mustBeString); + let noteLocation = getFlag(note, noteKeys, "location", mustBeObjectOrNull); + checkForInvalidFlags(note, noteKeys, where); + notesClone.push({ + text: noteText || "", + location: sanitizeLocation(noteLocation, where, terminalWidth) + }); + } + } + messagesClone.push({ + id: id || "", + pluginName: pluginName || fallbackPluginName, + text: text || "", + location: sanitizeLocation(location, where, terminalWidth), + notes: notesClone, + detail: stash ? stash.store(detail) : -1 + }); + index++; + } + return messagesClone; +} +function sanitizeStringArray(values, property) { + const result = []; + for (const value of values) { + if (typeof value !== "string") throw new Error(`${quote(property)} must be an array of strings`); + result.push(value); + } + return result; +} +function sanitizeStringMap(map, property) { + const result = /* @__PURE__ */ Object.create(null); + for (const key in map) { + const value = map[key]; + if (typeof value !== "string") throw new Error(`key ${quote(key)} in object ${quote(property)} must be a string`); + result[key] = value; + } + return result; +} +function convertOutputFiles({ path: path3, contents, hash }) { + let text = null; + return { + path: path3, + contents, + hash, + get text() { + const binary = this.contents; + if (text === null || binary !== contents) { + contents = binary; + text = decodeUTF8(binary); + } + return text; + } + }; +} +function jsRegExpToGoRegExp(regexp) { + let result = regexp.source; + if (regexp.flags) result = `(?${regexp.flags})${result}`; + return result; +} +function parseJSON(bytes) { + let text; + try { + text = decodeUTF8(bytes); + } catch { + return JSON_parse(bytes); + } + return JSON.parse(text); +} + +// lib/npm/node-platform.ts +var fs = require("fs"); +var os = require("os"); +var path = require("path"); +var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH; +var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild"; +var packageDarwin_arm64 = "@esbuild/darwin-arm64"; +var packageDarwin_x64 = "@esbuild/darwin-x64"; +var knownWindowsPackages = { + "win32 arm64 LE": "@esbuild/win32-arm64", + "win32 ia32 LE": "@esbuild/win32-ia32", + "win32 x64 LE": "@esbuild/win32-x64" +}; +var knownUnixlikePackages = { + "aix ppc64 BE": "@esbuild/aix-ppc64", + "android arm64 LE": "@esbuild/android-arm64", + "darwin arm64 LE": "@esbuild/darwin-arm64", + "darwin x64 LE": "@esbuild/darwin-x64", + "freebsd arm64 LE": "@esbuild/freebsd-arm64", + "freebsd x64 LE": "@esbuild/freebsd-x64", + "linux arm LE": "@esbuild/linux-arm", + "linux arm64 LE": "@esbuild/linux-arm64", + "linux ia32 LE": "@esbuild/linux-ia32", + "linux mips64el LE": "@esbuild/linux-mips64el", + "linux ppc64 LE": "@esbuild/linux-ppc64", + "linux riscv64 LE": "@esbuild/linux-riscv64", + "linux s390x BE": "@esbuild/linux-s390x", + "linux x64 LE": "@esbuild/linux-x64", + "linux loong64 LE": "@esbuild/linux-loong64", + "netbsd arm64 LE": "@esbuild/netbsd-arm64", + "netbsd x64 LE": "@esbuild/netbsd-x64", + "openbsd arm64 LE": "@esbuild/openbsd-arm64", + "openbsd x64 LE": "@esbuild/openbsd-x64", + "sunos x64 LE": "@esbuild/sunos-x64" +}; +var knownWebAssemblyFallbackPackages = { + "android arm LE": "@esbuild/android-arm", + "android x64 LE": "@esbuild/android-x64", + "openharmony arm64 LE": "@esbuild/openharmony-arm64" +}; +function pkgAndSubpathForCurrentPlatform() { + let pkg; + let subpath; + let isWASM = false; + let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`; + if (platformKey in knownWindowsPackages) { + pkg = knownWindowsPackages[platformKey]; + subpath = "esbuild.exe"; + } else if (platformKey in knownUnixlikePackages) { + pkg = knownUnixlikePackages[platformKey]; + subpath = "bin/esbuild"; + } else if (platformKey in knownWebAssemblyFallbackPackages) { + pkg = knownWebAssemblyFallbackPackages[platformKey]; + subpath = "bin/esbuild"; + isWASM = true; + } else { + throw new Error(`Unsupported platform: ${platformKey}`); + } + return { pkg, subpath, isWASM }; +} +function pkgForSomeOtherPlatform() { + const libMainJS = require.resolve("esbuild"); + const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS))); + if (path.basename(nodeModulesDirectory) === "node_modules") { + for (const unixKey in knownUnixlikePackages) { + try { + const pkg = knownUnixlikePackages[unixKey]; + if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg; + } catch { + } + } + for (const windowsKey in knownWindowsPackages) { + try { + const pkg = knownWindowsPackages[windowsKey]; + if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg; + } catch { + } + } + } + return null; +} +function downloadedBinPath(pkg, subpath) { + const esbuildLibDir = path.dirname(require.resolve("esbuild")); + return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`); +} +function generateBinPath() { + if (isValidBinaryPath(ESBUILD_BINARY_PATH)) { + if (!fs.existsSync(ESBUILD_BINARY_PATH)) { + console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`); + } else { + return { binPath: ESBUILD_BINARY_PATH, isWASM: false }; + } + } + const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform(); + let binPath; + try { + binPath = require.resolve(`${pkg}/${subpath}`); + } catch (e) { + binPath = downloadedBinPath(pkg, subpath); + if (!fs.existsSync(binPath)) { + try { + require.resolve(pkg); + } catch { + const otherPkg = pkgForSomeOtherPlatform(); + if (otherPkg) { + let suggestions = ` +Specifically the "${otherPkg}" package is present but this platform +needs the "${pkg}" package instead. People often get into this +situation by installing esbuild on Windows or macOS and copying "node_modules" +into a Docker image that runs Linux, or by copying "node_modules" between +Windows and WSL environments. + +If you are installing with npm, you can try not copying the "node_modules" +directory when you copy the files over, and running "npm ci" or "npm install" +on the destination platform after the copy. Or you could consider using yarn +instead of npm which has built-in support for installing a package on multiple +platforms simultaneously. + +If you are installing with yarn, you can try listing both this platform and the +other platform in your ".yarnrc.yml" file using the "supportedArchitectures" +feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures +Keep in mind that this means multiple copies of esbuild will be present. +`; + if (pkg === packageDarwin_x64 && otherPkg === packageDarwin_arm64 || pkg === packageDarwin_arm64 && otherPkg === packageDarwin_x64) { + suggestions = ` +Specifically the "${otherPkg}" package is present but this platform +needs the "${pkg}" package instead. People often get into this +situation by installing esbuild with npm running inside of Rosetta 2 and then +trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta +2 is Apple's on-the-fly x86_64-to-arm64 translation service). + +If you are installing with npm, you can try ensuring that both npm and node are +not running under Rosetta 2 and then reinstalling esbuild. This likely involves +changing how you installed npm and/or node. For example, installing node with +the universal installer here should work: https://nodejs.org/en/download/. Or +you could consider using yarn instead of npm which has built-in support for +installing a package on multiple platforms simultaneously. + +If you are installing with yarn, you can try listing both "arm64" and "x64" +in your ".yarnrc.yml" file using the "supportedArchitectures" feature: +https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures +Keep in mind that this means multiple copies of esbuild will be present. +`; + } + throw new Error(` +You installed esbuild for another platform than the one you're currently using. +This won't work because esbuild is written with native code and needs to +install a platform-specific binary executable. +${suggestions} +Another alternative is to use the "esbuild-wasm" package instead, which works +the same way on all platforms. But it comes with a heavy performance cost and +can sometimes be 10x slower than the "esbuild" package, so you may also not +want to do that. +`); + } + throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild. + +If you are installing esbuild with npm, make sure that you don't specify the +"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature +of "package.json" is used by esbuild to install the correct binary executable +for your current platform.`); + } + throw e; + } + } + if (/\.zip\//.test(binPath)) { + let pnpapi; + try { + pnpapi = require("pnpapi"); + } catch (e) { + } + if (pnpapi) { + const root = pnpapi.getPackageInformation(pnpapi.topLevel).packageLocation; + const binTargetPath = path.join( + root, + "node_modules", + ".cache", + "esbuild", + `pnpapi-${pkg.replace("/", "-")}-${"0.28.2"}-${path.basename(subpath)}` + ); + if (!fs.existsSync(binTargetPath)) { + fs.mkdirSync(path.dirname(binTargetPath), { recursive: true }); + fs.copyFileSync(binPath, binTargetPath); + fs.chmodSync(binTargetPath, 493); + } + return { binPath: binTargetPath, isWASM }; + } + } + return { binPath, isWASM }; +} + +// lib/npm/node.ts +var child_process = require("child_process"); +var crypto = require("crypto"); +var path2 = require("path"); +var fs2 = require("fs"); +var os2 = require("os"); +var tty = require("tty"); +var worker_threads; +if (process.env.ESBUILD_WORKER_THREADS !== "0") { + try { + worker_threads = require("worker_threads"); + } catch { + } + let [major, minor] = process.versions.node.split("."); + if ( + // { + if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) { + throw new Error( + `The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle. + +More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.` + ); + } + if (false) { + return ["node", [path2.join(__dirname, "..", "bin", "esbuild")]]; + } else { + const { binPath, isWASM } = generateBinPath(); + if (isWASM) { + return ["node", [binPath]]; + } else { + return [binPath, []]; + } + } +}; +var isTTY = () => tty.isatty(2); +var fsSync = { + readFile(tempFile, callback) { + try { + let contents = fs2.readFileSync(tempFile, "utf8"); + try { + fs2.unlinkSync(tempFile); + } catch { + } + callback(null, contents); + } catch (err) { + callback(err, null); + } + }, + writeFile(contents, callback) { + try { + let tempFile = randomFileName(); + fs2.writeFileSync(tempFile, contents); + callback(tempFile); + } catch { + callback(null); + } + } +}; +var fsAsync = { + readFile(tempFile, callback) { + try { + fs2.readFile(tempFile, "utf8", (err, contents) => { + try { + fs2.unlink(tempFile, () => callback(err, contents)); + } catch { + callback(err, contents); + } + }); + } catch (err) { + callback(err, null); + } + }, + writeFile(contents, callback) { + try { + let tempFile = randomFileName(); + fs2.writeFile(tempFile, contents, (err) => err !== null ? callback(null) : callback(tempFile)); + } catch { + callback(null); + } + } +}; +var version = "0.28.2"; +var build = (options) => ensureServiceIsRunning().build(options); +var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions); +var transform = (input, options) => ensureServiceIsRunning().transform(input, options); +var formatMessages = (messages, options) => ensureServiceIsRunning().formatMessages(messages, options); +var analyzeMetafile = (messages, options) => ensureServiceIsRunning().analyzeMetafile(messages, options); +var buildSync = (options) => { + if (worker_threads && !isInternalWorkerThread) { + if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads); + return workerThreadService.buildSync(options); + } + let result; + runServiceSync((service) => service.buildOrContext({ + callName: "buildSync", + refs: null, + options, + isTTY: isTTY(), + defaultWD, + callback: (err, res) => { + if (err) throw err; + result = res; + } + })); + return result; +}; +var transformSync = (input, options) => { + if (worker_threads && !isInternalWorkerThread) { + if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads); + return workerThreadService.transformSync(input, options); + } + let result; + runServiceSync((service) => service.transform({ + callName: "transformSync", + refs: null, + input, + options: options || {}, + isTTY: isTTY(), + fs: fsSync, + callback: (err, res) => { + if (err) throw err; + result = res; + } + })); + return result; +}; +var formatMessagesSync = (messages, options) => { + if (worker_threads && !isInternalWorkerThread) { + if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads); + return workerThreadService.formatMessagesSync(messages, options); + } + let result; + runServiceSync((service) => service.formatMessages({ + callName: "formatMessagesSync", + refs: null, + messages, + options, + callback: (err, res) => { + if (err) throw err; + result = res; + } + })); + return result; +}; +var analyzeMetafileSync = (metafile, options) => { + if (worker_threads && !isInternalWorkerThread) { + if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads); + return workerThreadService.analyzeMetafileSync(metafile, options); + } + let result; + runServiceSync((service) => service.analyzeMetafile({ + callName: "analyzeMetafileSync", + refs: null, + metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile), + options, + callback: (err, res) => { + if (err) throw err; + result = res; + } + })); + return result; +}; +var stop = () => { + if (stopService) stopService(); + if (workerThreadService) workerThreadService.stop(); + return Promise.resolve(); +}; +var initializeWasCalled = false; +var initialize = (options) => { + options = validateInitializeOptions(options || {}); + if (options.wasmURL) throw new Error(`The "wasmURL" option only works in the browser`); + if (options.wasmModule) throw new Error(`The "wasmModule" option only works in the browser`); + if (options.worker) throw new Error(`The "worker" option only works in the browser`); + if (initializeWasCalled) throw new Error('Cannot call "initialize" more than once'); + ensureServiceIsRunning(); + initializeWasCalled = true; + return Promise.resolve(); +}; +var defaultWD = process.cwd(); +var longLivedService; +var stopService; +var ensureServiceIsRunning = () => { + if (longLivedService) return longLivedService; + let [command, args] = esbuildCommandAndArgs(); + let child = child_process.spawn(command, args.concat(`--service=${"0.28.2"}`, "--ping"), { + windowsHide: true, + stdio: ["pipe", "pipe", "inherit"], + cwd: defaultWD + }); + let { readFromStdout, afterClose, service } = createChannel({ + writeToStdin(bytes) { + child.stdin.write(bytes, (err) => { + if (err) afterClose(err); + }); + }, + readFileSync: fs2.readFileSync, + isSync: false, + hasFS: true, + esbuild: node_exports + }); + child.stdin.on("error", afterClose); + child.on("error", afterClose); + const stdin = child.stdin; + const stdout = child.stdout; + stdout.on("data", readFromStdout); + stdout.on("end", afterClose); + stopService = () => { + stdin.destroy(); + stdout.destroy(); + child.kill(); + initializeWasCalled = false; + longLivedService = void 0; + stopService = void 0; + }; + let refCount = 0; + child.unref(); + if (stdin.unref) { + stdin.unref(); + } + if (stdout.unref) { + stdout.unref(); + } + const refs = { + ref() { + if (++refCount === 1) child.ref(); + }, + unref() { + if (--refCount === 0) child.unref(); + } + }; + longLivedService = { + build: (options) => new Promise((resolve, reject) => { + service.buildOrContext({ + callName: "build", + refs, + options, + isTTY: isTTY(), + defaultWD, + callback: (err, res) => err ? reject(err) : resolve(res) + }); + }), + context: (options) => new Promise((resolve, reject) => service.buildOrContext({ + callName: "context", + refs, + options, + isTTY: isTTY(), + defaultWD, + callback: (err, res) => err ? reject(err) : resolve(res) + })), + transform: (input, options) => new Promise((resolve, reject) => service.transform({ + callName: "transform", + refs, + input, + options: options || {}, + isTTY: isTTY(), + fs: fsAsync, + callback: (err, res) => err ? reject(err) : resolve(res) + })), + formatMessages: (messages, options) => new Promise((resolve, reject) => service.formatMessages({ + callName: "formatMessages", + refs, + messages, + options, + callback: (err, res) => err ? reject(err) : resolve(res) + })), + analyzeMetafile: (metafile, options) => new Promise((resolve, reject) => service.analyzeMetafile({ + callName: "analyzeMetafile", + refs, + metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile), + options, + callback: (err, res) => err ? reject(err) : resolve(res) + })) + }; + return longLivedService; +}; +var runServiceSync = (callback) => { + let [command, args] = esbuildCommandAndArgs(); + let stdin = new Uint8Array(); + let { readFromStdout, afterClose, service } = createChannel({ + writeToStdin(bytes) { + if (stdin.length !== 0) throw new Error("Must run at most one command"); + stdin = bytes; + }, + isSync: true, + hasFS: true, + esbuild: node_exports + }); + callback(service); + let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.28.2"}`), { + cwd: defaultWD, + windowsHide: true, + input: stdin, + // We don't know how large the output could be. If it's too large, the + // command will fail with ENOBUFS. Reserve 16mb for now since that feels + // like it should be enough. Also allow overriding this with an environment + // variable. + maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024 + }); + readFromStdout(stdout); + afterClose(null); +}; +var randomFileName = () => { + return path2.join(os2.tmpdir(), `esbuild-${crypto.randomBytes(32).toString("hex")}`); +}; +var workerThreadService = null; +var startWorkerThreadService = (worker_threads2) => { + let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel(); + let worker = new worker_threads2.Worker(__filename, { + workerData: { workerPort, defaultWD, esbuildVersion: "0.28.2" }, + transferList: [workerPort], + // From node's documentation: https://nodejs.org/api/worker_threads.html + // + // Take care when launching worker threads from preload scripts (scripts loaded + // and run using the `-r` command line flag). Unless the `execArgv` option is + // explicitly set, new Worker threads automatically inherit the command line flags + // from the running process and will preload the same preload scripts as the main + // thread. If the preload script unconditionally launches a worker thread, every + // thread spawned will spawn another until the application crashes. + // + execArgv: [] + }); + let nextID = 0; + let fakeBuildError = (text) => { + let error = new Error(`Build failed with 1 error: +error: ${text}`); + let errors = [{ id: "", pluginName: "", text, location: null, notes: [], detail: void 0 }]; + error.errors = errors; + error.warnings = []; + return error; + }; + let validateBuildSyncOptions = (options) => { + if (!options) return; + let plugins = options.plugins; + if (plugins && plugins.length > 0) throw fakeBuildError(`Cannot use plugins in synchronous API calls`); + }; + let applyProperties = (object, properties) => { + for (let key in properties) { + object[key] = properties[key]; + } + }; + let runCallSync = (command, args) => { + let id = nextID++; + let sharedBuffer = new SharedArrayBuffer(8); + let sharedBufferView = new Int32Array(sharedBuffer); + let msg = { sharedBuffer, id, command, args }; + worker.postMessage(msg); + let status = Atomics.wait(sharedBufferView, 0, 0); + if (status !== "ok" && status !== "not-equal") throw new Error("Internal error: Atomics.wait() failed: " + status); + let { message: { id: id2, resolve, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort); + if (id !== id2) throw new Error(`Internal error: Expected id ${id} but got id ${id2}`); + if (reject) { + applyProperties(reject, properties); + throw reject; + } + return resolve; + }; + worker.unref(); + return { + buildSync(options) { + validateBuildSyncOptions(options); + return runCallSync("build", [options]); + }, + transformSync(input, options) { + return runCallSync("transform", [input, options]); + }, + formatMessagesSync(messages, options) { + return runCallSync("formatMessages", [messages, options]); + }, + analyzeMetafileSync(metafile, options) { + return runCallSync("analyzeMetafile", [metafile, options]); + }, + stop() { + worker.terminate(); + workerThreadService = null; + } + }; +}; +var startSyncServiceWorker = () => { + let workerPort = worker_threads.workerData.workerPort; + let parentPort = worker_threads.parentPort; + let extractProperties = (object) => { + let properties = {}; + if (object && typeof object === "object") { + for (let key in object) { + properties[key] = object[key]; + } + } + return properties; + }; + try { + let service = ensureServiceIsRunning(); + defaultWD = worker_threads.workerData.defaultWD; + parentPort.on("message", (msg) => { + (async () => { + let { sharedBuffer, id, command, args } = msg; + let sharedBufferView = new Int32Array(sharedBuffer); + try { + switch (command) { + case "build": + workerPort.postMessage({ id, resolve: await service.build(args[0]) }); + break; + case "transform": + workerPort.postMessage({ id, resolve: await service.transform(args[0], args[1]) }); + break; + case "formatMessages": + workerPort.postMessage({ id, resolve: await service.formatMessages(args[0], args[1]) }); + break; + case "analyzeMetafile": + workerPort.postMessage({ id, resolve: await service.analyzeMetafile(args[0], args[1]) }); + break; + default: + throw new Error(`Invalid command: ${command}`); + } + } catch (reject) { + workerPort.postMessage({ id, reject, properties: extractProperties(reject) }); + } + Atomics.add(sharedBufferView, 0, 1); + Atomics.notify(sharedBufferView, 0, Infinity); + })(); + }); + } catch (reject) { + parentPort.on("message", (msg) => { + let { sharedBuffer, id } = msg; + let sharedBufferView = new Int32Array(sharedBuffer); + workerPort.postMessage({ id, reject, properties: extractProperties(reject) }); + Atomics.add(sharedBufferView, 0, 1); + Atomics.notify(sharedBufferView, 0, Infinity); + }); + } +}; +if (isInternalWorkerThread) { + startSyncServiceWorker(); +} +var node_default = node_exports; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + analyzeMetafile, + analyzeMetafileSync, + build, + buildSync, + context, + formatMessages, + formatMessagesSync, + initialize, + stop, + transform, + transformSync, + version +}); diff --git a/node_modules/esbuild/package.json b/node_modules/esbuild/package.json new file mode 100644 index 0000000..7e54c6f --- /dev/null +++ b/node_modules/esbuild/package.json @@ -0,0 +1,74 @@ +{ + "name": "esbuild", + "version": "0.28.2", + "description": "An extremely fast JavaScript and CSS bundler and minifier.", + "repository": { + "type": "git", + "url": "git+https://github.com/evanw/esbuild.git" + }, + "scripts": { + "postinstall": "node install.js" + }, + "main": "lib/main.js", + "types": "lib/main.d.ts", + "engines": { + "node": ">=18" + }, + "bin": { + "esbuild": "bin/esbuild" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + }, + "license": "MIT", + "esbuild.binaryHashes": { + "@esbuild/aix-ppc64/bin/esbuild": "6de148b932fc5d3b28a97f9f0bc4de8e2b47db478b8ad679e0eaa6b96e00420d", + "@esbuild/android-arm64/bin/esbuild": "84efbbd2cbf21bbfec2aaf304bee79cb2a4a05fe2ea7b861a87f7b8f213ac27d", + "@esbuild/darwin-arm64/bin/esbuild": "10b6243df618d374bb2d5c9cfbe7052e1405f6aa4e53a6164f11a91b9f2e1384", + "@esbuild/darwin-x64/bin/esbuild": "7fe5c9c905fff0a05d92db98929434ab4d3b6dd92d7a7688922db74380c75df3", + "@esbuild/freebsd-arm64/bin/esbuild": "6aba108a68b93064e491bfb1ecfa28843b4d4e504dff0627f53f68f6bb015c01", + "@esbuild/freebsd-x64/bin/esbuild": "8a237e222bee0e50556e7b00d83ec2ff43721bf72f19811a5f0ee56f1d40177c", + "@esbuild/linux-arm/bin/esbuild": "d88f751b22095b2f3b42c8c2e8a3f36fabc1705438c5d6e78366b681f8b4e7a5", + "@esbuild/linux-arm64/bin/esbuild": "90bd269553d258e80b19e3ccab4f98f0831f87442a2f056510ce24fd1b425fc2", + "@esbuild/linux-ia32/bin/esbuild": "b1e2d87d79f9a2baa0d3043cdf0dc6716f9f2eea66c58f47588641fd6019f36f", + "@esbuild/linux-loong64/bin/esbuild": "55a66f9854d6798f36b2b5471db74f2e552481887ea14d8bda1634a512383a43", + "@esbuild/linux-mips64el/bin/esbuild": "6bf7921a3af4a801051e056d85c360fe24bb446f488ef3da25f0b8e5cf973db1", + "@esbuild/linux-ppc64/bin/esbuild": "c30df60d09bb0ba4853d7b06e244ce966890d61ce60cadd9b22335f6379c316a", + "@esbuild/linux-riscv64/bin/esbuild": "36bdcdc8230eef385838cdfeb0d9a1565cbe4b9ace30097a511d77e894de36a1", + "@esbuild/linux-s390x/bin/esbuild": "bbbc1f92a76a5ca6e2976065222e42b02797363a1f119490dda315f74047741f", + "@esbuild/linux-x64/bin/esbuild": "e1698a3d5c6c0798fee4fd3b5cc816651f460c63d390a7a26ea4beb0b1884100", + "@esbuild/netbsd-arm64/bin/esbuild": "62548519d7ae875d060aa8c94bfb8ed38ef191671a5173d9f626bdb6b7516970", + "@esbuild/netbsd-x64/bin/esbuild": "f9d0e59d2b404559e3a0c958164d96960ebf0e04583b878b1d64d8f1c3698fcc", + "@esbuild/openbsd-arm64/bin/esbuild": "e10c45a0b62456632da41df058d7626b2e7cfe710780a2dc7f9f84681753f3aa", + "@esbuild/openbsd-x64/bin/esbuild": "720bbe607736716f2ecd37962436c5589d801966e868a2ae4e0e7e62d1e4e887", + "@esbuild/sunos-x64/bin/esbuild": "01a3bd9183631ca749f34d15601ea21ba6834614184c5c859f99d54bd683203d", + "@esbuild/win32-arm64/esbuild.exe": "530fb3933af14eefe85dfd06502f826e6ef60fdf4e75228ea67c696db312ecb1", + "@esbuild/win32-ia32/esbuild.exe": "b2e62af5c17e00939583be0a0762fdc469f352869a617edc91371b00454c76f0", + "@esbuild/win32-x64/esbuild.exe": "c7bee37877d0aa6a046e52783fa0a2cf1a9ce5579d68bb3083bda99d4bff18ef" + } +} diff --git a/node_modules/fdir/LICENSE b/node_modules/fdir/LICENSE new file mode 100644 index 0000000..bb7fdee --- /dev/null +++ b/node_modules/fdir/LICENSE @@ -0,0 +1,7 @@ +Copyright 2023 Abdullah Atta + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/fdir/README.md b/node_modules/fdir/README.md new file mode 100644 index 0000000..5c70530 --- /dev/null +++ b/node_modules/fdir/README.md @@ -0,0 +1,91 @@ +

+ + +

The Fastest Directory Crawler & Globber for NodeJS

+

+ + + + + + + + +

+

+ +⚡ **The Fastest:** Nothing similar (in the NodeJS world) beats `fdir` in speed. It can easily crawl a directory containing **1 million files in < 1 second.** + +💡 **Stupidly Easy:** `fdir` uses expressive Builder pattern to build the crawler increasing code readability. + +🤖 **Zero Dependencies\*:** `fdir` only uses NodeJS `fs` & `path` modules. + +🕺 **Astonishingly Small:** < 2KB in size gzipped & minified. + +🖮 **Hackable:** Extending `fdir` is extremely simple now that the new Builder API is here. Feel free to experiment around. + +_\* `picomatch` must be installed manually by the user to support globbing._ + +## 🚄 Quickstart + +### Installation + +You can install using `npm`: + +```sh +$ npm i fdir +``` + +or Yarn: + +```sh +$ yarn add fdir +``` + +### Usage + +```ts +import { fdir } from "fdir"; + +// create the builder +const api = new fdir().withFullPaths().crawl("path/to/dir"); + +// get all files in a directory synchronously +const files = api.sync(); + +// or asynchronously +api.withPromise().then((files) => { + // do something with the result here. +}); +``` + +## Documentation: + +Documentation for all methods is available [here](/documentation.md). + +## 📊 Benchmarks: + +Please check the benchmark against the latest version [here](/BENCHMARKS.md). + +## 🙏Used by: + +`fdir` is downloaded over 200k+ times a week by projects around the world. Here's a list of some notable projects using `fdir` in production: + +> Note: if you think your project should be here, feel free to open an issue. Notable is anything with a considerable amount of GitHub stars. + +1. [rollup/plugins](https://github.com/rollup/plugins) +2. [SuperchupuDev/tinyglobby](https://github.com/SuperchupuDev/tinyglobby) +3. [pulumi/pulumi](https://github.com/pulumi/pulumi) +4. [dotenvx/dotenvx](https://github.com/dotenvx/dotenvx) +5. [mdn/yari](https://github.com/mdn/yari) +6. [streetwriters/notesnook](https://github.com/streetwriters/notesnook) +7. [imba/imba](https://github.com/imba/imba) +8. [moroshko/react-scanner](https://github.com/moroshko/react-scanner) +9. [netlify/build](https://github.com/netlify/build) +10. [yassinedoghri/astro-i18next](https://github.com/yassinedoghri/astro-i18next) +11. [selfrefactor/rambda](https://github.com/selfrefactor/rambda) +12. [whyboris/Video-Hub-App](https://github.com/whyboris/Video-Hub-App) + +## 🦮 LICENSE + +Copyright © 2024 Abdullah Atta under MIT. [Read full text here.](https://github.com/thecodrr/fdir/raw/master/LICENSE) diff --git a/node_modules/fdir/dist/index.cjs b/node_modules/fdir/dist/index.cjs new file mode 100644 index 0000000..4868ffb --- /dev/null +++ b/node_modules/fdir/dist/index.cjs @@ -0,0 +1,588 @@ +//#region rolldown:runtime +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { + key = keys[i]; + if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { + get: ((k) => from[k]).bind(null, key), + enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable + }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { + value: mod, + enumerable: true +}) : target, mod)); + +//#endregion +const path = __toESM(require("path")); +const fs = __toESM(require("fs")); + +//#region src/utils.ts +function cleanPath(path$1) { + let normalized = (0, path.normalize)(path$1); + if (normalized.length > 1 && normalized[normalized.length - 1] === path.sep) normalized = normalized.substring(0, normalized.length - 1); + return normalized; +} +const SLASHES_REGEX = /[\\/]/g; +function convertSlashes(path$1, separator) { + return path$1.replace(SLASHES_REGEX, separator); +} +const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i; +function isRootDirectory(path$1) { + return path$1 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$1); +} +function normalizePath(path$1, options) { + const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options; + const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith("."); + if (resolvePaths) path$1 = (0, path.resolve)(path$1); + if (normalizePath$1 || pathNeedsCleaning) path$1 = cleanPath(path$1); + if (path$1 === ".") return ""; + const needsSeperator = path$1[path$1.length - 1] !== pathSeparator; + return convertSlashes(needsSeperator ? path$1 + pathSeparator : path$1, pathSeparator); +} + +//#endregion +//#region src/api/functions/join-path.ts +function joinPathWithBasePath(filename, directoryPath) { + return directoryPath + filename; +} +function joinPathWithRelativePath(root, options) { + return function(filename, directoryPath) { + const sameRoot = directoryPath.startsWith(root); + if (sameRoot) return directoryPath.slice(root.length) + filename; + else return convertSlashes((0, path.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename; + }; +} +function joinPath(filename) { + return filename; +} +function joinDirectoryPath(filename, directoryPath, separator) { + return directoryPath + filename + separator; +} +function build$7(root, options) { + const { relativePaths, includeBasePath } = options; + return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath; +} + +//#endregion +//#region src/api/functions/push-directory.ts +function pushDirectoryWithRelativePath(root) { + return function(directoryPath, paths) { + paths.push(directoryPath.substring(root.length) || "."); + }; +} +function pushDirectoryFilterWithRelativePath(root) { + return function(directoryPath, paths, filters) { + const relativePath = directoryPath.substring(root.length) || "."; + if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath); + }; +} +const pushDirectory = (directoryPath, paths) => { + paths.push(directoryPath || "."); +}; +const pushDirectoryFilter = (directoryPath, paths, filters) => { + const path$1 = directoryPath || "."; + if (filters.every((filter) => filter(path$1, true))) paths.push(path$1); +}; +const empty$2 = () => {}; +function build$6(root, options) { + const { includeDirs, filters, relativePaths } = options; + if (!includeDirs) return empty$2; + if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root); + return filters && filters.length ? pushDirectoryFilter : pushDirectory; +} + +//#endregion +//#region src/api/functions/push-file.ts +const pushFileFilterAndCount = (filename, _paths, counts, filters) => { + if (filters.every((filter) => filter(filename, false))) counts.files++; +}; +const pushFileFilter = (filename, paths, _counts, filters) => { + if (filters.every((filter) => filter(filename, false))) paths.push(filename); +}; +const pushFileCount = (_filename, _paths, counts, _filters) => { + counts.files++; +}; +const pushFile = (filename, paths) => { + paths.push(filename); +}; +const empty$1 = () => {}; +function build$5(options) { + const { excludeFiles, filters, onlyCounts } = options; + if (excludeFiles) return empty$1; + if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter; + else if (onlyCounts) return pushFileCount; + else return pushFile; +} + +//#endregion +//#region src/api/functions/get-array.ts +const getArray = (paths) => { + return paths; +}; +const getArrayGroup = () => { + return [""].slice(0, 0); +}; +function build$4(options) { + return options.group ? getArrayGroup : getArray; +} + +//#endregion +//#region src/api/functions/group-files.ts +const groupFiles = (groups, directory, files) => { + groups.push({ + directory, + files, + dir: directory + }); +}; +const empty = () => {}; +function build$3(options) { + return options.group ? groupFiles : empty; +} + +//#endregion +//#region src/api/functions/resolve-symlink.ts +const resolveSymlinksAsync = function(path$1, state, callback$1) { + const { queue, fs: fs$1, options: { suppressErrors } } = state; + queue.enqueue(); + fs$1.realpath(path$1, (error, resolvedPath) => { + if (error) return queue.dequeue(suppressErrors ? null : error, state); + fs$1.stat(resolvedPath, (error$1, stat) => { + if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state); + if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state); + callback$1(stat, resolvedPath); + queue.dequeue(null, state); + }); + }); +}; +const resolveSymlinks = function(path$1, state, callback$1) { + const { queue, fs: fs$1, options: { suppressErrors } } = state; + queue.enqueue(); + try { + const resolvedPath = fs$1.realpathSync(path$1); + const stat = fs$1.statSync(resolvedPath); + if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return; + callback$1(stat, resolvedPath); + } catch (e) { + if (!suppressErrors) throw e; + } +}; +function build$2(options, isSynchronous) { + if (!options.resolveSymlinks || options.excludeSymlinks) return null; + return isSynchronous ? resolveSymlinks : resolveSymlinksAsync; +} +function isRecursive(path$1, resolved, state) { + if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state); + let parent = (0, path.dirname)(path$1); + let depth = 1; + while (parent !== state.root && depth < 2) { + const resolvedPath = state.symlinks.get(parent); + const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath)); + if (isSameRoot) depth++; + else parent = (0, path.dirname)(parent); + } + state.symlinks.set(path$1, resolved); + return depth > 1; +} +function isRecursiveUsingRealPaths(resolved, state) { + return state.visited.includes(resolved + state.options.pathSeparator); +} + +//#endregion +//#region src/api/functions/invoke-callback.ts +const onlyCountsSync = (state) => { + return state.counts; +}; +const groupsSync = (state) => { + return state.groups; +}; +const defaultSync = (state) => { + return state.paths; +}; +const limitFilesSync = (state) => { + return state.paths.slice(0, state.options.maxFiles); +}; +const onlyCountsAsync = (state, error, callback$1) => { + report(error, callback$1, state.counts, state.options.suppressErrors); + return null; +}; +const defaultAsync = (state, error, callback$1) => { + report(error, callback$1, state.paths, state.options.suppressErrors); + return null; +}; +const limitFilesAsync = (state, error, callback$1) => { + report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors); + return null; +}; +const groupsAsync = (state, error, callback$1) => { + report(error, callback$1, state.groups, state.options.suppressErrors); + return null; +}; +function report(error, callback$1, output, suppressErrors) { + if (error && !suppressErrors) callback$1(error, output); + else callback$1(null, output); +} +function build$1(options, isSynchronous) { + const { onlyCounts, group, maxFiles } = options; + if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync; + else if (group) return isSynchronous ? groupsSync : groupsAsync; + else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync; + else return isSynchronous ? defaultSync : defaultAsync; +} + +//#endregion +//#region src/api/functions/walk-directory.ts +const readdirOpts = { withFileTypes: true }; +const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => { + state.queue.enqueue(); + if (currentDepth < 0) return state.queue.dequeue(null, state); + const { fs: fs$1 } = state; + state.visited.push(crawlPath); + state.counts.directories++; + fs$1.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => { + callback$1(entries, directoryPath, currentDepth); + state.queue.dequeue(state.options.suppressErrors ? null : error, state); + }); +}; +const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => { + const { fs: fs$1 } = state; + if (currentDepth < 0) return; + state.visited.push(crawlPath); + state.counts.directories++; + let entries = []; + try { + entries = fs$1.readdirSync(crawlPath || ".", readdirOpts); + } catch (e) { + if (!state.options.suppressErrors) throw e; + } + callback$1(entries, directoryPath, currentDepth); +}; +function build(isSynchronous) { + return isSynchronous ? walkSync : walkAsync; +} + +//#endregion +//#region src/api/queue.ts +/** +* This is a custom stateless queue to track concurrent async fs calls. +* It increments a counter whenever a call is queued and decrements it +* as soon as it completes. When the counter hits 0, it calls onQueueEmpty. +*/ +var Queue = class { + count = 0; + constructor(onQueueEmpty) { + this.onQueueEmpty = onQueueEmpty; + } + enqueue() { + this.count++; + return this.count; + } + dequeue(error, output) { + if (this.onQueueEmpty && (--this.count <= 0 || error)) { + this.onQueueEmpty(error, output); + if (error) { + output.controller.abort(); + this.onQueueEmpty = void 0; + } + } + } +}; + +//#endregion +//#region src/api/counter.ts +var Counter = class { + _files = 0; + _directories = 0; + set files(num) { + this._files = num; + } + get files() { + return this._files; + } + set directories(num) { + this._directories = num; + } + get directories() { + return this._directories; + } + /** + * @deprecated use `directories` instead + */ + /* c8 ignore next 3 */ + get dirs() { + return this._directories; + } +}; + +//#endregion +//#region src/api/aborter.ts +/** +* AbortController is not supported on Node 14 so we use this until we can drop +* support for Node 14. +*/ +var Aborter = class { + aborted = false; + abort() { + this.aborted = true; + } +}; + +//#endregion +//#region src/api/walker.ts +var Walker = class { + root; + isSynchronous; + state; + joinPath; + pushDirectory; + pushFile; + getArray; + groupFiles; + resolveSymlink; + walkDirectory; + callbackInvoker; + constructor(root, options, callback$1) { + this.isSynchronous = !callback$1; + this.callbackInvoker = build$1(options, this.isSynchronous); + this.root = normalizePath(root, options); + this.state = { + root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1), + paths: [""].slice(0, 0), + groups: [], + counts: new Counter(), + options, + queue: new Queue((error, state) => this.callbackInvoker(state, error, callback$1)), + symlinks: /* @__PURE__ */ new Map(), + visited: [""].slice(0, 0), + controller: new Aborter(), + fs: options.fs || fs + }; + this.joinPath = build$7(this.root, options); + this.pushDirectory = build$6(this.root, options); + this.pushFile = build$5(options); + this.getArray = build$4(options); + this.groupFiles = build$3(options); + this.resolveSymlink = build$2(options, this.isSynchronous); + this.walkDirectory = build(this.isSynchronous); + } + start() { + this.pushDirectory(this.root, this.state.paths, this.state.options.filters); + this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk); + return this.isSynchronous ? this.callbackInvoker(this.state, null) : null; + } + walk = (entries, directoryPath, depth) => { + const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state; + if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return; + const files = this.getArray(this.state.paths); + for (let i = 0; i < entries.length; ++i) { + const entry = entries[i]; + if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) { + const filename = this.joinPath(entry.name, directoryPath); + this.pushFile(filename, files, this.state.counts, filters); + } else if (entry.isDirectory()) { + let path$1 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator); + if (exclude && exclude(entry.name, path$1)) continue; + this.pushDirectory(path$1, paths, filters); + this.walkDirectory(this.state, path$1, path$1, depth - 1, this.walk); + } else if (this.resolveSymlink && entry.isSymbolicLink()) { + let path$1 = joinPathWithBasePath(entry.name, directoryPath); + this.resolveSymlink(path$1, this.state, (stat, resolvedPath) => { + if (stat.isDirectory()) { + resolvedPath = normalizePath(resolvedPath, this.state.options); + if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return; + this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth - 1, this.walk); + } else { + resolvedPath = useRealPaths ? resolvedPath : path$1; + const filename = (0, path.basename)(resolvedPath); + const directoryPath$1 = normalizePath((0, path.dirname)(resolvedPath), this.state.options); + resolvedPath = this.joinPath(filename, directoryPath$1); + this.pushFile(resolvedPath, files, this.state.counts, filters); + } + }); + } + } + this.groupFiles(this.state.groups, directoryPath, files); + }; +}; + +//#endregion +//#region src/api/async.ts +function promise(root, options) { + return new Promise((resolve$1, reject) => { + callback(root, options, (err, output) => { + if (err) return reject(err); + resolve$1(output); + }); + }); +} +function callback(root, options, callback$1) { + let walker = new Walker(root, options, callback$1); + walker.start(); +} + +//#endregion +//#region src/api/sync.ts +function sync(root, options) { + const walker = new Walker(root, options); + return walker.start(); +} + +//#endregion +//#region src/builder/api-builder.ts +var APIBuilder = class { + constructor(root, options) { + this.root = root; + this.options = options; + } + withPromise() { + return promise(this.root, this.options); + } + withCallback(cb) { + callback(this.root, this.options, cb); + } + sync() { + return sync(this.root, this.options); + } +}; + +//#endregion +//#region src/builder/index.ts +let pm = null; +/* c8 ignore next 6 */ +try { + require.resolve("picomatch"); + pm = require("picomatch"); +} catch {} +var Builder = class { + globCache = {}; + options = { + maxDepth: Infinity, + suppressErrors: true, + pathSeparator: path.sep, + filters: [] + }; + globFunction; + constructor(options) { + this.options = { + ...this.options, + ...options + }; + this.globFunction = this.options.globFunction; + } + group() { + this.options.group = true; + return this; + } + withPathSeparator(separator) { + this.options.pathSeparator = separator; + return this; + } + withBasePath() { + this.options.includeBasePath = true; + return this; + } + withRelativePaths() { + this.options.relativePaths = true; + return this; + } + withDirs() { + this.options.includeDirs = true; + return this; + } + withMaxDepth(depth) { + this.options.maxDepth = depth; + return this; + } + withMaxFiles(limit) { + this.options.maxFiles = limit; + return this; + } + withFullPaths() { + this.options.resolvePaths = true; + this.options.includeBasePath = true; + return this; + } + withErrors() { + this.options.suppressErrors = false; + return this; + } + withSymlinks({ resolvePaths = true } = {}) { + this.options.resolveSymlinks = true; + this.options.useRealPaths = resolvePaths; + return this.withFullPaths(); + } + withAbortSignal(signal) { + this.options.signal = signal; + return this; + } + normalize() { + this.options.normalizePath = true; + return this; + } + filter(predicate) { + this.options.filters.push(predicate); + return this; + } + onlyDirs() { + this.options.excludeFiles = true; + this.options.includeDirs = true; + return this; + } + exclude(predicate) { + this.options.exclude = predicate; + return this; + } + onlyCounts() { + this.options.onlyCounts = true; + return this; + } + crawl(root) { + return new APIBuilder(root || ".", this.options); + } + withGlobFunction(fn) { + this.globFunction = fn; + return this; + } + /** + * @deprecated Pass options using the constructor instead: + * ```ts + * new fdir(options).crawl("/path/to/root"); + * ``` + * This method will be removed in v7.0 + */ + /* c8 ignore next 4 */ + crawlWithOptions(root, options) { + this.options = { + ...this.options, + ...options + }; + return new APIBuilder(root || ".", this.options); + } + glob(...patterns) { + if (this.globFunction) return this.globWithOptions(patterns); + return this.globWithOptions(patterns, ...[{ dot: true }]); + } + globWithOptions(patterns, ...options) { + const globFn = this.globFunction || pm; + /* c8 ignore next 5 */ + if (!globFn) throw new Error("Please specify a glob function to use glob matching."); + var isMatch = this.globCache[patterns.join("\0")]; + if (!isMatch) { + isMatch = globFn(patterns, ...options); + this.globCache[patterns.join("\0")] = isMatch; + } + this.options.filters.push((path$1) => isMatch(path$1)); + return this; + } +}; + +//#endregion +exports.fdir = Builder; \ No newline at end of file diff --git a/node_modules/fdir/dist/index.d.cts b/node_modules/fdir/dist/index.d.cts new file mode 100644 index 0000000..f448ef5 --- /dev/null +++ b/node_modules/fdir/dist/index.d.cts @@ -0,0 +1,155 @@ +/// +import * as nativeFs from "fs"; +import picomatch from "picomatch"; + +//#region src/api/aborter.d.ts +/** + * AbortController is not supported on Node 14 so we use this until we can drop + * support for Node 14. + */ +declare class Aborter { + aborted: boolean; + abort(): void; +} +//#endregion +//#region src/api/queue.d.ts +type OnQueueEmptyCallback = (error: Error | null, output: WalkerState) => void; +/** + * This is a custom stateless queue to track concurrent async fs calls. + * It increments a counter whenever a call is queued and decrements it + * as soon as it completes. When the counter hits 0, it calls onQueueEmpty. + */ +declare class Queue { + private onQueueEmpty?; + count: number; + constructor(onQueueEmpty?: OnQueueEmptyCallback | undefined); + enqueue(): number; + dequeue(error: Error | null, output: WalkerState): void; +} +//#endregion +//#region src/types.d.ts +type Counts = { + files: number; + directories: number; + /** + * @deprecated use `directories` instead. Will be removed in v7.0. + */ + dirs: number; +}; +type Group = { + directory: string; + files: string[]; + /** + * @deprecated use `directory` instead. Will be removed in v7.0. + */ + dir: string; +}; +type GroupOutput = Group[]; +type OnlyCountsOutput = Counts; +type PathsOutput = string[]; +type Output = OnlyCountsOutput | PathsOutput | GroupOutput; +type FSLike = { + readdir: typeof nativeFs.readdir; + readdirSync: typeof nativeFs.readdirSync; + realpath: typeof nativeFs.realpath; + realpathSync: typeof nativeFs.realpathSync; + stat: typeof nativeFs.stat; + statSync: typeof nativeFs.statSync; +}; +type WalkerState = { + root: string; + paths: string[]; + groups: Group[]; + counts: Counts; + options: Options; + queue: Queue; + controller: Aborter; + fs: FSLike; + symlinks: Map; + visited: string[]; +}; +type ResultCallback = (error: Error | null, output: TOutput) => void; +type FilterPredicate = (path: string, isDirectory: boolean) => boolean; +type ExcludePredicate = (dirName: string, dirPath: string) => boolean; +type PathSeparator = "/" | "\\"; +type Options = { + includeBasePath?: boolean; + includeDirs?: boolean; + normalizePath?: boolean; + maxDepth: number; + maxFiles?: number; + resolvePaths?: boolean; + suppressErrors: boolean; + group?: boolean; + onlyCounts?: boolean; + filters: FilterPredicate[]; + resolveSymlinks?: boolean; + useRealPaths?: boolean; + excludeFiles?: boolean; + excludeSymlinks?: boolean; + exclude?: ExcludePredicate; + relativePaths?: boolean; + pathSeparator: PathSeparator; + signal?: AbortSignal; + globFunction?: TGlobFunction; + fs?: FSLike; +}; +type GlobMatcher = (test: string) => boolean; +type GlobFunction = (glob: string | string[], ...params: unknown[]) => GlobMatcher; +type GlobParams = T extends ((globs: string | string[], ...params: infer TParams extends unknown[]) => GlobMatcher) ? TParams : []; +//#endregion +//#region src/builder/api-builder.d.ts +declare class APIBuilder { + private readonly root; + private readonly options; + constructor(root: string, options: Options); + withPromise(): Promise; + withCallback(cb: ResultCallback): void; + sync(): TReturnType; +} +//#endregion +//#region src/builder/index.d.ts +declare class Builder { + private readonly globCache; + private options; + private globFunction?; + constructor(options?: Partial>); + group(): Builder; + withPathSeparator(separator: "/" | "\\"): this; + withBasePath(): this; + withRelativePaths(): this; + withDirs(): this; + withMaxDepth(depth: number): this; + withMaxFiles(limit: number): this; + withFullPaths(): this; + withErrors(): this; + withSymlinks({ + resolvePaths + }?: { + resolvePaths?: boolean | undefined; + }): this; + withAbortSignal(signal: AbortSignal): this; + normalize(): this; + filter(predicate: FilterPredicate): this; + onlyDirs(): this; + exclude(predicate: ExcludePredicate): this; + onlyCounts(): Builder; + crawl(root?: string): APIBuilder; + withGlobFunction(fn: TFunc): Builder; + /** + * @deprecated Pass options using the constructor instead: + * ```ts + * new fdir(options).crawl("/path/to/root"); + * ``` + * This method will be removed in v7.0 + */ + crawlWithOptions(root: string, options: Partial>): APIBuilder; + glob(...patterns: string[]): Builder; + globWithOptions(patterns: string[]): Builder; + globWithOptions(patterns: string[], ...options: GlobParams): Builder; +} +//#endregion +//#region src/index.d.ts +type Fdir = typeof Builder; +//#endregion +export { Counts, ExcludePredicate, FSLike, Fdir, FilterPredicate, GlobFunction, GlobMatcher, GlobParams, Group, GroupOutput, OnlyCountsOutput, Options, Output, PathSeparator, PathsOutput, ResultCallback, WalkerState, Builder as fdir }; \ No newline at end of file diff --git a/node_modules/fdir/dist/index.d.mts b/node_modules/fdir/dist/index.d.mts new file mode 100644 index 0000000..f448ef5 --- /dev/null +++ b/node_modules/fdir/dist/index.d.mts @@ -0,0 +1,155 @@ +/// +import * as nativeFs from "fs"; +import picomatch from "picomatch"; + +//#region src/api/aborter.d.ts +/** + * AbortController is not supported on Node 14 so we use this until we can drop + * support for Node 14. + */ +declare class Aborter { + aborted: boolean; + abort(): void; +} +//#endregion +//#region src/api/queue.d.ts +type OnQueueEmptyCallback = (error: Error | null, output: WalkerState) => void; +/** + * This is a custom stateless queue to track concurrent async fs calls. + * It increments a counter whenever a call is queued and decrements it + * as soon as it completes. When the counter hits 0, it calls onQueueEmpty. + */ +declare class Queue { + private onQueueEmpty?; + count: number; + constructor(onQueueEmpty?: OnQueueEmptyCallback | undefined); + enqueue(): number; + dequeue(error: Error | null, output: WalkerState): void; +} +//#endregion +//#region src/types.d.ts +type Counts = { + files: number; + directories: number; + /** + * @deprecated use `directories` instead. Will be removed in v7.0. + */ + dirs: number; +}; +type Group = { + directory: string; + files: string[]; + /** + * @deprecated use `directory` instead. Will be removed in v7.0. + */ + dir: string; +}; +type GroupOutput = Group[]; +type OnlyCountsOutput = Counts; +type PathsOutput = string[]; +type Output = OnlyCountsOutput | PathsOutput | GroupOutput; +type FSLike = { + readdir: typeof nativeFs.readdir; + readdirSync: typeof nativeFs.readdirSync; + realpath: typeof nativeFs.realpath; + realpathSync: typeof nativeFs.realpathSync; + stat: typeof nativeFs.stat; + statSync: typeof nativeFs.statSync; +}; +type WalkerState = { + root: string; + paths: string[]; + groups: Group[]; + counts: Counts; + options: Options; + queue: Queue; + controller: Aborter; + fs: FSLike; + symlinks: Map; + visited: string[]; +}; +type ResultCallback = (error: Error | null, output: TOutput) => void; +type FilterPredicate = (path: string, isDirectory: boolean) => boolean; +type ExcludePredicate = (dirName: string, dirPath: string) => boolean; +type PathSeparator = "/" | "\\"; +type Options = { + includeBasePath?: boolean; + includeDirs?: boolean; + normalizePath?: boolean; + maxDepth: number; + maxFiles?: number; + resolvePaths?: boolean; + suppressErrors: boolean; + group?: boolean; + onlyCounts?: boolean; + filters: FilterPredicate[]; + resolveSymlinks?: boolean; + useRealPaths?: boolean; + excludeFiles?: boolean; + excludeSymlinks?: boolean; + exclude?: ExcludePredicate; + relativePaths?: boolean; + pathSeparator: PathSeparator; + signal?: AbortSignal; + globFunction?: TGlobFunction; + fs?: FSLike; +}; +type GlobMatcher = (test: string) => boolean; +type GlobFunction = (glob: string | string[], ...params: unknown[]) => GlobMatcher; +type GlobParams = T extends ((globs: string | string[], ...params: infer TParams extends unknown[]) => GlobMatcher) ? TParams : []; +//#endregion +//#region src/builder/api-builder.d.ts +declare class APIBuilder { + private readonly root; + private readonly options; + constructor(root: string, options: Options); + withPromise(): Promise; + withCallback(cb: ResultCallback): void; + sync(): TReturnType; +} +//#endregion +//#region src/builder/index.d.ts +declare class Builder { + private readonly globCache; + private options; + private globFunction?; + constructor(options?: Partial>); + group(): Builder; + withPathSeparator(separator: "/" | "\\"): this; + withBasePath(): this; + withRelativePaths(): this; + withDirs(): this; + withMaxDepth(depth: number): this; + withMaxFiles(limit: number): this; + withFullPaths(): this; + withErrors(): this; + withSymlinks({ + resolvePaths + }?: { + resolvePaths?: boolean | undefined; + }): this; + withAbortSignal(signal: AbortSignal): this; + normalize(): this; + filter(predicate: FilterPredicate): this; + onlyDirs(): this; + exclude(predicate: ExcludePredicate): this; + onlyCounts(): Builder; + crawl(root?: string): APIBuilder; + withGlobFunction(fn: TFunc): Builder; + /** + * @deprecated Pass options using the constructor instead: + * ```ts + * new fdir(options).crawl("/path/to/root"); + * ``` + * This method will be removed in v7.0 + */ + crawlWithOptions(root: string, options: Partial>): APIBuilder; + glob(...patterns: string[]): Builder; + globWithOptions(patterns: string[]): Builder; + globWithOptions(patterns: string[], ...options: GlobParams): Builder; +} +//#endregion +//#region src/index.d.ts +type Fdir = typeof Builder; +//#endregion +export { Counts, ExcludePredicate, FSLike, Fdir, FilterPredicate, GlobFunction, GlobMatcher, GlobParams, Group, GroupOutput, OnlyCountsOutput, Options, Output, PathSeparator, PathsOutput, ResultCallback, WalkerState, Builder as fdir }; \ No newline at end of file diff --git a/node_modules/fdir/dist/index.mjs b/node_modules/fdir/dist/index.mjs new file mode 100644 index 0000000..5c37e09 --- /dev/null +++ b/node_modules/fdir/dist/index.mjs @@ -0,0 +1,570 @@ +import { createRequire } from "module"; +import { basename, dirname, normalize, relative, resolve, sep } from "path"; +import * as nativeFs from "fs"; + +//#region rolldown:runtime +var __require = /* @__PURE__ */ createRequire(import.meta.url); + +//#endregion +//#region src/utils.ts +function cleanPath(path) { + let normalized = normalize(path); + if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1); + return normalized; +} +const SLASHES_REGEX = /[\\/]/g; +function convertSlashes(path, separator) { + return path.replace(SLASHES_REGEX, separator); +} +const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i; +function isRootDirectory(path) { + return path === "/" || WINDOWS_ROOT_DIR_REGEX.test(path); +} +function normalizePath(path, options) { + const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options; + const pathNeedsCleaning = process.platform === "win32" && path.includes("/") || path.startsWith("."); + if (resolvePaths) path = resolve(path); + if (normalizePath$1 || pathNeedsCleaning) path = cleanPath(path); + if (path === ".") return ""; + const needsSeperator = path[path.length - 1] !== pathSeparator; + return convertSlashes(needsSeperator ? path + pathSeparator : path, pathSeparator); +} + +//#endregion +//#region src/api/functions/join-path.ts +function joinPathWithBasePath(filename, directoryPath) { + return directoryPath + filename; +} +function joinPathWithRelativePath(root, options) { + return function(filename, directoryPath) { + const sameRoot = directoryPath.startsWith(root); + if (sameRoot) return directoryPath.slice(root.length) + filename; + else return convertSlashes(relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename; + }; +} +function joinPath(filename) { + return filename; +} +function joinDirectoryPath(filename, directoryPath, separator) { + return directoryPath + filename + separator; +} +function build$7(root, options) { + const { relativePaths, includeBasePath } = options; + return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath; +} + +//#endregion +//#region src/api/functions/push-directory.ts +function pushDirectoryWithRelativePath(root) { + return function(directoryPath, paths) { + paths.push(directoryPath.substring(root.length) || "."); + }; +} +function pushDirectoryFilterWithRelativePath(root) { + return function(directoryPath, paths, filters) { + const relativePath = directoryPath.substring(root.length) || "."; + if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath); + }; +} +const pushDirectory = (directoryPath, paths) => { + paths.push(directoryPath || "."); +}; +const pushDirectoryFilter = (directoryPath, paths, filters) => { + const path = directoryPath || "."; + if (filters.every((filter) => filter(path, true))) paths.push(path); +}; +const empty$2 = () => {}; +function build$6(root, options) { + const { includeDirs, filters, relativePaths } = options; + if (!includeDirs) return empty$2; + if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root); + return filters && filters.length ? pushDirectoryFilter : pushDirectory; +} + +//#endregion +//#region src/api/functions/push-file.ts +const pushFileFilterAndCount = (filename, _paths, counts, filters) => { + if (filters.every((filter) => filter(filename, false))) counts.files++; +}; +const pushFileFilter = (filename, paths, _counts, filters) => { + if (filters.every((filter) => filter(filename, false))) paths.push(filename); +}; +const pushFileCount = (_filename, _paths, counts, _filters) => { + counts.files++; +}; +const pushFile = (filename, paths) => { + paths.push(filename); +}; +const empty$1 = () => {}; +function build$5(options) { + const { excludeFiles, filters, onlyCounts } = options; + if (excludeFiles) return empty$1; + if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter; + else if (onlyCounts) return pushFileCount; + else return pushFile; +} + +//#endregion +//#region src/api/functions/get-array.ts +const getArray = (paths) => { + return paths; +}; +const getArrayGroup = () => { + return [""].slice(0, 0); +}; +function build$4(options) { + return options.group ? getArrayGroup : getArray; +} + +//#endregion +//#region src/api/functions/group-files.ts +const groupFiles = (groups, directory, files) => { + groups.push({ + directory, + files, + dir: directory + }); +}; +const empty = () => {}; +function build$3(options) { + return options.group ? groupFiles : empty; +} + +//#endregion +//#region src/api/functions/resolve-symlink.ts +const resolveSymlinksAsync = function(path, state, callback$1) { + const { queue, fs, options: { suppressErrors } } = state; + queue.enqueue(); + fs.realpath(path, (error, resolvedPath) => { + if (error) return queue.dequeue(suppressErrors ? null : error, state); + fs.stat(resolvedPath, (error$1, stat) => { + if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state); + if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return queue.dequeue(null, state); + callback$1(stat, resolvedPath); + queue.dequeue(null, state); + }); + }); +}; +const resolveSymlinks = function(path, state, callback$1) { + const { queue, fs, options: { suppressErrors } } = state; + queue.enqueue(); + try { + const resolvedPath = fs.realpathSync(path); + const stat = fs.statSync(resolvedPath); + if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return; + callback$1(stat, resolvedPath); + } catch (e) { + if (!suppressErrors) throw e; + } +}; +function build$2(options, isSynchronous) { + if (!options.resolveSymlinks || options.excludeSymlinks) return null; + return isSynchronous ? resolveSymlinks : resolveSymlinksAsync; +} +function isRecursive(path, resolved, state) { + if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state); + let parent = dirname(path); + let depth = 1; + while (parent !== state.root && depth < 2) { + const resolvedPath = state.symlinks.get(parent); + const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath)); + if (isSameRoot) depth++; + else parent = dirname(parent); + } + state.symlinks.set(path, resolved); + return depth > 1; +} +function isRecursiveUsingRealPaths(resolved, state) { + return state.visited.includes(resolved + state.options.pathSeparator); +} + +//#endregion +//#region src/api/functions/invoke-callback.ts +const onlyCountsSync = (state) => { + return state.counts; +}; +const groupsSync = (state) => { + return state.groups; +}; +const defaultSync = (state) => { + return state.paths; +}; +const limitFilesSync = (state) => { + return state.paths.slice(0, state.options.maxFiles); +}; +const onlyCountsAsync = (state, error, callback$1) => { + report(error, callback$1, state.counts, state.options.suppressErrors); + return null; +}; +const defaultAsync = (state, error, callback$1) => { + report(error, callback$1, state.paths, state.options.suppressErrors); + return null; +}; +const limitFilesAsync = (state, error, callback$1) => { + report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors); + return null; +}; +const groupsAsync = (state, error, callback$1) => { + report(error, callback$1, state.groups, state.options.suppressErrors); + return null; +}; +function report(error, callback$1, output, suppressErrors) { + if (error && !suppressErrors) callback$1(error, output); + else callback$1(null, output); +} +function build$1(options, isSynchronous) { + const { onlyCounts, group, maxFiles } = options; + if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync; + else if (group) return isSynchronous ? groupsSync : groupsAsync; + else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync; + else return isSynchronous ? defaultSync : defaultAsync; +} + +//#endregion +//#region src/api/functions/walk-directory.ts +const readdirOpts = { withFileTypes: true }; +const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => { + state.queue.enqueue(); + if (currentDepth < 0) return state.queue.dequeue(null, state); + const { fs } = state; + state.visited.push(crawlPath); + state.counts.directories++; + fs.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => { + callback$1(entries, directoryPath, currentDepth); + state.queue.dequeue(state.options.suppressErrors ? null : error, state); + }); +}; +const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => { + const { fs } = state; + if (currentDepth < 0) return; + state.visited.push(crawlPath); + state.counts.directories++; + let entries = []; + try { + entries = fs.readdirSync(crawlPath || ".", readdirOpts); + } catch (e) { + if (!state.options.suppressErrors) throw e; + } + callback$1(entries, directoryPath, currentDepth); +}; +function build(isSynchronous) { + return isSynchronous ? walkSync : walkAsync; +} + +//#endregion +//#region src/api/queue.ts +/** +* This is a custom stateless queue to track concurrent async fs calls. +* It increments a counter whenever a call is queued and decrements it +* as soon as it completes. When the counter hits 0, it calls onQueueEmpty. +*/ +var Queue = class { + count = 0; + constructor(onQueueEmpty) { + this.onQueueEmpty = onQueueEmpty; + } + enqueue() { + this.count++; + return this.count; + } + dequeue(error, output) { + if (this.onQueueEmpty && (--this.count <= 0 || error)) { + this.onQueueEmpty(error, output); + if (error) { + output.controller.abort(); + this.onQueueEmpty = void 0; + } + } + } +}; + +//#endregion +//#region src/api/counter.ts +var Counter = class { + _files = 0; + _directories = 0; + set files(num) { + this._files = num; + } + get files() { + return this._files; + } + set directories(num) { + this._directories = num; + } + get directories() { + return this._directories; + } + /** + * @deprecated use `directories` instead + */ + /* c8 ignore next 3 */ + get dirs() { + return this._directories; + } +}; + +//#endregion +//#region src/api/aborter.ts +/** +* AbortController is not supported on Node 14 so we use this until we can drop +* support for Node 14. +*/ +var Aborter = class { + aborted = false; + abort() { + this.aborted = true; + } +}; + +//#endregion +//#region src/api/walker.ts +var Walker = class { + root; + isSynchronous; + state; + joinPath; + pushDirectory; + pushFile; + getArray; + groupFiles; + resolveSymlink; + walkDirectory; + callbackInvoker; + constructor(root, options, callback$1) { + this.isSynchronous = !callback$1; + this.callbackInvoker = build$1(options, this.isSynchronous); + this.root = normalizePath(root, options); + this.state = { + root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1), + paths: [""].slice(0, 0), + groups: [], + counts: new Counter(), + options, + queue: new Queue((error, state) => this.callbackInvoker(state, error, callback$1)), + symlinks: /* @__PURE__ */ new Map(), + visited: [""].slice(0, 0), + controller: new Aborter(), + fs: options.fs || nativeFs + }; + this.joinPath = build$7(this.root, options); + this.pushDirectory = build$6(this.root, options); + this.pushFile = build$5(options); + this.getArray = build$4(options); + this.groupFiles = build$3(options); + this.resolveSymlink = build$2(options, this.isSynchronous); + this.walkDirectory = build(this.isSynchronous); + } + start() { + this.pushDirectory(this.root, this.state.paths, this.state.options.filters); + this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk); + return this.isSynchronous ? this.callbackInvoker(this.state, null) : null; + } + walk = (entries, directoryPath, depth) => { + const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state; + if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return; + const files = this.getArray(this.state.paths); + for (let i = 0; i < entries.length; ++i) { + const entry = entries[i]; + if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) { + const filename = this.joinPath(entry.name, directoryPath); + this.pushFile(filename, files, this.state.counts, filters); + } else if (entry.isDirectory()) { + let path = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator); + if (exclude && exclude(entry.name, path)) continue; + this.pushDirectory(path, paths, filters); + this.walkDirectory(this.state, path, path, depth - 1, this.walk); + } else if (this.resolveSymlink && entry.isSymbolicLink()) { + let path = joinPathWithBasePath(entry.name, directoryPath); + this.resolveSymlink(path, this.state, (stat, resolvedPath) => { + if (stat.isDirectory()) { + resolvedPath = normalizePath(resolvedPath, this.state.options); + if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator)) return; + this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk); + } else { + resolvedPath = useRealPaths ? resolvedPath : path; + const filename = basename(resolvedPath); + const directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options); + resolvedPath = this.joinPath(filename, directoryPath$1); + this.pushFile(resolvedPath, files, this.state.counts, filters); + } + }); + } + } + this.groupFiles(this.state.groups, directoryPath, files); + }; +}; + +//#endregion +//#region src/api/async.ts +function promise(root, options) { + return new Promise((resolve$1, reject) => { + callback(root, options, (err, output) => { + if (err) return reject(err); + resolve$1(output); + }); + }); +} +function callback(root, options, callback$1) { + let walker = new Walker(root, options, callback$1); + walker.start(); +} + +//#endregion +//#region src/api/sync.ts +function sync(root, options) { + const walker = new Walker(root, options); + return walker.start(); +} + +//#endregion +//#region src/builder/api-builder.ts +var APIBuilder = class { + constructor(root, options) { + this.root = root; + this.options = options; + } + withPromise() { + return promise(this.root, this.options); + } + withCallback(cb) { + callback(this.root, this.options, cb); + } + sync() { + return sync(this.root, this.options); + } +}; + +//#endregion +//#region src/builder/index.ts +let pm = null; +/* c8 ignore next 6 */ +try { + __require.resolve("picomatch"); + pm = __require("picomatch"); +} catch {} +var Builder = class { + globCache = {}; + options = { + maxDepth: Infinity, + suppressErrors: true, + pathSeparator: sep, + filters: [] + }; + globFunction; + constructor(options) { + this.options = { + ...this.options, + ...options + }; + this.globFunction = this.options.globFunction; + } + group() { + this.options.group = true; + return this; + } + withPathSeparator(separator) { + this.options.pathSeparator = separator; + return this; + } + withBasePath() { + this.options.includeBasePath = true; + return this; + } + withRelativePaths() { + this.options.relativePaths = true; + return this; + } + withDirs() { + this.options.includeDirs = true; + return this; + } + withMaxDepth(depth) { + this.options.maxDepth = depth; + return this; + } + withMaxFiles(limit) { + this.options.maxFiles = limit; + return this; + } + withFullPaths() { + this.options.resolvePaths = true; + this.options.includeBasePath = true; + return this; + } + withErrors() { + this.options.suppressErrors = false; + return this; + } + withSymlinks({ resolvePaths = true } = {}) { + this.options.resolveSymlinks = true; + this.options.useRealPaths = resolvePaths; + return this.withFullPaths(); + } + withAbortSignal(signal) { + this.options.signal = signal; + return this; + } + normalize() { + this.options.normalizePath = true; + return this; + } + filter(predicate) { + this.options.filters.push(predicate); + return this; + } + onlyDirs() { + this.options.excludeFiles = true; + this.options.includeDirs = true; + return this; + } + exclude(predicate) { + this.options.exclude = predicate; + return this; + } + onlyCounts() { + this.options.onlyCounts = true; + return this; + } + crawl(root) { + return new APIBuilder(root || ".", this.options); + } + withGlobFunction(fn) { + this.globFunction = fn; + return this; + } + /** + * @deprecated Pass options using the constructor instead: + * ```ts + * new fdir(options).crawl("/path/to/root"); + * ``` + * This method will be removed in v7.0 + */ + /* c8 ignore next 4 */ + crawlWithOptions(root, options) { + this.options = { + ...this.options, + ...options + }; + return new APIBuilder(root || ".", this.options); + } + glob(...patterns) { + if (this.globFunction) return this.globWithOptions(patterns); + return this.globWithOptions(patterns, ...[{ dot: true }]); + } + globWithOptions(patterns, ...options) { + const globFn = this.globFunction || pm; + /* c8 ignore next 5 */ + if (!globFn) throw new Error("Please specify a glob function to use glob matching."); + var isMatch = this.globCache[patterns.join("\0")]; + if (!isMatch) { + isMatch = globFn(patterns, ...options); + this.globCache[patterns.join("\0")] = isMatch; + } + this.options.filters.push((path) => isMatch(path)); + return this; + } +}; + +//#endregion +export { Builder as fdir }; \ No newline at end of file diff --git a/node_modules/fdir/package.json b/node_modules/fdir/package.json new file mode 100644 index 0000000..e229dff --- /dev/null +++ b/node_modules/fdir/package.json @@ -0,0 +1,103 @@ +{ + "name": "fdir", + "version": "6.5.0", + "description": "The fastest directory crawler & globbing alternative to glob, fast-glob, & tiny-glob. Crawls 1m files in < 1s", + "main": "./dist/index.cjs", + "types": "./dist/index.d.cts", + "type": "module", + "scripts": { + "prepublishOnly": "npm run test && npm run build", + "build": "tsdown", + "format": "prettier --write src __tests__ benchmarks", + "test": "vitest run __tests__/", + "test:coverage": "vitest run --coverage __tests__/", + "test:watch": "vitest __tests__/", + "bench": "ts-node benchmarks/benchmark.js", + "bench:glob": "ts-node benchmarks/glob-benchmark.ts", + "bench:fdir": "ts-node benchmarks/fdir-benchmark.ts", + "release": "./scripts/release.sh" + }, + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/thecodrr/fdir.git" + }, + "keywords": [ + "util", + "os", + "sys", + "fs", + "walk", + "crawler", + "directory", + "files", + "io", + "tiny-glob", + "glob", + "fast-glob", + "speed", + "javascript", + "nodejs" + ], + "author": "thecodrr ", + "license": "MIT", + "bugs": { + "url": "https://github.com/thecodrr/fdir/issues" + }, + "homepage": "https://github.com/thecodrr/fdir#readme", + "devDependencies": { + "@types/glob": "^8.1.0", + "@types/mock-fs": "^4.13.4", + "@types/node": "^20.9.4", + "@types/picomatch": "^4.0.0", + "@types/tap": "^15.0.11", + "@vitest/coverage-v8": "^0.34.6", + "all-files-in-tree": "^1.1.2", + "benny": "^3.7.1", + "csv-to-markdown-table": "^1.3.1", + "expect": "^29.7.0", + "fast-glob": "^3.3.2", + "fdir1": "npm:fdir@1.2.0", + "fdir2": "npm:fdir@2.1.0", + "fdir3": "npm:fdir@3.4.2", + "fdir4": "npm:fdir@4.1.0", + "fdir5": "npm:fdir@5.0.0", + "fs-readdir-recursive": "^1.1.0", + "get-all-files": "^4.1.0", + "glob": "^10.3.10", + "klaw-sync": "^6.0.0", + "mock-fs": "^5.2.0", + "picomatch": "^4.0.2", + "prettier": "^3.5.3", + "recur-readdir": "0.0.1", + "recursive-files": "^1.0.2", + "recursive-fs": "^2.1.0", + "recursive-readdir": "^2.2.3", + "rrdir": "^12.1.0", + "systeminformation": "^5.21.17", + "tiny-glob": "^0.2.9", + "ts-node": "^10.9.1", + "tsdown": "^0.12.5", + "typescript": "^5.3.2", + "vitest": "^0.34.6", + "walk-sync": "^3.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + }, + "module": "./dist/index.mjs", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.cjs" + }, + "./package.json": "./package.json" + } +} diff --git a/node_modules/nanoid/LICENSE b/node_modules/nanoid/LICENSE new file mode 100644 index 0000000..37f56aa --- /dev/null +++ b/node_modules/nanoid/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright 2017 Andrey Sitnik + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/nanoid/README.md b/node_modules/nanoid/README.md new file mode 100644 index 0000000..35abb57 --- /dev/null +++ b/node_modules/nanoid/README.md @@ -0,0 +1,39 @@ +# Nano ID + +Nano ID logo by Anton Lovchikov + +**English** | [Русский](./README.ru.md) | [简体中文](./README.zh-CN.md) | [Bahasa Indonesia](./README.id-ID.md) + +A tiny, secure, URL-friendly, unique string ID generator for JavaScript. + +> “An amazing level of senseless perfectionism, +> which is simply impossible not to respect.” + +* **Small.** 130 bytes (minified and gzipped). No dependencies. + [Size Limit] controls the size. +* **Fast.** It is 2 times faster than UUID. +* **Safe.** It uses hardware random generator. Can be used in clusters. +* **Short IDs.** It uses a larger alphabet than UUID (`A-Za-z0-9_-`). + So ID size was reduced from 36 to 21 symbols. +* **Portable.** Nano ID was ported + to [20 programming languages](#other-programming-languages). + +```js +import { nanoid } from 'nanoid' +model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT" +``` + +Supports modern browsers, IE [with Babel], Node.js and React Native. + +[online tool]: https://gitpod.io/#https://github.com/ai/nanoid/ +[with Babel]: https://developer.epages.com/blog/coding/how-to-transpile-node-modules-with-babel-and-webpack-in-a-monorepo/ +[Size Limit]: https://github.com/ai/size-limit + + + Sponsored by Evil Martians + + +## Docs +Read full docs **[here](https://github.com/ai/nanoid#readme)**. diff --git a/node_modules/nanoid/async/index.browser.cjs b/node_modules/nanoid/async/index.browser.cjs new file mode 100644 index 0000000..0c8521a --- /dev/null +++ b/node_modules/nanoid/async/index.browser.cjs @@ -0,0 +1,43 @@ +let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes)) + +let customAlphabet = (alphabet, defaultSize = 21) => { + let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 + + + + let step = -~((1.6 * mask * defaultSize) / alphabet.length) + + return async (size = defaultSize) => { + if (size <= 0) return '' + let id = '' + while (true) { + let bytes = crypto.getRandomValues(new Uint8Array(step)) + let i = step | 0 + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + } + } +} + +let nanoid = async (size = 21) => { + let id = '' + let bytes = crypto.getRandomValues(new Uint8Array((size |= 0))) + + while (size--) { + let byte = bytes[size] & 63 + if (byte < 36) { + id += byte.toString(36) + } else if (byte < 62) { + id += (byte - 26).toString(36).toUpperCase() + } else if (byte < 63) { + id += '_' + } else { + id += '-' + } + } + return id +} + +module.exports = { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/index.browser.js b/node_modules/nanoid/async/index.browser.js new file mode 100644 index 0000000..b10c13c --- /dev/null +++ b/node_modules/nanoid/async/index.browser.js @@ -0,0 +1,43 @@ +let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes)) + +let customAlphabet = (alphabet, defaultSize = 21) => { + let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 + + + + let step = -~((1.6 * mask * defaultSize) / alphabet.length) + + return async (size = defaultSize) => { + if (size <= 0) return '' + let id = '' + while (true) { + let bytes = crypto.getRandomValues(new Uint8Array(step)) + let i = step | 0 + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + } + } +} + +let nanoid = async (size = 21) => { + let id = '' + let bytes = crypto.getRandomValues(new Uint8Array((size |= 0))) + + while (size--) { + let byte = bytes[size] & 63 + if (byte < 36) { + id += byte.toString(36) + } else if (byte < 62) { + id += (byte - 26).toString(36).toUpperCase() + } else if (byte < 63) { + id += '_' + } else { + id += '-' + } + } + return id +} + +export { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/index.cjs b/node_modules/nanoid/async/index.cjs new file mode 100644 index 0000000..8f0529e --- /dev/null +++ b/node_modules/nanoid/async/index.cjs @@ -0,0 +1,47 @@ +let crypto = require('crypto') + +let { urlAlphabet } = require('../url-alphabet/index.cjs') + +let random = bytes => + new Promise((resolve, reject) => { + crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => { + if (err) { + reject(err) + } else { + resolve(buf) + } + }) + }) + +let customAlphabet = (alphabet, defaultSize = 21) => { + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + + + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + + let tick = (id, size = defaultSize) => + random(step).then(bytes => { + let i = step + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length >= size) return id + } + return tick(id, size) + }) + + return (size = defaultSize) => { + if (size <= 0) return Promise.resolve('') + return tick('', size) + } +} + +let nanoid = (size = 21) => + random((size |= 0)).then(bytes => { + let id = '' + while (size--) { + id += urlAlphabet[bytes[size] & 63] + } + return id + }) + +module.exports = { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/index.d.ts b/node_modules/nanoid/async/index.d.ts new file mode 100644 index 0000000..9e91965 --- /dev/null +++ b/node_modules/nanoid/async/index.d.ts @@ -0,0 +1,56 @@ +/** + * Generate secure URL-friendly unique ID. The non-blocking version. + * + * By default, the ID will have 21 symbols to have a collision probability + * similar to UUID v4. + * + * ```js + * import { nanoid } from 'nanoid/async' + * nanoid().then(id => { + * model.id = id + * }) + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A promise with a random string. + */ +export function nanoid(size?: number): Promise + +/** + * A low-level function. + * Generate secure unique ID with custom alphabet. The non-blocking version. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * @param alphabet Alphabet used to generate the ID. + * @param defaultSize Size of the ID. The default size is 21. + * @returns A function that returns a promise with a random string. + * + * ```js + * import { customAlphabet } from 'nanoid/async' + * const nanoid = customAlphabet('0123456789абвгдеё', 5) + * nanoid().then(id => { + * model.id = id //=> "8ё56а" + * }) + * ``` + */ +export function customAlphabet( + alphabet: string, + defaultSize?: number +): (size?: number) => Promise + +/** + * Generate an array of random bytes collected from hardware noise. + * + * ```js + * import { random } from 'nanoid/async' + * random(5).then(bytes => { + * bytes //=> [10, 67, 212, 67, 89] + * }) + * ``` + * + * @param bytes Size of the array. + * @returns A promise with a random bytes array. + */ +export function random(bytes: number): Promise diff --git a/node_modules/nanoid/async/index.js b/node_modules/nanoid/async/index.js new file mode 100644 index 0000000..1364176 --- /dev/null +++ b/node_modules/nanoid/async/index.js @@ -0,0 +1,47 @@ +import crypto from 'crypto' + +import { urlAlphabet } from '../url-alphabet/index.js' + +let random = bytes => + new Promise((resolve, reject) => { + crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => { + if (err) { + reject(err) + } else { + resolve(buf) + } + }) + }) + +let customAlphabet = (alphabet, defaultSize = 21) => { + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + + + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + + let tick = (id, size = defaultSize) => + random(step).then(bytes => { + let i = step + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length >= size) return id + } + return tick(id, size) + }) + + return (size = defaultSize) => { + if (size <= 0) return Promise.resolve('') + return tick('', size) + } +} + +let nanoid = (size = 21) => + random((size |= 0)).then(bytes => { + let id = '' + while (size--) { + id += urlAlphabet[bytes[size] & 63] + } + return id + }) + +export { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/index.native.js b/node_modules/nanoid/async/index.native.js new file mode 100644 index 0000000..0e9df8c --- /dev/null +++ b/node_modules/nanoid/async/index.native.js @@ -0,0 +1,38 @@ +import { getRandomBytesAsync } from 'expo-random' + +import { urlAlphabet } from '../url-alphabet/index.js' + +let random = getRandomBytesAsync + +let customAlphabet = (alphabet, defaultSize = 21) => { + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + + + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + + let tick = (id, size = defaultSize) => + random(step).then(bytes => { + let i = step + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length >= size) return id + } + return tick(id, size) + }) + + return (size = defaultSize) => { + if (size <= 0) return Promise.resolve('') + return tick('', size) + } +} + +let nanoid = (size = 21) => + random((size |= 0)).then(bytes => { + let id = '' + while (size--) { + id += urlAlphabet[bytes[size] & 63] + } + return id + }) + +export { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/package.json b/node_modules/nanoid/async/package.json new file mode 100644 index 0000000..578cdb4 --- /dev/null +++ b/node_modules/nanoid/async/package.json @@ -0,0 +1,12 @@ +{ + "type": "module", + "main": "index.cjs", + "module": "index.js", + "react-native": { + "./index.js": "./index.native.js" + }, + "browser": { + "./index.js": "./index.browser.js", + "./index.cjs": "./index.browser.cjs" + } +} \ No newline at end of file diff --git a/node_modules/nanoid/bin/nanoid.cjs b/node_modules/nanoid/bin/nanoid.cjs new file mode 100755 index 0000000..c76db0f --- /dev/null +++ b/node_modules/nanoid/bin/nanoid.cjs @@ -0,0 +1,55 @@ +#!/usr/bin/env node + +let { nanoid, customAlphabet } = require('..') + +function print(msg) { + process.stdout.write(msg + '\n') +} + +function error(msg) { + process.stderr.write(msg + '\n') + process.exit(1) +} + +if (process.argv.includes('--help') || process.argv.includes('-h')) { + print(` + Usage + $ nanoid [options] + + Options + -s, --size Generated ID size + -a, --alphabet Alphabet to use + -h, --help Show this help + + Examples + $ nanoid --s 15 + S9sBF77U6sDB8Yg + + $ nanoid --size 10 --alphabet abc + bcabababca`) + process.exit() +} + +let alphabet, size +for (let i = 2; i < process.argv.length; i++) { + let arg = process.argv[i] + if (arg === '--size' || arg === '-s') { + size = Number(process.argv[i + 1]) + i += 1 + if (Number.isNaN(size) || size <= 0) { + error('Size must be positive integer') + } + } else if (arg === '--alphabet' || arg === '-a') { + alphabet = process.argv[i + 1] + i += 1 + } else { + error('Unknown argument ' + arg) + } +} + +if (alphabet) { + let customNanoid = customAlphabet(alphabet, size) + print(customNanoid()) +} else { + print(nanoid(size)) +} diff --git a/node_modules/nanoid/index.browser.cjs b/node_modules/nanoid/index.browser.cjs new file mode 100644 index 0000000..4de57f0 --- /dev/null +++ b/node_modules/nanoid/index.browser.cjs @@ -0,0 +1,45 @@ + +let { urlAlphabet } = require('./url-alphabet/index.cjs') + +let random = bytes => crypto.getRandomValues(new Uint8Array(bytes)) + +let customRandom = (alphabet, defaultSize, getRandom) => { + let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 + + + + let step = -~((1.6 * mask * defaultSize) / alphabet.length) + + return (size = defaultSize) => { + if (size <= 0) return '' + let id = '' + while (true) { + let bytes = getRandom(step) + let j = step | 0 + while (j--) { + id += alphabet[bytes[j] & mask] || '' + if (id.length === size) return id + } + } + } +} + +let customAlphabet = (alphabet, size = 21) => + customRandom(alphabet, size, random) + +let nanoid = (size = 21) => + crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => { + byte &= 63 + if (byte < 36) { + id += byte.toString(36) + } else if (byte < 62) { + id += (byte - 26).toString(36).toUpperCase() + } else if (byte > 62) { + id += '-' + } else { + id += '_' + } + return id + }, '') + +module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/node_modules/nanoid/index.browser.js b/node_modules/nanoid/index.browser.js new file mode 100644 index 0000000..03da901 --- /dev/null +++ b/node_modules/nanoid/index.browser.js @@ -0,0 +1,45 @@ + +import { urlAlphabet } from './url-alphabet/index.js' + +let random = bytes => crypto.getRandomValues(new Uint8Array(bytes)) + +let customRandom = (alphabet, defaultSize, getRandom) => { + let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 + + + + let step = -~((1.6 * mask * defaultSize) / alphabet.length) + + return (size = defaultSize) => { + if (size <= 0) return '' + let id = '' + while (true) { + let bytes = getRandom(step) + let j = step | 0 + while (j--) { + id += alphabet[bytes[j] & mask] || '' + if (id.length === size) return id + } + } + } +} + +let customAlphabet = (alphabet, size = 21) => + customRandom(alphabet, size, random) + +let nanoid = (size = 21) => + crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => { + byte &= 63 + if (byte < 36) { + id += byte.toString(36) + } else if (byte < 62) { + id += (byte - 26).toString(36).toUpperCase() + } else if (byte > 62) { + id += '-' + } else { + id += '_' + } + return id + }, '') + +export { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/node_modules/nanoid/index.cjs b/node_modules/nanoid/index.cjs new file mode 100644 index 0000000..53856b7 --- /dev/null +++ b/node_modules/nanoid/index.cjs @@ -0,0 +1,63 @@ +let crypto = require('crypto') + +let { urlAlphabet } = require('./url-alphabet/index.cjs') + +const POOL_SIZE_MULTIPLIER = 128 +let pool, poolOffset + +let fillPool = bytes => { + if (bytes < 0 || bytes > 1024) throw new RangeError('Wrong ID size') + try { + if (!pool || pool.length < bytes) { + pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER) + crypto.randomFillSync(pool) + poolOffset = 0 + } else if (poolOffset + bytes > pool.length) { + crypto.randomFillSync(pool) + poolOffset = 0 + } + } catch (e) { + pool = undefined + throw e + } + poolOffset += bytes +} + +let random = bytes => { + fillPool((bytes |= 0)) + return pool.subarray(poolOffset - bytes, poolOffset) +} + +let customRandom = (alphabet, defaultSize, getRandom) => { + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + + + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + + return (size = defaultSize) => { + if (size <= 0) return '' + let id = '' + while (true) { + let bytes = getRandom(step) + let i = step + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + } + } +} + +let customAlphabet = (alphabet, size = 21) => + customRandom(alphabet, size, random) + +let nanoid = (size = 21) => { + fillPool((size |= 0)) + let id = '' + for (let i = poolOffset - size; i < poolOffset; i++) { + id += urlAlphabet[pool[i] & 63] + } + return id +} + +module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/node_modules/nanoid/index.d.cts b/node_modules/nanoid/index.d.cts new file mode 100644 index 0000000..3e111a3 --- /dev/null +++ b/node_modules/nanoid/index.d.cts @@ -0,0 +1,91 @@ +/** + * Generate secure URL-friendly unique ID. + * + * By default, the ID will have 21 symbols to have a collision probability + * similar to UUID v4. + * + * ```js + * import { nanoid } from 'nanoid' + * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A random string. + */ +export function nanoid(size?: number): string + +/** + * Generate secure unique ID with custom alphabet. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * @param alphabet Alphabet used to generate the ID. + * @param defaultSize Size of the ID. The default size is 21. + * @returns A random string generator. + * + * ```js + * const { customAlphabet } = require('nanoid') + * const nanoid = customAlphabet('0123456789абвгдеё', 5) + * nanoid() //=> "8ё56а" + * ``` + */ +export function customAlphabet( + alphabet: string, + defaultSize?: number +): (size?: number) => string + +/** + * Generate unique ID with custom random generator and alphabet. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * ```js + * import { customRandom } from 'nanoid/format' + * + * const nanoid = customRandom('abcdef', 5, size => { + * const random = [] + * for (let i = 0; i < size; i++) { + * random.push(randomByte()) + * } + * return random + * }) + * + * nanoid() //=> "fbaef" + * ``` + * + * @param alphabet Alphabet used to generate a random string. + * @param size Size of the random string. + * @param random A random bytes generator. + * @returns A random string generator. + */ +export function customRandom( + alphabet: string, + size: number, + random: (bytes: number) => Uint8Array +): () => string + +/** + * URL safe symbols. + * + * ```js + * import { urlAlphabet } from 'nanoid' + * const nanoid = customAlphabet(urlAlphabet, 10) + * nanoid() //=> "Uakgb_J5m9" + * ``` + */ +export const urlAlphabet: string + +/** + * Generate an array of random bytes collected from hardware noise. + * + * ```js + * import { customRandom, random } from 'nanoid' + * const nanoid = customRandom("abcdef", 5, random) + * ``` + * + * @param bytes Size of the array. + * @returns An array of random bytes. + */ +export function random(bytes: number): Uint8Array diff --git a/node_modules/nanoid/index.d.ts b/node_modules/nanoid/index.d.ts new file mode 100644 index 0000000..3e111a3 --- /dev/null +++ b/node_modules/nanoid/index.d.ts @@ -0,0 +1,91 @@ +/** + * Generate secure URL-friendly unique ID. + * + * By default, the ID will have 21 symbols to have a collision probability + * similar to UUID v4. + * + * ```js + * import { nanoid } from 'nanoid' + * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A random string. + */ +export function nanoid(size?: number): string + +/** + * Generate secure unique ID with custom alphabet. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * @param alphabet Alphabet used to generate the ID. + * @param defaultSize Size of the ID. The default size is 21. + * @returns A random string generator. + * + * ```js + * const { customAlphabet } = require('nanoid') + * const nanoid = customAlphabet('0123456789абвгдеё', 5) + * nanoid() //=> "8ё56а" + * ``` + */ +export function customAlphabet( + alphabet: string, + defaultSize?: number +): (size?: number) => string + +/** + * Generate unique ID with custom random generator and alphabet. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * ```js + * import { customRandom } from 'nanoid/format' + * + * const nanoid = customRandom('abcdef', 5, size => { + * const random = [] + * for (let i = 0; i < size; i++) { + * random.push(randomByte()) + * } + * return random + * }) + * + * nanoid() //=> "fbaef" + * ``` + * + * @param alphabet Alphabet used to generate a random string. + * @param size Size of the random string. + * @param random A random bytes generator. + * @returns A random string generator. + */ +export function customRandom( + alphabet: string, + size: number, + random: (bytes: number) => Uint8Array +): () => string + +/** + * URL safe symbols. + * + * ```js + * import { urlAlphabet } from 'nanoid' + * const nanoid = customAlphabet(urlAlphabet, 10) + * nanoid() //=> "Uakgb_J5m9" + * ``` + */ +export const urlAlphabet: string + +/** + * Generate an array of random bytes collected from hardware noise. + * + * ```js + * import { customRandom, random } from 'nanoid' + * const nanoid = customRandom("abcdef", 5, random) + * ``` + * + * @param bytes Size of the array. + * @returns An array of random bytes. + */ +export function random(bytes: number): Uint8Array diff --git a/node_modules/nanoid/index.js b/node_modules/nanoid/index.js new file mode 100644 index 0000000..213fdb0 --- /dev/null +++ b/node_modules/nanoid/index.js @@ -0,0 +1,63 @@ +import crypto from 'crypto' + +import { urlAlphabet } from './url-alphabet/index.js' + +const POOL_SIZE_MULTIPLIER = 128 +let pool, poolOffset + +let fillPool = bytes => { + if (bytes < 0 || bytes > 1024) throw new RangeError('Wrong ID size') + try { + if (!pool || pool.length < bytes) { + pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER) + crypto.randomFillSync(pool) + poolOffset = 0 + } else if (poolOffset + bytes > pool.length) { + crypto.randomFillSync(pool) + poolOffset = 0 + } + } catch (e) { + pool = undefined + throw e + } + poolOffset += bytes +} + +let random = bytes => { + fillPool((bytes |= 0)) + return pool.subarray(poolOffset - bytes, poolOffset) +} + +let customRandom = (alphabet, defaultSize, getRandom) => { + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + + + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + + return (size = defaultSize) => { + if (size <= 0) return '' + let id = '' + while (true) { + let bytes = getRandom(step) + let i = step + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + } + } +} + +let customAlphabet = (alphabet, size = 21) => + customRandom(alphabet, size, random) + +let nanoid = (size = 21) => { + fillPool((size |= 0)) + let id = '' + for (let i = poolOffset - size; i < poolOffset; i++) { + id += urlAlphabet[pool[i] & 63] + } + return id +} + +export { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/node_modules/nanoid/nanoid.js b/node_modules/nanoid/nanoid.js new file mode 100644 index 0000000..ec242ea --- /dev/null +++ b/node_modules/nanoid/nanoid.js @@ -0,0 +1 @@ +export let nanoid=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e<63?"_":"-"),""); \ No newline at end of file diff --git a/node_modules/nanoid/non-secure/index.cjs b/node_modules/nanoid/non-secure/index.cjs new file mode 100644 index 0000000..5f1e743 --- /dev/null +++ b/node_modules/nanoid/non-secure/index.cjs @@ -0,0 +1,24 @@ +let urlAlphabet = + 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' + +let customAlphabet = (alphabet, defaultSize = 21) => { + return (size = defaultSize) => { + let id = '' + let i = size | 0 + while (i-- > 0) { + id += alphabet[(Math.random() * alphabet.length) | 0] + } + return id + } +} + +let nanoid = (size = 21) => { + let id = '' + let i = size | 0 + while (i-- > 0) { + id += urlAlphabet[(Math.random() * 64) | 0] + } + return id +} + +module.exports = { nanoid, customAlphabet } diff --git a/node_modules/nanoid/non-secure/index.d.ts b/node_modules/nanoid/non-secure/index.d.ts new file mode 100644 index 0000000..4965322 --- /dev/null +++ b/node_modules/nanoid/non-secure/index.d.ts @@ -0,0 +1,33 @@ +/** + * Generate URL-friendly unique ID. This method uses the non-secure + * predictable random generator with bigger collision probability. + * + * ```js + * import { nanoid } from 'nanoid/non-secure' + * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A random string. + */ +export function nanoid(size?: number): string + +/** + * Generate a unique ID based on a custom alphabet. + * This method uses the non-secure predictable random generator + * with bigger collision probability. + * + * @param alphabet Alphabet used to generate the ID. + * @param defaultSize Size of the ID. The default size is 21. + * @returns A random string generator. + * + * ```js + * import { customAlphabet } from 'nanoid/non-secure' + * const nanoid = customAlphabet('0123456789абвгдеё', 5) + * model.id = //=> "8ё56а" + * ``` + */ +export function customAlphabet( + alphabet: string, + defaultSize?: number +): (size?: number) => string diff --git a/node_modules/nanoid/non-secure/index.js b/node_modules/nanoid/non-secure/index.js new file mode 100644 index 0000000..2848f3f --- /dev/null +++ b/node_modules/nanoid/non-secure/index.js @@ -0,0 +1,24 @@ +let urlAlphabet = + 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' + +let customAlphabet = (alphabet, defaultSize = 21) => { + return (size = defaultSize) => { + let id = '' + let i = size | 0 + while (i-- > 0) { + id += alphabet[(Math.random() * alphabet.length) | 0] + } + return id + } +} + +let nanoid = (size = 21) => { + let id = '' + let i = size | 0 + while (i-- > 0) { + id += urlAlphabet[(Math.random() * 64) | 0] + } + return id +} + +export { nanoid, customAlphabet } diff --git a/node_modules/nanoid/non-secure/package.json b/node_modules/nanoid/non-secure/package.json new file mode 100644 index 0000000..9930d6a --- /dev/null +++ b/node_modules/nanoid/non-secure/package.json @@ -0,0 +1,6 @@ +{ + "type": "module", + "main": "index.cjs", + "module": "index.js", + "react-native": "index.js" +} \ No newline at end of file diff --git a/node_modules/nanoid/package.json b/node_modules/nanoid/package.json new file mode 100644 index 0000000..d556bd8 --- /dev/null +++ b/node_modules/nanoid/package.json @@ -0,0 +1,89 @@ +{ + "name": "nanoid", + "version": "3.3.19", + "description": "A tiny (116 bytes), secure URL-friendly unique string ID generator", + "keywords": [ + "uuid", + "random", + "id", + "url" + ], + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "author": "Andrey Sitnik ", + "license": "MIT", + "repository": "ai/nanoid", + "browser": { + "./index.js": "./index.browser.js", + "./async/index.js": "./async/index.browser.js", + "./async/index.cjs": "./async/index.browser.cjs", + "./index.cjs": "./index.browser.cjs" + }, + "react-native": "index.js", + "bin": "./bin/nanoid.cjs", + "sideEffects": false, + "types": "./index.d.ts", + "type": "module", + "main": "index.cjs", + "module": "index.js", + "exports": { + ".": { + "react-native": "./index.browser.js", + "browser": "./index.browser.js", + "require": { + "types": "./index.d.cts", + "default": "./index.cjs" + }, + "import": { + "types": "./index.d.ts", + "default": "./index.js" + }, + "default": "./index.js" + }, + "./package.json": "./package.json", + "./async/package.json": "./async/package.json", + "./async": { + "browser": "./async/index.browser.js", + "require": { + "types": "./index.d.cts", + "default": "./async/index.cjs" + }, + "import": { + "types": "./index.d.ts", + "default": "./async/index.js" + }, + "default": "./async/index.js" + }, + "./non-secure/package.json": "./non-secure/package.json", + "./non-secure": { + "require": { + "types": "./index.d.cts", + "default": "./non-secure/index.cjs" + }, + "import": { + "types": "./index.d.ts", + "default": "./non-secure/index.js" + }, + "default": "./non-secure/index.js" + }, + "./url-alphabet/package.json": "./url-alphabet/package.json", + "./url-alphabet": { + "require": { + "types": "./index.d.cts", + "default": "./url-alphabet/index.cjs" + }, + "import": { + "types": "./index.d.ts", + "default": "./url-alphabet/index.js" + }, + "default": "./url-alphabet/index.js" + } + } +} diff --git a/node_modules/nanoid/url-alphabet/index.cjs b/node_modules/nanoid/url-alphabet/index.cjs new file mode 100644 index 0000000..9021f0b --- /dev/null +++ b/node_modules/nanoid/url-alphabet/index.cjs @@ -0,0 +1,4 @@ +let urlAlphabet = + 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' + +module.exports = { urlAlphabet } diff --git a/node_modules/nanoid/url-alphabet/index.js b/node_modules/nanoid/url-alphabet/index.js new file mode 100644 index 0000000..f995c4f --- /dev/null +++ b/node_modules/nanoid/url-alphabet/index.js @@ -0,0 +1,4 @@ +let urlAlphabet = + 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' + +export { urlAlphabet } diff --git a/node_modules/nanoid/url-alphabet/package.json b/node_modules/nanoid/url-alphabet/package.json new file mode 100644 index 0000000..9930d6a --- /dev/null +++ b/node_modules/nanoid/url-alphabet/package.json @@ -0,0 +1,6 @@ +{ + "type": "module", + "main": "index.cjs", + "module": "index.js", + "react-native": "index.js" +} \ No newline at end of file diff --git a/node_modules/picocolors/LICENSE b/node_modules/picocolors/LICENSE new file mode 100644 index 0000000..46c9b95 --- /dev/null +++ b/node_modules/picocolors/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/picocolors/README.md b/node_modules/picocolors/README.md new file mode 100644 index 0000000..8e47aa8 --- /dev/null +++ b/node_modules/picocolors/README.md @@ -0,0 +1,21 @@ +# picocolors + +The tiniest and the fastest library for terminal output formatting with ANSI colors. + +```javascript +import pc from "picocolors" + +console.log( + pc.green(`How are ${pc.italic(`you`)} doing?`) +) +``` + +- **No dependencies.** +- **14 times** smaller and **2 times** faster than chalk. +- Used by popular tools like PostCSS, SVGO, Stylelint, and Browserslist. +- Node.js v6+ & browsers support. Support for both CJS and ESM projects. +- TypeScript type declarations included. +- [`NO_COLOR`](https://no-color.org/) friendly. + +## Docs +Read **[full docs](https://github.com/alexeyraspopov/picocolors#readme)** on GitHub. diff --git a/node_modules/picocolors/package.json b/node_modules/picocolors/package.json new file mode 100644 index 0000000..372d4b6 --- /dev/null +++ b/node_modules/picocolors/package.json @@ -0,0 +1,25 @@ +{ + "name": "picocolors", + "version": "1.1.1", + "main": "./picocolors.js", + "types": "./picocolors.d.ts", + "browser": { + "./picocolors.js": "./picocolors.browser.js" + }, + "sideEffects": false, + "description": "The tiniest and the fastest library for terminal output formatting with ANSI colors", + "files": [ + "picocolors.*", + "types.d.ts" + ], + "keywords": [ + "terminal", + "colors", + "formatting", + "cli", + "console" + ], + "author": "Alexey Raspopov", + "repository": "alexeyraspopov/picocolors", + "license": "ISC" +} diff --git a/node_modules/picocolors/picocolors.browser.js b/node_modules/picocolors/picocolors.browser.js new file mode 100644 index 0000000..9dcf637 --- /dev/null +++ b/node_modules/picocolors/picocolors.browser.js @@ -0,0 +1,4 @@ +var x=String; +var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x,blackBright:x,redBright:x,greenBright:x,yellowBright:x,blueBright:x,magentaBright:x,cyanBright:x,whiteBright:x,bgBlackBright:x,bgRedBright:x,bgGreenBright:x,bgYellowBright:x,bgBlueBright:x,bgMagentaBright:x,bgCyanBright:x,bgWhiteBright:x}}; +module.exports=create(); +module.exports.createColors = create; diff --git a/node_modules/picocolors/picocolors.d.ts b/node_modules/picocolors/picocolors.d.ts new file mode 100644 index 0000000..94e146a --- /dev/null +++ b/node_modules/picocolors/picocolors.d.ts @@ -0,0 +1,5 @@ +import { Colors } from "./types" + +declare const picocolors: Colors & { createColors: (enabled?: boolean) => Colors } + +export = picocolors diff --git a/node_modules/picocolors/picocolors.js b/node_modules/picocolors/picocolors.js new file mode 100644 index 0000000..e32df85 --- /dev/null +++ b/node_modules/picocolors/picocolors.js @@ -0,0 +1,75 @@ +let p = process || {}, argv = p.argv || [], env = p.env || {} +let isColorSupported = + !(!!env.NO_COLOR || argv.includes("--no-color")) && + (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI) + +let formatter = (open, close, replace = open) => + input => { + let string = "" + input, index = string.indexOf(close, open.length) + return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close + } + +let replaceClose = (string, close, replace, index) => { + let result = "", cursor = 0 + do { + result += string.substring(cursor, index) + replace + cursor = index + close.length + index = string.indexOf(close, cursor) + } while (~index) + return result + string.substring(cursor) +} + +let createColors = (enabled = isColorSupported) => { + let f = enabled ? formatter : () => String + return { + isColorSupported: enabled, + reset: f("\x1b[0m", "\x1b[0m"), + bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"), + dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"), + italic: f("\x1b[3m", "\x1b[23m"), + underline: f("\x1b[4m", "\x1b[24m"), + inverse: f("\x1b[7m", "\x1b[27m"), + hidden: f("\x1b[8m", "\x1b[28m"), + strikethrough: f("\x1b[9m", "\x1b[29m"), + + black: f("\x1b[30m", "\x1b[39m"), + red: f("\x1b[31m", "\x1b[39m"), + green: f("\x1b[32m", "\x1b[39m"), + yellow: f("\x1b[33m", "\x1b[39m"), + blue: f("\x1b[34m", "\x1b[39m"), + magenta: f("\x1b[35m", "\x1b[39m"), + cyan: f("\x1b[36m", "\x1b[39m"), + white: f("\x1b[37m", "\x1b[39m"), + gray: f("\x1b[90m", "\x1b[39m"), + + bgBlack: f("\x1b[40m", "\x1b[49m"), + bgRed: f("\x1b[41m", "\x1b[49m"), + bgGreen: f("\x1b[42m", "\x1b[49m"), + bgYellow: f("\x1b[43m", "\x1b[49m"), + bgBlue: f("\x1b[44m", "\x1b[49m"), + bgMagenta: f("\x1b[45m", "\x1b[49m"), + bgCyan: f("\x1b[46m", "\x1b[49m"), + bgWhite: f("\x1b[47m", "\x1b[49m"), + + blackBright: f("\x1b[90m", "\x1b[39m"), + redBright: f("\x1b[91m", "\x1b[39m"), + greenBright: f("\x1b[92m", "\x1b[39m"), + yellowBright: f("\x1b[93m", "\x1b[39m"), + blueBright: f("\x1b[94m", "\x1b[39m"), + magentaBright: f("\x1b[95m", "\x1b[39m"), + cyanBright: f("\x1b[96m", "\x1b[39m"), + whiteBright: f("\x1b[97m", "\x1b[39m"), + + bgBlackBright: f("\x1b[100m", "\x1b[49m"), + bgRedBright: f("\x1b[101m", "\x1b[49m"), + bgGreenBright: f("\x1b[102m", "\x1b[49m"), + bgYellowBright: f("\x1b[103m", "\x1b[49m"), + bgBlueBright: f("\x1b[104m", "\x1b[49m"), + bgMagentaBright: f("\x1b[105m", "\x1b[49m"), + bgCyanBright: f("\x1b[106m", "\x1b[49m"), + bgWhiteBright: f("\x1b[107m", "\x1b[49m"), + } +} + +module.exports = createColors() +module.exports.createColors = createColors diff --git a/node_modules/picocolors/types.d.ts b/node_modules/picocolors/types.d.ts new file mode 100644 index 0000000..cd1aec4 --- /dev/null +++ b/node_modules/picocolors/types.d.ts @@ -0,0 +1,51 @@ +export type Formatter = (input: string | number | null | undefined) => string + +export interface Colors { + isColorSupported: boolean + + reset: Formatter + bold: Formatter + dim: Formatter + italic: Formatter + underline: Formatter + inverse: Formatter + hidden: Formatter + strikethrough: Formatter + + black: Formatter + red: Formatter + green: Formatter + yellow: Formatter + blue: Formatter + magenta: Formatter + cyan: Formatter + white: Formatter + gray: Formatter + + bgBlack: Formatter + bgRed: Formatter + bgGreen: Formatter + bgYellow: Formatter + bgBlue: Formatter + bgMagenta: Formatter + bgCyan: Formatter + bgWhite: Formatter + + blackBright: Formatter + redBright: Formatter + greenBright: Formatter + yellowBright: Formatter + blueBright: Formatter + magentaBright: Formatter + cyanBright: Formatter + whiteBright: Formatter + + bgBlackBright: Formatter + bgRedBright: Formatter + bgGreenBright: Formatter + bgYellowBright: Formatter + bgBlueBright: Formatter + bgMagentaBright: Formatter + bgCyanBright: Formatter + bgWhiteBright: Formatter +} diff --git a/node_modules/picomatch/LICENSE b/node_modules/picomatch/LICENSE new file mode 100644 index 0000000..3608dca --- /dev/null +++ b/node_modules/picomatch/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017-present, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/picomatch/README.md b/node_modules/picomatch/README.md new file mode 100644 index 0000000..a480c74 --- /dev/null +++ b/node_modules/picomatch/README.md @@ -0,0 +1,743 @@ +

Picomatch

+ +

+ +version + + +test status + + +coverage status + + +downloads + +

+ +
+
+ +

+Blazing fast and accurate glob matcher written in JavaScript.
+No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. +

+ +
+
+ +## Why picomatch? + +* **Lightweight** - No dependencies +* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. +* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) +* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) +* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. +* **Well tested** - Thousands of unit tests + +See the [library comparison](#library-comparisons) to other libraries. + +
+
+ +## Table of Contents + +
Click to expand + +- [Install](#install) +- [Usage](#usage) +- [API](#api) + * [picomatch](#picomatch) + * [.test](#test) + * [.matchBase](#matchbase) + * [.isMatch](#ismatch) + * [.parse](#parse) + * [.scan](#scan) + * [.compileRe](#compilere) + * [.makeRe](#makere) + * [.toRegex](#toregex) +- [Options](#options) + * [Picomatch options](#picomatch-options) + * [Scan Options](#scan-options) + * [Options Examples](#options-examples) +- [Globbing features](#globbing-features) + * [Basic globbing](#basic-globbing) + * [Advanced globbing](#advanced-globbing) + * [Braces](#braces) + * [Matching special characters as literals](#matching-special-characters-as-literals) +- [Library Comparisons](#library-comparisons) +- [Benchmarks](#benchmarks) +- [Philosophies](#philosophies) +- [About](#about) + * [Author](#author) + * [License](#license) + +_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ + +
+ +
+
+ +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +npm install --save picomatch +``` + +
+ +## Usage + +The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. + +```js +const pm = require('picomatch'); +const isMatch = pm('*.js'); + +console.log(isMatch('abcd')); //=> false +console.log(isMatch('a.js')); //=> true +console.log(isMatch('a.md')); //=> false +console.log(isMatch('a/b.js')); //=> false +``` + +
+ +## API + +### [picomatch](lib/picomatch.js#L43) + +Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. + +**Params** + +* `globs` **{String|Array}**: One or more glob patterns. +* `options` **{Object=}** +* `returns` **{Function=}**: Returns a matcher function. + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch(glob[, options]); + +const isMatch = picomatch('*.!(*a)'); +console.log(isMatch('a.a')); //=> false +console.log(isMatch('a.b')); //=> true + +// For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection. +const picomatch = require('picomatch/posix'); +// the same API, defaulting to posix paths +const isMatch = picomatch('a/*'); +console.log(isMatch('a\\b')); //=> false +console.log(isMatch('a/b')); //=> true + +// you can still configure the matcher function to accept windows paths +const isMatch = picomatch('a/*', { options: windows }); +console.log(isMatch('a\\b')); //=> true +console.log(isMatch('a/b')); //=> true +``` + +### [.test](lib/picomatch.js#L128) + +Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. + +**Params** + +* `input` **{String}**: String to test. +* `regex` **{RegExp}** +* `returns` **{Object}**: Returns an object with matching info. + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.test(input, regex[, options]); + +console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); +// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } +``` + +### [.matchBase](lib/picomatch.js#L172) + +Match the basename of a filepath. + +**Params** + +* `input` **{String}**: String to test. +* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). +* `returns` **{Boolean}** + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.matchBase(input, glob[, options]); +console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true +``` + +### [.isMatch](lib/picomatch.js#L194) + +Returns true if **any** of the given glob `patterns` match the specified `string`. + +**Params** + +* **{String|Array}**: str The string to test. +* **{String|Array}**: patterns One or more glob patterns to use for matching. +* **{Object}**: See available [options](#options). +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.isMatch(string, patterns[, options]); + +console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true +console.log(picomatch.isMatch('a.a', 'b.*')); //=> false +``` + +### [.parse](lib/picomatch.js#L210) + +Parse a glob pattern to create the source string for a regular expression. + +**Params** + +* `pattern` **{String}** +* `options` **{Object}** +* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. + +**Example** + +```js +const picomatch = require('picomatch'); +const result = picomatch.parse(pattern[, options]); +``` + +### [.scan](lib/picomatch.js#L242) + +Scan a glob pattern to separate the pattern into segments. + +**Params** + +* `input` **{String}**: Glob pattern to scan. +* `options` **{Object}** +* `returns` **{Object}**: Returns an object with + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.scan(input[, options]); + +const result = picomatch.scan('!./foo/*.js'); +console.log(result); +{ prefix: '!./', + input: '!./foo/*.js', + start: 3, + base: 'foo', + glob: '*.js', + isBrace: false, + isBracket: false, + isGlob: true, + isExtglob: false, + isGlobstar: false, + negated: true } +``` + +### [.compileRe](lib/picomatch.js#L264) + +Compile a regular expression from the `state` object returned by the [parse()](#parse) method. + +**Params** + +* `state` **{Object}** +* `options` **{Object}** +* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser. +* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. +* `returns` **{RegExp}** + +**Example** + +```js +const picomatch = require('picomatch'); +const state = picomatch.parse('*.js'); +// picomatch.compileRe(state[, options]); + +console.log(picomatch.compileRe(state)); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +### [.makeRe](lib/picomatch.js#L305) + +Create a regular expression from a parsed glob pattern. + +**Params** + +* `state` **{String}**: The object returned from the `.parse` method. +* `options` **{Object}** +* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. +* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression. +* `returns` **{RegExp}**: Returns a regex created from the given pattern. + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.makeRe(state[, options]); + +const result = picomatch.makeRe('*.js'); +console.log(result); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +### [.toRegex](lib/picomatch.js#L340) + +Create a regular expression from the given regex source string. + +**Params** + +* `source` **{String}**: Regular expression source string. +* `options` **{Object}** +* `returns` **{RegExp}** + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.toRegex(source[, options]); + +const { output } = picomatch.parse('*.js'); +console.log(picomatch.toRegex(output)); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +
+ +## Options + +### Picomatch options + +The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. + +| **Option** | **Type** | **Default value** | **Description** | +| --- | --- | --- | --- | +| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | +| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | +| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | +| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | +| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | +| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | +| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | +| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | +| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | +| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | +| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | +| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | +| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | +| `matchBase` | `boolean` | `false` | Alias for `basename` | +| `maxLength` | `number` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | +| `maxExtglobRecursion` | `number\|boolean` | `0` | Limit nested quantified extglobs and other risky repeated extglob forms. When the limit is exceeded, the extglob is treated as a literal string instead of being compiled to regex. Set to `false` to disable this safeguard. | +| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | +| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | +| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | +| `noext` | `boolean` | `false` | Alias for `noextglob` | +| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | +| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | +| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | +| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | +| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | +| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | +| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | +| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | +| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | +| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | +| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | +| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | +| `windows` | `boolean` | `false` | Also accept backslashes as the path separator. | + +### Scan Options + +In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. + +| **Option** | **Type** | **Default value** | **Description** | +| --- | --- | --- | --- | +| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | +| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | + +**Example** + +```js +const picomatch = require('picomatch'); +const result = picomatch.scan('!./foo/*.js', { tokens: true }); +console.log(result); +// { +// prefix: '!./', +// input: '!./foo/*.js', +// start: 3, +// base: 'foo', +// glob: '*.js', +// isBrace: false, +// isBracket: false, +// isGlob: true, +// isExtglob: false, +// isGlobstar: false, +// negated: true, +// maxDepth: 2, +// tokens: [ +// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, +// { value: 'foo', depth: 1, isGlob: false }, +// { value: '*.js', depth: 1, isGlob: true } +// ], +// slashes: [ 2, 6 ], +// parts: [ 'foo', '*.js' ] +// } +``` + +
+ +### Options Examples + +#### options.expandRange + +**Type**: `function` + +**Default**: `undefined` + +Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. + +**Example** + +The following example shows how to create a glob that matches a folder + +```js +const fill = require('fill-range'); +const regex = pm.makeRe('foo/{01..25}/bar', { + expandRange(a, b) { + return `(${fill(a, b, { toRegex: true })})`; + } +}); + +console.log(regex); +//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ + +console.log(regex.test('foo/00/bar')) // false +console.log(regex.test('foo/01/bar')) // true +console.log(regex.test('foo/10/bar')) // true +console.log(regex.test('foo/22/bar')) // true +console.log(regex.test('foo/25/bar')) // true +console.log(regex.test('foo/26/bar')) // false +``` + +#### options.format + +**Type**: `function` + +**Default**: `undefined` + +Custom function for formatting strings before they're matched. + +**Example** + +```js +// strip leading './' from strings +const format = str => str.replace(/^\.\//, ''); +const isMatch = picomatch('foo/*.js', { format }); +console.log(isMatch('./foo/bar.js')); //=> true +``` + +#### options.onMatch + +```js +const onMatch = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onMatch }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +#### options.onIgnore + +```js +const onIgnore = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +#### options.onResult + +```js +const onResult = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onResult, ignore: 'f*' }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +
+
+ +## Globbing features + +* [Basic globbing](#basic-globbing) (Wildcard matching) +* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) + +### Basic globbing + +| **Character** | **Description** | +| --- | --- | +| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | +| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` with the `windows` option) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | +| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | +| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | + +#### Matching behavior vs. Bash + +Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: + +* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. +* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. + +
+ +### Advanced globbing + +* [extglobs](#extglobs) +* [POSIX brackets](#posix-brackets) +* [Braces](#brace-expansion) + +#### Extglobs + +| **Pattern** | **Description** | +| --- | --- | +| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | +| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | +| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | +| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | +| `!(pattern)` | Match _anything but_ `pattern` | + +**Examples** + +```js +const pm = require('picomatch'); + +// *(pattern) matches ZERO or more of "pattern" +console.log(pm.isMatch('a', 'a*(z)')); // true +console.log(pm.isMatch('az', 'a*(z)')); // true +console.log(pm.isMatch('azzz', 'a*(z)')); // true + +// +(pattern) matches ONE or more of "pattern" +console.log(pm.isMatch('a', 'a+(z)')); // false +console.log(pm.isMatch('az', 'a+(z)')); // true +console.log(pm.isMatch('azzz', 'a+(z)')); // true + +// supports multiple extglobs +console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false + +// supports nested extglobs +console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true + +// risky quantified extglobs are treated literally by default +console.log(pm.makeRe('+(a|aa)')); +//=> /^(?:\+\(a\|aa\))$/ + +// increase the limit to allow a small amount of nested quantified extglobs +console.log(pm.isMatch('aaa', '+(+(a))', { maxExtglobRecursion: 1 })); // true +``` + +#### POSIX brackets + +POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. + +**Enable POSIX bracket support** + +```js +console.log(pm.makeRe('[[:word:]]+', { posix: true })); +//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ +``` + +**Supported POSIX classes** + +The following named POSIX bracket expressions are supported: + +* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` +* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. +* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. +* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. +* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. +* `[:digit:]` - Numerical digits, equivalent to `[0-9]`. +* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. +* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. +* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. +* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. +* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. +* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. +* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. +* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. + +See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. + +### Braces + +Picomatch only does [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) of comma-delimited lists (e.g. `a/{b,c}/d`). For advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch), which supports advanced syntax such as ranges (e.g. `{01..03}`) and increments (e.g. `{2..10..2}`). + +### Matching special characters as literals + +If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: + +**Special Characters** + +Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. + +To match any of the following characters as literals: `$^*+?()[] + +Examples: + +```js +console.log(pm.makeRe('foo/bar \\(1\\)')); +console.log(pm.makeRe('foo/bar \\(1\\)')); +``` + +
+
+ +## Library Comparisons + +The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). + +| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | +| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | +| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | +| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | +| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | +| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | +| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | +| File system operations | - | - | - | - | - | - | - | + +
+
+ +## Benchmarks + +Performance comparison of picomatch and minimatch. + +``` +# .makeRe star (*) + picomatch x 3,251,247 ops/sec ±0.25% (95 runs sampled) + minimatch x 497,224 ops/sec ±0.11% (100 runs sampled) + +# .makeRe star; dot=true (*) + picomatch x 2,624,035 ops/sec ±0.16% (98 runs sampled) + minimatch x 446,244 ops/sec ±0.63% (99 runs sampled) + +# .makeRe globstar (**) + picomatch x 2,524,465 ops/sec ±0.13% (99 runs sampled) + minimatch x 1,396,257 ops/sec ±0.58% (96 runs sampled) + +# .makeRe globstars (**/**/**) + picomatch x 2,545,674 ops/sec ±0.10% (99 runs sampled) + minimatch x 1,196,835 ops/sec ±0.63% (98 runs sampled) + +# .makeRe with leading star (*.txt) + picomatch x 2,537,708 ops/sec ±0.11% (100 runs sampled) + minimatch x 345,284 ops/sec ±0.64% (96 runs sampled) + +# .makeRe - basic braces ({a,b,c}*.txt) + picomatch x 505,430 ops/sec ±1.04% (94 runs sampled) + minimatch x 107,991 ops/sec ±0.54% (99 runs sampled) + +# .makeRe - short ranges ({a..z}*.txt) + picomatch x 371,179 ops/sec ±2.91% (77 runs sampled) + minimatch x 14,104 ops/sec ±0.61% (99 runs sampled) + +# .makeRe - medium ranges ({1..100000}*.txt) + picomatch x 384,958 ops/sec ±1.70% (82 runs sampled) + minimatch x 2.55 ops/sec ±3.22% (11 runs sampled) + +# .makeRe - long ranges ({1..10000000}*.txt) + picomatch x 382,552 ops/sec ±1.52% (71 runs sampled) + minimatch x 0.83 ops/sec ±5.67% (7 runs sampled)) +``` + +
+
+ +## Philosophies + +The goal of this library is to be blazing fast, without compromising on accuracy. + +**Accuracy** + +The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. + +Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. + +**Performance** + +Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. + +
+
+ +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). \ No newline at end of file diff --git a/node_modules/picomatch/index.js b/node_modules/picomatch/index.js new file mode 100644 index 0000000..a753b1d --- /dev/null +++ b/node_modules/picomatch/index.js @@ -0,0 +1,17 @@ +'use strict'; + +const pico = require('./lib/picomatch'); +const utils = require('./lib/utils'); + +function picomatch(glob, options, returnState = false) { + // default to os.platform() + if (options && (options.windows === null || options.windows === undefined)) { + // don't mutate the original options object + options = { ...options, windows: utils.isWindows() }; + } + + return pico(glob, options, returnState); +} + +Object.assign(picomatch, pico); +module.exports = picomatch; diff --git a/node_modules/picomatch/lib/constants.js b/node_modules/picomatch/lib/constants.js new file mode 100644 index 0000000..f0aeda7 --- /dev/null +++ b/node_modules/picomatch/lib/constants.js @@ -0,0 +1,184 @@ +'use strict'; + +const WIN_SLASH = '\\\\/'; +const WIN_NO_SLASH = `[^${WIN_SLASH}]`; + +const DEFAULT_MAX_EXTGLOB_RECURSION = 0; + +/** + * Posix glob regex + */ + +const DOT_LITERAL = '\\.'; +const PLUS_LITERAL = '\\+'; +const QMARK_LITERAL = '\\?'; +const SLASH_LITERAL = '\\/'; +const ONE_CHAR = '(?=.)'; +const QMARK = '[^/]'; +const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; +const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; +const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; +const NO_DOT = `(?!${DOT_LITERAL})`; +const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; +const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; +const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; +const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; +const STAR = `${QMARK}*?`; +const SEP = '/'; + +const POSIX_CHARS = { + DOT_LITERAL, + PLUS_LITERAL, + QMARK_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + QMARK, + END_ANCHOR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK_NO_DOT, + STAR, + START_ANCHOR, + SEP +}; + +/** + * Windows glob regex + */ + +const WINDOWS_CHARS = { + ...POSIX_CHARS, + + SLASH_LITERAL: `[${WIN_SLASH}]`, + QMARK: WIN_NO_SLASH, + STAR: `${WIN_NO_SLASH}*?`, + DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, + NO_DOT: `(?!${DOT_LITERAL})`, + NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, + NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + QMARK_NO_DOT: `[^.${WIN_SLASH}]`, + START_ANCHOR: `(?:^|[${WIN_SLASH}])`, + END_ANCHOR: `(?:[${WIN_SLASH}]|$)`, + SEP: '\\' +}; + +/** + * POSIX Bracket Regex + */ + +const POSIX_REGEX_SOURCE = { + __proto__: null, + alnum: 'a-zA-Z0-9', + alpha: 'a-zA-Z', + ascii: '\\x00-\\x7F', + blank: ' \\t', + cntrl: '\\x00-\\x1F\\x7F', + digit: '0-9', + graph: '\\x21-\\x7E', + lower: 'a-z', + print: '\\x20-\\x7E ', + punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', + space: ' \\t\\r\\n\\v\\f', + upper: 'A-Z', + word: 'A-Za-z0-9_', + xdigit: 'A-Fa-f0-9' +}; + +module.exports = { + DEFAULT_MAX_EXTGLOB_RECURSION, + MAX_LENGTH: 1024 * 64, + POSIX_REGEX_SOURCE, + + // regular expressions + REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, + REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, + REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, + REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, + REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, + REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, + + // Replace globs with equivalent patterns to reduce parsing time. + REPLACEMENTS: { + __proto__: null, + '***': '*', + '**/**': '**', + '**/**/**': '**' + }, + + // Digits + CHAR_0: 48, /* 0 */ + CHAR_9: 57, /* 9 */ + + // Alphabet chars. + CHAR_UPPERCASE_A: 65, /* A */ + CHAR_LOWERCASE_A: 97, /* a */ + CHAR_UPPERCASE_Z: 90, /* Z */ + CHAR_LOWERCASE_Z: 122, /* z */ + + CHAR_LEFT_PARENTHESES: 40, /* ( */ + CHAR_RIGHT_PARENTHESES: 41, /* ) */ + + CHAR_ASTERISK: 42, /* * */ + + // Non-alphabetic chars. + CHAR_AMPERSAND: 38, /* & */ + CHAR_AT: 64, /* @ */ + CHAR_BACKWARD_SLASH: 92, /* \ */ + CHAR_CARRIAGE_RETURN: 13, /* \r */ + CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ + CHAR_COLON: 58, /* : */ + CHAR_COMMA: 44, /* , */ + CHAR_DOT: 46, /* . */ + CHAR_DOUBLE_QUOTE: 34, /* " */ + CHAR_EQUAL: 61, /* = */ + CHAR_EXCLAMATION_MARK: 33, /* ! */ + CHAR_FORM_FEED: 12, /* \f */ + CHAR_FORWARD_SLASH: 47, /* / */ + CHAR_GRAVE_ACCENT: 96, /* ` */ + CHAR_HASH: 35, /* # */ + CHAR_HYPHEN_MINUS: 45, /* - */ + CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ + CHAR_LEFT_CURLY_BRACE: 123, /* { */ + CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ + CHAR_LINE_FEED: 10, /* \n */ + CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ + CHAR_PERCENT: 37, /* % */ + CHAR_PLUS: 43, /* + */ + CHAR_QUESTION_MARK: 63, /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ + CHAR_RIGHT_CURLY_BRACE: 125, /* } */ + CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ + CHAR_SEMICOLON: 59, /* ; */ + CHAR_SINGLE_QUOTE: 39, /* ' */ + CHAR_SPACE: 32, /* */ + CHAR_TAB: 9, /* \t */ + CHAR_UNDERSCORE: 95, /* _ */ + CHAR_VERTICAL_LINE: 124, /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ + + /** + * Create EXTGLOB_CHARS + */ + + extglobChars(chars) { + return { + '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, + '?': { type: 'qmark', open: '(?:', close: ')?' }, + '+': { type: 'plus', open: '(?:', close: ')+' }, + '*': { type: 'star', open: '(?:', close: ')*' }, + '@': { type: 'at', open: '(?:', close: ')' } + }; + }, + + /** + * Create GLOB_CHARS + */ + + globChars(win32) { + return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; + } +}; diff --git a/node_modules/picomatch/lib/parse.js b/node_modules/picomatch/lib/parse.js new file mode 100644 index 0000000..2920751 --- /dev/null +++ b/node_modules/picomatch/lib/parse.js @@ -0,0 +1,1425 @@ +'use strict'; + +const constants = require('./constants'); +const utils = require('./utils'); + +/** + * Constants + */ + +const { + MAX_LENGTH, + POSIX_REGEX_SOURCE, + REGEX_NON_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_BACKREF, + REPLACEMENTS +} = constants; + +/** + * Helpers + */ + +const expandRange = (args, options) => { + if (typeof options.expandRange === 'function') { + return options.expandRange(...args, options); + } + + args.sort(); + const value = `[${args.join('-')}]`; + + try { + /* eslint-disable-next-line no-new */ + new RegExp(value); + } catch (ex) { + return args.map(v => utils.escapeRegex(v)).join('..'); + } + + return value; +}; + +/** + * Create the message for a syntax error + */ + +const syntaxError = (type, char) => { + return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; +}; + +const splitTopLevel = input => { + const parts = []; + let bracket = 0; + let paren = 0; + let quote = 0; + let value = ''; + let escaped = false; + + for (const ch of input) { + if (escaped === true) { + value += ch; + escaped = false; + continue; + } + + if (ch === '\\') { + value += ch; + escaped = true; + continue; + } + + if (ch === '"') { + quote = quote === 1 ? 0 : 1; + value += ch; + continue; + } + + if (quote === 0) { + if (ch === '[') { + bracket++; + } else if (ch === ']' && bracket > 0) { + bracket--; + } else if (bracket === 0) { + if (ch === '(') { + paren++; + } else if (ch === ')' && paren > 0) { + paren--; + } else if (ch === '|' && paren === 0) { + parts.push(value); + value = ''; + continue; + } + } + } + + value += ch; + } + + parts.push(value); + return parts; +}; + +const isPlainBranch = branch => { + let escaped = false; + + for (const ch of branch) { + if (escaped === true) { + escaped = false; + continue; + } + + if (ch === '\\') { + escaped = true; + continue; + } + + if (/[?*+@!()[\]{}]/.test(ch)) { + return false; + } + } + + return true; +}; + +const normalizeSimpleBranch = branch => { + let value = branch.trim(); + let changed = true; + + while (changed === true) { + changed = false; + + if (/^@\([^\\()[\]{}|]+\)$/.test(value)) { + value = value.slice(2, -1); + changed = true; + } + } + + if (!isPlainBranch(value)) { + return; + } + + return value.replace(/\\(.)/g, '$1'); +}; + +const hasRepeatedCharPrefixOverlap = branches => { + const values = branches.map(normalizeSimpleBranch).filter(Boolean); + + for (let i = 0; i < values.length; i++) { + for (let j = i + 1; j < values.length; j++) { + const a = values[i]; + const b = values[j]; + const char = a[0]; + + if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) { + continue; + } + + if (a === b || a.startsWith(b) || b.startsWith(a)) { + return true; + } + } + } + + return false; +}; + +const parseRepeatedExtglob = (pattern, requireEnd = true) => { + if ((pattern[0] !== '+' && pattern[0] !== '*') || pattern[1] !== '(') { + return; + } + + let bracket = 0; + let paren = 0; + let quote = 0; + let escaped = false; + + for (let i = 1; i < pattern.length; i++) { + const ch = pattern[i]; + + if (escaped === true) { + escaped = false; + continue; + } + + if (ch === '\\') { + escaped = true; + continue; + } + + if (ch === '"') { + quote = quote === 1 ? 0 : 1; + continue; + } + + if (quote === 1) { + continue; + } + + if (ch === '[') { + bracket++; + continue; + } + + if (ch === ']' && bracket > 0) { + bracket--; + continue; + } + + if (bracket > 0) { + continue; + } + + if (ch === '(') { + paren++; + continue; + } + + if (ch === ')') { + paren--; + + if (paren === 0) { + if (requireEnd === true && i !== pattern.length - 1) { + return; + } + + return { + type: pattern[0], + body: pattern.slice(2, i), + end: i + }; + } + } + } +}; + +const buildCharClassStar = chars => { + const source = chars.length === 1 + ? utils.escapeRegex(chars[0]) + : `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`; + + return `${source}*`; +}; + +const getStarExtglobSequenceChars = pattern => { + let index = 0; + const chars = []; + + while (index < pattern.length) { + const match = parseRepeatedExtglob(pattern.slice(index), false); + + if (!match || match.type !== '*') { + return; + } + + const branches = splitTopLevel(match.body).map(branch => branch.trim()); + if (branches.length !== 1) { + return; + } + + const branch = normalizeSimpleBranch(branches[0]); + if (!branch || branch.length !== 1) { + return; + } + + chars.push(branch); + index += match.end + 1; + } + + if (chars.length < 1) { + return; + } + + return chars; +}; + +const repeatedExtglobRecursion = pattern => { + let depth = 0; + let value = pattern.trim(); + let match = parseRepeatedExtglob(value); + + while (match) { + depth++; + value = match.body.trim(); + match = parseRepeatedExtglob(value); + } + + return depth; +}; + +const analyzeRepeatedExtglob = (body, options) => { + if (options.maxExtglobRecursion === false) { + return { risky: false }; + } + + const max = + typeof options.maxExtglobRecursion === 'number' + ? options.maxExtglobRecursion + : constants.DEFAULT_MAX_EXTGLOB_RECURSION; + + const branches = splitTopLevel(body).map(branch => branch.trim()); + + if (branches.length > 1) { + if ( + branches.some(branch => branch === '') || + branches.some(branch => /^[*?]+$/.test(branch)) || + hasRepeatedCharPrefixOverlap(branches) + ) { + return { risky: true }; + } + } + + // A repeated extglob is "risky" (prone to catastrophic backtracking) when a + // branch is itself a `*(...)` sequence, since that nests an unbounded quantifier + // inside the outer `+(...)`/`*(...)`. When *every* branch reduces to single + // characters we can emit one flat, ReDoS-safe character class that preserves the + // meaning of ALL branches (e.g. `+(*(a)|*(b))` -> `[ab]*`), rather than dropping + // every branch but the first. + const safeChars = []; + let sawStarSequence = false; + let combinable = true; + + for (const branch of branches) { + const chars = getStarExtglobSequenceChars(branch); + if (chars) { + sawStarSequence = true; + safeChars.push(...chars); + continue; + } + + const literal = normalizeSimpleBranch(branch); + if (literal && literal.length === 1) { + safeChars.push(literal); + continue; + } + + combinable = false; + + if (repeatedExtglobRecursion(branch) > max) { + return { risky: true }; + } + } + + if (sawStarSequence) { + return combinable + ? { risky: true, safeOutput: buildCharClassStar([...new Set(safeChars)]) } + : { risky: true }; + } + + return { risky: false }; +}; + +/** + * Parse the given input string. + * @param {String} input + * @param {Object} options + * @return {Object} + */ + +const parse = (input, options) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + input = REPLACEMENTS[input] || input; + + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + + let len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + const bos = { type: 'bos', value: '', output: opts.prepend || '' }; + const tokens = [bos]; + + const capture = opts.capture ? '' : '?:'; + + // create constants based on platform, for windows or posix + const PLATFORM_CHARS = constants.globChars(opts.windows); + const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); + + const { + DOT_LITERAL, + PLUS_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK, + QMARK_NO_DOT, + STAR, + START_ANCHOR + } = PLATFORM_CHARS; + + const globstar = opts => { + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const nodot = opts.dot ? '' : NO_DOT; + const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; + let star = opts.bash === true ? globstar(opts) : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + // minimatch options support + if (typeof opts.noext === 'boolean') { + opts.noextglob = opts.noext; + } + + const state = { + input, + index: -1, + start: 0, + dot: opts.dot === true, + consumed: '', + output: '', + prefix: '', + backtrack: false, + negated: false, + brackets: 0, + braces: 0, + parens: 0, + quotes: 0, + globstar: false, + tokens + }; + + input = utils.removePrefix(input, state); + len = input.length; + + const extglobs = []; + const braces = []; + const stack = []; + let prev = bos; + let value; + + /** + * Tokenizing helpers + */ + + const eos = () => state.index === len - 1; + const peek = state.peek = (n = 1) => input[state.index + n]; + const advance = state.advance = () => input[++state.index] || ''; + const remaining = () => input.slice(state.index + 1); + const consume = (value = '', num = 0) => { + state.consumed += value; + state.index += num; + }; + + const append = token => { + state.output += token.output != null ? token.output : token.value; + consume(token.value); + }; + + const negate = () => { + let count = 1; + + while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { + advance(); + state.start++; + count++; + } + + if (count % 2 === 0) { + return false; + } + + state.negated = true; + state.start++; + return true; + }; + + const increment = type => { + state[type]++; + stack.push(type); + }; + + const decrement = type => { + state[type]--; + stack.pop(); + }; + + /** + * Push tokens onto the tokens array. This helper speeds up + * tokenizing by 1) helping us avoid backtracking as much as possible, + * and 2) helping us avoid creating extra tokens when consecutive + * characters are plain text. This improves performance and simplifies + * lookbehinds. + */ + + const push = tok => { + if (prev.type === 'globstar') { + const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); + const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); + + if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { + state.output = state.output.slice(0, -prev.output.length); + prev.type = 'star'; + prev.value = '*'; + prev.output = star; + state.output += prev.output; + } + } + + if (extglobs.length && tok.type !== 'paren') { + extglobs[extglobs.length - 1].inner += tok.value; + } + + if (tok.value || tok.output) append(tok); + if (prev && prev.type === 'text' && tok.type === 'text') { + prev.output = (prev.output || prev.value) + tok.value; + prev.value += tok.value; + return; + } + + tok.prev = prev; + tokens.push(tok); + prev = tok; + }; + + const extglobOpen = (type, value) => { + const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; + + token.prev = prev; + token.parens = state.parens; + token.output = state.output; + token.startIndex = state.index; + token.tokensIndex = tokens.length; + const output = (opts.capture ? '(' : '') + token.open; + + increment('parens'); + push({ type, value, output: state.output ? '' : ONE_CHAR }); + push({ type: 'paren', extglob: true, value: advance(), output }); + extglobs.push(token); + }; + + const extglobClose = token => { + const literal = input.slice(token.startIndex, state.index + 1); + const body = input.slice(token.startIndex + 2, state.index); + const analysis = analyzeRepeatedExtglob(body, opts); + + if ((token.type === 'plus' || token.type === 'star') && analysis.risky) { + const safeOutput = analysis.safeOutput + ? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) + : undefined; + const open = tokens[token.tokensIndex]; + + open.type = 'text'; + open.value = literal; + open.output = safeOutput || utils.escapeRegex(literal); + + for (let i = token.tokensIndex + 1; i < tokens.length; i++) { + tokens[i].value = ''; + tokens[i].output = ''; + delete tokens[i].suffix; + } + + state.output = token.output + open.output; + state.backtrack = true; + + push({ type: 'paren', extglob: true, value, output: '' }); + decrement('parens'); + return; + } + + let output = token.close + (opts.capture ? ')' : ''); + let rest; + + if (token.type === 'negate') { + let extglobStar = star; + + if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { + extglobStar = globstar(opts); + } + + if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { + output = token.close = `)$))${extglobStar}`; + } + + if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { + // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis. + // In this case, we need to parse the string and use it in the output of the original pattern. + // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`. + // + // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`. + const expression = parse(rest, { ...options, fastpaths: false }).output; + + output = token.close = `)${expression})${extglobStar})`; + } + + if (token.prev.type === 'bos') { + state.negatedExtglob = true; + } + } + + push({ type: 'paren', extglob: true, value, output }); + decrement('parens'); + }; + + /** + * Fast paths + */ + + if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { + let backslashes = false; + + let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { + if (first === '\\') { + backslashes = true; + return m; + } + + if (first === '?') { + if (esc) { + return esc + first + (rest ? QMARK.repeat(rest.length) : ''); + } + if (index === 0) { + return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); + } + return QMARK.repeat(chars.length); + } + + if (first === '.') { + return DOT_LITERAL.repeat(chars.length); + } + + if (first === '*') { + if (esc) { + return esc + first + (rest ? star : ''); + } + return star; + } + return esc ? m : `\\${m}`; + }); + + if (backslashes === true) { + if (opts.unescape === true) { + output = output.replace(/\\/g, ''); + } else { + output = output.replace(/\\+/g, m => { + return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); + }); + } + } + + if (output === input && opts.contains === true) { + state.output = input; + return state; + } + + state.output = utils.wrapOutput(output, state, options); + return state; + } + + /** + * Tokenize input until we reach end-of-string + */ + + while (!eos()) { + value = advance(); + + if (value === '\u0000') { + continue; + } + + /** + * Escaped characters + */ + + if (value === '\\') { + const next = peek(); + + if (next === '/' && opts.bash !== true) { + continue; + } + + if (next === '.' || next === ';') { + continue; + } + + if (!next) { + value += '\\'; + push({ type: 'text', value }); + continue; + } + + // collapse slashes to reduce potential for exploits + const match = /^\\+/.exec(remaining()); + let slashes = 0; + + if (match && match[0].length > 2) { + slashes = match[0].length; + state.index += slashes; + if (slashes % 2 !== 0) { + value += '\\'; + } + } + + if (opts.unescape === true) { + value = advance(); + } else { + value += advance(); + } + + if (state.brackets === 0) { + push({ type: 'text', value }); + continue; + } + } + + /** + * If we're inside a regex character class, continue + * until we reach the closing bracket. + */ + + if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { + if (opts.posix !== false && value === ':') { + const inner = prev.value.slice(1); + if (inner.includes('[')) { + prev.posix = true; + + if (inner.includes(':')) { + const idx = prev.value.lastIndexOf('['); + const pre = prev.value.slice(0, idx); + const rest = prev.value.slice(idx + 2); + const posix = POSIX_REGEX_SOURCE[rest]; + if (posix) { + prev.value = pre + posix; + state.backtrack = true; + advance(); + + if (!bos.output && tokens.indexOf(prev) === 1) { + bos.output = ONE_CHAR; + } + continue; + } + } + } + } + + if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { + value = `\\${value}`; + } + + if (value === ']' && (prev.value === '[' || prev.value === '[^')) { + value = `\\${value}`; + } + + if (opts.posix === true && value === '!' && prev.value === '[') { + value = '^'; + } + + prev.value += value; + append({ value }); + continue; + } + + /** + * If we're inside a quoted string, continue + * until we reach the closing double quote. + */ + + if (state.quotes === 1 && value !== '"') { + value = utils.escapeRegex(value); + prev.value += value; + append({ value }); + continue; + } + + /** + * Double quotes + */ + + if (value === '"') { + state.quotes = state.quotes === 1 ? 0 : 1; + if (opts.keepQuotes === true) { + push({ type: 'text', value }); + } + continue; + } + + /** + * Parentheses + */ + + if (value === '(') { + increment('parens'); + push({ type: 'paren', value }); + continue; + } + + if (value === ')') { + if (state.parens === 0 && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '(')); + } + + const extglob = extglobs[extglobs.length - 1]; + if (extglob && state.parens === extglob.parens + 1) { + extglobClose(extglobs.pop()); + continue; + } + + push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); + decrement('parens'); + continue; + } + + /** + * Square brackets + */ + + if (value === '[') { + if (opts.nobracket === true || !remaining().includes(']')) { + if (opts.nobracket !== true && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('closing', ']')); + } + + value = `\\${value}`; + } else { + increment('brackets'); + } + + push({ type: 'bracket', value }); + continue; + } + + if (value === ']') { + if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { + push({ type: 'text', value, output: `\\${value}` }); + continue; + } + + if (state.brackets === 0) { + if (opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '[')); + } + + push({ type: 'text', value, output: `\\${value}` }); + continue; + } + + decrement('brackets'); + + const prevValue = prev.value.slice(1); + if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { + value = `/${value}`; + } + + prev.value += value; + append({ value }); + + // when literal brackets are explicitly disabled + // assume we should match with a regex character class + if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { + continue; + } + + const escaped = utils.escapeRegex(prev.value); + state.output = state.output.slice(0, -prev.value.length); + + // when literal brackets are explicitly enabled + // assume we should escape the brackets to match literal characters + if (opts.literalBrackets === true) { + state.output += escaped; + prev.value = escaped; + continue; + } + + // when the user specifies nothing, try to match both + prev.value = `(${capture}${escaped}|${prev.value})`; + state.output += prev.value; + continue; + } + + /** + * Braces + */ + + if (value === '{' && opts.nobrace !== true) { + increment('braces'); + + const open = { + type: 'brace', + value, + output: '(', + outputIndex: state.output.length, + tokensIndex: state.tokens.length + }; + + braces.push(open); + push(open); + continue; + } + + if (value === '}') { + const brace = braces[braces.length - 1]; + + if (opts.nobrace === true || !brace) { + push({ type: 'text', value, output: value }); + continue; + } + + let output = ')'; + + if (brace.dots === true) { + const arr = tokens.slice(); + const range = []; + + for (let i = arr.length - 1; i >= 0; i--) { + tokens.pop(); + if (arr[i].type === 'brace') { + break; + } + if (arr[i].type !== 'dots') { + range.unshift(arr[i].value); + } + } + + output = expandRange(range, opts); + state.backtrack = true; + } + + if (brace.comma !== true && brace.dots !== true) { + const out = state.output.slice(0, brace.outputIndex); + const toks = state.tokens.slice(brace.tokensIndex); + brace.value = brace.output = '\\{'; + value = output = '\\}'; + state.output = out; + for (const t of toks) { + state.output += (t.output || t.value); + } + } + + push({ type: 'brace', value, output }); + decrement('braces'); + braces.pop(); + continue; + } + + /** + * Pipes + */ + + if (value === '|') { + if (extglobs.length > 0) { + extglobs[extglobs.length - 1].conditions++; + } + push({ type: 'text', value }); + continue; + } + + /** + * Commas + */ + + if (value === ',') { + let output = value; + + const brace = braces[braces.length - 1]; + if (brace && stack[stack.length - 1] === 'braces') { + brace.comma = true; + output = '|'; + } + + push({ type: 'comma', value, output }); + continue; + } + + /** + * Slashes + */ + + if (value === '/') { + // if the beginning of the glob is "./", advance the start + // to the current index, and don't add the "./" characters + // to the state. This greatly simplifies lookbehinds when + // checking for BOS characters like "!" and "." (not "./") + if (prev.type === 'dot' && state.index === state.start + 1) { + state.start = state.index + 1; + state.consumed = ''; + state.output = ''; + tokens.pop(); + prev = bos; // reset "prev" to the first token + continue; + } + + push({ type: 'slash', value, output: SLASH_LITERAL }); + continue; + } + + /** + * Dots + */ + + if (value === '.') { + if (state.braces > 0 && prev.type === 'dot') { + if (prev.value === '.') prev.output = DOT_LITERAL; + const brace = braces[braces.length - 1]; + prev.type = 'dots'; + prev.output += value; + prev.value += value; + brace.dots = true; + continue; + } + + if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { + push({ type: 'text', value, output: DOT_LITERAL }); + continue; + } + + push({ type: 'dot', value, output: DOT_LITERAL }); + continue; + } + + /** + * Question marks + */ + + if (value === '?') { + const isGroup = prev && prev.value === '('; + if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('qmark', value); + continue; + } + + if (prev && prev.type === 'paren') { + const next = peek(); + let output = value; + + if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { + output = `\\${value}`; + } + + push({ type: 'text', value, output }); + continue; + } + + if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { + push({ type: 'qmark', value, output: QMARK_NO_DOT }); + continue; + } + + push({ type: 'qmark', value, output: QMARK }); + continue; + } + + /** + * Exclamation + */ + + if (value === '!') { + if (opts.noextglob !== true && peek() === '(') { + if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { + extglobOpen('negate', value); + continue; + } + } + + if (opts.nonegate !== true && state.index === 0) { + negate(); + continue; + } + } + + /** + * Plus + */ + + if (value === '+') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('plus', value); + continue; + } + + if ((prev && prev.value === '(') || opts.regex === false) { + push({ type: 'plus', value, output: PLUS_LITERAL }); + continue; + } + + if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { + push({ type: 'plus', value }); + continue; + } + + push({ type: 'plus', value: PLUS_LITERAL }); + continue; + } + + /** + * Plain text + */ + + if (value === '@') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + push({ type: 'at', extglob: true, value, output: '' }); + continue; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Plain text + */ + + if (value !== '*') { + if (value === '$' || value === '^') { + value = `\\${value}`; + } + + const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); + if (match) { + value += match[0]; + state.index += match[0].length; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Stars + */ + + if (prev && (prev.type === 'globstar' || prev.star === true)) { + prev.type = 'star'; + prev.star = true; + prev.value += value; + prev.output = star; + state.backtrack = true; + state.globstar = true; + consume(value); + continue; + } + + let rest = remaining(); + if (opts.noextglob !== true && /^\([^?]/.test(rest)) { + extglobOpen('star', value); + continue; + } + + if (prev.type === 'star') { + if (opts.noglobstar === true) { + consume(value); + continue; + } + + const prior = prev.prev; + const before = prior.prev; + const isStart = prior.type === 'slash' || prior.type === 'bos'; + const afterStar = before && (before.type === 'star' || before.type === 'globstar'); + + if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { + push({ type: 'star', value, output: '' }); + continue; + } + + const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); + const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); + if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { + push({ type: 'star', value, output: '' }); + continue; + } + + // strip consecutive `/**/` + while (rest.slice(0, 3) === '/**') { + const after = input[state.index + 4]; + if (after && after !== '/') { + break; + } + rest = rest.slice(3); + consume('/**', 3); + } + + // A globstar followed only by balanced closing parens is at the logical end of patterns like + // `test(/utils/**)` and `test?(/utils/**)`. Treat it as EOS so the trailing `/**` can match its + // parent path, except in negated extglobs where that would change the exclusion semantics. + const isEnd = eos() || ( + state.parens > 0 + && rest === ')'.repeat(state.parens) + && !extglobs.some(extglob => extglob.type === 'negate') + ); + + if (prior.type === 'bos' && eos()) { + prev.type = 'globstar'; + prev.value += value; + prev.output = globstar(opts); + state.output = prev.output; + state.globstar = true; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && isEnd) { + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + + prev.type = 'globstar'; + prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); + prev.value += value; + state.globstar = true; + state.output += prior.output + prev.output; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { + const end = rest[1] !== void 0 ? '|$' : ''; + + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + + prev.type = 'globstar'; + prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; + prev.value += value; + + state.output += prior.output + prev.output; + state.globstar = true; + + consume(value + advance()); + + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + if (prior.type === 'bos' && rest[0] === '/') { + prev.type = 'globstar'; + prev.value += value; + prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; + state.output = prev.output; + state.globstar = true; + consume(value + advance()); + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + // remove single star from output + state.output = state.output.slice(0, -prev.output.length); + + // reset previous token to globstar + prev.type = 'globstar'; + prev.output = globstar(opts); + prev.value += value; + + // reset output with globstar + state.output += prev.output; + state.globstar = true; + consume(value); + continue; + } + + const token = { type: 'star', value, output: star }; + + if (opts.bash === true) { + token.output = '.*?'; + if (prev.type === 'bos' || prev.type === 'slash') { + token.output = nodot + token.output; + } + push(token); + continue; + } + + if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { + token.output = value; + push(token); + continue; + } + + if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { + if (prev.type === 'dot') { + state.output += NO_DOT_SLASH; + prev.output += NO_DOT_SLASH; + + } else if (opts.dot === true) { + state.output += NO_DOTS_SLASH; + prev.output += NO_DOTS_SLASH; + + } else { + state.output += nodot; + prev.output += nodot; + } + + if (peek() !== '*') { + state.output += ONE_CHAR; + prev.output += ONE_CHAR; + } + } + + push(token); + } + + while (state.brackets > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); + state.output = utils.escapeLast(state.output, '['); + decrement('brackets'); + } + + while (state.parens > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); + state.output = utils.escapeLast(state.output, '('); + decrement('parens'); + } + + while (state.braces > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); + state.output = utils.escapeLast(state.output, '{'); + decrement('braces'); + } + + if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { + push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); + } + + // rebuild the output if we had to backtrack at any point + if (state.backtrack === true) { + state.output = ''; + + for (const token of state.tokens) { + state.output += token.output != null ? token.output : token.value; + + if (token.suffix) { + state.output += token.suffix; + } + } + } + + return state; +}; + +/** + * Fast paths for creating regular expressions for common glob patterns. + * This can significantly speed up processing and has very little downside + * impact when none of the fast paths match. + */ + +parse.fastpaths = (input, options) => { + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + const len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + input = REPLACEMENTS[input] || input; + + // create constants based on platform, for windows or posix + const { + DOT_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOTS_SLASH, + STAR, + START_ANCHOR + } = constants.globChars(opts.windows); + + const nodot = opts.dot ? NO_DOTS : NO_DOT; + const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; + const capture = opts.capture ? '' : '?:'; + const state = { negated: false, prefix: '' }; + let star = opts.bash === true ? '.*?' : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + const globstar = opts => { + if (opts.noglobstar === true) return star; + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const create = str => { + switch (str) { + case '*': + return `${nodot}${ONE_CHAR}${star}`; + + case '.*': + return `${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*.*': + return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*/*': + return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; + + case '**': + return nodot + globstar(opts); + + case '**/*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; + + case '**/*.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '**/.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; + + default: { + const match = /^(.*?)\.(\w+)$/.exec(str); + if (!match) return; + + const source = create(match[1]); + if (!source) return; + + return source + DOT_LITERAL + match[2]; + } + } + }; + + const output = utils.removePrefix(input, state); + let source = create(output); + + if (source && opts.strictSlashes !== true) { + source += `${SLASH_LITERAL}?`; + } + + return source; +}; + +module.exports = parse; diff --git a/node_modules/picomatch/lib/picomatch.js b/node_modules/picomatch/lib/picomatch.js new file mode 100644 index 0000000..9c2bfd5 --- /dev/null +++ b/node_modules/picomatch/lib/picomatch.js @@ -0,0 +1,361 @@ +'use strict'; + +const scan = require('./scan'); +const parse = require('./parse'); +const utils = require('./utils'); +const constants = require('./constants'); +const isObject = val => val && typeof val === 'object' && !Array.isArray(val); + +/** + * Creates a matcher function from one or more glob patterns. The + * returned function takes a string to match as its first argument, + * and returns true if the string is a match. The returned matcher + * function also takes a boolean as the second argument that, when true, + * returns an object with additional information. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch(glob[, options]); + * + * const isMatch = picomatch('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * + * // For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection. + * const picomatch = require('picomatch/posix'); + * // the same API, defaulting to posix paths + * const isMatch = picomatch('a/*'); + * console.log(isMatch('a\\b')); //=> false + * console.log(isMatch('a/b')); //=> true + * + * // you can still configure the matcher function to accept windows paths + * const isMatch = picomatch('a/*', { options: windows }); + * console.log(isMatch('a\\b')); //=> true + * console.log(isMatch('a/b')); //=> true + * ``` + * @name picomatch + * @param {String|Array} `globs` One or more glob patterns. + * @param {Object=} `options` + * @return {Function=} Returns a matcher function. + * @api public + */ + +const picomatch = (glob, options, returnState = false) => { + if (Array.isArray(glob)) { + const fns = glob.map(input => picomatch(input, options, returnState)); + const arrayMatcher = str => { + for (const isMatch of fns) { + const state = isMatch(str); + if (state) return state; + } + return false; + }; + return arrayMatcher; + } + + const isState = isObject(glob) && glob.tokens && glob.input; + + if (glob === '' || (typeof glob !== 'string' && !isState)) { + throw new TypeError('Expected pattern to be a non-empty string'); + } + + const opts = options || {}; + const posix = opts.windows; + const regex = isState + ? picomatch.compileRe(glob, options) + : picomatch.makeRe(glob, options, false, true); + + const state = regex.state; + delete regex.state; + + let isIgnored = () => false; + if (opts.ignore) { + const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; + isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); + } + + const matcher = (input, returnObject = false) => { + const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); + const result = { glob, state, regex, posix, input, output, match, isMatch }; + + if (typeof opts.onResult === 'function') { + opts.onResult(result); + } + + if (isMatch === false) { + result.isMatch = false; + return returnObject ? result : false; + } + + if (isIgnored(input)) { + if (typeof opts.onIgnore === 'function') { + opts.onIgnore(result); + } + result.isMatch = false; + return returnObject ? result : false; + } + + if (typeof opts.onMatch === 'function') { + opts.onMatch(result); + } + return returnObject ? result : true; + }; + + if (returnState) { + matcher.state = state; + } + + return matcher; +}; + +/** + * Test `input` with the given `regex`. This is used by the main + * `picomatch()` function to test the input string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.test(input, regex[, options]); + * + * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); + * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } + * ``` + * @param {String} `input` String to test. + * @param {RegExp} `regex` + * @return {Object} Returns an object with matching info. + * @api public + */ + +picomatch.test = (input, regex, options, { glob, posix } = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected input to be a string'); + } + + if (input === '') { + return { isMatch: false, output: '' }; + } + + const opts = options || {}; + const format = opts.format || (posix ? utils.toPosixSlashes : null); + let match = input === glob; + let output = (match && format) ? format(input) : input; + + if (match === false) { + output = format ? format(input) : input; + match = output === glob; + } + + if (match === false || opts.capture === true) { + if (opts.matchBase === true || opts.basename === true) { + match = picomatch.matchBase(input, regex, options, posix); + } else { + match = regex.exec(output); + } + } + + return { isMatch: Boolean(match), match, output }; +}; + +/** + * Match the basename of a filepath. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.matchBase(input, glob[, options]); + * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true + * ``` + * @param {String} `input` String to test. + * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). + * @return {Boolean} + * @api public + */ + +picomatch.matchBase = (input, glob, options, posix = options && options.windows) => { + const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); + return regex.test(utils.basename(input, { windows: posix })); +}; + +/** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.isMatch(string, patterns[, options]); + * + * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false + * ``` + * @param {String|Array} str The string to test. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} [options] See available [options](#options). + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); + +/** + * Parse a glob pattern to create the source string for a regular + * expression. + * + * ```js + * const picomatch = require('picomatch'); + * const result = picomatch.parse(pattern[, options]); + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} Returns an object with useful properties and output to be used as a regex source string. + * @api public + */ + +picomatch.parse = (pattern, options) => { + if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); + return parse(pattern, { ...options, fastpaths: false }); +}; + +/** + * Scan a glob pattern to separate the pattern into segments. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.scan(input[, options]); + * + * const result = picomatch.scan('!./foo/*.js'); + * console.log(result); + * { prefix: '!./', + * input: '!./foo/*.js', + * start: 3, + * base: 'foo', + * glob: '*.js', + * isBrace: false, + * isBracket: false, + * isGlob: true, + * isExtglob: false, + * isGlobstar: false, + * negated: true } + * ``` + * @param {String} `input` Glob pattern to scan. + * @param {Object} `options` + * @return {Object} Returns an object with + * @api public + */ + +picomatch.scan = (input, options) => scan(input, options); + +/** + * Compile a regular expression from the `state` object returned by the + * [parse()](#parse) method. + * + * ```js + * const picomatch = require('picomatch'); + * const state = picomatch.parse('*.js'); + * // picomatch.compileRe(state[, options]); + * + * console.log(picomatch.compileRe(state)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {Object} `state` + * @param {Object} `options` + * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. + * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. + * @return {RegExp} + * @api public + */ + +picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { + if (returnOutput === true) { + return state.output; + } + + const opts = options || {}; + const prepend = opts.contains ? '' : '^'; + const append = opts.contains ? '' : '$'; + + let source = `${prepend}(?:${state.output})${append}`; + if (state && state.negated === true) { + source = `^(?!${source}).*$`; + } + + const regex = picomatch.toRegex(source, options); + if (returnState === true) { + regex.state = state; + } + + return regex; +}; + +/** + * Create a regular expression from a parsed glob pattern. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.makeRe(state[, options]); + * + * const result = picomatch.makeRe('*.js'); + * console.log(result); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `state` The object returned from the `.parse` method. + * @param {Object} `options` + * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. + * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + +picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { + if (!input || typeof input !== 'string') { + throw new TypeError('Expected a non-empty string'); + } + + let parsed = { negated: false, fastpaths: true }; + + if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { + parsed.output = parse.fastpaths(input, options); + } + + if (!parsed.output) { + parsed = parse(input, options); + } + + return picomatch.compileRe(parsed, options, returnOutput, returnState); +}; + +/** + * Create a regular expression from the given regex source string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.toRegex(source[, options]); + * + * const { output } = picomatch.parse('*.js'); + * console.log(picomatch.toRegex(output)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `source` Regular expression source string. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +picomatch.toRegex = (source, options) => { + try { + const opts = options || {}; + return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); + } catch (err) { + if (options && options.debug === true) throw err; + return /$^/; + } +}; + +/** + * Picomatch constants. + * @return {Object} + */ + +picomatch.constants = constants; + +/** + * Expose "picomatch" + */ + +module.exports = picomatch; diff --git a/node_modules/picomatch/lib/scan.js b/node_modules/picomatch/lib/scan.js new file mode 100644 index 0000000..3c30a47 --- /dev/null +++ b/node_modules/picomatch/lib/scan.js @@ -0,0 +1,403 @@ +'use strict'; + +const utils = require('./utils'); +const { + CHAR_ASTERISK, /* * */ + CHAR_AT, /* @ */ + CHAR_BACKWARD_SLASH, /* \ */ + CHAR_COMMA, /* , */ + CHAR_DOT, /* . */ + CHAR_EXCLAMATION_MARK, /* ! */ + CHAR_FORWARD_SLASH, /* / */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_LEFT_SQUARE_BRACKET, /* [ */ + CHAR_PLUS, /* + */ + CHAR_QUESTION_MARK, /* ? */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_RIGHT_SQUARE_BRACKET /* ] */ +} = require('./constants'); + +const isPathSeparator = code => { + return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; +}; + +const depth = token => { + if (token.isPrefix !== true) { + token.depth = token.isGlobstar ? Infinity : 1; + } +}; + +/** + * Quickly scans a glob pattern and returns an object with a handful of + * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), + * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not + * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). + * + * ```js + * const pm = require('picomatch'); + * console.log(pm.scan('foo/bar/*.js')); + * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {Object} Returns an object with tokens and regex source string. + * @api public + */ + +const scan = (input, options) => { + const opts = options || {}; + + const length = input.length - 1; + const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true; + const slashes = []; + const tokens = []; + const parts = []; + + let str = input; + let index = -1; + let start = 0; + let lastIndex = 0; + let isBrace = false; + let isBracket = false; + let isGlob = false; + let isExtglob = false; + let isGlobstar = false; + let braceEscaped = false; + let backslashes = false; + let negated = false; + let negatedExtglob = false; + let finished = false; + let braces = 0; + let prev; + let code; + let token = { value: '', depth: 0, isGlob: false }; + + const eos = () => index >= length; + const peek = () => str.charCodeAt(index + 1); + const advance = () => { + prev = code; + return str.charCodeAt(++index); + }; + + while (index < length) { + code = advance(); + let next; + + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + + if (code === CHAR_LEFT_CURLY_BRACE) { + braceEscaped = true; + } + continue; + } + + if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { + braces++; + + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (code === CHAR_LEFT_CURLY_BRACE) { + braces++; + continue; + } + + if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (braceEscaped !== true && code === CHAR_COMMA) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_RIGHT_CURLY_BRACE) { + braces--; + + if (braces === 0) { + braceEscaped = false; + isBrace = token.isBrace = true; + finished = true; + break; + } + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_FORWARD_SLASH) { + slashes.push(index); + tokens.push(token); + token = { value: '', depth: 0, isGlob: false }; + + if (finished === true) continue; + if (prev === CHAR_DOT && index === (start + 1)) { + start += 2; + continue; + } + + lastIndex = index + 1; + continue; + } + + if (opts.noext !== true) { + const isExtglobChar = code === CHAR_PLUS + || code === CHAR_AT + || code === CHAR_ASTERISK + || code === CHAR_QUESTION_MARK + || code === CHAR_EXCLAMATION_MARK; + + if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + isExtglob = token.isExtglob = true; + finished = true; + if (code === CHAR_EXCLAMATION_MARK && index === start) { + negatedExtglob = true; + } + + if (scanToEnd === true) { + let parens = 0; + + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (code === CHAR_LEFT_PARENTHESES) { + parens++; + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) { + finished = true; + break; + } + } + continue; + } + break; + } + } + + if (code === CHAR_ASTERISK) { + if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_QUESTION_MARK) { + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_LEFT_SQUARE_BRACKET) { + while (eos() !== true && (next = advance())) { + if (next === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + isBracket = token.isBracket = true; + isGlob = token.isGlob = true; + finished = true; + break; + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { + negated = token.negated = true; + start++; + continue; + } + + if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + + if (scanToEnd === true) { + let parens = 1; + + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (code === CHAR_LEFT_PARENTHESES) { + parens++; + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) { + finished = true; + break; + } + } + continue; + } + break; + } + + if (isGlob === true) { + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + } + + if (opts.noext === true) { + isExtglob = false; + isGlob = false; + } + + let base = str; + let prefix = ''; + let glob = ''; + + if (start > 0) { + prefix = str.slice(0, start); + str = str.slice(start); + lastIndex -= start; + } + + if (base && isGlob === true && lastIndex > 0) { + base = str.slice(0, lastIndex); + glob = str.slice(lastIndex); + } else if (isGlob === true) { + base = ''; + glob = str; + } else { + base = str; + } + + if (base && base !== '' && base !== '/' && base !== str) { + if (isPathSeparator(base.charCodeAt(base.length - 1))) { + base = base.slice(0, -1); + } + } + + if (opts.unescape === true) { + if (glob) glob = utils.removeBackslashes(glob); + + if (base && backslashes === true) { + base = utils.removeBackslashes(base); + } + } + + const state = { + prefix, + input, + start, + base, + glob, + isBrace, + isBracket, + isGlob, + isExtglob, + isGlobstar, + negated, + negatedExtglob + }; + + if (opts.tokens === true) { + state.maxDepth = 0; + if (!isPathSeparator(code)) { + tokens.push(token); + } + state.tokens = tokens; + } + + if (opts.parts === true || opts.tokens === true) { + let prevIndex; + + for (let idx = 0; idx < slashes.length; idx++) { + const n = prevIndex !== undefined ? prevIndex + 1 : start; + const i = slashes[idx]; + const value = input.slice(n, i); + if (opts.tokens) { + if (idx === 0 && start !== 0) { + tokens[idx].isPrefix = true; + tokens[idx].value = prefix; + } else { + tokens[idx].value = value; + } + depth(tokens[idx]); + state.maxDepth += tokens[idx].depth; + } + if (i >= start) { + parts.push(value); + prevIndex = i; + } + } + + const n = prevIndex !== undefined ? prevIndex + 1 : start; + const value = input.slice(n); + parts.push(value); + + if (opts.tokens && prevIndex && prevIndex + 1 < input.length) { + tokens[tokens.length - 1].value = value; + depth(tokens[tokens.length - 1]); + state.maxDepth += tokens[tokens.length - 1].depth; + } + + state.slashes = slashes; + state.parts = parts; + } + + return state; +}; + +module.exports = scan; diff --git a/node_modules/picomatch/lib/utils.js b/node_modules/picomatch/lib/utils.js new file mode 100644 index 0000000..9c97cae --- /dev/null +++ b/node_modules/picomatch/lib/utils.js @@ -0,0 +1,72 @@ +/*global navigator*/ +'use strict'; + +const { + REGEX_BACKSLASH, + REGEX_REMOVE_BACKSLASH, + REGEX_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_GLOBAL +} = require('./constants'); + +exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); +exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); +exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); +exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); +exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); + +exports.isWindows = () => { + if (typeof navigator !== 'undefined' && navigator.platform) { + const platform = navigator.platform.toLowerCase(); + return platform === 'win32' || platform === 'windows'; + } + + if (typeof process !== 'undefined' && process.platform) { + return process.platform === 'win32'; + } + + return false; +}; + +exports.removeBackslashes = str => { + return str.replace(REGEX_REMOVE_BACKSLASH, match => { + return match === '\\' ? '' : match; + }); +}; + +exports.escapeLast = (input, char, lastIdx) => { + const idx = input.lastIndexOf(char, lastIdx); + if (idx === -1) return input; + if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); + return `${input.slice(0, idx)}\\${input.slice(idx)}`; +}; + +exports.removePrefix = (input, state = {}) => { + let output = input; + if (output.startsWith('./')) { + output = output.slice(2); + state.prefix = './'; + } + return output; +}; + +exports.wrapOutput = (input, state = {}, options = {}) => { + const prepend = options.contains ? '' : '^'; + const append = options.contains ? '' : '$'; + + let output = `${prepend}(?:${input})${append}`; + if (state.negated === true) { + output = `(?:^(?!${output}).*$)`; + } + return output; +}; + +exports.basename = (path, { windows } = {}) => { + const segs = path.split(windows ? /[\\/]/ : '/'); + const last = segs[segs.length - 1]; + + if (last === '') { + return segs[segs.length - 2]; + } + + return last; +}; diff --git a/node_modules/picomatch/package.json b/node_modules/picomatch/package.json new file mode 100644 index 0000000..ab3cf80 --- /dev/null +++ b/node_modules/picomatch/package.json @@ -0,0 +1,83 @@ +{ + "name": "picomatch", + "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.", + "version": "4.0.7", + "homepage": "https://github.com/micromatch/picomatch", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "funding": "https://github.com/sponsors/jonschlinkert", + "repository": "micromatch/picomatch", + "bugs": { + "url": "https://github.com/micromatch/picomatch/issues" + }, + "license": "MIT", + "files": [ + "index.js", + "posix.js", + "lib" + ], + "sideEffects": false, + "main": "index.js", + "engines": { + "node": ">=12" + }, + "scripts": { + "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", + "mocha": "mocha --reporter dot", + "test": "npm run lint && npm run mocha", + "test:ci": "npm run test:cover", + "test:cover": "nyc npm run mocha" + }, + "devDependencies": { + "eslint": "^8.57.0", + "fill-range": "^7.0.1", + "gulp-format-md": "^2.0.0", + "mocha": "^10.4.0", + "nyc": "^15.1.0" + }, + "keywords": [ + "glob", + "match", + "picomatch" + ], + "nyc": { + "reporter": [ + "html", + "lcov", + "text-summary", + "cobertura" + ] + }, + "verb": { + "toc": { + "render": true, + "method": "preWrite", + "maxdepth": 3 + }, + "layout": "empty", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "related": { + "list": [ + "braces", + "micromatch" + ] + }, + "reflinks": [ + "braces", + "expand-brackets", + "extglob", + "fill-range", + "micromatch", + "minimatch", + "nanomatch", + "picomatch" + ] + } +} diff --git a/node_modules/picomatch/posix.js b/node_modules/picomatch/posix.js new file mode 100644 index 0000000..d2f2bc5 --- /dev/null +++ b/node_modules/picomatch/posix.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/picomatch'); diff --git a/node_modules/postcss/LICENSE b/node_modules/postcss/LICENSE new file mode 100644 index 0000000..c2314d5 --- /dev/null +++ b/node_modules/postcss/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright 2013 Andrey Sitnik + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/postcss/README.md b/node_modules/postcss/README.md new file mode 100644 index 0000000..6c8de01 --- /dev/null +++ b/node_modules/postcss/README.md @@ -0,0 +1,27 @@ +# PostCSS + +Philosopher’s stone, logo of PostCSS + +PostCSS is a tool for transforming styles with JS plugins. +These plugins can lint your CSS, support variables and mixins, +transpile future CSS syntax, inline images, and more. + +PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba, +and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins are some of the most popular CSS tools. + +--- + +  PostCSS is built by Evil Martians, an American design and engineering consultancy for developer tools, AI, and cybersecurity startups. + +--- + +[Abstract Syntax Tree]: https://en.wikipedia.org/wiki/Abstract_syntax_tree +[Evil Martians]: https://evilmartians.com/?utm_source=postcss +[Autoprefixer]: https://github.com/postcss/autoprefixer +[Stylelint]: https://stylelint.io/ +[plugins]: https://github.com/postcss/postcss#plugins + +## Docs +Read full docs **[here](https://postcss.org/)**. diff --git a/node_modules/postcss/lib/at-rule.d.ts b/node_modules/postcss/lib/at-rule.d.ts new file mode 100644 index 0000000..703e399 --- /dev/null +++ b/node_modules/postcss/lib/at-rule.d.ts @@ -0,0 +1,139 @@ +import Container, { + ContainerProps, + ContainerWithChildren +} from './container.js' + +declare namespace AtRule { + export interface AtRuleRaws extends Record { + /** + * The space symbols after the last child of the node to the end of the node. + */ + after?: string + + /** + * The space between the at-rule name and its parameters. + */ + afterName?: string + + /** + * The space symbols before the node. It also stores `*` + * and `_` symbols before the declaration (IE hack). + */ + before?: string + + /** + * The symbols between the last parameter and `{` for rules. + */ + between?: string + + /** + * The rule’s selector with comments. + */ + params?: { + raw: string + value: string + } + + /** + * Contains `true` if the last child has an (optional) semicolon. + */ + semicolon?: boolean + } + + export interface AtRuleProps extends ContainerProps { + /** Name of the at-rule. */ + name: string + /** Parameters following the name of the at-rule. */ + params?: number | string + /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ + raws?: AtRuleRaws + } + + export { AtRule_ as default } +} + +/** + * Represents an at-rule. + * + * ```js + * Once (root, { AtRule }) { + * let media = new AtRule({ name: 'media', params: 'print' }) + * media.append(…) + * root.append(media) + * } + * ``` + * + * If it’s followed in the CSS by a `{}` block, this node will have + * a nodes property representing its children. + * + * ```js + * const root = postcss.parse('@charset "UTF-8"; @media print {}') + * + * const charset = root.first + * charset.type //=> 'atrule' + * charset.nodes //=> undefined + * + * const media = root.last + * media.nodes //=> [] + * ``` + */ +declare class AtRule_ extends Container { + /** + * An array containing the layer’s children. + * + * ```js + * const root = postcss.parse('@layer example { a { color: black } }') + * const layer = root.first + * layer.nodes.length //=> 1 + * layer.nodes[0].selector //=> 'a' + * ``` + * + * Can be `undefinded` if the at-rule has no body. + * + * ```js + * const root = postcss.parse('@layer a, b, c;') + * const layer = root.first + * layer.nodes //=> undefined + * ``` + */ + nodes: Container['nodes'] | undefined + parent: ContainerWithChildren | undefined + + raws: AtRule.AtRuleRaws + type: 'atrule' + /** + * The at-rule’s name immediately follows the `@`. + * + * ```js + * const root = postcss.parse('@media print {}') + * const media = root.first + * media.name //=> 'media' + * ``` + */ + get name(): string + set name(value: string) + + /** + * The at-rule’s parameters, the values that follow the at-rule’s name + * but precede any `{}` block. + * + * ```js + * const root = postcss.parse('@media print, screen {}') + * const media = root.first + * media.params //=> 'print, screen' + * ``` + */ + get params(): string + + set params(value: string) + + constructor(defaults?: AtRule.AtRuleProps) + assign(overrides: AtRule.AtRuleProps | object): this + clone(overrides?: Partial): this + cloneAfter(overrides?: Partial): this + cloneBefore(overrides?: Partial): this +} + +declare class AtRule extends AtRule_ {} + +export = AtRule diff --git a/node_modules/postcss/lib/at-rule.js b/node_modules/postcss/lib/at-rule.js new file mode 100644 index 0000000..9486447 --- /dev/null +++ b/node_modules/postcss/lib/at-rule.js @@ -0,0 +1,25 @@ +'use strict' + +let Container = require('./container') + +class AtRule extends Container { + constructor(defaults) { + super(defaults) + this.type = 'atrule' + } + + append(...children) { + if (!this.proxyOf.nodes) this.nodes = [] + return super.append(...children) + } + + prepend(...children) { + if (!this.proxyOf.nodes) this.nodes = [] + return super.prepend(...children) + } +} + +module.exports = AtRule +AtRule.default = AtRule + +Container.registerAtRule(AtRule) diff --git a/node_modules/postcss/lib/comment.d.ts b/node_modules/postcss/lib/comment.d.ts new file mode 100644 index 0000000..f764109 --- /dev/null +++ b/node_modules/postcss/lib/comment.d.ts @@ -0,0 +1,67 @@ +import Container from './container.js' +import Node, { NodeProps } from './node.js' + +declare namespace Comment { + export interface CommentRaws extends Record { + /** + * The space symbols before the node. + */ + before?: string + + /** + * The space symbols between `/*` and the comment’s text. + */ + left?: string + + /** + * The space symbols between the comment’s text. + */ + right?: string + } + + export interface CommentProps extends NodeProps { + /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ + raws?: CommentRaws + /** Content of the comment. */ + text: string + } + + export { Comment_ as default } +} + +/** + * It represents a class that handles + * [CSS comments](https://developer.mozilla.org/en-US/docs/Web/CSS/Comments) + * + * ```js + * Once (root, { Comment }) { + * const note = new Comment({ text: 'Note: …' }) + * root.append(note) + * } + * ``` + * + * Remember that CSS comments inside selectors, at-rule parameters, + * or declaration values will be stored in the `raws` properties + * explained above. + */ +declare class Comment_ extends Node { + parent: Container | undefined + raws: Comment.CommentRaws + type: 'comment' + /** + * The comment's text. + */ + get text(): string + + set text(value: string) + + constructor(defaults?: Comment.CommentProps) + assign(overrides: Comment.CommentProps | object): this + clone(overrides?: Partial): this + cloneAfter(overrides?: Partial): this + cloneBefore(overrides?: Partial): this +} + +declare class Comment extends Comment_ {} + +export = Comment diff --git a/node_modules/postcss/lib/comment.js b/node_modules/postcss/lib/comment.js new file mode 100644 index 0000000..c566506 --- /dev/null +++ b/node_modules/postcss/lib/comment.js @@ -0,0 +1,13 @@ +'use strict' + +let Node = require('./node') + +class Comment extends Node { + constructor(defaults) { + super(defaults) + this.type = 'comment' + } +} + +module.exports = Comment +Comment.default = Comment diff --git a/node_modules/postcss/lib/container.d.ts b/node_modules/postcss/lib/container.d.ts new file mode 100644 index 0000000..a2edcda --- /dev/null +++ b/node_modules/postcss/lib/container.d.ts @@ -0,0 +1,474 @@ +import AtRule from './at-rule.js' +import Comment from './comment.js' +import Declaration from './declaration.js' +import Node, { ChildNode, ChildProps, NodeProps } from './node.js' +import { Root } from './postcss.js' +import Rule from './rule.js' + +declare namespace Container { + export type ContainerWithChildren = { + nodes: Child[] + } & (AtRule | Root | Rule) + + export interface ValueOptions { + /** + * String that’s used to narrow down values and speed up the regexp search. + */ + fast?: string + + /** + * An array of property names. + */ + props?: readonly string[] + } + + export interface ContainerProps extends NodeProps { + nodes?: readonly (ChildProps | Node)[] + } + + /** + * All types that can be passed into container methods to create or add a new + * child node. + */ + export type NewChild = + | ChildProps + | Node + | readonly ChildProps[] + | readonly Node[] + | readonly string[] + | string + | undefined + + export { Container_ as default } +} + +/** + * The `Root`, `AtRule`, and `Rule` container nodes + * inherit some common methods to help work with their children. + * + * Note that all containers can store any content. If you write a rule inside + * a rule, PostCSS will parse it. + */ +declare abstract class Container_ extends Node { + /** + * An array containing the container’s children. + * + * ```js + * const root = postcss.parse('a { color: black }') + * root.nodes.length //=> 1 + * root.nodes[0].selector //=> 'a' + * root.nodes[0].nodes[0].prop //=> 'color' + * ``` + */ + nodes: Child[] | undefined + + /** + * The container’s first child. + * + * ```js + * rule.first === rules.nodes[0] + * ``` + */ + get first(): Child | undefined + + /** + * The container’s last child. + * + * ```js + * rule.last === rule.nodes[rule.nodes.length - 1] + * ``` + */ + get last(): Child | undefined + /** + * Inserts new nodes to the end of the container. + * + * ```js + * const decl1 = new Declaration({ prop: 'color', value: 'black' }) + * const decl2 = new Declaration({ prop: 'background-color', value: 'white' }) + * rule.append(decl1, decl2) + * + * root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule + * root.append({ selector: 'a' }) // rule + * rule.append({ prop: 'color', value: 'black' }) // declaration + * rule.append({ text: 'Comment' }) // comment + * + * root.append('a {}') + * root.first.append('color: black; z-index: 1') + * ``` + * + * @param nodes New nodes. + * @return This node for methods chain. + */ + append(...nodes: Container.NewChild[]): this + assign(overrides: Container.ContainerProps | object): this + clone(overrides?: Partial): this + + cloneAfter(overrides?: Partial): this + + cloneBefore(overrides?: Partial): this + /** + * Iterates through the container’s immediate children, + * calling `callback` for each child. + * + * Returning `false` in the callback will break iteration. + * + * This method only iterates through the container’s immediate children. + * If you need to recursively iterate through all the container’s descendant + * nodes, use `Container#walk`. + * + * Unlike the for `{}`-cycle or `Array#forEach` this iterator is safe + * if you are mutating the array of child nodes during iteration. + * PostCSS will adjust the current index to match the mutations. + * + * ```js + * const root = postcss.parse('a { color: black; z-index: 1 }') + * const rule = root.first + * + * for (const decl of rule.nodes) { + * decl.cloneBefore({ prop: '-webkit-' + decl.prop }) + * // Cycle will be infinite, because cloneBefore moves the current node + * // to the next index + * } + * + * rule.each(decl => { + * decl.cloneBefore({ prop: '-webkit-' + decl.prop }) + * // Will be executed only for color and z-index + * }) + * ``` + * + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + each( + callback: (node: Child, index: number) => false | void + ): false | undefined + + /** + * Returns `true` if callback returns `true` + * for all of the container’s children. + * + * ```js + * const noPrefixes = rule.every(i => i.prop[0] !== '-') + * ``` + * + * @param condition Iterator returns true or false. + * @return Is every child pass condition. + */ + every( + condition: (node: Child, index: number, nodes: Child[]) => boolean + ): boolean + /** + * Returns a `child`’s index within the `Container#nodes` array. + * + * ```js + * rule.index( rule.nodes[2] ) //=> 2 + * ``` + * + * @param child Child of the current container. + * @return Child index. + */ + index(child: Child | number): number + + /** + * Insert new node after old node within the container. + * + * @param oldNode Child or child’s index. + * @param newNode New node. + * @return This node for methods chain. + */ + insertAfter(oldNode: Child | number, newNode: Container.NewChild): this + + /** + * Insert new node before old node within the container. + * + * ```js + * rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop })) + * ``` + * + * @param oldNode Child or child’s index. + * @param newNode New node. + * @return This node for methods chain. + */ + insertBefore(oldNode: Child | number, newNode: Container.NewChild): this + /** + * Inserts new nodes to the start of the container. + * + * ```js + * const decl1 = new Declaration({ prop: 'color', value: 'black' }) + * const decl2 = new Declaration({ prop: 'background-color', value: 'white' }) + * rule.prepend(decl1, decl2) + * + * root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule + * root.append({ selector: 'a' }) // rule + * rule.append({ prop: 'color', value: 'black' }) // declaration + * rule.append({ text: 'Comment' }) // comment + * + * root.append('a {}') + * root.first.append('color: black; z-index: 1') + * ``` + * + * @param nodes New nodes. + * @return This node for methods chain. + */ + prepend(...nodes: Container.NewChild[]): this + + /** + * Add child to the end of the node. + * + * ```js + * rule.push(new Declaration({ prop: 'color', value: 'black' })) + * ``` + * + * @param child New node. + * @return This node for methods chain. + */ + push(child: Child): this + + /** + * Removes all children from the container + * and cleans their parent properties. + * + * ```js + * rule.removeAll() + * rule.nodes.length //=> 0 + * ``` + * + * @return This node for methods chain. + */ + removeAll(): this + + /** + * Removes node from the container and cleans the parent properties + * from the node and its children. + * + * ```js + * rule.nodes.length //=> 5 + * rule.removeChild(decl) + * rule.nodes.length //=> 4 + * decl.parent //=> undefined + * ``` + * + * @param child Child or child’s index. + * @return This node for methods chain. + */ + removeChild(child: Child | number): this + + replaceValues( + pattern: RegExp | string, + replaced: { (substring: string, ...args: any[]): string } | string + ): this + /** + * Passes all declaration values within the container that match pattern + * through callback, replacing those values with the returned result + * of callback. + * + * This method is useful if you are using a custom unit or function + * and need to iterate through all values. + * + * ```js + * root.replaceValues(/\d+rem/, { fast: 'rem' }, string => { + * return 15 * parseInt(string) + 'px' + * }) + * ``` + * + * @param pattern Replace pattern. + * @param {object} options Options to speed up the search. + * @param replaced String to replace pattern or callback + * that returns a new value. The callback + * will receive the same arguments + * as those passed to a function parameter + * of `String#replace`. + * @return This node for methods chain. + */ + replaceValues( + pattern: RegExp | string, + options: Container.ValueOptions, + replaced: { (substring: string, ...args: any[]): string } | string + ): this + + /** + * Returns `true` if callback returns `true` for (at least) one + * of the container’s children. + * + * ```js + * const hasPrefix = rule.some(i => i.prop[0] === '-') + * ``` + * + * @param condition Iterator returns true or false. + * @return Is some child pass condition. + */ + some( + condition: (node: Child, index: number, nodes: Child[]) => boolean + ): boolean + + /** + * Traverses the container’s descendant nodes, calling callback + * for each node. + * + * Like container.each(), this method is safe to use + * if you are mutating arrays during iteration. + * + * If you only need to iterate through the container’s immediate children, + * use `Container#each`. + * + * ```js + * root.walk(node => { + * // Traverses all descendant nodes. + * }) + * ``` + * + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walk( + callback: (node: ChildNode, index: number) => false | void + ): false | undefined + + /** + * Traverses the container’s descendant nodes, calling callback + * for each at-rule node. + * + * If you pass a filter, iteration will only happen over at-rules + * that have matching names. + * + * Like `Container#each`, this method is safe + * to use if you are mutating arrays during iteration. + * + * ```js + * root.walkAtRules(rule => { + * if (isOld(rule.name)) rule.remove() + * }) + * + * let first = false + * root.walkAtRules('charset', rule => { + * if (!first) { + * first = true + * } else { + * rule.remove() + * } + * }) + * ``` + * + * @param name String or regular expression to filter at-rules by name. + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walkAtRules( + nameFilter: RegExp | string, + callback: (atRule: AtRule, index: number) => false | void + ): false | undefined + walkAtRules( + callback: (atRule: AtRule, index: number) => false | void + ): false | undefined + + /** + * Traverses the container’s descendant nodes, calling callback + * for each comment node. + * + * Like `Container#each`, this method is safe + * to use if you are mutating arrays during iteration. + * + * ```js + * root.walkComments(comment => { + * comment.remove() + * }) + * ``` + * + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walkComments( + callback: (comment: Comment, indexed: number) => false | void + ): false | undefined + + /** + * Traverses the container’s descendant nodes, calling callback + * for each declaration node. + * + * If you pass a filter, iteration will only happen over declarations + * with matching properties. + * + * ```js + * root.walkDecls(decl => { + * checkPropertySupport(decl.prop) + * }) + * + * root.walkDecls('border-radius', decl => { + * decl.remove() + * }) + * + * root.walkDecls(/^background/, decl => { + * decl.value = takeFirstColorFromGradient(decl.value) + * }) + * ``` + * + * Like `Container#each`, this method is safe + * to use if you are mutating arrays during iteration. + * + * @param prop String or regular expression to filter declarations + * by property name. + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walkDecls( + propFilter: RegExp | string, + callback: (decl: Declaration, index: number) => false | void + ): false | undefined + walkDecls( + callback: (decl: Declaration, index: number) => false | void + ): false | undefined + /** + * Traverses the container’s descendant nodes, calling callback + * for each rule node. + * + * If you pass a filter, iteration will only happen over rules + * with matching selectors. + * + * Like `Container#each`, this method is safe + * to use if you are mutating arrays during iteration. + * + * ```js + * const selectors = [] + * root.walkRules(rule => { + * selectors.push(rule.selector) + * }) + * console.log(`Your CSS uses ${ selectors.length } selectors`) + * ``` + * + * @param selector String or regular expression to filter rules by selector. + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walkRules( + selectorFilter: RegExp | string, + callback: (rule: Rule, index: number) => false | void + ): false | undefined + walkRules( + callback: (rule: Rule, index: number) => false | void + ): false | undefined + /** + * An internal method that converts a {@link NewChild} into a list of actual + * child nodes that can then be added to this container. + * + * This ensures that the nodes' parent is set to this container, that they use + * the correct prototype chain, and that they're marked as dirty. + * + * @param mnodes The new node or nodes to add. + * @param sample A node from whose raws the new node's `before` raw should be + * taken. + * @param type This should be set to `'prepend'` if the new nodes will be + * inserted at the beginning of the container. + * @hidden + */ + protected normalize( + nodes: Container.NewChild, + sample: Node | undefined, + type?: 'prepend' | false + ): Child[] +} + +declare class Container< + Child extends Node = ChildNode +> extends Container_ {} + +export = Container diff --git a/node_modules/postcss/lib/container.js b/node_modules/postcss/lib/container.js new file mode 100644 index 0000000..cd3b65b --- /dev/null +++ b/node_modules/postcss/lib/container.js @@ -0,0 +1,494 @@ +'use strict' + +let Comment = require('./comment') +let Declaration = require('./declaration') +let Node = require('./node') +let { isClean, my } = require('./symbols') + +let AtRule, parse, Root, Rule + +function cleanSource(nodes) { + let stack = nodes.slice() + while (stack.length > 0) { + let node = stack.pop() + delete node.source + if (node.nodes) { + node.nodes = node.nodes.slice() + for (let i of node.nodes) stack.push(i) + } + } + return nodes.slice() +} + +function markTreeDirty(node) { + let stack = [node] + while (stack.length > 0) { + let next = stack.pop() + next[isClean] = false + if (next.proxyOf.nodes) { + for (let i of next.proxyOf.nodes) stack.push(i) + } + } +} + +class Container extends Node { + get first() { + if (!this.proxyOf.nodes) return undefined + return this.proxyOf.nodes[0] + } + + get last() { + if (!this.proxyOf.nodes) return undefined + return this.proxyOf.nodes[this.proxyOf.nodes.length - 1] + } + + append(...children) { + for (let child of children) { + let nodes = this.normalize(child, this.last) + for (let node of nodes) this.proxyOf.nodes.push(node) + } + + this.markDirty() + + return this + } + + cleanRaws(keepBetween) { + let stack = [this] + while (stack.length > 0) { + let node = stack.pop() + if (node !== this && node.cleanRaws !== Container.prototype.cleanRaws) { + // Subclass with own logic; let it handle its subtree + node.cleanRaws(keepBetween) + continue + } + Node.prototype.cleanRaws.call(node, keepBetween) + if (node.nodes) { + for (let child of node.nodes) stack.push(child) + } + } + } + + each(callback) { + if (!this.proxyOf.nodes) return undefined + let iterator = this.getIterator() + + let index, result + while (this.indexes[iterator] < this.proxyOf.nodes.length) { + index = this.indexes[iterator] + result = callback(this.proxyOf.nodes[index], index) + if (result === false) break + + this.indexes[iterator] += 1 + } + + delete this.indexes[iterator] + return result + } + + every(condition) { + return this.nodes.every(condition) + } + + getIterator() { + if (!this.lastEach) this.lastEach = 0 + if (!this.indexes) this.indexes = {} + + this.lastEach += 1 + let iterator = this.lastEach + this.indexes[iterator] = 0 + + return iterator + } + + getProxyProcessor() { + return { + get(node, prop) { + if (prop === 'proxyOf') { + return node + } else if (!node[prop]) { + return node[prop] + } else if ( + prop === 'each' || + (typeof prop === 'string' && prop.startsWith('walk')) + ) { + return (...args) => { + return node[prop]( + ...args.map(i => { + if (typeof i === 'function') { + return (child, index) => i(child.toProxy(), index) + } else { + return i + } + }) + ) + } + } else if (prop === 'every' || prop === 'some') { + return cb => { + return node[prop]((child, ...other) => + cb(child.toProxy(), ...other) + ) + } + } else if (prop === 'root') { + return () => node.root().toProxy() + } else if (prop === 'nodes') { + return node.nodes.map(i => i.toProxy()) + } else if (prop === 'first' || prop === 'last') { + return node[prop].toProxy() + } else { + return node[prop] + } + }, + + set(node, prop, value) { + if (node[prop] === value) return true + node[prop] = value + if (prop === 'name' || prop === 'params' || prop === 'selector') { + node.markDirty() + } + return true + } + } + } + + index(child) { + if (typeof child === 'number') return child + if (child.proxyOf) child = child.proxyOf + return this.proxyOf.nodes.indexOf(child) + } + + insertAfter(exist, add) { + let existIndex = this.index(exist) + let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse() + existIndex = this.index(exist) + for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node) + + let index + for (let id in this.indexes) { + index = this.indexes[id] + if (existIndex < index) { + this.indexes[id] = index + nodes.length + } + } + + this.markDirty() + + return this + } + + insertBefore(exist, add) { + let existIndex = this.index(exist) + let type = existIndex === 0 ? 'prepend' : false + let nodes = this.normalize( + add, + this.proxyOf.nodes[existIndex], + type + ).reverse() + existIndex = this.index(exist) + for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node) + + let index + for (let id in this.indexes) { + index = this.indexes[id] + if (existIndex <= index) { + this.indexes[id] = index + nodes.length + } + } + + this.markDirty() + + return this + } + + normalize(nodes, sample) { + if (typeof nodes === 'string') { + nodes = cleanSource(parse(nodes).nodes) + } else if (typeof nodes === 'undefined') { + nodes = [] + } else if (Array.isArray(nodes)) { + nodes = nodes.slice(0) + for (let i of nodes) { + if (i.parent) i.parent.removeChild(i, 'ignore') + } + } else if (nodes.type === 'root' && this.type !== 'document') { + nodes = nodes.nodes.slice(0) + for (let i of nodes) { + if (i.parent) i.parent.removeChild(i, 'ignore') + } + } else if (nodes.type) { + nodes = [nodes] + } else if (nodes.prop) { + if (typeof nodes.value === 'undefined') { + throw new Error('Value field is missed in node creation') + } else if (typeof nodes.value !== 'string') { + nodes.value = String(nodes.value) + } + nodes = [new Declaration(nodes)] + } else if (nodes.selector || nodes.selectors) { + nodes = [new Rule(nodes)] + } else if (nodes.name) { + nodes = [new AtRule(nodes)] + } else if (nodes.text) { + nodes = [new Comment(nodes)] + } else { + throw new Error('Unknown node type in node creation') + } + + let processed = nodes.map(i => { + /* c8 ignore next */ + if (!i[my]) Container.rebuild(i) + i = i.proxyOf + if (i.parent) i.parent.removeChild(i) + if (i[isClean]) markTreeDirty(i) + + if (!i.raws) i.raws = {} + if (typeof i.raws.before === 'undefined') { + if (sample && typeof sample.raws.before !== 'undefined') { + i.raws.before = sample.raws.before.replace(/\S/g, '') + } + } + i.parent = this.proxyOf + return i + }) + + return processed + } + + prepend(...children) { + children = children.reverse() + for (let child of children) { + let nodes = this.normalize(child, this.first, 'prepend').reverse() + for (let node of nodes) this.proxyOf.nodes.unshift(node) + for (let id in this.indexes) { + this.indexes[id] = this.indexes[id] + nodes.length + } + } + + this.markDirty() + + return this + } + + push(child) { + child.parent = this + this.proxyOf.nodes.push(child) + return this + } + + removeAll() { + for (let node of this.proxyOf.nodes) node.parent = undefined + this.proxyOf.nodes = [] + + this.markDirty() + + return this + } + + removeChild(child) { + child = this.index(child) + this.proxyOf.nodes[child].parent = undefined + this.proxyOf.nodes.splice(child, 1) + + let index + for (let id in this.indexes) { + index = this.indexes[id] + if (index >= child) { + this.indexes[id] = index - 1 + } + } + + this.markDirty() + + return this + } + + replaceValues(pattern, opts, callback) { + if (!callback) { + callback = opts + opts = {} + } + + this.walkDecls(decl => { + if (opts.props && !opts.props.includes(decl.prop)) return + if (opts.fast && !decl.value.includes(opts.fast)) return + + decl.value = decl.value.replace(pattern, callback) + }) + + this.markDirty() + + return this + } + + some(condition) { + return this.nodes.some(condition) + } + + walk(callback) { + if (!this.proxyOf.nodes) return undefined + + // An explicit stack instead of recursive `each()` calls to survive + // deeply nested trees. Each frame keeps a live `indexes` slot, so + // insertion and removal during the walk behave like `each()`: the + // slot stays at the current child until its subtree is finished. + let stack = [{ iterator: this.getIterator(), node: this.proxyOf }] + + while (stack.length > 0) { + let { iterator, node } = stack[stack.length - 1] + let index = node.indexes[iterator] + + if (index >= node.proxyOf.nodes.length) { + delete node.indexes[iterator] + stack.pop() + let parent = stack[stack.length - 1] + // Finish the parent’s step for the child subtree we just left + if (parent) parent.node.indexes[parent.iterator] += 1 + continue + } + + let child = node.proxyOf.nodes[index] + let result + try { + result = callback(child, index) + } catch (e) { + throw child.addToError(e) + } + if (result === false) { + for (let opened of stack) { + delete opened.node.indexes[opened.iterator] + } + return false + } + if (child.walk && child.proxyOf.nodes) { + stack.push({ iterator: child.getIterator(), node: child }) + } else { + node.indexes[iterator] += 1 + } + } + + return undefined + } + + walkAtRules(name, callback) { + if (!callback) { + callback = name + return this.walk((child, i) => { + if (child.type === 'atrule') { + return callback(child, i) + } + }) + } + if (name instanceof RegExp) { + return this.walk((child, i) => { + if (child.type === 'atrule' && name.test(child.name)) { + return callback(child, i) + } + }) + } + return this.walk((child, i) => { + if (child.type === 'atrule' && child.name === name) { + return callback(child, i) + } + }) + } + + walkComments(callback) { + return this.walk((child, i) => { + if (child.type === 'comment') { + return callback(child, i) + } + }) + } + + walkDecls(prop, callback) { + if (!callback) { + callback = prop + return this.walk((child, i) => { + if (child.type === 'decl') { + return callback(child, i) + } + }) + } + if (prop instanceof RegExp) { + return this.walk((child, i) => { + if (child.type === 'decl' && prop.test(child.prop)) { + return callback(child, i) + } + }) + } + return this.walk((child, i) => { + if (child.type === 'decl' && child.prop === prop) { + return callback(child, i) + } + }) + } + + walkRules(selector, callback) { + if (!callback) { + callback = selector + + return this.walk((child, i) => { + if (child.type === 'rule') { + return callback(child, i) + } + }) + } + if (selector instanceof RegExp) { + return this.walk((child, i) => { + if (child.type === 'rule' && selector.test(child.selector)) { + return callback(child, i) + } + }) + } + return this.walk((child, i) => { + if (child.type === 'rule' && child.selector === selector) { + return callback(child, i) + } + }) + } +} + +Container.registerParse = dependant => { + parse = dependant +} + +Container.registerRule = dependant => { + Rule = dependant +} + +Container.registerAtRule = dependant => { + AtRule = dependant +} + +Container.registerRoot = dependant => { + Root = dependant +} + +module.exports = Container +Container.default = Container + +/* c8 ignore start */ +Container.rebuild = node => { + let stack = [node] + while (stack.length > 0) { + let next = stack.pop() + if (next.type === 'atrule') { + Object.setPrototypeOf(next, AtRule.prototype) + } else if (next.type === 'rule') { + Object.setPrototypeOf(next, Rule.prototype) + } else if (next.type === 'decl') { + Object.setPrototypeOf(next, Declaration.prototype) + } else if (next.type === 'comment') { + Object.setPrototypeOf(next, Comment.prototype) + } else if (next.type === 'root') { + Object.setPrototypeOf(next, Root.prototype) + } + + next[my] = true + + if (next.nodes) { + for (let child of next.nodes) stack.push(child) + } + } +} +/* c8 ignore stop */ diff --git a/node_modules/postcss/lib/css-syntax-error.d.ts b/node_modules/postcss/lib/css-syntax-error.d.ts new file mode 100644 index 0000000..03d9ed1 --- /dev/null +++ b/node_modules/postcss/lib/css-syntax-error.d.ts @@ -0,0 +1,247 @@ +import { FilePosition } from './input.js' + +declare namespace CssSyntaxError { + /** + * A position that is part of a range. + */ + export interface RangePosition { + /** + * The column number in the input. + */ + column: number + + /** + * The line number in the input. + */ + line: number + } + + export { CssSyntaxError_ as default } +} + +/** + * The CSS parser throws this error for broken CSS. + * + * Custom parsers can throw this error for broken custom syntax using + * the `Node#error` method. + * + * PostCSS will use the input source map to detect the original error location. + * If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS, + * PostCSS will show the original position in the Sass file. + * + * If you need the position in the PostCSS input + * (e.g., to debug the previous compiler), use `error.input.file`. + * + * ```js + * // Raising error from plugin + * throw node.error('Unknown variable', { plugin: 'postcss-vars' }) + * ``` + * + * ```js + * // Catching and checking syntax error + * try { + * postcss.parse('a{') + * } catch (error) { + * if (error.name === 'CssSyntaxError') { + * error //=> CssSyntaxError + * } + * } + * ``` + */ +declare class CssSyntaxError_ extends Error { + /** + * Source column of the error. + * + * ```js + * error.column //=> 1 + * error.input.column //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.column`. + */ + column?: number + + /** + * Source column of the error's end, exclusive. Provided if the error pertains + * to a range. + * + * ```js + * error.endColumn //=> 1 + * error.input.endColumn //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.endColumn`. + */ + endColumn?: number + + /** + * Source line of the error's end, exclusive. Provided if the error pertains + * to a range. + * + * ```js + * error.endLine //=> 3 + * error.input.endLine //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.endLine`. + */ + endLine?: number + + /** + * Absolute path to the broken file. + * + * ```js + * error.file //=> 'a.sass' + * error.input.file //=> 'a.css' + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.file`. + */ + file?: string + + /** + * Input object with PostCSS internal information + * about input file. If input has source map + * from previous tool, PostCSS will use origin + * (for example, Sass) source. You can use this + * object to get PostCSS input source. + * + * ```js + * error.input.file //=> 'a.css' + * error.file //=> 'a.sass' + * ``` + */ + input?: FilePosition + + /** + * Source line of the error. + * + * ```js + * error.line //=> 2 + * error.input.line //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.line`. + */ + line?: number + + /** + * Full error text in the GNU error format + * with plugin, file, line and column. + * + * ```js + * error.message //=> 'a.css:1:1: Unclosed block' + * ``` + */ + message: string + + /** + * Always equal to `'CssSyntaxError'`. You should always check error type + * by `error.name === 'CssSyntaxError'` + * instead of `error instanceof CssSyntaxError`, + * because npm could have several PostCSS versions. + * + * ```js + * if (error.name === 'CssSyntaxError') { + * error //=> CssSyntaxError + * } + * ``` + */ + name: 'CssSyntaxError' + + /** + * Plugin name, if error came from plugin. + * + * ```js + * error.plugin //=> 'postcss-vars' + * ``` + */ + plugin?: string + + /** + * Error message. + * + * ```js + * error.message //=> 'Unclosed block' + * ``` + */ + reason: string + + /** + * Source code of the broken file. + * + * ```js + * error.source //=> 'a { b {} }' + * error.input.source //=> 'a b { }' + * ``` + */ + source?: string + + stack: string + + /** + * Instantiates a CSS syntax error. Can be instantiated for a single position + * or for a range. + * @param message Error message. + * @param lineOrStartPos If for a single position, the line number, or if for + * a range, the inclusive start position of the error. + * @param columnOrEndPos If for a single position, the column number, or if for + * a range, the exclusive end position of the error. + * @param source Source code of the broken file. + * @param file Absolute path to the broken file. + * @param plugin PostCSS plugin name, if error came from plugin. + */ + constructor( + message: string, + lineOrStartPos?: CssSyntaxError.RangePosition | number, + columnOrEndPos?: CssSyntaxError.RangePosition | number, + source?: string, + file?: string, + plugin?: string + ) + + /** + * Returns a few lines of CSS source that caused the error. + * + * If the CSS has an input source map without `sourceContent`, + * this method will return an empty string. + * + * ```js + * error.showSourceCode() //=> " 4 | } + * // 5 | a { + * // > 6 | bad + * // | ^ + * // 7 | } + * // 8 | b {" + * ``` + * + * @param color Whether arrow will be colored red by terminal + * color codes. By default, PostCSS will detect + * color support by `process.stdout.isTTY` + * and `process.env.NODE_DISABLE_COLORS`. + * @return Few lines of CSS source that caused the error. + */ + showSourceCode(color?: boolean): string + + /** + * Returns error position, message and source code of the broken part. + * + * ```js + * error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block + * // > 1 | a { + * // | ^" + * ``` + * + * @return Error position, message and source code. + */ + toString(): string +} + +declare class CssSyntaxError extends CssSyntaxError_ {} + +export = CssSyntaxError diff --git a/node_modules/postcss/lib/css-syntax-error.js b/node_modules/postcss/lib/css-syntax-error.js new file mode 100644 index 0000000..275a4f6 --- /dev/null +++ b/node_modules/postcss/lib/css-syntax-error.js @@ -0,0 +1,133 @@ +'use strict' + +let pico = require('picocolors') + +let terminalHighlight = require('./terminal-highlight') + +class CssSyntaxError extends Error { + constructor(message, line, column, source, file, plugin) { + super(message) + this.name = 'CssSyntaxError' + this.reason = message + + if (file) { + this.file = file + } + if (source) { + this.source = source + } + if (plugin) { + this.plugin = plugin + } + if (typeof line !== 'undefined' && typeof column !== 'undefined') { + if (typeof line === 'number') { + this.line = line + this.column = column + } else { + this.line = line.line + this.column = line.column + this.endLine = column.line + this.endColumn = column.column + } + } + + this.setMessage() + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, CssSyntaxError) + } + } + + setMessage() { + this.message = this.plugin ? this.plugin + ': ' : '' + this.message += this.file ? this.file : '' + if (typeof this.line !== 'undefined') { + this.message += ':' + this.line + ':' + this.column + } + this.message += ': ' + this.reason + } + + showSourceCode(color) { + if (!this.source) return '' + + let css = this.source + if (color == null) color = pico.isColorSupported + + let aside = text => text + let mark = text => text + let highlight = text => text + if (color) { + let { bold, gray, red } = pico.createColors(true) + mark = text => bold(red(text)) + aside = text => gray(text) + if (terminalHighlight) { + highlight = text => terminalHighlight(text) + } + } + + let lines = css.split(/\r?\n/) + let start = Math.max(this.line - 3, 0) + let end = Math.min(this.line + 2, lines.length) + let maxWidth = String(end).length + + return lines + .slice(start, end) + .map((line, index) => { + let number = start + 1 + index + let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ' + if (number === this.line) { + if (line.length > 160) { + let padding = 20 + let subLineStart = Math.max(0, this.column - padding) + let subLineEnd = Math.max( + this.column + padding, + this.endColumn + padding + ) + let subLine = line.slice(subLineStart, subLineEnd) + + let spacing = + aside(gutter.replace(/\d/g, ' ')) + + line + .slice(0, Math.min(this.column - 1, padding - 1)) + .replace(/[^\t]/g, ' ') + + return ( + mark('>') + + aside(gutter) + + highlight(subLine) + + '\n ' + + spacing + + mark('^') + ) + } + + let spacing = + aside(gutter.replace(/\d/g, ' ')) + + line.slice(0, this.column - 1).replace(/[^\t]/g, ' ') + + return ( + mark('>') + + aside(gutter) + + highlight(line) + + '\n ' + + spacing + + mark('^') + ) + } + + return ' ' + aside(gutter) + highlight(line) + }) + .join('\n') + } + + toString() { + let code = this.showSourceCode() + if (code) { + code = '\n\n' + code + '\n' + } + return this.name + ': ' + this.message + code + } +} + +module.exports = CssSyntaxError +CssSyntaxError.default = CssSyntaxError diff --git a/node_modules/postcss/lib/declaration.d.ts b/node_modules/postcss/lib/declaration.d.ts new file mode 100644 index 0000000..35c0e5b --- /dev/null +++ b/node_modules/postcss/lib/declaration.d.ts @@ -0,0 +1,150 @@ +import { ContainerWithChildren } from './container.js' +import Node, { NodeProps } from './node.js' + +declare namespace Declaration { + export interface DeclarationRaws extends Record { + /** + * The space symbols before the node. It also stores `*` + * and `_` symbols before the declaration (IE hack). + */ + before?: string + + /** + * The symbols between the property and value for declarations. + */ + between?: string + + /** + * The content of the important statement, if it is not just `!important`. + */ + important?: string + + /** + * Declaration value with comments. + */ + value?: { + raw: string + value: string + } + } + + export interface DeclarationProps extends NodeProps { + /** Whether the declaration has an `!important` annotation. */ + important?: boolean + /** Name of the declaration. */ + prop: string + /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ + raws?: DeclarationRaws + /** Value of the declaration. */ + value: string + } + + export { Declaration_ as default } +} + +/** + * It represents a class that handles + * [CSS declarations](https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax#css_declarations) + * + * ```js + * Once (root, { Declaration }) { + * const color = new Declaration({ prop: 'color', value: 'black' }) + * root.append(color) + * } + * ``` + * + * ```js + * const root = postcss.parse('a { color: black }') + * const decl = root.first?.first + * + * decl.type //=> 'decl' + * decl.toString() //=> ' color: black' + * ``` + */ +declare class Declaration_ extends Node { + parent: ContainerWithChildren | undefined + raws: Declaration.DeclarationRaws + + type: 'decl' + + /** + * It represents a specificity of the declaration. + * + * If true, the CSS declaration will have an + * [important](https://developer.mozilla.org/en-US/docs/Web/CSS/important) + * specifier. + * + * ```js + * const root = postcss.parse('a { color: black !important; color: red }') + * + * root.first.first.important //=> true + * root.first.last.important //=> undefined + * ``` + */ + get important(): boolean + set important(value: boolean) + + /** + * The property name for a CSS declaration. + * + * ```js + * const root = postcss.parse('a { color: black }') + * const decl = root.first.first + * + * decl.prop //=> 'color' + * ``` + */ + get prop(): string + + set prop(value: string) + + /** + * The property value for a CSS declaration. + * + * Any CSS comments inside the value string will be filtered out. + * CSS comments present in the source value will be available in + * the `raws` property. + * + * Assigning new `value` would ignore the comments in `raws` + * property while compiling node to string. + * + * ```js + * const root = postcss.parse('a { color: black }') + * const decl = root.first.first + * + * decl.value //=> 'black' + * ``` + */ + get value(): string + set value(value: string) + + /** + * It represents a getter that returns `true` if a declaration starts with + * `--` or `$`, which are used to declare variables in CSS and SASS/SCSS. + * + * ```js + * const root = postcss.parse(':root { --one: 1 }') + * const one = root.first.first + * + * one.variable //=> true + * ``` + * + * ```js + * const root = postcss.parse('$one: 1') + * const one = root.first + * + * one.variable //=> true + * ``` + */ + get variable(): boolean + constructor(defaults?: Declaration.DeclarationProps) + + assign(overrides: Declaration.DeclarationProps | object): this + clone(overrides?: Partial): this + cloneAfter(overrides?: Partial): this + cloneBefore(overrides?: Partial): this +} + +declare class Declaration extends Declaration_ {} + +export = Declaration diff --git a/node_modules/postcss/lib/declaration.js b/node_modules/postcss/lib/declaration.js new file mode 100644 index 0000000..65a03aa --- /dev/null +++ b/node_modules/postcss/lib/declaration.js @@ -0,0 +1,24 @@ +'use strict' + +let Node = require('./node') + +class Declaration extends Node { + get variable() { + return this.prop.startsWith('--') || this.prop[0] === '$' + } + + constructor(defaults) { + if ( + defaults && + typeof defaults.value !== 'undefined' && + typeof defaults.value !== 'string' + ) { + defaults = { ...defaults, value: String(defaults.value) } + } + super(defaults) + this.type = 'decl' + } +} + +module.exports = Declaration +Declaration.default = Declaration diff --git a/node_modules/postcss/lib/document.d.ts b/node_modules/postcss/lib/document.d.ts new file mode 100644 index 0000000..67194dd --- /dev/null +++ b/node_modules/postcss/lib/document.d.ts @@ -0,0 +1,68 @@ +import Container, { ContainerProps } from './container.js' +import { ProcessOptions } from './postcss.js' +import Result from './result.js' +import Root from './root.js' + +declare namespace Document { + export interface DocumentProps extends ContainerProps { + nodes?: readonly Root[] + + /** + * Information to generate byte-to-byte equal node string as it was + * in the origin input. + * + * Every parser saves its own properties. + */ + raws?: Record + } + + export { Document_ as default } +} + +/** + * Represents a file and contains all its parsed nodes. + * + * **Experimental:** some aspects of this node could change within minor + * or patch version releases. + * + * ```js + * const document = htmlParser( + * '' + * ) + * document.type //=> 'document' + * document.nodes.length //=> 2 + * ``` + */ +declare class Document_ extends Container { + nodes: Root[] + parent: undefined + type: 'document' + + constructor(defaults?: Document.DocumentProps) + + assign(overrides: Document.DocumentProps | object): this + clone(overrides?: Partial): this + cloneAfter(overrides?: Partial): this + cloneBefore(overrides?: Partial): this + + /** + * Returns a `Result` instance representing the document’s CSS roots. + * + * ```js + * const root1 = postcss.parse(css1, { from: 'a.css' }) + * const root2 = postcss.parse(css2, { from: 'b.css' }) + * const document = postcss.document() + * document.append(root1) + * document.append(root2) + * const result = document.toResult({ to: 'all.css', map: true }) + * ``` + * + * @param opts Options. + * @return Result with current document’s CSS. + */ + toResult(options?: ProcessOptions): Result +} + +declare class Document extends Document_ {} + +export = Document diff --git a/node_modules/postcss/lib/document.js b/node_modules/postcss/lib/document.js new file mode 100644 index 0000000..4468991 --- /dev/null +++ b/node_modules/postcss/lib/document.js @@ -0,0 +1,33 @@ +'use strict' + +let Container = require('./container') + +let LazyResult, Processor + +class Document extends Container { + constructor(defaults) { + // type needs to be passed to super, otherwise child roots won't be normalized correctly + super({ type: 'document', ...defaults }) + + if (!this.nodes) { + this.nodes = [] + } + } + + toResult(opts = {}) { + let lazy = new LazyResult(new Processor(), this, opts) + + return lazy.stringify() + } +} + +Document.registerLazyResult = dependant => { + LazyResult = dependant +} + +Document.registerProcessor = dependant => { + Processor = dependant +} + +module.exports = Document +Document.default = Document diff --git a/node_modules/postcss/lib/fromJSON.d.ts b/node_modules/postcss/lib/fromJSON.d.ts new file mode 100644 index 0000000..3a0c5b8 --- /dev/null +++ b/node_modules/postcss/lib/fromJSON.d.ts @@ -0,0 +1,9 @@ +import { JSONHydrator } from './postcss.js' + +interface FromJSON extends JSONHydrator { + default: FromJSON +} + +declare let fromJSON: FromJSON + +export = fromJSON diff --git a/node_modules/postcss/lib/fromJSON.js b/node_modules/postcss/lib/fromJSON.js new file mode 100644 index 0000000..c1a9509 --- /dev/null +++ b/node_modules/postcss/lib/fromJSON.js @@ -0,0 +1,107 @@ +'use strict' + +let AtRule = require('./at-rule') +let Comment = require('./comment') +let Declaration = require('./declaration') +let Input = require('./input') +let PreviousMap = require('./previous-map') +let Root = require('./root') +let Rule = require('./rule') + +function hydrateInputs(json, inputs) { + if (!json.inputs) return inputs + return json.inputs.map(input => { + let inputHydrated = { ...input, __proto__: Input.prototype } + if (inputHydrated.map) { + inputHydrated.map = { + ...inputHydrated.map, + __proto__: PreviousMap.prototype + } + } + return inputHydrated + }) +} + +function constructNode(json, inputs, children) { + let defaults = { ...json } + delete defaults.inputs + delete defaults.nodes + if (defaults.source) { + let { inputId, ...source } = defaults.source + defaults.source = source + if (inputId != null) { + defaults.source.input = inputs[inputId] + } + } + + let node + if (defaults.type === 'root') { + node = new Root(defaults) + } else if (defaults.type === 'decl') { + node = new Declaration(defaults) + } else if (defaults.type === 'rule') { + node = new Rule(defaults) + } else if (defaults.type === 'comment') { + node = new Comment(defaults) + } else if (defaults.type === 'atrule') { + node = new AtRule(defaults) + } else { + throw new Error('Unknown node type: ' + json.type) + } + + // Rehydrated children are attached after construction. Passing them + // through the container constructor would re-run insertion spacing + // normalization and overwrite each child's own `raws.before`. + if (children) { + node.nodes = children + for (let child of children) child.parent = node + } + + return node +} + +function fromJSON(json, inputs) { + if (Array.isArray(json)) return json.map(n => fromJSON(n)) + + // An explicit stack instead of recursive calls to survive deeply + // nested trees. Children are rehydrated before their parent node + // is constructed. + let result + let stack = [ + { childIndex: 0, children: [], inputs: hydrateInputs(json, inputs), json } + ] + + while (stack.length > 0) { + let frame = stack[stack.length - 1] + let jsonNodes = frame.json.nodes + + if (jsonNodes && frame.childIndex < jsonNodes.length) { + let childJson = jsonNodes[frame.childIndex] + frame.childIndex += 1 + stack.push({ + childIndex: 0, + children: [], + inputs: hydrateInputs(childJson, frame.inputs), + json: childJson + }) + continue + } + + stack.pop() + let node = constructNode( + frame.json, + frame.inputs, + jsonNodes ? frame.children : undefined + ) + if (stack.length > 0) { + stack[stack.length - 1].children.push(node) + } else { + result = node + } + } + + return result +} + +module.exports = fromJSON +fromJSON.default = fromJSON diff --git a/node_modules/postcss/lib/input.d.ts b/node_modules/postcss/lib/input.d.ts new file mode 100644 index 0000000..ca2d26b --- /dev/null +++ b/node_modules/postcss/lib/input.d.ts @@ -0,0 +1,226 @@ +import { CssSyntaxError, ProcessOptions } from './postcss.js' +import PreviousMap from './previous-map.js' + +declare namespace Input { + export interface FilePosition { + /** + * Column of inclusive start position in source file. + */ + column: number + + /** + * Column of exclusive end position in source file. + */ + endColumn?: number + + /** + * Line of exclusive end position in source file. + */ + endLine?: number + + /** + * Offset of exclusive end position in source file. + */ + endOffset?: number + + /** + * Absolute path to the source file. + */ + file?: string + + /** + * Line of inclusive start position in source file. + */ + line: number + + /** + * Offset of inclusive start position in source file. + */ + offset: number + + /** + * Source code. + */ + source?: string + + /** + * URL for the source file. + */ + url: string + } + + export { Input_ as default } +} + +/** + * Represents the source CSS. + * + * ```js + * const root = postcss.parse(css, { from: file }) + * const input = root.source.input + * ``` + */ +declare class Input_ { + /** + * Input CSS source. + * + * ```js + * const input = postcss.parse('a{}', { from: file }).input + * input.css //=> "a{}" + * ``` + */ + css: string + + /** + * Input source with support for non-CSS documents. + * + * ```js + * const input = postcss.parse('a{}', { from: file, document: '' }).input + * input.document //=> "" + * input.css //=> "a{}" + * ``` + */ + document: string + + /** + * The absolute path to the CSS source file defined + * with the `from` option. + * + * ```js + * const root = postcss.parse(css, { from: 'a.css' }) + * root.source.input.file //=> '/home/ai/a.css' + * ``` + */ + file?: string + + /** + * The flag to indicate whether or not the source code has Unicode BOM. + */ + hasBOM: boolean + + /** + * The unique ID of the CSS source. It will be created if `from` option + * is not provided (because PostCSS does not know the file path). + * + * ```js + * const root = postcss.parse(css) + * root.source.input.file //=> undefined + * root.source.input.id //=> "" + * ``` + */ + id?: string + + /** + * The input source map passed from a compilation step before PostCSS + * (for example, from Sass compiler). + * + * ```js + * root.source.input.map.consumer().sources //=> ['a.sass'] + * ``` + */ + map: PreviousMap + + /** + * The CSS source identifier. Contains `Input#file` if the user + * set the `from` option, or `Input#id` if they did not. + * + * ```js + * const root = postcss.parse(css, { from: 'a.css' }) + * root.source.input.from //=> "/home/ai/a.css" + * + * const root = postcss.parse(css) + * root.source.input.from //=> "" + * ``` + */ + get from(): string + + /** + * @param css Input CSS source. + * @param opts Process options. + */ + constructor(css: string, opts?: ProcessOptions) + + /** + * Returns `CssSyntaxError` with information about the error and its position. + */ + error( + message: string, + start: + | { + column: number + line: number + } + | { + offset: number + }, + end: + | { + column: number + line: number + } + | { + offset: number + }, + opts?: { plugin?: CssSyntaxError['plugin'] } + ): CssSyntaxError + error( + message: string, + line: number, + column: number, + opts?: { plugin?: CssSyntaxError['plugin'] } + ): CssSyntaxError + error( + message: string, + offset: number, + opts?: { plugin?: CssSyntaxError['plugin'] } + ): CssSyntaxError + + /** + * Converts source line and column to offset. + * + * @param line Source line. + * @param column Source column. + * @return Source offset. + */ + fromLineAndColumn(line: number, column: number): number + + /** + * Converts source offset to line and column. + * + * @param offset Source offset. + */ + fromOffset(offset: number): { col: number; line: number } | null + + /** + * Reads the input source map and returns a symbol position + * in the input source (e.g., in a Sass file that was compiled + * to CSS before being passed to PostCSS). Optionally takes an + * end position, exclusive. + * + * ```js + * root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 } + * root.source.input.origin(1, 1, 1, 4) + * //=> { file: 'a.css', line: 3, column: 1, endLine: 3, endColumn: 4 } + * ``` + * + * @param line Line for inclusive start position in input CSS. + * @param column Column for inclusive start position in input CSS. + * @param endLine Line for exclusive end position in input CSS. + * @param endColumn Column for exclusive end position in input CSS. + * + * @return Position in input source. + */ + origin( + line: number, + column: number, + endLine?: number, + endColumn?: number + ): false | Input.FilePosition + + /** Converts this to a JSON-friendly object representation. */ + toJSON(): object +} + +declare class Input extends Input_ {} + +export = Input diff --git a/node_modules/postcss/lib/input.js b/node_modules/postcss/lib/input.js new file mode 100644 index 0000000..defe395 --- /dev/null +++ b/node_modules/postcss/lib/input.js @@ -0,0 +1,282 @@ +'use strict' + +let { nanoid } = require('nanoid/non-secure') +let { isAbsolute, resolve } = require('path') +let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') +let { fileURLToPath, pathToFileURL } = require('url') + +let CssSyntaxError = require('./css-syntax-error') +let PreviousMap = require('./previous-map') +let terminalHighlight = require('./terminal-highlight') + +let lineToIndexCache = Symbol('lineToIndexCache') + +let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) +let pathAvailable = Boolean(resolve && isAbsolute) + +function getLineToIndex(input) { + if (input[lineToIndexCache]) return input[lineToIndexCache] + let lines = input.css.split('\n') + let lineToIndex = new Array(lines.length) + let prevIndex = 0 + + for (let i = 0, l = lines.length; i < l; i++) { + lineToIndex[i] = prevIndex + prevIndex += lines[i].length + 1 + } + + input[lineToIndexCache] = lineToIndex + return lineToIndex +} + +class Input { + get from() { + return this.file || this.id + } + + constructor(css, opts = {}) { + if ( + css === null || + typeof css === 'undefined' || + (typeof css === 'object' && !css.toString) + ) { + throw new Error(`PostCSS received ${css} instead of CSS string`) + } + + this.css = css.toString() + + if (this.css[0] === '\uFEFF' || this.css[0] === '\uFFFE') { + this.hasBOM = true + this.css = this.css.slice(1) + } else { + this.hasBOM = false + } + + this.document = this.css + if (opts.document) this.document = opts.document.toString() + + if (opts.from) { + if ( + !pathAvailable || + /^\w+:\/\//.test(opts.from) || + isAbsolute(opts.from) + ) { + this.file = opts.from + } else { + this.file = resolve(opts.from) + } + } + + if (pathAvailable && sourceMapAvailable) { + let map = new PreviousMap(this.css, opts) + if (map.text) { + this.map = map + let file = map.consumer().file + if (!this.file && file) this.file = this.mapResolve(file) + } + } + + if (!this.file) { + this.id = '' + } + if (this.map) this.map.file = this.from + } + + error(message, line, column, opts = {}) { + let endColumn, endLine, endOffset, offset, result + + if (line && typeof line === 'object') { + let start = line + let end = column + if (typeof start.offset === 'number') { + offset = start.offset + let pos = this.fromOffset(offset) + line = pos.line + column = pos.col + } else { + line = start.line + column = start.column + offset = this.fromLineAndColumn(line, column) + } + if (typeof end.offset === 'number') { + endOffset = end.offset + let pos = this.fromOffset(endOffset) + endLine = pos.line + endColumn = pos.col + } else { + endLine = end.line + endColumn = end.column + endOffset = this.fromLineAndColumn(end.line, end.column) + } + } else if (!column) { + offset = line + let pos = this.fromOffset(offset) + line = pos.line + column = pos.col + } else { + offset = this.fromLineAndColumn(line, column) + } + + let origin = this.origin(line, column, endLine, endColumn) + if (origin) { + result = new CssSyntaxError( + message, + origin.endLine === undefined + ? origin.line + : { column: origin.column, line: origin.line }, + origin.endLine === undefined + ? origin.column + : { column: origin.endColumn, line: origin.endLine }, + origin.source, + origin.file, + opts.plugin + ) + } else { + result = new CssSyntaxError( + message, + endLine === undefined ? line : { column, line }, + endLine === undefined ? column : { column: endColumn, line: endLine }, + this.css, + this.file, + opts.plugin + ) + } + + result.input = { + column, + endColumn, + endLine, + endOffset, + line, + offset, + source: this.css + } + if (this.file) { + if (pathToFileURL) { + result.input.url = pathToFileURL(this.file).toString() + } + result.input.file = this.file + } + + return result + } + + fromLineAndColumn(line, column) { + let lineToIndex = getLineToIndex(this) + let index = lineToIndex[line - 1] + return index + column - 1 + } + + fromOffset(offset) { + let lineToIndex = getLineToIndex(this) + let lastLine = lineToIndex[lineToIndex.length - 1] + + let min = 0 + if (offset >= lastLine) { + min = lineToIndex.length - 1 + } else { + let max = lineToIndex.length - 2 + let mid + while (min < max) { + mid = min + ((max - min) >> 1) + if (offset < lineToIndex[mid]) { + max = mid - 1 + } else if (offset >= lineToIndex[mid + 1]) { + min = mid + 1 + } else { + min = mid + break + } + } + } + return { + col: offset - lineToIndex[min] + 1, + line: min + 1 + } + } + + mapResolve(file) { + if (/^\w+:\/\//.test(file)) { + return file + } + return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file) + } + + origin(line, column, endLine, endColumn) { + if (!this.map) return false + let consumer = this.map.consumer() + + let from = consumer.originalPositionFor({ column: column - 1, line }) + if (!from.source) return false + + let to + if (typeof endLine === 'number') { + let toPosition = consumer.originalPositionFor({ + column: endColumn - 1, + line: endLine + }) + // The source map may not have a mapping that covers the end position + // (`originalPositionFor()` then returns `null` for `line`/`column` + // instead of omitting them). Treat that the same as not requesting + // an end position at all, so `endLine`/`endColumn` stay a consistent + // `undefined` pair instead of a mix of `null` and a bogus number. + if (toPosition.source) to = toPosition + } + + let fromUrl + + if (isAbsolute(from.source)) { + fromUrl = pathToFileURL(from.source) + } else { + fromUrl = new URL( + from.source, + this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile) + ) + } + + let result = { + column: from.column + 1, + endColumn: to && to.column + 1, + endLine: to && to.line, + line: from.line, + url: fromUrl.toString() + } + + if (fromUrl.protocol === 'file:') { + if (fileURLToPath) { + result.file = fileURLToPath(fromUrl) + } else { + /* c8 ignore next 2 */ + throw new Error(`file: protocol is not available in this PostCSS build`) + } + } + + let source = consumer.sourceContentFor(from.source) + if (source) result.source = source + + return result + } + + toJSON() { + let json = {} + for (let name of ['hasBOM', 'css', 'file', 'id']) { + if (this[name] != null) { + json[name] = this[name] + } + } + if (this.map) { + json.map = { ...this.map } + if (json.map.consumerCache) { + json.map.consumerCache = undefined + } + } + return json + } +} + +module.exports = Input +Input.default = Input + +if (terminalHighlight && terminalHighlight.registerInput) { + terminalHighlight.registerInput(Input) +} diff --git a/node_modules/postcss/lib/lazy-result.d.ts b/node_modules/postcss/lib/lazy-result.d.ts new file mode 100644 index 0000000..599a614 --- /dev/null +++ b/node_modules/postcss/lib/lazy-result.d.ts @@ -0,0 +1,189 @@ +import Document from './document.js' +import { SourceMap } from './postcss.js' +import Processor from './processor.js' +import Result, { Message, ResultOptions } from './result.js' +import Root from './root.js' +import Warning from './warning.js' + +declare namespace LazyResult { + export { LazyResult_ as default } +} + +/** + * A Promise proxy for the result of PostCSS transformations. + * + * A `LazyResult` instance is returned by `Processor#process`. + * + * ```js + * const lazy = postcss([autoprefixer]).process(css) + * ``` + */ +declare class LazyResult_ implements PromiseLike< + Result +> { + /** + * Processes input CSS through synchronous and asynchronous plugins + * and calls onRejected for each error thrown in any plugin. + * + * It implements standard Promise API. + * + * ```js + * postcss([autoprefixer]).process(css).then(result => { + * console.log(result.css) + * }).catch(error => { + * console.error(error) + * }) + * ``` + */ + catch: Promise>['catch'] + + /** + * Processes input CSS through synchronous and asynchronous plugins + * and calls onFinally on any error or when all plugins will finish work. + * + * It implements standard Promise API. + * + * ```js + * postcss([autoprefixer]).process(css).finally(() => { + * console.log('processing ended') + * }) + * ``` + */ + finally: Promise>['finally'] + + /** + * Processes input CSS through synchronous and asynchronous plugins + * and calls `onFulfilled` with a Result instance. If a plugin throws + * an error, the `onRejected` callback will be executed. + * + * It implements standard Promise API. + * + * ```js + * postcss([autoprefixer]).process(css, { from: cssPath }).then(result => { + * console.log(result.css) + * }) + * ``` + */ + then: Promise>['then'] + + /** + * An alias for the `css` property. Use it with syntaxes + * that generate non-CSS output. + * + * This property will only work with synchronous plugins. + * If the processor contains any asynchronous plugins + * it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get content(): string + + /** + * Processes input CSS through synchronous plugins, converts `Root` + * to a CSS string and returns `Result#css`. + * + * This property will only work with synchronous plugins. + * If the processor contains any asynchronous plugins + * it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get css(): string + + /** + * Processes input CSS through synchronous plugins + * and returns `Result#map`. + * + * This property will only work with synchronous plugins. + * If the processor contains any asynchronous plugins + * it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get map(): SourceMap + + /** + * Processes input CSS through synchronous plugins + * and returns `Result#messages`. + * + * This property will only work with synchronous plugins. If the processor + * contains any asynchronous plugins it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get messages(): Message[] + + /** + * Options from the `Processor#process` call. + */ + get opts(): ResultOptions + + /** + * Returns a `Processor` instance, which will be used + * for CSS transformations. + */ + get processor(): Processor + + /** + * Processes input CSS through synchronous plugins + * and returns `Result#root`. + * + * This property will only work with synchronous plugins. If the processor + * contains any asynchronous plugins it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get root(): RootNode + + /** + * Returns the default string description of an object. + * Required to implement the Promise interface. + */ + get [Symbol.toStringTag](): string + + /** + * @param processor Processor used for this transformation. + * @param css CSS to parse and transform. + * @param opts Options from the `Processor#process` or `Root#toResult`. + */ + constructor(processor: Processor, css: string, opts: ResultOptions) + + /** + * Run plugin in async way and return `Result`. + * + * @return Result with output content. + */ + async(): Promise> + + /** + * Run plugin in sync way and return `Result`. + * + * @return Result with output content. + */ + sync(): Result + + /** + * Alias for the `LazyResult#css` property. + * + * ```js + * lazy + '' === lazy.css + * ``` + * + * @return Output CSS. + */ + toString(): string + + /** + * Processes input CSS through synchronous plugins + * and calls `Result#warnings`. + * + * @return Warnings from plugins. + */ + warnings(): Warning[] +} + +declare class LazyResult< + RootNode = Document | Root +> extends LazyResult_ {} + +export = LazyResult diff --git a/node_modules/postcss/lib/lazy-result.js b/node_modules/postcss/lib/lazy-result.js new file mode 100644 index 0000000..be695b2 --- /dev/null +++ b/node_modules/postcss/lib/lazy-result.js @@ -0,0 +1,626 @@ +'use strict' + +let Container = require('./container') +let Document = require('./document') +let MapGenerator = require('./map-generator') +let parse = require('./parse') +let Result = require('./result') +let Root = require('./root') +let stringify = require('./stringify') +let { isClean, my } = require('./symbols') +let warnOnce = require('./warn-once') + +const TYPE_TO_CLASS_NAME = { + atrule: 'AtRule', + comment: 'Comment', + decl: 'Declaration', + document: 'Document', + root: 'Root', + rule: 'Rule' +} + +const PLUGIN_PROPS = { + AtRule: true, + AtRuleExit: true, + Comment: true, + CommentExit: true, + Declaration: true, + DeclarationExit: true, + Document: true, + DocumentExit: true, + Once: true, + OnceExit: true, + postcssPlugin: true, + prepare: true, + Root: true, + RootExit: true, + Rule: true, + RuleExit: true +} + +const NOT_VISITORS = { + Once: true, + postcssPlugin: true, + prepare: true +} + +const CHILDREN = 0 + +function isPromise(obj) { + return typeof obj === 'object' && typeof obj.then === 'function' +} + +function getEvents(node) { + let key = false + let type = TYPE_TO_CLASS_NAME[node.type] + if (node.type === 'decl') { + key = node.prop.toLowerCase() + } else if (node.type === 'atrule') { + key = node.name.toLowerCase() + } + + if (key && node.append) { + return [ + type, + type + '-' + key, + CHILDREN, + type + 'Exit', + type + 'Exit-' + key + ] + } else if (key) { + return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key] + } else if (node.append) { + return [type, CHILDREN, type + 'Exit'] + } else { + return [type, type + 'Exit'] + } +} + +function toStack(node) { + let events + if (node.type === 'document') { + events = ['Document', CHILDREN, 'DocumentExit'] + } else if (node.type === 'root') { + events = ['Root', CHILDREN, 'RootExit'] + } else { + events = getEvents(node) + } + + return { + eventIndex: 0, + events, + iterator: 0, + node, + visitorIndex: 0, + visitors: [] + } +} + +function cleanMarks(node) { + let stack = [node] + while (stack.length > 0) { + let next = stack.pop() + next[isClean] = false + if (next.nodes) { + for (let i of next.nodes) stack.push(i) + } + } + return node +} + +let postcss = {} + +class LazyResult { + get content() { + return this.stringify().content + } + + get css() { + return this.stringify().css + } + + get map() { + return this.stringify().map + } + + get messages() { + return this.sync().messages + } + + get opts() { + return this.result.opts + } + + get processor() { + return this.result.processor + } + + get root() { + return this.sync().root + } + + get [Symbol.toStringTag]() { + return 'LazyResult' + } + + constructor(processor, css, opts) { + this.stringified = false + this.processed = false + + let root + if ( + typeof css === 'object' && + css !== null && + (css.type === 'root' || css.type === 'document') + ) { + root = cleanMarks(css) + } else if (css instanceof LazyResult || css instanceof Result) { + root = cleanMarks(css.root) + if (css.map) { + if (typeof opts.map === 'undefined') opts.map = {} + if (!opts.map.inline) opts.map.inline = false + opts.map.prev = css.map + } + } else { + let parser = parse + if (opts.syntax) parser = opts.syntax.parse + if (opts.parser) parser = opts.parser + if (parser.parse) parser = parser.parse + + try { + root = parser(css, opts) + } catch (error) { + this.processed = true + this.error = error + } + + if (root && !root[my]) { + /* c8 ignore next 2 */ + Container.rebuild(root) + } + } + + this.result = new Result(processor, root, opts) + this.helpers = { ...postcss, postcss, result: this.result } + this.plugins = this.processor.plugins.map(plugin => { + if (typeof plugin === 'object' && plugin.prepare) { + return { ...plugin, ...plugin.prepare(this.result) } + } else { + return plugin + } + }) + } + + async() { + if (this.error) return Promise.reject(this.error) + if (this.processed) return Promise.resolve(this.result) + if (!this.processing) { + this.processing = this.runAsync() + } + return this.processing + } + + catch(onRejected) { + return this.async().catch(onRejected) + } + + finally(onFinally) { + return this.async().then(onFinally, onFinally) + } + + getAsyncError() { + throw new Error('Use process(css).then(cb) to work with async plugins') + } + + handleError(error, node) { + let plugin = this.result.lastPlugin + try { + if (node) node.addToError(error) + this.error = error + if (error.name === 'CssSyntaxError' && !error.plugin) { + error.plugin = plugin.postcssPlugin + error.setMessage() + } else if (plugin.postcssVersion) { + if (process.env.NODE_ENV !== 'production') { + let pluginName = plugin.postcssPlugin + let pluginVer = plugin.postcssVersion + let runtimeVer = this.result.processor.version + let a = pluginVer.split('.') + let b = runtimeVer.split('.') + + if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) { + // eslint-disable-next-line no-console + console.error( + 'Unknown error from PostCSS plugin. Your current PostCSS ' + + 'version is ' + + runtimeVer + + ', but ' + + pluginName + + ' uses ' + + pluginVer + + '. Perhaps this is the source of the error below.' + ) + } + } + } + } catch (err) { + /* c8 ignore next 3 */ + // eslint-disable-next-line no-console + if (console && console.error) console.error(err) + } + return error + } + + prepareVisitors() { + this.listeners = {} + let add = (plugin, type, cb) => { + if (!this.listeners[type]) this.listeners[type] = [] + this.listeners[type].push([plugin, cb]) + } + for (let plugin of this.plugins) { + if (typeof plugin === 'object') { + for (let event in plugin) { + if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) { + throw new Error( + `Unknown event ${event} in ${plugin.postcssPlugin}. ` + + `Try to update PostCSS (${this.processor.version} now).` + ) + } + if (!NOT_VISITORS[event]) { + if (typeof plugin[event] === 'object') { + for (let filter in plugin[event]) { + if (filter === '*') { + add(plugin, event, plugin[event][filter]) + } else { + add( + plugin, + event + '-' + filter.toLowerCase(), + plugin[event][filter] + ) + } + } + } else if (typeof plugin[event] === 'function') { + add(plugin, event, plugin[event]) + } + } + } + } + } + this.hasListener = Object.keys(this.listeners).length > 0 + } + + async runAsync() { + this.plugin = 0 + for (let i = 0; i < this.plugins.length; i++) { + let plugin = this.plugins[i] + let promise = this.runOnRoot(plugin) + if (isPromise(promise)) { + try { + await promise + } catch (error) { + throw this.handleError(error) + } + } + } + + this.prepareVisitors() + if (this.hasListener) { + let root = this.result.root + while (!root[isClean]) { + root[isClean] = true + let stack = [toStack(root)] + while (stack.length > 0) { + let promise = this.visitTick(stack) + if (isPromise(promise)) { + try { + await promise + } catch (e) { + let node = stack[stack.length - 1].node + throw this.handleError(e, node) + } + } + } + } + + if (this.listeners.OnceExit) { + for (let [plugin, visitor] of this.listeners.OnceExit) { + this.result.lastPlugin = plugin + try { + if (root.type === 'document') { + let roots = root.nodes.map(subRoot => + visitor(subRoot, this.helpers) + ) + + await Promise.all(roots) + } else { + await visitor(root, this.helpers) + } + } catch (e) { + throw this.handleError(e) + } + } + } + } + + this.processed = true + return this.stringify() + } + + runOnRoot(plugin) { + this.result.lastPlugin = plugin + try { + if (typeof plugin === 'object' && plugin.Once) { + if (this.result.root.type === 'document') { + let roots = this.result.root.nodes.map(root => + plugin.Once(root, this.helpers) + ) + + if (isPromise(roots[0])) { + return Promise.all(roots) + } + + return roots + } + + return plugin.Once(this.result.root, this.helpers) + } else if (typeof plugin === 'function') { + return plugin(this.result.root, this.result) + } + } catch (error) { + throw this.handleError(error) + } + } + + stringify() { + if (this.error) throw this.error + if (this.stringified) return this.result + this.stringified = true + + this.sync() + + let opts = this.result.opts + let str = stringify + if (opts.syntax) str = opts.syntax.stringify + if (opts.stringifier) str = opts.stringifier + if (str.stringify) str = str.stringify + + let rootSource = this.result.root.source + if ( + opts.map === undefined && + !(rootSource && rootSource.input && rootSource.input.map) + ) { + let result = '' + str(this.result.root, i => { + result += i + }) + this.result.css = result + return this.result + } + + let map = new MapGenerator(str, this.result.root, this.result.opts) + let data = map.generate() + this.result.css = data[0] + this.result.map = data[1] + + return this.result + } + + sync() { + if (this.error) throw this.error + if (this.processed) return this.result + this.processed = true + + if (this.processing) { + throw this.getAsyncError() + } + + for (let plugin of this.plugins) { + let promise = this.runOnRoot(plugin) + if (isPromise(promise)) { + throw this.getAsyncError() + } + } + + this.prepareVisitors() + if (this.hasListener) { + let root = this.result.root + while (!root[isClean]) { + root[isClean] = true + this.walkSync(root) + } + if (this.listeners.OnceExit) { + if (root.type === 'document') { + for (let subRoot of root.nodes) { + this.visitSync(this.listeners.OnceExit, subRoot) + } + } else { + this.visitSync(this.listeners.OnceExit, root) + } + } + } + + return this.result + } + + then(onFulfilled, onRejected) { + if (process.env.NODE_ENV !== 'production') { + if (!('from' in this.opts)) { + warnOnce( + 'Without `from` option PostCSS could generate wrong source map ' + + 'and will not find Browserslist config. Set it to CSS file path ' + + 'or to `undefined` to prevent this warning.' + ) + } + } + return this.async().then(onFulfilled, onRejected) + } + + toString() { + return this.css + } + + visitSync(visitors, node) { + for (let [plugin, visitor] of visitors) { + this.result.lastPlugin = plugin + let promise + try { + promise = visitor(node, this.helpers) + } catch (e) { + throw this.handleError(e, node.proxyOf) + } + if (node.type !== 'root' && node.type !== 'document' && !node.parent) { + return true + } + if (isPromise(promise)) { + throw this.getAsyncError() + } + } + } + + visitTick(stack) { + let visit = stack[stack.length - 1] + let { node, visitors } = visit + + if (node.type !== 'root' && node.type !== 'document' && !node.parent) { + stack.pop() + return + } + + if (visitors.length > 0 && visit.visitorIndex < visitors.length) { + let [plugin, visitor] = visitors[visit.visitorIndex] + visit.visitorIndex += 1 + if (visit.visitorIndex === visitors.length) { + visit.visitors = [] + visit.visitorIndex = 0 + } + this.result.lastPlugin = plugin + try { + return visitor(node.toProxy(), this.helpers) + } catch (e) { + throw this.handleError(e, node) + } + } + + if (visit.iterator !== 0) { + let iterator = visit.iterator + // Advance past the child we just finished visiting. Like + // `Container#each`, the index is incremented only after a child has + // been fully processed, so a node inserted right after the current + // child is not skipped by the `existIndex < index` adjustment in + // `Container#insertAfter()` (which would fire exit events too early). + if (visit.descending) { + visit.descending = false + node.indexes[iterator] += 1 + } + let child + while ((child = node.nodes[node.indexes[iterator]])) { + if (!child[isClean]) { + child[isClean] = true + visit.descending = true + stack.push(toStack(child)) + return + } + node.indexes[iterator] += 1 + } + visit.iterator = 0 + delete node.indexes[iterator] + } + + let events = visit.events + while (visit.eventIndex < events.length) { + let event = events[visit.eventIndex] + visit.eventIndex += 1 + if (event === CHILDREN) { + if (node.nodes && node.nodes.length) { + node[isClean] = true + visit.iterator = node.getIterator() + } + return + } else if (this.listeners[event]) { + visit.visitors = this.listeners[event] + return + } + } + stack.pop() + } + + walkSync(node) { + // An explicit stack like in async `visitTick()` to survive deeply + // nested trees. Unlike `visitTick()`, nodes are marked clean only + // on entering, so a node dirtied by its own visitors is revisited + // on the next pass. + node[isClean] = true + let stack = [{ eventIndex: 0, events: getEvents(node), iterator: 0, node }] + + while (stack.length > 0) { + let visit = stack[stack.length - 1] + let visitNode = visit.node + + if (visit.iterator !== 0) { + let iterator = visit.iterator + // Advance past the child we just finished visiting. Like + // `Container#each`, the index is incremented only after a child has + // been fully processed. Incrementing before (as this loop used to) + // makes a node inserted right after the current child get skipped by + // the `existIndex < index` adjustment in `Container#insertAfter()`, + // which fires exit events before those new siblings are visited. + if (visit.descending) { + visit.descending = false + visitNode.indexes[iterator] += 1 + } + let child + let descended = false + while ((child = visitNode.nodes[visitNode.indexes[iterator]])) { + if (!child[isClean]) { + child[isClean] = true + visit.descending = true + stack.push({ + eventIndex: 0, + events: getEvents(child), + iterator: 0, + node: child + }) + descended = true + break + } + visitNode.indexes[iterator] += 1 + } + if (descended) continue + visit.iterator = 0 + delete visitNode.indexes[iterator] + } + + if (visit.eventIndex < visit.events.length) { + let event = visit.events[visit.eventIndex] + visit.eventIndex += 1 + if (event === CHILDREN) { + if (visitNode.nodes && visitNode.nodes.length) { + visit.iterator = visitNode.getIterator() + } + } else { + let visitors = this.listeners[event] + if (visitors) { + if (this.visitSync(visitors, visitNode.toProxy())) stack.pop() + } + } + continue + } + + stack.pop() + } + } + + warnings() { + return this.sync().warnings() + } +} + +LazyResult.registerPostcss = dependant => { + postcss = dependant +} + +module.exports = LazyResult +LazyResult.default = LazyResult + +Root.registerLazyResult(LazyResult) +Document.registerLazyResult(LazyResult) diff --git a/node_modules/postcss/lib/list.d.ts b/node_modules/postcss/lib/list.d.ts new file mode 100644 index 0000000..119624e --- /dev/null +++ b/node_modules/postcss/lib/list.d.ts @@ -0,0 +1,60 @@ +declare namespace list { + type List = { + /** + * Safely splits comma-separated values (such as those for `transition-*` + * and `background` properties). + * + * ```js + * Once (root, { list }) { + * list.comma('black, linear-gradient(white, black)') + * //=> ['black', 'linear-gradient(white, black)'] + * } + * ``` + * + * @param str Comma-separated values. + * @return Split values. + */ + comma(str: string): string[] + + default: List + + /** + * Safely splits space-separated values (such as those for `background`, + * `border-radius`, and other shorthand properties). + * + * ```js + * Once (root, { list }) { + * list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)'] + * } + * ``` + * + * @param str Space-separated values. + * @return Split values. + */ + space(str: string): string[] + + /** + * Safely splits values. + * + * ```js + * Once (root, { list }) { + * list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)'] + * } + * ``` + * + * @param string separated values. + * @param separators array of separators. + * @param last boolean indicator. + * @return Split values. + */ + split( + string: string, + separators: readonly string[], + last: boolean + ): string[] + } +} + +declare let list: list.List + +export = list diff --git a/node_modules/postcss/lib/list.js b/node_modules/postcss/lib/list.js new file mode 100644 index 0000000..2a963a8 --- /dev/null +++ b/node_modules/postcss/lib/list.js @@ -0,0 +1,61 @@ +'use strict' + +let list = { + comma(string) { + return list.split(string, [','], true) + }, + + space(string) { + let spaces = [' ', '\n', '\t'] + return list.split(string, spaces) + }, + + split(string, separators, last) { + if (typeof string !== 'string') return [] + let array = [] + let current = '' + let split = false + + let func = 0 + let inQuote = false + let prevQuote = '' + let escape = false + + for (let letter of string) { + if (escape) { + escape = false + } else if (letter === '\\') { + escape = true + } else if (inQuote) { + if (letter === prevQuote) { + inQuote = false + } + } else if (letter === '"' || letter === "'") { + inQuote = true + prevQuote = letter + } else if (letter === '(') { + func += 1 + } else if (letter === ')') { + if (func > 0) func -= 1 + } else if (func === 0) { + if (separators.includes(letter)) split = true + } + + if (split) { + let value = current.trim() + if (last || value !== '') array.push(value) + current = '' + split = false + } else { + current += letter + } + } + + let value = current.trim() + if (last || value !== '') array.push(value) + return array + } +} + +module.exports = list +list.default = list diff --git a/node_modules/postcss/lib/map-generator.js b/node_modules/postcss/lib/map-generator.js new file mode 100644 index 0000000..13f883e --- /dev/null +++ b/node_modules/postcss/lib/map-generator.js @@ -0,0 +1,377 @@ +'use strict' + +let { dirname, relative, resolve, sep } = require('path') +let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') +let { pathToFileURL } = require('url') + +let Input = require('./input') + +let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) +let pathAvailable = Boolean(dirname && resolve && relative && sep) + +class MapGenerator { + constructor(stringify, root, opts, cssString) { + this.stringify = stringify + this.mapOpts = opts.map || {} + this.root = root + this.opts = opts + this.css = cssString + this.originalCSS = cssString + this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute + + this.memoizedFileURLs = new Map() + this.memoizedPaths = new Map() + this.memoizedURLs = new Map() + } + + addAnnotation() { + let content + + if (this.isInline()) { + content = + 'data:application/json;base64,' + this.toBase64(this.map.toString()) + } else if (typeof this.mapOpts.annotation === 'string') { + content = this.mapOpts.annotation + } else if (typeof this.mapOpts.annotation === 'function') { + content = this.mapOpts.annotation(this.opts.to, this.root) + } else { + content = this.outputFile() + '.map' + } + let eol = '\n' + if (this.css.includes('\r\n')) eol = '\r\n' + + this.css += eol + '/*# sourceMappingURL=' + content + ' */' + } + + applyPrevMaps() { + for (let prev of this.previous()) { + let from = this.toUrl(this.path(prev.file)) + let root = prev.root || dirname(prev.file) + let map + + if (this.mapOpts.sourcesContent === false) { + map = new SourceMapConsumer(prev.text) + if (map.sourcesContent) { + map.sourcesContent = null + } + } else { + map = prev.consumer() + } + + this.map.applySourceMap(map, from, this.toUrl(this.path(root))) + } + } + + clearAnnotation() { + if (this.mapOpts.annotation === false) return + + if (this.root) { + let node + for (let i = this.root.nodes.length - 1; i >= 0; i--) { + node = this.root.nodes[i] + if (node.type !== 'comment') continue + if (node.text.startsWith('# sourceMappingURL=')) { + this.root.removeChild(i) + } + } + } else if (this.css) { + let annotation = '/*# sourceMappingURL=' + let startIndex + while ((startIndex = this.css.lastIndexOf(annotation)) !== -1) { + let endIndex = this.css.indexOf('*/', startIndex + annotation.length) + if (endIndex === -1) break + while (startIndex > 0 && this.css[startIndex - 1] === '\n') { + startIndex-- + } + this.css = this.css.slice(0, startIndex) + this.css.slice(endIndex + 2) + } + } + } + + generate() { + this.clearAnnotation() + if (pathAvailable && sourceMapAvailable && this.isMap()) { + return this.generateMap() + } else { + let result = '' + this.stringify(this.root, i => { + result += i + }) + return [result] + } + } + + generateMap() { + if (this.root) { + this.generateString() + } else if (this.previous().length === 1) { + let prev = this.previous()[0].consumer() + prev.file = this.outputFile() + this.map = SourceMapGenerator.fromSourceMap(prev, { + ignoreInvalidMapping: true + }) + } else { + this.map = new SourceMapGenerator({ + file: this.outputFile(), + ignoreInvalidMapping: true + }) + this.map.addMapping({ + generated: { column: 0, line: 1 }, + original: { column: 0, line: 1 }, + source: this.opts.from + ? this.toUrl(this.path(this.opts.from)) + : '' + }) + } + + if (this.isSourcesContent()) this.setSourcesContent() + if (this.root && this.previous().length > 0) this.applyPrevMaps() + if (this.isAnnotation()) this.addAnnotation() + + if (this.isInline()) { + return [this.css] + } else { + return [this.css, this.map] + } + } + + generateString() { + this.css = '' + this.map = new SourceMapGenerator({ + file: this.outputFile(), + ignoreInvalidMapping: true + }) + + let line = 1 + let column = 1 + + let noSource = '' + let mapping = { + generated: { column: 0, line: 0 }, + original: { column: 0, line: 0 }, + source: '' + } + + let last, lines + this.stringify(this.root, (str, node, type) => { + this.css += str + + if (node && type !== 'end') { + mapping.generated.line = line + mapping.generated.column = column - 1 + if (node.source && node.source.start) { + mapping.source = this.sourcePath(node) + mapping.original.line = node.source.start.line + mapping.original.column = node.source.start.column - 1 + this.map.addMapping(mapping) + } else { + mapping.source = noSource + mapping.original.line = 1 + mapping.original.column = 0 + this.map.addMapping(mapping) + } + } + + lines = str.match(/\n/g) + if (lines) { + line += lines.length + last = str.lastIndexOf('\n') + column = str.length - last + } else { + column += str.length + } + + if (node && type !== 'start') { + let p = node.parent || { raws: {} } + let childless = + node.type === 'decl' || (node.type === 'atrule' && !node.nodes) + if (!childless || node !== p.last || p.raws.semicolon) { + if (node.source && node.source.end) { + mapping.source = this.sourcePath(node) + mapping.original.line = node.source.end.line + mapping.original.column = node.source.end.column - 1 + mapping.generated.line = line + mapping.generated.column = column - 2 + this.map.addMapping(mapping) + } else { + mapping.source = noSource + mapping.original.line = 1 + mapping.original.column = 0 + mapping.generated.line = line + mapping.generated.column = column - 1 + this.map.addMapping(mapping) + } + } + } + }) + } + + isAnnotation() { + if (this.isInline()) { + return true + } + if (typeof this.mapOpts.annotation !== 'undefined') { + return this.mapOpts.annotation + } + if (this.previous().length) { + return this.previous().some(i => i.annotation) + } + return true + } + + isInline() { + if (typeof this.mapOpts.inline !== 'undefined') { + return this.mapOpts.inline + } + + let annotation = this.mapOpts.annotation + if (typeof annotation !== 'undefined' && annotation !== true) { + return false + } + + if (this.previous().length) { + return this.previous().some(i => i.inline) + } + return true + } + + isMap() { + if (typeof this.opts.map !== 'undefined') { + return !!this.opts.map + } + return this.previous().length > 0 + } + + isSourcesContent() { + if (typeof this.mapOpts.sourcesContent !== 'undefined') { + return this.mapOpts.sourcesContent + } + if (this.previous().length) { + return this.previous().some(i => i.withContent()) + } + return true + } + + outputFile() { + if (this.opts.to) { + return this.path(this.opts.to) + } else if (this.opts.from) { + return this.path(this.opts.from) + } else { + return 'to.css' + } + } + + path(file) { + if (this.mapOpts.absolute) return file + if (file.charCodeAt(0) === 60 /* `<` */) return file + if (/^\w+:\/\//.test(file)) return file + let cached = this.memoizedPaths.get(file) + if (cached) return cached + + let from = this.opts.to ? dirname(this.opts.to) : '.' + + if (typeof this.mapOpts.annotation === 'string') { + from = dirname(resolve(from, this.mapOpts.annotation)) + } + + let path = relative(from, file) + this.memoizedPaths.set(file, path) + + return path + } + + previous() { + if (!this.previousMaps) { + this.previousMaps = [] + if (this.root) { + this.root.walk(node => { + if (node.source && node.source.input.map) { + let map = node.source.input.map + if (!this.previousMaps.includes(map)) { + this.previousMaps.push(map) + } + } + }) + } else { + let input = new Input(this.originalCSS, this.opts) + if (input.map) this.previousMaps.push(input.map) + } + } + + return this.previousMaps + } + + setSourcesContent() { + let already = {} + if (this.root) { + this.root.walk(node => { + if (node.source) { + let from = node.source.input.from + if (from && !already[from]) { + already[from] = true + let fromUrl = this.usesFileUrls + ? this.toFileUrl(from) + : this.toUrl(this.path(from)) + this.map.setSourceContent(fromUrl, node.source.input.css) + } + } + }) + } else if (this.css) { + let from = this.opts.from + ? this.toUrl(this.path(this.opts.from)) + : '' + this.map.setSourceContent(from, this.css) + } + } + + sourcePath(node) { + if (this.mapOpts.from) { + return this.toUrl(this.mapOpts.from) + } else if (this.usesFileUrls) { + return this.toFileUrl(node.source.input.from) + } else { + return this.toUrl(this.path(node.source.input.from)) + } + } + + toBase64(str) { + if (Buffer) { + return Buffer.from(str).toString('base64') + } else { + return window.btoa(unescape(encodeURIComponent(str))) + } + } + + toFileUrl(path) { + let cached = this.memoizedFileURLs.get(path) + if (cached) return cached + + if (pathToFileURL) { + let fileURL = pathToFileURL(path).toString() + this.memoizedFileURLs.set(path, fileURL) + + return fileURL + } else { + throw new Error( + '`map.absolute` option is not available in this PostCSS build' + ) + } + } + + toUrl(path) { + let cached = this.memoizedURLs.get(path) + if (cached) return cached + + if (sep === '\\') { + path = path.replace(/\\/g, '/') + } + + let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent) + this.memoizedURLs.set(path, url) + + return url + } +} + +module.exports = MapGenerator diff --git a/node_modules/postcss/lib/no-work-result.d.ts b/node_modules/postcss/lib/no-work-result.d.ts new file mode 100644 index 0000000..fa9d284 --- /dev/null +++ b/node_modules/postcss/lib/no-work-result.d.ts @@ -0,0 +1,45 @@ +import LazyResult from './lazy-result.js' +import { SourceMap } from './postcss.js' +import Processor from './processor.js' +import Result, { Message, ResultOptions } from './result.js' +import Root from './root.js' +import Warning from './warning.js' + +declare namespace NoWorkResult { + export { NoWorkResult_ as default } +} + +/** + * A Promise proxy for the result of PostCSS transformations. + * This lazy result instance doesn't parse css unless `NoWorkResult#root` or `Result#root` + * are accessed. See the example below for details. + * A `NoWork` instance is returned by `Processor#process` ONLY when no plugins defined. + * + * ```js + * const noWorkResult = postcss().process(css) // No plugins are defined. + * // CSS is not parsed + * let root = noWorkResult.root // now css is parsed because we accessed the root + * ``` + */ +declare class NoWorkResult_ implements LazyResult { + catch: Promise>['catch'] + finally: Promise>['finally'] + then: Promise>['then'] + get content(): string + get css(): string + get map(): SourceMap + get messages(): Message[] + get opts(): ResultOptions + get processor(): Processor + get root(): Root + get [Symbol.toStringTag](): string + constructor(processor: Processor, css: string, opts: ResultOptions) + async(): Promise> + sync(): Result + toString(): string + warnings(): Warning[] +} + +declare class NoWorkResult extends NoWorkResult_ {} + +export = NoWorkResult diff --git a/node_modules/postcss/lib/no-work-result.js b/node_modules/postcss/lib/no-work-result.js new file mode 100644 index 0000000..7ec1a74 --- /dev/null +++ b/node_modules/postcss/lib/no-work-result.js @@ -0,0 +1,137 @@ +'use strict' + +let MapGenerator = require('./map-generator') +let parse = require('./parse') +let Result = require('./result') +let stringify = require('./stringify') +let warnOnce = require('./warn-once') + +class NoWorkResult { + get content() { + return this.result.css + } + + get css() { + return this.result.css + } + + get map() { + return this.result.map + } + + get messages() { + return [] + } + + get opts() { + return this.result.opts + } + + get processor() { + return this.result.processor + } + + get root() { + if (this._root) { + return this._root + } + + let root + let parser = parse + + try { + root = parser(this._css, this._opts) + } catch (error) { + this.error = error + } + + if (this.error) { + throw this.error + } else { + this._root = root + return root + } + } + + get [Symbol.toStringTag]() { + return 'NoWorkResult' + } + + constructor(processor, css, opts) { + css = css.toString() + this.stringified = false + + this._processor = processor + this._css = css + this._opts = opts + this._map = undefined + + let str = stringify + this.result = new Result(this._processor, undefined, this._opts) + this.result.css = css + + let self = this + Object.defineProperty(this.result, 'root', { + get() { + return self.root + } + }) + + let map = new MapGenerator(str, undefined, this._opts, css) + if (map.isMap()) { + let [generatedCSS, generatedMap] = map.generate() + if (generatedCSS) { + this.result.css = generatedCSS + } + if (generatedMap) { + this.result.map = generatedMap + } + } else { + map.clearAnnotation() + this.result.css = map.css + } + } + + async() { + if (this.error) return Promise.reject(this.error) + return Promise.resolve(this.result) + } + + catch(onRejected) { + return this.async().catch(onRejected) + } + + finally(onFinally) { + return this.async().then(onFinally, onFinally) + } + + sync() { + if (this.error) throw this.error + return this.result + } + + then(onFulfilled, onRejected) { + if (process.env.NODE_ENV !== 'production') { + if (!('from' in this._opts)) { + warnOnce( + 'Without `from` option PostCSS could generate wrong source map ' + + 'and will not find Browserslist config. Set it to CSS file path ' + + 'or to `undefined` to prevent this warning.' + ) + } + } + + return this.async().then(onFulfilled, onRejected) + } + + toString() { + return this._css + } + + warnings() { + return [] + } +} + +module.exports = NoWorkResult +NoWorkResult.default = NoWorkResult diff --git a/node_modules/postcss/lib/node.d.ts b/node_modules/postcss/lib/node.d.ts new file mode 100644 index 0000000..e93ce5b --- /dev/null +++ b/node_modules/postcss/lib/node.d.ts @@ -0,0 +1,555 @@ +import AtRule = require('./at-rule.js') +import { AtRuleProps } from './at-rule.js' +import Comment, { CommentProps } from './comment.js' +import Container, { NewChild } from './container.js' +import CssSyntaxError from './css-syntax-error.js' +import Declaration, { DeclarationProps } from './declaration.js' +import Document from './document.js' +import Input from './input.js' +import { Stringifier, Syntax } from './postcss.js' +import Result from './result.js' +import Root from './root.js' +import Rule, { RuleProps } from './rule.js' +import Warning, { WarningOptions } from './warning.js' + +declare namespace Node { + export type ChildNode = AtRule.default | Comment | Declaration | Rule + + export type AnyNode = + | AtRule.default + | Comment + | Declaration + | Document + | Root + | Rule + + export type ChildProps = + | AtRuleProps + | CommentProps + | DeclarationProps + | RuleProps + + export interface Position { + /** + * Source column in file. It starts from 1. + */ + column: number + + /** + * Source line in file. It starts from 1. + */ + line: number + + /** + * Source offset in file. It starts from 0. + */ + offset: number + } + + export interface Range { + /** + * End position, exclusive. + */ + end: Position + + /** + * Start position, inclusive. + */ + start: Position + } + + /** + * Source represents an interface for the {@link Node.source} property. + */ + export interface Source { + /** + * The inclusive ending position for the source + * code of a node. + * + * However, `end.offset` of a non `Root` node is the exclusive position. + * See https://github.com/postcss/postcss/pull/1879 for details. + * + * ```js + * const root = postcss.parse('a { color: black }') + * const a = root.first + * const color = a.first + * + * // The offset of `Root` node is the inclusive position + * css.source.end // { line: 1, column: 19, offset: 18 } + * + * // The offset of non `Root` node is the exclusive position + * a.source.end // { line: 1, column: 18, offset: 18 } + * color.source.end // { line: 1, column: 16, offset: 16 } + * ``` + */ + end?: Position + + /** + * The source file from where a node has originated. + */ + input: Input + + /** + * The inclusive starting position for the source + * code of a node. + */ + start?: Position + } + + /** + * Interface represents an interface for an object received + * as parameter by Node class constructor. + */ + export interface NodeProps { + source?: Source + } + + export interface NodeErrorOptions { + /** + * An ending index inside a node's string that should be highlighted as + * source of error. + */ + endIndex?: number + /** + * An index inside a node's string that should be highlighted as source + * of error. + */ + index?: number + /** + * Plugin name that created this error. PostCSS will set it automatically. + */ + plugin?: string + /** + * A word inside a node's string, that should be highlighted as source + * of error. + */ + word?: string + } + + class Node extends Node_ {} + export { Node as default } +} + +/** + * It represents an abstract class that handles common + * methods for other CSS abstract syntax tree nodes. + * + * Any node that represents CSS selector or value should + * not extend the `Node` class. + */ +declare abstract class Node_ { + /** + * It represents parent of the current node. + * + * ```js + * root.nodes[0].parent === root //=> true + * ``` + */ + parent: Container | Document | undefined + + /** + * It represents unnecessary whitespace and characters present + * in the css source code. + * + * Information to generate byte-to-byte equal node string as it was + * in the origin input. + * + * The properties of the raws object are decided by parser, + * the default parser uses the following properties: + * + * * `before`: the space symbols before the node. It also stores `*` + * and `_` symbols before the declaration (IE hack). + * * `after`: the space symbols after the last child of the node + * to the end of the node. + * * `between`: the symbols between the property and value + * for declarations, selector and `{` for rules, or last parameter + * and `{` for at-rules. + * * `semicolon`: contains true if the last child has + * an (optional) semicolon. + * * `afterName`: the space between the at-rule name and its parameters. + * * `left`: the space symbols between `/*` and the comment’s text. + * * `right`: the space symbols between the comment’s text + * and */. + * - `important`: the content of the important statement, + * if it is not just `!important`. + * + * PostCSS filters out the comments inside selectors, declaration values + * and at-rule parameters but it stores the origin content in raws. + * + * ```js + * const root = postcss.parse('a {\n color:black\n}') + * root.first.first.raws //=> { before: '\n ', between: ':' } + * ``` + */ + raws: any + + /** + * It represents information related to origin of a node and is required + * for generating source maps. + * + * The nodes that are created manually using the public APIs + * provided by PostCSS will have `source` undefined and + * will be absent in the source map. + * + * For this reason, the plugin developer should consider + * duplicating nodes as the duplicate node will have the + * same source as the original node by default or assign + * source to a node created manually. + * + * ```js + * decl.source.input.from //=> '/home/ai/source.css' + * decl.source.start //=> { line: 10, column: 2 } + * decl.source.end //=> { line: 10, column: 12 } + * ``` + * + * ```js + * // Incorrect method, source not specified! + * const prefixed = postcss.decl({ + * prop: '-moz-' + decl.prop, + * value: decl.value + * }) + * + * // Correct method, source is inherited when duplicating. + * const prefixed = decl.clone({ + * prop: '-moz-' + decl.prop + * }) + * ``` + * + * ```js + * if (atrule.name === 'add-link') { + * const rule = postcss.rule({ + * selector: 'a', + * source: atrule.source + * }) + * + * atrule.parent.insertBefore(atrule, rule) + * } + * ``` + */ + source?: Node.Source + + /** + * It represents type of a node in + * an abstract syntax tree. + * + * A type of node helps in identification of a node + * and perform operation based on it's type. + * + * ```js + * const declaration = new Declaration({ + * prop: 'color', + * value: 'black' + * }) + * + * declaration.type //=> 'decl' + * ``` + */ + type: string + + constructor(defaults?: object) + + /** + * Insert new node after current node to current node’s parent. + * + * Just alias for `node.parent.insertAfter(node, add)`. + * + * ```js + * decl.after('color: black') + * ``` + * + * @param newNode New node. + * @return This node for methods chain. + */ + after( + newNode: Node | Node.ChildProps | readonly Node[] | string | undefined + ): this + + /** + * It assigns properties to an existing node instance. + * + * ```js + * decl.assign({ prop: 'word-wrap', value: 'break-word' }) + * ``` + * + * @param overrides New properties to override the node. + * + * @return `this` for method chaining. + */ + assign(overrides: object): this + + /** + * Insert new node before current node to current node’s parent. + * + * Just alias for `node.parent.insertBefore(node, add)`. + * + * ```js + * decl.before('content: ""') + * ``` + * + * @param newNode New node. + * @return This node for methods chain. + */ + before( + newNode: Node | Node.ChildProps | readonly Node[] | string | undefined + ): this + + /** + * Clear the code style properties for the node and its children. + * + * ```js + * node.raws.before //=> ' ' + * node.cleanRaws() + * node.raws.before //=> undefined + * ``` + * + * @param keepBetween Keep the `raws.between` symbols. + */ + cleanRaws(keepBetween?: boolean): void + + /** + * It creates clone of an existing node, which includes all the properties + * and their values, that includes `raws` but not `type`. + * + * ```js + * decl.raws.before //=> "\n " + * const cloned = decl.clone({ prop: '-moz-' + decl.prop }) + * cloned.raws.before //=> "\n " + * cloned.toString() //=> -moz-transform: scale(0) + * ``` + * + * @param overrides New properties to override in the clone. + * + * @return Duplicate of the node instance. + */ + clone(overrides?: object): this + + /** + * Shortcut to clone the node and insert the resulting cloned node + * after the current node. + * + * @param overrides New properties to override in the clone. + * @return New node. + */ + cloneAfter(overrides?: object): this + + /** + * Shortcut to clone the node and insert the resulting cloned node + * before the current node. + * + * ```js + * decl.cloneBefore({ prop: '-moz-' + decl.prop }) + * ``` + * + * @param overrides Mew properties to override in the clone. + * + * @return New node + */ + cloneBefore(overrides?: object): this + + /** + * It creates an instance of the class `CssSyntaxError` and parameters passed + * to this method are assigned to the error instance. + * + * The error instance will have description for the + * error, original position of the node in the + * source, showing line and column number. + * + * If any previous map is present, it would be used + * to get original position of the source. + * + * The Previous Map here is referred to the source map + * generated by previous compilation, example: Less, + * Stylus and Sass. + * + * This method returns the error instance instead of + * throwing it. + * + * ```js + * if (!variables[name]) { + * throw decl.error(`Unknown variable ${name}`, { word: name }) + * // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black + * // color: $black + * // a + * // ^ + * // background: white + * } + * ``` + * + * @param message Description for the error instance. + * @param options Options for the error instance. + * + * @return Error instance is returned. + */ + error(message: string, options?: Node.NodeErrorOptions): CssSyntaxError + + /** + * Returns the next child of the node’s parent. + * Returns `undefined` if the current node is the last child. + * + * ```js + * if (comment.text === 'delete next') { + * const next = comment.next() + * if (next) { + * next.remove() + * } + * } + * ``` + * + * @return Next node. + */ + next(): Node.ChildNode | undefined + + /** + * Get the position for a word or an index inside the node. + * + * @param opts Options. + * @return Position. + */ + positionBy(opts?: Pick): Node.Position + + /** + * Convert string index to line/column. + * + * @param index The symbol number in the node’s string. + * @return Symbol position in file. + */ + positionInside(index: number): Node.Position + + /** + * Returns the previous child of the node’s parent. + * Returns `undefined` if the current node is the first child. + * + * ```js + * const annotation = decl.prev() + * if (annotation.type === 'comment') { + * readAnnotation(annotation.text) + * } + * ``` + * + * @return Previous node. + */ + prev(): Node.ChildNode | undefined + + /** + * Get the range for a word or start and end index inside the node. + * The start index is inclusive; the end index is exclusive. + * + * @param opts Options. + * @return Range. + */ + rangeBy( + opts?: Pick + ): Node.Range + + /** + * Returns a `raws` value. If the node is missing + * the code style property (because the node was manually built or cloned), + * PostCSS will try to autodetect the code style property by looking + * at other nodes in the tree. + * + * ```js + * const root = postcss.parse('a { background: white }') + * root.nodes[0].append({ prop: 'color', value: 'black' }) + * root.nodes[0].nodes[1].raws.before //=> undefined + * root.nodes[0].nodes[1].raw('before') //=> ' ' + * ``` + * + * @param prop Name of code style property. + * @param defaultType Name of default value, it can be missed + * if the value is the same as prop. + * @return {string} Code style value. + */ + raw(prop: string, defaultType?: string): string + + /** + * It removes the node from its parent and deletes its parent property. + * + * ```js + * if (decl.prop.match(/^-webkit-/)) { + * decl.remove() + * } + * ``` + * + * @return `this` for method chaining. + */ + remove(): this + + /** + * Inserts node(s) before the current node and removes the current node. + * + * ```js + * AtRule: { + * mixin: atrule => { + * atrule.replaceWith(mixinRules[atrule.params]) + * } + * } + * ``` + * + * @param nodes Mode(s) to replace current one. + * @return Current node to methods chain. + */ + replaceWith(...nodes: NewChild[]): this + + /** + * Finds the Root instance of the node’s tree. + * + * ```js + * root.nodes[0].nodes[0].root() === root + * ``` + * + * @return Root parent. + */ + root(): Root + + /** + * Fix circular links on `JSON.stringify()`. + * + * @return Cleaned object. + */ + toJSON(): object + + /** + * It compiles the node to browser readable cascading style sheets string + * depending on it's type. + * + * ```js + * new Rule({ selector: 'a' }).toString() //=> "a {}" + * ``` + * + * @param stringifier A syntax to use in string generation. + * @return CSS string of this node. + */ + toString(stringifier?: Stringifier | Syntax): string + + /** + * It is a wrapper for {@link Result#warn}, providing convenient + * way of generating warnings. + * + * ```js + * Declaration: { + * bad: (decl, { result }) => { + * decl.warn(result, 'Deprecated property: bad') + * } + * } + * ``` + * + * @param result The `Result` instance that will receive the warning. + * @param message Description for the warning. + * @param options Options for the warning. + * + * @return `Warning` instance is returned + */ + warn(result: Result, message: string, options?: WarningOptions): Warning + + /** + * If this node isn't already dirty, marks it and its ancestors as such. This + * indicates to the LazyResult processor that the {@link Root} has been + * modified by the current plugin and may need to be processed again by other + * plugins. + */ + protected markDirty(): void +} + +declare class Node extends Node_ {} + +export = Node diff --git a/node_modules/postcss/lib/node.js b/node_modules/postcss/lib/node.js new file mode 100644 index 0000000..a298d36 --- /dev/null +++ b/node_modules/postcss/lib/node.js @@ -0,0 +1,494 @@ +'use strict' + +let CssSyntaxError = require('./css-syntax-error') +let Stringifier = require('./stringifier') +let stringify = require('./stringify') +let { isClean, my } = require('./symbols') + +function cloneNode(obj, parent) { + let cloned = new obj.constructor() + // An explicit stack instead of recursive calls to survive deeply + // nested trees. Each entry is [source, its clone, clone's parent]. + let stack = [[obj, cloned, parent]] + + while (stack.length > 0) { + let [source, target, targetParent] = stack.pop() + for (let i in source) { + if (!Object.prototype.hasOwnProperty.call(source, i)) { + /* c8 ignore next 2 */ + continue + } + if (i === 'proxyCache') continue + let value = source[i] + let type = typeof value + + if (i === 'parent' && type === 'object') { + if (targetParent) target[i] = targetParent + } else if (i === 'source') { + target[i] = value + } else if (Array.isArray(value)) { + let children = [] + target[i] = children + for (let j of value) { + let childClone = new j.constructor() + children.push(childClone) + stack.push([j, childClone, target]) + } + } else { + if (type === 'object' && value !== null) { + let valueClone = new value.constructor() + stack.push([value, valueClone, undefined]) + value = valueClone + } + target[i] = value + } + } + } + + return cloned +} + +function sourceOffset(inputCSS, position) { + // Not all custom syntaxes support `offset` in `source.start` and `source.end` + if (position && typeof position.offset !== 'undefined') { + return position.offset + } + + let column = 1 + let line = 1 + let offset = 0 + + for (let i = 0; i < inputCSS.length; i++) { + if (line === position.line && column === position.column) { + offset = i + break + } + + if (inputCSS[i] === '\n') { + column = 1 + line += 1 + } else { + column += 1 + } + } + + return offset +} + +class Node { + get proxyOf() { + return this + } + + constructor(defaults = {}) { + this.raws = {} + this[isClean] = false + this[my] = true + + for (let name of Object.keys(defaults)) { + if (name === '__proto__') continue + if (name === 'nodes') { + this.nodes = [] + for (let node of defaults[name]) { + // Clone only nodes that already belong to another tree, so passing a + // freshly created (parent-less) node adopts that instance instead of + // a copy and keeps the caller's reference usable. See #1987. + if (typeof node.clone === 'function' && node.parent) { + this.append(node.clone()) + } else { + this.append(node) + } + } + } else { + this[name] = defaults[name] + } + } + } + + addToError(error) { + error.postcssNode = this + if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) { + let s = this.source + error.stack = error.stack.replace( + /\n\s{4}at /, + `$&${s.input.from}:${s.start.line}:${s.start.column}$&` + ) + } + return error + } + + after(add) { + this.parent.insertAfter(this, add) + return this + } + + assign(overrides = {}) { + for (let name in overrides) { + this[name] = overrides[name] + } + return this + } + + before(add) { + this.parent.insertBefore(this, add) + return this + } + + cleanRaws(keepBetween) { + delete this.raws.before + delete this.raws.after + if (!keepBetween) delete this.raws.between + } + + clone(overrides = {}) { + let cloned = cloneNode(this) + for (let name in overrides) { + cloned[name] = overrides[name] + } + return cloned + } + + cloneAfter(overrides = {}) { + let cloned = this.clone(overrides) + this.parent.insertAfter(this, cloned) + return cloned + } + + cloneBefore(overrides = {}) { + let cloned = this.clone(overrides) + this.parent.insertBefore(this, cloned) + return cloned + } + + error(message, opts = {}) { + if (this.source) { + let { end, start } = this.rangeBy(opts) + return this.source.input.error( + message, + { column: start.column, line: start.line }, + { column: end.column, line: end.line }, + opts + ) + } + return new CssSyntaxError(message) + } + + getProxyProcessor() { + return { + get(node, prop) { + if (prop === 'proxyOf') { + return node + } else if (prop === 'root') { + return () => node.root().toProxy() + } else { + return node[prop] + } + }, + + set(node, prop, value) { + if (node[prop] === value) return true + node[prop] = value + if ( + prop === 'prop' || + prop === 'value' || + prop === 'name' || + prop === 'params' || + prop === 'important' || + /* c8 ignore next */ + prop === 'text' + ) { + node.markDirty() + } + return true + } + } + } + + /* c8 ignore next 3 */ + markClean() { + this[isClean] = true + } + + markDirty() { + if (this[isClean]) { + this[isClean] = false + let next = this + while ((next = next.parent)) { + next[isClean] = false + } + } + } + + next() { + if (!this.parent) return undefined + let index = this.parent.index(this) + return this.parent.nodes[index + 1] + } + + positionBy(opts = {}) { + let inputString = + 'document' in this.source.input + ? this.source.input.document + : this.source.input.css + let pos = { + column: this.source.start.column, + line: this.source.start.line, + offset: sourceOffset(inputString, this.source.start) + } + if (opts.index) { + pos = this.positionInside(opts.index) + } else if (opts.word) { + let stringRepresentation = inputString.slice( + sourceOffset(inputString, this.source.start), + sourceOffset(inputString, this.source.end) + ) + let index = stringRepresentation.indexOf(opts.word) + if (index !== -1) pos = this.positionInside(index) + } + return pos + } + + positionInside(index) { + let column = this.source.start.column + let line = this.source.start.line + let inputString = + 'document' in this.source.input + ? this.source.input.document + : this.source.input.css + let offset = sourceOffset(inputString, this.source.start) + let end = offset + index + + for (let i = offset; i < end; i++) { + if (inputString[i] === '\n') { + column = 1 + line += 1 + } else { + column += 1 + } + } + + return { column, line, offset: end } + } + + prev() { + if (!this.parent) return undefined + let index = this.parent.index(this) + return this.parent.nodes[index - 1] + } + + rangeBy(opts = {}) { + let inputString = + 'document' in this.source.input + ? this.source.input.document + : this.source.input.css + let start = { + column: this.source.start.column, + line: this.source.start.line, + offset: sourceOffset(inputString, this.source.start) + } + let end = this.source.end + ? { + column: this.source.end.column + 1, + line: this.source.end.line, + offset: + typeof this.source.end.offset === 'number' + ? // `source.end.offset` is exclusive, so we don't need to add 1 + this.source.end.offset + : // Since line/column in this.source.end is inclusive, + // the `sourceOffset(... , this.source.end)` returns an inclusive offset. + // So, we add 1 to convert it to exclusive. + sourceOffset(inputString, this.source.end) + 1 + } + : { + column: start.column + 1, + line: start.line, + offset: start.offset + 1 + } + + if (opts.word) { + let stringRepresentation = inputString.slice( + sourceOffset(inputString, this.source.start), + sourceOffset(inputString, this.source.end) + ) + let index = stringRepresentation.indexOf(opts.word) + if (index !== -1) { + start = this.positionInside(index) + end = this.positionInside(index + opts.word.length) + } + } else { + if (opts.start) { + start = { + column: opts.start.column, + line: opts.start.line, + offset: sourceOffset(inputString, opts.start) + } + } else if (typeof opts.index === 'number') { + start = this.positionInside(opts.index) + } + + if (opts.end) { + end = { + column: opts.end.column, + line: opts.end.line, + offset: sourceOffset(inputString, opts.end) + } + } else if (typeof opts.endIndex === 'number') { + end = this.positionInside(opts.endIndex) + } else if (typeof opts.index === 'number') { + end = this.positionInside(opts.index + 1) + } + } + + if ( + end.line < start.line || + (end.line === start.line && end.column <= start.column) + ) { + end = { + column: start.column + 1, + line: start.line, + offset: start.offset + 1 + } + } + + return { end, start } + } + + raw(prop, defaultType) { + let str = new Stringifier() + return str.raw(this, prop, defaultType) + } + + remove() { + if (this.parent) { + this.parent.removeChild(this) + } + this.parent = undefined + return this + } + + replaceWith(...nodes) { + if (this.parent) { + let bookmark = this + let foundSelf = false + for (let node of nodes) { + if (node === this) { + foundSelf = true + } else if (foundSelf) { + this.parent.insertAfter(bookmark, node) + bookmark = node + } else { + this.parent.insertBefore(bookmark, node) + } + } + + if (!foundSelf) { + this.remove() + } + } + + return this + } + + root() { + let result = this + while (result.parent && result.parent.type !== 'document') { + result = result.parent + } + return result + } + + toJSON(_, inputs) { + let emitInputs = inputs == null + inputs = inputs || new Map() + + // A worklist instead of recursive `toJSON()` calls to survive deeply + // nested trees. Each entry converts one node and writes the result + // into the already converted parent by [holder, key]. + let holderOfRoot = [] + let queue = [[this, holderOfRoot, 0]] + + for (let step = 0; step < queue.length; step++) { + let [node, holder, key] = queue[step] + let fixed = {} + holder[key] = fixed + + for (let name in node) { + if (!Object.prototype.hasOwnProperty.call(node, name)) { + /* c8 ignore next 2 */ + continue + } + if (name === 'parent' || name === 'proxyCache') continue + let value = node[name] + + if (Array.isArray(value)) { + let fixedArray = [] + fixed[name] = fixedArray + for (let i = 0; i < value.length; i++) { + let item = value[i] + if (typeof item === 'object' && item.toJSON) { + if (item.toJSON === Node.prototype.toJSON) { + queue.push([item, fixedArray, i]) + } else { + fixedArray[i] = item.toJSON(null, inputs) + } + } else { + fixedArray[i] = item + } + } + } else if (typeof value === 'object' && value.toJSON) { + if (value.toJSON === Node.prototype.toJSON) { + queue.push([value, fixed, name]) + } else { + fixed[name] = value.toJSON(null, inputs) + } + } else if (name === 'source') { + if (value == null) continue + let inputId = inputs.get(value.input) + if (inputId == null) { + inputId = inputs.size + inputs.set(value.input, inputId) + } + fixed[name] = { + end: value.end, + inputId, + start: value.start + } + } else { + fixed[name] = value + } + } + } + + let fixed = holderOfRoot[0] + if (emitInputs) { + fixed.inputs = [...inputs.keys()].map(input => input.toJSON()) + } + + return fixed + } + + toProxy() { + if (!this.proxyCache) { + this.proxyCache = new Proxy(this, this.getProxyProcessor()) + } + return this.proxyCache + } + + toString(stringifier = stringify) { + if (stringifier.stringify) stringifier = stringifier.stringify + let result = '' + stringifier(this, i => { + result += i + }) + return result + } + + warn(result, text, opts = {}) { + let data = { node: this } + for (let i in opts) data[i] = opts[i] + return result.warn(text, data) + } +} + +module.exports = Node +Node.default = Node diff --git a/node_modules/postcss/lib/parse.d.ts b/node_modules/postcss/lib/parse.d.ts new file mode 100644 index 0000000..ffe35b4 --- /dev/null +++ b/node_modules/postcss/lib/parse.d.ts @@ -0,0 +1,9 @@ +import { Parser } from './postcss.js' + +interface Parse extends Parser { + default: Parse +} + +declare let parse: Parse + +export = parse diff --git a/node_modules/postcss/lib/parse.js b/node_modules/postcss/lib/parse.js new file mode 100644 index 0000000..00a1037 --- /dev/null +++ b/node_modules/postcss/lib/parse.js @@ -0,0 +1,42 @@ +'use strict' + +let Container = require('./container') +let Input = require('./input') +let Parser = require('./parser') + +function parse(css, opts) { + let input = new Input(css, opts) + let parser = new Parser(input) + try { + parser.parse() + } catch (e) { + if (process.env.NODE_ENV !== 'production') { + if (e.name === 'CssSyntaxError' && opts && opts.from) { + if (/\.scss$/i.test(opts.from)) { + e.message += + '\nYou tried to parse SCSS with ' + + 'the standard CSS parser; ' + + 'try again with the postcss-scss parser' + } else if (/\.sass/i.test(opts.from)) { + e.message += + '\nYou tried to parse Sass with ' + + 'the standard CSS parser; ' + + 'try again with the postcss-sass parser' + } else if (/\.less$/i.test(opts.from)) { + e.message += + '\nYou tried to parse Less with ' + + 'the standard CSS parser; ' + + 'try again with the postcss-less parser' + } + } + } + throw e + } + + return parser.root +} + +module.exports = parse +parse.default = parse + +Container.registerParse(parse) diff --git a/node_modules/postcss/lib/parser.js b/node_modules/postcss/lib/parser.js new file mode 100644 index 0000000..f549f56 --- /dev/null +++ b/node_modules/postcss/lib/parser.js @@ -0,0 +1,621 @@ +'use strict' + +let AtRule = require('./at-rule') +let Comment = require('./comment') +let Declaration = require('./declaration') +let Root = require('./root') +let Rule = require('./rule') +let tokenizer = require('./tokenize') + +const SAFE_COMMENT_NEIGHBOR = { + empty: true, + space: true +} + +function findLastWithPosition(tokens) { + for (let i = tokens.length - 1; i >= 0; i--) { + let token = tokens[i] + let pos = token[3] || token[2] + if (pos) return pos + } +} + +function tokensToString(tokens, from, to) { + let result = '' + for (let i = from; i < to; i++) result += tokens[i][1] + return result +} + +class Parser { + constructor(input) { + this.input = input + + this.root = new Root() + this.current = this.root + this.spaces = '' + this.semicolon = false + + this.createTokenizer() + this.root.source = { input, start: { column: 1, line: 1, offset: 0 } } + } + + atrule(token) { + let node = new AtRule() + node.name = token[1].slice(1) + if (node.name === '') { + this.unnamedAtrule(node, token) + } + this.init(node, token[2]) + + let type + let prev + let shift + let last = false + let open = false + let params = [] + let brackets = [] + + while (!this.tokenizer.endOfFile()) { + token = this.tokenizer.nextToken() + type = token[0] + + if (type === '(' || type === '[') { + brackets.push(type === '(' ? ')' : ']') + } else if (type === '{' && brackets.length > 0) { + brackets.push('}') + } else if (type === brackets[brackets.length - 1]) { + brackets.pop() + } + + if (brackets.length === 0) { + if (type === ';') { + node.source.end = this.getPosition(token[2]) + node.source.end.offset++ + this.semicolon = true + break + } else if (type === '{') { + open = true + break + } else if (type === '}') { + if (params.length > 0) { + shift = params.length - 1 + prev = params[shift] + while (prev && prev[0] === 'space') { + prev = params[--shift] + } + if (prev) { + node.source.end = this.getPosition(prev[3] || prev[2]) + node.source.end.offset++ + } + } + this.end(token) + break + } else { + params.push(token) + } + } else { + params.push(token) + } + + if (this.tokenizer.endOfFile()) { + last = true + break + } + } + + node.raws.between = this.spacesAndCommentsFromEnd(params) + if (params.length) { + node.raws.afterName = this.spacesAndCommentsFromStart(params) + this.raw(node, 'params', params) + if (last) { + token = params[params.length - 1] + node.source.end = this.getPosition(token[3] || token[2]) + node.source.end.offset++ + this.spaces = node.raws.between + node.raws.between = '' + } + } else { + node.raws.afterName = '' + node.params = '' + } + + if (open) { + node.nodes = [] + this.current = node + } + } + + checkMissedSemicolon(tokens) { + let colon = this.colon(tokens) + if (colon === false) return + + let founded = 0 + let token + for (let j = colon - 1; j >= 0; j--) { + token = tokens[j] + if (token[0] !== 'space') { + founded += 1 + if (founded === 2) break + } + } + // If the token is a word, e.g. `!important`, `red` or any other valid + // property's value. Then we need to return the colon after that word + // token. [3] is the "end" colon of that word. And because we need it + // after that one we do +1 to get the next one. + throw this.input.error( + 'Missed semicolon', + token[0] === 'word' ? token[3] + 1 : token[2] + ) + } + + colon(tokens) { + let brackets = 0 + let prev, token, type + for (let [i, element] of tokens.entries()) { + token = element + type = token[0] + + if (type === '(') { + brackets += 1 + } + if (type === ')') { + brackets -= 1 + } + if (brackets === 0 && type === ':') { + if (!prev) { + this.doubleColon(token) + } else if (prev[0] === 'word' && prev[1] === 'progid') { + continue + } else { + return i + } + } + + prev = token + } + return false + } + + comment(token) { + let node = new Comment() + this.init(node, token[2]) + node.source.end = this.getPosition(token[3] || token[2]) + node.source.end.offset++ + + let text = token[1].slice(2, -2) + if (!text.trim()) { + node.text = '' + node.raws.left = text + node.raws.right = '' + } else { + let match = text.match(/^(\s*)([^]*\S)(\s*)$/) + node.text = match[2] + node.raws.left = match[1] + node.raws.right = match[3] + } + } + + createTokenizer() { + this.tokenizer = tokenizer(this.input) + } + + decl(tokens, customProperty) { + let node = new Declaration() + this.init(node, tokens[0][2]) + + let last = tokens[tokens.length - 1] + if (last[0] === ';') { + this.semicolon = true + tokens.pop() + } + + node.source.end = this.getPosition( + last[3] || last[2] || findLastWithPosition(tokens) + ) + node.source.end.offset++ + + let start = 0 + while (tokens[start][0] !== 'word') { + if (start === tokens.length - 1) this.unknownWord([tokens[start]]) + start++ + } + node.raws.before += tokensToString(tokens, 0, start) + node.source.start = this.getPosition(tokens[start][2]) + + let propStart = start + while (start < tokens.length) { + let type = tokens[start][0] + if (type === ':' || type === 'space' || type === 'comment') { + break + } + start++ + } + node.prop = tokensToString(tokens, propStart, start) + + let betweenStart = start + let token + while (start < tokens.length) { + token = tokens[start] + start++ + if (token[0] === ':') break + if (token[0] === 'word' && /\w/.test(token[1])) { + this.unknownWord([token]) + } + } + node.raws.between = tokensToString(tokens, betweenStart, start) + + if (node.prop[0] === '_' || node.prop[0] === '*') { + node.raws.before += node.prop[0] + node.prop = node.prop.slice(1) + } + + let firstSpacesStart = start + while (start < tokens.length) { + let next = tokens[start][0] + if (next !== 'space' && next !== 'comment') break + start++ + } + let firstSpaces = tokens.slice(firstSpacesStart, start) + + tokens = tokens.slice(start) + + this.precheckMissedSemicolon(tokens) + + for (let i = tokens.length - 1; i >= 0; i--) { + token = tokens[i] + if (token[1].toLowerCase() === '!important') { + node.important = true + let string = this.stringFrom(tokens, i) + string = this.spacesFromEnd(tokens) + string + if (string !== ' !important') node.raws.important = string + break + } else if (token[1].toLowerCase() === 'important') { + let cache = tokens.slice(0) + let str = '' + for (let j = i; j > 0; j--) { + let type = cache[j][0] + if (str.trim().startsWith('!') && type !== 'space') { + break + } + str = cache.pop()[1] + str + } + if (str.trim().startsWith('!')) { + node.important = true + node.raws.important = str + tokens = cache + } + } + + if (token[0] !== 'space' && token[0] !== 'comment') { + break + } + } + + let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment') + + if (hasWord) { + node.raws.between += firstSpaces.map(i => i[1]).join('') + firstSpaces = [] + } + this.raw(node, 'value', firstSpaces.concat(tokens), customProperty) + + if (node.value.includes(':') && !customProperty) { + this.checkMissedSemicolon(tokens) + } + } + + doubleColon(token) { + throw this.input.error( + 'Double colon', + { offset: token[2] }, + { offset: token[2] + token[1].length } + ) + } + + emptyRule(token) { + let node = new Rule() + this.init(node, token[2]) + node.selector = '' + node.raws.between = '' + this.current = node + } + + end(token) { + if (this.current.nodes && this.current.nodes.length) { + this.current.raws.semicolon = this.semicolon + } + this.semicolon = false + + this.current.raws.after = (this.current.raws.after || '') + this.spaces + this.spaces = '' + + if (this.current.parent) { + this.current.source.end = this.getPosition(token[2]) + this.current.source.end.offset++ + this.current = this.current.parent + } else { + this.unexpectedClose(token) + } + } + + endFile() { + if (this.current.parent) this.unclosedBlock() + if (this.current.nodes && this.current.nodes.length) { + this.current.raws.semicolon = this.semicolon + } + this.current.raws.after = (this.current.raws.after || '') + this.spaces + this.root.source.end = this.getPosition(this.tokenizer.position()) + } + + freeSemicolon(token) { + this.spaces += token[1] + if (this.current.nodes) { + let prev = this.current.nodes[this.current.nodes.length - 1] + if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) { + prev.raws.ownSemicolon = this.spaces + this.spaces = '' + // `ownSemicolon` also holds the spaces before the semicolon, but + // the position above is the semicolon itself, so the node ends + // right after it. + prev.source.end = this.getPosition(token[2]) + prev.source.end.offset++ + } + } + } + + // Helpers + + getPosition(offset) { + let pos = this.input.fromOffset(offset) + return { + column: pos.col, + line: pos.line, + offset + } + } + + init(node, offset) { + this.current.push(node) + node.source = { + input: this.input, + start: this.getPosition(offset) + } + node.raws.before = this.spaces + this.spaces = '' + if (node.type !== 'comment') this.semicolon = false + } + + other(start) { + let end = false + let type = null + let colon = false + let bracket = null + let brackets = [] + let customProperty = start[1].startsWith('--') + + let tokens = [] + let token = start + while (token) { + type = token[0] + tokens.push(token) + + if (type === '(' || type === '[') { + if (!bracket) bracket = token + brackets.push(type === '(' ? ')' : ']') + } else if (customProperty && colon && type === '{') { + if (!bracket) bracket = token + brackets.push('}') + } else if (brackets.length === 0) { + if (type === ';') { + if (colon) { + this.decl(tokens, customProperty) + return + } else { + break + } + } else if (type === '{') { + this.rule(tokens) + return + } else if (type === '}') { + this.tokenizer.back(tokens.pop()) + end = true + break + } else if (type === ':') { + colon = true + } + } else if (type === brackets[brackets.length - 1]) { + brackets.pop() + if (brackets.length === 0) bracket = null + } + + token = this.tokenizer.nextToken() + } + + if (this.tokenizer.endOfFile()) end = true + if (brackets.length > 0) this.unclosedBracket(bracket) + + if (end && colon) { + if (!customProperty) { + while (tokens.length) { + token = tokens[tokens.length - 1][0] + if (token !== 'space' && token !== 'comment') break + this.tokenizer.back(tokens.pop()) + } + } + this.decl(tokens, customProperty) + } else { + this.unknownWord(tokens) + } + } + + parse() { + let token + while (!this.tokenizer.endOfFile()) { + token = this.tokenizer.nextToken() + + switch (token[0]) { + case 'space': + this.spaces += token[1] + break + + case ';': + this.freeSemicolon(token) + break + + case '}': + this.end(token) + break + + case 'comment': + this.comment(token) + break + + case 'at-word': + this.atrule(token) + break + + case '{': + this.emptyRule(token) + break + + default: + this.other(token) + break + } + } + this.endFile() + } + + precheckMissedSemicolon(/* tokens */) { + // Hook for Safe Parser + } + + raw(node, prop, tokens, customProperty) { + let token, type + let length = tokens.length + let value = '' + let clean = true + let next, prev + + for (let i = 0; i < length; i += 1) { + token = tokens[i] + type = token[0] + if (type === 'space' && i === length - 1 && !customProperty) { + clean = false + } else if (type === 'comment') { + prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty' + next = tokens[i + 1] ? tokens[i + 1][0] : 'empty' + if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) { + if (value.slice(-1) === ',') { + clean = false + } else { + value += token[1] + } + } else { + clean = false + } + } else { + value += token[1] + } + } + if (!clean) { + let raw = tokens.reduce((all, i) => all + i[1], '') + node.raws[prop] = { raw, value } + } + node[prop] = value + } + + rule(tokens) { + tokens.pop() + + let node = new Rule() + this.init(node, tokens[0][2]) + + node.raws.between = this.spacesAndCommentsFromEnd(tokens) + this.raw(node, 'selector', tokens) + this.current = node + } + + spacesAndCommentsFromEnd(tokens) { + let lastTokenType + let spaces = '' + while (tokens.length) { + lastTokenType = tokens[tokens.length - 1][0] + if (lastTokenType !== 'space' && lastTokenType !== 'comment') break + spaces = tokens.pop()[1] + spaces + } + return spaces + } + + // Errors + + spacesAndCommentsFromStart(tokens) { + let next + let spaces = '' + while (tokens.length) { + next = tokens[0][0] + if (next !== 'space' && next !== 'comment') break + spaces += tokens.shift()[1] + } + return spaces + } + + spacesFromEnd(tokens) { + let lastTokenType + let spaces = '' + while (tokens.length) { + lastTokenType = tokens[tokens.length - 1][0] + if (lastTokenType !== 'space') break + spaces = tokens.pop()[1] + spaces + } + return spaces + } + + stringFrom(tokens, from) { + let result = '' + for (let i = from; i < tokens.length; i++) { + result += tokens[i][1] + } + tokens.splice(from, tokens.length - from) + return result + } + + unclosedBlock() { + let pos = this.current.source.start + throw this.input.error('Unclosed block', pos.line, pos.column) + } + + unclosedBracket(bracket) { + throw this.input.error( + 'Unclosed bracket', + { offset: bracket[2] }, + { offset: bracket[2] + 1 } + ) + } + + unexpectedClose(token) { + throw this.input.error( + 'Unexpected }', + { offset: token[2] }, + { offset: token[2] + 1 } + ) + } + + unknownWord(tokens) { + throw this.input.error( + 'Unknown word ' + tokens[0][1], + { offset: tokens[0][2] }, + { offset: tokens[0][2] + tokens[0][1].length } + ) + } + + unnamedAtrule(node, token) { + throw this.input.error( + 'At-rule without name', + { offset: token[2] }, + { offset: token[2] + token[1].length } + ) + } +} + +module.exports = Parser diff --git a/node_modules/postcss/lib/postcss.d.mts b/node_modules/postcss/lib/postcss.d.mts new file mode 100644 index 0000000..eaec868 --- /dev/null +++ b/node_modules/postcss/lib/postcss.d.mts @@ -0,0 +1,66 @@ +export { + // Type-only exports + AcceptedPlugin, + AnyNode, + atRule, + AtRule, + AtRuleProps, + Builder, + ChildNode, + ChildProps, + comment, + Comment, + CommentProps, + Container, + ContainerProps, + CssSyntaxError, + decl, + Declaration, + DeclarationProps, + // postcss function / namespace + default, + document, + Document, + DocumentProps, + FilePosition, + fromJSON, + Helpers, + Input, + JSONHydrator, + // This is a class, but it’s not re-exported. That’s why it’s exported as type-only here. + type LazyResult, + list, + Message, + Node, + NodeErrorOptions, + NodeProps, + OldPlugin, + parse, + Parser, + // @ts-expect-error This value exists, but it’s untyped. + plugin, + Plugin, + PluginCreator, + Position, + Postcss, + ProcessOptions, + Processor, + Result, + root, + Root, + RootProps, + rule, + Rule, + RuleProps, + Source, + SourceMap, + SourceMapOptions, + Stringifier, + // Value exports from postcss.mjs + stringify, + Syntax, + TransformCallback, + Transformer, + Warning, + WarningOptions +} from './postcss.js' diff --git a/node_modules/postcss/lib/postcss.d.ts b/node_modules/postcss/lib/postcss.d.ts new file mode 100644 index 0000000..41bf40f --- /dev/null +++ b/node_modules/postcss/lib/postcss.d.ts @@ -0,0 +1,464 @@ +import { RawSourceMap, SourceMapGenerator } from 'source-map-js' + +import AtRule, { AtRuleProps } from './at-rule.js' +import Comment, { CommentProps } from './comment.js' +import Container, { ContainerProps, NewChild } from './container.js' +import CssSyntaxError from './css-syntax-error.js' +import Declaration, { DeclarationProps } from './declaration.js' +import Document, { DocumentProps } from './document.js' +import Input, { FilePosition } from './input.js' +import LazyResult from './lazy-result.js' +import list from './list.js' +import Node, { + AnyNode, + ChildNode, + ChildProps, + NodeErrorOptions, + NodeProps, + Position, + Source +} from './node.js' +import Processor from './processor.js' +import Result, { Message } from './result.js' +import Root, { RootProps } from './root.js' +import Rule, { RuleProps } from './rule.js' +import Warning, { WarningOptions } from './warning.js' + +type DocumentProcessor = ( + document: Document, + helper: postcss.Helpers +) => Promise | void +type RootProcessor = ( + root: Root, + helper: postcss.Helpers +) => Promise | void +type DeclarationProcessor = ( + decl: Declaration, + helper: postcss.Helpers +) => Promise | void +type RuleProcessor = ( + rule: Rule, + helper: postcss.Helpers +) => Promise | void +type AtRuleProcessor = ( + atRule: AtRule, + helper: postcss.Helpers +) => Promise | void +type CommentProcessor = ( + comment: Comment, + helper: postcss.Helpers +) => Promise | void + +interface Processors { + /** + * Will be called on all`AtRule` nodes. + * + * Will be called again on node or children changes. + */ + AtRule?: { [name: string]: AtRuleProcessor } | AtRuleProcessor + + /** + * Will be called on all `AtRule` nodes, when all children will be processed. + * + * Will be called again on node or children changes. + */ + AtRuleExit?: { [name: string]: AtRuleProcessor } | AtRuleProcessor + + /** + * Will be called on all `Comment` nodes. + * + * Will be called again on node or children changes. + */ + Comment?: CommentProcessor + + /** + * Will be called on all `Comment` nodes after listeners + * for `Comment` event. + * + * Will be called again on node or children changes. + */ + CommentExit?: CommentProcessor + + /** + * Will be called on all `Declaration` nodes after listeners + * for `Declaration` event. + * + * Will be called again on node or children changes. + */ + Declaration?: { [prop: string]: DeclarationProcessor } | DeclarationProcessor + + /** + * Will be called on all `Declaration` nodes. + * + * Will be called again on node or children changes. + */ + DeclarationExit?: + | { [prop: string]: DeclarationProcessor } + | DeclarationProcessor + + /** + * Will be called on `Document` node. + * + * Will be called again on children changes. + */ + Document?: DocumentProcessor + + /** + * Will be called on `Document` node, when all children will be processed. + * + * Will be called again on children changes. + */ + DocumentExit?: DocumentProcessor + + /** + * Will be called on `Root` node once. + */ + Once?: RootProcessor + + /** + * Will be called on `Root` node once, when all children will be processed. + */ + OnceExit?: RootProcessor + + /** + * Will be called on `Root` node. + * + * Will be called again on children changes. + */ + Root?: RootProcessor + + /** + * Will be called on `Root` node, when all children will be processed. + * + * Will be called again on children changes. + */ + RootExit?: RootProcessor + + /** + * Will be called on all `Rule` nodes. + * + * Will be called again on node or children changes. + */ + Rule?: RuleProcessor + + /** + * Will be called on all `Rule` nodes, when all children will be processed. + * + * Will be called again on node or children changes. + */ + RuleExit?: RuleProcessor +} + +declare namespace postcss { + export { + AnyNode, + AtRule, + AtRuleProps, + ChildNode, + ChildProps, + Comment, + CommentProps, + Container, + ContainerProps, + CssSyntaxError, + Declaration, + DeclarationProps, + Document, + DocumentProps, + FilePosition, + Input, + LazyResult, + list, + Message, + NewChild, + Node, + NodeErrorOptions, + NodeProps, + Position, + Processor, + Result, + Root, + RootProps, + Rule, + RuleProps, + Source, + Warning, + WarningOptions + } + + export type SourceMap = { + toJSON(): RawSourceMap + } & SourceMapGenerator + + export type Helpers = { postcss: Postcss; result: Result } & Postcss + + export interface Plugin extends Processors { + postcssPlugin: string + prepare?: (result: Result) => Processors + } + + export interface PluginCreator { + (opts?: PluginOptions): Plugin | Processor + postcss: true + } + + export interface Transformer extends TransformCallback { + postcssPlugin: string + postcssVersion: string + } + + export interface TransformCallback { + (root: Root, result: Result): Promise | void + } + + export interface OldPlugin extends Transformer { + (opts?: T): Transformer + postcss: Transformer + } + + export type AcceptedPlugin = + | { + postcss: Processor | TransformCallback + } + | OldPlugin + | Plugin + | PluginCreator + | Processor + | TransformCallback + + export interface Parser { + ( + css: { toString(): string } | string, + opts?: Pick + ): RootNode + } + + export interface Builder { + (part: string, node?: AnyNode, type?: 'end' | 'start'): void + } + + export interface Stringifier { + (node: AnyNode, builder: Builder): void + } + + export interface JSONHydrator { + (data: object): Node + (data: object[]): Node[] + } + + export interface Syntax { + /** + * Function to generate AST by string. + */ + parse?: Parser + + /** + * Class to generate string by AST. + */ + stringify?: Stringifier + } + + export interface SourceMapOptions { + /** + * Use absolute path in generated source map. + */ + absolute?: boolean + + /** + * Indicates that PostCSS should add annotation comments to the CSS. + * By default, PostCSS will always add a comment with a path + * to the source map. PostCSS will not add annotations to CSS files + * that do not contain any comments. + * + * By default, PostCSS presumes that you want to save the source map as + * `opts.to + '.map'` and will use this path in the annotation comment. + * A different path can be set by providing a string value for annotation. + * + * If you have set `inline: true`, annotation cannot be disabled. + */ + annotation?: ((file: string, root: Root) => string) | boolean | string + + /** + * Override `from` in map’s sources. + */ + from?: string + + /** + * Indicates that the source map should be embedded in the output CSS + * as a Base64-encoded comment. By default, it is `true`. + * But if all previous maps are external, not inline, PostCSS will not embed + * the map even if you do not set this option. + * + * If you have an inline source map, the result.map property will be empty, + * as the source map will be contained within the text of `result.css`. + */ + inline?: boolean + + /** + * Source map content from a previous processing step (e.g., Sass). + * + * PostCSS will try to read the previous source map + * automatically (based on comments within the source CSS), but you can use + * this option to identify it manually. + * + * If desired, you can omit the previous map with prev: `false`. + */ + prev?: ((file: string) => string) | boolean | object | string + + /** + * Indicates that PostCSS should set the origin content (e.g., Sass source) + * of the source map. By default, it is true. But if all previous maps do not + * contain sources content, PostCSS will also leave it out even if you + * do not set this option. + */ + sourcesContent?: boolean + } + + export interface ProcessOptions { + /** + * Input file if it is not simple CSS file, but HTML with + + `; +} + +//#endregion +//#region src/node/server/transformRequest.ts +var import_etag = /* @__PURE__ */ __toESM(require_etag(), 1); +var import_picocolors$19 = /* @__PURE__ */ __toESM(require_picocolors(), 1); +const ERR_LOAD_URL = "ERR_LOAD_URL"; +const ERR_LOAD_PUBLIC_URL = "ERR_LOAD_PUBLIC_URL"; +const ERR_DENIED_ID = "ERR_DENIED_ID"; +const debugLoad = createDebugger("vite:load"); +const debugTransform = createDebugger("vite:transform"); +const debugCache$1 = createDebugger("vite:cache"); +function transformRequest(environment, url$3, options$1) { + if (environment._closing && environment.config.dev.recoverable) throwClosedServerError(); + const timestamp = monotonicDateNow(); + url$3 = removeTimestampQuery(url$3); + const pending = environment._pendingRequests.get(url$3); + if (pending) return environment.moduleGraph.getModuleByUrl(url$3).then((module$1) => { + if (!module$1 || pending.timestamp > module$1.lastInvalidationTimestamp) return pending.request; + else { + pending.abort(); + return transformRequest(environment, url$3, options$1); + } + }); + const request = doTransform(environment, url$3, options$1, timestamp); + let cleared = false; + const clearCache = () => { + if (!cleared) { + environment._pendingRequests.delete(url$3); + cleared = true; + } + }; + environment._pendingRequests.set(url$3, { + request, + timestamp, + abort: clearCache + }); + return request.finally(clearCache); +} +async function doTransform(environment, url$3, options$1, timestamp) { + const { pluginContainer } = environment; + let module$1 = await environment.moduleGraph.getModuleByUrl(url$3); + if (module$1) { + const cached = await getCachedTransformResult(environment, url$3, module$1, timestamp); + if (cached) return cached; + } + const resolved = module$1 ? void 0 : await pluginContainer.resolveId(url$3, void 0) ?? void 0; + const id = module$1?.id ?? resolved?.id ?? url$3; + module$1 ??= environment.moduleGraph.getModuleById(id); + if (module$1) { + await environment.moduleGraph._ensureEntryFromUrl(url$3, void 0, resolved); + const cached = await getCachedTransformResult(environment, url$3, module$1, timestamp); + if (cached) return cached; + } + const result = loadAndTransform(environment, id, url$3, options$1, timestamp, module$1, resolved); + const { depsOptimizer } = environment; + if (!depsOptimizer?.isOptimizedDepFile(id)) environment._registerRequestProcessing(id, () => result); + return result; +} +async function getCachedTransformResult(environment, url$3, module$1, timestamp) { + const prettyUrl = debugCache$1 ? prettifyUrl(url$3, environment.config.root) : ""; + const softInvalidatedTransformResult = await handleModuleSoftInvalidation(environment, module$1, timestamp); + if (softInvalidatedTransformResult) { + debugCache$1?.(`[memory-hmr] ${prettyUrl}`); + return softInvalidatedTransformResult; + } + const cached = module$1.transformResult; + if (cached) { + debugCache$1?.(`[memory] ${prettyUrl}`); + return cached; + } +} +async function loadAndTransform(environment, id, url$3, options$1, timestamp, mod, resolved) { + const { config: config$2, pluginContainer, logger } = environment; + const prettyUrl = debugLoad || debugTransform ? prettifyUrl(url$3, config$2.root) : ""; + const moduleGraph = environment.moduleGraph; + if (!options$1.skipFsCheck && id[0] !== "\0" && isServerAccessDeniedForTransform(config$2, id)) { + const err$2 = /* @__PURE__ */ new Error(`Denied ID ${id}`); + err$2.code = ERR_DENIED_ID; + err$2.id = id; + throw err$2; + } + let code = null; + let map$1 = null; + const loadStart = debugLoad ? performance$1.now() : 0; + const loadResult = await pluginContainer.load(id); + if (loadResult == null) { + const file = cleanUrl(id); + if (options$1.skipFsCheck || isFileLoadingAllowed(environment.getTopLevelConfig(), slash(file))) { + try { + code = await fsp.readFile(file, "utf-8"); + debugLoad?.(`${timeFrom(loadStart)} [fs] ${prettyUrl}`); + } catch (e$1) { + if (e$1.code !== "ENOENT" && e$1.code !== "EISDIR") throw e$1; + } + if (code != null && environment.pluginContainer.watcher) ensureWatchedFile(environment.pluginContainer.watcher, file, config$2.root); + } + if (code) try { + const extracted = await extractSourcemapFromFile(code, file); + if (extracted) { + code = extracted.code; + map$1 = extracted.map; + } + } catch (e$1) { + logger.warn(`Failed to load source map for ${file}.\n${e$1}`, { timestamp: true }); + } + } else { + debugLoad?.(`${timeFrom(loadStart)} [plugin] ${prettyUrl}`); + if (isObject(loadResult)) { + code = loadResult.code; + map$1 = loadResult.map; + } else code = loadResult; + } + if (code == null) { + const isPublicFile = checkPublicFile(url$3, environment.getTopLevelConfig()); + let publicDirName = path.relative(config$2.root, config$2.publicDir); + if (publicDirName[0] !== ".") publicDirName = "/" + publicDirName; + const msg = isPublicFile ? `This file is in ${publicDirName} and will be copied as-is during build without going through the plugin transforms, and therefore should not be imported from source code. It can only be referenced via HTML tags.` : `Does the file exist?`; + const importerMod = moduleGraph.idToModuleMap.get(id)?.importers.values().next().value; + const importer = importerMod?.file || importerMod?.url; + const err$2 = /* @__PURE__ */ new Error(`Failed to load url ${url$3} (resolved id: ${id})${importer ? ` in ${importer}` : ""}. ${msg}`); + err$2.code = isPublicFile ? ERR_LOAD_PUBLIC_URL : ERR_LOAD_URL; + throw err$2; + } + if (environment._closing && environment.config.dev.recoverable) throwClosedServerError(); + mod ??= await moduleGraph._ensureEntryFromUrl(url$3, void 0, resolved); + const transformStart = debugTransform ? performance$1.now() : 0; + const transformResult = await pluginContainer.transform(code, id, { inMap: map$1 }); + const originalCode = code; + if (transformResult.code === originalCode) debugTransform?.(timeFrom(transformStart) + import_picocolors$19.default.dim(` [skipped] ${prettyUrl}`)); + else { + debugTransform?.(`${timeFrom(transformStart)} ${prettyUrl}`); + code = transformResult.code; + map$1 = transformResult.map; + } + let normalizedMap; + if (typeof map$1 === "string") normalizedMap = JSON.parse(map$1); + else if (map$1) normalizedMap = map$1; + else normalizedMap = null; + if (normalizedMap && "version" in normalizedMap && mod.file) { + if (normalizedMap.mappings) await injectSourcesContent(normalizedMap, mod.file, logger); + const sourcemapPath = `${mod.file}.map`; + applySourcemapIgnoreList(normalizedMap, sourcemapPath, config$2.server.sourcemapIgnoreList, logger); + if (path.isAbsolute(mod.file)) { + let modDirname; + for (let sourcesIndex = 0; sourcesIndex < normalizedMap.sources.length; ++sourcesIndex) { + const sourcePath = normalizedMap.sources[sourcesIndex]; + if (sourcePath) { + if (path.isAbsolute(sourcePath)) { + modDirname ??= path.dirname(mod.file); + normalizedMap.sources[sourcesIndex] = path.relative(modDirname, sourcePath); + } + } + } + } + } + if (environment._closing && environment.config.dev.recoverable) throwClosedServerError(); + const topLevelConfig = environment.getTopLevelConfig(); + const result = environment.config.dev.moduleRunnerTransform ? await ssrTransform(code, normalizedMap, url$3, originalCode, { json: { stringify: topLevelConfig.json.stringify === true && topLevelConfig.json.namedExports !== true } }) : { + code, + map: normalizedMap, + etag: (0, import_etag.default)(code, { weak: true }) + }; + if (timestamp > mod.lastInvalidationTimestamp) moduleGraph.updateModuleTransformResult(mod, result); + return result; +} +/** +* When a module is soft-invalidated, we can preserve its previous `transformResult` and +* return similar code to before: +* +* - Client: We need to transform the import specifiers with new timestamps +* - SSR: We don't need to change anything as `ssrLoadModule` controls it +*/ +async function handleModuleSoftInvalidation(environment, mod, timestamp) { + const transformResult = mod.invalidationState; + mod.invalidationState = void 0; + if (!transformResult || transformResult === "HARD_INVALIDATED") return; + if (mod.transformResult) throw new Error(`Internal server error: Soft-invalidated module "${mod.url}" should not have existing transform result`); + let result; + if (transformResult.ssr) result = transformResult; + else { + await init; + const source = transformResult.code; + const s = new MagicString(source); + const [imports] = parse(source, mod.id || void 0); + for (const imp of imports) { + let rawUrl = source.slice(imp.s, imp.e); + if (rawUrl === "import.meta") continue; + const hasQuotes = rawUrl[0] === "\"" || rawUrl[0] === "'"; + if (hasQuotes) rawUrl = rawUrl.slice(1, -1); + const urlWithoutTimestamp = removeTimestampQuery(rawUrl); + const hmrUrl = unwrapId(stripBase(removeImportQuery(urlWithoutTimestamp), environment.config.base)); + for (const importedMod of mod.importedModules) { + if (importedMod.url !== hmrUrl) continue; + if (importedMod.lastHMRTimestamp > 0) { + const replacedUrl = injectQuery(urlWithoutTimestamp, `t=${importedMod.lastHMRTimestamp}`); + const start = hasQuotes ? imp.s + 1 : imp.s; + const end = hasQuotes ? imp.e - 1 : imp.e; + s.overwrite(start, end, replacedUrl); + } + if (imp.d === -1 && environment.config.dev.preTransformRequests) environment.warmupRequest(hmrUrl); + break; + } + } + const code = s.toString(); + result = { + ...transformResult, + code, + etag: (0, import_etag.default)(code, { weak: true }) + }; + } + if (timestamp > mod.lastInvalidationTimestamp) environment.moduleGraph.updateModuleTransformResult(mod, result); + return result; +} + +//#endregion +//#region ../../node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.js +var require_js_tokens = /* @__PURE__ */ __commonJSMin(((exports, module) => { + var HashbangComment, Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]?|[^\/[\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/uy, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace; + Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y; + Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/uy; + StringLiteral = /(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y; + NumericLiteral = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y; + Template = /[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y; + WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/uy; + LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y; + MultiLineComment = /\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y; + SingleLineComment = /\/\/.*/y; + HashbangComment = /^#!.*/; + JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y; + JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/uy; + JSXString = /(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y; + JSXText = /[^<>{}]+/y; + TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/; + TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/; + KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/; + KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/; + Newline = RegExp(LineTerminatorSequence.source); + module.exports = function* (input, { jsx = false } = {}) { + var braces$2, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack; + ({length} = input); + lastIndex = 0; + lastSignificantToken = ""; + stack = [{ tag: "JS" }]; + braces$2 = []; + parenNesting = 0; + postfixIncDec = false; + if (match = HashbangComment.exec(input)) { + yield { + type: "HashbangComment", + value: match[0] + }; + lastIndex = match[0].length; + } + while (lastIndex < length) { + mode = stack[stack.length - 1]; + switch (mode.tag) { + case "JS": + case "JSNonExpressionParen": + case "InterpolationInTemplate": + case "InterpolationInJSX": + if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) { + RegularExpressionLiteral.lastIndex = lastIndex; + if (match = RegularExpressionLiteral.exec(input)) { + lastIndex = RegularExpressionLiteral.lastIndex; + lastSignificantToken = match[0]; + postfixIncDec = true; + yield { + type: "RegularExpressionLiteral", + value: match[0], + closed: match[1] !== void 0 && match[1] !== "\\" + }; + continue; + } + } + Punctuator.lastIndex = lastIndex; + if (match = Punctuator.exec(input)) { + punctuator = match[0]; + nextLastIndex = Punctuator.lastIndex; + nextLastSignificantToken = punctuator; + switch (punctuator) { + case "(": + if (lastSignificantToken === "?NonExpressionParenKeyword") stack.push({ + tag: "JSNonExpressionParen", + nesting: parenNesting + }); + parenNesting++; + postfixIncDec = false; + break; + case ")": + parenNesting--; + postfixIncDec = true; + if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) { + stack.pop(); + nextLastSignificantToken = "?NonExpressionParenEnd"; + postfixIncDec = false; + } + break; + case "{": + Punctuator.lastIndex = 0; + isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken)); + braces$2.push(isExpression); + postfixIncDec = false; + break; + case "}": + switch (mode.tag) { + case "InterpolationInTemplate": + if (braces$2.length === mode.nesting) { + Template.lastIndex = lastIndex; + match = Template.exec(input); + lastIndex = Template.lastIndex; + lastSignificantToken = match[0]; + if (match[1] === "${") { + lastSignificantToken = "?InterpolationInTemplate"; + postfixIncDec = false; + yield { + type: "TemplateMiddle", + value: match[0] + }; + } else { + stack.pop(); + postfixIncDec = true; + yield { + type: "TemplateTail", + value: match[0], + closed: match[1] === "`" + }; + } + continue; + } + break; + case "InterpolationInJSX": if (braces$2.length === mode.nesting) { + stack.pop(); + lastIndex += 1; + lastSignificantToken = "}"; + yield { + type: "JSXPunctuator", + value: "}" + }; + continue; + } + } + postfixIncDec = braces$2.pop(); + nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}"; + break; + case "]": + postfixIncDec = true; + break; + case "++": + case "--": + nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec"; + break; + case "<": + if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) { + stack.push({ tag: "JSXTag" }); + lastIndex += 1; + lastSignificantToken = "<"; + yield { + type: "JSXPunctuator", + value: punctuator + }; + continue; + } + postfixIncDec = false; + break; + default: postfixIncDec = false; + } + lastIndex = nextLastIndex; + lastSignificantToken = nextLastSignificantToken; + yield { + type: "Punctuator", + value: punctuator + }; + continue; + } + Identifier.lastIndex = lastIndex; + if (match = Identifier.exec(input)) { + lastIndex = Identifier.lastIndex; + nextLastSignificantToken = match[0]; + switch (match[0]) { + case "for": + case "if": + case "while": + case "with": if (lastSignificantToken !== "." && lastSignificantToken !== "?.") nextLastSignificantToken = "?NonExpressionParenKeyword"; + } + lastSignificantToken = nextLastSignificantToken; + postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]); + yield { + type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName", + value: match[0] + }; + continue; + } + StringLiteral.lastIndex = lastIndex; + if (match = StringLiteral.exec(input)) { + lastIndex = StringLiteral.lastIndex; + lastSignificantToken = match[0]; + postfixIncDec = true; + yield { + type: "StringLiteral", + value: match[0], + closed: match[2] !== void 0 + }; + continue; + } + NumericLiteral.lastIndex = lastIndex; + if (match = NumericLiteral.exec(input)) { + lastIndex = NumericLiteral.lastIndex; + lastSignificantToken = match[0]; + postfixIncDec = true; + yield { + type: "NumericLiteral", + value: match[0] + }; + continue; + } + Template.lastIndex = lastIndex; + if (match = Template.exec(input)) { + lastIndex = Template.lastIndex; + lastSignificantToken = match[0]; + if (match[1] === "${") { + lastSignificantToken = "?InterpolationInTemplate"; + stack.push({ + tag: "InterpolationInTemplate", + nesting: braces$2.length + }); + postfixIncDec = false; + yield { + type: "TemplateHead", + value: match[0] + }; + } else { + postfixIncDec = true; + yield { + type: "NoSubstitutionTemplate", + value: match[0], + closed: match[1] === "`" + }; + } + continue; + } + break; + case "JSXTag": + case "JSXTagEnd": + JSXPunctuator.lastIndex = lastIndex; + if (match = JSXPunctuator.exec(input)) { + lastIndex = JSXPunctuator.lastIndex; + nextLastSignificantToken = match[0]; + switch (match[0]) { + case "<": + stack.push({ tag: "JSXTag" }); + break; + case ">": + stack.pop(); + if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") { + nextLastSignificantToken = "?JSX"; + postfixIncDec = true; + } else stack.push({ tag: "JSXChildren" }); + break; + case "{": + stack.push({ + tag: "InterpolationInJSX", + nesting: braces$2.length + }); + nextLastSignificantToken = "?InterpolationInJSX"; + postfixIncDec = false; + break; + case "/": if (lastSignificantToken === "<") { + stack.pop(); + if (stack[stack.length - 1].tag === "JSXChildren") stack.pop(); + stack.push({ tag: "JSXTagEnd" }); + } + } + lastSignificantToken = nextLastSignificantToken; + yield { + type: "JSXPunctuator", + value: match[0] + }; + continue; + } + JSXIdentifier.lastIndex = lastIndex; + if (match = JSXIdentifier.exec(input)) { + lastIndex = JSXIdentifier.lastIndex; + lastSignificantToken = match[0]; + yield { + type: "JSXIdentifier", + value: match[0] + }; + continue; + } + JSXString.lastIndex = lastIndex; + if (match = JSXString.exec(input)) { + lastIndex = JSXString.lastIndex; + lastSignificantToken = match[0]; + yield { + type: "JSXString", + value: match[0], + closed: match[2] !== void 0 + }; + continue; + } + break; + case "JSXChildren": + JSXText.lastIndex = lastIndex; + if (match = JSXText.exec(input)) { + lastIndex = JSXText.lastIndex; + lastSignificantToken = match[0]; + yield { + type: "JSXText", + value: match[0] + }; + continue; + } + switch (input[lastIndex]) { + case "<": + stack.push({ tag: "JSXTag" }); + lastIndex++; + lastSignificantToken = "<"; + yield { + type: "JSXPunctuator", + value: "<" + }; + continue; + case "{": + stack.push({ + tag: "InterpolationInJSX", + nesting: braces$2.length + }); + lastIndex++; + lastSignificantToken = "?InterpolationInJSX"; + postfixIncDec = false; + yield { + type: "JSXPunctuator", + value: "{" + }; + continue; + } + } + WhiteSpace.lastIndex = lastIndex; + if (match = WhiteSpace.exec(input)) { + lastIndex = WhiteSpace.lastIndex; + yield { + type: "WhiteSpace", + value: match[0] + }; + continue; + } + LineTerminatorSequence.lastIndex = lastIndex; + if (match = LineTerminatorSequence.exec(input)) { + lastIndex = LineTerminatorSequence.lastIndex; + postfixIncDec = false; + if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere"; + yield { + type: "LineTerminatorSequence", + value: match[0] + }; + continue; + } + MultiLineComment.lastIndex = lastIndex; + if (match = MultiLineComment.exec(input)) { + lastIndex = MultiLineComment.lastIndex; + if (Newline.test(match[0])) { + postfixIncDec = false; + if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere"; + } + yield { + type: "MultiLineComment", + value: match[0], + closed: match[1] !== void 0 + }; + continue; + } + SingleLineComment.lastIndex = lastIndex; + if (match = SingleLineComment.exec(input)) { + lastIndex = SingleLineComment.lastIndex; + postfixIncDec = false; + yield { + type: "SingleLineComment", + value: match[0] + }; + continue; + } + firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex)); + lastIndex += firstCodePoint.length; + lastSignificantToken = firstCodePoint; + postfixIncDec = false; + yield { + type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid", + value: firstCodePoint + }; + } + }; +})); + +//#endregion +//#region ../../node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.mjs +var import_js_tokens = /* @__PURE__ */ __toESM(require_js_tokens(), 1); +const FILL_COMMENT = " "; +function stripLiteralFromToken(token, fillChar, filter$1) { + if (token.type === "SingleLineComment") return FILL_COMMENT.repeat(token.value.length); + if (token.type === "MultiLineComment") return token.value.replace(/[^\n]/g, FILL_COMMENT); + if (token.type === "StringLiteral") { + if (!token.closed) return token.value; + const body = token.value.slice(1, -1); + if (filter$1(body)) return token.value[0] + fillChar.repeat(body.length) + token.value[token.value.length - 1]; + } + if (token.type === "NoSubstitutionTemplate") { + const body = token.value.slice(1, -1); + if (filter$1(body)) return `\`${body.replace(/[^\n]/g, fillChar)}\``; + } + if (token.type === "RegularExpressionLiteral") { + const body = token.value; + if (filter$1(body)) return body.replace(/\/(.*)\/(\w?)$/g, (_, $1, $2) => `/${fillChar.repeat($1.length)}/${$2}`); + } + if (token.type === "TemplateHead") { + const body = token.value.slice(1, -2); + if (filter$1(body)) return `\`${body.replace(/[^\n]/g, fillChar)}\${`; + } + if (token.type === "TemplateTail") { + const body = token.value.slice(0, -2); + if (filter$1(body)) return `}${body.replace(/[^\n]/g, fillChar)}\``; + } + if (token.type === "TemplateMiddle") { + const body = token.value.slice(1, -2); + if (filter$1(body)) return `}${body.replace(/[^\n]/g, fillChar)}\${`; + } + return token.value; +} +function optionsWithDefaults(options$1) { + return { + fillChar: options$1?.fillChar ?? " ", + filter: options$1?.filter ?? (() => true) + }; +} +function stripLiteral(code, options$1) { + let result = ""; + const _options = optionsWithDefaults(options$1); + for (const token of (0, import_js_tokens.default)(code, { jsx: false })) result += stripLiteralFromToken(token, _options.fillChar, _options.filter); + return result; +} + +//#endregion +//#region src/node/assetSource.ts +const ALLOWED_META_NAME = [ + "msapplication-tileimage", + "msapplication-square70x70logo", + "msapplication-square150x150logo", + "msapplication-wide310x150logo", + "msapplication-square310x310logo", + "msapplication-config", + "twitter:image" +]; +const ALLOWED_META_PROPERTY = [ + "og:image", + "og:image:url", + "og:image:secure_url", + "og:audio", + "og:audio:secure_url", + "og:video", + "og:video:secure_url" +]; +const DEFAULT_HTML_ASSET_SOURCES = { + audio: { srcAttributes: ["src"] }, + embed: { srcAttributes: ["src"] }, + img: { + srcAttributes: ["src"], + srcsetAttributes: ["srcset"] + }, + image: { srcAttributes: ["href", "xlink:href"] }, + input: { srcAttributes: ["src"] }, + link: { + srcAttributes: ["href"], + srcsetAttributes: ["imagesrcset"] + }, + object: { srcAttributes: ["data"] }, + source: { + srcAttributes: ["src"], + srcsetAttributes: ["srcset"] + }, + track: { srcAttributes: ["src"] }, + use: { srcAttributes: ["href", "xlink:href"] }, + video: { srcAttributes: ["src", "poster"] }, + meta: { + srcAttributes: ["content"], + filter({ attributes }) { + if (attributes.name && ALLOWED_META_NAME.includes(attributes.name.trim().toLowerCase())) return true; + if (attributes.property && ALLOWED_META_PROPERTY.includes(attributes.property.trim().toLowerCase())) return true; + return false; + } + } +}; +/** +* Given a HTML node, find all attributes that references an asset to be processed +*/ +function getNodeAssetAttributes(node) { + const matched = DEFAULT_HTML_ASSET_SOURCES[node.nodeName]; + if (!matched) return []; + const attributes = {}; + for (const attr of node.attrs) attributes[getAttrKey(attr)] = attr.value; + if ("vite-ignore" in attributes) return [{ + type: "remove", + key: "vite-ignore", + value: "", + attributes, + location: node.sourceCodeLocation.attrs["vite-ignore"] + }]; + const actions = []; + function handleAttributeKey(key, type) { + const value$1 = attributes[key]; + if (!value$1) return; + if (matched.filter && !matched.filter({ + key, + value: value$1, + attributes + })) return; + const location$1 = node.sourceCodeLocation.attrs[key]; + actions.push({ + type, + key, + value: value$1, + attributes, + location: location$1 + }); + } + matched.srcAttributes?.forEach((key) => handleAttributeKey(key, "src")); + matched.srcsetAttributes?.forEach((key) => handleAttributeKey(key, "srcset")); + return actions; +} +function getAttrKey(attr) { + return attr.prefix === void 0 ? attr.name : `${attr.prefix}:${attr.name}`; +} + +//#endregion +//#region src/node/plugins/importAnalysisBuild.ts +var import_convert_source_map = /* @__PURE__ */ __toESM(require_convert_source_map(), 1); +/** +* A flag for injected helpers. This flag will be set to `false` if the output +* target is not native es - so that injected helper logic can be conditionally +* dropped. +*/ +const isModernFlag = `__VITE_IS_MODERN__`; +const preloadMethod = `__vitePreload`; +const preloadMarker = `__VITE_PRELOAD__`; +const preloadHelperId = "\0vite/preload-helper.js"; +const preloadMarkerRE = new RegExp(preloadMarker, "g"); +const dynamicImportPrefixRE = /import\s*\(/; +const dynamicImportTreeshakenRE = /((?:\bconst\s+|\blet\s+|\bvar\s+|,\s*)(\{[^{}.=]+\})\s*=\s*await\s+import\([^)]+\))(?=\s*(?:$|[^[.]))|(\(\s*await\s+import\([^)]+\)\s*\)(\??\.[\w$]+))|\bimport\([^)]+\)(\s*\.then\(\s*(?:function\s*)?\(\s*\{([^{}.=]+)\}\))/g; +function toRelativePath(filename, importer) { + const relPath = path.posix.relative(path.posix.dirname(importer), filename); + return relPath[0] === "." ? relPath : `./${relPath}`; +} +function findPreloadMarker(str, pos = 0) { + preloadMarkerRE.lastIndex = pos; + return preloadMarkerRE.exec(str)?.index ?? -1; +} +/** +* Helper for preloading CSS and direct imports of async chunks in parallel to +* the async chunk itself. +*/ +function detectScriptRel() { + const relList = typeof document !== "undefined" && document.createElement("link").relList; + return relList && relList.supports && relList.supports("modulepreload") ? "modulepreload" : "preload"; +} +function preload(baseModule, deps, importerUrl) { + let promise = Promise.resolve(); + if (__VITE_IS_MODERN__ && deps && deps.length > 0) { + const links = document.getElementsByTagName("link"); + const cspNonceMeta = document.querySelector("meta[property=csp-nonce]"); + const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce"); + function allSettled(promises$2) { + return Promise.all(promises$2.map((p) => Promise.resolve(p).then((value$1) => ({ + status: "fulfilled", + value: value$1 + }), (reason) => ({ + status: "rejected", + reason + })))); + } + promise = allSettled(deps.map((dep) => { + dep = assetsURL(dep, importerUrl); + if (dep in seen) return; + seen[dep] = true; + const isCss = dep.endsWith(".css"); + const cssSelector = isCss ? "[rel=\"stylesheet\"]" : ""; + if (!!importerUrl) for (let i$1 = links.length - 1; i$1 >= 0; i$1--) { + const link$1 = links[i$1]; + if (link$1.href === dep && (!isCss || link$1.rel === "stylesheet")) return; + } + else if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) return; + const link = document.createElement("link"); + link.rel = isCss ? "stylesheet" : scriptRel; + if (!isCss) link.as = "script"; + link.crossOrigin = ""; + link.href = dep; + if (cspNonce) link.setAttribute("nonce", cspNonce); + document.head.appendChild(link); + if (isCss) return new Promise((res, rej) => { + link.addEventListener("load", res); + link.addEventListener("error", () => rej(/* @__PURE__ */ new Error(`Unable to preload CSS for ${dep}`))); + }); + })); + } + function handlePreloadError(err$2) { + const e$1 = new Event("vite:preloadError", { cancelable: true }); + e$1.payload = err$2; + window.dispatchEvent(e$1); + if (!e$1.defaultPrevented) throw err$2; + } + return promise.then((res) => { + for (const item of res || []) { + if (item.status !== "rejected") continue; + handlePreloadError(item.reason); + } + return baseModule().catch(handlePreloadError); + }); +} +function getPreloadCode(environment, renderBuiltUrlBoolean, isRelativeBase) { + const { modulePreload } = environment.config.build; + return `const scriptRel = ${modulePreload && modulePreload.polyfill ? `'modulepreload'` : `/* @__PURE__ */ (${detectScriptRel.toString()})()`};const assetsURL = ${renderBuiltUrlBoolean || isRelativeBase ? `function(dep, importerUrl) { return new URL(dep, importerUrl).href }` : `function(dep) { return ${JSON.stringify(environment.config.base)}+dep }`};const seen = {};export const ${preloadMethod} = ${preload.toString()}`; +} +/** +* Build only. During serve this is performed as part of ./importAnalysis. +*/ +function buildImportAnalysisPlugin(config$2) { + const getInsertPreload = (environment) => environment.config.consumer === "client" && !config$2.isWorker && !config$2.build.lib; + const renderBuiltUrl = config$2.experimental.renderBuiltUrl; + const isRelativeBase = config$2.base === "./" || config$2.base === ""; + return { + name: "vite:build-import-analysis", + resolveId: { + filter: { id: exactRegex(preloadHelperId) }, + handler(id) { + return id; + } + }, + load: { + filter: { id: exactRegex(preloadHelperId) }, + handler(_id) { + return { + code: getPreloadCode(this.environment, !!renderBuiltUrl, isRelativeBase), + moduleSideEffects: false + }; + } + }, + transform: { + filter: { code: dynamicImportPrefixRE }, + async handler(source, importer) { + await init; + let imports = []; + try { + imports = parse(source)[0]; + } catch (_e) { + const e$1 = _e; + const { message, showCodeFrame } = createParseErrorInfo(importer, source); + this.error(message, showCodeFrame ? e$1.idx : void 0); + } + if (!imports.length) return null; + const insertPreload = getInsertPreload(this.environment); + const dynamicImports = {}; + if (insertPreload) { + let match; + while (match = dynamicImportTreeshakenRE.exec(source)) { + if (match[1]) { + dynamicImports[dynamicImportTreeshakenRE.lastIndex] = { + declaration: `const ${match[2]}`, + names: match[2]?.trim() + }; + continue; + } + if (match[3]) { + let names$1 = /\.([^.?]+)/.exec(match[4])?.[1] || ""; + if (names$1 === "default") names$1 = "default: __vite_default__"; + dynamicImports[dynamicImportTreeshakenRE.lastIndex - match[4]?.length - 1] = { + declaration: `const {${names$1}}`, + names: `{ ${names$1} }` + }; + continue; + } + const names = match[6]?.trim(); + dynamicImports[dynamicImportTreeshakenRE.lastIndex - match[5]?.length] = { + declaration: `const {${names}}`, + names: `{ ${names} }` + }; + } + } + let s; + const str = () => s || (s = new MagicString(source)); + let needPreloadHelper = false; + for (let index = 0; index < imports.length; index++) { + const { s: start, e: end, ss: expStart, se: expEnd, d: dynamicIndex, a: attributeIndex } = imports[index]; + const isDynamicImport = dynamicIndex > -1; + if (!isDynamicImport && attributeIndex > -1) str().remove(end + 1, expEnd); + if (isDynamicImport && insertPreload && (source[start] === "\"" || source[start] === "'" || source[start] === "`")) { + needPreloadHelper = true; + const { declaration, names } = dynamicImports[expEnd] || {}; + if (names) { + str().prependLeft(expStart, `${preloadMethod}(async () => { ${declaration} = await `); + str().appendRight(expEnd, `;return ${names}}`); + } else str().prependLeft(expStart, `${preloadMethod}(() => `); + str().appendRight(expEnd, `,${isModernFlag}?${preloadMarker}:void 0${renderBuiltUrl || isRelativeBase ? ",import.meta.url" : ""})`); + } + } + if (needPreloadHelper && insertPreload && !source.includes(`const ${preloadMethod} =`)) str().prepend(`import { ${preloadMethod} } from "${preloadHelperId}";`); + if (s) return { + code: s.toString(), + map: this.environment.config.build.sourcemap ? s.generateMap({ hires: "boundary" }) : null + }; + } + }, + renderChunk(code, _, { format: format$3 }) { + if (code.indexOf(isModernFlag) > -1) { + const re = new RegExp(isModernFlag, "g"); + const isModern = String(format$3 === "es"); + const isModernWithPadding = isModern + " ".repeat(isModernFlag.length - isModern.length); + return { + code: code.replace(re, isModernWithPadding), + map: null + }; + } + return null; + }, + generateBundle({ format: format$3 }, bundle) { + if (format$3 !== "es") return; + if (!getInsertPreload(this.environment)) { + const removedPureCssFiles = removedPureCssFilesCache.get(config$2); + if (removedPureCssFiles && removedPureCssFiles.size > 0) for (const file in bundle) { + const chunk = bundle[file]; + if (chunk.type === "chunk" && chunk.code.includes("import")) { + const code = chunk.code; + let imports; + try { + imports = parse(code)[0].filter((i$1) => i$1.d > -1); + } catch (e$1) { + const loc = numberToPos(code, e$1.idx); + this.error({ + name: e$1.name, + message: e$1.message, + stack: e$1.stack, + cause: e$1.cause, + pos: e$1.idx, + loc: { + ...loc, + file: chunk.fileName + }, + frame: generateCodeFrame(code, loc) + }); + } + for (const imp of imports) { + const { n: name, s: start, e: end, ss: expStart, se: expEnd } = imp; + let url$3 = name; + if (!url$3) { + const rawUrl = code.slice(start, end); + if (rawUrl[0] === `"` && rawUrl.endsWith(`"`)) url$3 = rawUrl.slice(1, -1); + } + if (!url$3) continue; + const normalizedFile = path.posix.join(path.posix.dirname(chunk.fileName), url$3); + if (removedPureCssFiles.has(normalizedFile)) chunk.code = chunk.code.slice(0, expStart) + `Promise.resolve({${"".padEnd(expEnd - expStart - 19, " ")}})` + chunk.code.slice(expEnd); + } + } + } + return; + } + const buildSourcemap = this.environment.config.build.sourcemap; + const { modulePreload } = this.environment.config.build; + for (const file in bundle) { + const chunk = bundle[file]; + if (chunk.type === "chunk" && chunk.code.indexOf(preloadMarker) > -1) { + const code = chunk.code; + let imports; + try { + imports = parse(code)[0].filter((i$1) => i$1.d > -1); + } catch (e$1) { + const loc = numberToPos(code, e$1.idx); + this.error({ + name: e$1.name, + message: e$1.message, + stack: e$1.stack, + cause: e$1.cause, + pos: e$1.idx, + loc: { + ...loc, + file: chunk.fileName + }, + frame: generateCodeFrame(code, loc) + }); + } + const s = new MagicString(code); + const rewroteMarkerStartPos = /* @__PURE__ */ new Set(); + const fileDeps = []; + const addFileDep = (url$3, runtime = false) => { + const index = fileDeps.findIndex((dep) => dep.url === url$3); + if (index === -1) return fileDeps.push({ + url: url$3, + runtime + }) - 1; + else return index; + }; + if (imports.length) for (let index = 0; index < imports.length; index++) { + const { n: name, s: start, e: end, ss: expStart, se: expEnd } = imports[index]; + let url$3 = name; + if (!url$3) { + const rawUrl = code.slice(start, end); + if (rawUrl[0] === `"` && rawUrl.endsWith(`"`)) url$3 = rawUrl.slice(1, -1); + } + const deps = /* @__PURE__ */ new Set(); + let hasRemovedPureCssChunk = false; + let normalizedFile = void 0; + if (url$3) { + normalizedFile = path.posix.join(path.posix.dirname(chunk.fileName), url$3); + const ownerFilename = chunk.fileName; + const analyzed = /* @__PURE__ */ new Set(); + const addDeps = (filename) => { + if (filename === ownerFilename) return; + if (analyzed.has(filename)) return; + analyzed.add(filename); + const chunk$1 = bundle[filename]; + if (chunk$1) { + deps.add(chunk$1.fileName); + if (chunk$1.type === "chunk") { + chunk$1.imports.forEach(addDeps); + chunk$1.viteMetadata.importedCss.forEach((file$1) => { + deps.add(file$1); + }); + } + } else { + const chunk$2 = removedPureCssFilesCache.get(config$2).get(filename); + if (chunk$2) { + if (chunk$2.viteMetadata.importedCss.size) { + chunk$2.viteMetadata.importedCss.forEach((file$1) => { + deps.add(file$1); + }); + hasRemovedPureCssChunk = true; + } + s.update(expStart, expEnd, "Promise.resolve({})"); + } + } + }; + addDeps(normalizedFile); + } + let markerStartPos$1 = findPreloadMarker(code, end); + if (markerStartPos$1 === -1 && imports.length === 1) markerStartPos$1 = findPreloadMarker(code); + if (markerStartPos$1 > 0) { + let depsArray = deps.size > 1 || hasRemovedPureCssChunk && deps.size > 0 ? modulePreload === false ? [...deps].filter((d) => d.endsWith(".css")) : [...deps] : []; + const resolveDependencies = modulePreload ? modulePreload.resolveDependencies : void 0; + if (resolveDependencies && normalizedFile) { + const cssDeps = []; + const otherDeps = []; + for (const dep of depsArray) (dep.endsWith(".css") ? cssDeps : otherDeps).push(dep); + depsArray = [...resolveDependencies(normalizedFile, otherDeps, { + hostId: file, + hostType: "js" + }), ...cssDeps]; + } + let renderedDeps; + if (renderBuiltUrl) renderedDeps = depsArray.map((dep) => { + const replacement = toOutputFilePathInJS(this.environment, dep, "asset", chunk.fileName, "js", toRelativePath); + if (typeof replacement === "string") return addFileDep(replacement); + return addFileDep(replacement.runtime, true); + }); + else renderedDeps = depsArray.map((d) => isRelativeBase ? addFileDep(toRelativePath(d, file)) : addFileDep(d)); + s.update(markerStartPos$1, markerStartPos$1 + preloadMarker.length, renderedDeps.length > 0 ? `__vite__mapDeps([${renderedDeps.join(",")}])` : `[]`); + rewroteMarkerStartPos.add(markerStartPos$1); + } + } + if (fileDeps.length > 0) { + const mapDepsCode = `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=${`[${fileDeps.map((fileDep) => fileDep.runtime ? fileDep.url : JSON.stringify(fileDep.url)).join(",")}]`})))=>i.map(i=>d[i]);\n`; + if (code.startsWith("#!")) s.prependLeft(code.indexOf("\n") + 1, mapDepsCode); + else s.prepend(mapDepsCode); + } + let markerStartPos = findPreloadMarker(code); + while (markerStartPos >= 0) { + if (!rewroteMarkerStartPos.has(markerStartPos)) s.update(markerStartPos, markerStartPos + preloadMarker.length, "void 0"); + markerStartPos = findPreloadMarker(code, markerStartPos + preloadMarker.length); + } + if (s.hasChanged()) { + chunk.code = s.toString(); + if (buildSourcemap && chunk.map) { + const nextMap = s.generateMap({ + source: chunk.fileName, + hires: "boundary" + }); + const originalFile = chunk.map.file; + const map$1 = combineSourcemaps(chunk.fileName, [nextMap, chunk.map]); + map$1.toUrl = () => genSourceMapUrl(map$1); + if (originalFile) map$1.file = originalFile; + const originalDebugId = chunk.map.debugId; + chunk.map = map$1; + if (buildSourcemap === "inline") { + chunk.code = chunk.code.replace(import_convert_source_map.default.mapFileCommentRegex, ""); + chunk.code += `\n//# sourceMappingURL=${genSourceMapUrl(map$1)}`; + } else { + if (originalDebugId) map$1.debugId = originalDebugId; + const mapAsset = bundle[chunk.fileName + ".map"]; + if (mapAsset && mapAsset.type === "asset") mapAsset.source = map$1.toString(); + } + } + } + } + } + } + }; +} + +//#endregion +//#region src/node/plugins/modulePreloadPolyfill.ts +const modulePreloadPolyfillId = "vite/modulepreload-polyfill"; +const resolvedModulePreloadPolyfillId = "\0" + modulePreloadPolyfillId + ".js"; +function modulePreloadPolyfillPlugin(config$2) { + let polyfillString; + return { + name: "vite:modulepreload-polyfill", + resolveId: { + filter: { id: exactRegex(modulePreloadPolyfillId) }, + handler(_id) { + return resolvedModulePreloadPolyfillId; + } + }, + load: { + filter: { id: exactRegex(resolvedModulePreloadPolyfillId) }, + handler(_id) { + if (config$2.command !== "build" || this.environment.config.consumer !== "client") return ""; + if (!polyfillString) polyfillString = `${isModernFlag}&&(${polyfill.toString()}());`; + return { + code: polyfillString, + moduleSideEffects: true + }; + } + } + }; +} +function polyfill() { + const relList = document.createElement("link").relList; + if (relList && relList.supports && relList.supports("modulepreload")) return; + for (const link of document.querySelectorAll("link[rel=\"modulepreload\"]")) processPreload(link); + new MutationObserver((mutations) => { + for (const mutation of mutations) { + if (mutation.type !== "childList") continue; + for (const node of mutation.addedNodes) if (node.tagName === "LINK" && node.rel === "modulepreload") processPreload(node); + } + }).observe(document, { + childList: true, + subtree: true + }); + function getFetchOpts(link) { + const fetchOpts = {}; + if (link.integrity) fetchOpts.integrity = link.integrity; + if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy; + if (link.crossOrigin === "use-credentials") fetchOpts.credentials = "include"; + else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit"; + else fetchOpts.credentials = "same-origin"; + return fetchOpts; + } + function processPreload(link) { + if (link.ep) return; + link.ep = true; + const fetchOpts = getFetchOpts(link); + fetch(link.href, fetchOpts); + } +} + +//#endregion +//#region src/node/plugins/html.ts +var import_picocolors$18 = /* @__PURE__ */ __toESM(require_picocolors(), 1); +var import_escape_html = /* @__PURE__ */ __toESM(require_escape_html(), 1); +const htmlProxyRE$1 = /[?&]html-proxy=?(?:&inline-css)?(?:&style-attr)?&index=(\d+)\.(?:js|css)$/; +const isHtmlProxyRE = /[?&]html-proxy\b/; +const inlineCSSRE$1 = /__VITE_INLINE_CSS__([a-z\d]{8}_\d+)__/g; +const inlineImportRE = /(?]*type\s*=\s*(?:"importmap"|'importmap'|importmap)[^>]*>.*?<\/script>/is; +const importMapAppendRE = new RegExp([/[ \t]*]*type\s*=\s*(?:"module"|'module'|module)[^>]*>/i, /[ \t]*]*rel\s*=\s*(?:"modulepreload"|'modulepreload'|modulepreload)[\s\S]*?\/>/i].map((r$1) => r$1.source).join("|"), "i"); +const isHTMLProxy = (id) => isHtmlProxyRE.test(id); +const isHTMLRequest = (request) => htmlLangRE.test(request); +const htmlProxyMap = /* @__PURE__ */ new WeakMap(); +const htmlProxyResult = /* @__PURE__ */ new Map(); +function htmlInlineProxyPlugin(config$2) { + htmlProxyMap.set(config$2, /* @__PURE__ */ new Map()); + return { + name: "vite:html-inline-proxy", + resolveId: { + filter: { id: isHtmlProxyRE }, + handler(id) { + return id; + } + }, + load: { + filter: { id: isHtmlProxyRE }, + handler(id) { + const proxyMatch = htmlProxyRE$1.exec(id); + if (proxyMatch) { + const index = Number(proxyMatch[1]); + const url$3 = cleanUrl(id).replace(normalizePath(config$2.root), ""); + const result = htmlProxyMap.get(config$2).get(url$3)?.[index]; + if (result) return { + ...result, + moduleSideEffects: true + }; + else throw new Error(`No matching HTML proxy module found from ${id}`); + } + } + } + }; +} +function addToHTMLProxyCache(config$2, filePath, index, result) { + if (!htmlProxyMap.get(config$2)) htmlProxyMap.set(config$2, /* @__PURE__ */ new Map()); + if (!htmlProxyMap.get(config$2).get(filePath)) htmlProxyMap.get(config$2).set(filePath, []); + htmlProxyMap.get(config$2).get(filePath)[index] = result; +} +function addToHTMLProxyTransformResult(hash$1, code) { + htmlProxyResult.set(hash$1, code); +} +const noInlineLinkRels = new Set([ + "icon", + "apple-touch-icon", + "apple-touch-startup-image", + "manifest" +]); +const isAsyncScriptMap = /* @__PURE__ */ new WeakMap(); +function nodeIsElement(node) { + return node.nodeName[0] !== "#"; +} +function traverseNodes(node, visitor) { + if (node.nodeName === "template") node = node.content; + visitor(node); + if (nodeIsElement(node) || node.nodeName === "#document" || node.nodeName === "#document-fragment") node.childNodes.forEach((childNode) => traverseNodes(childNode, visitor)); +} +async function traverseHtml(html, filePath, warn, visitor) { + const { parse: parse$15 } = await import("./dist.js"); + const warnings = {}; + traverseNodes(parse$15(html, { + scriptingEnabled: false, + sourceCodeLocationInfo: true, + onParseError: (e$1) => { + handleParseError(e$1, html, filePath, warnings); + } + }), visitor); + for (const message of Object.values(warnings)) warn(import_picocolors$18.default.yellow(`\n${message}`)); +} +function getScriptInfo(node) { + let src; + let srcSourceCodeLocation; + let isModule = false; + let isAsync = false; + let isIgnored = false; + for (const p of node.attrs) { + if (p.prefix !== void 0) continue; + if (p.name === "src") { + if (!src) { + src = p; + srcSourceCodeLocation = node.sourceCodeLocation?.attrs["src"]; + } + } else if (p.name === "type" && p.value === "module") isModule = true; + else if (p.name === "async") isAsync = true; + else if (p.name === "vite-ignore") isIgnored = true; + } + return { + src, + srcSourceCodeLocation, + isModule, + isAsync, + isIgnored + }; +} +const attrValueStartRE = /=\s*(.)/; +function overwriteAttrValue(s, sourceCodeLocation, newValue) { + const srcString = s.slice(sourceCodeLocation.startOffset, sourceCodeLocation.endOffset); + const valueStart = attrValueStartRE.exec(srcString); + if (!valueStart) throw new Error(`[vite:html] internal error, failed to overwrite attribute value`); + const wrapOffset = valueStart[1] === "\"" || valueStart[1] === "'" ? 1 : 0; + const valueOffset = valueStart.index + valueStart[0].length - 1; + s.update(sourceCodeLocation.startOffset + valueOffset + wrapOffset, sourceCodeLocation.endOffset - wrapOffset, newValue); + return s; +} +function removeViteIgnoreAttr(s, sourceCodeLocation) { + const loc = sourceCodeLocation.attrs?.["vite-ignore"]; + if (loc) s.remove(loc.startOffset, loc.endOffset); + return s; +} +/** +* Format parse5 @type {ParserError} to @type {RollupError} +*/ +function formatParseError(parserError, id, html) { + return { + code: parserError.code, + message: `parse5 error code ${parserError.code}`, + frame: generateCodeFrame(html, parserError.startOffset, parserError.endOffset), + loc: { + file: id, + line: parserError.startLine, + column: parserError.startCol + } + }; +} +function handleParseError(parserError, html, filePath, warnings) { + switch (parserError.code) { + case "missing-doctype": return; + case "abandoned-head-element-child": return; + case "duplicate-attribute": return; + case "non-void-html-element-start-tag-with-trailing-solidus": return; + case "unexpected-question-mark-instead-of-tag-name": return; + } + const parseError = formatParseError(parserError, filePath, html); + warnings[parseError.code] ??= `Unable to parse HTML; ${parseError.message}\n at ${parseError.loc.file}:${parseError.loc.line}:${parseError.loc.column}\n` + parseError.frame; +} +/** +* Compiles index.html into an entry js module +*/ +function buildHtmlPlugin(config$2) { + const [preHooks, normalHooks, postHooks] = resolveHtmlTransforms(config$2.plugins); + preHooks.unshift(injectCspNonceMetaTagHook(config$2)); + preHooks.unshift(preImportMapHook(config$2)); + preHooks.push(htmlEnvHook(config$2)); + postHooks.push(injectNonceAttributeTagHook(config$2)); + postHooks.push(postImportMapHook()); + const processedHtml = perEnvironmentState(() => /* @__PURE__ */ new Map()); + const isExcludedUrl = (url$3) => url$3[0] === "#" || isExternalUrl(url$3) || isDataUrl(url$3); + isAsyncScriptMap.set(config$2, /* @__PURE__ */ new Map()); + return { + name: "vite:build-html", + transform: { + filter: { id: /\.html$/ }, + async handler(html, id) { + id = normalizePath(id); + const relativeUrlPath = normalizePath(path.relative(config$2.root, id)); + const publicPath = `/${relativeUrlPath}`; + const publicBase = getBaseInHTML(relativeUrlPath, config$2); + const publicToRelative = (filename) => publicBase + filename; + const toOutputPublicFilePath = (url$3) => toOutputFilePathInHtml(url$3.slice(1), "public", relativeUrlPath, "html", config$2, publicToRelative); + const nodeStartWithLeadingWhitespace = (node) => { + const startOffset = node.sourceCodeLocation.startOffset; + if (startOffset === 0) return 0; + const lineStartOffset = startOffset - node.sourceCodeLocation.startCol; + let isLineEmpty = false; + try { + isLineEmpty = !s.slice(Math.max(0, lineStartOffset), startOffset).trim(); + } catch {} + return isLineEmpty ? lineStartOffset : startOffset; + }; + html = await applyHtmlTransforms(html, preHooks, this, { + path: publicPath, + filename: id + }); + let js = ""; + const s = new MagicString(html); + const scriptUrls = []; + const styleUrls = []; + let inlineModuleIndex = -1; + let everyScriptIsAsync = true; + let someScriptsAreAsync = false; + let someScriptsAreDefer = false; + const assetUrlsPromises = []; + const namedOutput = Object.keys(config$2.build.rollupOptions.input || {}); + const processAssetUrl = async (url$3, shouldInline$1) => { + if (url$3 !== "" && !namedOutput.includes(url$3) && !namedOutput.includes(removeLeadingSlash(url$3))) try { + return await urlToBuiltUrl(this, url$3, id, shouldInline$1); + } catch (e$1) { + if (e$1.code !== "ENOENT") throw e$1; + } + return url$3; + }; + const setModuleSideEffectPromises = []; + await traverseHtml(html, id, config$2.logger.warn, (node) => { + if (!nodeIsElement(node)) return; + let shouldRemove = false; + if (node.nodeName === "script") { + const { src, srcSourceCodeLocation, isModule, isAsync, isIgnored } = getScriptInfo(node); + if (isIgnored) removeViteIgnoreAttr(s, node.sourceCodeLocation); + else { + const url$3 = src && src.value; + const isPublicFile = !!(url$3 && checkPublicFile(url$3, config$2)); + if (isPublicFile) overwriteAttrValue(s, srcSourceCodeLocation, partialEncodeURIPath(toOutputPublicFilePath(url$3))); + if (isModule) { + inlineModuleIndex++; + if (url$3 && !isExcludedUrl(url$3) && !isPublicFile) { + setModuleSideEffectPromises.push(this.resolve(url$3, id).then((resolved) => { + if (!resolved) return Promise.reject(/* @__PURE__ */ new Error(`Failed to resolve ${url$3} from ${id}`)); + const moduleInfo = this.getModuleInfo(resolved.id); + if (moduleInfo) moduleInfo.moduleSideEffects = true; + else if (!resolved.external) return this.load(resolved).then((mod) => { + mod.moduleSideEffects = true; + }); + })); + js += `\nimport ${JSON.stringify(url$3)}`; + shouldRemove = true; + } else if (node.childNodes.length) { + const contents = node.childNodes.pop().value; + addToHTMLProxyCache(config$2, id.replace(normalizePath(config$2.root), ""), inlineModuleIndex, { code: contents }); + js += `\nimport "${id}?html-proxy&index=${inlineModuleIndex}.js"`; + shouldRemove = true; + } + everyScriptIsAsync &&= isAsync; + someScriptsAreAsync ||= isAsync; + someScriptsAreDefer ||= !isAsync; + } else if (url$3 && !isPublicFile) { + if (!isExcludedUrl(url$3)) config$2.logger.warn(`