@run-trace/duckdb-wasm 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/duckdb-browser-blocking.cjs +1 -1
- package/dist/duckdb-browser-blocking.cjs.map +4 -4
- package/dist/duckdb-browser-blocking.mjs +1 -1
- package/dist/duckdb-browser-blocking.mjs.map +4 -4
- package/dist/duckdb-browser-coi.pthread.worker.js +1 -1
- package/dist/duckdb-browser-coi.worker.js +1 -1
- package/dist/duckdb-browser.cjs +1 -1
- package/dist/duckdb-browser.cjs.map +3 -3
- package/dist/duckdb-browser.mjs +1 -1
- package/dist/duckdb-browser.mjs.map +3 -3
- package/dist/duckdb-coi.wasm +0 -0
- package/dist/duckdb-eh.wasm +0 -0
- package/dist/duckdb-node-blocking.cjs +2 -2
- package/dist/duckdb-node-blocking.cjs.map +4 -4
- package/dist/duckdb-node-eh.worker.cjs +2 -2
- package/dist/duckdb-node-eh.worker.cjs.map +4 -4
- package/dist/duckdb-node.cjs +1 -1
- package/dist/duckdb-node.cjs.map +3 -3
- package/dist/types/src/platform.d.ts +1 -1
- package/package.json +2 -7
- package/dist/duckdb-browser-eh.worker.js +0 -14
- package/dist/duckdb-browser-eh.worker.js.map +0 -7
- package/dist/duckdb-browser-mvp.worker.js +0 -14
- package/dist/duckdb-mvp.wasm +0 -0
- package/dist/duckdb-node-mvp.worker.cjs +0 -51
- package/dist/duckdb-node-mvp.worker.cjs.map +0 -7
- package/dist/types/src/bindings/bindings_browser_mvp.d.ts +0 -11
- package/dist/types/src/bindings/bindings_node_mvp.d.ts +0 -12
- package/dist/types/src/targets/duckdb-browser-mvp.worker.d.ts +0 -2
- package/dist/types/src/targets/duckdb-node-mvp.worker.d.ts +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Q_=Object.create;var Wr=Object.defineProperty;var z_=Object.getOwnPropertyDescriptor;var Z_=Object.getOwnPropertyNames;var ed=Object.getPrototypeOf,rd=Object.prototype.hasOwnProperty;var td=(w,d,y)=>d in w?Wr(w,d,{enumerable:!0,configurable:!0,writable:!0,value:y}):w[d]=y;var wr=(w,d)=>()=>(d||w((d={exports:{}}).exports,d),d.exports),id=(w,d)=>{for(var y in d)Wr(w,y,{get:d[y],enumerable:!0})},ua=(w,d,y,g)=>{if(d&&typeof d=="object"||typeof d=="function")for(let l of Z_(d))!rd.call(w,l)&&l!==y&&Wr(w,l,{get:()=>d[l],enumerable:!(g=z_(d,l))||g.enumerable});return w};var qr=(w,d,y)=>(y=w!=null?Q_(ed(w)):{},ua(d||!w||!w.__esModule?Wr(y,"default",{value:w,enumerable:!0}):y,w)),nd=w=>ua(Wr({},"__esModule",{value:!0}),w);var At=(w,d,y)=>(td(w,typeof d!="symbol"?d+"":d,y),y);var Ra=wr(()=>{});var Ca=wr(()=>{});var Sa=wr((zd,xt)=>{(function(){"use strict";var w="input is invalid type",d=typeof window=="object",y=d?window:{};y.JS_SHA256_NO_WINDOW&&(d=!1);var g=!d&&typeof self=="object",l=!y.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node&&process.type!="renderer";l?y=global:g&&(y=self);var E=!y.JS_SHA256_NO_COMMON_JS&&typeof xt=="object"&&xt.exports,T=typeof define=="function"&&define.amd,S=!y.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",A="0123456789abcdef".split(""),M=[-2147483648,8388608,32768,128],O=[24,16,8,0],Q=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],ie=["hex","array","digest","arrayBuffer"],V=[];(y.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),S&&(y.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});var ke=function(x,G){return function(z){return new we(G,!0).update(z)[x]()}},oe=function(x){var G=ke("hex",x);l&&(G=Se(G,x)),G.create=function(){return new we(x)},G.update=function(X){return G.create().update(X)};for(var z=0;z<ie.length;++z){var N=ie[z];G[N]=ke(N,x)}return G},Se=function(x,G){var z=Ra(),N=Ca().Buffer,X=G?"sha224":"sha256",q;N.from&&!y.JS_SHA256_NO_BUFFER_FROM?q=N.from:q=function(H){return new N(H)};var Y=function(H){if(typeof H=="string")return z.createHash(X).update(H,"utf8").digest("hex");if(H==null)throw new Error(w);return H.constructor===ArrayBuffer&&(H=new Uint8Array(H)),Array.isArray(H)||ArrayBuffer.isView(H)||H.constructor===N?z.createHash(X).update(q(H)).digest("hex"):x(H)};return Y},De=function(x,G){return function(z,N){return new Ie(z,G,!0).update(N)[x]()}},ye=function(x){var G=De("hex",x);G.create=function(X){return new Ie(X,x)},G.update=function(X,q){return G.create(X).update(q)};for(var z=0;z<ie.length;++z){var N=ie[z];G[N]=De(N,x)}return G};function we(x,G){G?(V[0]=V[16]=V[1]=V[2]=V[3]=V[4]=V[5]=V[6]=V[7]=V[8]=V[9]=V[10]=V[11]=V[12]=V[13]=V[14]=V[15]=0,this.blocks=V):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],x?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=x}we.prototype.update=function(x){if(!this.finalized){var G,z=typeof x;if(z!=="string"){if(z==="object"){if(x===null)throw new Error(w);if(S&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!S||!ArrayBuffer.isView(x)))throw new Error(w)}else throw new Error(w);G=!0}for(var N,X=0,q,Y=x.length,H=this.blocks;X<Y;){if(this.hashed&&(this.hashed=!1,H[0]=this.block,this.block=H[16]=H[1]=H[2]=H[3]=H[4]=H[5]=H[6]=H[7]=H[8]=H[9]=H[10]=H[11]=H[12]=H[13]=H[14]=H[15]=0),G)for(q=this.start;X<Y&&q<64;++X)H[q>>>2]|=x[X]<<O[q++&3];else for(q=this.start;X<Y&&q<64;++X)N=x.charCodeAt(X),N<128?H[q>>>2]|=N<<O[q++&3]:N<2048?(H[q>>>2]|=(192|N>>>6)<<O[q++&3],H[q>>>2]|=(128|N&63)<<O[q++&3]):N<55296||N>=57344?(H[q>>>2]|=(224|N>>>12)<<O[q++&3],H[q>>>2]|=(128|N>>>6&63)<<O[q++&3],H[q>>>2]|=(128|N&63)<<O[q++&3]):(N=65536+((N&1023)<<10|x.charCodeAt(++X)&1023),H[q>>>2]|=(240|N>>>18)<<O[q++&3],H[q>>>2]|=(128|N>>>12&63)<<O[q++&3],H[q>>>2]|=(128|N>>>6&63)<<O[q++&3],H[q>>>2]|=(128|N&63)<<O[q++&3]);this.lastByteIndex=q,this.bytes+=q-this.start,q>=64?(this.block=H[16],this.start=q-64,this.hash(),this.hashed=!0):this.start=q}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},we.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var x=this.blocks,G=this.lastByteIndex;x[16]=this.block,x[G>>>2]|=M[G&3],this.block=x[16],G>=56&&(this.hashed||this.hash(),x[0]=this.block,x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0),x[14]=this.hBytes<<3|this.bytes>>>29,x[15]=this.bytes<<3,this.hash()}},we.prototype.hash=function(){var x=this.h0,G=this.h1,z=this.h2,N=this.h3,X=this.h4,q=this.h5,Y=this.h6,H=this.h7,J=this.blocks,ne,F,ae,Ke,ve,We,Me,Ve,lr,fr,yr;for(ne=16;ne<64;++ne)ve=J[ne-15],F=(ve>>>7|ve<<25)^(ve>>>18|ve<<14)^ve>>>3,ve=J[ne-2],ae=(ve>>>17|ve<<15)^(ve>>>19|ve<<13)^ve>>>10,J[ne]=J[ne-16]+F+J[ne-7]+ae<<0;for(yr=G&z,ne=0;ne<64;ne+=4)this.first?(this.is224?(Ve=300032,ve=J[0]-1413257819,H=ve-150054599<<0,N=ve+24177077<<0):(Ve=704751109,ve=J[0]-210244248,H=ve-1521486534<<0,N=ve+143694565<<0),this.first=!1):(F=(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10),ae=(X>>>6|X<<26)^(X>>>11|X<<21)^(X>>>25|X<<7),Ve=x&G,Ke=Ve^x&z^yr,Me=X&q^~X&Y,ve=H+ae+Me+Q[ne]+J[ne],We=F+Ke,H=N+ve<<0,N=ve+We<<0),F=(N>>>2|N<<30)^(N>>>13|N<<19)^(N>>>22|N<<10),ae=(H>>>6|H<<26)^(H>>>11|H<<21)^(H>>>25|H<<7),lr=N&x,Ke=lr^N&G^Ve,Me=H&X^~H&q,ve=Y+ae+Me+Q[ne+1]+J[ne+1],We=F+Ke,Y=z+ve<<0,z=ve+We<<0,F=(z>>>2|z<<30)^(z>>>13|z<<19)^(z>>>22|z<<10),ae=(Y>>>6|Y<<26)^(Y>>>11|Y<<21)^(Y>>>25|Y<<7),fr=z&N,Ke=fr^z&x^lr,Me=Y&H^~Y&X,ve=q+ae+Me+Q[ne+2]+J[ne+2],We=F+Ke,q=G+ve<<0,G=ve+We<<0,F=(G>>>2|G<<30)^(G>>>13|G<<19)^(G>>>22|G<<10),ae=(q>>>6|q<<26)^(q>>>11|q<<21)^(q>>>25|q<<7),yr=G&z,Ke=yr^G&N^fr,Me=q&Y^~q&H,ve=X+ae+Me+Q[ne+3]+J[ne+3],We=F+Ke,X=x+ve<<0,x=ve+We<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+x<<0,this.h1=this.h1+G<<0,this.h2=this.h2+z<<0,this.h3=this.h3+N<<0,this.h4=this.h4+X<<0,this.h5=this.h5+q<<0,this.h6=this.h6+Y<<0,this.h7=this.h7+H<<0},we.prototype.hex=function(){this.finalize();var x=this.h0,G=this.h1,z=this.h2,N=this.h3,X=this.h4,q=this.h5,Y=this.h6,H=this.h7,J=A[x>>>28&15]+A[x>>>24&15]+A[x>>>20&15]+A[x>>>16&15]+A[x>>>12&15]+A[x>>>8&15]+A[x>>>4&15]+A[x&15]+A[G>>>28&15]+A[G>>>24&15]+A[G>>>20&15]+A[G>>>16&15]+A[G>>>12&15]+A[G>>>8&15]+A[G>>>4&15]+A[G&15]+A[z>>>28&15]+A[z>>>24&15]+A[z>>>20&15]+A[z>>>16&15]+A[z>>>12&15]+A[z>>>8&15]+A[z>>>4&15]+A[z&15]+A[N>>>28&15]+A[N>>>24&15]+A[N>>>20&15]+A[N>>>16&15]+A[N>>>12&15]+A[N>>>8&15]+A[N>>>4&15]+A[N&15]+A[X>>>28&15]+A[X>>>24&15]+A[X>>>20&15]+A[X>>>16&15]+A[X>>>12&15]+A[X>>>8&15]+A[X>>>4&15]+A[X&15]+A[q>>>28&15]+A[q>>>24&15]+A[q>>>20&15]+A[q>>>16&15]+A[q>>>12&15]+A[q>>>8&15]+A[q>>>4&15]+A[q&15]+A[Y>>>28&15]+A[Y>>>24&15]+A[Y>>>20&15]+A[Y>>>16&15]+A[Y>>>12&15]+A[Y>>>8&15]+A[Y>>>4&15]+A[Y&15];return this.is224||(J+=A[H>>>28&15]+A[H>>>24&15]+A[H>>>20&15]+A[H>>>16&15]+A[H>>>12&15]+A[H>>>8&15]+A[H>>>4&15]+A[H&15]),J},we.prototype.toString=we.prototype.hex,we.prototype.digest=function(){this.finalize();var x=this.h0,G=this.h1,z=this.h2,N=this.h3,X=this.h4,q=this.h5,Y=this.h6,H=this.h7,J=[x>>>24&255,x>>>16&255,x>>>8&255,x&255,G>>>24&255,G>>>16&255,G>>>8&255,G&255,z>>>24&255,z>>>16&255,z>>>8&255,z&255,N>>>24&255,N>>>16&255,N>>>8&255,N&255,X>>>24&255,X>>>16&255,X>>>8&255,X&255,q>>>24&255,q>>>16&255,q>>>8&255,q&255,Y>>>24&255,Y>>>16&255,Y>>>8&255,Y&255];return this.is224||J.push(H>>>24&255,H>>>16&255,H>>>8&255,H&255),J},we.prototype.array=we.prototype.digest,we.prototype.arrayBuffer=function(){this.finalize();var x=new ArrayBuffer(this.is224?28:32),G=new DataView(x);return G.setUint32(0,this.h0),G.setUint32(4,this.h1),G.setUint32(8,this.h2),G.setUint32(12,this.h3),G.setUint32(16,this.h4),G.setUint32(20,this.h5),G.setUint32(24,this.h6),this.is224||G.setUint32(28,this.h7),x};function Ie(x,G,z){var N,X=typeof x;if(X==="string"){var q=[],Y=x.length,H=0,J;for(N=0;N<Y;++N)J=x.charCodeAt(N),J<128?q[H++]=J:J<2048?(q[H++]=192|J>>>6,q[H++]=128|J&63):J<55296||J>=57344?(q[H++]=224|J>>>12,q[H++]=128|J>>>6&63,q[H++]=128|J&63):(J=65536+((J&1023)<<10|x.charCodeAt(++N)&1023),q[H++]=240|J>>>18,q[H++]=128|J>>>12&63,q[H++]=128|J>>>6&63,q[H++]=128|J&63);x=q}else if(X==="object"){if(x===null)throw new Error(w);if(S&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!S||!ArrayBuffer.isView(x)))throw new Error(w)}else throw new Error(w);x.length>64&&(x=new we(G,!0).update(x).array());var ne=[],F=[];for(N=0;N<64;++N){var ae=x[N]||0;ne[N]=92^ae,F[N]=54^ae}we.call(this,G,z),this.update(F),this.oKeyPad=ne,this.inner=!0,this.sharedMemory=z}Ie.prototype=new we,Ie.prototype.finalize=function(){if(we.prototype.finalize.call(this),this.inner){this.inner=!1;var x=this.array();we.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(x),we.prototype.finalize.call(this)}};var Fe=oe();Fe.sha256=Fe,Fe.sha224=oe(!0),Fe.sha256.hmac=ye(),Fe.sha224.hmac=ye(!0),E?xt.exports=Fe:(y.sha256=Fe.sha256,y.sha224=Fe.sha224,T&&define(function(){return Fe}))})()});var Bn=wr(()=>{});var Nn=wr(()=>{});var Ba=wr((Ia,Ht)=>{"use strict";var Pn=(()=>{var d;var w=typeof document<"u"?(d=document.currentScript)==null?void 0:d.src:void 0;return typeof __filename<"u"&&(w=w||__filename),async function(y={}){var g,l=y,E,T,S=new Promise((e,r)=>{E=e,T=r}),A=typeof window=="object",M=typeof WorkerGlobalScope<"u",O=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",Q=Object.assign({},l),ie=[],V="./this.program",ke=(e,r)=>{throw r},oe="";function Se(e){return l.locateFile?l.locateFile(e,oe):oe+e}var De,ye;if(O){var we=Bn(),Ie=Nn();oe=__dirname+"/",ye=e=>{e=Me(e)?new URL(e):e;var r=we.readFileSync(e);return r},De=async(e,r=!0)=>{e=Me(e)?new URL(e):e;var t=we.readFileSync(e,r?void 0:"utf8");return t},!l.thisProgram&&process.argv.length>1&&(V=process.argv[1].replace(/\\/g,"/")),ie=process.argv.slice(2),ke=(e,r)=>{throw process.exitCode=e,r}}else(A||M)&&(M?oe=self.location.href:typeof document<"u"&&document.currentScript&&(oe=document.currentScript.src),w&&(oe=w),oe.startsWith("blob:")?oe="":oe=oe.slice(0,oe.replace(/[?#].*/,"").lastIndexOf("/")+1),M&&(ye=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),De=async e=>{var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var Fe=l.print||console.log.bind(console),x=l.printErr||console.error.bind(console);Object.assign(l,Q),Q=null,l.arguments&&(ie=l.arguments),l.thisProgram&&(V=l.thisProgram);var G=l.wasmBinary,z,N=!1,X;function q(e,r){e||Re(r)}var Y,H,J,ne,F,ae,Ke,ve,We=!1,Me=e=>e.startsWith("file://");function Ve(){var e=z.buffer;l.HEAP8=Y=new Int8Array(e),l.HEAP16=J=new Int16Array(e),l.HEAPU8=H=new Uint8Array(e),l.HEAPU16=ne=new Uint16Array(e),l.HEAP32=F=new Int32Array(e),l.HEAPU32=ae=new Uint32Array(e),l.HEAPF32=Ke=new Float32Array(e),l.HEAPF64=ve=new Float64Array(e)}function lr(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)Yt(l.preRun.shift());Rr(Sr)}function fr(){We=!0,ee.vh()}function yr(){}function Pt(){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)Jt(l.postRun.shift());Rr(Cr)}var Be=0,Je=null;function Mt(e){var r;Be++,(r=l.monitorRunDependencies)==null||r.call(l,Be)}function Lt(e){var t;if(Be--,(t=l.monitorRunDependencies)==null||t.call(l,Be),Be==0&&Je){var r=Je;Je=null,r()}}function Re(e){var t;(t=l.onAbort)==null||t.call(l,e),e="Aborted("+e+")",x(e),N=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw T(r),r}var Ye;function Ot(){return Se("./duckdb-mvp.wasm")}function Wt(e){if(e==Ye&&G)return new Uint8Array(G);if(ye)return ye(e);throw"both async and sync fetching of the wasm failed"}async function qt(e){if(!G)try{var r=await De(e);return new Uint8Array(r)}catch(t){}return Wt(e)}async function Kt(e,r){try{var t=await qt(e),i=await WebAssembly.instantiate(t,r);return i}catch(n){x("failed to asynchronously prepare wasm: ".concat(n)),Re(n)}}async function Gt(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!O)try{var i=fetch(r,{credentials:"same-origin"}),n=await WebAssembly.instantiateStreaming(i,t);return n}catch(a){x("wasm streaming compile failed: ".concat(a)),x("falling back to ArrayBuffer instantiation")}return Kt(r,t)}function $t(){return{a:ea}}async function Xt(){function e(a,s){return ee=a.exports,ee=J_(ee),z=ee.uh,Ve(),hn=ee.xh,Lt("wasm-instantiate"),ee}Mt("wasm-instantiate");function r(a){return e(a.instance)}var t=$t();if(l.instantiateWasm)return new Promise((a,s)=>{l.instantiateWasm(t,(o,c)=>{e(o,c),a(o.exports)})});Ye!=null||(Ye=Ot());try{var i=await Gt(G,Ye,t),n=r(i);return n}catch(a){return T(a),Promise.reject(a)}}var _e,xe,Vt={10165216:(e,r,t,i)=>{var n=me(e);if(typeof XMLHttpRequest>"u")return 0;let a=new XMLHttpRequest;a.open(me(i),n,!1),a.responseType="arraybuffer";for(var s=0,_=r;s<_*2;){var o=F[t/4+s>>>0],c=F[t/4+s+1>>>0];try{var u=encodeURI(me(o));u==="Host"&&(u="X-Host-Override"),u==="User-Agent"&&(u="X-user-agent"),u==="Authorization"?a.setRequestHeader(u,me(c)):a.setRequestHeader(u,encodeURI(me(c)))}catch(re){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",re)}s+=2}try{a.send(null)}catch(re){return 0}if(a.status>=400)return 0;for(var f=a.response,_=f.byteLength,m=B(_+4),k=new Uint8Array(f),D=0;D<_;D++)l.HEAPU8[D+m+4]=k[D];var R=new Uint8Array(4);return R[0]=_%256,_-=R[0],_/=256,R[1]=_%256,_-=R[1],_/=256,R[2]=_%256,_-=R[2],_/=256,R[3]=_%256,_-=R[3],_/=256,l.HEAPU8.set(R,m),m},10166623:(e,r,t,i,n,a)=>{var s=me(e);if(typeof XMLHttpRequest>"u")return 0;let o=new XMLHttpRequest;o.open(me(i),s,!1),o.responseType="arraybuffer";for(var c=0,R=r;c<R*2;){var u=F[t/4+c>>>0],f=F[t/4+c+1>>>0];try{var _=encodeURI(me(u));_==="Host"&&(_="X-Host-Override"),_==="User-Agent"&&(_="X-user-agent"),_==="Authorization"?o.setRequestHeader(_,me(f)):o.setRequestHeader(_,encodeURI(me(f)))}catch(Ce){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ce)}c+=2}try{for(var m=new Uint8Array(a),k=0;k<a;k++)m[k]=l.HEAPU8[k+n];o.send(m)}catch(Ce){return 0}if(o.status>=400)return 0;for(var D=Uint8Array.from(Array.from(o.getResponseHeader("Etag")).map(Ce=>Ce.charCodeAt(0))),R=D.byteLength,re=B(R+4),de=new Uint8Array(D),k=0;k<R;k++)l.HEAPU8[k+re+4]=de[k];var ce=new Uint8Array(4);return ce[0]=R%256,R-=ce[0],R/=256,ce[1]=R%256,R-=ce[1],R/=256,ce[2]=R%256,R-=ce[2],R/=256,ce[3]=R%256,R-=ce[3],R/=256,l.HEAPU8.set(ce,re),re},10168243:(e,r,t,i)=>{var n=me(e);if(typeof XMLHttpRequest>"u")return 0;let a=new XMLHttpRequest;a.open(me(i),n,!1),a.responseType="arraybuffer";for(var s=0,_=r;s<_*2;){var o=F[t/4+s>>>0],c=F[t/4+s+1>>>0];console.log("HEAD",me(o),me(c));try{var u=encodeURI(me(o));u==="Host"&&(u="X-Host-Override"),u==="User-Agent"&&(u="X-user-agent"),u==="Authorization"?a.setRequestHeader(u,me(c)):a.setRequestHeader(u,encodeURI(me(c)))}catch(ce){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",ce)}s+=2}try{a.send(null)}catch(ce){return 0}if(a.status>=400)return 0;for(var f=a.response,_=f.byteLength,m=B(_+8),k=new Uint8Array(f),D=0;D<_;D++)l.HEAPU8[D+m+8]=k[D];var R=new Uint8Array(4);R[0]=_%256,_-=R[0],_/=256,R[1]=_%256,_-=R[1],_/=256,R[2]=_%256,_-=R[2],_/=256,R[3]=_%256,_-=R[3],_/=256,l.HEAPU8.set(R,m+4);var re=Uint8Array.from(Array.from(a.getAllResponseHeaders()).map(ce=>ce.charCodeAt(0)));_=re.byteLength;for(var de=B(_+8),D=0;D<_;D++)l.HEAPU8[D+de+8]=re[D];return R=new Uint8Array(4),R[0]=_%256,_-=R[0],_/=256,R[1]=_%256,_-=R[1],_/=256,R[2]=_%256,_-=R[2],_/=256,R[3]=_%256,_-=R[3],_/=256,l.HEAPU8.set(R,de+4),_=de,R=new Uint8Array(4),R[0]=_%256,_-=R[0],_/=256,R[1]=_%256,_-=R[1],_/=256,R[2]=_%256,_-=R[2],_/=256,R[3]=_%256,_-=R[3],_/=256,l.HEAPU8.set(R,m),m},10170588:(e,r,t,i)=>{var n=me(e);if(typeof XMLHttpRequest>"u")return 0;let a=new XMLHttpRequest;a.open(me(i),n,!1),a.responseType="arraybuffer";for(var s=0,_=r;s<_*2;){var o=F[t/4+s>>>0],c=F[t/4+s+1>>>0];try{var u=encodeURI(me(o));u==="Host"&&(u="X-Host-Override"),u==="User-Agent"&&(u="X-user-agent"),u==="Authorization"?a.setRequestHeader(u,me(c)):a.setRequestHeader(u,encodeURI(me(c)))}catch(re){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",re)}s+=2}try{a.send(null)}catch(re){return 0}if(a.status>=400)return 0;for(var f=a.response,_=f.byteLength,m=B(_+4),k=new Uint8Array(f),D=0;D<_;D++)l.HEAPU8[D+m+4]=k[D];var R=new Uint8Array(4);return R[0]=_%256,_-=R[0],_/=256,R[1]=_%256,_-=R[1],_/=256,R[2]=_%256,_-=R[2],_/=256,R[3]=_%256,_-=R[3],_/=256,l.HEAPU8.set(R,m),m},10171995:(e,r,t,i,n,a)=>{var s=me(e);if(typeof XMLHttpRequest>"u")return 0;let o=new XMLHttpRequest;o.open(me(i),s,!1),o.responseType="arraybuffer";for(var c=0,R=r;c<R*2;){var u=F[t/4+c>>>0],f=F[t/4+c+1>>>0];try{var _=encodeURI(me(u));_==="Host"&&(_="X-Host-Override"),_==="User-Agent"&&(_="X-user-agent"),_==="Authorization"?o.setRequestHeader(_,me(f)):o.setRequestHeader(_,encodeURI(me(f)))}catch(Ce){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ce)}c+=2}try{for(var m=new Uint8Array(a),k=0;k<a;k++)m[k]=l.HEAPU8[k+n];o.send(m)}catch(Ce){return 0}if(o.status>=400)return 0;for(var D=o.response,R=D.byteLength,re=B(R+4),de=new Uint8Array(D),k=0;k<R;k++)l.HEAPU8[k+re+4]=de[k];var ce=new Uint8Array(4);return ce[0]=R%256,R-=ce[0],R/=256,ce[1]=R%256,R-=ce[1],R/=256,ce[2]=R%256,R-=ce[2],R/=256,ce[3]=R%256,R-=ce[3],R/=256,l.HEAPU8.set(ce,re),re}};class Dr{constructor(r){At(this,"name","ExitStatus");this.message="Program terminated with exit(".concat(r,")"),this.status=r}}var Rr=e=>{for(;e.length>0;)e.shift()(l)},Cr=[],Jt=e=>Cr.unshift(e),Sr=[],Yt=e=>Sr.unshift(e),Qt=l.noExitRuntime||!0,p=e=>Ae(e),v=()=>Te(),Ne=[],sr=0,Qe=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN;function Jr(e){e>>>=0;var r=new He(e);return r.get_caught()||(r.set_caught(!0),sr--),r.set_rethrown(!1),Ne.push(r),___cxa_increment_exception_refcount(e),___cxa_get_exception_ptr(e)}function br(){if(!Ne.length)return 0;var e=Ne[Ne.length-1];return ___cxa_increment_exception_refcount(e.excPtr),e.excPtr}var Le=0,Fr=()=>{_setThrew(0,0);var e=Ne.pop();___cxa_decrement_exception_refcount(e.excPtr),Le=0};class He{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){ae[this.ptr+4>>>2>>>0]=r}get_type(){return ae[this.ptr+4>>>2>>>0]}set_destructor(r){ae[this.ptr+8>>>2>>>0]=r}get_destructor(){return ae[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,Y[this.ptr+12>>>0]=r}get_caught(){return Y[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,Y[this.ptr+13>>>0]=r}get_rethrown(){return Y[this.ptr+13>>>0]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){ae[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return ae[this.ptr+16>>>2>>>0]}}function Yr(e){throw e>>>=0,Le||(Le=e),Le}var Oe=e=>fe(e),mr=e=>{var r=Le;if(!r)return Oe(0),0;var t=new He(r);t.set_adjusted_ptr(r);var i=t.get_type();if(!i)return Oe(0),r;for(var n of e){if(n===0||n===i)break;var a=t.ptr+16;if(___cxa_can_catch(n,i,a))return Oe(n),r}return Oe(i),r};function zt(){return mr([])}function Zt(e){return e>>>=0,mr([e])}function ei(e,r){return e>>>=0,r>>>=0,mr([e,r])}function Qr(e,r,t){return e>>>=0,r>>>=0,t>>>=0,mr([e,r,t])}var Ur=()=>{var e=Ne.pop();e||Re("no exception to throw");var r=e.excPtr;throw e.get_rethrown()||(Ne.push(e),e.set_rethrown(!0),e.set_caught(!1),sr++),Le=r,Le};function be(e){if(e>>>=0,!!e){var r=new He(e);Ne.push(r),r.set_rethrown(!0),Ur()}}function xr(e,r,t){e>>>=0,r>>>=0,t>>>=0;var i=new He(e);throw i.init(r,t),Le=e,sr++,Le}var ri=()=>sr;function zr(){Re("missing function: $SOCKFS")}zr.stub=!0;function Hr(){Re("missing function: $FS")}Hr.stub=!0;var nr=e=>{var r=zr.getSocket(e);if(!r)throw new Hr.ErrnoError(8);return r},Ir=e=>(e&255)+"."+(e>>8&255)+"."+(e>>16&255)+"."+(e>>24&255),ze=e=>{var r="",t=0,i=0,n=0,a=0,s=0,o=0,c=[e[0]&65535,e[0]>>16,e[1]&65535,e[1]>>16,e[2]&65535,e[2]>>16,e[3]&65535,e[3]>>16],u=!0,f="";for(o=0;o<5;o++)if(c[o]!==0){u=!1;break}if(u){if(f=Ir(c[6]|c[7]<<16),c[5]===-1)return r="::ffff:",r+=f,r;if(c[5]===0)return r="::",f==="0.0.0.0"&&(f=""),f==="0.0.0.1"&&(f="1"),r+=f,r}for(t=0;t<8;t++)c[t]===0&&(t-n>1&&(s=0),n=t,s++),s>i&&(i=s,a=t-i+1);for(t=0;t<8;t++){if(i>1&&c[t]===0&&t>=a&&t<a+i){t===a&&(r+=":",a===0&&(r+=":"));continue}r+=Number(_ntohs(c[t]&65535)).toString(16),r+=t<7?":":""}return r},Zr=(e,r)=>{var t=J[e>>>1>>>0],i=_ntohs(ne[e+2>>>1>>>0]),n;switch(t){case 2:if(r!==16)return{errno:28};n=F[e+4>>>2>>>0],n=Ir(n);break;case 10:if(r!==28)return{errno:28};n=[F[e+8>>>2>>>0],F[e+12>>>2>>>0],F[e+16>>>2>>>0],F[e+20>>>2>>>0]],n=ze(n);break;default:return{errno:5}}return{family:t,addr:n,port:i}},gr=e=>{for(var r=e.split("."),t=0;t<4;t++){var i=Number(r[t]);if(isNaN(i))return null;r[t]=i}return(r[0]|r[1]<<8|r[2]<<16|r[3]<<24)>>>0},_r=e=>parseInt(e),or=e=>{var r,t,i,n,a=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,s=[];if(!a.test(e))return null;if(e==="::")return[0,0,0,0,0,0,0,0];for(e.startsWith("::")?e=e.replace("::","Z:"):e=e.replace("::",":Z:"),e.indexOf(".")>0?(e=e.replace(new RegExp("[.]","g"),":"),r=e.split(":"),r[r.length-4]=_r(r[r.length-4])+_r(r[r.length-3])*256,r[r.length-3]=_r(r[r.length-2])+_r(r[r.length-1])*256,r=r.slice(0,r.length-2)):r=e.split(":"),i=0,n=0,t=0;t<r.length;t++)if(typeof r[t]=="string")if(r[t]==="Z"){for(n=0;n<8-r.length+1;n++)s[t+n]=0;i=n-1}else s[t+i]=_htons(parseInt(r[t],16));else s[t+i]=r[t];return[s[1]<<16|s[0],s[3]<<16|s[2],s[5]<<16|s[4],s[7]<<16|s[6]]},Pe={address_map:{id:1,addrs:{},names:{}},lookup_name(e){var r=gr(e);if(r!==null||(r=or(e),r!==null))return e;var t;if(Pe.address_map.addrs[e])t=Pe.address_map.addrs[e];else{var i=Pe.address_map.id++;q(i<65535,"exceeded max address mappings of 65535"),t="172.29."+(i&255)+"."+(i&65280),Pe.address_map.names[t]=e,Pe.address_map.addrs[e]=t}return t},lookup_addr(e){return Pe.address_map.names[e]?Pe.address_map.names[e]:null}},et=(e,r)=>{var t=Zr(e,r);if(t.errno)throw new Hr.ErrnoError(t.errno);return t.addr=Pe.lookup_addr(t.addr)||t.addr,t};function ti(e,r,t,i,n,a){r>>>=0,t>>>=0;var s=nr(e),o=et(r,t);return s.sock_ops.bind(s,o.addr,o.port),0}function ii(e,r,t,i,n,a){r>>>=0,t>>>=0;var s=nr(e),o=et(r,t);return s.sock_ops.connect(s,o.addr,o.port),0}var ni=(e,r,t)=>{};function ai(e,r,t,i){r>>>=0}var rt=typeof TextDecoder<"u"?new TextDecoder:void 0,tt=(e,r=0,t=NaN)=>{r>>>=0;for(var i=r+t,n=r;e[n]&&!(n>=i);)++n;if(n-r>16&&e.buffer&&rt)return rt.decode(e.subarray(r,n));for(var a="";r<n;){var s=e[r++];if(!(s&128)){a+=String.fromCharCode(s);continue}var o=e[r++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|o);continue}var c=e[r++]&63;if((s&240)==224?s=(s&15)<<12|o<<6|c:s=(s&7)<<18|o<<12|c<<6|e[r++]&63,s<65536)a+=String.fromCharCode(s);else{var u=s-65536;a+=String.fromCharCode(55296|u>>10,56320|u&1023)}}return a},me=(e,r)=>(e>>>=0,e?tt(H,e,r):""),Br={varargs:void 0,getStr(e){var r=me(e);return r}};function si(e,r,t){return t>>>=0,Br.varargs=t,0}function oi(e,r){r>>>=0}function ci(e,r,t){var i=Qe(r,t)}var it=e=>{for(var r=0,t=0;t<e.length;++t){var i=e.charCodeAt(t);i<=127?r++:i<=2047?r+=2:i>=55296&&i<=57343?(r+=4,++t):r+=3}return r};l.lengthBytesUTF8=it;var ui=(e,r,t,i)=>{if(t>>>=0,!(i>0))return 0;for(var n=t,a=t+i-1,s=0;s<e.length;++s){var o=e.charCodeAt(s);if(o>=55296&&o<=57343){var c=e.charCodeAt(++s);o=65536+((o&1023)<<10)|c&1023}if(o<=127){if(t>=a)break;r[t++>>>0]=o}else if(o<=2047){if(t+1>=a)break;r[t++>>>0]=192|o>>6,r[t++>>>0]=128|o&63}else if(o<=65535){if(t+2>=a)break;r[t++>>>0]=224|o>>12,r[t++>>>0]=128|o>>6&63,r[t++>>>0]=128|o&63}else{if(t+3>=a)break;r[t++>>>0]=240|o>>18,r[t++>>>0]=128|o>>12&63,r[t++>>>0]=128|o>>6&63,r[t++>>>0]=128|o&63}}return r[t>>>0]=0,t-n},rr=(e,r,t)=>ui(e,H,r,t);l.stringToUTF8=rr;function li(e,r){e>>>=0,r>>>=0}function fi(e,r,t){r>>>=0,t>>>=0}var nt=(e,r)=>{H.fill(0,e,e+r)},dr=(e,r,t,i,n)=>{switch(r){case 2:t=gr(t),nt(e,16),n&&(F[n>>>2>>>0]=16),J[e>>>1>>>0]=r,F[e+4>>>2>>>0]=t,J[e+2>>>1>>>0]=_htons(i);break;case 10:t=or(t),nt(e,28),n&&(F[n>>>2>>>0]=28),F[e>>>2>>>0]=r,F[e+8>>>2>>>0]=t[0],F[e+12>>>2>>>0]=t[1],F[e+16>>>2>>>0]=t[2],F[e+20>>>2>>>0]=t[3],J[e+2>>>1>>>0]=_htons(i);break;default:return 5}return 0};function at(e,r,t,i,n,a){r>>>=0,t>>>=0;var s=nr(e);if(!s.daddr)return-53;var o=dr(r,s.family,Pe.lookup_name(s.daddr),s.dport,t);return 0}function st(e,r,t,i,n,a){r>>>=0,t>>>=0;var s=nr(e),o=dr(r,s.family,Pe.lookup_name(s.saddr||"0.0.0.0"),s.sport,t);return 0}function ot(e,r,t,i,n,a){i>>>=0,n>>>=0;var s=nr(e);return r===1&&t===4?(F[i>>>2>>>0]=s.error,F[n>>>2>>>0]=4,s.error=null,0):-50}function ct(e,r,t){return t>>>=0,Br.varargs=t,0}function _i(e,r){e>>>=0,r>>>=0}function di(e,r,t){r>>>=0}function hi(e,r,t,i){r>>>=0,t>>>=0}function vi(e,r,t,i){r>>>=0,i>>>=0,Br.varargs=i}function pi(e,r,t){e>>>=0}function wi(e,r,t,i){r>>>=0,t>>>=0,i>>>=0}function yi(e,r,t,i,n,a){r>>>=0,t>>>=0,n>>>=0,a>>>=0;var s=nr(e),o=s.sock_ops.recvmsg(s,t);if(!o)return 0;if(n)var c=dr(n,s.family,Pe.lookup_name(o.addr),o.port,a);return H.set(o.buffer,r>>>0),o.buffer.byteLength}function bi(e,r,t,i){r>>>=0,i>>>=0}function ut(e){e>>>=0}function lt(e,r,t,i,n,a){r>>>=0,t>>>=0,n>>>=0,a>>>=0}var mi=(e,r,t)=>{};function gi(e,r){e>>>=0,r>>>=0}function ji(e,r,t){e>>>=0,r>>>=0,t>>>=0}function ki(e,r,t){r>>>=0}var Ti=()=>Re(""),Ei=()=>{throw 1/0};function ft(){Re("missing function: _emval_call_method")}ft.stub=!0;function _t(){Re("missing function: _emval_decref")}_t.stub=!0;function dt(){Re("missing function: _emval_get_global")}dt.stub=!0;function ht(){Re("missing function: _emval_get_method_caller")}ht.stub=!0;function vt(){Re("missing function: _emval_run_destructors")}vt.stub=!0;var Ai=e=>e%4===0&&(e%100!==0||e%400===0),Di=[0,31,60,91,121,152,182,213,244,274,305,335],Ri=[0,31,59,90,120,151,181,212,243,273,304,334],Ci=e=>{var r=Ai(e.getFullYear()),t=r?Di:Ri,i=t[e.getMonth()]+e.getDate()-1;return i};function Si(e,r,t){var i=Qe(e,r);t>>>=0;var n=new Date(i*1e3);F[t>>>2>>>0]=n.getSeconds(),F[t+4>>>2>>>0]=n.getMinutes(),F[t+8>>>2>>>0]=n.getHours(),F[t+12>>>2>>>0]=n.getDate(),F[t+16>>>2>>>0]=n.getMonth(),F[t+20>>>2>>>0]=n.getFullYear()-1900,F[t+24>>>2>>>0]=n.getDay();var a=Ci(n)|0;F[t+28>>>2>>>0]=a,F[t+36>>>2>>>0]=-(n.getTimezoneOffset()*60);var s=new Date(n.getFullYear(),0,1),o=new Date(n.getFullYear(),6,1).getTimezoneOffset(),c=s.getTimezoneOffset(),u=(o!=c&&n.getTimezoneOffset()==Math.min(c,o))|0;F[t+32>>>2>>>0]=u}function Fi(e,r,t,i,n,a,s,o){e>>>=0;var c=Qe(n,a);return s>>>=0,o>>>=0,-52}function Ui(e,r,t,i,n,a,s){e>>>=0,r>>>=0;var o=Qe(a,s)}var xi=function(e,r,t,i){e>>>=0,r>>>=0,t>>>=0,i>>>=0;var n=new Date().getFullYear(),a=new Date(n,0,1),s=new Date(n,6,1),o=a.getTimezoneOffset(),c=s.getTimezoneOffset(),u=Math.max(o,c);ae[e>>>2>>>0]=u*60,F[r>>>2>>>0]=+(o!=c);var f=k=>{var D=k>=0?"-":"+",R=Math.abs(k),re=String(Math.floor(R/60)).padStart(2,"0"),de=String(R%60).padStart(2,"0");return"UTC".concat(D).concat(re).concat(de)},_=f(o),m=f(c);c<o?(rr(_,t,17),rr(m,i,17)):(rr(_,i,17),rr(m,t,17))},jr=()=>performance.now(),pt=()=>Date.now(),Hi=1,Ii=e=>e>=0&&e<=3;function wt(e,r,t,i){var n=Qe(r,t);if(i>>>=0,!Ii(e))return 28;var a;if(e===0)a=pt();else if(Hi)a=jr();else return 52;var s=Math.round(a*1e3*1e3);return xe=[s>>>0,(_e=s,+Math.abs(_e)>=1?_e>0?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)],F[i>>>2>>>0]=xe[0],F[i+4>>>2>>>0]=xe[1],0}function Bi(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.createDirectory(l,e,r)}function Ni(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.checkDirectory(l,e,r)}function Pi(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.listDirectoryEntries(l,e,r)}function Mi(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.removeDirectory(l,e,r)}function Nr(e){return globalThis.DUCKDB_RUNTIME.closeFile(l,e)}function Li(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.dropFile(l,e,r)}function hr(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.checkFile(l,e,r)}function Oi(e,r,t,i){return e>>>=0,t>>>=0,globalThis.DUCKDB_RUNTIME.moveFile(l,e,r,t,i)}function Wi(e,r){return globalThis.DUCKDB_RUNTIME.openFile(l,e,r)}function qi(e,r,t,i){return r>>>=0,globalThis.DUCKDB_RUNTIME.readFile(l,e,r,t,i)}function Ki(e,r){return globalThis.DUCKDB_RUNTIME.truncateFile(l,e,r)}function Gi(e,r,t,i){return r>>>=0,globalThis.DUCKDB_RUNTIME.writeFile(l,e,r,t,i)}function $i(e){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(e)}function yt(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.glob(l,e,r)}function Xi(e){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(l,e)}function Vi(e,r,t,i,n,a){return e>>>=0,t>>>=0,n>>>=0,globalThis.DUCKDB_RUNTIME.callScalarUDF(l,e,r,t,i,n,a)}var Pr=[],Ji=(e,r)=>{Pr.length=0;for(var t;t=H[e++>>>0];){var i=t!=105;i&=t!=112,r+=i&&r%8?4:0,Pr.push(t==112?ae[r>>>2>>>0]:t==105?F[r>>>2>>>0]:ve[r>>>3>>>0]),r+=i?8:4}return Pr},Yi=(e,r,t)=>{var i=Ji(r,t);return Vt[e](...i)};function Qi(e,r,t){return e>>>=0,r>>>=0,t>>>=0,Yi(e,r,t)}var bt=()=>4294901760;function zi(){return bt()}var Zi=(e,r)=>Math.ceil(e/r)*r,en=e=>{var r=z.buffer,t=(e-r.byteLength+65535)/65536|0;try{return z.grow(t),Ve(),1}catch(i){}};function rn(e){e>>>=0;var r=H.length,t=bt();if(e>t)return!1;for(var i=1;i<=4;i*=2){var n=r*(1+.2/i);n=Math.min(n,e+100663296);var a=Math.min(t,Zi(Math.max(e,n),65536)),s=en(a);if(s)return!0}return!1}var Mr={},tn=()=>V||"./this.program",vr=()=>{if(!vr.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:tn()};for(var t in Mr)Mr[t]===void 0?delete r[t]:r[t]=Mr[t];var i=[];for(var t in r)i.push("".concat(t,"=").concat(r[t]));vr.strings=i}return vr.strings},mt=(e,r)=>{for(var t=0;t<e.length;++t)Y[r++>>>0]=e.charCodeAt(t);Y[r>>>0]=0},nn=function(e,r){e>>>=0,r>>>=0;var t=0;return vr().forEach((i,n)=>{var a=r+t;ae[e+n*4>>>2>>>0]=a,mt(i,a),t+=i.length+1}),0},an=function(e,r){e>>>=0,r>>>=0;var t=vr();ae[e>>>2>>>0]=t.length;var i=0;return t.forEach(n=>i+=n.length+1),ae[r>>>2>>>0]=i,0},sn=0,on=()=>Qt||sn>0,kr=e=>{var r;X=e,on()||((r=l.onExit)==null||r.call(l,e),N=!0),ke(e,new Dr(e))},gt=(e,r)=>{X=e,kr(e)},jt=gt,kt=e=>52;function cn(e,r){r>>>=0;var t=0,i=0,n=0;{var a=2;e==0?t=2:(e==1||e==2)&&(t=64),n=1}return Y[r>>>0]=a,J[r+2>>>1>>>0]=n,xe=[t>>>0,(_e=t,+Math.abs(_e)>=1?_e>0?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)],F[r+8>>>2>>>0]=xe[0],F[r+12>>>2>>>0]=xe[1],xe=[i>>>0,(_e=i,+Math.abs(_e)>=1?_e>0?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)],F[r+16>>>2>>>0]=xe[0],F[r+20>>>2>>>0]=xe[1],0}function un(e,r,t,i,n,a){r>>>=0,t>>>=0;var s=Qe(i,n);return a>>>=0,52}function ln(e,r,t,i,n,a){r>>>=0,t>>>=0;var s=Qe(i,n);return a>>>=0,52}function fn(e,r,t,i){return r>>>=0,t>>>=0,i>>>=0,52}function Z(e,r,t,i,n){var a=Qe(r,t);return n>>>=0,70}var _n=e=>52,Ln=[null,[],[]],On=(e,r)=>{var t=Ln[e];r===0||r===10?((e===1?Fe:x)(tt(t)),t.length=0):t.push(r)};function Wn(e,r,t,i){r>>>=0,t>>>=0,i>>>=0;for(var n=0,a=0;a<t;a++){var s=ae[r>>>2>>>0],o=ae[r+4>>>2>>>0];r+=8;for(var c=0;c<o;c++)On(e,H[s+c>>>0]);n+=o}return ae[i>>>2>>>0]=n,0}function qn(e,r,t,i){e>>>=0,r>>>=0,t>>>=0,i>>>=0;var n=0,a=0,s=0,o=0,c=0,u=0,f;function _(m,k,D,R,re,de){var ce,Ce,Ue,tr;return Ce=m===10?28:16,re=m===10?ze(re):Ir(re),ce=B(Ce),tr=dr(ce,m,re,de),q(!tr),Ue=B(32),F[Ue+4>>>2>>>0]=m,F[Ue+8>>>2>>>0]=k,F[Ue+12>>>2>>>0]=D,ae[Ue+24>>>2>>>0]=R,ae[Ue+20>>>2>>>0]=ce,m===10?F[Ue+16>>>2>>>0]=28:F[Ue+16>>>2>>>0]=16,F[Ue+28>>>2>>>0]=0,Ue}if(t&&(s=F[t>>>2>>>0],o=F[t+4>>>2>>>0],c=F[t+8>>>2>>>0],u=F[t+12>>>2>>>0]),c&&!u&&(u=c===2?17:6),!c&&u&&(c=u===17?2:1),u===0&&(u=6),c===0&&(c=1),!e&&!r)return-2;if(s&-1088||t!==0&&F[t>>>2>>>0]&2&&!e)return-1;if(s&32)return-2;if(c!==0&&c!==1&&c!==2)return-7;if(o!==0&&o!==2&&o!==10)return-6;if(r&&(r=me(r),a=parseInt(r,10),isNaN(a)))return s&1024?-2:-8;if(!e)return o===0&&(o=2),s&1||(o===2?n=_htonl(2130706433):n=[0,0,0,_htonl(1)]),f=_(o,c,u,null,n,a),ae[i>>>2>>>0]=f,0;if(e=me(e),n=gr(e),n!==null)if(o===0||o===2)o=2;else if(o===10&&s&8)n=[0,0,_htonl(65535),n],o=10;else return-2;else if(n=or(e),n!==null)if(o===0||o===10)o=10;else return-2;return n!=null?(f=_(o,c,u,e,n,a),ae[i>>>2>>>0]=f,0):s&4?-2:(e=Pe.lookup_name(e),n=gr(e),o===0?o=2:o===10&&(n=[0,0,_htonl(65535),n]),f=_(o,c,u,null,n,a),ae[i>>>2>>>0]=f,0)}function Kn(e,r,t,i,n,a,s){e>>>=0,t>>>=0,n>>>=0;var o=Zr(e,r);if(o.errno)return-6;var c=o.port,u=o.addr,f=!1;if(t&&i){var _;if(s&1||!(_=Pe.lookup_addr(u))){if(s&8)return-2}else u=_;var m=rr(u,t,i);m+1>=i&&(f=!0)}if(n&&a){c=""+c;var m=rr(c,n,a);m+1>=a&&(f=!0)}return f?-12:0}function Gn(e){return e>>>=0,e}var $n=()=>{if(O){var e=["crypto"].map(require).pop();return r=>e.randomFillSync(r)}return r=>crypto.getRandomValues(r)},dn=e=>{(dn=$n())(e)};function Xn(e,r){return e>>>=0,r>>>=0,dn(H.subarray(e>>>0,e+r>>>0)),0}var Vn=e=>{if(e instanceof Dr||e=="unwind")return X;ke(1,e)},Lr=[],hn,K=e=>{var r=Lr[e];return r||(e>=Lr.length&&(Lr.length=e+1),Lr[e]=r=hn.get(e)),r},Jn=e=>{var r=l["_"+e];return r},Yn=(e,r)=>{Y.set(e,r>>>0)},Or=e=>qe(e);l.stackAlloc=Or;var Qn=e=>{var r=it(e)+1,t=Or(r);return rr(e,t,r),t},zn=(e,r,t,i,n)=>{var a={string:D=>{var R=0;return D!=null&&D!==0&&(R=Qn(D)),R},array:D=>{var R=Or(D.length);return Yn(D,R),R}};function s(D){return r==="string"?me(D):r==="boolean"?!!D:D}var o=Jn(e),c=[],u=0;if(i)for(var f=0;f<i.length;f++){var _=a[t[f]];_?(u===0&&(u=v()),c[f]=_(i[f])):c[f]=i[f]}var m=o(...c);function k(D){return u!==0&&p(u),s(D)}return m=k(m),m},Zn=e=>W(),ea={q:Jr,Sb:br,u:Fr,a:zt,k:Zt,B:ei,ka:Qr,Ma:Ur,Hb:be,s:xr,K:ri,c:Yr,fb:ti,kb:ii,Kg:ni,mh:ai,aa:si,lh:oi,Zb:ci,nh:li,gh:fi,eb:at,db:st,ib:ot,xa:ct,ih:_i,hh:di,jh:hi,Ka:vi,jb:pi,dh:wi,gb:yi,eh:bi,Za:ut,hb:lt,Ja:mi,kh:gi,oh:ji,_a:ki,sh:Ti,Lg:Ei,Hg:ft,Fg:_t,Jg:dt,Ig:ht,Gg:vt,cc:Si,Pc:Fi,Qc:Ui,hd:xi,og:wt,Xg:Bi,Yg:Ni,Vg:Pi,Wg:Mi,Wa:Nr,$g:Li,Tg:hr,Ug:Oi,_g:Wi,sa:qi,Zg:Ki,Xa:Gi,ah:$i,Sg:yt,Va:Xi,bh:Vi,oa:Qi,Ua:pt,lb:zi,Ca:jr,th:rn,Md:nn,Xd:an,Y:jt,la:kt,mf:cn,$b:un,_b:ln,Na:fn,Cg:Z,fh:_n,ya:Wn,Ia:qn,Ha:Kn,P:Ro,I:to,ea:fo,D:Ns,Ga:Xs,_:Ys,Ta:Do,ma:ws,Pa:No,ga:Zs,ba:no,Qa:Uo,T:ao,pc:Qf,jc:i_,Hf:Pc,qb:K_,Ic:Uf,Pd:Rl,hc:a_,ic:n_,V:Ks,Oa:ps,ta:Ao,qc:Yf,If:Nc,p:ks,E:Ws,ph:yo,rh:vo,S:oo,fa:Ps,wa:po,R:Os,qh:wo,$a:ho,Z:_o,d:Et,N:uo,G:lo,Ya:mo,C:Vs,pa:go,ja:jo,xc:qf,Da:bo,na:ko,b:fs,Ba:Io,xd:Gl,Ue:Tu,g:_s,ab:so,Aa:Po,za:Mo,j:vs,La:Ss,Qg:xo,ia:Bo,o:ds,bb:eo,v:Es,w:ms,H:Bs,Q:Is,X:gs,ha:As,r:js,A:Us,Og:Lo,U:$s,x:Gs,tb:O_,Nd:Sl,wd:$l,Ge:Pu,ud:Vl,yd:Kl,Id:Hl,Ud:kl,vd:Xl,vb:M_,ce:hl,Hd:Il,zd:ql,Yd:ml,He:Nu,Vd:jl,_d:yl,Ld:Fl,Te:Eu,qf:ru,Lf:Hc,te:Qu,we:Vu,fd:uf,Ag:$o,of:iu,Mf:xc,Gf:Mc,nf:nu,Ae:Ku,zg:Xo,td:Jl,sd:Yl,ke:sl,qg:tc,rf:eu,ze:Gu,re:Zu,fe:fl,rd:Ql,qd:zl,ld:nf,Rc:Ef,Re:Du,Jd:xl,Wd:gl,Vf:Tc,pg:ic,kg:oc,Ef:Oc,Uf:Ec,sb:W_,Ib:D_,Fb:C_,Wc:mf,Qb:b_,Tb:w_,Pb:m_,ng:nc,wf:Jc,vf:Yc,Ke:Hu,se:zu,pb:G_,tc:Xf,Kb:E_,vg:Qo,ub:L_,ue:Yu,lg:sc,Tf:Ac,Wf:kc,Pe:Cu,De:Ou,Jc:Ff,kd:af,Gb:R_,Jb:A_,Nf:Uc,$c:vf,hg:lc,Oe:Su,Mc:Rf,yc:Wf,Ne:Fu,Le:xu,uc:$f,vc:Gf,rc:Jf,Rf:Rc,bg:pc,ve:Ju,lc:r_,dd:ff,Df:Wc,Je:Iu,xf:Vc,Ve:ju,We:gu,wg:Yo,tg:Zo,Qf:Cc,Eg:qo,Qe:Ru,lf:au,Ed:Pl,wc:Kf,Ye:bu,zc:Of,Gd:Bl,Xe:mu,Bd:Ol,Bc:Mf,Ec:Bf,Tc:kf,kf:su,df:_u,Sd:El,Td:Tl,Fc:If,$e:pu,xe:Xu,hf:cu,Jf:Bc,Bf:Kc,Xb:d_,Ac:Lf,Yb:__,cf:du,Ad:Wl,Cc:Pf,yf:Xc,Oc:Af,Db:F_,le:al,Xc:bf,zb:I_,mb:V_,Qd:Dl,Eb:S_,nb:X_,sg:ec,ad:hf,mc:e_,ob:$_,bd:df,gc:s_,Gc:Hf,Yc:yf,sc:Vf,l:Ge,Ng:Oo,Rg:Co,Sa:So,h:ls,F:Hs,Ea:io,J:Qs,ua:Eo,Ra:Fo,Mg:Wo,W:xs,M:ro,va:To,e:$e,ra:bs,cb:zs,f:hs,Pg:Ho,i:ys,m:Fs,n:Cs,y:Ts,t:Ms,O:qs,L:Ds,$:Ls,Fa:Js,ca:co,qa:Rs,fg:_c,jf:ou,pf:tu,Hc:xf,Nc:Df,me:nl,zf:$c,Be:qu,Ie:Bu,sf:Zc,Zc:wf,af:vu,he:ul,Vb:v_,ug:zo,Af:Gc,Cd:Ll,Nb:j_,dc:u_,ec:c_,_c:pf,gd:cf,qe:el,Kd:Ul,Sc:Tf,Zd:bl,be:vl,Cb:U_,gg:fc,yg:Vo,da:ku,rb:q_,Pf:Sc,tf:zc,uf:Qc,Dc:Nf,bc:l_,ae:pl,ef:fu,ne:il,ge:ll,Rd:Al,ie:cl,Ob:g_,_f:bc,Vc:gf,Uc:jf,Dd:Ml,ag:wc,wb:P_,cg:vc,od:ef,xg:Jo,Kc:Sf,Yf:gc,Bg:Go,ig:uc,ed:lf,Kf:Ic,pe:rl,oe:tl,Rb:y_,Ub:p_,id:of,eg:dc,Mb:k_,$d:wl,md:tf,pd:Zl,bf:hu,Dg:Ko,je:ol,Fd:Nl,jd:sf,Zf:mc,$f:yc,Bb:x_,nd:rf,Ab:H_,rg:rc,jg:cc,Xf:jc,Me:Uu,mg:ac,Fe:Mu,Ee:Lu,ye:$u,yb:B_,xb:N_,Lb:T_,de:dl,Sf:Dc,kc:t_,oc:zf,dg:hc,Od:Cl,Wb:h_,Se:Au,_e:wu,ee:_l,nc:Zf,Of:Fc,Ze:yu,Ff:Lc,ac:f_,cd:_f,Cf:qc,Ce:Wu,fc:o_,Lc:Cf,gf:uu,ff:lu,z:Gn,ch:Xn},ee=await Xt(),ra=l._main=ee.wh,Oa=l._duckdb_web_fs_glob_add_path=ee.yh,Wa=l._duckdb_web_clear_response=ee.zh,qa=l._duckdb_web_fail_with=ee.Ah,Ka=l._duckdb_web_reset=ee.Bh,Ga=l._duckdb_web_connect=ee.Ch,$a=l._duckdb_web_disconnect=ee.Dh,Xa=l._duckdb_web_flush_files=ee.Eh,Va=l._duckdb_web_flush_file=ee.Fh,Ja=l._duckdb_web_open=ee.Gh,Ya=l._duckdb_web_get_global_file_info=ee.Hh,Qa=l._duckdb_web_collect_file_stats=ee.Ih,za=l._duckdb_web_export_file_stats=ee.Jh,Za=l._duckdb_web_fs_drop_file=ee.Kh,es=l._duckdb_web_fs_drop_files=ee.Lh,rs=l._duckdb_web_fs_glob_file_infos=ee.Mh,ts=l._duckdb_web_fs_get_file_info_by_id=ee.Nh,is=l._duckdb_web_fs_get_file_info_by_name=ee.Oh,ns=l._duckdb_web_fs_register_file_url=ee.Ph,as=l._duckdb_web_fs_register_file_buffer=ee.Qh,ss=l._duckdb_web_copy_file_to_buffer=ee.Rh,os=l._duckdb_web_copy_file_to_path=ee.Sh,ar=l._duckdb_web_get_version=ee.Th,cs=l._duckdb_web_get_feature_flags=ee.Uh,us=l._duckdb_web_tokenize=ee.Vh,ta=l._duckdb_web_tokenize_buffer=ee.Wh,ia=l._duckdb_web_udf_scalar_create=ee.Xh,na=l._duckdb_web_prepared_create=ee.Yh,aa=l._duckdb_web_prepared_create_buffer=ee.Zh,sa=l._duckdb_web_prepared_close=ee._h,oa=l._duckdb_web_prepared_run=ee.$h,ca=l._duckdb_web_prepared_send=ee.ai,Tt=l._duckdb_web_query_run=ee.bi,h=l._duckdb_web_query_run_buffer=ee.ci,b=l._duckdb_web_pending_query_start=ee.di,j=l._duckdb_web_pending_query_start_buffer=ee.ei,C=l._duckdb_web_pending_query_poll=ee.fi,U=l._duckdb_web_pending_query_cancel=ee.gi,I=l._duckdb_web_query_fetch_results=ee.hi,P=l._duckdb_web_get_tablenames=ee.ii,L=l._duckdb_web_get_tablenames_buffer=ee.ji,$=l._duckdb_web_insert_arrow_from_ipc_stream=ee.ki,te=l._duckdb_web_insert_csv_from_path=ee.li,le=l._duckdb_web_insert_json_from_path=ee.mi,B=l._malloc=ee.qi,pe=l._free=ee.ri,ge=l._calloc=ee.si,fe=ee.ui,W=ee.vi,Ae=ee.wi,qe=ee.xi,Te=ee.yi;function Ge(e){var r=v();try{K(e)()}catch(t){if(p(r),t!==t+0)throw t;_setThrew(1,0)}}function $e(e,r,t){var i=v();try{K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function Et(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function ls(e,r){var t=v();try{K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function fs(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function _s(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function ds(e,r,t,i,n,a){var s=v();try{return K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function hs(e,r,t,i){var n=v();try{K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function vs(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function ps(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function ws(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function ys(e,r,t,i,n){var a=v();try{K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function bs(e,r,t,i){var n=v();try{K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function ms(e,r,t,i,n,a,s,o){var c=v();try{return K(e)(r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function gs(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function js(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function ks(e){var r=v();try{return K(e)()}catch(t){if(p(r),t!==t+0)throw t;_setThrew(1,0)}}function Ts(e,r,t,i,n,a,s,o){var c=v();try{K(e)(r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Es(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function As(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Ds(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{K(e)(r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Rs(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R){var re=v();try{K(e)(r,t,i,n,a,s,o,c,u,f,_,m,k,D,R)}catch(de){if(p(re),de!==de+0)throw de;_setThrew(1,0)}}function Cs(e,r,t,i,n,a,s){var o=v();try{K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Ss(e,r,t,i,n,a){var s=v();try{return K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Fs(e,r,t,i,n,a){var s=v();try{K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Us(e,r,t,i,n,a,s,o,c,u,f,_,m,k){var D=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f,_,m,k)}catch(R){if(p(D),R!==R+0)throw R;_setThrew(1,0)}}function xs(e,r,t){var i=v();try{K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function Hs(e,r,t){var i=v();try{K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function Is(e,r,t,i,n,a,s,o,c,u){var f=v();try{return K(e)(r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Bs(e,r,t,i,n,a,s,o,c){var u=v();try{return K(e)(r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Ns(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function Ps(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Ms(e,r,t,i,n,a,s,o,c){var u=v();try{K(e)(r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Ls(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{K(e)(r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Os(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function Ws(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function qs(e,r,t,i,n,a,s,o,c,u){var f=v();try{K(e)(r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Ks(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function Gs(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de){var ce=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de)}catch(Ce){if(p(ce),Ce!==Ce+0)throw Ce;_setThrew(1,0)}}function $s(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re){var de=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re)}catch(ce){if(p(de),ce!==ce+0)throw ce;_setThrew(1,0)}}function Xs(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function Vs(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Js(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{K(e)(r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Ys(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function Qs(e,r,t,i){var n=v();try{K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function zs(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{K(e)(r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Zs(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function eo(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function ro(e,r,t,i){var n=v();try{K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function to(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function io(e,r,t,i,n,a,s){var o=v();try{K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function no(e,r,t,i,n,a){var s=v();try{return K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function ao(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function so(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function oo(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function co(e,r,t,i,n,a,s,o,c,u,f,_,m,k){var D=v();try{K(e)(r,t,i,n,a,s,o,c,u,f,_,m,k)}catch(R){if(p(D),R!==R+0)throw R;_setThrew(1,0)}}function uo(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function lo(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function fo(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function _o(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function ho(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function vo(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function po(e,r,t,i,n,a){var s=v();try{return K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function wo(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function yo(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function bo(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function mo(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function go(e,r,t,i,n,a){var s=v();try{return K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function jo(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function ko(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function To(e,r,t,i,n){var a=v();try{K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Eo(e,r,t,i,n){var a=v();try{K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Ao(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Do(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Ro(e){var r=v();try{return K(e)()}catch(t){if(p(r),t!==t+0)throw t;_setThrew(1,0)}}function Co(e,r,t,i,n,a,s){var o=v();try{K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function So(e,r,t,i,n,a,s,o){var c=v();try{K(e)(r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Fo(e,r,t,i,n,a,s){var o=v();try{K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Uo(e,r,t,i,n,a){var s=v();try{return K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function xo(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Ho(e,r,t,i,n,a){var s=v();try{K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Io(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Bo(e,r,t,i,n,a,s,o){var c=v();try{return K(e)(r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function No(e,r,t,i,n,a,s,o,c,u){var f=v();try{return K(e)(r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Po(e,r,t,i,n,a,s,o,c){var u=v();try{return K(e)(r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Mo(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Lo(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R){var re=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f,_,m,k,D,R)}catch(de){if(p(re),de!==de+0)throw de;_setThrew(1,0)}}function Oo(e,r,t,i,n,a){var s=v();try{K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Wo(e,r,t,i,n,a,s,o){var c=v();try{K(e)(r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function qo(e,r,t,i,n){var a=v();try{return dynCall_jiiii(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Ko(e,r,t,i,n,a,s){var o=v();try{dynCall_viijj(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Go(e,r,t,i,n,a,s){var o=v();try{dynCall_viijii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function $o(e,r,t,i,n,a,s){var o=v();try{return dynCall_iiiiij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Xo(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiiijj(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Vo(e,r,t,i,n,a){var s=v();try{dynCall_viiij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Jo(e,r,t,i,n){var a=v();try{dynCall_viij(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Yo(e,r){var t=v();try{return dynCall_ji(e,r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function Qo(e,r,t,i){var n=v();try{return dynCall_iij(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function zo(e,r,t,i,n,a,s){var o=v();try{dynCall_viiiij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Zo(e,r,t){var i=v();try{return dynCall_jii(e,r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function ec(e,r,t){var i=v();try{return dynCall_jj(e,r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function rc(e,r,t,i){var n=v();try{dynCall_vij(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function tc(e,r,t,i,n,a){var s=v();try{return dynCall_iiiij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function ic(e,r,t,i,n){var a=v();try{return dynCall_iiij(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function nc(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiijij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function ac(e,r,t,i,n,a,s,o){var c=v();try{dynCall_vijiiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function sc(e,r,t,i,n){var a=v();try{return dynCall_iiji(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function oc(e,r,t,i,n,a){var s=v();try{return dynCall_iiiji(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function cc(e,r,t,i,n){var a=v();try{dynCall_viji(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function uc(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viijiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function lc(e,r,t,i,n,a){var s=v();try{return dynCall_iijj(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function fc(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiiijjjii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function _c(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiiiiiij(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function dc(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viijij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function hc(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_vijijj(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function vc(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiijjjj(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function pc(e,r,t,i){var n=v();try{return dynCall_iji(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function wc(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiijjj(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function yc(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viijjji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function bc(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viiijj(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function mc(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viijjj(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function gc(e,r,t,i,n,a){var s=v();try{dynCall_viiji(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function jc(e,r,t,i,n,a){var s=v();try{dynCall_vijii(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function kc(e,r,t,i,n,a,s){var o=v();try{return dynCall_iijiii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Tc(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiiijjj(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Ec(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiijiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Ac(e,r,t,i,n,a){var s=v();try{return dynCall_iijii(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Dc(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_vijiiji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Rc(e,r,t){var i=v();try{return dynCall_ij(e,r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function Cc(e,r,t,i){var n=v();try{return dynCall_jiii(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function Sc(e,r,t,i,n,a,s){var o=v();try{dynCall_viiiji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Fc(e,r,t,i,n,a,s,o){var c=v();try{dynCall_vijjj(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Uc(e,r,t,i,n,a,s){var o=v();try{return dynCall_iijij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function xc(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiiijii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Hc(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiiiiijii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Ic(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viijiiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Bc(e,r,t,i,n,a){var s=v();try{return dynCall_jiiji(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Nc(e,r,t,i,n,a){var s=v();try{return dynCall_fiiji(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Pc(e,r,t,i,n,a){var s=v();try{return dynCall_diiji(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Mc(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiiiijiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Lc(e,r,t){var i=v();try{dynCall_vj(e,r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function Oc(e,r,t,i,n,a,s){var o=v();try{return dynCall_iiijii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Wc(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_ijjiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function qc(e,r,t,i,n,a,s){var o=v();try{dynCall_vjiiii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Kc(e,r,t,i,n,a,s){var o=v();try{return dynCall_jiijii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Gc(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viiiiji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function $c(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viiiiij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Xc(e,r,t,i){var n=v();try{return dynCall_jij(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function Vc(e){var r=v();try{return dynCall_j(e)}catch(t){if(p(r),t!==t+0)throw t;_setThrew(1,0)}}function Jc(e,r,t,i,n,a,s){var o=v();try{return dynCall_iiijj(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Yc(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiijji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Qc(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiijiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function zc(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viiijii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Zc(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiiiijiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function eu(e,r,t,i,n,a,s){var o=v();try{return dynCall_iiiiji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function ru(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiiiiji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function tu(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiiiiij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function iu(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiiiiji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function nu(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiiijiiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function au(e,r,t,i,n,a,s){var o=v();try{return dynCall_jiiiiii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function su(e,r,t,i,n,a){var s=v();try{return dynCall_jiiij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function ou(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiiiiiijij(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function cu(e,r,t,i,n){var a=v();try{return dynCall_jiij(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function uu(e,r,t,i,n,a,s){var o=v();try{dynCall_vjjii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function lu(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_vjjijij(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function fu(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiijiijij(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function _u(e,r,t,i,n,a,s){var o=v();try{return dynCall_jiiiji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function du(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiijiij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function hu(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viijijj(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function vu(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiiiijij(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function pu(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiiijij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function wu(e,r,t,i,n,a,s){var o=v();try{dynCall_vijji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function yu(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_vijjji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function bu(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiiiiiji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function mu(e,r,t,i,n,a,s){var o=v();try{return dynCall_jiiiij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function gu(e,r){var t=v();try{return dynCall_jf(e,r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function ju(e,r){var t=v();try{return dynCall_jd(e,r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function ku(e,r,t,i,n,a,s){var o=v();try{dynCall_viiijd(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Tu(e,r,t,i,n,a){var s=v();try{return dynCall_iiifj(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Eu(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiiiiij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Au(e,r,t,i,n,a){var s=v();try{dynCall_vijj(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Du(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiiijj(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Ru(e,r,t,i,n,a){var s=v();try{return dynCall_jiiiii(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Cu(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iijiiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Su(e,r,t,i,n,a,s){var o=v();try{return dynCall_iijji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Fu(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iijjiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Uu(e,r,t,i,n,a,s){var o=v();try{dynCall_vijiii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function xu(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iijjiiiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Hu(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiijjiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Iu(e,r,t,i,n,a,s){var o=v();try{return dynCall_ijjj(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Bu(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiiiijii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Nu(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce,Ce,Ue,tr){var pn=v();try{return dynCall_iiiiiiiijjjjjjii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce,Ce,Ue,tr)}catch(pr){if(p(pn),pr!==pr+0)throw pr;_setThrew(1,0)}}function Pu(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiiiiiiiij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Mu(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_vijiiiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Lu(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_vijiiiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Ou(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iijiiiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Wu(e,r,t,i,n,a,s,o){var c=v();try{dynCall_vjiiij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function qu(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiiiiji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Ku(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiiijiiiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Gu(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiiijii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function $u(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_vijiiiiiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Xu(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jiiijj(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Vu(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiiiijji(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Ju(e,r,t,i,n){var a=v();try{return dynCall_ijii(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Yu(e,r,t,i,n){var a=v();try{return dynCall_iijf(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Qu(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re){var de=v();try{return dynCall_iiiiiijiijjji(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re)}catch(ce){if(p(de),ce!==ce+0)throw ce;_setThrew(1,0)}}function zu(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_iiijjijiii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Zu(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiijiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function el(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiiijij(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function rl(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viijiiiiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function tl(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viijiiij(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function il(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiijiijj(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function nl(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiiiiijjj(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function al(e,r,t,i,n,a,s){var o=v();try{return dynCall_jijij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function sl(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiiijjj(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function ol(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viijji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function cl(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiijijj(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function ul(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiiiijjij(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function ll(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiijij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function fl(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiiijiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function _l(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_vijjiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function dl(e,r,t,i,n,a,s,o){var c=v();try{dynCall_vijiij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function hl(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiiiiiiij(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function vl(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiiijjij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function pl(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiijiiijii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function wl(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viijijiiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function yl(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiiiiiiji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function bl(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiiijjii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function ml(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiiiiiijj(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function gl(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiijjiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function jl(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiiiiij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function kl(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_iiiiiiiiijii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Tl(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiiijiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function El(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jiiijii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Al(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiijiji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Dl(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jijjj(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Rl(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_dijjj(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Cl(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_vijijjd(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Sl(e,r,t,i,n,a,s,o,c,u,f,_,m,k){var D=v();try{return dynCall_iiiiiiiiiiiji(e,r,t,i,n,a,s,o,c,u,f,_,m,k)}catch(R){if(p(D),R!==R+0)throw R;_setThrew(1,0)}}function Fl(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiiiiijji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Ul(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiiijj(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function xl(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiijji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Hl(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiiiiiiiji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Il(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiiiiiiji(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Bl(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_jiiiiijji(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Nl(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viijjii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Pl(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jiiiiiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Ml(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiijjiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Ll(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiiijii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Ol(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jiiiiji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Wl(e,r,t,i,n,a,s){var o=v();try{return dynCall_jiijj(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function ql(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_iiiiiiiijiii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Kl(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiiiiiiij(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Gl(e,r,t,i,n,a){var s=v();try{return dynCall_iiidj(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function $l(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R){var re=v();try{return dynCall_iiiiiiiiiiijiii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R)}catch(de){if(p(re),de!==de+0)throw de;_setThrew(1,0)}}function Xl(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce){var Ce=v();try{return dynCall_iiiiiiiiijiiiiiiii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce)}catch(Ue){if(p(Ce),Ue!==Ue+0)throw Ue;_setThrew(1,0)}}function Vl(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_iiiiiiiiiiji(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Jl(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiiijjii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Yl(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiiijjij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Ql(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiijiiiij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function zl(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiijiiij(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Zl(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D){var R=v();try{dynCall_viijijijiji(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D)}catch(re){if(p(R),re!==re+0)throw re;_setThrew(1,0)}}function ef(e,r,t,i,n,a,s,o,c,u,f,_,m,k){var D=v();try{dynCall_viiijjjjii(e,r,t,i,n,a,s,o,c,u,f,_,m,k)}catch(R){if(p(D),R!==R+0)throw R;_setThrew(1,0)}}function rf(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viijjjji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function tf(e,r,t,i,n,a,s,o,c,u,f,_,m,k){var D=v();try{dynCall_viijijijij(e,r,t,i,n,a,s,o,c,u,f,_,m,k)}catch(R){if(p(D),R!==R+0)throw R;_setThrew(1,0)}}function nf(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D){var R=v();try{return dynCall_iiiijiijjiii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D)}catch(re){if(p(R),re!==re+0)throw re;_setThrew(1,0)}}function af(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iijiiiiiij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function sf(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viijjiiij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function of(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viijiijji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function cf(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D){var R=v();try{dynCall_viiiijiijjii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D)}catch(re){if(p(R),re!==re+0)throw re;_setThrew(1,0)}}function uf(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce,Ce){var Ue=v();try{return dynCall_iiiiiijjiiiiiiiji(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce,Ce)}catch(tr){if(p(Ue),tr!==tr+0)throw tr;_setThrew(1,0)}}function lf(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viijiiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function ff(e,r,t,i,n,a){var s=v();try{return dynCall_ijji(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function _f(e,r,t,i,n){var a=v();try{dynCall_vjii(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function df(e,r,t,i,n){var a=v();try{return dynCall_jjj(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function hf(e,r,t,i){var n=v();try{return dynCall_jji(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function vf(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iijiji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function pf(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D){var R=v();try{dynCall_viiiijiiiiiiii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D)}catch(re){if(p(R),re!==re+0)throw re;_setThrew(1,0)}}function wf(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiiiijiiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function yf(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jjjij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function bf(e,r,t,i,n,a){var s=v();try{return dynCall_jijj(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function mf(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiijiiiji(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function gf(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiijji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function jf(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiijjii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function kf(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_jiiiijji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Tf(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiiijji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Ef(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiijij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Af(e,r,t,i,n){var a=v();try{return dynCall_jiji(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Df(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiiiiijij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Rf(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iijjii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Cf(e,r,t,i,n){var a=v();try{dynCall_vjj(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Sf(e,r,t,i,n,a){var s=v();try{dynCall_viijd(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Ff(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iijiiiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Uf(e,r,t,i){var n=v();try{return dynCall_dij(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function xf(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiiiiiji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Hf(e,r,t,i,n,a,s){var o=v();try{return dynCall_jjjii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function If(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_jiiijiijiii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Bf(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_jiiiijiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Nf(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiijiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Pf(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_jiijjiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Mf(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiiiijii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Lf(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiijiiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Of(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_jiiiiijiiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Wf(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iijjiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function qf(e,r,t,i,n){var a=v();try{return dynCall_iidj(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Kf(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiiiiiiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Gf(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iijjjii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function $f(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iijjji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Xf(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiijjj(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Vf(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jjjji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Jf(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iijjjj(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Yf(e,r,t,i,n,a,s){var o=v();try{return dynCall_fiiiij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Qf(e,r,t,i,n,a,s){var o=v();try{return dynCall_diiiij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function zf(e,r,t,i,n,a,s,o){var c=v();try{dynCall_vijiji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Zf(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_vijjij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function e_(e,r,t,i,n,a){var s=v();try{return dynCall_jjij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function r_(e,r,t,i,n,a){var s=v();try{return dynCall_ijij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function t_(e,r,t,i,n,a,s){var o=v();try{dynCall_vijij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function i_(e,r,t,i,n){var a=v();try{return dynCall_diij(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function n_(e,r,t,i,n,a){var s=v();try{return dynCall_djij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function a_(e,r,t){var i=v();try{return dynCall_dj(e,r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function s_(e,r,t,i,n,a){var s=v();try{return dynCall_jjjd(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function o_(e,r,t,i,n,a){var s=v();try{dynCall_vjij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function c_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiiijiiiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function u_(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiiijiiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function l_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiijiiiji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function f_(e,r,t,i){var n=v();try{dynCall_vji(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function __(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_jiijiiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function d_(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jiijiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function h_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_vijijjji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function v_(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiiiijjji(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function p_(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viijiijj(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function w_(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiijiij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function y_(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viijiij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function b_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiijiiijj(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function m_(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiijiijj(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function g_(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiijijjj(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function j_(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiiijiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function k_(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viijiji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function T_(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_vijiiiiji(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function E_(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiijjji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function A_(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iijiijj(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function D_(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_iiijiiiijj(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function R_(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iijiiijj(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function C_(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiijiiij(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function S_(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_jijjjj(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function F_(e,r,t,i,n,a,s){var o=v();try{return dynCall_jijiii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function U_(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiiijjj(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function x_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viijjjiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function H_(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viijjjjii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function I_(e,r,t,i,n,a,s){var o=v();try{return dynCall_jijji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function B_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_vijiiiiiiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function N_(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_vijiiiij(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function P_(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiijjjiii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function M_(e,r,t,i,n,a,s,o,c,u,f,_,m,k){var D=v();try{return dynCall_iiiiiiiiijji(e,r,t,i,n,a,s,o,c,u,f,_,m,k)}catch(R){if(p(D),R!==R+0)throw R;_setThrew(1,0)}}function L_(e,r,t,i,n){var a=v();try{return dynCall_iijd(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function O_(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce,Ce,Ue,tr){var pn=v();try{return dynCall_iiiiiiiiiiiijjidjii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce,Ce,Ue,tr)}catch(pr){if(p(pn),pr!==pr+0)throw pr;_setThrew(1,0)}}function W_(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiijiiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function q_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiijdjji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function K_(e,r,t,i,n,a,s){var o=v();try{return dynCall_diijj(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function G_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiijjijj(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function $_(e,r,t,i,n,a,s){var o=v();try{return dynCall_jjiji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function X_(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_jijjjjjd(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function V_(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jijjiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function J_(e){e=Object.assign({},e);var r=n=>a=>n(a)>>>0,t=n=>(a,s)=>n(a,s)>>>0,i=n=>()=>n()>>>0;return e.qi=r(e.qi),e.si=t(e.si),e.xi=r(e.xi),e.yi=i(e.yi),e.Ci=r(e.Ci),e}l.stackSave=v,l.stackRestore=p,l.stackAlloc=Or,l.getTempRet0=Zn,l.setTempRet0=Oe,l.ccall=zn;function Y_(){var e=ra,r=0,t=0;try{var i=e(r,t);return gt(i,!0),i}catch(n){return Vn(n)}}function vn(){if(Be>0){Je=vn;return}if(lr(),Be>0){Je=vn;return}function e(){var t;if(l.calledRun=!0,!N){fr(),E(l),(t=l.onRuntimeInitialized)==null||t.call(l);var r=l.noInitialRun;r||Y_(),Pt()}}l.setStatus?(l.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>l.setStatus(""),1),e()},1)):e()}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();return vn(),g=S,g}})();typeof Ia=="object"&&typeof Ht=="object"?(Ht.exports=Pn,Ht.exports.default=Pn):typeof define=="function"&&define.amd&&define([],()=>Pn)});var Ma=wr((Pa,Bt)=>{"use strict";var Mn=(()=>{var d;var w=typeof document<"u"?(d=document.currentScript)==null?void 0:d.src:void 0;return typeof __filename<"u"&&(w=w||__filename),async function(y={}){var g,l=y,E,T,S=new Promise((h,b)=>{E=h,T=b}),A=typeof window=="object",M=typeof WorkerGlobalScope<"u",O=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",Q=Object.assign({},l),ie=[],V="./this.program",ke=(h,b)=>{throw b},oe="";function Se(h){return l.locateFile?l.locateFile(h,oe):oe+h}var De,ye;if(O){var we=Bn(),Ie=Nn();oe=__dirname+"/",ye=h=>{h=Me(h)?new URL(h):h;var b=we.readFileSync(h);return b},De=async(h,b=!0)=>{h=Me(h)?new URL(h):h;var j=we.readFileSync(h,b?void 0:"utf8");return j},!l.thisProgram&&process.argv.length>1&&(V=process.argv[1].replace(/\\/g,"/")),ie=process.argv.slice(2),ke=(h,b)=>{throw process.exitCode=h,b}}else(A||M)&&(M?oe=self.location.href:typeof document<"u"&&document.currentScript&&(oe=document.currentScript.src),w&&(oe=w),oe.startsWith("blob:")?oe="":oe=oe.slice(0,oe.replace(/[?#].*/,"").lastIndexOf("/")+1),M&&(ye=h=>{var b=new XMLHttpRequest;return b.open("GET",h,!1),b.responseType="arraybuffer",b.send(null),new Uint8Array(b.response)}),De=async h=>{var b=await fetch(h,{credentials:"same-origin"});if(b.ok)return b.arrayBuffer();throw new Error(b.status+" : "+b.url)});var Fe=l.print||console.log.bind(console),x=l.printErr||console.error.bind(console);Object.assign(l,Q),Q=null,l.arguments&&(ie=l.arguments),l.thisProgram&&(V=l.thisProgram);var G=l.wasmBinary,z,N=!1,X;function q(h,b){h||Re(b)}var Y,H,J,ne,F,ae,Ke,ve,We=!1,Me=h=>h.startsWith("file://");function Ve(){var h=z.buffer;l.HEAP8=Y=new Int8Array(h),l.HEAP16=J=new Int16Array(h),l.HEAPU8=H=new Uint8Array(h),l.HEAPU16=ne=new Uint16Array(h),l.HEAP32=F=new Int32Array(h),l.HEAPU32=ae=new Uint32Array(h),l.HEAPF32=Ke=new Float32Array(h),l.HEAPF64=ve=new Float64Array(h)}function lr(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)Yt(l.preRun.shift());Rr(Sr)}function fr(){We=!0,Z.ua()}function yr(){}function Pt(){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)Jt(l.postRun.shift());Rr(Cr)}var Be=0,Je=null;function Mt(h){var b;Be++,(b=l.monitorRunDependencies)==null||b.call(l,Be)}function Lt(h){var j;if(Be--,(j=l.monitorRunDependencies)==null||j.call(l,Be),Be==0&&Je){var b=Je;Je=null,b()}}function Re(h){var j;(j=l.onAbort)==null||j.call(l,h),h="Aborted("+h+")",x(h),N=!0,h+=". Build with -sASSERTIONS for more info.",We&&___trap();var b=new WebAssembly.RuntimeError(h);throw T(b),b}var Ye;function Ot(){return Se("./duckdb-eh.wasm")}function Wt(h){if(h==Ye&&G)return new Uint8Array(G);if(ye)return ye(h);throw"both async and sync fetching of the wasm failed"}async function qt(h){if(!G)try{var b=await De(h);return new Uint8Array(b)}catch(j){}return Wt(h)}async function Kt(h,b){try{var j=await qt(h),C=await WebAssembly.instantiate(j,b);return C}catch(U){x("failed to asynchronously prepare wasm: ".concat(U)),Re(U)}}async function Gt(h,b,j){if(!h&&typeof WebAssembly.instantiateStreaming=="function"&&!O)try{var C=fetch(b,{credentials:"same-origin"}),U=await WebAssembly.instantiateStreaming(C,j);return U}catch(I){x("wasm streaming compile failed: ".concat(I)),x("falling back to ArrayBuffer instantiation")}return Kt(b,j)}function $t(){return{a:fn}}async function Xt(){function h(I,P){return Z=I.exports,Z=oa(Z),z=Z.ta,Ve(),Lt("wasm-instantiate"),Z}Mt("wasm-instantiate");function b(I){return h(I.instance)}var j=$t();if(l.instantiateWasm)return new Promise((I,P)=>{l.instantiateWasm(j,(L,$)=>{h(L,$),I(L.exports)})});Ye!=null||(Ye=Ot());try{var C=await Gt(G,Ye,j),U=b(C);return U}catch(I){return T(I),Promise.reject(I)}}var _e,xe,Vt={10168112:(h,b,j,C)=>{var U=be(h);if(typeof XMLHttpRequest>"u")return 0;let I=new XMLHttpRequest;I.open(be(C),U,!1),I.responseType="arraybuffer";for(var P=0,B=b;P<B*2;){var L=F[j/4+P>>>0],$=F[j/4+P+1>>>0];try{var te=encodeURI(be(L));te==="Host"&&(te="X-Host-Override"),te==="User-Agent"&&(te="X-user-agent"),te==="Authorization"?I.setRequestHeader(te,be($)):I.setRequestHeader(te,encodeURI(be($)))}catch(Ae){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ae)}P+=2}try{I.send(null)}catch(Ae){return 0}if(I.status>=400)return 0;for(var le=I.response,B=le.byteLength,pe=ar(B+4),ge=new Uint8Array(le),fe=0;fe<B;fe++)l.HEAPU8[fe+pe+4]=ge[fe];var W=new Uint8Array(4);return W[0]=B%256,B-=W[0],B/=256,W[1]=B%256,B-=W[1],B/=256,W[2]=B%256,B-=W[2],B/=256,W[3]=B%256,B-=W[3],B/=256,l.HEAPU8.set(W,pe),pe},10169519:(h,b,j,C,U,I)=>{var P=be(h);if(typeof XMLHttpRequest>"u")return 0;let L=new XMLHttpRequest;L.open(be(C),P,!1),L.responseType="arraybuffer";for(var $=0,W=b;$<W*2;){var te=F[j/4+$>>>0],le=F[j/4+$+1>>>0];try{var B=encodeURI(be(te));B==="Host"&&(B="X-Host-Override"),B==="User-Agent"&&(B="X-user-agent"),B==="Authorization"?L.setRequestHeader(B,be(le)):L.setRequestHeader(B,encodeURI(be(le)))}catch(Ge){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ge)}$+=2}try{for(var pe=new Uint8Array(I),ge=0;ge<I;ge++)pe[ge]=l.HEAPU8[ge+U];L.send(pe)}catch(Ge){return 0}if(L.status>=400)return 0;for(var fe=Uint8Array.from(Array.from(L.getResponseHeader("Etag")).map(Ge=>Ge.charCodeAt(0))),W=fe.byteLength,Ae=ar(W+4),qe=new Uint8Array(fe),ge=0;ge<W;ge++)l.HEAPU8[ge+Ae+4]=qe[ge];var Te=new Uint8Array(4);return Te[0]=W%256,W-=Te[0],W/=256,Te[1]=W%256,W-=Te[1],W/=256,Te[2]=W%256,W-=Te[2],W/=256,Te[3]=W%256,W-=Te[3],W/=256,l.HEAPU8.set(Te,Ae),Ae},10171139:(h,b,j,C)=>{var U=be(h);if(typeof XMLHttpRequest>"u")return 0;let I=new XMLHttpRequest;I.open(be(C),U,!1),I.responseType="arraybuffer";for(var P=0,B=b;P<B*2;){var L=F[j/4+P>>>0],$=F[j/4+P+1>>>0];console.log("HEAD",be(L),be($));try{var te=encodeURI(be(L));te==="Host"&&(te="X-Host-Override"),te==="User-Agent"&&(te="X-user-agent"),te==="Authorization"?I.setRequestHeader(te,be($)):I.setRequestHeader(te,encodeURI(be($)))}catch(Te){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Te)}P+=2}try{I.send(null)}catch(Te){return 0}if(I.status>=400)return 0;for(var le=I.response,B=le.byteLength,pe=ar(B+8),ge=new Uint8Array(le),fe=0;fe<B;fe++)l.HEAPU8[fe+pe+8]=ge[fe];var W=new Uint8Array(4);W[0]=B%256,B-=W[0],B/=256,W[1]=B%256,B-=W[1],B/=256,W[2]=B%256,B-=W[2],B/=256,W[3]=B%256,B-=W[3],B/=256,l.HEAPU8.set(W,pe+4);var Ae=Uint8Array.from(Array.from(I.getAllResponseHeaders()).map(Te=>Te.charCodeAt(0)));B=Ae.byteLength;for(var qe=ar(B+8),fe=0;fe<B;fe++)l.HEAPU8[fe+qe+8]=Ae[fe];return W=new Uint8Array(4),W[0]=B%256,B-=W[0],B/=256,W[1]=B%256,B-=W[1],B/=256,W[2]=B%256,B-=W[2],B/=256,W[3]=B%256,B-=W[3],B/=256,l.HEAPU8.set(W,qe+4),B=qe,W=new Uint8Array(4),W[0]=B%256,B-=W[0],B/=256,W[1]=B%256,B-=W[1],B/=256,W[2]=B%256,B-=W[2],B/=256,W[3]=B%256,B-=W[3],B/=256,l.HEAPU8.set(W,pe),pe},10173484:(h,b,j,C)=>{var U=be(h);if(typeof XMLHttpRequest>"u")return 0;let I=new XMLHttpRequest;I.open(be(C),U,!1),I.responseType="arraybuffer";for(var P=0,B=b;P<B*2;){var L=F[j/4+P>>>0],$=F[j/4+P+1>>>0];try{var te=encodeURI(be(L));te==="Host"&&(te="X-Host-Override"),te==="User-Agent"&&(te="X-user-agent"),te==="Authorization"?I.setRequestHeader(te,be($)):I.setRequestHeader(te,encodeURI(be($)))}catch(Ae){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ae)}P+=2}try{I.send(null)}catch(Ae){return 0}if(I.status>=400)return 0;for(var le=I.response,B=le.byteLength,pe=ar(B+4),ge=new Uint8Array(le),fe=0;fe<B;fe++)l.HEAPU8[fe+pe+4]=ge[fe];var W=new Uint8Array(4);return W[0]=B%256,B-=W[0],B/=256,W[1]=B%256,B-=W[1],B/=256,W[2]=B%256,B-=W[2],B/=256,W[3]=B%256,B-=W[3],B/=256,l.HEAPU8.set(W,pe),pe},10174891:(h,b,j,C,U,I)=>{var P=be(h);if(typeof XMLHttpRequest>"u")return 0;let L=new XMLHttpRequest;L.open(be(C),P,!1),L.responseType="arraybuffer";for(var $=0,W=b;$<W*2;){var te=F[j/4+$>>>0],le=F[j/4+$+1>>>0];try{var B=encodeURI(be(te));B==="Host"&&(B="X-Host-Override"),B==="User-Agent"&&(B="X-user-agent"),B==="Authorization"?L.setRequestHeader(B,be(le)):L.setRequestHeader(B,encodeURI(be(le)))}catch(Ge){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ge)}$+=2}try{for(var pe=new Uint8Array(I),ge=0;ge<I;ge++)pe[ge]=l.HEAPU8[ge+U];L.send(pe)}catch(Ge){return 0}if(L.status>=400)return 0;for(var fe=L.response,W=fe.byteLength,Ae=ar(W+4),qe=new Uint8Array(fe),ge=0;ge<W;ge++)l.HEAPU8[ge+Ae+4]=qe[ge];var Te=new Uint8Array(4);return Te[0]=W%256,W-=Te[0],W/=256,Te[1]=W%256,W-=Te[1],W/=256,Te[2]=W%256,W-=Te[2],W/=256,Te[3]=W%256,W-=Te[3],W/=256,l.HEAPU8.set(Te,Ae),Ae}};class Dr{constructor(b){At(this,"name","ExitStatus");this.message="Program terminated with exit(".concat(b,")"),this.status=b}}var Rr=h=>{for(;h.length>0;)h.shift()(l)},Cr=[],Jt=h=>Cr.unshift(h),Sr=[],Yt=h=>Sr.unshift(h),Qt=l.noExitRuntime||!0;function p(){Re("missing function: $SOCKFS")}p.stub=!0;function v(){Re("missing function: $FS")}v.stub=!0;var Ne=h=>{var b=p.getSocket(h);if(!b)throw new v.ErrnoError(8);return b},sr=h=>(h&255)+"."+(h>>8&255)+"."+(h>>16&255)+"."+(h>>24&255),Qe=h=>{var b="",j=0,C=0,U=0,I=0,P=0,L=0,$=[h[0]&65535,h[0]>>16,h[1]&65535,h[1]>>16,h[2]&65535,h[2]>>16,h[3]&65535,h[3]>>16],te=!0,le="";for(L=0;L<5;L++)if($[L]!==0){te=!1;break}if(te){if(le=sr($[6]|$[7]<<16),$[5]===-1)return b="::ffff:",b+=le,b;if($[5]===0)return b="::",le==="0.0.0.0"&&(le=""),le==="0.0.0.1"&&(le="1"),b+=le,b}for(j=0;j<8;j++)$[j]===0&&(j-U>1&&(P=0),U=j,P++),P>C&&(C=P,I=j-C+1);for(j=0;j<8;j++){if(C>1&&$[j]===0&&j>=I&&j<I+C){j===I&&(b+=":",I===0&&(b+=":"));continue}b+=Number(_ntohs($[j]&65535)).toString(16),b+=j<7?":":""}return b},Jr=(h,b)=>{var j=J[h>>>1>>>0],C=_ntohs(ne[h+2>>>1>>>0]),U;switch(j){case 2:if(b!==16)return{errno:28};U=F[h+4>>>2>>>0],U=sr(U);break;case 10:if(b!==28)return{errno:28};U=[F[h+8>>>2>>>0],F[h+12>>>2>>>0],F[h+16>>>2>>>0],F[h+20>>>2>>>0]],U=Qe(U);break;default:return{errno:5}}return{family:j,addr:U,port:C}},br=h=>{for(var b=h.split("."),j=0;j<4;j++){var C=Number(b[j]);if(isNaN(C))return null;b[j]=C}return(b[0]|b[1]<<8|b[2]<<16|b[3]<<24)>>>0},Le=h=>parseInt(h),Fr=h=>{var b,j,C,U,I=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,P=[];if(!I.test(h))return null;if(h==="::")return[0,0,0,0,0,0,0,0];for(h.startsWith("::")?h=h.replace("::","Z:"):h=h.replace("::",":Z:"),h.indexOf(".")>0?(h=h.replace(new RegExp("[.]","g"),":"),b=h.split(":"),b[b.length-4]=Le(b[b.length-4])+Le(b[b.length-3])*256,b[b.length-3]=Le(b[b.length-2])+Le(b[b.length-1])*256,b=b.slice(0,b.length-2)):b=h.split(":"),C=0,U=0,j=0;j<b.length;j++)if(typeof b[j]=="string")if(b[j]==="Z"){for(U=0;U<8-b.length+1;U++)P[j+U]=0;C=U-1}else P[j+C]=_htons(parseInt(b[j],16));else P[j+C]=b[j];return[P[1]<<16|P[0],P[3]<<16|P[2],P[5]<<16|P[4],P[7]<<16|P[6]]},He={address_map:{id:1,addrs:{},names:{}},lookup_name(h){var b=br(h);if(b!==null||(b=Fr(h),b!==null))return h;var j;if(He.address_map.addrs[h])j=He.address_map.addrs[h];else{var C=He.address_map.id++;q(C<65535,"exceeded max address mappings of 65535"),j="172.29."+(C&255)+"."+(C&65280),He.address_map.names[j]=h,He.address_map.addrs[h]=j}return j},lookup_addr(h){return He.address_map.names[h]?He.address_map.names[h]:null}},Yr=(h,b)=>{var j=Jr(h,b);if(j.errno)throw new v.ErrnoError(j.errno);return j.addr=He.lookup_addr(j.addr)||j.addr,j},Oe=(h,b)=>b+2097152>>>0<4194305-!!h?(h>>>0)+b*4294967296:NaN;function mr(h,b,j,C,U,I){b>>>=0,j>>>=0;var P=Ne(h),L=Yr(b,j);return P.sock_ops.bind(P,L.addr,L.port),0}function zt(h,b,j,C,U,I){b>>>=0,j>>>=0;var P=Ne(h),L=Yr(b,j);return P.sock_ops.connect(P,L.addr,L.port),0}var Zt=(h,b,j)=>{};function ei(h,b,j,C){b>>>=0}var Qr=typeof TextDecoder<"u"?new TextDecoder:void 0,Ur=(h,b=0,j=NaN)=>{b>>>=0;for(var C=b+j,U=b;h[U]&&!(U>=C);)++U;if(U-b>16&&h.buffer&&Qr)return Qr.decode(h.subarray(b,U));for(var I="";b<U;){var P=h[b++];if(!(P&128)){I+=String.fromCharCode(P);continue}var L=h[b++]&63;if((P&224)==192){I+=String.fromCharCode((P&31)<<6|L);continue}var $=h[b++]&63;if((P&240)==224?P=(P&15)<<12|L<<6|$:P=(P&7)<<18|L<<12|$<<6|h[b++]&63,P<65536)I+=String.fromCharCode(P);else{var te=P-65536;I+=String.fromCharCode(55296|te>>10,56320|te&1023)}}return I},be=(h,b)=>(h>>>=0,h?Ur(H,h,b):""),xr={varargs:void 0,getStr(h){var b=be(h);return b}};function ri(h,b,j){return j>>>=0,xr.varargs=j,0}function zr(h,b){b>>>=0}function Hr(h,b,j){var C=Oe(b,j)}var nr=h=>{for(var b=0,j=0;j<h.length;++j){var C=h.charCodeAt(j);C<=127?b++:C<=2047?b+=2:C>=55296&&C<=57343?(b+=4,++j):b+=3}return b};l.lengthBytesUTF8=nr;var Ir=(h,b,j,C)=>{if(j>>>=0,!(C>0))return 0;for(var U=j,I=j+C-1,P=0;P<h.length;++P){var L=h.charCodeAt(P);if(L>=55296&&L<=57343){var $=h.charCodeAt(++P);L=65536+((L&1023)<<10)|$&1023}if(L<=127){if(j>=I)break;b[j++>>>0]=L}else if(L<=2047){if(j+1>=I)break;b[j++>>>0]=192|L>>6,b[j++>>>0]=128|L&63}else if(L<=65535){if(j+2>=I)break;b[j++>>>0]=224|L>>12,b[j++>>>0]=128|L>>6&63,b[j++>>>0]=128|L&63}else{if(j+3>=I)break;b[j++>>>0]=240|L>>18,b[j++>>>0]=128|L>>12&63,b[j++>>>0]=128|L>>6&63,b[j++>>>0]=128|L&63}}return b[j>>>0]=0,j-U},ze=(h,b,j)=>Ir(h,H,b,j);l.stringToUTF8=ze;function Zr(h,b){h>>>=0,b>>>=0}function gr(h,b,j){b>>>=0,j>>>=0}var _r=(h,b)=>{H.fill(0,h,h+b)},or=(h,b,j,C,U)=>{switch(b){case 2:j=br(j),_r(h,16),U&&(F[U>>>2>>>0]=16),J[h>>>1>>>0]=b,F[h+4>>>2>>>0]=j,J[h+2>>>1>>>0]=_htons(C);break;case 10:j=Fr(j),_r(h,28),U&&(F[U>>>2>>>0]=28),F[h>>>2>>>0]=b,F[h+8>>>2>>>0]=j[0],F[h+12>>>2>>>0]=j[1],F[h+16>>>2>>>0]=j[2],F[h+20>>>2>>>0]=j[3],J[h+2>>>1>>>0]=_htons(C);break;default:return 5}return 0};function Pe(h,b,j,C,U,I){b>>>=0,j>>>=0;var P=Ne(h);if(!P.daddr)return-53;var L=or(b,P.family,He.lookup_name(P.daddr),P.dport,j);return 0}function et(h,b,j,C,U,I){b>>>=0,j>>>=0;var P=Ne(h),L=or(b,P.family,He.lookup_name(P.saddr||"0.0.0.0"),P.sport,j);return 0}function ti(h,b,j,C,U,I){C>>>=0,U>>>=0;var P=Ne(h);return b===1&&j===4?(F[C>>>2>>>0]=P.error,F[U>>>2>>>0]=4,P.error=null,0):-50}function ii(h,b,j){return j>>>=0,xr.varargs=j,0}function ni(h,b){h>>>=0,b>>>=0}function ai(h,b,j){b>>>=0}function rt(h,b,j,C){b>>>=0,j>>>=0}function tt(h,b,j,C){b>>>=0,C>>>=0,xr.varargs=C}function me(h,b,j){h>>>=0}function Br(h,b,j,C){b>>>=0,j>>>=0,C>>>=0}function si(h,b,j,C,U,I){b>>>=0,j>>>=0,U>>>=0,I>>>=0;var P=Ne(h),L=P.sock_ops.recvmsg(P,j);if(!L)return 0;if(U)var $=or(U,P.family,He.lookup_name(L.addr),L.port,I);return H.set(L.buffer,b>>>0),L.buffer.byteLength}function oi(h,b,j,C){b>>>=0,C>>>=0}function ci(h){h>>>=0}function it(h,b,j,C,U,I){b>>>=0,j>>>=0,U>>>=0,I>>>=0}var ui=(h,b,j)=>{};function rr(h,b){h>>>=0,b>>>=0}function li(h,b,j){h>>>=0,b>>>=0,j>>>=0}function fi(h,b,j){b>>>=0}var nt=()=>Re("");function dr(){Re("missing function: _emval_call_method")}dr.stub=!0;function at(){Re("missing function: _emval_decref")}at.stub=!0;function st(){Re("missing function: _emval_get_global")}st.stub=!0;function ot(){Re("missing function: _emval_get_method_caller")}ot.stub=!0;function ct(){Re("missing function: _emval_run_destructors")}ct.stub=!0;var _i=h=>h%4===0&&(h%100!==0||h%400===0),di=[0,31,60,91,121,152,182,213,244,274,305,335],hi=[0,31,59,90,120,151,181,212,243,273,304,334],vi=h=>{var b=_i(h.getFullYear()),j=b?di:hi,C=j[h.getMonth()]+h.getDate()-1;return C};function pi(h,b,j){var C=Oe(h,b);j>>>=0;var U=new Date(C*1e3);F[j>>>2>>>0]=U.getSeconds(),F[j+4>>>2>>>0]=U.getMinutes(),F[j+8>>>2>>>0]=U.getHours(),F[j+12>>>2>>>0]=U.getDate(),F[j+16>>>2>>>0]=U.getMonth(),F[j+20>>>2>>>0]=U.getFullYear()-1900,F[j+24>>>2>>>0]=U.getDay();var I=vi(U)|0;F[j+28>>>2>>>0]=I,F[j+36>>>2>>>0]=-(U.getTimezoneOffset()*60);var P=new Date(U.getFullYear(),0,1),L=new Date(U.getFullYear(),6,1).getTimezoneOffset(),$=P.getTimezoneOffset(),te=(L!=$&&U.getTimezoneOffset()==Math.min($,L))|0;F[j+32>>>2>>>0]=te}function wi(h,b,j,C,U,I,P,L){h>>>=0;var $=Oe(U,I);return P>>>=0,L>>>=0,-52}function yi(h,b,j,C,U,I,P){h>>>=0,b>>>=0;var L=Oe(I,P)}var bi=function(h,b,j,C){h>>>=0,b>>>=0,j>>>=0,C>>>=0;var U=new Date().getFullYear(),I=new Date(U,0,1),P=new Date(U,6,1),L=I.getTimezoneOffset(),$=P.getTimezoneOffset(),te=Math.max(L,$);ae[h>>>2>>>0]=te*60,F[b>>>2>>>0]=+(L!=$);var le=ge=>{var fe=ge>=0?"-":"+",W=Math.abs(ge),Ae=String(Math.floor(W/60)).padStart(2,"0"),qe=String(W%60).padStart(2,"0");return"UTC".concat(fe).concat(Ae).concat(qe)},B=le(L),pe=le($);$<L?(ze(B,j,17),ze(pe,C,17)):(ze(B,C,17),ze(pe,j,17))},ut=()=>performance.now(),lt=()=>Date.now(),mi=1,gi=h=>h>=0&&h<=3;function ji(h,b,j,C){var U=Oe(b,j);if(C>>>=0,!gi(h))return 28;var I;if(h===0)I=lt();else if(mi)I=ut();else return 52;var P=Math.round(I*1e3*1e3);return xe=[P>>>0,(_e=P,+Math.abs(_e)>=1?_e>0?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)],F[C>>>2>>>0]=xe[0],F[C+4>>>2>>>0]=xe[1],0}function ki(h,b){return h>>>=0,globalThis.DUCKDB_RUNTIME.createDirectory(l,h,b)}function Ti(h,b){return h>>>=0,globalThis.DUCKDB_RUNTIME.checkDirectory(l,h,b)}function Ei(h,b){return h>>>=0,globalThis.DUCKDB_RUNTIME.listDirectoryEntries(l,h,b)}function ft(h,b){return h>>>=0,globalThis.DUCKDB_RUNTIME.removeDirectory(l,h,b)}function _t(h){return globalThis.DUCKDB_RUNTIME.closeFile(l,h)}function dt(h,b){return h>>>=0,globalThis.DUCKDB_RUNTIME.dropFile(l,h,b)}function ht(h,b){return h>>>=0,globalThis.DUCKDB_RUNTIME.checkFile(l,h,b)}function vt(h,b,j,C){return h>>>=0,j>>>=0,globalThis.DUCKDB_RUNTIME.moveFile(l,h,b,j,C)}function Ai(h,b){return globalThis.DUCKDB_RUNTIME.openFile(l,h,b)}function Di(h,b,j,C){return b>>>=0,globalThis.DUCKDB_RUNTIME.readFile(l,h,b,j,C)}function Ri(h,b){return globalThis.DUCKDB_RUNTIME.truncateFile(l,h,b)}function Ci(h,b,j,C){return b>>>=0,globalThis.DUCKDB_RUNTIME.writeFile(l,h,b,j,C)}function Si(h){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(h)}function Fi(h,b){return h>>>=0,globalThis.DUCKDB_RUNTIME.glob(l,h,b)}function Ui(h){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(l,h)}function xi(h,b,j,C,U,I){return h>>>=0,j>>>=0,U>>>=0,globalThis.DUCKDB_RUNTIME.callScalarUDF(l,h,b,j,C,U,I)}var jr=[],pt=(h,b)=>{jr.length=0;for(var j;j=H[h++>>>0];){var C=j!=105;C&=j!=112,b+=C&&b%8?4:0,jr.push(j==112?ae[b>>>2>>>0]:j==105?F[b>>>2>>>0]:ve[b>>>3>>>0]),b+=C?8:4}return jr},Hi=(h,b,j)=>{var C=pt(b,j);return Vt[h](...C)};function Ii(h,b,j){return h>>>=0,b>>>=0,j>>>=0,Hi(h,b,j)}var wt=()=>4294901760;function Bi(){return wt()}var Ni=(h,b)=>Math.ceil(h/b)*b,Pi=h=>{var b=z.buffer,j=(h-b.byteLength+65535)/65536|0;try{return z.grow(j),Ve(),1}catch(C){}};function Mi(h){h>>>=0;var b=H.length,j=wt();if(h>j)return!1;for(var C=1;C<=4;C*=2){var U=b*(1+.2/C);U=Math.min(U,h+100663296);var I=Math.min(j,Ni(Math.max(h,U),65536)),P=Pi(I);if(P)return!0}return!1}var Nr={},Li=()=>V||"./this.program",hr=()=>{if(!hr.strings){var h=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",b={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:h,_:Li()};for(var j in Nr)Nr[j]===void 0?delete b[j]:b[j]=Nr[j];var C=[];for(var j in b)C.push("".concat(j,"=").concat(b[j]));hr.strings=C}return hr.strings},Oi=(h,b)=>{for(var j=0;j<h.length;++j)Y[b++>>>0]=h.charCodeAt(j);Y[b>>>0]=0},Wi=function(h,b){h>>>=0,b>>>=0;var j=0;return hr().forEach((C,U)=>{var I=b+j;ae[h+U*4>>>2>>>0]=I,Oi(C,I),j+=C.length+1}),0},qi=function(h,b){h>>>=0,b>>>=0;var j=hr();ae[h>>>2>>>0]=j.length;var C=0;return j.forEach(U=>C+=U.length+1),ae[b>>>2>>>0]=C,0},Ki=0,Gi=()=>Qt||Ki>0,$i=h=>{var b;X=h,Gi()||((b=l.onExit)==null||b.call(l,h),N=!0),ke(h,new Dr(h))},yt=(h,b)=>{X=h,$i(h)},Xi=yt,Vi=h=>52;function Pr(h,b){b>>>=0;var j=0,C=0,U=0;{var I=2;h==0?j=2:(h==1||h==2)&&(j=64),U=1}return Y[b>>>0]=I,J[b+2>>>1>>>0]=U,xe=[j>>>0,(_e=j,+Math.abs(_e)>=1?_e>0?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)],F[b+8>>>2>>>0]=xe[0],F[b+12>>>2>>>0]=xe[1],xe=[C>>>0,(_e=C,+Math.abs(_e)>=1?_e>0?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)],F[b+16>>>2>>>0]=xe[0],F[b+20>>>2>>>0]=xe[1],0}function Ji(h,b,j,C,U,I){b>>>=0,j>>>=0;var P=Oe(C,U);return I>>>=0,52}function Yi(h,b,j,C,U,I){b>>>=0,j>>>=0;var P=Oe(C,U);return I>>>=0,52}function Qi(h,b,j,C){return b>>>=0,j>>>=0,C>>>=0,52}function bt(h,b,j,C,U){var I=Oe(b,j);return U>>>=0,70}var zi=h=>52,Zi=[null,[],[]],en=(h,b)=>{var j=Zi[h];b===0||b===10?((h===1?Fe:x)(Ur(j)),j.length=0):j.push(b)};function rn(h,b,j,C){b>>>=0,j>>>=0,C>>>=0;for(var U=0,I=0;I<j;I++){var P=ae[b>>>2>>>0],L=ae[b+4>>>2>>>0];b+=8;for(var $=0;$<L;$++)en(h,H[P+$>>>0]);U+=L}return ae[C>>>2>>>0]=U,0}function Mr(h,b,j,C){h>>>=0,b>>>=0,j>>>=0,C>>>=0;var U=0,I=0,P=0,L=0,$=0,te=0,le;function B(pe,ge,fe,W,Ae,qe){var Te,Ge,$e,Et;return Ge=pe===10?28:16,Ae=pe===10?Qe(Ae):sr(Ae),Te=ar(Ge),Et=or(Te,pe,Ae,qe),q(!Et),$e=ar(32),F[$e+4>>>2>>>0]=pe,F[$e+8>>>2>>>0]=ge,F[$e+12>>>2>>>0]=fe,ae[$e+24>>>2>>>0]=W,ae[$e+20>>>2>>>0]=Te,pe===10?F[$e+16>>>2>>>0]=28:F[$e+16>>>2>>>0]=16,F[$e+28>>>2>>>0]=0,$e}if(j&&(P=F[j>>>2>>>0],L=F[j+4>>>2>>>0],$=F[j+8>>>2>>>0],te=F[j+12>>>2>>>0]),$&&!te&&(te=$===2?17:6),!$&&te&&($=te===17?2:1),te===0&&(te=6),$===0&&($=1),!h&&!b)return-2;if(P&-1088||j!==0&&F[j>>>2>>>0]&2&&!h)return-1;if(P&32)return-2;if($!==0&&$!==1&&$!==2)return-7;if(L!==0&&L!==2&&L!==10)return-6;if(b&&(b=be(b),I=parseInt(b,10),isNaN(I)))return P&1024?-2:-8;if(!h)return L===0&&(L=2),P&1||(L===2?U=_htonl(2130706433):U=[0,0,0,_htonl(1)]),le=B(L,$,te,null,U,I),ae[C>>>2>>>0]=le,0;if(h=be(h),U=br(h),U!==null)if(L===0||L===2)L=2;else if(L===10&&P&8)U=[0,0,_htonl(65535),U],L=10;else return-2;else if(U=Fr(h),U!==null)if(L===0||L===10)L=10;else return-2;return U!=null?(le=B(L,$,te,h,U,I),ae[C>>>2>>>0]=le,0):P&4?-2:(h=He.lookup_name(h),U=br(h),L===0?L=2:L===10&&(U=[0,0,_htonl(65535),U]),le=B(L,$,te,null,U,I),ae[C>>>2>>>0]=le,0)}function tn(h,b,j,C,U,I,P){h>>>=0,j>>>=0,U>>>=0;var L=Jr(h,b);if(L.errno)return-6;var $=L.port,te=L.addr,le=!1;if(j&&C){var B;if(P&1||!(B=He.lookup_addr(te))){if(P&8)return-2}else te=B;var pe=ze(te,j,C);pe+1>=C&&(le=!0)}if(U&&I){$=""+$;var pe=ze($,U,I);pe+1>=I&&(le=!0)}return le?-12:0}var vr=()=>{if(O){var h=["crypto"].map(require).pop();return b=>h.randomFillSync(b)}return b=>crypto.getRandomValues(b)},mt=h=>{(mt=vr())(h)};function nn(h,b){return h>>>=0,b>>>=0,mt(H.subarray(h>>>0,h+b>>>0)),0}var an=h=>{if(h instanceof Dr||h=="unwind")return X;ke(1,h)},sn=h=>{var b=l["_"+h];return b},on=(h,b)=>{Y.set(h,b>>>0)},kr=h=>aa(h);l.stackAlloc=kr;var gt=h=>{var b=nr(h)+1,j=kr(b);return ze(h,j,b),j},jt=()=>sa(),kt=h=>na(h),cn=(h,b,j,C,U)=>{var I={string:fe=>{var W=0;return fe!=null&&fe!==0&&(W=gt(fe)),W},array:fe=>{var W=kr(fe.length);return on(fe,W),W}};function P(fe){return b==="string"?be(fe):b==="boolean"?!!fe:fe}var L=sn(h),$=[],te=0;if(C)for(var le=0;le<C.length;le++){var B=I[j[le]];B?(te===0&&(te=jt()),$[le]=B(C[le])):$[le]=C[le]}var pe=L(...$);function ge(fe){return te!==0&&kt(te),P(fe)}return pe=ge(pe),pe},un=h=>ia(),ln=h=>ta(h),fn={ja:mr,oa:zt,I:Zt,ea:ei,b:ri,da:zr,w:Hr,fa:Zr,_:gr,ia:Pe,ha:et,ma:ti,h:ii,aa:ni,$:ai,ba:rt,t:tt,na:me,X:Br,ka:si,Y:oi,o:ci,la:it,s:ui,ca:rr,ga:li,p:fi,ra:nt,F:dr,i:at,H:st,G:ot,E:ct,z:pi,A:wi,B:yi,qa:bi,C:ji,O:ki,Q:Ti,M:Ei,N:ft,m:_t,T:dt,K:ht,L:vt,S:Ai,f:Di,R:Ri,n:Ci,U:Si,J:Fi,l:Ui,V:xi,e:Ii,k:lt,pa:Bi,c:ut,sa:Mi,u:Wi,v:qi,a:Xi,d:Vi,P:Pr,y:Ji,x:Yi,j:Qi,D:bt,Z:zi,g:rn,r:Mr,q:tn,W:nn},Z=await Xt(),_n=l._main=Z.va,Ln=l._duckdb_web_fs_glob_add_path=Z.xa,On=l._duckdb_web_clear_response=Z.ya,Wn=l._duckdb_web_fail_with=Z.za,qn=l._duckdb_web_reset=Z.Aa,Kn=l._duckdb_web_connect=Z.Ba,Gn=l._duckdb_web_disconnect=Z.Ca,$n=l._duckdb_web_flush_files=Z.Da,dn=l._duckdb_web_flush_file=Z.Ea,Xn=l._duckdb_web_open=Z.Fa,Vn=l._duckdb_web_get_global_file_info=Z.Ga,Lr=l._duckdb_web_collect_file_stats=Z.Ha,hn=l._duckdb_web_export_file_stats=Z.Ia,K=l._duckdb_web_fs_drop_file=Z.Ja,Jn=l._duckdb_web_fs_drop_files=Z.Ka,Yn=l._duckdb_web_fs_glob_file_infos=Z.La,Or=l._duckdb_web_fs_get_file_info_by_id=Z.Ma,Qn=l._duckdb_web_fs_get_file_info_by_name=Z.Na,zn=l._duckdb_web_fs_register_file_url=Z.Oa,Zn=l._duckdb_web_fs_register_file_buffer=Z.Pa,ea=l._duckdb_web_copy_file_to_buffer=Z.Qa,ee=l._duckdb_web_copy_file_to_path=Z.Ra,ra=l._duckdb_web_get_version=Z.Sa,Oa=l._duckdb_web_get_feature_flags=Z.Ta,Wa=l._duckdb_web_tokenize=Z.Ua,qa=l._duckdb_web_tokenize_buffer=Z.Va,Ka=l._duckdb_web_udf_scalar_create=Z.Wa,Ga=l._duckdb_web_prepared_create=Z.Xa,$a=l._duckdb_web_prepared_create_buffer=Z.Ya,Xa=l._duckdb_web_prepared_close=Z.Za,Va=l._duckdb_web_prepared_run=Z._a,Ja=l._duckdb_web_prepared_send=Z.$a,Ya=l._duckdb_web_query_run=Z.ab,Qa=l._duckdb_web_query_run_buffer=Z.bb,za=l._duckdb_web_pending_query_start=Z.cb,Za=l._duckdb_web_pending_query_start_buffer=Z.db,es=l._duckdb_web_pending_query_poll=Z.eb,rs=l._duckdb_web_pending_query_cancel=Z.fb,ts=l._duckdb_web_query_fetch_results=Z.gb,is=l._duckdb_web_get_tablenames=Z.hb,ns=l._duckdb_web_get_tablenames_buffer=Z.ib,as=l._duckdb_web_insert_arrow_from_ipc_stream=Z.jb,ss=l._duckdb_web_insert_csv_from_path=Z.kb,os=l._duckdb_web_insert_json_from_path=Z.lb,ar=l._malloc=Z.pb,cs=l._free=Z.qb,us=l._calloc=Z.rb,ta=Z.tb,ia=Z.ub,na=Z.vb,aa=Z.wb,sa=Z.xb;function oa(h){h=Object.assign({},h);var b=U=>I=>U(I)>>>0,j=U=>(I,P)=>U(I,P)>>>0,C=U=>()=>U()>>>0;return h.pb=b(h.pb),h.rb=j(h.rb),h.wb=b(h.wb),h.xb=C(h.xb),h}l.stackSave=jt,l.stackRestore=kt,l.stackAlloc=kr,l.getTempRet0=un,l.setTempRet0=ln,l.ccall=cn;function ca(){var h=_n,b=0,j=0;try{var C=h(b,j);return yt(C,!0),C}catch(U){return an(U)}}function Tt(){if(Be>0){Je=Tt;return}if(lr(),Be>0){Je=Tt;return}function h(){var j;if(l.calledRun=!0,!N){fr(),E(l),(j=l.onRuntimeInitialized)==null||j.call(l);var b=l.noInitialRun;b||ca(),Pt()}}l.setStatus?(l.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>l.setStatus(""),1),h()},1)):h()}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();return Tt(),g=S,g}})();typeof Pa=="object"&&typeof Bt=="object"?(Bt.exports=Mn,Bt.exports.default=Mn):typeof define=="function"&&define.amd&&define([],()=>Mn)});var Ed={};id(Ed,{BROWSER_RUNTIME:()=>se,ConsoleLogger:()=>An,DEFAULT_RUNTIME:()=>Tn,DuckDBAccessMode:()=>pa,DuckDBBindingsBase:()=>Vr,DuckDBConnection:()=>Kr,DuckDBDataProtocol:()=>$r,DuckDBFeature:()=>va,FileFlags:()=>kn,FileStatistics:()=>Xr,IsArrowBuffer:()=>yn,IsDuckDBWasmRetry:()=>bn,JSONTableShape:()=>wa,LogEvent:()=>ga,LogLevel:()=>ba,LogOrigin:()=>ja,LogTopic:()=>ma,PACKAGE_NAME:()=>Dn,PACKAGE_VERSION:()=>Rn,PACKAGE_VERSION_MAJOR:()=>_d,PACKAGE_VERSION_MINOR:()=>dd,PACKAGE_VERSION_PATCH:()=>hd,PreparedStatement:()=>Dt,ResultStreamIterator:()=>Gr,StatusCode:()=>wn,TokenType:()=>ya,VoidLogger:()=>En,callSRet:()=>je,copyBuffer:()=>cr,createDuckDB:()=>Td,decodeText:()=>ha,dropResponseBuffers:()=>Ee,failWith:()=>Xe,getJsDelivrBundles:()=>wd,getLogEventLabel:()=>od,getLogLevelLabel:()=>sd,getLogOriginLabel:()=>ud,getLogTopicLabel:()=>cd,getPlatformFeatures:()=>Ut,isFirefox:()=>vd,isNode:()=>In,isSafari:()=>pd,readString:()=>ue,selectBundle:()=>yd});module.exports=nd(Ed);var ir=qr(require("apache-arrow")),Kr=class{constructor(d,y){this._bindings=d,this._conn=y}close(){this._bindings.disconnect(this._conn)}useUnsafe(d){return d(this._bindings,this._conn)}query(d){let y=this._bindings.runQuery(this._conn,d),g=ir.RecordBatchReader.from(y);return console.assert(g.isSync()),console.assert(g.isFile()),new ir.Table(g)}async send(d,y=!1){let g=this._bindings.startPendingQuery(this._conn,d,y);for(;g==null;)g=await new Promise((T,S)=>{try{T(this._bindings.pollPendingQuery(this._conn))}catch(A){console.log(A),A.message.includes("worker is not set!")?S(new Error("Worker has been terminated")):S(A)}});let l=new Gr(this._bindings,this._conn,g),E=ir.RecordBatchReader.from(l);return console.assert(E.isSync()),console.assert(E.isStream()),E}cancelSent(){return this._bindings.cancelPendingQuery(this._conn)}getTableNames(d){return this._bindings.getTableNames(this._conn,d)}prepare(d){let y=this._bindings.createPrepared(this._conn,d);return new Dt(this._bindings,this._conn,y)}createScalarFunction(d,y,g){this._bindings.createScalarFunction(this._conn,d,y,g)}insertArrowTable(d,y){let g=ir.tableToIPC(d,"stream");this.insertArrowFromIPCStream(g,y)}insertArrowFromIPCStream(d,y){this._bindings.insertArrowFromIPCStream(this._conn,d,y)}insertCSVFromPath(d,y){this._bindings.insertCSVFromPath(this._conn,d,y)}insertJSONFromPath(d,y){this._bindings.insertJSONFromPath(this._conn,d,y)}},Gr=class{constructor(d,y,g){this.bindings=d;this.conn=y;this.header=g;this._first=!0,this._depleted=!1}next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let d=null;do d=this.bindings.fetchQueryResults(this.conn);while(d==null);return this._depleted=d.length==0,{done:this._depleted,value:d}}[Symbol.iterator](){return this}},Dt=class{constructor(d,y,g){this.bindings=d,this.connectionId=y,this.statementId=g}close(){this.bindings.closePrepared(this.connectionId,this.statementId)}query(...d){let y=this.bindings.runPrepared(this.connectionId,this.statementId,d),g=ir.RecordBatchReader.from(y);return console.assert(g.isSync()),console.assert(g.isFile()),new ir.Table(g)}send(...d){let y=this.bindings.sendPrepared(this.connectionId,this.statementId,d),g=new Gr(this.bindings,this.connectionId,y),l=ir.RecordBatchReader.from(g);return console.assert(l.isSync()),console.assert(l.isStream()),l}};var wn=(g=>(g[g.SUCCESS=0]="SUCCESS",g[g.MAX_ARROW_ERROR=255]="MAX_ARROW_ERROR",g[g.DUCKDB_WASM_RETRY=256]="DUCKDB_WASM_RETRY",g))(wn||{});function yn(w){return w<=255}function bn(w){return w===256}var _a=new TextEncoder,la=new TextDecoder("utf-8");function mn(w,d,y){let g=_a.encode(y),l=w._malloc(g.byteLength),E=w.HEAPU8.subarray(l,l+g.byteLength);E.set(g),w.HEAPF64[(d>>3)+0]=1,w.HEAPF64[(d>>3)+1]=l,w.HEAPF64[(d>>3)+2]=E.byteLength}function jn(w){switch(w){case"UINT8":case"INT8":return 1;case"INT32":case"FLOAT":return 4;case"INT64":case"UINT64":case"DOUBLE":case"VARCHAR":return 8;default:return 0}}function gn(w,d,y,g){let l=w.HEAPU8.subarray(d,d+g*jn(y));switch(y){case"UINT8":return new Uint8Array(l.buffer,l.byteOffset,g);case"INT8":return new Int8Array(l.buffer,l.byteOffset,g);case"INT32":return new Int32Array(l.buffer,l.byteOffset,g);case"FLOAT":return new Float32Array(l.buffer,l.byteOffset,g);case"DOUBLE":return new Float64Array(l.buffer,l.byteOffset,g);case"VARCHAR":return new Float64Array(l.buffer,l.byteOffset,g);default:return new Array(0)}}function fa(w,d,y){let g=w.HEAPU8.subarray(d,d+y);return new Uint8Array(g.buffer,g.byteOffset,y)}function Rt(w,d,y){let g=w.HEAPU8.subarray(d,d+y*8);return new Float64Array(g.buffer,g.byteOffset,y)}function Ct(w,d,y,g,l,E,T,S){try{let A=w._udfFunctions.get(g);if(!A){mn(d,y,"Unknown UDF with id: "+g);return}let M=la.decode(d.HEAPU8.subarray(l,l+E)),O=JSON.parse(M),Q=Rt(d,T,S/8),ie=N=>{var q;let X=null;switch(N.validityBuffer!==void 0&&(X=fa(d,Q[N.validityBuffer],O.rows)),N.physicalType){case"VARCHAR":{if(N.dataBuffer===null||N.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(N.lengthBuffer===null||N.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let Y=gn(d,Q[N.dataBuffer],N.physicalType,O.rows),H=[],J=Rt(d,Q[N.lengthBuffer],O.rows);for(let ne=0;ne<O.rows;++ne){if(X!=null&&!X[ne]){H.push(null);continue}let F=d.HEAPU8.subarray(Y[ne],Y[ne]+J[ne]),ae=la.decode(F);H.push(ae)}return ne=>H[ne]}case"STRUCT":{let Y={},H=[];for(let J=0;J<(((q=N.children)==null?void 0:q.length)||0);++J){let ne=N.children[J],F=ie(ne);H.push(ae=>{Y[ne.name]=F(ae)})}return X!=null?J=>{if(!X[J])return null;for(let ne of H)ne(J);return Y}:J=>{for(let ne of H)ne(J);return Y}}default:{if(N.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+N.physicalType);let Y=gn(d,Q[N.dataBuffer],N.physicalType,O.rows);return X!=null?H=>X[H]?Y[H]:null:H=>Y[H]}}},V=[];for(let N=0;N<O.args.length;++N)V.push(ie(O.args[N]));let ke=O.rows*jn(O.ret.physicalType),oe=d._malloc(ke),Se=gn(d,oe,O.ret.physicalType,O.rows),De=d._malloc(O.rows),ye=fa(d,De,O.rows);if(Se.length==0||ye.length==0){mn(d,y,"Can't create physical arrays for result");return}let we=Se;O.ret.physicalType=="VARCHAR"&&(we=new Array(O.rows));let Ie=[];for(let N=0;N<O.args.length;++N)Ie.push(null);for(let N=0;N<O.rows;++N){for(let q=0;q<O.args.length;++q)Ie[q]=V[q](N);let X=A.func(...Ie);we[N]=X,ye[N]=X==null?0:1}let Fe=0;switch(O.ret.physicalType){case"VARCHAR":{let N=new Array(0);Fe=d._malloc(O.rows*jn("DOUBLE"));let X=Rt(d,Fe,O.rows),q=0;for(let ne=0;ne<O.rows;++ne){let F=_a.encode(we[ne]||"");N.push(F),X[ne]=F.length,q+=F.length}let Y=d._malloc(q),H=d.HEAPU8.subarray(Y,Y+q),J=0;for(let ne=0;ne<O.rows;++ne){Se[ne]=J;let F=N[ne];H.subarray(J,J+F.length).set(F),J+=F.length}}}let x=3*8,G=d._malloc(x),z=Rt(d,G,3);z[0]=oe,z[1]=De,z[2]=Fe,d.HEAPF64[(y>>3)+0]=0,d.HEAPF64[(y>>3)+1]=G,d.HEAPF64[(y>>3)+2]=0}catch(A){mn(d,y,A.toString())}}function ad(){let w=new TextDecoder;return d=>(typeof SharedArrayBuffer<"u"&&d.buffer instanceof SharedArrayBuffer&&(d=new Uint8Array(d)),w.decode(d))}var ha=ad();function Xe(w,d){console.error("FAIL WITH: ".concat(d)),w.ccall("duckdb_web_fail_with",null,["string"],[d])}function cr(w,d,y){let g=new Uint8Array(w.HEAPU8.buffer,d>>>0,y),l=new Uint8Array(new ArrayBuffer(g.byteLength));return l.set(g),l}function ue(w,d,y){return ha(new Uint8Array(w.HEAPU8.buffer,d>>>0,y))}var $r=(T=>(T[T.BUFFER=0]="BUFFER",T[T.NODE_FS=1]="NODE_FS",T[T.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",T[T.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",T[T.HTTP=4]="HTTP",T[T.S3=5]="S3",T))($r||{}),kn=(Q=>(Q[Q.FILE_FLAGS_READ=1]="FILE_FLAGS_READ",Q[Q.FILE_FLAGS_WRITE=2]="FILE_FLAGS_WRITE",Q[Q.FILE_FLAGS_DIRECT_IO=4]="FILE_FLAGS_DIRECT_IO",Q[Q.FILE_FLAGS_FILE_CREATE=8]="FILE_FLAGS_FILE_CREATE",Q[Q.FILE_FLAGS_FILE_CREATE_NEW=16]="FILE_FLAGS_FILE_CREATE_NEW",Q[Q.FILE_FLAGS_APPEND=32]="FILE_FLAGS_APPEND",Q[Q.FILE_FLAGS_PRIVATE=64]="FILE_FLAGS_PRIVATE",Q[Q.FILE_FLAGS_NULL_IF_NOT_EXISTS=128]="FILE_FLAGS_NULL_IF_NOT_EXISTS",Q[Q.FILE_FLAGS_PARALLEL_ACCESS=256]="FILE_FLAGS_PARALLEL_ACCESS",Q[Q.FILE_FLAGS_EXCLUSIVE_CREATE=512]="FILE_FLAGS_EXCLUSIVE_CREATE",Q[Q.FILE_FLAGS_NULL_IF_EXISTS=1024]="FILE_FLAGS_NULL_IF_EXISTS",Q))(kn||{});function je(w,d,y,g){let l=w.stackSave(),E=w.stackAlloc(3*8);y.unshift("number"),g.unshift(E),w.ccall(d,null,y,g);let T=w.HEAPF64[(E>>3)+0],S=w.HEAPF64[(E>>3)+1],A=w.HEAPF64[(E>>3)+2];return w.stackRestore(l),[T,S,A]}function Ee(w){w.ccall("duckdb_web_clear_response",null,[],[])}var Tn={_udfFunctions:new Map,testPlatformFeature:(w,d)=>!1,getDefaultDataProtocol:w=>0,openFile:(w,d,y)=>{},syncFile:(w,d)=>{},closeFile:(w,d)=>{},dropFile:(w,d,y)=>{},getLastFileModificationTime:(w,d)=>0,progressUpdate:(w,d,y)=>{},truncateFile:(w,d,y)=>{},readFile:(w,d,y,g,l)=>0,writeFile:(w,d,y,g,l)=>0,removeDirectory:(w,d,y)=>{},checkDirectory:(w,d,y)=>!1,createDirectory:(w,d,y)=>{},listDirectoryEntries:(w,d,y)=>!1,glob:(w,d,y)=>{},moveFile:(w,d,y,g,l)=>{},checkFile:(w,d,y)=>!1,removeFile:(w,d,y)=>{},callScalarUDF:(w,d,y,g,l,E,T)=>{Ct(Tn,w,d,y,g,l,E,T)}};var Xr=class{constructor(d){let y=new Float64Array(d.buffer,d.byteOffset,d.byteLength/8),g=new Uint8Array(new ArrayBuffer(d.byteLength));g.set(d.subarray(7*8)),this.totalFileReadsCold=y[0],this.totalFileReadsAhead=y[1],this.totalFileReadsCached=y[2],this.totalFileWrites=y[3],this.totalPageAccesses=y[4],this.totalPageLoads=y[5],this.blockSize=y[6],this.blockStats=g}getBlockStats(d,y){return y=y||{file_reads_cold:0,file_reads_ahead:0,file_reads_cached:0,file_writes:0,page_accesses:0,page_loads:0},y.file_writes=this.blockStats[d*3+0]&15,y.file_reads_cold=this.blockStats[d*3+0]>>4,y.file_reads_ahead=this.blockStats[d*3+1]&15,y.file_reads_cached=this.blockStats[d*3+1]>>4,y.page_accesses=this.blockStats[d*3+1]&15,y.page_loads=this.blockStats[d*3+1]>>4,y}};var he=qr(require("apache-arrow"));function Tr(w){switch(w.typeId){case he.Type.Binary:return{sqlType:"binary"};case he.Type.Bool:return{sqlType:"bool"};case he.Type.Date:return{sqlType:"date"};case he.Type.DateDay:return{sqlType:"date32[d]"};case he.Type.DateMillisecond:return{sqlType:"date64[ms]"};case he.Type.Decimal:{let d=w;return{sqlType:"decimal",precision:d.precision,scale:d.scale}}case he.Type.Float:return{sqlType:"float"};case he.Type.Float16:return{sqlType:"float16"};case he.Type.Float32:return{sqlType:"float32"};case he.Type.Float64:return{sqlType:"float64"};case he.Type.Int:return{sqlType:"int32"};case he.Type.Int16:return{sqlType:"int16"};case he.Type.Int32:return{sqlType:"int32"};case he.Type.Int64:return{sqlType:"int64"};case he.Type.Uint16:return{sqlType:"uint16"};case he.Type.Uint32:return{sqlType:"uint32"};case he.Type.Uint64:return{sqlType:"uint64"};case he.Type.Uint8:return{sqlType:"uint8"};case he.Type.IntervalDayTime:return{sqlType:"interval[dt]"};case he.Type.IntervalYearMonth:return{sqlType:"interval[m]"};case he.Type.List:return{sqlType:"list",valueType:Tr(w.valueType)};case he.Type.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:w.byteWidth};case he.Type.Null:return{sqlType:"null"};case he.Type.Utf8:return{sqlType:"utf8"};case he.Type.Struct:return{sqlType:"struct",fields:w.children.map(y=>St(y.name,y.type))};case he.Type.Map:{let d=w;return{sqlType:"map",keyType:Tr(d.keyType),valueType:Tr(d.valueType)}}case he.Type.Time:return{sqlType:"time[s]"};case he.Type.TimeMicrosecond:return{sqlType:"time[us]"};case he.Type.TimeMillisecond:return{sqlType:"time[ms]"};case he.Type.TimeNanosecond:return{sqlType:"time[ns]"};case he.Type.TimeSecond:return{sqlType:"time[s]"};case he.Type.Timestamp:return{sqlType:"timestamp",timezone:w.timezone||void 0};case he.Type.TimestampSecond:return{sqlType:"timestamp[s]",timezone:w.timezone||void 0};case he.Type.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:w.timezone||void 0};case he.Type.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:w.timezone||void 0};case he.Type.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:w.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(w.toString()))}function St(w,d){let y=Tr(d);return y.name=w,y}var Er=new TextEncoder,va=(T=>(T[T.WASM_EXCEPTIONS=1]="WASM_EXCEPTIONS",T[T.WASM_THREADS=2]="WASM_THREADS",T[T.WASM_SIMD=4]="WASM_SIMD",T[T.WASM_BULK_MEMORY=8]="WASM_BULK_MEMORY",T[T.EMIT_BIGINT=16]="EMIT_BIGINT",T[T.WASMFS=32]="WASMFS",T))(va||{}),Vr=class{constructor(d,y){this._instance=null;this._initPromise=null;this._initPromiseResolver=()=>{};this.onInstantiationProgress=[];this._logger=d,this._runtime=y,this._nextUDFId=1}get logger(){return this._logger}get mod(){return this._instance}get pthread(){return this.mod.PThread||null}async instantiate(d=y=>{}){return this._instance!=null?this:(this._initPromise!=null&&(this.onInstantiationProgress.push(d),await this._initPromise),this._initPromise=new Promise(y=>{this._initPromiseResolver=y}),this.onInstantiationProgress=[d],this._instance=await this.instantiateImpl({print:console.log.bind(console),printErr:console.log.bind(console),onRuntimeInitialized:this._initPromiseResolver}),await this._initPromise,this._initPromise=null,this.onInstantiationProgress=this.onInstantiationProgress.filter(y=>y!=d),globalThis.DUCKDB_BINDINGS=this,this)}open(d){let[y,g,l]=je(this.mod,"duckdb_web_open",["string"],[JSON.stringify(d)]);if(y!==0)throw new Error(ue(this.mod,g,l));Ee(this.mod)}reset(){let[d,y,g]=je(this.mod,"duckdb_web_reset",[],[]);if(d!==0)throw new Error(ue(this.mod,y,g));Ee(this.mod)}getVersion(){let[d,y,g]=je(this.mod,"duckdb_web_get_version",[],[]);if(d!==0)throw new Error(ue(this.mod,y,g));let l=ue(this.mod,y,g);return Ee(this.mod),l}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(d){let y=Er.encode(d),g=this.mod._malloc(y.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,g,y.length).set(y);let[E,T,S]=je(this.mod,"duckdb_web_tokenize_buffer",["number","number"],[g,y.length]);if(this.mod._free(g),E!==0)throw new Error(ue(this.mod,T,S));let A=ue(this.mod,T,S);return Ee(this.mod),JSON.parse(A)}connect(){let d=this.mod.ccall("duckdb_web_connect","number",[],[]);return new Kr(this,d)}disconnect(d){if(this.mod.ccall("duckdb_web_disconnect",null,["number"],[d]),this.pthread)for(let y of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])y.postMessage({cmd:"dropUDFFunctions",connectionId:d})}runQuery(d,y){let g=Er.encode(y),l=this.mod._malloc(g.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,l,g.length).set(g);let[T,S,A]=je(this.mod,"duckdb_web_query_run_buffer",["number","number","number"],[d,l,g.length]);if(this.mod._free(l),T!==0)throw new Error(ue(this.mod,S,A));let M=cr(this.mod,S,A);return Ee(this.mod),M}startPendingQuery(d,y,g=!1){let l=Er.encode(y),E=this.mod._malloc(l.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,E,l.length).set(l);let[S,A,M]=je(this.mod,"duckdb_web_pending_query_start_buffer",["number","number","number","boolean"],[d,E,l.length,g]);if(this.mod._free(E),S!==0)throw new Error(ue(this.mod,A,M));if(A==0)return null;let O=cr(this.mod,A,M);return Ee(this.mod),O}pollPendingQuery(d){let[y,g,l]=je(this.mod,"duckdb_web_pending_query_poll",["number"],[d]);if(y!==0)throw new Error(ue(this.mod,g,l));if(g==0)return null;let E=cr(this.mod,g,l);return Ee(this.mod),E}cancelPendingQuery(d){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[d])}fetchQueryResults(d){let[y,g,l]=je(this.mod,"duckdb_web_query_fetch_results",["number"],[d]);if(bn(y))return Ee(this.mod),null;if(!yn(y))throw new Error("Unexpected StatusCode from duckdb_web_query_fetch_results ("+y+") and with self reported error as"+ue(this.mod,g,l));if(y!==0)throw new Error(ue(this.mod,g,l));let E=cr(this.mod,g,l);return Ee(this.mod),E}getTableNames(d,y){let g=Er.encode(y),l=this.mod._malloc(g.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,l,g.length).set(g);let[T,S,A]=je(this.mod,"duckdb_web_get_tablenames_buffer",["number","number","number"],[d,l,g.length]);if(this.mod._free(l),T!==0)throw new Error(ue(this.mod,S,A));let M=ue(this.mod,S,A);return Ee(this.mod),JSON.parse(M)}createScalarFunction(d,y,g,l){let E={functionId:this._nextUDFId,name:y,returnType:Tr(g)},T={functionId:E.functionId,connectionId:d,name:y,returnType:g,func:l};this._nextUDFId+=1;let[S,A,M]=je(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[d,JSON.stringify(E)]);if(S!==0)throw new Error(ue(this.mod,A,M));if(Ee(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(T.functionId,T),this.pthread)for(let O of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])O.postMessage({cmd:"registerUDFFunction",udf:T})}createPrepared(d,y){let g=Er.encode(y),l=this.mod._malloc(g.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,l,g.length).set(g);let[T,S,A]=je(this.mod,"duckdb_web_prepared_create_buffer",["number","number","number"],[d,l,g.length]);if(this.mod._free(l),T!==0)throw new Error(ue(this.mod,S,A));return Ee(this.mod),S}closePrepared(d,y){let[g,l,E]=je(this.mod,"duckdb_web_prepared_close",["number","number"],[d,y]);if(g!==0)throw new Error(ue(this.mod,l,E));Ee(this.mod)}runPrepared(d,y,g){let[l,E,T]=je(this.mod,"duckdb_web_prepared_run",["number","number","string"],[d,y,JSON.stringify(g)]);if(l!==0)throw new Error(ue(this.mod,E,T));let S=cr(this.mod,E,T);return Ee(this.mod),S}sendPrepared(d,y,g){let[l,E,T]=je(this.mod,"duckdb_web_prepared_send",["number","number","string"],[d,y,JSON.stringify(g)]);if(l!==0)throw new Error(ue(this.mod,E,T));let S=cr(this.mod,E,T);return Ee(this.mod),S}insertArrowFromIPCStream(d,y,g){if(y.length==0)return;let l=this.mod._malloc(y.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,l,y.length).set(y);let T=g?JSON.stringify(g):"",[S,A,M]=je(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[d,l,y.length,T]);if(this.mod._free(l),S!==0)throw new Error(ue(this.mod,A,M))}insertCSVFromPath(d,y,g){if(g.columns!==void 0){g.columnsFlat=[];for(let M in g.columns)g.columnsFlat.push(St(M,g.columns[M]))}let l={...g};l.columns=l.columnsFlat,delete l.columnsFlat;let E=JSON.stringify(l),[T,S,A]=je(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[d,y,E]);if(T!==0)throw new Error(ue(this.mod,S,A))}insertJSONFromPath(d,y,g){if(g.columns!==void 0){g.columnsFlat=[];for(let M in g.columns)g.columnsFlat.push(St(M,g.columns[M]))}let l={...g};l.columns=l.columnsFlat,delete l.columnsFlat;let E=JSON.stringify(l),[T,S,A]=je(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[d,y,E]);if(T!==0)throw new Error(ue(this.mod,S,A))}globFiles(d){let[y,g,l]=je(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[d]);if(y!==0)throw new Error(ue(this.mod,g,l));let E=ue(this.mod,g,l);Ee(this.mod);let T=JSON.parse(E);return T==null?[]:T}registerFileURL(d,y,g,l=!1){y===void 0&&(y=d);let[E,T,S]=je(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[d,y,g,l]);if(E!==0)throw new Error(ue(this.mod,T,S));Ee(this.mod)}registerFileText(d,y){let g=Er.encode(y);this.registerFileBuffer(d,g)}registerFileBuffer(d,y){let g=this.mod._malloc(y.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,g,y.length).set(y);let[E,T,S]=je(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[d,g,y.length]);if(E!==0)throw new Error(ue(this.mod,T,S));Ee(this.mod)}async prepareFileHandle(d,y){if(y===3&&this._runtime.prepareFileHandles){let g=await this._runtime.prepareFileHandles([d],3);for(let l of g){let{handle:E,path:T,fromCached:S}=l;!S&&E.getSize()&&await this.registerFileHandleAsync(T,E,3,!0)}return}throw new Error("prepareFileHandle: unsupported protocol ".concat(y))}async prepareDBFileHandle(d,y){if(y===3&&this._runtime.prepareDBFileHandle){let g=await this._runtime.prepareDBFileHandle(d,3);for(let l of g){let{handle:E,path:T,fromCached:S}=l;!S&&E.getSize()&&await this.registerFileHandleAsync(T,E,3,!0)}return}throw new Error("prepareDBFileHandle: unsupported protocol ".concat(y))}async prepareFileHandleAsync(d,y,g,l){if(g===3&&!(y instanceof FileSystemSyncAccessHandle)){if(y instanceof FileSystemFileHandle){let E=y;try{y=await E.createSyncAccessHandle()}catch(T){throw new Error(T.message+":"+d)}}else if(d!=null)try{y=await(await(await navigator.storage.getDirectory()).getFileHandle(d)).createSyncAccessHandle()}catch(E){throw new Error(E.message+":"+d)}}return y}async registerFileHandleAsync(d,y,g,l){let E=await this.prepareFileHandleAsync(d,y,g,l);this.registerFileHandle(d,E,g,l)}registerFileHandle(d,y,g,l){var A;let[E,T,S]=je(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[d,d,g,l]);if(E!==0)throw new Error(ue(this.mod,T,S));if(Ee(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(d,y),(A=globalThis.DUCKDB_RUNTIME._preparedHandles)!=null&&A[d]&&delete globalThis.DUCKDB_RUNTIME._preparedHandles[d],this.pthread){for(let M of this.pthread.runningWorkers)M.postMessage({cmd:"registerFileHandle",fileName:d,fileHandle:y});for(let M of this.pthread.unusedWorkers)M.postMessage({cmd:"dropFileHandle",fileName:d})}}dropFile(d){let[y,g,l]=je(this.mod,"duckdb_web_fs_drop_file",["string"],[d]);if(y!==0)throw new Error(ue(this.mod,g,l));Ee(this.mod)}dropFiles(d){let y=[],g=-1;try{for(let S of d!=null?d:[])if(S!=null&&S.length>0){let A=this.mod.lengthBytesUTF8(S)+1,M=this.mod._malloc(A);if(!M)throw new Error("Failed to allocate memory for string: ".concat(S));this.mod.stringToUTF8(S,M,A),y.push(M)}if(g=this.mod._malloc(y.length*4),!g)throw new Error("Failed to allocate memory for pointers array");for(let S=0;S<y.length;S++)this.mod.HEAP32[(g>>2)+S]=y[S];let[l,E,T]=je(this.mod,"duckdb_web_fs_drop_files",["number","number"],[g,y.length]);if(l!==0)throw new Error(ue(this.mod,E,T));Ee(this.mod)}finally{for(let l of y)this.mod._free(l);g>0&&this.mod._free(g)}}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(d,y){let[g,l,E]=je(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[d,y]);if(g!==0)throw new Error(ue(this.mod,l,E));Ee(this.mod)}copyFileToBuffer(d){let[y,g,l]=je(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[d]);if(y!==0)throw new Error(ue(this.mod,g,l));let E=new Uint8Array(this.mod.HEAPU8.buffer,g>>>0,l),T=new Uint8Array(E.length);return T.set(E),Ee(this.mod),T}async registerOPFSFileName(d){if(d.startsWith("opfs://"))return this.prepareFileHandle(d,3);throw new Error("Not an OPFS file name: "+d)}collectFileStatistics(d,y){let[g,l,E]=je(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[d,y]);if(g!==0)throw new Error(ue(this.mod,l,E))}exportFileStatistics(d){let[y,g,l]=je(this.mod,"duckdb_web_export_file_stats",["string"],[d]);if(y!==0)throw new Error(ue(this.mod,g,l));return new Xr(new Uint8Array(this.mod.HEAPU8.buffer,g>>>0,l))}};var pa=(l=>(l[l.UNDEFINED=0]="UNDEFINED",l[l.AUTOMATIC=1]="AUTOMATIC",l[l.READ_ONLY=2]="READ_ONLY",l[l.READ_WRITE=3]="READ_WRITE",l))(pa||{});var wa=(y=>(y.ROW_ARRAY="row-array",y.COLUMN_OBJECT="column-object",y))(wa||{});var ya=(T=>(T[T.IDENTIFIER=0]="IDENTIFIER",T[T.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",T[T.STRING_CONSTANT=2]="STRING_CONSTANT",T[T.OPERATOR=3]="OPERATOR",T[T.KEYWORD=4]="KEYWORD",T[T.COMMENT=5]="COMMENT",T))(ya||{});var ba=(E=>(E[E.NONE=0]="NONE",E[E.DEBUG=1]="DEBUG",E[E.INFO=2]="INFO",E[E.WARNING=3]="WARNING",E[E.ERROR=4]="ERROR",E))(ba||{}),ma=(T=>(T[T.NONE=0]="NONE",T[T.CONNECT=1]="CONNECT",T[T.DISCONNECT=2]="DISCONNECT",T[T.OPEN=3]="OPEN",T[T.QUERY=4]="QUERY",T[T.INSTANTIATE=5]="INSTANTIATE",T))(ma||{}),ga=(T=>(T[T.NONE=0]="NONE",T[T.OK=1]="OK",T[T.ERROR=2]="ERROR",T[T.START=3]="START",T[T.RUN=4]="RUN",T[T.CAPTURE=5]="CAPTURE",T))(ga||{}),ja=(E=>(E[E.NONE=0]="NONE",E[E.WEB_WORKER=1]="WEB_WORKER",E[E.NODE_WORKER=2]="NODE_WORKER",E[E.BINDINGS=3]="BINDINGS",E[E.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",E))(ja||{}),En=class{log(d){}},An=class{constructor(d=2){this.level=d}log(d){d.level>=this.level&&console.log(d)}};function sd(w){switch(w){case 0:return"NONE";case 1:return"DEBUG";case 2:return"INFO";case 3:return"WARNING";case 4:return"ERROR";default:return"?"}}function od(w){switch(w){case 0:return"NONE";case 1:return"OK";case 2:return"ERROR";case 3:return"START";case 4:return"RUN";case 5:return"CAPTURE";default:return"?"}}function cd(w){switch(w){case 1:return"CONNECT";case 2:return"DISCONNECT";case 5:return"INSTANTIATE";case 3:return"OPEN";case 4:return"QUERY";default:return"?"}}function ud(w){switch(w){case 0:return"NONE";case 1:return"WEB WORKER";case 2:return"NODE WORKER";case 3:return"DUCKDB BINDINGS";case 4:return"DUCKDB";default:return"?"}}var ka=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),Ta=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11]));var Ea=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));var Aa=()=>(async w=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(w)}catch(d){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));var Ft={name:"@run-trace/duckdb-wasm",version:"0.3.1",description:"DuckDB powered by WebAssembly \u2014 Trace fork with bundled extensions",license:"MIT",repository:{type:"git",url:"https://github.com/trace-github/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^17.0.0",qs:"^6.14.1"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.13","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0",esbuild:"^0.20.2",eslint:"^8.57.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.37.5","fast-glob":"^3.3.2",jasmine:"^5.13.0","jasmine-core":"^5.1.2","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.1",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.3","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.5",puppeteer:"^22.8.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.28.15",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",format:'prettier --write "**/*.+(js|ts)"',report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/tests-*","!dist/duckdb-browser-mvp.worker.js.map","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-node-blocking.d.ts",import:"./dist/duckdb-node-blocking.mjs",require:"./dist/duckdb-node-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}};var Dn=Ft.name,Rn=Ft.version,Cn=Ft.version.split("."),_d=Cn[0],dd=Cn[1],hd=Cn[2];var In=()=>typeof navigator>"u",Da=()=>In()?"node":navigator.userAgent,vd=()=>Da().includes("Firefox"),pd=()=>/^((?!chrome|android).)*safari/i.test(Da());function wd(){let w="https://cdn.jsdelivr.net/npm/".concat(Dn,"@").concat(Rn,"/dist/");return{mvp:{mainModule:"".concat(w,"duckdb-mvp.wasm"),mainWorker:"".concat(w,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(w,"duckdb-eh.wasm"),mainWorker:"".concat(w,"duckdb-browser-eh.worker.js")}}}var Sn=null,Fn=null,Un=null,xn=null,Hn=null;async function Ut(){return Sn==null&&(Sn=typeof BigInt64Array<"u"),Fn==null&&(Fn=await Ta()),Un==null&&(Un=await Aa()),xn==null&&(xn=await Ea()),Hn==null&&(Hn=await ka()),{bigInt64Array:Sn,crossOriginIsolated:In()||globalThis.crossOriginIsolated||!1,wasmExceptions:Fn,wasmSIMD:xn,wasmThreads:Un,wasmBulkMemory:Hn}}async function yd(w){let d=await Ut();if(d.wasmExceptions){if(d.wasmSIMD&&d.wasmThreads&&d.crossOriginIsolated&&w.coi)return{mainModule:w.coi.mainModule,mainWorker:w.coi.mainWorker,pthreadWorker:w.coi.pthreadWorker};if(w.eh)return{mainModule:w.eh.mainModule,mainWorker:w.eh.mainWorker,pthreadWorker:null}}return{mainModule:w.mvp.mainModule,mainWorker:w.mvp.mainWorker,pthreadWorker:null}}var ur=qr(Sa()),Fa=function(w,d,y){var g;return(g=w==null?void 0:w.endpoint)!=null&&g.startsWith("http")?new URL(w.endpoint).host:w!=null&&w.endpoint?"".concat(y,".").concat(w==null?void 0:w.endpoint):"".concat(y,".s3.amazonaws.com")};function bd(w,d,y){var E,T,S,A;let g=Ua(d),l=g.path;if(xa(w)){let M="";if(w!=null&&w.endpoint){let O=new URL(w.endpoint);O.pathname!=="/"&&(M=O.pathname)}l="".concat(M,"/").concat(g.bucket).concat(l)}return{url:l,query:"",host:Fa(w,d,g.bucket),region:(E=w==null?void 0:w.region)!=null?E:"",service:"s3",method:y,accessKeyId:(T=w==null?void 0:w.accessKeyId)!=null?T:"",secretAccessKey:(S=w==null?void 0:w.secretAccessKey)!=null?S:"",sessionToken:(A=w==null?void 0:w.sessionToken)!=null?A:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function md(w,d=!1){let y="0123456789ABCDEF",g="";for(let l=0;l<w.length;l++){let E=w[l];E>="A"&&E<="Z"||E>="a"&&E<="z"||E>="0"&&E<="9"||E=="_"||E=="-"||E=="~"||E=="."?g+=E:E=="/"?d?g+="%2F":g+=E:(g+="%",g+=y[E.charCodeAt(0)>>4],g+=y[E.charCodeAt(0)&15])}return g}function gd(w,d=null){var ke;let y=(ke=d==null?void 0:d.contentHash)!=null?ke:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",g=new Map;g.set("x-amz-date",w.datetimeNow),g.set("x-amz-content-sha256",y),w.sessionToken&&g.set("x-amz-security-token",w.sessionToken);let l="";d!=null&&d.contentType&&(l+="content-type;"),l+="host;x-amz-content-sha256;x-amz-date",w.sessionToken&&(l+=";x-amz-security-token");let E=w.method+"\n"+md(w.url)+"\n"+w.query;d!=null&&d.contentType&&(E+="\ncontent-type:"+(d==null?void 0:d.contentType)),E+="\nhost:"+w.host+"\nx-amz-content-sha256:"+y+"\nx-amz-date:"+w.datetimeNow,w.sessionToken&&w.sessionToken.length>0&&(E+="\nx-amz-security-token:"+w.sessionToken),E+="\n\n"+l+"\n"+y;let T=(0,ur.sha256)(E),S="AWS4-HMAC-SHA256\n"+w.datetimeNow+"\n"+w.dateNow+"/"+w.region+"/"+w.service+"/aws4_request\n"+T,A="AWS4"+w.secretAccessKey,M=ur.sha256.hmac.arrayBuffer(A,w.dateNow),O=ur.sha256.hmac.arrayBuffer(M,w.region),Q=ur.sha256.hmac.arrayBuffer(O,w.service),ie=ur.sha256.hmac.arrayBuffer(Q,"aws4_request"),V=ur.sha256.hmac(ie,S);return g.set("Authorization","AWS4-HMAC-SHA256 Credential="+w.accessKeyId+"/"+w.dateNow+"/"+w.region+"/"+w.service+"/aws4_request, SignedHeaders="+l+", Signature="+V),g}var jd=function(w,d,y,g=null,l=null){let E=bd(w,d,y),T={contentType:g,contentHash:l?ur.sha256.hex(l):null};return gd(E,T)};function Ze(w,d,y,g,l=null,E=null){(d!=null&&d.accessKeyId||d!=null&&d.sessionToken)&&(jd(d,y,g,l,E).forEach((S,A)=>{w.setRequestHeader(A,S)}),l&&w.setRequestHeader("content-type",l))}function Ua(w){if(w.indexOf("s3://")!=0)throw new Error("URL needs to start with s3://");let d=w.indexOf("/",5);if(d==-1)throw new Error("URL needs to contain a '/' after the host");let y=w.substring(5,d);if(!y)throw new Error("URL needs to contain a bucket name");let g=w.substring(d);if(!g)throw new Error("URL needs to contain key");return{bucket:y,path:g}}function xa(w){var d;return!!((d=w==null?void 0:w.endpoint)!=null&&d.startsWith("http"))}function er(w,d){let y=Ua(d);return xa(w)?"".concat(w==null?void 0:w.endpoint,"/").concat(y.bucket)+y.path:"https://"+Fa(w,d,y.bucket)+y.path}var kd=7,Ha=/\/|\\/,se={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,_preparedHandles:{},_opfsRoot:null,getFileInfo(w,d){try{let y=se._fileInfoCache.get(d),[g,l,E]=je(w,"duckdb_web_fs_get_file_info_by_id",["number","number"],[d,(y==null?void 0:y.cacheEpoch)||0]);if(g!==0)return null;if(E===0)return y;let T=ue(w,l,E);Ee(w);try{let S=JSON.parse(T);if(S==null)return null;let A={...S,blob:null};return se._fileInfoCache.set(d,A),!se._files.has(A.fileName)&&se._preparedHandles[A.fileName]&&(se._files.set(A.fileName,se._preparedHandles[A.fileName]),delete se._preparedHandles[A.fileName]),A}catch(S){return console.warn(S),null}}catch(y){return console.log(y),null}},getGlobalFileInfo(w){var d;try{let[y,g,l]=je(w,"duckdb_web_get_global_file_info",["number"],[((d=se._globalFileInfo)==null?void 0:d.cacheEpoch)||0]);if(y!==0)return null;if(l===0)return se._globalFileInfo;let E=ue(w,g,l);Ee(w);let T=JSON.parse(E);return T==null?null:(se._globalFileInfo={...T,blob:null},se._globalFileInfo)}catch(y){return console.log(y),null}},async assignOPFSRoot(){se._opfsRoot||(se._opfsRoot=await navigator.storage.getDirectory())},async prepareFileHandles(w,d){if(d===3){await se.assignOPFSRoot();let y=async l=>{if(se._files.has(l))return{path:l,handle:se._files.get(l),fromCached:!0};let T=se._opfsRoot,S=l.slice(kd),A=S;if(Ha.test(S)){let O=S.split(Ha);if(O.length===0)throw new Error("Invalid path ".concat(S));if(A=O[O.length-1],!A)throw new Error("Invalid path ".concat(S,". File Not Found."));O.pop();for(let Q of O)T=await T.getDirectoryHandle(Q,{create:!0})}let M=await T.getFileHandle(A,{create:!1}).catch(O=>{if((O==null?void 0:O.name)==="NotFoundError")return console.debug("File ".concat(l," does not exists yet, creating...")),T.getFileHandle(A,{create:!0});throw O});try{let O=await M.createSyncAccessHandle();return se._preparedHandles[l]=O,{path:l,handle:O,fromCached:!1}}catch(O){throw new Error(O.message+":"+name)}},g=[];for(let l of w){let E=await y(l);g.push(E)}return g}throw new Error("Unsupported protocol ".concat(d," for paths ").concat(w," with protocol ").concat(d))},async prepareDBFileHandle(w,d){if(d===3&&this.prepareFileHandles){let y=[w,"".concat(w,".wal")];return this.prepareFileHandles(y,d)}throw new Error("Unsupported protocol ".concat(d," for path ").concat(w," with protocol ").concat(d))},testPlatformFeature:(w,d)=>{switch(d){case 1:return typeof BigInt64Array<"u";default:return console.warn("test for unknown feature: ".concat(d)),!1}},getDefaultDataProtocol(w){return 2},openFile:(w,d,y)=>{var g,l,E,T,S,A;try{se._fileInfoCache.delete(d);let M=se.getFileInfo(w,d);switch(M==null?void 0:M.dataProtocol){case 4:case 5:{if(y&1&&y&2)throw new Error("Opening file ".concat(M.fileName," failed: cannot open file with both read and write flags set"));if(y&32)throw new Error("Opening file ".concat(M.fileName," failed: appending to HTTP/S3 files is not supported"));if(y&2){let ie=new XMLHttpRequest;if(M.dataProtocol==5?(ie.open("HEAD",er(M.s3Config,M.dataUrl),!1),Ze(ie,M.s3Config,M.dataUrl,"HEAD")):ie.open("HEAD",M.dataUrl,!1),ie.send(null),ie.status!=200&&ie.status!=404)throw new Error("Opening file ".concat(M.fileName," failed: Unexpected return status from server (").concat(ie.status,")"));if(ie.status==404&&!(y&8||y&16))throw new Error("Opening file ".concat(M.fileName," failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag."));let V=w._malloc(1),ke=new Uint8Array;w.HEAPU8.set(ke,V);let oe=w._malloc(3*8);return w.HEAPF64[(oe>>3)+0]=1,w.HEAPF64[(oe>>3)+1]=V,w.HEAPF64[(oe>>3)+2]=new Date().getTime()/1e3,oe}else if(!(y&1))throw new Error("Opening file ".concat(M.fileName," failed: unsupported file flags: ").concat(y));let O=null,Q=null;if(!M.forceFullHttpReads&&(M.reliableHeadRequests||!M.allowFullHttpReads))try{let ie=new XMLHttpRequest;M.dataProtocol==5?(ie.open("HEAD",er(M.s3Config,M.dataUrl),!1),Ze(ie,M.s3Config,M.dataUrl,"HEAD")):ie.open("HEAD",M.dataUrl,!1),ie.setRequestHeader("Range","bytes=0-"),ie.send(null),O=null;try{O=ie.getResponseHeader("Content-Length")}catch(V){console.warn("Failed to get Content-Length on request")}if(O!==null&&ie.status==206){let V=w._malloc(24);w.HEAPF64[(V>>3)+0]=+O,w.HEAPF64[(V>>3)+1]=0;let ke=0;try{ke=new Date((g=ie.getResponseHeader("Last-Modified"))!=null?g:"").getTime()/1e3}catch(oe){console.warn("Failed to get Last-Modified on request")}return w.HEAPF64[(V>>3)+2]=+ke,V}}catch(ie){Q=ie,console.warn("HEAD request with range header failed: ".concat(ie))}if(M.allowFullHttpReads){if(!M.forceFullHttpReads){let V=new XMLHttpRequest;M.dataProtocol==5?(V.open("GET",er(M.s3Config,M.dataUrl),!1),Ze(V,M.s3Config,M.dataUrl,"GET")):V.open("GET",M.dataUrl,!1),V.responseType="arraybuffer",V.setRequestHeader("Range","bytes=0-0"),V.send(null);let ke=null;try{ke=V.getResponseHeader("Content-Length")}catch(ye){console.warn("Failed to get Content-Length on request")}let oe=ke==null?void 0:ke.split("/")[1],Se=ke,De=null;if(oe!==void 0)De=oe;else if(!M.reliableHeadRequests){let ye=new XMLHttpRequest;M.dataProtocol==5?(ye.open("HEAD",er(M.s3Config,M.dataUrl),!1),Ze(ye,M.s3Config,M.dataUrl,"HEAD")):ye.open("HEAD",M.dataUrl,!1),ye.setRequestHeader("Range","bytes=0-"),ye.send(null),O=null;try{O=ye.getResponseHeader("Content-Length")}catch(we){console.warn("Failed to get Content-Length on request")}O!==null&&+O>1&&(De=O)}if(V.status==206&&Se!==null&&+Se==1&&De!==null){let ye=w._malloc(24);w.HEAPF64[(ye>>3)+0]=+De,w.HEAPF64[(ye>>3)+1]=0;let we=0;try{we=new Date((l=V.getResponseHeader("Last-Modified"))!=null?l:"").getTime()/1e3}catch(Ie){console.warn("Failed to get Last-Modified on request")}return w.HEAPF64[(ye>>3)+2]=+we,ye}if(V.status==200&&Se!==null&&O!==null&&+Se==+O){console.warn("fall back to full HTTP read for: ".concat(M.dataUrl));let ye=w._malloc(V.response.byteLength),we=new Uint8Array(V.response,0,V.response.byteLength);w.HEAPU8.set(we,ye);let Ie=w._malloc(3*8);w.HEAPF64[(Ie>>3)+0]=V.response.byteLength,w.HEAPF64[(Ie>>3)+1]=ye;let Fe=0;try{Fe=new Date((E=V.getResponseHeader("Last-Modified"))!=null?E:"").getTime()/1e3}catch(x){console.warn("Failed to get Last-Modified on request")}return w.HEAPF64[(Ie>>3)+2]=+Fe,Ie}console.warn("falling back to full HTTP read for: ".concat(M.dataUrl))}let ie=new XMLHttpRequest;if(M.dataProtocol==5?(ie.open("GET",er(M.s3Config,M.dataUrl),!1),Ze(ie,M.s3Config,M.dataUrl,"GET")):ie.open("GET",M.dataUrl,!1),ie.responseType="arraybuffer",ie.send(null),ie.status==200){let V=w._malloc(ie.response.byteLength),ke=new Uint8Array(ie.response,0,ie.response.byteLength);w.HEAPU8.set(ke,V);let oe=w._malloc(3*8);w.HEAPF64[(oe>>3)+0]=ie.response.byteLength,w.HEAPF64[(oe>>3)+1]=V;let Se=0;try{Se=new Date((T=ie.getResponseHeader("Last-Modified"))!=null?T:"").getTime()/1e3}catch(De){console.warn("Failed to get Last-Modified on request")}return w.HEAPF64[(oe>>3)+2]=+Se,oe}}if(Q!=null)throw new Error("Reading file ".concat(M.fileName," failed with error: ").concat(Q));return 0}case 2:{let O=(S=se._files)==null?void 0:S.get(M.fileName);if(O){let V=w._malloc(24);return w.HEAPF64[(V>>3)+0]=O.size,w.HEAPF64[(V>>3)+1]=0,w.HEAPF64[(V>>3)+2]=0,V}if(y&128)return 0;console.warn("Buffering missing file: ".concat(M.fileName));let Q=w._malloc(3*8),ie=w._malloc(1);return w.HEAPF64[(Q>>3)+0]=1,w.HEAPF64[(Q>>3)+1]=ie,w.HEAPF64[(Q>>3)+2]=0,Q}case 3:{let O=(A=se._files)==null?void 0:A.get(M.fileName);if(!O)throw new Error("No OPFS access handle registered with name: ".concat(M.fileName));y&16&&O.truncate(0);let Q=w._malloc(3*8),ie=O.getSize();return w.HEAPF64[(Q>>3)+0]=ie,w.HEAPF64[(Q>>3)+1]=0,w.HEAPF64[(Q>>3)+2]=0,Q}}}catch(M){console.error(M.toString()),Xe(w,M.toString())}return 0},glob:(w,d,y)=>{var g;try{let l=ue(w,d,y);if(l.startsWith("http")||l.startsWith("s3://")){let E=new XMLHttpRequest;if(l.startsWith("s3://")){let T=se.getGlobalFileInfo(w);E.open("HEAD",er(T==null?void 0:T.s3Config,l),!1),Ze(E,T==null?void 0:T.s3Config,l,"HEAD")}else E.open("HEAD",l,!1);if(E.send(null),E.status!=200&&E.status!==206){if(!((g=se.getGlobalFileInfo(w))!=null&&g.allowFullHttpReads))return console.log("HEAD request failed: ".concat(l,", with full http reads are disabled")),0;let T=new XMLHttpRequest;if(l.startsWith("s3://")){let A=se.getGlobalFileInfo(w);T.open("GET",er(A==null?void 0:A.s3Config,l),!1),Ze(T,A==null?void 0:A.s3Config,l,"HEAD")}else T.open("GET",l,!1);if(T.setRequestHeader("Range","bytes=0-0"),T.send(null),T.status!=200&&T.status!==206)return console.log("HEAD and GET requests failed: ".concat(l)),0;let S=null;try{S=T.getResponseHeader("Content-Length")}catch(A){console.warn("Failed to get Content-Length on request")}S&&+S>1&&console.warn("Range request for ".concat(l," did not return a partial response: ").concat(T.status,' "').concat(T.statusText,'"'))}w.ccall("duckdb_web_fs_glob_add_path",null,["string"],[l])}else for(let[E]of se._files.entries()||[])E.startsWith(l)&&w.ccall("duckdb_web_fs_glob_add_path",null,["string"],[E])}catch(l){return console.log(l),Xe(w,l.toString()),0}},checkFile:(w,d,y)=>{try{let g=ue(w,d,y);if(g.startsWith("http")||g.startsWith("s3://")){let l=new XMLHttpRequest;if(g.startsWith("s3://")){let E=se.getGlobalFileInfo(w);l.open("HEAD",er(E==null?void 0:E.s3Config,g),!1),Ze(l,E==null?void 0:E.s3Config,g,"HEAD")}else l.open("HEAD",g,!1);return l.send(null),l.status==206||l.status==200}else return se._files.has(g)}catch(g){return console.log(g),!1}return!1},syncFile:(w,d)=>{},closeFile:(w,d)=>{var g;let y=se.getFileInfo(w,d);se._fileInfoCache.delete(d);try{switch(y==null?void 0:y.dataProtocol){case 0:case 4:case 5:break;case 1:case 2:return;case 3:{let l=(g=se._files)==null?void 0:g.get(y.fileName);if(!l)throw new Error("No OPFS access handle registered with name: ".concat(y.fileName));return l.flush()}}}catch(l){console.log(l),Xe(w,l.toString())}},dropFile:(w,d,y)=>{var E;let g=ue(w,d,y),l=(E=se._files)==null?void 0:E.get(g);if(l){if(se._files.delete(g),l instanceof FileSystemSyncAccessHandle)try{l.flush(),l.close()}catch(T){throw new Error("Cannot drop file with name: ".concat(g))}l instanceof Blob}},truncateFile:(w,d,y)=>{var l;let g=se.getFileInfo(w,d);switch(g==null?void 0:g.dataProtocol){case 4:Xe(w,"Cannot truncate a http file");return;case 5:Xe(w,"Cannot truncate an s3 file");return;case 0:case 1:case 2:Xe(w,"truncateFile not implemented");return;case 3:{let E=(l=se._files)==null?void 0:l.get(g.fileName);if(!E)throw new Error("No OPFS access handle registered with name: ".concat(g.fileName));return E.truncate(y)}}return 0},readFile(w,d,y,g,l){var E;if(g==0)return 0;try{let T=se.getFileInfo(w,d);switch(T==null?void 0:T.dataProtocol){case 4:case 5:{if(!T.dataUrl)throw new Error("Missing data URL for file ".concat(d));try{let S=new XMLHttpRequest;if(T.dataProtocol==5?(S.open("GET",er(T==null?void 0:T.s3Config,T.dataUrl),!1),Ze(S,T==null?void 0:T.s3Config,T.dataUrl,"GET")):S.open("GET",T.dataUrl,!1),S.responseType="arraybuffer",S.setRequestHeader("Range","bytes=".concat(l,"-").concat(l+g-1)),S.send(null),S.status==206||S.status==200&&g==S.response.byteLength&&l==0){let A=new Uint8Array(S.response,0,Math.min(S.response.byteLength,g));return w.HEAPU8.set(A,y),A.byteLength}else if(S.status==200){console.warn("Range request for ".concat(T.dataUrl," did not return a partial response: ").concat(S.status,' "').concat(S.statusText,'"'));let A=new Uint8Array(S.response,l,Math.min(S.response.byteLength-l,g));return w.HEAPU8.set(A,y),A.byteLength}else throw new Error("Range request for ".concat(T.dataUrl," did returned non-success status: ").concat(S.status,' "').concat(S.statusText,'"'))}catch(S){throw console.log(S),new Error("Range request for ".concat(T.dataUrl," failed with error: ").concat(S,'"'))}}case 2:{let S=(E=se._files)==null?void 0:E.get(T.fileName);if(!S)throw new Error("No HTML5 file registered with name: ".concat(T.fileName));let A=S.slice(l,l+g),M=new Uint8Array(new FileReaderSync().readAsArrayBuffer(A));return w.HEAPU8.set(M,y),M.byteLength}case 3:{let S=se._files.get(T.fileName);if(!S)throw new Error("No OPFS access handle registered with name: ".concat(T.fileName));let A=w.HEAPU8.subarray(y,y+g);return S.read(A,{at:l})}}return 0}catch(T){return console.log(T),Xe(w,T.toString()),0}},writeFile:(w,d,y,g,l)=>{var T;let E=se.getFileInfo(w,d);switch(E==null?void 0:E.dataProtocol){case 4:return Xe(w,"Cannot write to HTTP file"),0;case 5:{let S=w.HEAPU8.subarray(y,y+g),A=new XMLHttpRequest;return A.open("PUT",er(E==null?void 0:E.s3Config,E.dataUrl),!1),Ze(A,E==null?void 0:E.s3Config,E.dataUrl,"PUT","",S),A.send(S),A.status!==200?(Xe(w,"Failed writing file: HTTP "+A.status),0):g}case 2:return Xe(w,"cannot write using the html5 file reader api"),0;case 3:{let S=(T=se._files)==null?void 0:T.get(E.fileName);if(!S)throw new Error("No OPFS access handle registered with name: ".concat(E.fileName));let A=w.HEAPU8.subarray(y,y+g);return S.write(A,{at:l})}}return 0},getLastFileModificationTime:(w,d)=>{var g;let y=se.getFileInfo(w,d);switch(y==null?void 0:y.dataProtocol){case 2:{if(!((g=se._files)==null?void 0:g.get(y.fileName)))throw Error("No handle available for file: ".concat(y.fileName));return 0}case 4:case 5:return new Date().getTime()/1e3}return 0},progressUpdate:(w,d,y)=>{postMessage&&postMessage({requestId:0,type:"PROGRESS_UPDATE",data:{status:w?"completed":"in-progress",percentage:d,repetitions:y}})},checkDirectory:(w,d,y)=>{let g=ue(w,d,y);return console.log("checkDirectory: ".concat(g)),!1},createDirectory:(w,d,y)=>{let g=ue(w,d,y);console.log("createDirectory: ".concat(g))},removeDirectory:(w,d,y)=>{let g=ue(w,d,y);console.log("removeDirectory: ".concat(g))},listDirectoryEntries:(w,d,y)=>{let g=ue(w,d,y);return console.log("listDirectoryEntries: ".concat(g)),!1},moveFile:(w,d,y,g,l)=>{var A,M;let E=ue(w,d,y),T=ue(w,g,l),S=(A=se._files)==null?void 0:A.get(E);S!==void 0&&(se._files.delete(S),se._files.set(T,S));for(let[O,Q]of((M=se._fileInfoCache)==null?void 0:M.entries())||[])if(Q.dataUrl==E){se._fileInfoCache.delete(O);break}return!0},removeFile:(w,d,y)=>{},callScalarUDF:(w,d,y,g,l,E,T)=>{Ct(se,w,d,y,g,l,E,T)}};var Na=qr(Ba());var Ar=class extends Vr{constructor(d,y,g,l){super(d,y),this.mainModuleURL=g,this.pthreadWorkerURL=l}locateFile(d,y){if(d.endsWith(".wasm"))return this.mainModuleURL;if(d.endsWith(".worker.js")){if(!this.pthreadWorkerURL)throw new Error("Missing DuckDB worker URL!");return this.pthreadWorkerURL}throw new Error("WASM instantiation requested unexpected file: prefix=".concat(y," path=").concat(d))}instantiateWasm(d,y){globalThis.DUCKDB_RUNTIME=this._runtime;let g=this.onInstantiationProgress;if(WebAssembly.instantiateStreaming)if(typeof TransformStream=="function"){let E=(async()=>{var ke;let T=new Request(this.mainModuleURL),S=await fetch(T),A=S.headers.get("content-length"),M=A&&parseInt(A,10)||0,O=new Date,Q={startedAt:O,updatedAt:O,bytesTotal:M||0,bytesLoaded:0},ie={transform(oe,Se){Q.bytesLoaded+=oe.byteLength;let De=new Date;if(De.getTime()-Q.updatedAt.getTime()<20){Q.updatedAt=De,Se.enqueue(oe);return}for(let ye of g)ye(Q);Se.enqueue(oe)}},V=new TransformStream(ie);return new Response((ke=S.body)==null?void 0:ke.pipeThrough(V),S)})();WebAssembly.instantiateStreaming(E,d).then(T=>{y(T.instance,T.module)})}else{console.warn("instantiating without progress handler since transform streams are unavailable");let l=new Request(this.mainModuleURL);WebAssembly.instantiateStreaming(fetch(l),d).then(E=>{y(E.instance,E.module)})}else if(typeof XMLHttpRequest=="function"){let l=new XMLHttpRequest,E=this.mainModuleURL,T=new Date,S={startedAt:T,updatedAt:T,bytesTotal:0,bytesLoaded:0};l.open("GET",E),l.responseType="arraybuffer",l.onerror=A=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+A}),new Error(A.toString())},l.onprogress=A=>{S.bytesTotal=A.total,S.bytesLoaded=A.loaded;let M=new Date;if(M.getTime()-S.updatedAt.getTime()<20){S.updatedAt=M;return}for(let O of g)O(S)},l.onload=()=>{WebAssembly.instantiate(l.response,d).then(A=>{y(A.instance,A.module)}).catch(A=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+A}),new Error(A)})},l.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let E=new Request(this.mainModuleURL),S=await(await fetch(E)).arrayBuffer();WebAssembly.instantiate(S,d).then(A=>{y(A.instance,A.module)})})();return[]}};var It=class extends Ar{constructor(d,y,g,l=null){super(d,y,g,l)}instantiateImpl(d){return(0,Na.default)({...d,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};var La=qr(Ma());var Nt=class extends Ar{constructor(d,y,g,l=null){super(d,y,g,l)}instantiateImpl(d){return(0,La.default)({...d,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};async function Td(w,d,y){return(await Ut()).wasmExceptions&&w.eh?new Nt(d,y,w.eh.mainModule):new It(d,y,w.mvp.mainModule)}
|
|
1
|
+
"use strict";var qs=Object.create;var Pe=Object.defineProperty;var js=Object.getOwnPropertyDescriptor;var Gs=Object.getOwnPropertyNames;var $s=Object.getPrototypeOf,Ks=Object.prototype.hasOwnProperty;var Xs=(n,t,s)=>t in n?Pe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var Re=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),Vs=(n,t)=>{for(var s in t)Pe(n,s,{get:t[s],enumerable:!0})},rt=(n,t,s,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of Gs(t))!Ks.call(n,e)&&e!==s&&Pe(n,e,{get:()=>t[e],enumerable:!(o=js(t,e))||o.enumerable});return n};var Xe=(n,t,s)=>(s=n!=null?qs($s(n)):{},rt(t||!n||!n.__esModule?Pe(s,"default",{value:n,enumerable:!0}):s,n)),zs=n=>rt(Pe({},"__esModule",{value:!0}),n);var tt=(n,t,s)=>(Xs(n,typeof t!="symbol"?t+"":t,s),s);var Et=Re(()=>{});var Dt=Re(()=>{});var St=Re((No,Ze)=>{(function(){"use strict";var n="input is invalid type",t=typeof window=="object",s=t?window:{};s.JS_SHA256_NO_WINDOW&&(t=!1);var o=!t&&typeof self=="object",e=!s.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node&&process.type!="renderer";e?s=global:o&&(s=self);var u=!s.JS_SHA256_NO_COMMON_JS&&typeof Ze=="object"&&Ze.exports,l=typeof define=="function"&&define.amd,f=!s.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),v=[-2147483648,8388608,32768,128],S=[24,16,8,0],U=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],C=["hex","array","digest","arrayBuffer"],T=[];(s.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(h){return Object.prototype.toString.call(h)==="[object Array]"}),f&&(s.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(h){return typeof h=="object"&&h.buffer&&h.buffer.constructor===ArrayBuffer});var ee=function(h,F){return function(x){return new z(F,!0).update(x)[h]()}},j=function(h){var F=ee("hex",h);e&&(F=te(F,h)),F.create=function(){return new z(h)},F.update=function(R){return F.create().update(R)};for(var x=0;x<C.length;++x){var m=C[x];F[m]=ee(m,h)}return F},te=function(h,F){var x=Et(),m=Dt().Buffer,R=F?"sha224":"sha256",D;m.from&&!s.JS_SHA256_NO_BUFFER_FROM?D=m.from:D=function(p){return new m(p)};var N=function(p){if(typeof p=="string")return x.createHash(R).update(p,"utf8").digest("hex");if(p==null)throw new Error(n);return p.constructor===ArrayBuffer&&(p=new Uint8Array(p)),Array.isArray(p)||ArrayBuffer.isView(p)||p.constructor===m?x.createHash(R).update(D(p)).digest("hex"):h(p)};return N},ne=function(h,F){return function(x,m){return new oe(x,F,!0).update(m)[h]()}},Q=function(h){var F=ne("hex",h);F.create=function(R){return new oe(R,h)},F.update=function(R,D){return F.create(R).update(D)};for(var x=0;x<C.length;++x){var m=C[x];F[m]=ne(m,h)}return F};function z(h,F){F?(T[0]=T[16]=T[1]=T[2]=T[3]=T[4]=T[5]=T[6]=T[7]=T[8]=T[9]=T[10]=T[11]=T[12]=T[13]=T[14]=T[15]=0,this.blocks=T):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=h}z.prototype.update=function(h){if(!this.finalized){var F,x=typeof h;if(x!=="string"){if(x==="object"){if(h===null)throw new Error(n);if(f&&h.constructor===ArrayBuffer)h=new Uint8Array(h);else if(!Array.isArray(h)&&(!f||!ArrayBuffer.isView(h)))throw new Error(n)}else throw new Error(n);F=!0}for(var m,R=0,D,N=h.length,p=this.blocks;R<N;){if(this.hashed&&(this.hashed=!1,p[0]=this.block,this.block=p[16]=p[1]=p[2]=p[3]=p[4]=p[5]=p[6]=p[7]=p[8]=p[9]=p[10]=p[11]=p[12]=p[13]=p[14]=p[15]=0),F)for(D=this.start;R<N&&D<64;++R)p[D>>>2]|=h[R]<<S[D++&3];else for(D=this.start;R<N&&D<64;++R)m=h.charCodeAt(R),m<128?p[D>>>2]|=m<<S[D++&3]:m<2048?(p[D>>>2]|=(192|m>>>6)<<S[D++&3],p[D>>>2]|=(128|m&63)<<S[D++&3]):m<55296||m>=57344?(p[D>>>2]|=(224|m>>>12)<<S[D++&3],p[D>>>2]|=(128|m>>>6&63)<<S[D++&3],p[D>>>2]|=(128|m&63)<<S[D++&3]):(m=65536+((m&1023)<<10|h.charCodeAt(++R)&1023),p[D>>>2]|=(240|m>>>18)<<S[D++&3],p[D>>>2]|=(128|m>>>12&63)<<S[D++&3],p[D>>>2]|=(128|m>>>6&63)<<S[D++&3],p[D>>>2]|=(128|m&63)<<S[D++&3]);this.lastByteIndex=D,this.bytes+=D-this.start,D>=64?(this.block=p[16],this.start=D-64,this.hash(),this.hashed=!0):this.start=D}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},z.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var h=this.blocks,F=this.lastByteIndex;h[16]=this.block,h[F>>>2]|=v[F&3],this.block=h[16],F>=56&&(this.hashed||this.hash(),h[0]=this.block,h[16]=h[1]=h[2]=h[3]=h[4]=h[5]=h[6]=h[7]=h[8]=h[9]=h[10]=h[11]=h[12]=h[13]=h[14]=h[15]=0),h[14]=this.hBytes<<3|this.bytes>>>29,h[15]=this.bytes<<3,this.hash()}},z.prototype.hash=function(){var h=this.h0,F=this.h1,x=this.h2,m=this.h3,R=this.h4,D=this.h5,N=this.h6,p=this.h7,B=this.blocks,P,A,$,he,K,ue,ce,we,xe,Be,Ie;for(P=16;P<64;++P)K=B[P-15],A=(K>>>7|K<<25)^(K>>>18|K<<14)^K>>>3,K=B[P-2],$=(K>>>17|K<<15)^(K>>>19|K<<13)^K>>>10,B[P]=B[P-16]+A+B[P-7]+$<<0;for(Ie=F&x,P=0;P<64;P+=4)this.first?(this.is224?(we=300032,K=B[0]-1413257819,p=K-150054599<<0,m=K+24177077<<0):(we=704751109,K=B[0]-210244248,p=K-1521486534<<0,m=K+143694565<<0),this.first=!1):(A=(h>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),$=(R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7),we=h&F,he=we^h&x^Ie,ce=R&D^~R&N,K=p+$+ce+U[P]+B[P],ue=A+he,p=m+K<<0,m=K+ue<<0),A=(m>>>2|m<<30)^(m>>>13|m<<19)^(m>>>22|m<<10),$=(p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7),xe=m&h,he=xe^m&F^we,ce=p&R^~p&D,K=N+$+ce+U[P+1]+B[P+1],ue=A+he,N=x+K<<0,x=K+ue<<0,A=(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10),$=(N>>>6|N<<26)^(N>>>11|N<<21)^(N>>>25|N<<7),Be=x&m,he=Be^x&h^xe,ce=N&p^~N&R,K=D+$+ce+U[P+2]+B[P+2],ue=A+he,D=F+K<<0,F=K+ue<<0,A=(F>>>2|F<<30)^(F>>>13|F<<19)^(F>>>22|F<<10),$=(D>>>6|D<<26)^(D>>>11|D<<21)^(D>>>25|D<<7),Ie=F&x,he=Ie^F&m^Be,ce=D&N^~D&p,K=R+$+ce+U[P+3]+B[P+3],ue=A+he,R=h+K<<0,h=K+ue<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+h<<0,this.h1=this.h1+F<<0,this.h2=this.h2+x<<0,this.h3=this.h3+m<<0,this.h4=this.h4+R<<0,this.h5=this.h5+D<<0,this.h6=this.h6+N<<0,this.h7=this.h7+p<<0},z.prototype.hex=function(){this.finalize();var h=this.h0,F=this.h1,x=this.h2,m=this.h3,R=this.h4,D=this.h5,N=this.h6,p=this.h7,B=c[h>>>28&15]+c[h>>>24&15]+c[h>>>20&15]+c[h>>>16&15]+c[h>>>12&15]+c[h>>>8&15]+c[h>>>4&15]+c[h&15]+c[F>>>28&15]+c[F>>>24&15]+c[F>>>20&15]+c[F>>>16&15]+c[F>>>12&15]+c[F>>>8&15]+c[F>>>4&15]+c[F&15]+c[x>>>28&15]+c[x>>>24&15]+c[x>>>20&15]+c[x>>>16&15]+c[x>>>12&15]+c[x>>>8&15]+c[x>>>4&15]+c[x&15]+c[m>>>28&15]+c[m>>>24&15]+c[m>>>20&15]+c[m>>>16&15]+c[m>>>12&15]+c[m>>>8&15]+c[m>>>4&15]+c[m&15]+c[R>>>28&15]+c[R>>>24&15]+c[R>>>20&15]+c[R>>>16&15]+c[R>>>12&15]+c[R>>>8&15]+c[R>>>4&15]+c[R&15]+c[D>>>28&15]+c[D>>>24&15]+c[D>>>20&15]+c[D>>>16&15]+c[D>>>12&15]+c[D>>>8&15]+c[D>>>4&15]+c[D&15]+c[N>>>28&15]+c[N>>>24&15]+c[N>>>20&15]+c[N>>>16&15]+c[N>>>12&15]+c[N>>>8&15]+c[N>>>4&15]+c[N&15];return this.is224||(B+=c[p>>>28&15]+c[p>>>24&15]+c[p>>>20&15]+c[p>>>16&15]+c[p>>>12&15]+c[p>>>8&15]+c[p>>>4&15]+c[p&15]),B},z.prototype.toString=z.prototype.hex,z.prototype.digest=function(){this.finalize();var h=this.h0,F=this.h1,x=this.h2,m=this.h3,R=this.h4,D=this.h5,N=this.h6,p=this.h7,B=[h>>>24&255,h>>>16&255,h>>>8&255,h&255,F>>>24&255,F>>>16&255,F>>>8&255,F&255,x>>>24&255,x>>>16&255,x>>>8&255,x&255,m>>>24&255,m>>>16&255,m>>>8&255,m&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255,N>>>24&255,N>>>16&255,N>>>8&255,N&255];return this.is224||B.push(p>>>24&255,p>>>16&255,p>>>8&255,p&255),B},z.prototype.array=z.prototype.digest,z.prototype.arrayBuffer=function(){this.finalize();var h=new ArrayBuffer(this.is224?28:32),F=new DataView(h);return F.setUint32(0,this.h0),F.setUint32(4,this.h1),F.setUint32(8,this.h2),F.setUint32(12,this.h3),F.setUint32(16,this.h4),F.setUint32(20,this.h5),F.setUint32(24,this.h6),this.is224||F.setUint32(28,this.h7),h};function oe(h,F,x){var m,R=typeof h;if(R==="string"){var D=[],N=h.length,p=0,B;for(m=0;m<N;++m)B=h.charCodeAt(m),B<128?D[p++]=B:B<2048?(D[p++]=192|B>>>6,D[p++]=128|B&63):B<55296||B>=57344?(D[p++]=224|B>>>12,D[p++]=128|B>>>6&63,D[p++]=128|B&63):(B=65536+((B&1023)<<10|h.charCodeAt(++m)&1023),D[p++]=240|B>>>18,D[p++]=128|B>>>12&63,D[p++]=128|B>>>6&63,D[p++]=128|B&63);h=D}else if(R==="object"){if(h===null)throw new Error(n);if(f&&h.constructor===ArrayBuffer)h=new Uint8Array(h);else if(!Array.isArray(h)&&(!f||!ArrayBuffer.isView(h)))throw new Error(n)}else throw new Error(n);h.length>64&&(h=new z(F,!0).update(h).array());var P=[],A=[];for(m=0;m<64;++m){var $=h[m]||0;P[m]=92^$,A[m]=54^$}z.call(this,F,x),this.update(A),this.oKeyPad=P,this.inner=!0,this.sharedMemory=x}oe.prototype=new z,oe.prototype.finalize=function(){if(z.prototype.finalize.call(this),this.inner){this.inner=!1;var h=this.array();z.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(h),z.prototype.finalize.call(this)}};var se=j();se.sha256=se,se.sha224=j(!0),se.sha256.hmac=Q(),se.sha224.hmac=Q(!0),u?Ze.exports=se:(s.sha256=se.sha256,s.sha224=se.sha224,l&&define(function(){return se}))})()});var Tt=Re(()=>{});var Ut=Re(()=>{});var Bt=Re((xt,er)=>{"use strict";var Tr=(()=>{var t;var n=typeof document<"u"?(t=document.currentScript)==null?void 0:t.src:void 0;return typeof __filename<"u"&&(n=n||__filename),async function(s={}){var o,e=s,u,l,f=new Promise((r,a)=>{u=r,l=a}),c=typeof window=="object",v=typeof WorkerGlobalScope<"u",S=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",U=Object.assign({},e),C=[],T="./this.program",ee=(r,a)=>{throw a},j="";function te(r){return e.locateFile?e.locateFile(r,j):j+r}var ne,Q;if(S){var z=Tt(),oe=Ut();j=__dirname+"/",Q=r=>{r=ce(r)?new URL(r):r;var a=z.readFileSync(r);return a},ne=async(r,a=!0)=>{r=ce(r)?new URL(r):r;var i=z.readFileSync(r,a?void 0:"utf8");return i},!e.thisProgram&&process.argv.length>1&&(T=process.argv[1].replace(/\\/g,"/")),C=process.argv.slice(2),ee=(r,a)=>{throw process.exitCode=r,a}}else(c||v)&&(v?j=self.location.href:typeof document<"u"&&document.currentScript&&(j=document.currentScript.src),n&&(j=n),j.startsWith("blob:")?j="":j=j.slice(0,j.replace(/[?#].*/,"").lastIndexOf("/")+1),v&&(Q=r=>{var a=new XMLHttpRequest;return a.open("GET",r,!1),a.responseType="arraybuffer",a.send(null),new Uint8Array(a.response)}),ne=async r=>{var a=await fetch(r,{credentials:"same-origin"});if(a.ok)return a.arrayBuffer();throw new Error(a.status+" : "+a.url)});var se=e.print||console.log.bind(console),h=e.printErr||console.error.bind(console);Object.assign(e,U),U=null,e.arguments&&(C=e.arguments),e.thisProgram&&(T=e.thisProgram);var F=e.wasmBinary,x,m=!1,R;function D(r,a){r||be(a)}var N,p,B,P,A,$,he,K,ue=!1,ce=r=>r.startsWith("file://");function we(){var r=x.buffer;e.HEAP8=N=new Int8Array(r),e.HEAP16=B=new Int16Array(r),e.HEAPU8=p=new Uint8Array(r),e.HEAPU16=P=new Uint16Array(r),e.HEAP32=A=new Int32Array(r),e.HEAPU32=$=new Uint32Array(r),e.HEAPF32=he=new Float32Array(r),e.HEAPF64=K=new Float64Array(r)}function xe(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Kt(e.preRun.shift());xr(Ir)}function Be(){ue=!0,I.ua()}function Ie(){}function Ht(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)$t(e.postRun.shift());xr(Br)}var Fe=0,He=null;function Nt(r){var a;Fe++,(a=e.monitorRunDependencies)==null||a.call(e,Fe)}function Ct(r){var i;if(Fe--,(i=e.monitorRunDependencies)==null||i.call(e,Fe),Fe==0&&He){var a=He;He=null,a()}}function be(r){var i;(i=e.onAbort)==null||i.call(e,r),r="Aborted("+r+")",h(r),m=!0,r+=". Build with -sASSERTIONS for more info.",ue&&___trap();var a=new WebAssembly.RuntimeError(r);throw l(a),a}var Ne;function Pt(){return te("./duckdb-eh.wasm")}function Lt(r){if(r==Ne&&F)return new Uint8Array(F);if(Q)return Q(r);throw"both async and sync fetching of the wasm failed"}async function Ot(r){if(!F)try{var a=await ne(r);return new Uint8Array(a)}catch(i){}return Lt(r)}async function Mt(r,a){try{var i=await Ot(r),d=await WebAssembly.instantiate(i,a);return d}catch(_){h("failed to asynchronously prepare wasm: ".concat(_)),be(_)}}async function Wt(r,a,i){if(!r&&typeof WebAssembly.instantiateStreaming=="function"&&!S)try{var d=fetch(a,{credentials:"same-origin"}),_=await WebAssembly.instantiateStreaming(d,i);return _}catch(b){h("wasm streaming compile failed: ".concat(b)),h("falling back to ArrayBuffer instantiation")}return Mt(a,i)}function qt(){return{a:Is}}async function jt(){function r(b,g){return I=b.exports,I=Ms(I),x=I.ta,we(),Ct("wasm-instantiate"),I}Nt("wasm-instantiate");function a(b){return r(b.instance)}var i=qt();if(e.instantiateWasm)return new Promise((b,g)=>{e.instantiateWasm(i,(y,k)=>{r(y,k),b(y.exports)})});Ne!=null||(Ne=Pt());try{var d=await Wt(F,Ne,i),_=a(d);return _}catch(b){return l(b),Promise.reject(b)}}var ae,ye,Gt={10168112:(r,a,i,d)=>{var _=J(r);if(typeof XMLHttpRequest>"u")return 0;let b=new XMLHttpRequest;b.open(J(d),_,!1),b.responseType="arraybuffer";for(var g=0,w=a;g<w*2;){var y=A[i/4+g>>>0],k=A[i/4+g+1>>>0];try{var H=encodeURI(J(y));H==="Host"&&(H="X-Host-Override"),H==="User-Agent"&&(H="X-user-agent"),H==="Authorization"?b.setRequestHeader(H,J(k)):b.setRequestHeader(H,encodeURI(J(k)))}catch(re){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",re)}g+=2}try{b.send(null)}catch(re){return 0}if(b.status>=400)return 0;for(var M=b.response,w=M.byteLength,G=De(w+4),X=new Uint8Array(M),W=0;W<w;W++)e.HEAPU8[W+G+4]=X[W];var E=new Uint8Array(4);return E[0]=w%256,w-=E[0],w/=256,E[1]=w%256,w-=E[1],w/=256,E[2]=w%256,w-=E[2],w/=256,E[3]=w%256,w-=E[3],w/=256,e.HEAPU8.set(E,G),G},10169519:(r,a,i,d,_,b)=>{var g=J(r);if(typeof XMLHttpRequest>"u")return 0;let y=new XMLHttpRequest;y.open(J(d),g,!1),y.responseType="arraybuffer";for(var k=0,E=a;k<E*2;){var H=A[i/4+k>>>0],M=A[i/4+k+1>>>0];try{var w=encodeURI(J(H));w==="Host"&&(w="X-Host-Override"),w==="User-Agent"&&(w="X-user-agent"),w==="Authorization"?y.setRequestHeader(w,J(M)):y.setRequestHeader(w,encodeURI(J(M)))}catch(pe){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",pe)}k+=2}try{for(var G=new Uint8Array(b),X=0;X<b;X++)G[X]=e.HEAPU8[X+_];y.send(G)}catch(pe){return 0}if(y.status>=400)return 0;for(var W=Uint8Array.from(Array.from(y.getResponseHeader("Etag")).map(pe=>pe.charCodeAt(0))),E=W.byteLength,re=De(E+4),de=new Uint8Array(W),X=0;X<E;X++)e.HEAPU8[X+re+4]=de[X];var Y=new Uint8Array(4);return Y[0]=E%256,E-=Y[0],E/=256,Y[1]=E%256,E-=Y[1],E/=256,Y[2]=E%256,E-=Y[2],E/=256,Y[3]=E%256,E-=Y[3],E/=256,e.HEAPU8.set(Y,re),re},10171139:(r,a,i,d)=>{var _=J(r);if(typeof XMLHttpRequest>"u")return 0;let b=new XMLHttpRequest;b.open(J(d),_,!1),b.responseType="arraybuffer";for(var g=0,w=a;g<w*2;){var y=A[i/4+g>>>0],k=A[i/4+g+1>>>0];console.log("HEAD",J(y),J(k));try{var H=encodeURI(J(y));H==="Host"&&(H="X-Host-Override"),H==="User-Agent"&&(H="X-user-agent"),H==="Authorization"?b.setRequestHeader(H,J(k)):b.setRequestHeader(H,encodeURI(J(k)))}catch(Y){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Y)}g+=2}try{b.send(null)}catch(Y){return 0}if(b.status>=400)return 0;for(var M=b.response,w=M.byteLength,G=De(w+8),X=new Uint8Array(M),W=0;W<w;W++)e.HEAPU8[W+G+8]=X[W];var E=new Uint8Array(4);E[0]=w%256,w-=E[0],w/=256,E[1]=w%256,w-=E[1],w/=256,E[2]=w%256,w-=E[2],w/=256,E[3]=w%256,w-=E[3],w/=256,e.HEAPU8.set(E,G+4);var re=Uint8Array.from(Array.from(b.getAllResponseHeaders()).map(Y=>Y.charCodeAt(0)));w=re.byteLength;for(var de=De(w+8),W=0;W<w;W++)e.HEAPU8[W+de+8]=re[W];return E=new Uint8Array(4),E[0]=w%256,w-=E[0],w/=256,E[1]=w%256,w-=E[1],w/=256,E[2]=w%256,w-=E[2],w/=256,E[3]=w%256,w-=E[3],w/=256,e.HEAPU8.set(E,de+4),w=de,E=new Uint8Array(4),E[0]=w%256,w-=E[0],w/=256,E[1]=w%256,w-=E[1],w/=256,E[2]=w%256,w-=E[2],w/=256,E[3]=w%256,w-=E[3],w/=256,e.HEAPU8.set(E,G),G},10173484:(r,a,i,d)=>{var _=J(r);if(typeof XMLHttpRequest>"u")return 0;let b=new XMLHttpRequest;b.open(J(d),_,!1),b.responseType="arraybuffer";for(var g=0,w=a;g<w*2;){var y=A[i/4+g>>>0],k=A[i/4+g+1>>>0];try{var H=encodeURI(J(y));H==="Host"&&(H="X-Host-Override"),H==="User-Agent"&&(H="X-user-agent"),H==="Authorization"?b.setRequestHeader(H,J(k)):b.setRequestHeader(H,encodeURI(J(k)))}catch(re){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",re)}g+=2}try{b.send(null)}catch(re){return 0}if(b.status>=400)return 0;for(var M=b.response,w=M.byteLength,G=De(w+4),X=new Uint8Array(M),W=0;W<w;W++)e.HEAPU8[W+G+4]=X[W];var E=new Uint8Array(4);return E[0]=w%256,w-=E[0],w/=256,E[1]=w%256,w-=E[1],w/=256,E[2]=w%256,w-=E[2],w/=256,E[3]=w%256,w-=E[3],w/=256,e.HEAPU8.set(E,G),G},10174891:(r,a,i,d,_,b)=>{var g=J(r);if(typeof XMLHttpRequest>"u")return 0;let y=new XMLHttpRequest;y.open(J(d),g,!1),y.responseType="arraybuffer";for(var k=0,E=a;k<E*2;){var H=A[i/4+k>>>0],M=A[i/4+k+1>>>0];try{var w=encodeURI(J(H));w==="Host"&&(w="X-Host-Override"),w==="User-Agent"&&(w="X-user-agent"),w==="Authorization"?y.setRequestHeader(w,J(M)):y.setRequestHeader(w,encodeURI(J(M)))}catch(pe){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",pe)}k+=2}try{for(var G=new Uint8Array(b),X=0;X<b;X++)G[X]=e.HEAPU8[X+_];y.send(G)}catch(pe){return 0}if(y.status>=400)return 0;for(var W=y.response,E=W.byteLength,re=De(E+4),de=new Uint8Array(W),X=0;X<E;X++)e.HEAPU8[X+re+4]=de[X];var Y=new Uint8Array(4);return Y[0]=E%256,E-=Y[0],E/=256,Y[1]=E%256,E-=Y[1],E/=256,Y[2]=E%256,E-=Y[2],E/=256,Y[3]=E%256,E-=Y[3],E/=256,e.HEAPU8.set(Y,re),re}};class Ur{constructor(a){tt(this,"name","ExitStatus");this.message="Program terminated with exit(".concat(a,")"),this.status=a}}var xr=r=>{for(;r.length>0;)r.shift()(e)},Br=[],$t=r=>Br.unshift(r),Ir=[],Kt=r=>Ir.unshift(r),Xt=e.noExitRuntime||!0;function Hr(){be("missing function: $SOCKFS")}Hr.stub=!0;function nr(){be("missing function: $FS")}nr.stub=!0;var ke=r=>{var a=Hr.getSocket(r);if(!a)throw new nr.ErrnoError(8);return a},sr=r=>(r&255)+"."+(r>>8&255)+"."+(r>>16&255)+"."+(r>>24&255),Nr=r=>{var a="",i=0,d=0,_=0,b=0,g=0,y=0,k=[r[0]&65535,r[0]>>16,r[1]&65535,r[1]>>16,r[2]&65535,r[2]>>16,r[3]&65535,r[3]>>16],H=!0,M="";for(y=0;y<5;y++)if(k[y]!==0){H=!1;break}if(H){if(M=sr(k[6]|k[7]<<16),k[5]===-1)return a="::ffff:",a+=M,a;if(k[5]===0)return a="::",M==="0.0.0.0"&&(M=""),M==="0.0.0.1"&&(M="1"),a+=M,a}for(i=0;i<8;i++)k[i]===0&&(i-_>1&&(g=0),_=i,g++),g>d&&(d=g,b=i-d+1);for(i=0;i<8;i++){if(d>1&&k[i]===0&&i>=b&&i<b+d){i===b&&(a+=":",b===0&&(a+=":"));continue}a+=Number(_ntohs(k[i]&65535)).toString(16),a+=i<7?":":""}return a},Cr=(r,a)=>{var i=B[r>>>1>>>0],d=_ntohs(P[r+2>>>1>>>0]),_;switch(i){case 2:if(a!==16)return{errno:28};_=A[r+4>>>2>>>0],_=sr(_);break;case 10:if(a!==28)return{errno:28};_=[A[r+8>>>2>>>0],A[r+12>>>2>>>0],A[r+16>>>2>>>0],A[r+20>>>2>>>0]],_=Nr(_);break;default:return{errno:5}}return{family:i,addr:_,port:d}},je=r=>{for(var a=r.split("."),i=0;i<4;i++){var d=Number(a[i]);if(isNaN(d))return null;a[i]=d}return(a[0]|a[1]<<8|a[2]<<16|a[3]<<24)>>>0},Ge=r=>parseInt(r),ar=r=>{var a,i,d,_,b=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,g=[];if(!b.test(r))return null;if(r==="::")return[0,0,0,0,0,0,0,0];for(r.startsWith("::")?r=r.replace("::","Z:"):r=r.replace("::",":Z:"),r.indexOf(".")>0?(r=r.replace(new RegExp("[.]","g"),":"),a=r.split(":"),a[a.length-4]=Ge(a[a.length-4])+Ge(a[a.length-3])*256,a[a.length-3]=Ge(a[a.length-2])+Ge(a[a.length-1])*256,a=a.slice(0,a.length-2)):a=r.split(":"),d=0,_=0,i=0;i<a.length;i++)if(typeof a[i]=="string")if(a[i]==="Z"){for(_=0;_<8-a.length+1;_++)g[i+_]=0;d=_-1}else g[i+d]=_htons(parseInt(a[i],16));else g[i+d]=a[i];return[g[1]<<16|g[0],g[3]<<16|g[2],g[5]<<16|g[4],g[7]<<16|g[6]]},ie={address_map:{id:1,addrs:{},names:{}},lookup_name(r){var a=je(r);if(a!==null||(a=ar(r),a!==null))return r;var i;if(ie.address_map.addrs[r])i=ie.address_map.addrs[r];else{var d=ie.address_map.id++;D(d<65535,"exceeded max address mappings of 65535"),i="172.29."+(d&255)+"."+(d&65280),ie.address_map.names[i]=r,ie.address_map.addrs[r]=i}return i},lookup_addr(r){return ie.address_map.names[r]?ie.address_map.names[r]:null}},Pr=(r,a)=>{var i=Cr(r,a);if(i.errno)throw new nr.ErrnoError(i.errno);return i.addr=ie.lookup_addr(i.addr)||i.addr,i},ve=(r,a)=>a+2097152>>>0<4194305-!!r?(r>>>0)+a*4294967296:NaN;function Vt(r,a,i,d,_,b){a>>>=0,i>>>=0;var g=ke(r),y=Pr(a,i);return g.sock_ops.bind(g,y.addr,y.port),0}function zt(r,a,i,d,_,b){a>>>=0,i>>>=0;var g=ke(r),y=Pr(a,i);return g.sock_ops.connect(g,y.addr,y.port),0}var Jt=(r,a,i)=>{};function Qt(r,a,i,d){a>>>=0}var Lr=typeof TextDecoder<"u"?new TextDecoder:void 0,Or=(r,a=0,i=NaN)=>{a>>>=0;for(var d=a+i,_=a;r[_]&&!(_>=d);)++_;if(_-a>16&&r.buffer&&Lr)return Lr.decode(r.subarray(a,_));for(var b="";a<_;){var g=r[a++];if(!(g&128)){b+=String.fromCharCode(g);continue}var y=r[a++]&63;if((g&224)==192){b+=String.fromCharCode((g&31)<<6|y);continue}var k=r[a++]&63;if((g&240)==224?g=(g&15)<<12|y<<6|k:g=(g&7)<<18|y<<12|k<<6|r[a++]&63,g<65536)b+=String.fromCharCode(g);else{var H=g-65536;b+=String.fromCharCode(55296|H>>10,56320|H&1023)}}return b},J=(r,a)=>(r>>>=0,r?Or(p,r,a):""),or={varargs:void 0,getStr(r){var a=J(r);return a}};function Yt(r,a,i){return i>>>=0,or.varargs=i,0}function Zt(r,a){a>>>=0}function en(r,a,i){var d=ve(a,i)}var Mr=r=>{for(var a=0,i=0;i<r.length;++i){var d=r.charCodeAt(i);d<=127?a++:d<=2047?a+=2:d>=55296&&d<=57343?(a+=4,++i):a+=3}return a};e.lengthBytesUTF8=Mr;var rn=(r,a,i,d)=>{if(i>>>=0,!(d>0))return 0;for(var _=i,b=i+d-1,g=0;g<r.length;++g){var y=r.charCodeAt(g);if(y>=55296&&y<=57343){var k=r.charCodeAt(++g);y=65536+((y&1023)<<10)|k&1023}if(y<=127){if(i>=b)break;a[i++>>>0]=y}else if(y<=2047){if(i+1>=b)break;a[i++>>>0]=192|y>>6,a[i++>>>0]=128|y&63}else if(y<=65535){if(i+2>=b)break;a[i++>>>0]=224|y>>12,a[i++>>>0]=128|y>>6&63,a[i++>>>0]=128|y&63}else{if(i+3>=b)break;a[i++>>>0]=240|y>>18,a[i++>>>0]=128|y>>12&63,a[i++>>>0]=128|y>>6&63,a[i++>>>0]=128|y&63}}return a[i>>>0]=0,i-_},Ee=(r,a,i)=>rn(r,p,a,i);e.stringToUTF8=Ee;function tn(r,a){r>>>=0,a>>>=0}function nn(r,a,i){a>>>=0,i>>>=0}var Wr=(r,a)=>{p.fill(0,r,r+a)},$e=(r,a,i,d,_)=>{switch(a){case 2:i=je(i),Wr(r,16),_&&(A[_>>>2>>>0]=16),B[r>>>1>>>0]=a,A[r+4>>>2>>>0]=i,B[r+2>>>1>>>0]=_htons(d);break;case 10:i=ar(i),Wr(r,28),_&&(A[_>>>2>>>0]=28),A[r>>>2>>>0]=a,A[r+8>>>2>>>0]=i[0],A[r+12>>>2>>>0]=i[1],A[r+16>>>2>>>0]=i[2],A[r+20>>>2>>>0]=i[3],B[r+2>>>1>>>0]=_htons(d);break;default:return 5}return 0};function sn(r,a,i,d,_,b){a>>>=0,i>>>=0;var g=ke(r);if(!g.daddr)return-53;var y=$e(a,g.family,ie.lookup_name(g.daddr),g.dport,i);return 0}function an(r,a,i,d,_,b){a>>>=0,i>>>=0;var g=ke(r),y=$e(a,g.family,ie.lookup_name(g.saddr||"0.0.0.0"),g.sport,i);return 0}function on(r,a,i,d,_,b){d>>>=0,_>>>=0;var g=ke(r);return a===1&&i===4?(A[d>>>2>>>0]=g.error,A[_>>>2>>>0]=4,g.error=null,0):-50}function ln(r,a,i){return i>>>=0,or.varargs=i,0}function un(r,a){r>>>=0,a>>>=0}function cn(r,a,i){a>>>=0}function dn(r,a,i,d){a>>>=0,i>>>=0}function fn(r,a,i,d){a>>>=0,d>>>=0,or.varargs=d}function _n(r,a,i){r>>>=0}function hn(r,a,i,d){a>>>=0,i>>>=0,d>>>=0}function bn(r,a,i,d,_,b){a>>>=0,i>>>=0,_>>>=0,b>>>=0;var g=ke(r),y=g.sock_ops.recvmsg(g,i);if(!y)return 0;if(_)var k=$e(_,g.family,ie.lookup_name(y.addr),y.port,b);return p.set(y.buffer,a>>>0),y.buffer.byteLength}function pn(r,a,i,d){a>>>=0,d>>>=0}function mn(r){r>>>=0}function gn(r,a,i,d,_,b){a>>>=0,i>>>=0,_>>>=0,b>>>=0}var yn=(r,a,i)=>{};function wn(r,a){r>>>=0,a>>>=0}function vn(r,a,i){r>>>=0,a>>>=0,i>>>=0}function En(r,a,i){a>>>=0}var Dn=()=>be("");function qr(){be("missing function: _emval_call_method")}qr.stub=!0;function jr(){be("missing function: _emval_decref")}jr.stub=!0;function Gr(){be("missing function: _emval_get_global")}Gr.stub=!0;function $r(){be("missing function: _emval_get_method_caller")}$r.stub=!0;function Kr(){be("missing function: _emval_run_destructors")}Kr.stub=!0;var Sn=r=>r%4===0&&(r%100!==0||r%400===0),An=[0,31,60,91,121,152,182,213,244,274,305,335],Fn=[0,31,59,90,120,151,181,212,243,273,304,334],kn=r=>{var a=Sn(r.getFullYear()),i=a?An:Fn,d=i[r.getMonth()]+r.getDate()-1;return d};function Rn(r,a,i){var d=ve(r,a);i>>>=0;var _=new Date(d*1e3);A[i>>>2>>>0]=_.getSeconds(),A[i+4>>>2>>>0]=_.getMinutes(),A[i+8>>>2>>>0]=_.getHours(),A[i+12>>>2>>>0]=_.getDate(),A[i+16>>>2>>>0]=_.getMonth(),A[i+20>>>2>>>0]=_.getFullYear()-1900,A[i+24>>>2>>>0]=_.getDay();var b=kn(_)|0;A[i+28>>>2>>>0]=b,A[i+36>>>2>>>0]=-(_.getTimezoneOffset()*60);var g=new Date(_.getFullYear(),0,1),y=new Date(_.getFullYear(),6,1).getTimezoneOffset(),k=g.getTimezoneOffset(),H=(y!=k&&_.getTimezoneOffset()==Math.min(k,y))|0;A[i+32>>>2>>>0]=H}function Tn(r,a,i,d,_,b,g,y){r>>>=0;var k=ve(_,b);return g>>>=0,y>>>=0,-52}function Un(r,a,i,d,_,b,g){r>>>=0,a>>>=0;var y=ve(b,g)}var xn=function(r,a,i,d){r>>>=0,a>>>=0,i>>>=0,d>>>=0;var _=new Date().getFullYear(),b=new Date(_,0,1),g=new Date(_,6,1),y=b.getTimezoneOffset(),k=g.getTimezoneOffset(),H=Math.max(y,k);$[r>>>2>>>0]=H*60,A[a>>>2>>>0]=+(y!=k);var M=X=>{var W=X>=0?"-":"+",E=Math.abs(X),re=String(Math.floor(E/60)).padStart(2,"0"),de=String(E%60).padStart(2,"0");return"UTC".concat(W).concat(re).concat(de)},w=M(y),G=M(k);k<y?(Ee(w,i,17),Ee(G,d,17)):(Ee(w,d,17),Ee(G,i,17))},Xr=()=>performance.now(),Vr=()=>Date.now(),Bn=1,In=r=>r>=0&&r<=3;function Hn(r,a,i,d){var _=ve(a,i);if(d>>>=0,!In(r))return 28;var b;if(r===0)b=Vr();else if(Bn)b=Xr();else return 52;var g=Math.round(b*1e3*1e3);return ye=[g>>>0,(ae=g,+Math.abs(ae)>=1?ae>0?+Math.floor(ae/4294967296)>>>0:~~+Math.ceil((ae-+(~~ae>>>0))/4294967296)>>>0:0)],A[d>>>2>>>0]=ye[0],A[d+4>>>2>>>0]=ye[1],0}function Nn(r,a){return r>>>=0,globalThis.DUCKDB_RUNTIME.createDirectory(e,r,a)}function Cn(r,a){return r>>>=0,globalThis.DUCKDB_RUNTIME.checkDirectory(e,r,a)}function Pn(r,a){return r>>>=0,globalThis.DUCKDB_RUNTIME.listDirectoryEntries(e,r,a)}function Ln(r,a){return r>>>=0,globalThis.DUCKDB_RUNTIME.removeDirectory(e,r,a)}function On(r){return globalThis.DUCKDB_RUNTIME.closeFile(e,r)}function Mn(r,a){return r>>>=0,globalThis.DUCKDB_RUNTIME.dropFile(e,r,a)}function Wn(r,a){return r>>>=0,globalThis.DUCKDB_RUNTIME.checkFile(e,r,a)}function qn(r,a,i,d){return r>>>=0,i>>>=0,globalThis.DUCKDB_RUNTIME.moveFile(e,r,a,i,d)}function jn(r,a){return globalThis.DUCKDB_RUNTIME.openFile(e,r,a)}function Gn(r,a,i,d){return a>>>=0,globalThis.DUCKDB_RUNTIME.readFile(e,r,a,i,d)}function $n(r,a){return globalThis.DUCKDB_RUNTIME.truncateFile(e,r,a)}function Kn(r,a,i,d){return a>>>=0,globalThis.DUCKDB_RUNTIME.writeFile(e,r,a,i,d)}function Xn(r){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(r)}function Vn(r,a){return r>>>=0,globalThis.DUCKDB_RUNTIME.glob(e,r,a)}function zn(r){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(e,r)}function Jn(r,a,i,d,_,b){return r>>>=0,i>>>=0,_>>>=0,globalThis.DUCKDB_RUNTIME.callScalarUDF(e,r,a,i,d,_,b)}var ir=[],Qn=(r,a)=>{ir.length=0;for(var i;i=p[r++>>>0];){var d=i!=105;d&=i!=112,a+=d&&a%8?4:0,ir.push(i==112?$[a>>>2>>>0]:i==105?A[a>>>2>>>0]:K[a>>>3>>>0]),a+=d?8:4}return ir},Yn=(r,a,i)=>{var d=Qn(a,i);return Gt[r](...d)};function Zn(r,a,i){return r>>>=0,a>>>=0,i>>>=0,Yn(r,a,i)}var zr=()=>4294901760;function es(){return zr()}var rs=(r,a)=>Math.ceil(r/a)*a,ts=r=>{var a=x.buffer,i=(r-a.byteLength+65535)/65536|0;try{return x.grow(i),we(),1}catch(d){}};function ns(r){r>>>=0;var a=p.length,i=zr();if(r>i)return!1;for(var d=1;d<=4;d*=2){var _=a*(1+.2/d);_=Math.min(_,r+100663296);var b=Math.min(i,rs(Math.max(r,_),65536)),g=ts(b);if(g)return!0}return!1}var lr={},ss=()=>T||"./this.program",Ce=()=>{if(!Ce.strings){var r=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:r,_:ss()};for(var i in lr)lr[i]===void 0?delete a[i]:a[i]=lr[i];var d=[];for(var i in a)d.push("".concat(i,"=").concat(a[i]));Ce.strings=d}return Ce.strings},as=(r,a)=>{for(var i=0;i<r.length;++i)N[a++>>>0]=r.charCodeAt(i);N[a>>>0]=0},os=function(r,a){r>>>=0,a>>>=0;var i=0;return Ce().forEach((d,_)=>{var b=a+i;$[r+_*4>>>2>>>0]=b,as(d,b),i+=d.length+1}),0},is=function(r,a){r>>>=0,a>>>=0;var i=Ce();$[r>>>2>>>0]=i.length;var d=0;return i.forEach(_=>d+=_.length+1),$[a>>>2>>>0]=d,0},ls=0,us=()=>Xt||ls>0,cs=r=>{var a;R=r,us()||((a=e.onExit)==null||a.call(e,r),m=!0),ee(r,new Ur(r))},Jr=(r,a)=>{R=r,cs(r)},ds=Jr,fs=r=>52;function _s(r,a){a>>>=0;var i=0,d=0,_=0;{var b=2;r==0?i=2:(r==1||r==2)&&(i=64),_=1}return N[a>>>0]=b,B[a+2>>>1>>>0]=_,ye=[i>>>0,(ae=i,+Math.abs(ae)>=1?ae>0?+Math.floor(ae/4294967296)>>>0:~~+Math.ceil((ae-+(~~ae>>>0))/4294967296)>>>0:0)],A[a+8>>>2>>>0]=ye[0],A[a+12>>>2>>>0]=ye[1],ye=[d>>>0,(ae=d,+Math.abs(ae)>=1?ae>0?+Math.floor(ae/4294967296)>>>0:~~+Math.ceil((ae-+(~~ae>>>0))/4294967296)>>>0:0)],A[a+16>>>2>>>0]=ye[0],A[a+20>>>2>>>0]=ye[1],0}function hs(r,a,i,d,_,b){a>>>=0,i>>>=0;var g=ve(d,_);return b>>>=0,52}function bs(r,a,i,d,_,b){a>>>=0,i>>>=0;var g=ve(d,_);return b>>>=0,52}function ps(r,a,i,d){return a>>>=0,i>>>=0,d>>>=0,52}function ms(r,a,i,d,_){var b=ve(a,i);return _>>>=0,70}var gs=r=>52,ys=[null,[],[]],ws=(r,a)=>{var i=ys[r];a===0||a===10?((r===1?se:h)(Or(i)),i.length=0):i.push(a)};function vs(r,a,i,d){a>>>=0,i>>>=0,d>>>=0;for(var _=0,b=0;b<i;b++){var g=$[a>>>2>>>0],y=$[a+4>>>2>>>0];a+=8;for(var k=0;k<y;k++)ws(r,p[g+k>>>0]);_+=y}return $[d>>>2>>>0]=_,0}function Es(r,a,i,d){r>>>=0,a>>>=0,i>>>=0,d>>>=0;var _=0,b=0,g=0,y=0,k=0,H=0,M;function w(G,X,W,E,re,de){var Y,pe,me,et;return pe=G===10?28:16,re=G===10?Nr(re):sr(re),Y=De(pe),et=$e(Y,G,re,de),D(!et),me=De(32),A[me+4>>>2>>>0]=G,A[me+8>>>2>>>0]=X,A[me+12>>>2>>>0]=W,$[me+24>>>2>>>0]=E,$[me+20>>>2>>>0]=Y,G===10?A[me+16>>>2>>>0]=28:A[me+16>>>2>>>0]=16,A[me+28>>>2>>>0]=0,me}if(i&&(g=A[i>>>2>>>0],y=A[i+4>>>2>>>0],k=A[i+8>>>2>>>0],H=A[i+12>>>2>>>0]),k&&!H&&(H=k===2?17:6),!k&&H&&(k=H===17?2:1),H===0&&(H=6),k===0&&(k=1),!r&&!a)return-2;if(g&-1088||i!==0&&A[i>>>2>>>0]&2&&!r)return-1;if(g&32)return-2;if(k!==0&&k!==1&&k!==2)return-7;if(y!==0&&y!==2&&y!==10)return-6;if(a&&(a=J(a),b=parseInt(a,10),isNaN(b)))return g&1024?-2:-8;if(!r)return y===0&&(y=2),g&1||(y===2?_=_htonl(2130706433):_=[0,0,0,_htonl(1)]),M=w(y,k,H,null,_,b),$[d>>>2>>>0]=M,0;if(r=J(r),_=je(r),_!==null)if(y===0||y===2)y=2;else if(y===10&&g&8)_=[0,0,_htonl(65535),_],y=10;else return-2;else if(_=ar(r),_!==null)if(y===0||y===10)y=10;else return-2;return _!=null?(M=w(y,k,H,r,_,b),$[d>>>2>>>0]=M,0):g&4?-2:(r=ie.lookup_name(r),_=je(r),y===0?y=2:y===10&&(_=[0,0,_htonl(65535),_]),M=w(y,k,H,null,_,b),$[d>>>2>>>0]=M,0)}function Ds(r,a,i,d,_,b,g){r>>>=0,i>>>=0,_>>>=0;var y=Cr(r,a);if(y.errno)return-6;var k=y.port,H=y.addr,M=!1;if(i&&d){var w;if(g&1||!(w=ie.lookup_addr(H))){if(g&8)return-2}else H=w;var G=Ee(H,i,d);G+1>=d&&(M=!0)}if(_&&b){k=""+k;var G=Ee(k,_,b);G+1>=b&&(M=!0)}return M?-12:0}var Ss=()=>{if(S){var r=["crypto"].map(require).pop();return a=>r.randomFillSync(a)}return a=>crypto.getRandomValues(a)},Qr=r=>{(Qr=Ss())(r)};function As(r,a){return r>>>=0,a>>>=0,Qr(p.subarray(r>>>0,r+a>>>0)),0}var Fs=r=>{if(r instanceof Ur||r=="unwind")return R;ee(1,r)},ks=r=>{var a=e["_"+r];return a},Rs=(r,a)=>{N.set(r,a>>>0)},Ke=r=>Ls(r);e.stackAlloc=Ke;var Ts=r=>{var a=Mr(r)+1,i=Ke(a);return Ee(r,i,a),i},Yr=()=>Os(),Zr=r=>Ps(r),Us=(r,a,i,d,_)=>{var b={string:W=>{var E=0;return W!=null&&W!==0&&(E=Ts(W)),E},array:W=>{var E=Ke(W.length);return Rs(W,E),E}};function g(W){return a==="string"?J(W):a==="boolean"?!!W:W}var y=ks(r),k=[],H=0;if(d)for(var M=0;M<d.length;M++){var w=b[i[M]];w?(H===0&&(H=Yr()),k[M]=w(d[M])):k[M]=d[M]}var G=y(...k);function X(W){return H!==0&&Zr(H),g(W)}return G=X(G),G},xs=r=>Cs(),Bs=r=>Ns(r),Is={ja:Vt,oa:zt,I:Jt,ea:Qt,b:Yt,da:Zt,w:en,fa:tn,_:nn,ia:sn,ha:an,ma:on,h:ln,aa:un,$:cn,ba:dn,t:fn,na:_n,X:hn,ka:bn,Y:pn,o:mn,la:gn,s:yn,ca:wn,ga:vn,p:En,ra:Dn,F:qr,i:jr,H:Gr,G:$r,E:Kr,z:Rn,A:Tn,B:Un,qa:xn,C:Hn,O:Nn,Q:Cn,M:Pn,N:Ln,m:On,T:Mn,K:Wn,L:qn,S:jn,f:Gn,R:$n,n:Kn,U:Xn,J:Vn,l:zn,V:Jn,e:Zn,k:Vr,pa:es,c:Xr,sa:ns,u:os,v:is,a:ds,d:fs,P:_s,y:hs,x:bs,j:ps,D:ms,Z:gs,g:vs,r:Es,q:Ds,W:As},I=await jt(),Hs=e._main=I.va,ma=e._duckdb_web_fs_glob_add_path=I.xa,ga=e._duckdb_web_clear_response=I.ya,ya=e._duckdb_web_fail_with=I.za,wa=e._duckdb_web_reset=I.Aa,va=e._duckdb_web_connect=I.Ba,Ea=e._duckdb_web_disconnect=I.Ca,Da=e._duckdb_web_flush_files=I.Da,Sa=e._duckdb_web_flush_file=I.Ea,Aa=e._duckdb_web_open=I.Fa,Fa=e._duckdb_web_get_global_file_info=I.Ga,ka=e._duckdb_web_collect_file_stats=I.Ha,Ra=e._duckdb_web_export_file_stats=I.Ia,Ta=e._duckdb_web_fs_drop_file=I.Ja,Ua=e._duckdb_web_fs_drop_files=I.Ka,xa=e._duckdb_web_fs_glob_file_infos=I.La,Ba=e._duckdb_web_fs_get_file_info_by_id=I.Ma,Ia=e._duckdb_web_fs_get_file_info_by_name=I.Na,Ha=e._duckdb_web_fs_register_file_url=I.Oa,Na=e._duckdb_web_fs_register_file_buffer=I.Pa,Ca=e._duckdb_web_copy_file_to_buffer=I.Qa,Pa=e._duckdb_web_copy_file_to_path=I.Ra,La=e._duckdb_web_get_version=I.Sa,Oa=e._duckdb_web_get_feature_flags=I.Ta,Ma=e._duckdb_web_tokenize=I.Ua,Wa=e._duckdb_web_tokenize_buffer=I.Va,qa=e._duckdb_web_udf_scalar_create=I.Wa,ja=e._duckdb_web_prepared_create=I.Xa,Ga=e._duckdb_web_prepared_create_buffer=I.Ya,$a=e._duckdb_web_prepared_close=I.Za,Ka=e._duckdb_web_prepared_run=I._a,Xa=e._duckdb_web_prepared_send=I.$a,Va=e._duckdb_web_query_run=I.ab,za=e._duckdb_web_query_run_buffer=I.bb,Ja=e._duckdb_web_pending_query_start=I.cb,Qa=e._duckdb_web_pending_query_start_buffer=I.db,Ya=e._duckdb_web_pending_query_poll=I.eb,Za=e._duckdb_web_pending_query_cancel=I.fb,eo=e._duckdb_web_query_fetch_results=I.gb,ro=e._duckdb_web_get_tablenames=I.hb,to=e._duckdb_web_get_tablenames_buffer=I.ib,no=e._duckdb_web_insert_arrow_from_ipc_stream=I.jb,so=e._duckdb_web_insert_csv_from_path=I.kb,ao=e._duckdb_web_insert_json_from_path=I.lb,De=e._malloc=I.pb,oo=e._free=I.qb,io=e._calloc=I.rb,Ns=I.tb,Cs=I.ub,Ps=I.vb,Ls=I.wb,Os=I.xb;function Ms(r){r=Object.assign({},r);var a=_=>b=>_(b)>>>0,i=_=>(b,g)=>_(b,g)>>>0,d=_=>()=>_()>>>0;return r.pb=a(r.pb),r.rb=i(r.rb),r.wb=a(r.wb),r.xb=d(r.xb),r}e.stackSave=Yr,e.stackRestore=Zr,e.stackAlloc=Ke,e.getTempRet0=xs,e.setTempRet0=Bs,e.ccall=Us;function Ws(){var r=Hs,a=0,i=0;try{var d=r(a,i);return Jr(d,!0),d}catch(_){return Fs(_)}}function ur(){if(Fe>0){He=ur;return}if(xe(),Fe>0){He=ur;return}function r(){var i;if(e.calledRun=!0,!m){Be(),u(e),(i=e.onRuntimeInitialized)==null||i.call(e);var a=e.noInitialRun;a||Ws(),Ht()}}e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),r()},1)):r()}if(e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return ur(),o=f,o}})();typeof xt=="object"&&typeof er=="object"?(er.exports=Tr,er.exports.default=Tr):typeof define=="function"&&define.amd&&define([],()=>Tr)});var pa={};Vs(pa,{BROWSER_RUNTIME:()=>L,ConsoleLogger:()=>yr,DEFAULT_RUNTIME:()=>mr,DuckDBAccessMode:()=>ut,DuckDBBindingsBase:()=>qe,DuckDBConnection:()=>Le,DuckDBDataProtocol:()=>Me,DuckDBFeature:()=>lt,FileFlags:()=>pr,FileStatistics:()=>We,IsArrowBuffer:()=>dr,IsDuckDBWasmRetry:()=>fr,JSONTableShape:()=>ct,LogEvent:()=>ht,LogLevel:()=>ft,LogOrigin:()=>bt,LogTopic:()=>_t,PACKAGE_NAME:()=>wr,PACKAGE_VERSION:()=>vr,PACKAGE_VERSION_MAJOR:()=>na,PACKAGE_VERSION_MINOR:()=>sa,PACKAGE_VERSION_PATCH:()=>aa,PreparedStatement:()=>Ve,ResultStreamIterator:()=>Oe,StatusCode:()=>cr,TokenType:()=>dt,VoidLogger:()=>gr,callSRet:()=>V,copyBuffer:()=>Se,createDuckDB:()=>ba,decodeText:()=>it,dropResponseBuffers:()=>Z,failWith:()=>le,getJsDelivrBundles:()=>la,getLogEventLabel:()=>Ys,getLogLevelLabel:()=>Qs,getLogOriginLabel:()=>ea,getLogTopicLabel:()=>Zs,getPlatformFeatures:()=>vt,isFirefox:()=>oa,isNode:()=>Rr,isSafari:()=>ia,readString:()=>O,selectBundle:()=>ua});module.exports=zs(pa);var ge=Xe(require("apache-arrow")),Le=class{constructor(t,s){this._bindings=t,this._conn=s}close(){this._bindings.disconnect(this._conn)}useUnsafe(t){return t(this._bindings,this._conn)}query(t){let s=this._bindings.runQuery(this._conn,t),o=ge.RecordBatchReader.from(s);return console.assert(o.isSync()),console.assert(o.isFile()),new ge.Table(o)}async send(t,s=!1){let o=this._bindings.startPendingQuery(this._conn,t,s);for(;o==null;)o=await new Promise((l,f)=>{try{l(this._bindings.pollPendingQuery(this._conn))}catch(c){console.log(c),c.message.includes("worker is not set!")?f(new Error("Worker has been terminated")):f(c)}});let e=new Oe(this._bindings,this._conn,o),u=ge.RecordBatchReader.from(e);return console.assert(u.isSync()),console.assert(u.isStream()),u}cancelSent(){return this._bindings.cancelPendingQuery(this._conn)}getTableNames(t){return this._bindings.getTableNames(this._conn,t)}prepare(t){let s=this._bindings.createPrepared(this._conn,t);return new Ve(this._bindings,this._conn,s)}createScalarFunction(t,s,o){this._bindings.createScalarFunction(this._conn,t,s,o)}insertArrowTable(t,s){let o=ge.tableToIPC(t,"stream");this.insertArrowFromIPCStream(o,s)}insertArrowFromIPCStream(t,s){this._bindings.insertArrowFromIPCStream(this._conn,t,s)}insertCSVFromPath(t,s){this._bindings.insertCSVFromPath(this._conn,t,s)}insertJSONFromPath(t,s){this._bindings.insertJSONFromPath(this._conn,t,s)}},Oe=class{constructor(t,s,o){this.bindings=t;this.conn=s;this.header=o;this._first=!0,this._depleted=!1}next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let t=null;do t=this.bindings.fetchQueryResults(this.conn);while(t==null);return this._depleted=t.length==0,{done:this._depleted,value:t}}[Symbol.iterator](){return this}},Ve=class{constructor(t,s,o){this.bindings=t,this.connectionId=s,this.statementId=o}close(){this.bindings.closePrepared(this.connectionId,this.statementId)}query(...t){let s=this.bindings.runPrepared(this.connectionId,this.statementId,t),o=ge.RecordBatchReader.from(s);return console.assert(o.isSync()),console.assert(o.isFile()),new ge.Table(o)}send(...t){let s=this.bindings.sendPrepared(this.connectionId,this.statementId,t),o=new Oe(this.bindings,this.connectionId,s),e=ge.RecordBatchReader.from(o);return console.assert(e.isSync()),console.assert(e.isStream()),e}};var cr=(o=>(o[o.SUCCESS=0]="SUCCESS",o[o.MAX_ARROW_ERROR=255]="MAX_ARROW_ERROR",o[o.DUCKDB_WASM_RETRY=256]="DUCKDB_WASM_RETRY",o))(cr||{});function dr(n){return n<=255}function fr(n){return n===256}var at=new TextEncoder,nt=new TextDecoder("utf-8");function _r(n,t,s){let o=at.encode(s),e=n._malloc(o.byteLength),u=n.HEAPU8.subarray(e,e+o.byteLength);u.set(o),n.HEAPF64[(t>>3)+0]=1,n.HEAPF64[(t>>3)+1]=e,n.HEAPF64[(t>>3)+2]=u.byteLength}function br(n){switch(n){case"UINT8":case"INT8":return 1;case"INT32":case"FLOAT":return 4;case"INT64":case"UINT64":case"DOUBLE":case"VARCHAR":return 8;default:return 0}}function hr(n,t,s,o){let e=n.HEAPU8.subarray(t,t+o*br(s));switch(s){case"UINT8":return new Uint8Array(e.buffer,e.byteOffset,o);case"INT8":return new Int8Array(e.buffer,e.byteOffset,o);case"INT32":return new Int32Array(e.buffer,e.byteOffset,o);case"FLOAT":return new Float32Array(e.buffer,e.byteOffset,o);case"DOUBLE":return new Float64Array(e.buffer,e.byteOffset,o);case"VARCHAR":return new Float64Array(e.buffer,e.byteOffset,o);default:return new Array(0)}}function st(n,t,s){let o=n.HEAPU8.subarray(t,t+s);return new Uint8Array(o.buffer,o.byteOffset,s)}function ze(n,t,s){let o=n.HEAPU8.subarray(t,t+s*8);return new Float64Array(o.buffer,o.byteOffset,s)}function Je(n,t,s,o,e,u,l,f){try{let c=n._udfFunctions.get(o);if(!c){_r(t,s,"Unknown UDF with id: "+o);return}let v=nt.decode(t.HEAPU8.subarray(e,e+u)),S=JSON.parse(v),U=ze(t,l,f/8),C=m=>{var D;let R=null;switch(m.validityBuffer!==void 0&&(R=st(t,U[m.validityBuffer],S.rows)),m.physicalType){case"VARCHAR":{if(m.dataBuffer===null||m.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(m.lengthBuffer===null||m.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let N=hr(t,U[m.dataBuffer],m.physicalType,S.rows),p=[],B=ze(t,U[m.lengthBuffer],S.rows);for(let P=0;P<S.rows;++P){if(R!=null&&!R[P]){p.push(null);continue}let A=t.HEAPU8.subarray(N[P],N[P]+B[P]),$=nt.decode(A);p.push($)}return P=>p[P]}case"STRUCT":{let N={},p=[];for(let B=0;B<(((D=m.children)==null?void 0:D.length)||0);++B){let P=m.children[B],A=C(P);p.push($=>{N[P.name]=A($)})}return R!=null?B=>{if(!R[B])return null;for(let P of p)P(B);return N}:B=>{for(let P of p)P(B);return N}}default:{if(m.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+m.physicalType);let N=hr(t,U[m.dataBuffer],m.physicalType,S.rows);return R!=null?p=>R[p]?N[p]:null:p=>N[p]}}},T=[];for(let m=0;m<S.args.length;++m)T.push(C(S.args[m]));let ee=S.rows*br(S.ret.physicalType),j=t._malloc(ee),te=hr(t,j,S.ret.physicalType,S.rows),ne=t._malloc(S.rows),Q=st(t,ne,S.rows);if(te.length==0||Q.length==0){_r(t,s,"Can't create physical arrays for result");return}let z=te;S.ret.physicalType=="VARCHAR"&&(z=new Array(S.rows));let oe=[];for(let m=0;m<S.args.length;++m)oe.push(null);for(let m=0;m<S.rows;++m){for(let D=0;D<S.args.length;++D)oe[D]=T[D](m);let R=c.func(...oe);z[m]=R,Q[m]=R==null?0:1}let se=0;switch(S.ret.physicalType){case"VARCHAR":{let m=new Array(0);se=t._malloc(S.rows*br("DOUBLE"));let R=ze(t,se,S.rows),D=0;for(let P=0;P<S.rows;++P){let A=at.encode(z[P]||"");m.push(A),R[P]=A.length,D+=A.length}let N=t._malloc(D),p=t.HEAPU8.subarray(N,N+D),B=0;for(let P=0;P<S.rows;++P){te[P]=B;let A=m[P];p.subarray(B,B+A.length).set(A),B+=A.length}}}let h=3*8,F=t._malloc(h),x=ze(t,F,3);x[0]=j,x[1]=ne,x[2]=se,t.HEAPF64[(s>>3)+0]=0,t.HEAPF64[(s>>3)+1]=F,t.HEAPF64[(s>>3)+2]=0}catch(c){_r(t,s,c.toString())}}function Js(){let n=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),n.decode(t))}var it=Js();function le(n,t){console.error("FAIL WITH: ".concat(t)),n.ccall("duckdb_web_fail_with",null,["string"],[t])}function Se(n,t,s){let o=new Uint8Array(n.HEAPU8.buffer,t>>>0,s),e=new Uint8Array(new ArrayBuffer(o.byteLength));return e.set(o),e}function O(n,t,s){return it(new Uint8Array(n.HEAPU8.buffer,t>>>0,s))}var Me=(l=>(l[l.BUFFER=0]="BUFFER",l[l.NODE_FS=1]="NODE_FS",l[l.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",l[l.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",l[l.HTTP=4]="HTTP",l[l.S3=5]="S3",l))(Me||{}),pr=(U=>(U[U.FILE_FLAGS_READ=1]="FILE_FLAGS_READ",U[U.FILE_FLAGS_WRITE=2]="FILE_FLAGS_WRITE",U[U.FILE_FLAGS_DIRECT_IO=4]="FILE_FLAGS_DIRECT_IO",U[U.FILE_FLAGS_FILE_CREATE=8]="FILE_FLAGS_FILE_CREATE",U[U.FILE_FLAGS_FILE_CREATE_NEW=16]="FILE_FLAGS_FILE_CREATE_NEW",U[U.FILE_FLAGS_APPEND=32]="FILE_FLAGS_APPEND",U[U.FILE_FLAGS_PRIVATE=64]="FILE_FLAGS_PRIVATE",U[U.FILE_FLAGS_NULL_IF_NOT_EXISTS=128]="FILE_FLAGS_NULL_IF_NOT_EXISTS",U[U.FILE_FLAGS_PARALLEL_ACCESS=256]="FILE_FLAGS_PARALLEL_ACCESS",U[U.FILE_FLAGS_EXCLUSIVE_CREATE=512]="FILE_FLAGS_EXCLUSIVE_CREATE",U[U.FILE_FLAGS_NULL_IF_EXISTS=1024]="FILE_FLAGS_NULL_IF_EXISTS",U))(pr||{});function V(n,t,s,o){let e=n.stackSave(),u=n.stackAlloc(3*8);s.unshift("number"),o.unshift(u),n.ccall(t,null,s,o);let l=n.HEAPF64[(u>>3)+0],f=n.HEAPF64[(u>>3)+1],c=n.HEAPF64[(u>>3)+2];return n.stackRestore(e),[l,f,c]}function Z(n){n.ccall("duckdb_web_clear_response",null,[],[])}var mr={_udfFunctions:new Map,testPlatformFeature:(n,t)=>!1,getDefaultDataProtocol:n=>0,openFile:(n,t,s)=>{},syncFile:(n,t)=>{},closeFile:(n,t)=>{},dropFile:(n,t,s)=>{},getLastFileModificationTime:(n,t)=>0,progressUpdate:(n,t,s)=>{},truncateFile:(n,t,s)=>{},readFile:(n,t,s,o,e)=>0,writeFile:(n,t,s,o,e)=>0,removeDirectory:(n,t,s)=>{},checkDirectory:(n,t,s)=>!1,createDirectory:(n,t,s)=>{},listDirectoryEntries:(n,t,s)=>!1,glob:(n,t,s)=>{},moveFile:(n,t,s,o,e)=>{},checkFile:(n,t,s)=>!1,removeFile:(n,t,s)=>{},callScalarUDF:(n,t,s,o,e,u,l)=>{Je(mr,n,t,s,o,e,u,l)}};var We=class{constructor(t){let s=new Float64Array(t.buffer,t.byteOffset,t.byteLength/8),o=new Uint8Array(new ArrayBuffer(t.byteLength));o.set(t.subarray(7*8)),this.totalFileReadsCold=s[0],this.totalFileReadsAhead=s[1],this.totalFileReadsCached=s[2],this.totalFileWrites=s[3],this.totalPageAccesses=s[4],this.totalPageLoads=s[5],this.blockSize=s[6],this.blockStats=o}getBlockStats(t,s){return s=s||{file_reads_cold:0,file_reads_ahead:0,file_reads_cached:0,file_writes:0,page_accesses:0,page_loads:0},s.file_writes=this.blockStats[t*3+0]&15,s.file_reads_cold=this.blockStats[t*3+0]>>4,s.file_reads_ahead=this.blockStats[t*3+1]&15,s.file_reads_cached=this.blockStats[t*3+1]>>4,s.page_accesses=this.blockStats[t*3+1]&15,s.page_loads=this.blockStats[t*3+1]>>4,s}};var q=Xe(require("apache-arrow"));function Te(n){switch(n.typeId){case q.Type.Binary:return{sqlType:"binary"};case q.Type.Bool:return{sqlType:"bool"};case q.Type.Date:return{sqlType:"date"};case q.Type.DateDay:return{sqlType:"date32[d]"};case q.Type.DateMillisecond:return{sqlType:"date64[ms]"};case q.Type.Decimal:{let t=n;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case q.Type.Float:return{sqlType:"float"};case q.Type.Float16:return{sqlType:"float16"};case q.Type.Float32:return{sqlType:"float32"};case q.Type.Float64:return{sqlType:"float64"};case q.Type.Int:return{sqlType:"int32"};case q.Type.Int16:return{sqlType:"int16"};case q.Type.Int32:return{sqlType:"int32"};case q.Type.Int64:return{sqlType:"int64"};case q.Type.Uint16:return{sqlType:"uint16"};case q.Type.Uint32:return{sqlType:"uint32"};case q.Type.Uint64:return{sqlType:"uint64"};case q.Type.Uint8:return{sqlType:"uint8"};case q.Type.IntervalDayTime:return{sqlType:"interval[dt]"};case q.Type.IntervalYearMonth:return{sqlType:"interval[m]"};case q.Type.List:return{sqlType:"list",valueType:Te(n.valueType)};case q.Type.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:n.byteWidth};case q.Type.Null:return{sqlType:"null"};case q.Type.Utf8:return{sqlType:"utf8"};case q.Type.Struct:return{sqlType:"struct",fields:n.children.map(s=>Qe(s.name,s.type))};case q.Type.Map:{let t=n;return{sqlType:"map",keyType:Te(t.keyType),valueType:Te(t.valueType)}}case q.Type.Time:return{sqlType:"time[s]"};case q.Type.TimeMicrosecond:return{sqlType:"time[us]"};case q.Type.TimeMillisecond:return{sqlType:"time[ms]"};case q.Type.TimeNanosecond:return{sqlType:"time[ns]"};case q.Type.TimeSecond:return{sqlType:"time[s]"};case q.Type.Timestamp:return{sqlType:"timestamp",timezone:n.timezone||void 0};case q.Type.TimestampSecond:return{sqlType:"timestamp[s]",timezone:n.timezone||void 0};case q.Type.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:n.timezone||void 0};case q.Type.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:n.timezone||void 0};case q.Type.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:n.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(n.toString()))}function Qe(n,t){let s=Te(t);return s.name=n,s}var Ue=new TextEncoder,lt=(l=>(l[l.WASM_EXCEPTIONS=1]="WASM_EXCEPTIONS",l[l.WASM_THREADS=2]="WASM_THREADS",l[l.WASM_SIMD=4]="WASM_SIMD",l[l.WASM_BULK_MEMORY=8]="WASM_BULK_MEMORY",l[l.EMIT_BIGINT=16]="EMIT_BIGINT",l[l.WASMFS=32]="WASMFS",l))(lt||{}),qe=class{constructor(t,s){this._instance=null;this._initPromise=null;this._initPromiseResolver=()=>{};this.onInstantiationProgress=[];this._logger=t,this._runtime=s,this._nextUDFId=1}get logger(){return this._logger}get mod(){return this._instance}get pthread(){return this.mod.PThread||null}async instantiate(t=s=>{}){return this._instance!=null?this:(this._initPromise!=null&&(this.onInstantiationProgress.push(t),await this._initPromise),this._initPromise=new Promise(s=>{this._initPromiseResolver=s}),this.onInstantiationProgress=[t],this._instance=await this.instantiateImpl({print:console.log.bind(console),printErr:console.log.bind(console),onRuntimeInitialized:this._initPromiseResolver}),await this._initPromise,this._initPromise=null,this.onInstantiationProgress=this.onInstantiationProgress.filter(s=>s!=t),globalThis.DUCKDB_BINDINGS=this,this)}open(t){let[s,o,e]=V(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(s!==0)throw new Error(O(this.mod,o,e));Z(this.mod)}reset(){let[t,s,o]=V(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(O(this.mod,s,o));Z(this.mod)}getVersion(){let[t,s,o]=V(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(O(this.mod,s,o));let e=O(this.mod,s,o);return Z(this.mod),e}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let s=Ue.encode(t),o=this.mod._malloc(s.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,o,s.length).set(s);let[u,l,f]=V(this.mod,"duckdb_web_tokenize_buffer",["number","number"],[o,s.length]);if(this.mod._free(o),u!==0)throw new Error(O(this.mod,l,f));let c=O(this.mod,l,f);return Z(this.mod),JSON.parse(c)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new Le(this,t)}disconnect(t){if(this.mod.ccall("duckdb_web_disconnect",null,["number"],[t]),this.pthread)for(let s of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])s.postMessage({cmd:"dropUDFFunctions",connectionId:t})}runQuery(t,s){let o=Ue.encode(s),e=this.mod._malloc(o.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,e,o.length).set(o);let[l,f,c]=V(this.mod,"duckdb_web_query_run_buffer",["number","number","number"],[t,e,o.length]);if(this.mod._free(e),l!==0)throw new Error(O(this.mod,f,c));let v=Se(this.mod,f,c);return Z(this.mod),v}startPendingQuery(t,s,o=!1){let e=Ue.encode(s),u=this.mod._malloc(e.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,u,e.length).set(e);let[f,c,v]=V(this.mod,"duckdb_web_pending_query_start_buffer",["number","number","number","boolean"],[t,u,e.length,o]);if(this.mod._free(u),f!==0)throw new Error(O(this.mod,c,v));if(c==0)return null;let S=Se(this.mod,c,v);return Z(this.mod),S}pollPendingQuery(t){let[s,o,e]=V(this.mod,"duckdb_web_pending_query_poll",["number"],[t]);if(s!==0)throw new Error(O(this.mod,o,e));if(o==0)return null;let u=Se(this.mod,o,e);return Z(this.mod),u}cancelPendingQuery(t){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[t])}fetchQueryResults(t){let[s,o,e]=V(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(fr(s))return Z(this.mod),null;if(!dr(s))throw new Error("Unexpected StatusCode from duckdb_web_query_fetch_results ("+s+") and with self reported error as"+O(this.mod,o,e));if(s!==0)throw new Error(O(this.mod,o,e));let u=Se(this.mod,o,e);return Z(this.mod),u}getTableNames(t,s){let o=Ue.encode(s),e=this.mod._malloc(o.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,e,o.length).set(o);let[l,f,c]=V(this.mod,"duckdb_web_get_tablenames_buffer",["number","number","number"],[t,e,o.length]);if(this.mod._free(e),l!==0)throw new Error(O(this.mod,f,c));let v=O(this.mod,f,c);return Z(this.mod),JSON.parse(v)}createScalarFunction(t,s,o,e){let u={functionId:this._nextUDFId,name:s,returnType:Te(o)},l={functionId:u.functionId,connectionId:t,name:s,returnType:o,func:e};this._nextUDFId+=1;let[f,c,v]=V(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(u)]);if(f!==0)throw new Error(O(this.mod,c,v));if(Z(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(l.functionId,l),this.pthread)for(let S of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])S.postMessage({cmd:"registerUDFFunction",udf:l})}createPrepared(t,s){let o=Ue.encode(s),e=this.mod._malloc(o.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,e,o.length).set(o);let[l,f,c]=V(this.mod,"duckdb_web_prepared_create_buffer",["number","number","number"],[t,e,o.length]);if(this.mod._free(e),l!==0)throw new Error(O(this.mod,f,c));return Z(this.mod),f}closePrepared(t,s){let[o,e,u]=V(this.mod,"duckdb_web_prepared_close",["number","number"],[t,s]);if(o!==0)throw new Error(O(this.mod,e,u));Z(this.mod)}runPrepared(t,s,o){let[e,u,l]=V(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,s,JSON.stringify(o)]);if(e!==0)throw new Error(O(this.mod,u,l));let f=Se(this.mod,u,l);return Z(this.mod),f}sendPrepared(t,s,o){let[e,u,l]=V(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,s,JSON.stringify(o)]);if(e!==0)throw new Error(O(this.mod,u,l));let f=Se(this.mod,u,l);return Z(this.mod),f}insertArrowFromIPCStream(t,s,o){if(s.length==0)return;let e=this.mod._malloc(s.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,e,s.length).set(s);let l=o?JSON.stringify(o):"",[f,c,v]=V(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,e,s.length,l]);if(this.mod._free(e),f!==0)throw new Error(O(this.mod,c,v))}insertCSVFromPath(t,s,o){if(o.columns!==void 0){o.columnsFlat=[];for(let v in o.columns)o.columnsFlat.push(Qe(v,o.columns[v]))}let e={...o};e.columns=e.columnsFlat,delete e.columnsFlat;let u=JSON.stringify(e),[l,f,c]=V(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,s,u]);if(l!==0)throw new Error(O(this.mod,f,c))}insertJSONFromPath(t,s,o){if(o.columns!==void 0){o.columnsFlat=[];for(let v in o.columns)o.columnsFlat.push(Qe(v,o.columns[v]))}let e={...o};e.columns=e.columnsFlat,delete e.columnsFlat;let u=JSON.stringify(e),[l,f,c]=V(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,s,u]);if(l!==0)throw new Error(O(this.mod,f,c))}globFiles(t){let[s,o,e]=V(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(s!==0)throw new Error(O(this.mod,o,e));let u=O(this.mod,o,e);Z(this.mod);let l=JSON.parse(u);return l==null?[]:l}registerFileURL(t,s,o,e=!1){s===void 0&&(s=t);let[u,l,f]=V(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[t,s,o,e]);if(u!==0)throw new Error(O(this.mod,l,f));Z(this.mod)}registerFileText(t,s){let o=Ue.encode(s);this.registerFileBuffer(t,o)}registerFileBuffer(t,s){let o=this.mod._malloc(s.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,o,s.length).set(s);let[u,l,f]=V(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,o,s.length]);if(u!==0)throw new Error(O(this.mod,l,f));Z(this.mod)}async prepareFileHandle(t,s){if(s===3&&this._runtime.prepareFileHandles){let o=await this._runtime.prepareFileHandles([t],3);for(let e of o){let{handle:u,path:l,fromCached:f}=e;!f&&u.getSize()&&await this.registerFileHandleAsync(l,u,3,!0)}return}throw new Error("prepareFileHandle: unsupported protocol ".concat(s))}async prepareDBFileHandle(t,s){if(s===3&&this._runtime.prepareDBFileHandle){let o=await this._runtime.prepareDBFileHandle(t,3);for(let e of o){let{handle:u,path:l,fromCached:f}=e;!f&&u.getSize()&&await this.registerFileHandleAsync(l,u,3,!0)}return}throw new Error("prepareDBFileHandle: unsupported protocol ".concat(s))}async prepareFileHandleAsync(t,s,o,e){if(o===3&&!(s instanceof FileSystemSyncAccessHandle)){if(s instanceof FileSystemFileHandle){let u=s;try{s=await u.createSyncAccessHandle()}catch(l){throw new Error(l.message+":"+t)}}else if(t!=null)try{s=await(await(await navigator.storage.getDirectory()).getFileHandle(t)).createSyncAccessHandle()}catch(u){throw new Error(u.message+":"+t)}}return s}async registerFileHandleAsync(t,s,o,e){let u=await this.prepareFileHandleAsync(t,s,o,e);this.registerFileHandle(t,u,o,e)}registerFileHandle(t,s,o,e){var c;let[u,l,f]=V(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[t,t,o,e]);if(u!==0)throw new Error(O(this.mod,l,f));if(Z(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,s),(c=globalThis.DUCKDB_RUNTIME._preparedHandles)!=null&&c[t]&&delete globalThis.DUCKDB_RUNTIME._preparedHandles[t],this.pthread){for(let v of this.pthread.runningWorkers)v.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:s});for(let v of this.pthread.unusedWorkers)v.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[s,o,e]=V(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(s!==0)throw new Error(O(this.mod,o,e));Z(this.mod)}dropFiles(t){let s=[],o=-1;try{for(let f of t!=null?t:[])if(f!=null&&f.length>0){let c=this.mod.lengthBytesUTF8(f)+1,v=this.mod._malloc(c);if(!v)throw new Error("Failed to allocate memory for string: ".concat(f));this.mod.stringToUTF8(f,v,c),s.push(v)}if(o=this.mod._malloc(s.length*4),!o)throw new Error("Failed to allocate memory for pointers array");for(let f=0;f<s.length;f++)this.mod.HEAP32[(o>>2)+f]=s[f];let[e,u,l]=V(this.mod,"duckdb_web_fs_drop_files",["number","number"],[o,s.length]);if(e!==0)throw new Error(O(this.mod,u,l));Z(this.mod)}finally{for(let e of s)this.mod._free(e);o>0&&this.mod._free(o)}}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,s){let[o,e,u]=V(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,s]);if(o!==0)throw new Error(O(this.mod,e,u));Z(this.mod)}copyFileToBuffer(t){let[s,o,e]=V(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(s!==0)throw new Error(O(this.mod,o,e));let u=new Uint8Array(this.mod.HEAPU8.buffer,o>>>0,e),l=new Uint8Array(u.length);return l.set(u),Z(this.mod),l}async registerOPFSFileName(t){if(t.startsWith("opfs://"))return this.prepareFileHandle(t,3);throw new Error("Not an OPFS file name: "+t)}collectFileStatistics(t,s){let[o,e,u]=V(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,s]);if(o!==0)throw new Error(O(this.mod,e,u))}exportFileStatistics(t){let[s,o,e]=V(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(s!==0)throw new Error(O(this.mod,o,e));return new We(new Uint8Array(this.mod.HEAPU8.buffer,o>>>0,e))}};var ut=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(ut||{});var ct=(s=>(s.ROW_ARRAY="row-array",s.COLUMN_OBJECT="column-object",s))(ct||{});var dt=(l=>(l[l.IDENTIFIER=0]="IDENTIFIER",l[l.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",l[l.STRING_CONSTANT=2]="STRING_CONSTANT",l[l.OPERATOR=3]="OPERATOR",l[l.KEYWORD=4]="KEYWORD",l[l.COMMENT=5]="COMMENT",l))(dt||{});var ft=(u=>(u[u.NONE=0]="NONE",u[u.DEBUG=1]="DEBUG",u[u.INFO=2]="INFO",u[u.WARNING=3]="WARNING",u[u.ERROR=4]="ERROR",u))(ft||{}),_t=(l=>(l[l.NONE=0]="NONE",l[l.CONNECT=1]="CONNECT",l[l.DISCONNECT=2]="DISCONNECT",l[l.OPEN=3]="OPEN",l[l.QUERY=4]="QUERY",l[l.INSTANTIATE=5]="INSTANTIATE",l))(_t||{}),ht=(l=>(l[l.NONE=0]="NONE",l[l.OK=1]="OK",l[l.ERROR=2]="ERROR",l[l.START=3]="START",l[l.RUN=4]="RUN",l[l.CAPTURE=5]="CAPTURE",l))(ht||{}),bt=(u=>(u[u.NONE=0]="NONE",u[u.WEB_WORKER=1]="WEB_WORKER",u[u.NODE_WORKER=2]="NODE_WORKER",u[u.BINDINGS=3]="BINDINGS",u[u.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",u))(bt||{}),gr=class{log(t){}},yr=class{constructor(t=2){this.level=t}log(t){t.level>=this.level&&console.log(t)}};function Qs(n){switch(n){case 0:return"NONE";case 1:return"DEBUG";case 2:return"INFO";case 3:return"WARNING";case 4:return"ERROR";default:return"?"}}function Ys(n){switch(n){case 0:return"NONE";case 1:return"OK";case 2:return"ERROR";case 3:return"START";case 4:return"RUN";case 5:return"CAPTURE";default:return"?"}}function Zs(n){switch(n){case 1:return"CONNECT";case 2:return"DISCONNECT";case 5:return"INSTANTIATE";case 3:return"OPEN";case 4:return"QUERY";default:return"?"}}function ea(n){switch(n){case 0:return"NONE";case 1:return"WEB WORKER";case 2:return"NODE WORKER";case 3:return"DUCKDB BINDINGS";case 4:return"DUCKDB";default:return"?"}}var pt=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),mt=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11]));var gt=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));var yt=()=>(async n=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(n)}catch(t){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));var Ye={name:"@run-trace/duckdb-wasm",version:"0.4.0",description:"DuckDB powered by WebAssembly \u2014 Trace fork with bundled extensions",license:"MIT",repository:{type:"git",url:"https://github.com/trace-github/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^17.0.0",qs:"^6.14.1"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.13","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0",esbuild:"^0.20.2",eslint:"^8.57.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.37.5","fast-glob":"^3.3.2",jasmine:"^5.13.0","jasmine-core":"^5.1.2","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.1",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.3","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.5",puppeteer:"^22.8.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.28.15",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",format:'prettier --write "**/*.+(js|ts)"',report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/tests-*","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./blocking":{node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-node-blocking.d.ts",import:"./dist/duckdb-node-blocking.mjs",require:"./dist/duckdb-node-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}};var wr=Ye.name,vr=Ye.version,Er=Ye.version.split("."),na=Er[0],sa=Er[1],aa=Er[2];var Rr=()=>typeof navigator>"u",wt=()=>Rr()?"node":navigator.userAgent,oa=()=>wt().includes("Firefox"),ia=()=>/^((?!chrome|android).)*safari/i.test(wt());function la(){let n="https://cdn.jsdelivr.net/npm/".concat(wr,"@").concat(vr,"/dist/");return{eh:{mainModule:"".concat(n,"duckdb-eh.wasm"),mainWorker:"".concat(n,"duckdb-browser-eh.worker.js")},coi:{mainModule:"".concat(n,"duckdb-coi.wasm"),mainWorker:"".concat(n,"duckdb-browser-coi.worker.js"),pthreadWorker:"".concat(n,"duckdb-browser-coi.pthread.worker.js")}}}var Dr=null,Sr=null,Ar=null,Fr=null,kr=null;async function vt(){return Dr==null&&(Dr=typeof BigInt64Array<"u"),Sr==null&&(Sr=await mt()),Ar==null&&(Ar=await yt()),Fr==null&&(Fr=await gt()),kr==null&&(kr=await pt()),{bigInt64Array:Dr,crossOriginIsolated:Rr()||globalThis.crossOriginIsolated||!1,wasmExceptions:Sr,wasmSIMD:Fr,wasmThreads:Ar,wasmBulkMemory:kr}}async function ua(n){var o;let t=await vt();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&n.coi)return{mainModule:n.coi.mainModule,mainWorker:n.coi.mainWorker,pthreadWorker:n.coi.pthreadWorker};if(n.eh)return{mainModule:n.eh.mainModule,mainWorker:n.eh.mainWorker,pthreadWorker:null}}let s=(o=n.mvp)!=null?o:n.eh;if(!s)throw new Error("No suitable DuckDB bundle found for this platform");return{mainModule:s.mainModule,mainWorker:s.mainWorker,pthreadWorker:null}}var Ae=Xe(St()),At=function(n,t,s){var o;return(o=n==null?void 0:n.endpoint)!=null&&o.startsWith("http")?new URL(n.endpoint).host:n!=null&&n.endpoint?"".concat(s,".").concat(n==null?void 0:n.endpoint):"".concat(s,".s3.amazonaws.com")};function ca(n,t,s){var u,l,f,c;let o=Ft(t),e=o.path;if(kt(n)){let v="";if(n!=null&&n.endpoint){let S=new URL(n.endpoint);S.pathname!=="/"&&(v=S.pathname)}e="".concat(v,"/").concat(o.bucket).concat(e)}return{url:e,query:"",host:At(n,t,o.bucket),region:(u=n==null?void 0:n.region)!=null?u:"",service:"s3",method:s,accessKeyId:(l=n==null?void 0:n.accessKeyId)!=null?l:"",secretAccessKey:(f=n==null?void 0:n.secretAccessKey)!=null?f:"",sessionToken:(c=n==null?void 0:n.sessionToken)!=null?c:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function da(n,t=!1){let s="0123456789ABCDEF",o="";for(let e=0;e<n.length;e++){let u=n[e];u>="A"&&u<="Z"||u>="a"&&u<="z"||u>="0"&&u<="9"||u=="_"||u=="-"||u=="~"||u=="."?o+=u:u=="/"?t?o+="%2F":o+=u:(o+="%",o+=s[u.charCodeAt(0)>>4],o+=s[u.charCodeAt(0)&15])}return o}function fa(n,t=null){var ee;let s=(ee=t==null?void 0:t.contentHash)!=null?ee:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",o=new Map;o.set("x-amz-date",n.datetimeNow),o.set("x-amz-content-sha256",s),n.sessionToken&&o.set("x-amz-security-token",n.sessionToken);let e="";t!=null&&t.contentType&&(e+="content-type;"),e+="host;x-amz-content-sha256;x-amz-date",n.sessionToken&&(e+=";x-amz-security-token");let u=n.method+"\n"+da(n.url)+"\n"+n.query;t!=null&&t.contentType&&(u+="\ncontent-type:"+(t==null?void 0:t.contentType)),u+="\nhost:"+n.host+"\nx-amz-content-sha256:"+s+"\nx-amz-date:"+n.datetimeNow,n.sessionToken&&n.sessionToken.length>0&&(u+="\nx-amz-security-token:"+n.sessionToken),u+="\n\n"+e+"\n"+s;let l=(0,Ae.sha256)(u),f="AWS4-HMAC-SHA256\n"+n.datetimeNow+"\n"+n.dateNow+"/"+n.region+"/"+n.service+"/aws4_request\n"+l,c="AWS4"+n.secretAccessKey,v=Ae.sha256.hmac.arrayBuffer(c,n.dateNow),S=Ae.sha256.hmac.arrayBuffer(v,n.region),U=Ae.sha256.hmac.arrayBuffer(S,n.service),C=Ae.sha256.hmac.arrayBuffer(U,"aws4_request"),T=Ae.sha256.hmac(C,f);return o.set("Authorization","AWS4-HMAC-SHA256 Credential="+n.accessKeyId+"/"+n.dateNow+"/"+n.region+"/"+n.service+"/aws4_request, SignedHeaders="+e+", Signature="+T),o}var _a=function(n,t,s,o=null,e=null){let u=ca(n,t,s),l={contentType:o,contentHash:e?Ae.sha256.hex(e):null};return fa(u,l)};function fe(n,t,s,o,e=null,u=null){(t!=null&&t.accessKeyId||t!=null&&t.sessionToken)&&(_a(t,s,o,e,u).forEach((f,c)=>{n.setRequestHeader(c,f)}),e&&n.setRequestHeader("content-type",e))}function Ft(n){if(n.indexOf("s3://")!=0)throw new Error("URL needs to start with s3://");let t=n.indexOf("/",5);if(t==-1)throw new Error("URL needs to contain a '/' after the host");let s=n.substring(5,t);if(!s)throw new Error("URL needs to contain a bucket name");let o=n.substring(t);if(!o)throw new Error("URL needs to contain key");return{bucket:s,path:o}}function kt(n){var t;return!!((t=n==null?void 0:n.endpoint)!=null&&t.startsWith("http"))}function _e(n,t){let s=Ft(t);return kt(n)?"".concat(n==null?void 0:n.endpoint,"/").concat(s.bucket)+s.path:"https://"+At(n,t,s.bucket)+s.path}var ha=7,Rt=/\/|\\/,L={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,_preparedHandles:{},_opfsRoot:null,getFileInfo(n,t){try{let s=L._fileInfoCache.get(t),[o,e,u]=V(n,"duckdb_web_fs_get_file_info_by_id",["number","number"],[t,(s==null?void 0:s.cacheEpoch)||0]);if(o!==0)return null;if(u===0)return s;let l=O(n,e,u);Z(n);try{let f=JSON.parse(l);if(f==null)return null;let c={...f,blob:null};return L._fileInfoCache.set(t,c),!L._files.has(c.fileName)&&L._preparedHandles[c.fileName]&&(L._files.set(c.fileName,L._preparedHandles[c.fileName]),delete L._preparedHandles[c.fileName]),c}catch(f){return console.warn(f),null}}catch(s){return console.log(s),null}},getGlobalFileInfo(n){var t;try{let[s,o,e]=V(n,"duckdb_web_get_global_file_info",["number"],[((t=L._globalFileInfo)==null?void 0:t.cacheEpoch)||0]);if(s!==0)return null;if(e===0)return L._globalFileInfo;let u=O(n,o,e);Z(n);let l=JSON.parse(u);return l==null?null:(L._globalFileInfo={...l,blob:null},L._globalFileInfo)}catch(s){return console.log(s),null}},async assignOPFSRoot(){L._opfsRoot||(L._opfsRoot=await navigator.storage.getDirectory())},async prepareFileHandles(n,t){if(t===3){await L.assignOPFSRoot();let s=async e=>{if(L._files.has(e))return{path:e,handle:L._files.get(e),fromCached:!0};let l=L._opfsRoot,f=e.slice(ha),c=f;if(Rt.test(f)){let S=f.split(Rt);if(S.length===0)throw new Error("Invalid path ".concat(f));if(c=S[S.length-1],!c)throw new Error("Invalid path ".concat(f,". File Not Found."));S.pop();for(let U of S)l=await l.getDirectoryHandle(U,{create:!0})}let v=await l.getFileHandle(c,{create:!1}).catch(S=>{if((S==null?void 0:S.name)==="NotFoundError")return console.debug("File ".concat(e," does not exists yet, creating...")),l.getFileHandle(c,{create:!0});throw S});try{let S=await v.createSyncAccessHandle();return L._preparedHandles[e]=S,{path:e,handle:S,fromCached:!1}}catch(S){throw new Error(S.message+":"+name)}},o=[];for(let e of n){let u=await s(e);o.push(u)}return o}throw new Error("Unsupported protocol ".concat(t," for paths ").concat(n," with protocol ").concat(t))},async prepareDBFileHandle(n,t){if(t===3&&this.prepareFileHandles){let s=[n,"".concat(n,".wal")];return this.prepareFileHandles(s,t)}throw new Error("Unsupported protocol ".concat(t," for path ").concat(n," with protocol ").concat(t))},testPlatformFeature:(n,t)=>{switch(t){case 1:return typeof BigInt64Array<"u";default:return console.warn("test for unknown feature: ".concat(t)),!1}},getDefaultDataProtocol(n){return 2},openFile:(n,t,s)=>{var o,e,u,l,f,c;try{L._fileInfoCache.delete(t);let v=L.getFileInfo(n,t);switch(v==null?void 0:v.dataProtocol){case 4:case 5:{if(s&1&&s&2)throw new Error("Opening file ".concat(v.fileName," failed: cannot open file with both read and write flags set"));if(s&32)throw new Error("Opening file ".concat(v.fileName," failed: appending to HTTP/S3 files is not supported"));if(s&2){let C=new XMLHttpRequest;if(v.dataProtocol==5?(C.open("HEAD",_e(v.s3Config,v.dataUrl),!1),fe(C,v.s3Config,v.dataUrl,"HEAD")):C.open("HEAD",v.dataUrl,!1),C.send(null),C.status!=200&&C.status!=404)throw new Error("Opening file ".concat(v.fileName," failed: Unexpected return status from server (").concat(C.status,")"));if(C.status==404&&!(s&8||s&16))throw new Error("Opening file ".concat(v.fileName," failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag."));let T=n._malloc(1),ee=new Uint8Array;n.HEAPU8.set(ee,T);let j=n._malloc(3*8);return n.HEAPF64[(j>>3)+0]=1,n.HEAPF64[(j>>3)+1]=T,n.HEAPF64[(j>>3)+2]=new Date().getTime()/1e3,j}else if(!(s&1))throw new Error("Opening file ".concat(v.fileName," failed: unsupported file flags: ").concat(s));let S=null,U=null;if(!v.forceFullHttpReads&&(v.reliableHeadRequests||!v.allowFullHttpReads))try{let C=new XMLHttpRequest;v.dataProtocol==5?(C.open("HEAD",_e(v.s3Config,v.dataUrl),!1),fe(C,v.s3Config,v.dataUrl,"HEAD")):C.open("HEAD",v.dataUrl,!1),C.setRequestHeader("Range","bytes=0-"),C.send(null),S=null;try{S=C.getResponseHeader("Content-Length")}catch(T){console.warn("Failed to get Content-Length on request")}if(S!==null&&C.status==206){let T=n._malloc(24);n.HEAPF64[(T>>3)+0]=+S,n.HEAPF64[(T>>3)+1]=0;let ee=0;try{ee=new Date((o=C.getResponseHeader("Last-Modified"))!=null?o:"").getTime()/1e3}catch(j){console.warn("Failed to get Last-Modified on request")}return n.HEAPF64[(T>>3)+2]=+ee,T}}catch(C){U=C,console.warn("HEAD request with range header failed: ".concat(C))}if(v.allowFullHttpReads){if(!v.forceFullHttpReads){let T=new XMLHttpRequest;v.dataProtocol==5?(T.open("GET",_e(v.s3Config,v.dataUrl),!1),fe(T,v.s3Config,v.dataUrl,"GET")):T.open("GET",v.dataUrl,!1),T.responseType="arraybuffer",T.setRequestHeader("Range","bytes=0-0"),T.send(null);let ee=null;try{ee=T.getResponseHeader("Content-Length")}catch(Q){console.warn("Failed to get Content-Length on request")}let j=ee==null?void 0:ee.split("/")[1],te=ee,ne=null;if(j!==void 0)ne=j;else if(!v.reliableHeadRequests){let Q=new XMLHttpRequest;v.dataProtocol==5?(Q.open("HEAD",_e(v.s3Config,v.dataUrl),!1),fe(Q,v.s3Config,v.dataUrl,"HEAD")):Q.open("HEAD",v.dataUrl,!1),Q.setRequestHeader("Range","bytes=0-"),Q.send(null),S=null;try{S=Q.getResponseHeader("Content-Length")}catch(z){console.warn("Failed to get Content-Length on request")}S!==null&&+S>1&&(ne=S)}if(T.status==206&&te!==null&&+te==1&&ne!==null){let Q=n._malloc(24);n.HEAPF64[(Q>>3)+0]=+ne,n.HEAPF64[(Q>>3)+1]=0;let z=0;try{z=new Date((e=T.getResponseHeader("Last-Modified"))!=null?e:"").getTime()/1e3}catch(oe){console.warn("Failed to get Last-Modified on request")}return n.HEAPF64[(Q>>3)+2]=+z,Q}if(T.status==200&&te!==null&&S!==null&&+te==+S){console.warn("fall back to full HTTP read for: ".concat(v.dataUrl));let Q=n._malloc(T.response.byteLength),z=new Uint8Array(T.response,0,T.response.byteLength);n.HEAPU8.set(z,Q);let oe=n._malloc(3*8);n.HEAPF64[(oe>>3)+0]=T.response.byteLength,n.HEAPF64[(oe>>3)+1]=Q;let se=0;try{se=new Date((u=T.getResponseHeader("Last-Modified"))!=null?u:"").getTime()/1e3}catch(h){console.warn("Failed to get Last-Modified on request")}return n.HEAPF64[(oe>>3)+2]=+se,oe}console.warn("falling back to full HTTP read for: ".concat(v.dataUrl))}let C=new XMLHttpRequest;if(v.dataProtocol==5?(C.open("GET",_e(v.s3Config,v.dataUrl),!1),fe(C,v.s3Config,v.dataUrl,"GET")):C.open("GET",v.dataUrl,!1),C.responseType="arraybuffer",C.send(null),C.status==200){let T=n._malloc(C.response.byteLength),ee=new Uint8Array(C.response,0,C.response.byteLength);n.HEAPU8.set(ee,T);let j=n._malloc(3*8);n.HEAPF64[(j>>3)+0]=C.response.byteLength,n.HEAPF64[(j>>3)+1]=T;let te=0;try{te=new Date((l=C.getResponseHeader("Last-Modified"))!=null?l:"").getTime()/1e3}catch(ne){console.warn("Failed to get Last-Modified on request")}return n.HEAPF64[(j>>3)+2]=+te,j}}if(U!=null)throw new Error("Reading file ".concat(v.fileName," failed with error: ").concat(U));return 0}case 2:{let S=(f=L._files)==null?void 0:f.get(v.fileName);if(S){let T=n._malloc(24);return n.HEAPF64[(T>>3)+0]=S.size,n.HEAPF64[(T>>3)+1]=0,n.HEAPF64[(T>>3)+2]=0,T}if(s&128)return 0;console.warn("Buffering missing file: ".concat(v.fileName));let U=n._malloc(3*8),C=n._malloc(1);return n.HEAPF64[(U>>3)+0]=1,n.HEAPF64[(U>>3)+1]=C,n.HEAPF64[(U>>3)+2]=0,U}case 3:{let S=(c=L._files)==null?void 0:c.get(v.fileName);if(!S)throw new Error("No OPFS access handle registered with name: ".concat(v.fileName));s&16&&S.truncate(0);let U=n._malloc(3*8),C=S.getSize();return n.HEAPF64[(U>>3)+0]=C,n.HEAPF64[(U>>3)+1]=0,n.HEAPF64[(U>>3)+2]=0,U}}}catch(v){console.error(v.toString()),le(n,v.toString())}return 0},glob:(n,t,s)=>{var o;try{let e=O(n,t,s);if(e.startsWith("http")||e.startsWith("s3://")){let u=new XMLHttpRequest;if(e.startsWith("s3://")){let l=L.getGlobalFileInfo(n);u.open("HEAD",_e(l==null?void 0:l.s3Config,e),!1),fe(u,l==null?void 0:l.s3Config,e,"HEAD")}else u.open("HEAD",e,!1);if(u.send(null),u.status!=200&&u.status!==206){if(!((o=L.getGlobalFileInfo(n))!=null&&o.allowFullHttpReads))return console.log("HEAD request failed: ".concat(e,", with full http reads are disabled")),0;let l=new XMLHttpRequest;if(e.startsWith("s3://")){let c=L.getGlobalFileInfo(n);l.open("GET",_e(c==null?void 0:c.s3Config,e),!1),fe(l,c==null?void 0:c.s3Config,e,"HEAD")}else l.open("GET",e,!1);if(l.setRequestHeader("Range","bytes=0-0"),l.send(null),l.status!=200&&l.status!==206)return console.log("HEAD and GET requests failed: ".concat(e)),0;let f=null;try{f=l.getResponseHeader("Content-Length")}catch(c){console.warn("Failed to get Content-Length on request")}f&&+f>1&&console.warn("Range request for ".concat(e," did not return a partial response: ").concat(l.status,' "').concat(l.statusText,'"'))}n.ccall("duckdb_web_fs_glob_add_path",null,["string"],[e])}else for(let[u]of L._files.entries()||[])u.startsWith(e)&&n.ccall("duckdb_web_fs_glob_add_path",null,["string"],[u])}catch(e){return console.log(e),le(n,e.toString()),0}},checkFile:(n,t,s)=>{try{let o=O(n,t,s);if(o.startsWith("http")||o.startsWith("s3://")){let e=new XMLHttpRequest;if(o.startsWith("s3://")){let u=L.getGlobalFileInfo(n);e.open("HEAD",_e(u==null?void 0:u.s3Config,o),!1),fe(e,u==null?void 0:u.s3Config,o,"HEAD")}else e.open("HEAD",o,!1);return e.send(null),e.status==206||e.status==200}else return L._files.has(o)}catch(o){return console.log(o),!1}return!1},syncFile:(n,t)=>{},closeFile:(n,t)=>{var o;let s=L.getFileInfo(n,t);L._fileInfoCache.delete(t);try{switch(s==null?void 0:s.dataProtocol){case 0:case 4:case 5:break;case 1:case 2:return;case 3:{let e=(o=L._files)==null?void 0:o.get(s.fileName);if(!e)throw new Error("No OPFS access handle registered with name: ".concat(s.fileName));return e.flush()}}}catch(e){console.log(e),le(n,e.toString())}},dropFile:(n,t,s)=>{var u;let o=O(n,t,s),e=(u=L._files)==null?void 0:u.get(o);if(e){if(L._files.delete(o),e instanceof FileSystemSyncAccessHandle)try{e.flush(),e.close()}catch(l){throw new Error("Cannot drop file with name: ".concat(o))}e instanceof Blob}},truncateFile:(n,t,s)=>{var e;let o=L.getFileInfo(n,t);switch(o==null?void 0:o.dataProtocol){case 4:le(n,"Cannot truncate a http file");return;case 5:le(n,"Cannot truncate an s3 file");return;case 0:case 1:case 2:le(n,"truncateFile not implemented");return;case 3:{let u=(e=L._files)==null?void 0:e.get(o.fileName);if(!u)throw new Error("No OPFS access handle registered with name: ".concat(o.fileName));return u.truncate(s)}}return 0},readFile(n,t,s,o,e){var u;if(o==0)return 0;try{let l=L.getFileInfo(n,t);switch(l==null?void 0:l.dataProtocol){case 4:case 5:{if(!l.dataUrl)throw new Error("Missing data URL for file ".concat(t));try{let f=new XMLHttpRequest;if(l.dataProtocol==5?(f.open("GET",_e(l==null?void 0:l.s3Config,l.dataUrl),!1),fe(f,l==null?void 0:l.s3Config,l.dataUrl,"GET")):f.open("GET",l.dataUrl,!1),f.responseType="arraybuffer",f.setRequestHeader("Range","bytes=".concat(e,"-").concat(e+o-1)),f.send(null),f.status==206||f.status==200&&o==f.response.byteLength&&e==0){let c=new Uint8Array(f.response,0,Math.min(f.response.byteLength,o));return n.HEAPU8.set(c,s),c.byteLength}else if(f.status==200){console.warn("Range request for ".concat(l.dataUrl," did not return a partial response: ").concat(f.status,' "').concat(f.statusText,'"'));let c=new Uint8Array(f.response,e,Math.min(f.response.byteLength-e,o));return n.HEAPU8.set(c,s),c.byteLength}else throw new Error("Range request for ".concat(l.dataUrl," did returned non-success status: ").concat(f.status,' "').concat(f.statusText,'"'))}catch(f){throw console.log(f),new Error("Range request for ".concat(l.dataUrl," failed with error: ").concat(f,'"'))}}case 2:{let f=(u=L._files)==null?void 0:u.get(l.fileName);if(!f)throw new Error("No HTML5 file registered with name: ".concat(l.fileName));let c=f.slice(e,e+o),v=new Uint8Array(new FileReaderSync().readAsArrayBuffer(c));return n.HEAPU8.set(v,s),v.byteLength}case 3:{let f=L._files.get(l.fileName);if(!f)throw new Error("No OPFS access handle registered with name: ".concat(l.fileName));let c=n.HEAPU8.subarray(s,s+o);return f.read(c,{at:e})}}return 0}catch(l){return console.log(l),le(n,l.toString()),0}},writeFile:(n,t,s,o,e)=>{var l;let u=L.getFileInfo(n,t);switch(u==null?void 0:u.dataProtocol){case 4:return le(n,"Cannot write to HTTP file"),0;case 5:{let f=n.HEAPU8.subarray(s,s+o),c=new XMLHttpRequest;return c.open("PUT",_e(u==null?void 0:u.s3Config,u.dataUrl),!1),fe(c,u==null?void 0:u.s3Config,u.dataUrl,"PUT","",f),c.send(f),c.status!==200?(le(n,"Failed writing file: HTTP "+c.status),0):o}case 2:return le(n,"cannot write using the html5 file reader api"),0;case 3:{let f=(l=L._files)==null?void 0:l.get(u.fileName);if(!f)throw new Error("No OPFS access handle registered with name: ".concat(u.fileName));let c=n.HEAPU8.subarray(s,s+o);return f.write(c,{at:e})}}return 0},getLastFileModificationTime:(n,t)=>{var o;let s=L.getFileInfo(n,t);switch(s==null?void 0:s.dataProtocol){case 2:{if(!((o=L._files)==null?void 0:o.get(s.fileName)))throw Error("No handle available for file: ".concat(s.fileName));return 0}case 4:case 5:return new Date().getTime()/1e3}return 0},progressUpdate:(n,t,s)=>{postMessage&&postMessage({requestId:0,type:"PROGRESS_UPDATE",data:{status:n?"completed":"in-progress",percentage:t,repetitions:s}})},checkDirectory:(n,t,s)=>{let o=O(n,t,s);return console.log("checkDirectory: ".concat(o)),!1},createDirectory:(n,t,s)=>{let o=O(n,t,s);console.log("createDirectory: ".concat(o))},removeDirectory:(n,t,s)=>{let o=O(n,t,s);console.log("removeDirectory: ".concat(o))},listDirectoryEntries:(n,t,s)=>{let o=O(n,t,s);return console.log("listDirectoryEntries: ".concat(o)),!1},moveFile:(n,t,s,o,e)=>{var c,v;let u=O(n,t,s),l=O(n,o,e),f=(c=L._files)==null?void 0:c.get(u);f!==void 0&&(L._files.delete(f),L._files.set(l,f));for(let[S,U]of((v=L._fileInfoCache)==null?void 0:v.entries())||[])if(U.dataUrl==u){L._fileInfoCache.delete(S);break}return!0},removeFile:(n,t,s)=>{},callScalarUDF:(n,t,s,o,e,u,l)=>{Je(L,n,t,s,o,e,u,l)}};var It=Xe(Bt());var rr=class extends qe{constructor(t,s,o,e){super(t,s),this.mainModuleURL=o,this.pthreadWorkerURL=e}locateFile(t,s){if(t.endsWith(".wasm"))return this.mainModuleURL;if(t.endsWith(".worker.js")){if(!this.pthreadWorkerURL)throw new Error("Missing DuckDB worker URL!");return this.pthreadWorkerURL}throw new Error("WASM instantiation requested unexpected file: prefix=".concat(s," path=").concat(t))}instantiateWasm(t,s){globalThis.DUCKDB_RUNTIME=this._runtime;let o=this.onInstantiationProgress;if(WebAssembly.instantiateStreaming)if(typeof TransformStream=="function"){let u=(async()=>{var ee;let l=new Request(this.mainModuleURL),f=await fetch(l),c=f.headers.get("content-length"),v=c&&parseInt(c,10)||0,S=new Date,U={startedAt:S,updatedAt:S,bytesTotal:v||0,bytesLoaded:0},C={transform(j,te){U.bytesLoaded+=j.byteLength;let ne=new Date;if(ne.getTime()-U.updatedAt.getTime()<20){U.updatedAt=ne,te.enqueue(j);return}for(let Q of o)Q(U);te.enqueue(j)}},T=new TransformStream(C);return new Response((ee=f.body)==null?void 0:ee.pipeThrough(T),f)})();WebAssembly.instantiateStreaming(u,t).then(l=>{s(l.instance,l.module)})}else{console.warn("instantiating without progress handler since transform streams are unavailable");let e=new Request(this.mainModuleURL);WebAssembly.instantiateStreaming(fetch(e),t).then(u=>{s(u.instance,u.module)})}else if(typeof XMLHttpRequest=="function"){let e=new XMLHttpRequest,u=this.mainModuleURL,l=new Date,f={startedAt:l,updatedAt:l,bytesTotal:0,bytesLoaded:0};e.open("GET",u),e.responseType="arraybuffer",e.onerror=c=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+c}),new Error(c.toString())},e.onprogress=c=>{f.bytesTotal=c.total,f.bytesLoaded=c.loaded;let v=new Date;if(v.getTime()-f.updatedAt.getTime()<20){f.updatedAt=v;return}for(let S of o)S(f)},e.onload=()=>{WebAssembly.instantiate(e.response,t).then(c=>{s(c.instance,c.module)}).catch(c=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+c}),new Error(c)})},e.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let u=new Request(this.mainModuleURL),f=await(await fetch(u)).arrayBuffer();WebAssembly.instantiate(f,t).then(c=>{s(c.instance,c.module)})})();return[]}};var tr=class extends rr{constructor(t,s,o,e=null){super(t,s,o,e)}instantiateImpl(t){return(0,It.default)({...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};async function ba(n,t,s){var e;let o=(e=n.eh)!=null?e:n.mvp;if(!o)throw new Error("No suitable DuckDB bundle found");return new tr(t,s,o.mainModule)}
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
js-sha256/src/sha256.js:
|