@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,14 +0,0 @@
|
|
|
1
|
-
"use strict";var duckdb=(()=>{var uh=Object.create;var ai=Object.defineProperty;var dh=Object.getOwnPropertyDescriptor;var fh=Object.getOwnPropertyNames;var hh=Object.getPrototypeOf,ph=Object.prototype.hasOwnProperty;var aa=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r);var mh=(r,t,e)=>t in r?ai(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Vc=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Fn=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Pr=(r,t)=>{for(var e in t)ai(r,e,{get:t[e],enumerable:!0})},Hc=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fh(t))!ph.call(r,i)&&i!==e&&ai(r,i,{get:()=>t[i],enumerable:!(n=dh(t,i))||n.enumerable});return r};var zc=(r,t,e)=>(e=r!=null?uh(hh(r)):{},Hc(t||!r||!r.__esModule?ai(e,"default",{value:r,enumerable:!0}):e,r)),yh=r=>Hc(ai({},"__esModule",{value:!0}),r);var jc=(r,t,e)=>(mh(r,typeof t!="symbol"?t+"":t,e),e);var _h=function(r,t){this[0]=r,this[1]=t};var nn=r=>{var t=r[aa("asyncIterator")],e=!1,n,i={};return t==null?(t=r[aa("iterator")](),n=s=>i[s]=o=>t[s](o)):(t=t.call(r),n=s=>i[s]=o=>{if(e){if(e=!1,s==="throw")throw o;return o}return e=!0,{done:!1,value:new _h(new Promise(a=>{var c=t[s](o);if(!(c instanceof Object))throw TypeError("Object expected");a(c)}),1)}}),i[aa("iterator")]=()=>i,n("next"),"throw"in t?n("throw"):i.throw=s=>{throw s},"return"in t&&n("return"),i};var ju=Fn(()=>{});var Wu=Fn(()=>{});var Gu=Fn(($u,Jo)=>{"use strict";var hc=(()=>{var t;var r=typeof document<"u"?(t=document.currentScript)==null?void 0:t.src:void 0;return typeof __filename<"u"&&(r=r||__filename),async function(e={}){var n,i=e,s,o,a=new Promise((l,u)=>{s=l,o=u}),c=typeof window=="object",d=typeof WorkerGlobalScope<"u",p=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",S=Object.assign({},i),A=[],x="./this.program",ot=(l,u)=>{throw u},lt="";function Pt(l){return i.locateFile?i.locateFile(l,lt):lt+l}var Ot,Bt;if(p){var bt=ju(),Qt=Wu();lt=__dirname+"/",Bt=l=>{l=De(l)?new URL(l):l;var u=bt.readFileSync(l);return u},Ot=async(l,u=!0)=>{l=De(l)?new URL(l):l;var f=bt.readFileSync(l,u?void 0:"utf8");return f},!i.thisProgram&&process.argv.length>1&&(x=process.argv[1].replace(/\\/g,"/")),A=process.argv.slice(2),ot=(l,u)=>{throw process.exitCode=l,u}}else(c||d)&&(d?lt=self.location.href:typeof document<"u"&&document.currentScript&&(lt=document.currentScript.src),r&&(lt=r),lt.startsWith("blob:")?lt="":lt=lt.slice(0,lt.replace(/[?#].*/,"").lastIndexOf("/")+1),d&&(Bt=l=>{var u=new XMLHttpRequest;return u.open("GET",l,!1),u.responseType="arraybuffer",u.send(null),new Uint8Array(u.response)}),Ot=async l=>{var u=await fetch(l,{credentials:"same-origin"});if(u.ok)return u.arrayBuffer();throw new Error(u.status+" : "+u.url)});var Gt=i.print||console.log.bind(console),_=i.printErr||console.error.bind(console);Object.assign(i,S),S=null,i.arguments&&(A=i.arguments),i.thisProgram&&(x=i.thisProgram);var E=i.wasmBinary,k,w=!1,R;function F(l,u){l||qe(u)}var H,g,C,q,T,pt,Ke,mt,Be=!1,De=l=>l.startsWith("file://");function Lr(){var l=k.buffer;i.HEAP8=H=new Int8Array(l),i.HEAP16=C=new Int16Array(l),i.HEAPU8=g=new Uint8Array(l),i.HEAPU16=q=new Uint16Array(l),i.HEAP32=T=new Int32Array(l),i.HEAPU32=pt=new Uint32Array(l),i.HEAPF32=Ke=new Float32Array(l),i.HEAPF64=mt=new Float64Array(l)}function ei(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)pd(i.preRun.shift());yc(bc)}function ri(){Be=!0,P.ua()}function ni(){}function rd(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)hd(i.postRun.shift());yc(_c)}var rn=0,ii=null;function nd(l){var u;rn++,(u=i.monitorRunDependencies)==null||u.call(i,rn)}function id(l){var f;if(rn--,(f=i.monitorRunDependencies)==null||f.call(i,rn),rn==0&&ii){var u=ii;ii=null,u()}}function qe(l){var f;(f=i.onAbort)==null||f.call(i,l),l="Aborted("+l+")",_(l),w=!0,l+=". Build with -sASSERTIONS for more info.",Be&&___trap();var u=new WebAssembly.RuntimeError(l);throw o(u),u}var si;function sd(){return Pt("./duckdb-eh.wasm")}function od(l){if(l==si&&E)return new Uint8Array(E);if(Bt)return Bt(l);throw"both async and sync fetching of the wasm failed"}async function ad(l){if(!E)try{var u=await Ot(l);return new Uint8Array(u)}catch(f){}return od(l)}async function cd(l,u){try{var f=await ad(l),m=await WebAssembly.instantiate(f,u);return m}catch(y){_("failed to asynchronously prepare wasm: ".concat(y)),qe(y)}}async function ld(l,u,f){if(!l&&typeof WebAssembly.instantiateStreaming=="function"&&!p)try{var m=fetch(u,{credentials:"same-origin"}),y=await WebAssembly.instantiateStreaming(m,f);return y}catch(b){_("wasm streaming compile failed: ".concat(b)),_("falling back to ArrayBuffer instantiation")}return cd(u,f)}function ud(){return{a:eh}}async function dd(){function l(b,v){return P=b.exports,P=ch(P),k=P.ta,Lr(),id("wasm-instantiate"),P}nd("wasm-instantiate");function u(b){return l(b.instance)}var f=ud();if(i.instantiateWasm)return new Promise((b,v)=>{i.instantiateWasm(f,(I,U)=>{l(I,U),b(I.exports)})});si!=null||(si=sd());try{var m=await ld(E,si,f),y=u(m);return y}catch(b){return o(b),Promise.reject(b)}}var Kt,cr,fd={10168112:(l,u,f,m)=>{var y=gt(l);if(typeof XMLHttpRequest>"u")return 0;let b=new XMLHttpRequest;b.open(gt(m),y,!1),b.responseType="arraybuffer";for(var v=0,B=u;v<B*2;){var I=T[f/4+v>>>0],U=T[f/4+v+1>>>0];try{var V=encodeURI(gt(I));V==="Host"&&(V="X-Host-Override"),V==="User-Agent"&&(V="X-user-agent"),V==="Authorization"?b.setRequestHeader(V,gt(U)):b.setRequestHeader(V,encodeURI(gt(U)))}catch(Lt){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Lt)}v+=2}try{b.send(null)}catch(Lt){return 0}if(b.status>=400)return 0;for(var nt=b.response,B=nt.byteLength,ft=Cr(B+4),yt=new Uint8Array(nt),st=0;st<B;st++)i.HEAPU8[st+ft+4]=yt[st];var D=new Uint8Array(4);return D[0]=B%256,B-=D[0],B/=256,D[1]=B%256,B-=D[1],B/=256,D[2]=B%256,B-=D[2],B/=256,D[3]=B%256,B-=D[3],B/=256,i.HEAPU8.set(D,ft),ft},10169519:(l,u,f,m,y,b)=>{var v=gt(l);if(typeof XMLHttpRequest>"u")return 0;let I=new XMLHttpRequest;I.open(gt(m),v,!1),I.responseType="arraybuffer";for(var U=0,D=u;U<D*2;){var V=T[f/4+U>>>0],nt=T[f/4+U+1>>>0];try{var B=encodeURI(gt(V));B==="Host"&&(B="X-Host-Override"),B==="User-Agent"&&(B="X-user-agent"),B==="Authorization"?I.setRequestHeader(B,gt(nt)):I.setRequestHeader(B,encodeURI(gt(nt)))}catch(Ye){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ye)}U+=2}try{for(var ft=new Uint8Array(b),yt=0;yt<b;yt++)ft[yt]=i.HEAPU8[yt+y];I.send(ft)}catch(Ye){return 0}if(I.status>=400)return 0;for(var st=Uint8Array.from(Array.from(I.getResponseHeader("Etag")).map(Ye=>Ye.charCodeAt(0))),D=st.byteLength,Lt=Cr(D+4),Fe=new Uint8Array(st),yt=0;yt<D;yt++)i.HEAPU8[yt+Lt+4]=Fe[yt];var Ft=new Uint8Array(4);return Ft[0]=D%256,D-=Ft[0],D/=256,Ft[1]=D%256,D-=Ft[1],D/=256,Ft[2]=D%256,D-=Ft[2],D/=256,Ft[3]=D%256,D-=Ft[3],D/=256,i.HEAPU8.set(Ft,Lt),Lt},10171139:(l,u,f,m)=>{var y=gt(l);if(typeof XMLHttpRequest>"u")return 0;let b=new XMLHttpRequest;b.open(gt(m),y,!1),b.responseType="arraybuffer";for(var v=0,B=u;v<B*2;){var I=T[f/4+v>>>0],U=T[f/4+v+1>>>0];console.log("HEAD",gt(I),gt(U));try{var V=encodeURI(gt(I));V==="Host"&&(V="X-Host-Override"),V==="User-Agent"&&(V="X-user-agent"),V==="Authorization"?b.setRequestHeader(V,gt(U)):b.setRequestHeader(V,encodeURI(gt(U)))}catch(Ft){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ft)}v+=2}try{b.send(null)}catch(Ft){return 0}if(b.status>=400)return 0;for(var nt=b.response,B=nt.byteLength,ft=Cr(B+8),yt=new Uint8Array(nt),st=0;st<B;st++)i.HEAPU8[st+ft+8]=yt[st];var D=new Uint8Array(4);D[0]=B%256,B-=D[0],B/=256,D[1]=B%256,B-=D[1],B/=256,D[2]=B%256,B-=D[2],B/=256,D[3]=B%256,B-=D[3],B/=256,i.HEAPU8.set(D,ft+4);var Lt=Uint8Array.from(Array.from(b.getAllResponseHeaders()).map(Ft=>Ft.charCodeAt(0)));B=Lt.byteLength;for(var Fe=Cr(B+8),st=0;st<B;st++)i.HEAPU8[st+Fe+8]=Lt[st];return D=new Uint8Array(4),D[0]=B%256,B-=D[0],B/=256,D[1]=B%256,B-=D[1],B/=256,D[2]=B%256,B-=D[2],B/=256,D[3]=B%256,B-=D[3],B/=256,i.HEAPU8.set(D,Fe+4),B=Fe,D=new Uint8Array(4),D[0]=B%256,B-=D[0],B/=256,D[1]=B%256,B-=D[1],B/=256,D[2]=B%256,B-=D[2],B/=256,D[3]=B%256,B-=D[3],B/=256,i.HEAPU8.set(D,ft),ft},10173484:(l,u,f,m)=>{var y=gt(l);if(typeof XMLHttpRequest>"u")return 0;let b=new XMLHttpRequest;b.open(gt(m),y,!1),b.responseType="arraybuffer";for(var v=0,B=u;v<B*2;){var I=T[f/4+v>>>0],U=T[f/4+v+1>>>0];try{var V=encodeURI(gt(I));V==="Host"&&(V="X-Host-Override"),V==="User-Agent"&&(V="X-user-agent"),V==="Authorization"?b.setRequestHeader(V,gt(U)):b.setRequestHeader(V,encodeURI(gt(U)))}catch(Lt){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Lt)}v+=2}try{b.send(null)}catch(Lt){return 0}if(b.status>=400)return 0;for(var nt=b.response,B=nt.byteLength,ft=Cr(B+4),yt=new Uint8Array(nt),st=0;st<B;st++)i.HEAPU8[st+ft+4]=yt[st];var D=new Uint8Array(4);return D[0]=B%256,B-=D[0],B/=256,D[1]=B%256,B-=D[1],B/=256,D[2]=B%256,B-=D[2],B/=256,D[3]=B%256,B-=D[3],B/=256,i.HEAPU8.set(D,ft),ft},10174891:(l,u,f,m,y,b)=>{var v=gt(l);if(typeof XMLHttpRequest>"u")return 0;let I=new XMLHttpRequest;I.open(gt(m),v,!1),I.responseType="arraybuffer";for(var U=0,D=u;U<D*2;){var V=T[f/4+U>>>0],nt=T[f/4+U+1>>>0];try{var B=encodeURI(gt(V));B==="Host"&&(B="X-Host-Override"),B==="User-Agent"&&(B="X-user-agent"),B==="Authorization"?I.setRequestHeader(B,gt(nt)):I.setRequestHeader(B,encodeURI(gt(nt)))}catch(Ye){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ye)}U+=2}try{for(var ft=new Uint8Array(b),yt=0;yt<b;yt++)ft[yt]=i.HEAPU8[yt+y];I.send(ft)}catch(Ye){return 0}if(I.status>=400)return 0;for(var st=I.response,D=st.byteLength,Lt=Cr(D+4),Fe=new Uint8Array(st),yt=0;yt<D;yt++)i.HEAPU8[yt+Lt+4]=Fe[yt];var Ft=new Uint8Array(4);return Ft[0]=D%256,D-=Ft[0],D/=256,Ft[1]=D%256,D-=Ft[1],D/=256,Ft[2]=D%256,D-=Ft[2],D/=256,Ft[3]=D%256,D-=Ft[3],D/=256,i.HEAPU8.set(Ft,Lt),Lt}};class mc{constructor(u){jc(this,"name","ExitStatus");this.message="Program terminated with exit(".concat(u,")"),this.status=u}}var yc=l=>{for(;l.length>0;)l.shift()(i)},_c=[],hd=l=>_c.unshift(l),bc=[],pd=l=>bc.unshift(l),md=i.noExitRuntime||!0;function gc(){qe("missing function: $SOCKFS")}gc.stub=!0;function ta(){qe("missing function: $FS")}ta.stub=!0;var Dn=l=>{var u=gc.getSocket(l);if(!u)throw new ta.ErrnoError(8);return u},ea=l=>(l&255)+"."+(l>>8&255)+"."+(l>>16&255)+"."+(l>>24&255),wc=l=>{var u="",f=0,m=0,y=0,b=0,v=0,I=0,U=[l[0]&65535,l[0]>>16,l[1]&65535,l[1]>>16,l[2]&65535,l[2]>>16,l[3]&65535,l[3]>>16],V=!0,nt="";for(I=0;I<5;I++)if(U[I]!==0){V=!1;break}if(V){if(nt=ea(U[6]|U[7]<<16),U[5]===-1)return u="::ffff:",u+=nt,u;if(U[5]===0)return u="::",nt==="0.0.0.0"&&(nt=""),nt==="0.0.0.1"&&(nt="1"),u+=nt,u}for(f=0;f<8;f++)U[f]===0&&(f-y>1&&(v=0),y=f,v++),v>m&&(m=v,b=f-m+1);for(f=0;f<8;f++){if(m>1&&U[f]===0&&f>=b&&f<b+m){f===b&&(u+=":",b===0&&(u+=":"));continue}u+=Number(_ntohs(U[f]&65535)).toString(16),u+=f<7?":":""}return u},vc=(l,u)=>{var f=C[l>>>1>>>0],m=_ntohs(q[l+2>>>1>>>0]),y;switch(f){case 2:if(u!==16)return{errno:28};y=T[l+4>>>2>>>0],y=ea(y);break;case 10:if(u!==28)return{errno:28};y=[T[l+8>>>2>>>0],T[l+12>>>2>>>0],T[l+16>>>2>>>0],T[l+20>>>2>>>0]],y=wc(y);break;default:return{errno:5}}return{family:f,addr:y,port:m}},as=l=>{for(var u=l.split("."),f=0;f<4;f++){var m=Number(u[f]);if(isNaN(m))return null;u[f]=m}return(u[0]|u[1]<<8|u[2]<<16|u[3]<<24)>>>0},cs=l=>parseInt(l),ra=l=>{var u,f,m,y,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,v=[];if(!b.test(l))return null;if(l==="::")return[0,0,0,0,0,0,0,0];for(l.startsWith("::")?l=l.replace("::","Z:"):l=l.replace("::",":Z:"),l.indexOf(".")>0?(l=l.replace(new RegExp("[.]","g"),":"),u=l.split(":"),u[u.length-4]=cs(u[u.length-4])+cs(u[u.length-3])*256,u[u.length-3]=cs(u[u.length-2])+cs(u[u.length-1])*256,u=u.slice(0,u.length-2)):u=l.split(":"),m=0,y=0,f=0;f<u.length;f++)if(typeof u[f]=="string")if(u[f]==="Z"){for(y=0;y<8-u.length+1;y++)v[f+y]=0;m=y-1}else v[f+m]=_htons(parseInt(u[f],16));else v[f+m]=u[f];return[v[1]<<16|v[0],v[3]<<16|v[2],v[5]<<16|v[4],v[7]<<16|v[6]]},le={address_map:{id:1,addrs:{},names:{}},lookup_name(l){var u=as(l);if(u!==null||(u=ra(l),u!==null))return l;var f;if(le.address_map.addrs[l])f=le.address_map.addrs[l];else{var m=le.address_map.id++;F(m<65535,"exceeded max address mappings of 65535"),f="172.29."+(m&255)+"."+(m&65280),le.address_map.names[f]=l,le.address_map.addrs[l]=f}return f},lookup_addr(l){return le.address_map.names[l]?le.address_map.names[l]:null}},Sc=(l,u)=>{var f=vc(l,u);if(f.errno)throw new ta.ErrnoError(f.errno);return f.addr=le.lookup_addr(f.addr)||f.addr,f},Nr=(l,u)=>u+2097152>>>0<4194305-!!l?(l>>>0)+u*4294967296:NaN;function yd(l,u,f,m,y,b){u>>>=0,f>>>=0;var v=Dn(l),I=Sc(u,f);return v.sock_ops.bind(v,I.addr,I.port),0}function _d(l,u,f,m,y,b){u>>>=0,f>>>=0;var v=Dn(l),I=Sc(u,f);return v.sock_ops.connect(v,I.addr,I.port),0}var bd=(l,u,f)=>{};function gd(l,u,f,m){u>>>=0}var Ic=typeof TextDecoder<"u"?new TextDecoder:void 0,Bc=(l,u=0,f=NaN)=>{u>>>=0;for(var m=u+f,y=u;l[y]&&!(y>=m);)++y;if(y-u>16&&l.buffer&&Ic)return Ic.decode(l.subarray(u,y));for(var b="";u<y;){var v=l[u++];if(!(v&128)){b+=String.fromCharCode(v);continue}var I=l[u++]&63;if((v&224)==192){b+=String.fromCharCode((v&31)<<6|I);continue}var U=l[u++]&63;if((v&240)==224?v=(v&15)<<12|I<<6|U:v=(v&7)<<18|I<<12|U<<6|l[u++]&63,v<65536)b+=String.fromCharCode(v);else{var V=v-65536;b+=String.fromCharCode(55296|V>>10,56320|V&1023)}}return b},gt=(l,u)=>(l>>>=0,l?Bc(g,l,u):""),na={varargs:void 0,getStr(l){var u=gt(l);return u}};function wd(l,u,f){return f>>>=0,na.varargs=f,0}function vd(l,u){u>>>=0}function Sd(l,u,f){var m=Nr(u,f)}var Dc=l=>{for(var u=0,f=0;f<l.length;++f){var m=l.charCodeAt(f);m<=127?u++:m<=2047?u+=2:m>=55296&&m<=57343?(u+=4,++f):u+=3}return u};i.lengthBytesUTF8=Dc;var Id=(l,u,f,m)=>{if(f>>>=0,!(m>0))return 0;for(var y=f,b=f+m-1,v=0;v<l.length;++v){var I=l.charCodeAt(v);if(I>=55296&&I<=57343){var U=l.charCodeAt(++v);I=65536+((I&1023)<<10)|U&1023}if(I<=127){if(f>=b)break;u[f++>>>0]=I}else if(I<=2047){if(f+1>=b)break;u[f++>>>0]=192|I>>6,u[f++>>>0]=128|I&63}else if(I<=65535){if(f+2>=b)break;u[f++>>>0]=224|I>>12,u[f++>>>0]=128|I>>6&63,u[f++>>>0]=128|I&63}else{if(f+3>=b)break;u[f++>>>0]=240|I>>18,u[f++>>>0]=128|I>>12&63,u[f++>>>0]=128|I>>6&63,u[f++>>>0]=128|I&63}}return u[f>>>0]=0,f-y},kr=(l,u,f)=>Id(l,g,u,f);i.stringToUTF8=kr;function Bd(l,u){l>>>=0,u>>>=0}function Dd(l,u,f){u>>>=0,f>>>=0}var Fc=(l,u)=>{g.fill(0,l,l+u)},ls=(l,u,f,m,y)=>{switch(u){case 2:f=as(f),Fc(l,16),y&&(T[y>>>2>>>0]=16),C[l>>>1>>>0]=u,T[l+4>>>2>>>0]=f,C[l+2>>>1>>>0]=_htons(m);break;case 10:f=ra(f),Fc(l,28),y&&(T[y>>>2>>>0]=28),T[l>>>2>>>0]=u,T[l+8>>>2>>>0]=f[0],T[l+12>>>2>>>0]=f[1],T[l+16>>>2>>>0]=f[2],T[l+20>>>2>>>0]=f[3],C[l+2>>>1>>>0]=_htons(m);break;default:return 5}return 0};function Fd(l,u,f,m,y,b){u>>>=0,f>>>=0;var v=Dn(l);if(!v.daddr)return-53;var I=ls(u,v.family,le.lookup_name(v.daddr),v.dport,f);return 0}function Ad(l,u,f,m,y,b){u>>>=0,f>>>=0;var v=Dn(l),I=ls(u,v.family,le.lookup_name(v.saddr||"0.0.0.0"),v.sport,f);return 0}function xd(l,u,f,m,y,b){m>>>=0,y>>>=0;var v=Dn(l);return u===1&&f===4?(T[m>>>2>>>0]=v.error,T[y>>>2>>>0]=4,v.error=null,0):-50}function Td(l,u,f){return f>>>=0,na.varargs=f,0}function Ed(l,u){l>>>=0,u>>>=0}function Ud(l,u,f){u>>>=0}function Od(l,u,f,m){u>>>=0,f>>>=0}function Md(l,u,f,m){u>>>=0,m>>>=0,na.varargs=m}function Rd(l,u,f){l>>>=0}function Ld(l,u,f,m){u>>>=0,f>>>=0,m>>>=0}function Nd(l,u,f,m,y,b){u>>>=0,f>>>=0,y>>>=0,b>>>=0;var v=Dn(l),I=v.sock_ops.recvmsg(v,f);if(!I)return 0;if(y)var U=ls(y,v.family,le.lookup_name(I.addr),I.port,b);return g.set(I.buffer,u>>>0),I.buffer.byteLength}function kd(l,u,f,m){u>>>=0,m>>>=0}function Cd(l){l>>>=0}function Pd(l,u,f,m,y,b){u>>>=0,f>>>=0,y>>>=0,b>>>=0}var Vd=(l,u,f)=>{};function Hd(l,u){l>>>=0,u>>>=0}function zd(l,u,f){l>>>=0,u>>>=0,f>>>=0}function jd(l,u,f){u>>>=0}var Wd=()=>qe("");function Ac(){qe("missing function: _emval_call_method")}Ac.stub=!0;function xc(){qe("missing function: _emval_decref")}xc.stub=!0;function Tc(){qe("missing function: _emval_get_global")}Tc.stub=!0;function Ec(){qe("missing function: _emval_get_method_caller")}Ec.stub=!0;function Uc(){qe("missing function: _emval_run_destructors")}Uc.stub=!0;var $d=l=>l%4===0&&(l%100!==0||l%400===0),Gd=[0,31,60,91,121,152,182,213,244,274,305,335],Kd=[0,31,59,90,120,151,181,212,243,273,304,334],qd=l=>{var u=$d(l.getFullYear()),f=u?Gd:Kd,m=f[l.getMonth()]+l.getDate()-1;return m};function Yd(l,u,f){var m=Nr(l,u);f>>>=0;var y=new Date(m*1e3);T[f>>>2>>>0]=y.getSeconds(),T[f+4>>>2>>>0]=y.getMinutes(),T[f+8>>>2>>>0]=y.getHours(),T[f+12>>>2>>>0]=y.getDate(),T[f+16>>>2>>>0]=y.getMonth(),T[f+20>>>2>>>0]=y.getFullYear()-1900,T[f+24>>>2>>>0]=y.getDay();var b=qd(y)|0;T[f+28>>>2>>>0]=b,T[f+36>>>2>>>0]=-(y.getTimezoneOffset()*60);var v=new Date(y.getFullYear(),0,1),I=new Date(y.getFullYear(),6,1).getTimezoneOffset(),U=v.getTimezoneOffset(),V=(I!=U&&y.getTimezoneOffset()==Math.min(U,I))|0;T[f+32>>>2>>>0]=V}function Jd(l,u,f,m,y,b,v,I){l>>>=0;var U=Nr(y,b);return v>>>=0,I>>>=0,-52}function Xd(l,u,f,m,y,b,v){l>>>=0,u>>>=0;var I=Nr(b,v)}var Zd=function(l,u,f,m){l>>>=0,u>>>=0,f>>>=0,m>>>=0;var y=new Date().getFullYear(),b=new Date(y,0,1),v=new Date(y,6,1),I=b.getTimezoneOffset(),U=v.getTimezoneOffset(),V=Math.max(I,U);pt[l>>>2>>>0]=V*60,T[u>>>2>>>0]=+(I!=U);var nt=yt=>{var st=yt>=0?"-":"+",D=Math.abs(yt),Lt=String(Math.floor(D/60)).padStart(2,"0"),Fe=String(D%60).padStart(2,"0");return"UTC".concat(st).concat(Lt).concat(Fe)},B=nt(I),ft=nt(U);U<I?(kr(B,f,17),kr(ft,m,17)):(kr(B,m,17),kr(ft,f,17))},Oc=()=>performance.now(),Mc=()=>Date.now(),Qd=1,tf=l=>l>=0&&l<=3;function ef(l,u,f,m){var y=Nr(u,f);if(m>>>=0,!tf(l))return 28;var b;if(l===0)b=Mc();else if(Qd)b=Oc();else return 52;var v=Math.round(b*1e3*1e3);return cr=[v>>>0,(Kt=v,+Math.abs(Kt)>=1?Kt>0?+Math.floor(Kt/4294967296)>>>0:~~+Math.ceil((Kt-+(~~Kt>>>0))/4294967296)>>>0:0)],T[m>>>2>>>0]=cr[0],T[m+4>>>2>>>0]=cr[1],0}function rf(l,u){return l>>>=0,globalThis.DUCKDB_RUNTIME.createDirectory(i,l,u)}function nf(l,u){return l>>>=0,globalThis.DUCKDB_RUNTIME.checkDirectory(i,l,u)}function sf(l,u){return l>>>=0,globalThis.DUCKDB_RUNTIME.listDirectoryEntries(i,l,u)}function of(l,u){return l>>>=0,globalThis.DUCKDB_RUNTIME.removeDirectory(i,l,u)}function af(l){return globalThis.DUCKDB_RUNTIME.closeFile(i,l)}function cf(l,u){return l>>>=0,globalThis.DUCKDB_RUNTIME.dropFile(i,l,u)}function lf(l,u){return l>>>=0,globalThis.DUCKDB_RUNTIME.checkFile(i,l,u)}function uf(l,u,f,m){return l>>>=0,f>>>=0,globalThis.DUCKDB_RUNTIME.moveFile(i,l,u,f,m)}function df(l,u){return globalThis.DUCKDB_RUNTIME.openFile(i,l,u)}function ff(l,u,f,m){return u>>>=0,globalThis.DUCKDB_RUNTIME.readFile(i,l,u,f,m)}function hf(l,u){return globalThis.DUCKDB_RUNTIME.truncateFile(i,l,u)}function pf(l,u,f,m){return u>>>=0,globalThis.DUCKDB_RUNTIME.writeFile(i,l,u,f,m)}function mf(l){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(l)}function yf(l,u){return l>>>=0,globalThis.DUCKDB_RUNTIME.glob(i,l,u)}function _f(l){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(i,l)}function bf(l,u,f,m,y,b){return l>>>=0,f>>>=0,y>>>=0,globalThis.DUCKDB_RUNTIME.callScalarUDF(i,l,u,f,m,y,b)}var ia=[],gf=(l,u)=>{ia.length=0;for(var f;f=g[l++>>>0];){var m=f!=105;m&=f!=112,u+=m&&u%8?4:0,ia.push(f==112?pt[u>>>2>>>0]:f==105?T[u>>>2>>>0]:mt[u>>>3>>>0]),u+=m?8:4}return ia},wf=(l,u,f)=>{var m=gf(u,f);return fd[l](...m)};function vf(l,u,f){return l>>>=0,u>>>=0,f>>>=0,wf(l,u,f)}var Rc=()=>4294901760;function Sf(){return Rc()}var If=(l,u)=>Math.ceil(l/u)*u,Bf=l=>{var u=k.buffer,f=(l-u.byteLength+65535)/65536|0;try{return k.grow(f),Lr(),1}catch(m){}};function Df(l){l>>>=0;var u=g.length,f=Rc();if(l>f)return!1;for(var m=1;m<=4;m*=2){var y=u*(1+.2/m);y=Math.min(y,l+100663296);var b=Math.min(f,If(Math.max(l,y),65536)),v=Bf(b);if(v)return!0}return!1}var sa={},Ff=()=>x||"./this.program",oi=()=>{if(!oi.strings){var l=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",u={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:l,_:Ff()};for(var f in sa)sa[f]===void 0?delete u[f]:u[f]=sa[f];var m=[];for(var f in u)m.push("".concat(f,"=").concat(u[f]));oi.strings=m}return oi.strings},Af=(l,u)=>{for(var f=0;f<l.length;++f)H[u++>>>0]=l.charCodeAt(f);H[u>>>0]=0},xf=function(l,u){l>>>=0,u>>>=0;var f=0;return oi().forEach((m,y)=>{var b=u+f;pt[l+y*4>>>2>>>0]=b,Af(m,b),f+=m.length+1}),0},Tf=function(l,u){l>>>=0,u>>>=0;var f=oi();pt[l>>>2>>>0]=f.length;var m=0;return f.forEach(y=>m+=y.length+1),pt[u>>>2>>>0]=m,0},Ef=0,Uf=()=>md||Ef>0,Of=l=>{var u;R=l,Uf()||((u=i.onExit)==null||u.call(i,l),w=!0),ot(l,new mc(l))},Lc=(l,u)=>{R=l,Of(l)},Mf=Lc,Rf=l=>52;function Lf(l,u){u>>>=0;var f=0,m=0,y=0;{var b=2;l==0?f=2:(l==1||l==2)&&(f=64),y=1}return H[u>>>0]=b,C[u+2>>>1>>>0]=y,cr=[f>>>0,(Kt=f,+Math.abs(Kt)>=1?Kt>0?+Math.floor(Kt/4294967296)>>>0:~~+Math.ceil((Kt-+(~~Kt>>>0))/4294967296)>>>0:0)],T[u+8>>>2>>>0]=cr[0],T[u+12>>>2>>>0]=cr[1],cr=[m>>>0,(Kt=m,+Math.abs(Kt)>=1?Kt>0?+Math.floor(Kt/4294967296)>>>0:~~+Math.ceil((Kt-+(~~Kt>>>0))/4294967296)>>>0:0)],T[u+16>>>2>>>0]=cr[0],T[u+20>>>2>>>0]=cr[1],0}function Nf(l,u,f,m,y,b){u>>>=0,f>>>=0;var v=Nr(m,y);return b>>>=0,52}function kf(l,u,f,m,y,b){u>>>=0,f>>>=0;var v=Nr(m,y);return b>>>=0,52}function Cf(l,u,f,m){return u>>>=0,f>>>=0,m>>>=0,52}function Pf(l,u,f,m,y){var b=Nr(u,f);return y>>>=0,70}var Vf=l=>52,Hf=[null,[],[]],zf=(l,u)=>{var f=Hf[l];u===0||u===10?((l===1?Gt:_)(Bc(f)),f.length=0):f.push(u)};function jf(l,u,f,m){u>>>=0,f>>>=0,m>>>=0;for(var y=0,b=0;b<f;b++){var v=pt[u>>>2>>>0],I=pt[u+4>>>2>>>0];u+=8;for(var U=0;U<I;U++)zf(l,g[v+U>>>0]);y+=I}return pt[m>>>2>>>0]=y,0}function Wf(l,u,f,m){l>>>=0,u>>>=0,f>>>=0,m>>>=0;var y=0,b=0,v=0,I=0,U=0,V=0,nt;function B(ft,yt,st,D,Lt,Fe){var Ft,Ye,Je,Pc;return Ye=ft===10?28:16,Lt=ft===10?wc(Lt):ea(Lt),Ft=Cr(Ye),Pc=ls(Ft,ft,Lt,Fe),F(!Pc),Je=Cr(32),T[Je+4>>>2>>>0]=ft,T[Je+8>>>2>>>0]=yt,T[Je+12>>>2>>>0]=st,pt[Je+24>>>2>>>0]=D,pt[Je+20>>>2>>>0]=Ft,ft===10?T[Je+16>>>2>>>0]=28:T[Je+16>>>2>>>0]=16,T[Je+28>>>2>>>0]=0,Je}if(f&&(v=T[f>>>2>>>0],I=T[f+4>>>2>>>0],U=T[f+8>>>2>>>0],V=T[f+12>>>2>>>0]),U&&!V&&(V=U===2?17:6),!U&&V&&(U=V===17?2:1),V===0&&(V=6),U===0&&(U=1),!l&&!u)return-2;if(v&-1088||f!==0&&T[f>>>2>>>0]&2&&!l)return-1;if(v&32)return-2;if(U!==0&&U!==1&&U!==2)return-7;if(I!==0&&I!==2&&I!==10)return-6;if(u&&(u=gt(u),b=parseInt(u,10),isNaN(b)))return v&1024?-2:-8;if(!l)return I===0&&(I=2),v&1||(I===2?y=_htonl(2130706433):y=[0,0,0,_htonl(1)]),nt=B(I,U,V,null,y,b),pt[m>>>2>>>0]=nt,0;if(l=gt(l),y=as(l),y!==null)if(I===0||I===2)I=2;else if(I===10&&v&8)y=[0,0,_htonl(65535),y],I=10;else return-2;else if(y=ra(l),y!==null)if(I===0||I===10)I=10;else return-2;return y!=null?(nt=B(I,U,V,l,y,b),pt[m>>>2>>>0]=nt,0):v&4?-2:(l=le.lookup_name(l),y=as(l),I===0?I=2:I===10&&(y=[0,0,_htonl(65535),y]),nt=B(I,U,V,null,y,b),pt[m>>>2>>>0]=nt,0)}function $f(l,u,f,m,y,b,v){l>>>=0,f>>>=0,y>>>=0;var I=vc(l,u);if(I.errno)return-6;var U=I.port,V=I.addr,nt=!1;if(f&&m){var B;if(v&1||!(B=le.lookup_addr(V))){if(v&8)return-2}else V=B;var ft=kr(V,f,m);ft+1>=m&&(nt=!0)}if(y&&b){U=""+U;var ft=kr(U,y,b);ft+1>=b&&(nt=!0)}return nt?-12:0}var Gf=()=>{if(p){var l=["crypto"].map(Vc).pop();return u=>l.randomFillSync(u)}return u=>crypto.getRandomValues(u)},Nc=l=>{(Nc=Gf())(l)};function Kf(l,u){return l>>>=0,u>>>=0,Nc(g.subarray(l>>>0,l+u>>>0)),0}var qf=l=>{if(l instanceof mc||l=="unwind")return R;ot(1,l)},Yf=l=>{var u=i["_"+l];return u},Jf=(l,u)=>{H.set(l,u>>>0)},us=l=>oh(l);i.stackAlloc=us;var Xf=l=>{var u=Dc(l)+1,f=us(u);return kr(l,f,u),f},kc=()=>ah(),Cc=l=>sh(l),Zf=(l,u,f,m,y)=>{var b={string:st=>{var D=0;return st!=null&&st!==0&&(D=Xf(st)),D},array:st=>{var D=us(st.length);return Jf(st,D),D}};function v(st){return u==="string"?gt(st):u==="boolean"?!!st:st}var I=Yf(l),U=[],V=0;if(m)for(var nt=0;nt<m.length;nt++){var B=b[f[nt]];B?(V===0&&(V=kc()),U[nt]=B(m[nt])):U[nt]=m[nt]}var ft=I(...U);function yt(st){return V!==0&&Cc(V),v(st)}return ft=yt(ft),ft},Qf=l=>ih(),th=l=>nh(l),eh={ja:yd,oa:_d,I:bd,ea:gd,b:wd,da:vd,w:Sd,fa:Bd,_:Dd,ia:Fd,ha:Ad,ma:xd,h:Td,aa:Ed,$:Ud,ba:Od,t:Md,na:Rd,X:Ld,ka:Nd,Y:kd,o:Cd,la:Pd,s:Vd,ca:Hd,ga:zd,p:jd,ra:Wd,F:Ac,i:xc,H:Tc,G:Ec,E:Uc,z:Yd,A:Jd,B:Xd,qa:Zd,C:ef,O:rf,Q:nf,M:sf,N:of,m:af,T:cf,K:lf,L:uf,S:df,f:ff,R:hf,n:pf,U:mf,J:yf,l:_f,V:bf,e:vf,k:Mc,pa:Sf,c:Oc,sa:Df,u:xf,v:Tf,a:Mf,d:Rf,P:Lf,y:Nf,x:kf,j:Cf,D:Pf,Z:Vf,g:jf,r:Wf,q:$f,W:Kf},P=await dd(),rh=i._main=P.va,Km=i._duckdb_web_fs_glob_add_path=P.xa,qm=i._duckdb_web_clear_response=P.ya,Ym=i._duckdb_web_fail_with=P.za,Jm=i._duckdb_web_reset=P.Aa,Xm=i._duckdb_web_connect=P.Ba,Zm=i._duckdb_web_disconnect=P.Ca,Qm=i._duckdb_web_flush_files=P.Da,ty=i._duckdb_web_flush_file=P.Ea,ey=i._duckdb_web_open=P.Fa,ry=i._duckdb_web_get_global_file_info=P.Ga,ny=i._duckdb_web_collect_file_stats=P.Ha,iy=i._duckdb_web_export_file_stats=P.Ia,sy=i._duckdb_web_fs_drop_file=P.Ja,oy=i._duckdb_web_fs_drop_files=P.Ka,ay=i._duckdb_web_fs_glob_file_infos=P.La,cy=i._duckdb_web_fs_get_file_info_by_id=P.Ma,ly=i._duckdb_web_fs_get_file_info_by_name=P.Na,uy=i._duckdb_web_fs_register_file_url=P.Oa,dy=i._duckdb_web_fs_register_file_buffer=P.Pa,fy=i._duckdb_web_copy_file_to_buffer=P.Qa,hy=i._duckdb_web_copy_file_to_path=P.Ra,py=i._duckdb_web_get_version=P.Sa,my=i._duckdb_web_get_feature_flags=P.Ta,yy=i._duckdb_web_tokenize=P.Ua,_y=i._duckdb_web_tokenize_buffer=P.Va,by=i._duckdb_web_udf_scalar_create=P.Wa,gy=i._duckdb_web_prepared_create=P.Xa,wy=i._duckdb_web_prepared_create_buffer=P.Ya,vy=i._duckdb_web_prepared_close=P.Za,Sy=i._duckdb_web_prepared_run=P._a,Iy=i._duckdb_web_prepared_send=P.$a,By=i._duckdb_web_query_run=P.ab,Dy=i._duckdb_web_query_run_buffer=P.bb,Fy=i._duckdb_web_pending_query_start=P.cb,Ay=i._duckdb_web_pending_query_start_buffer=P.db,xy=i._duckdb_web_pending_query_poll=P.eb,Ty=i._duckdb_web_pending_query_cancel=P.fb,Ey=i._duckdb_web_query_fetch_results=P.gb,Uy=i._duckdb_web_get_tablenames=P.hb,Oy=i._duckdb_web_get_tablenames_buffer=P.ib,My=i._duckdb_web_insert_arrow_from_ipc_stream=P.jb,Ry=i._duckdb_web_insert_csv_from_path=P.kb,Ly=i._duckdb_web_insert_json_from_path=P.lb,Cr=i._malloc=P.pb,Ny=i._free=P.qb,ky=i._calloc=P.rb,nh=P.tb,ih=P.ub,sh=P.vb,oh=P.wb,ah=P.xb;function ch(l){l=Object.assign({},l);var u=y=>b=>y(b)>>>0,f=y=>(b,v)=>y(b,v)>>>0,m=y=>()=>y()>>>0;return l.pb=u(l.pb),l.rb=f(l.rb),l.wb=u(l.wb),l.xb=m(l.xb),l}i.stackSave=kc,i.stackRestore=Cc,i.stackAlloc=us,i.getTempRet0=Qf,i.setTempRet0=th,i.ccall=Zf;function lh(){var l=rh,u=0,f=0;try{var m=l(u,f);return Lc(m,!0),m}catch(y){return qf(y)}}function oa(){if(rn>0){ii=oa;return}if(ei(),rn>0){ii=oa;return}function l(){var f;if(i.calledRun=!0,!w){ri(),s(i),(f=i.onRuntimeInitialized)==null||f.call(i);var u=i.noInitialRun;u||lh(),rd()}}i.setStatus?(i.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>i.setStatus(""),1),l()},1)):l()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return oa(),n=a,n}})();typeof $u=="object"&&typeof Jo=="object"?(Jo.exports=hc,Jo.exports.default=hc):typeof define=="function"&&define.amd&&define([],()=>hc)});var qu=Fn(()=>{});var Yu=Fn(()=>{});var Ju=Fn((HD,Qo)=>{(function(){"use strict";var r="input is invalid type",t=typeof window=="object",e=t?window:{};e.JS_SHA256_NO_WINDOW&&(t=!1);var n=!t&&typeof self=="object",i=!e.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node&&process.type!="renderer";i?e=global:n&&(e=self);var s=!e.JS_SHA256_NO_COMMON_JS&&typeof Qo=="object"&&Qo.exports,o=typeof define=="function"&&define.amd,a=!e.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),d=[-2147483648,8388608,32768,128],p=[24,16,8,0],S=[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],A=["hex","array","digest","arrayBuffer"],x=[];(e.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(_){return Object.prototype.toString.call(_)==="[object Array]"}),a&&(e.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(_){return typeof _=="object"&&_.buffer&&_.buffer.constructor===ArrayBuffer});var ot=function(_,E){return function(k){return new bt(E,!0).update(k)[_]()}},lt=function(_){var E=ot("hex",_);i&&(E=Pt(E,_)),E.create=function(){return new bt(_)},E.update=function(R){return E.create().update(R)};for(var k=0;k<A.length;++k){var w=A[k];E[w]=ot(w,_)}return E},Pt=function(_,E){var k=qu(),w=Yu().Buffer,R=E?"sha224":"sha256",F;w.from&&!e.JS_SHA256_NO_BUFFER_FROM?F=w.from:F=function(g){return new w(g)};var H=function(g){if(typeof g=="string")return k.createHash(R).update(g,"utf8").digest("hex");if(g==null)throw new Error(r);return g.constructor===ArrayBuffer&&(g=new Uint8Array(g)),Array.isArray(g)||ArrayBuffer.isView(g)||g.constructor===w?k.createHash(R).update(F(g)).digest("hex"):_(g)};return H},Ot=function(_,E){return function(k,w){return new Qt(k,E,!0).update(w)[_]()}},Bt=function(_){var E=Ot("hex",_);E.create=function(R){return new Qt(R,_)},E.update=function(R,F){return E.create(R).update(F)};for(var k=0;k<A.length;++k){var w=A[k];E[w]=Ot(w,_)}return E};function bt(_,E){E?(x[0]=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,this.blocks=x):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],_?(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=_}bt.prototype.update=function(_){if(!this.finalized){var E,k=typeof _;if(k!=="string"){if(k==="object"){if(_===null)throw new Error(r);if(a&&_.constructor===ArrayBuffer)_=new Uint8Array(_);else if(!Array.isArray(_)&&(!a||!ArrayBuffer.isView(_)))throw new Error(r)}else throw new Error(r);E=!0}for(var w,R=0,F,H=_.length,g=this.blocks;R<H;){if(this.hashed&&(this.hashed=!1,g[0]=this.block,this.block=g[16]=g[1]=g[2]=g[3]=g[4]=g[5]=g[6]=g[7]=g[8]=g[9]=g[10]=g[11]=g[12]=g[13]=g[14]=g[15]=0),E)for(F=this.start;R<H&&F<64;++R)g[F>>>2]|=_[R]<<p[F++&3];else for(F=this.start;R<H&&F<64;++R)w=_.charCodeAt(R),w<128?g[F>>>2]|=w<<p[F++&3]:w<2048?(g[F>>>2]|=(192|w>>>6)<<p[F++&3],g[F>>>2]|=(128|w&63)<<p[F++&3]):w<55296||w>=57344?(g[F>>>2]|=(224|w>>>12)<<p[F++&3],g[F>>>2]|=(128|w>>>6&63)<<p[F++&3],g[F>>>2]|=(128|w&63)<<p[F++&3]):(w=65536+((w&1023)<<10|_.charCodeAt(++R)&1023),g[F>>>2]|=(240|w>>>18)<<p[F++&3],g[F>>>2]|=(128|w>>>12&63)<<p[F++&3],g[F>>>2]|=(128|w>>>6&63)<<p[F++&3],g[F>>>2]|=(128|w&63)<<p[F++&3]);this.lastByteIndex=F,this.bytes+=F-this.start,F>=64?(this.block=g[16],this.start=F-64,this.hash(),this.hashed=!0):this.start=F}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},bt.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var _=this.blocks,E=this.lastByteIndex;_[16]=this.block,_[E>>>2]|=d[E&3],this.block=_[16],E>=56&&(this.hashed||this.hash(),_[0]=this.block,_[16]=_[1]=_[2]=_[3]=_[4]=_[5]=_[6]=_[7]=_[8]=_[9]=_[10]=_[11]=_[12]=_[13]=_[14]=_[15]=0),_[14]=this.hBytes<<3|this.bytes>>>29,_[15]=this.bytes<<3,this.hash()}},bt.prototype.hash=function(){var _=this.h0,E=this.h1,k=this.h2,w=this.h3,R=this.h4,F=this.h5,H=this.h6,g=this.h7,C=this.blocks,q,T,pt,Ke,mt,Be,De,Lr,ei,ri,ni;for(q=16;q<64;++q)mt=C[q-15],T=(mt>>>7|mt<<25)^(mt>>>18|mt<<14)^mt>>>3,mt=C[q-2],pt=(mt>>>17|mt<<15)^(mt>>>19|mt<<13)^mt>>>10,C[q]=C[q-16]+T+C[q-7]+pt<<0;for(ni=E&k,q=0;q<64;q+=4)this.first?(this.is224?(Lr=300032,mt=C[0]-1413257819,g=mt-150054599<<0,w=mt+24177077<<0):(Lr=704751109,mt=C[0]-210244248,g=mt-1521486534<<0,w=mt+143694565<<0),this.first=!1):(T=(_>>>2|_<<30)^(_>>>13|_<<19)^(_>>>22|_<<10),pt=(R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7),Lr=_&E,Ke=Lr^_&k^ni,De=R&F^~R&H,mt=g+pt+De+S[q]+C[q],Be=T+Ke,g=w+mt<<0,w=mt+Be<<0),T=(w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10),pt=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),ei=w&_,Ke=ei^w&E^Lr,De=g&R^~g&F,mt=H+pt+De+S[q+1]+C[q+1],Be=T+Ke,H=k+mt<<0,k=mt+Be<<0,T=(k>>>2|k<<30)^(k>>>13|k<<19)^(k>>>22|k<<10),pt=(H>>>6|H<<26)^(H>>>11|H<<21)^(H>>>25|H<<7),ri=k&w,Ke=ri^k&_^ei,De=H&g^~H&R,mt=F+pt+De+S[q+2]+C[q+2],Be=T+Ke,F=E+mt<<0,E=mt+Be<<0,T=(E>>>2|E<<30)^(E>>>13|E<<19)^(E>>>22|E<<10),pt=(F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7),ni=E&k,Ke=ni^E&w^ri,De=F&H^~F&g,mt=R+pt+De+S[q+3]+C[q+3],Be=T+Ke,R=_+mt<<0,_=mt+Be<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+_<<0,this.h1=this.h1+E<<0,this.h2=this.h2+k<<0,this.h3=this.h3+w<<0,this.h4=this.h4+R<<0,this.h5=this.h5+F<<0,this.h6=this.h6+H<<0,this.h7=this.h7+g<<0},bt.prototype.hex=function(){this.finalize();var _=this.h0,E=this.h1,k=this.h2,w=this.h3,R=this.h4,F=this.h5,H=this.h6,g=this.h7,C=c[_>>>28&15]+c[_>>>24&15]+c[_>>>20&15]+c[_>>>16&15]+c[_>>>12&15]+c[_>>>8&15]+c[_>>>4&15]+c[_&15]+c[E>>>28&15]+c[E>>>24&15]+c[E>>>20&15]+c[E>>>16&15]+c[E>>>12&15]+c[E>>>8&15]+c[E>>>4&15]+c[E&15]+c[k>>>28&15]+c[k>>>24&15]+c[k>>>20&15]+c[k>>>16&15]+c[k>>>12&15]+c[k>>>8&15]+c[k>>>4&15]+c[k&15]+c[w>>>28&15]+c[w>>>24&15]+c[w>>>20&15]+c[w>>>16&15]+c[w>>>12&15]+c[w>>>8&15]+c[w>>>4&15]+c[w&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[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[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];return this.is224||(C+=c[g>>>28&15]+c[g>>>24&15]+c[g>>>20&15]+c[g>>>16&15]+c[g>>>12&15]+c[g>>>8&15]+c[g>>>4&15]+c[g&15]),C},bt.prototype.toString=bt.prototype.hex,bt.prototype.digest=function(){this.finalize();var _=this.h0,E=this.h1,k=this.h2,w=this.h3,R=this.h4,F=this.h5,H=this.h6,g=this.h7,C=[_>>>24&255,_>>>16&255,_>>>8&255,_&255,E>>>24&255,E>>>16&255,E>>>8&255,E&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255,F>>>24&255,F>>>16&255,F>>>8&255,F&255,H>>>24&255,H>>>16&255,H>>>8&255,H&255];return this.is224||C.push(g>>>24&255,g>>>16&255,g>>>8&255,g&255),C},bt.prototype.array=bt.prototype.digest,bt.prototype.arrayBuffer=function(){this.finalize();var _=new ArrayBuffer(this.is224?28:32),E=new DataView(_);return E.setUint32(0,this.h0),E.setUint32(4,this.h1),E.setUint32(8,this.h2),E.setUint32(12,this.h3),E.setUint32(16,this.h4),E.setUint32(20,this.h5),E.setUint32(24,this.h6),this.is224||E.setUint32(28,this.h7),_};function Qt(_,E,k){var w,R=typeof _;if(R==="string"){var F=[],H=_.length,g=0,C;for(w=0;w<H;++w)C=_.charCodeAt(w),C<128?F[g++]=C:C<2048?(F[g++]=192|C>>>6,F[g++]=128|C&63):C<55296||C>=57344?(F[g++]=224|C>>>12,F[g++]=128|C>>>6&63,F[g++]=128|C&63):(C=65536+((C&1023)<<10|_.charCodeAt(++w)&1023),F[g++]=240|C>>>18,F[g++]=128|C>>>12&63,F[g++]=128|C>>>6&63,F[g++]=128|C&63);_=F}else if(R==="object"){if(_===null)throw new Error(r);if(a&&_.constructor===ArrayBuffer)_=new Uint8Array(_);else if(!Array.isArray(_)&&(!a||!ArrayBuffer.isView(_)))throw new Error(r)}else throw new Error(r);_.length>64&&(_=new bt(E,!0).update(_).array());var q=[],T=[];for(w=0;w<64;++w){var pt=_[w]||0;q[w]=92^pt,T[w]=54^pt}bt.call(this,E,k),this.update(T),this.oKeyPad=q,this.inner=!0,this.sharedMemory=k}Qt.prototype=new bt,Qt.prototype.finalize=function(){if(bt.prototype.finalize.call(this),this.inner){this.inner=!1;var _=this.array();bt.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(_),bt.prototype.finalize.call(this)}};var Gt=lt();Gt.sha256=Gt,Gt.sha224=lt(!0),Gt.sha256.hmac=Bt(),Gt.sha224.hmac=Bt(!0),s?Qo.exports=Gt:(e.sha256=Gt.sha256,e.sha224=Gt.sha224,o&&define(function(){return Gt}))})()});var Gm={};Pr(Gm,{registerWorker:()=>ed});function $c(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function O(r,t,e,n){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(p){try{d(n.next(p))}catch(S){o(S)}}function c(p){try{d(n.throw(p))}catch(S){o(S)}}function d(p){p.done?s(p.value):i(p.value).then(a,c)}d((n=n.apply(r,t||[])).next())})}function Wc(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function it(r){return this instanceof it?(this.v=r,this):new it(r)}function ue(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(A){n[A]&&(i[A]=function(x){return new Promise(function(ot,lt){s.push([A,x,ot,lt])>1||a(A,x)})})}function a(A,x){try{c(n[A](x))}catch(ot){S(s[0][3],ot)}}function c(A){A.value instanceof it?Promise.resolve(A.value.v).then(d,p):S(s[0][2],A)}function d(A){a("next",A)}function p(A){a("throw",A)}function S(A,x){A(x),s.shift(),s.length&&a(s[0][0],s[0][1])}}function An(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,s){t[i]=r[i]?function(o){return(e=!e)?{value:it(r[i](o)),done:!1}:s?s(o):o}:s}}function Ae(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof Wc=="function"?Wc(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(s){e[s]=r[s]&&function(o){return new Promise(function(a,c){o=r[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(d){s({value:d,done:a})},o)}}var ha={};Pr(ha,{compareArrayLike:()=>fa,joinUint8Arrays:()=>de,memcpy:()=>ui,rebaseValueOffsets:()=>bs,toArrayBufferView:()=>at,toArrayBufferViewAsyncIterator:()=>Ee,toArrayBufferViewIterator:()=>Ze,toBigInt64Array:()=>_s,toBigUint64Array:()=>Fh,toFloat32Array:()=>Ah,toFloat32ArrayAsyncIterator:()=>jh,toFloat32ArrayIterator:()=>Lh,toFloat64Array:()=>xh,toFloat64ArrayAsyncIterator:()=>Wh,toFloat64ArrayIterator:()=>Nh,toInt16Array:()=>Ih,toInt16ArrayAsyncIterator:()=>Ph,toInt16ArrayIterator:()=>Uh,toInt32Array:()=>sn,toInt32ArrayAsyncIterator:()=>Vh,toInt32ArrayIterator:()=>Oh,toInt8Array:()=>Sh,toInt8ArrayAsyncIterator:()=>Ch,toInt8ArrayIterator:()=>Eh,toUint16Array:()=>Bh,toUint16ArrayAsyncIterator:()=>Hh,toUint16ArrayIterator:()=>Mh,toUint32Array:()=>Dh,toUint32ArrayAsyncIterator:()=>zh,toUint32ArrayIterator:()=>Rh,toUint8Array:()=>Y,toUint8ArrayAsyncIterator:()=>da,toUint8ArrayIterator:()=>ua,toUint8ClampedArray:()=>Th,toUint8ClampedArrayAsyncIterator:()=>$h,toUint8ClampedArrayIterator:()=>kh});var bh=new TextDecoder("utf-8"),ci=r=>bh.decode(r),gh=new TextEncoder,Xe=r=>gh.encode(r);var wh=r=>typeof r=="number",Gc=r=>typeof r=="boolean",zt=r=>typeof r=="function",te=r=>r!=null&&Object(r)===r,xe=r=>te(r)&&zt(r.then);var Te=r=>te(r)&&zt(r[Symbol.iterator]),_e=r=>te(r)&&zt(r[Symbol.asyncIterator]),ds=r=>te(r)&&te(r.schema);var fs=r=>te(r)&&"done"in r&&"value"in r;var hs=r=>te(r)&&zt(r.stat)&&wh(r.fd);var ps=r=>te(r)&&li(r.body),ms=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Kc=r=>te(r)&&zt(r.abort)&&zt(r.getWriter)&&!ms(r),li=r=>te(r)&&zt(r.cancel)&&zt(r.getReader)&&!ms(r),qc=r=>te(r)&&zt(r.end)&&zt(r.write)&&Gc(r.writable)&&!ms(r),ys=r=>te(r)&&zt(r.read)&&zt(r.pipe)&&Gc(r.readable)&&!ms(r),Yc=r=>te(r)&&zt(r.clear)&&zt(r.bytes)&&zt(r.position)&&zt(r.setPosition)&&zt(r.capacity)&&zt(r.getBufferIdentifier)&&zt(r.createLong);var la=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function vh(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,a,c=0,d=0,p=r.length;++c<p;){if(o=t[d],a=r[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++d]=a);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:n,byteLength:s}=a,e+i<n||n+s<e){a&&(t[++d]=a);continue}t[d]=new Uint8Array(o.buffer,e,n-e+s)}return t}function ui(r,t,e=0,n=t.byteLength){let i=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return s.set(o,e),r}function de(r,t){let e=vh(r),n=e.reduce((p,S)=>p+S.byteLength,0),i,s,o,a=0,c=-1,d=Math.min(t||Number.POSITIVE_INFINITY,n);for(let p=e.length;++c<p;){if(i=e[c],s=i.subarray(0,Math.min(i.length,d-a)),d<=a+s.length){s.length<i.length?e[c]=i.subarray(s.length):s.length===i.length&&c++,o?ui(o,s,a):o=s;break}ui(o||(o=new Uint8Array(d)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),n-(o?o.byteLength:0)]}function at(r,t){let e=fs(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Xe(e)),e instanceof ArrayBuffer?new r(e):e instanceof la?new r(e):Yc(e)?at(r,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new r(0):new r(e.buffer,e.byteOffset,e.byteLength/r.BYTES_PER_ELEMENT):r.from(e)):new r(0)}var Sh=r=>at(Int8Array,r),Ih=r=>at(Int16Array,r),sn=r=>at(Int32Array,r),_s=r=>at(BigInt64Array,r),Y=r=>at(Uint8Array,r),Bh=r=>at(Uint16Array,r),Dh=r=>at(Uint32Array,r),Fh=r=>at(BigUint64Array,r),Ah=r=>at(Float32Array,r),xh=r=>at(Float64Array,r),Th=r=>at(Uint8ClampedArray,r),ca=r=>(r.next(),r);function*Ze(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof la?e(t):Te(t)?t:e(t);return yield*nn(ca(function*(i){let s=null;do s=i.next(yield at(r,s));while(!s.done)}(n[Symbol.iterator]()))),new r}var Eh=r=>Ze(Int8Array,r),Uh=r=>Ze(Int16Array,r),Oh=r=>Ze(Int32Array,r),ua=r=>Ze(Uint8Array,r),Mh=r=>Ze(Uint16Array,r),Rh=r=>Ze(Uint32Array,r),Lh=r=>Ze(Float32Array,r),Nh=r=>Ze(Float64Array,r),kh=r=>Ze(Uint8ClampedArray,r);function Ee(r,t){return ue(this,arguments,function*(){if(xe(t))return yield it(yield it(yield*nn(An(Ae(Ee(r,yield it(t)))))));let n=function(o){return ue(this,arguments,function*(){yield yield it(yield it(o))})},i=function(o){return ue(this,arguments,function*(){yield it(yield*nn(An(Ae(ca(function*(a){let c=null;do c=a.next(yield c==null?void 0:c.value);while(!c.done)}(o[Symbol.iterator]()))))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof la?n(t):Te(t)?i(t):_e(t)?t:n(t);return yield it(yield*nn(An(Ae(ca(function(o){return ue(this,arguments,function*(){let a=null;do a=yield it(o.next(yield yield it(at(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]())))))),yield it(new r)})}var Ch=r=>Ee(Int8Array,r),Ph=r=>Ee(Int16Array,r),Vh=r=>Ee(Int32Array,r),da=r=>Ee(Uint8Array,r),Hh=r=>Ee(Uint16Array,r),zh=r=>Ee(Uint32Array,r),jh=r=>Ee(Float32Array,r),Wh=r=>Ee(Float64Array,r),$h=r=>Ee(Uint8ClampedArray,r);function bs(r,t,e){if(r!==0){e=e.slice(0,t);for(let n=-1,i=e.length;++n<i;)e[n]+=r}return e.subarray(0,t)}function fa(r,t){let e=0,n=r.length;if(n!==t.length)return!1;if(n>0)do if(r[e]!==t[e])return!1;while(++e<n);return!0}var qt={fromIterable(r){return gs(Gh(r))},fromAsyncIterable(r){return gs(Kh(r))},fromDOMStream(r){return gs(qh(r))},fromNodeStream(r){return gs(Yh(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},gs=r=>(r.next(),r);function*Gh(r){let t,e=!1,n=[],i,s,o,a=0;function c(){return s==="peek"?de(n,o)[0]:([i,n,a]=de(n,o),i)}({cmd:s,size:o}=(yield null)||{cmd:"read",size:0});let d=ua(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?d.next():d.next(o-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield c());while(o<a);while(!t)}catch(p){(e=!0)&&typeof d.throw=="function"&&d.throw(p)}finally{e===!1&&typeof d.return=="function"&&d.return(null)}return null}function Kh(r){return ue(this,arguments,function*(){let e,n=!1,i=[],s,o,a,c=0;function d(){return o==="peek"?de(i,a)[0]:([s,i,c]=de(i,a),s)}({cmd:o,size:a}=(yield yield it(null))||{cmd:"read",size:0});let p=da(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield it(p.next()):yield it(p.next(a-c)),!e&&s.byteLength>0&&(i.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield it(d()));while(a<c);while(!e)}catch(S){(n=!0)&&typeof p.throw=="function"&&(yield it(p.throw(S)))}finally{n===!1&&typeof p.return=="function"&&(yield it(p.return(new Uint8Array(0))))}return yield it(null)})}function qh(r){return ue(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,c=0;function d(){return o==="peek"?de(i,a)[0]:([s,i,c]=de(i,a),s)}({cmd:o,size:a}=(yield yield it(null))||{cmd:"read",size:0});let p=new ma(r);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield it(p.read()):yield it(p.read(a-c)),!e&&s.byteLength>0&&(i.push(Y(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield it(d()));while(a<c);while(!e)}catch(S){(n=!0)&&(yield it(p.cancel(S)))}finally{n===!1?yield it(p.cancel()):r.locked&&p.releaseLock()}return yield it(null)})}var ma=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return O(this,void 0,void 0,function*(){let{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return O(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let e=yield this.reader.read();return!e.done&&(e.value=Y(e)),e})}},pa=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function Yh(r){return ue(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,c=0,d=[],p;function S(){return o==="peek"?de(d,a)[0]:([p,d,c]=de(d,a),p)}if({cmd:o,size:a}=(yield yield it(null))||{cmd:"read",size:0},r.isTTY)return yield yield it(new Uint8Array(0)),yield it(null);try{e[0]=pa(r,"end"),e[1]=pa(r,"error");do{if(e[2]=pa(r,"readable"),[n,s]=yield it(Promise.race(e.map(x=>x[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(p=Y(r.read(a-c)),p.byteLength<a-c&&(p=Y(r.read()))):p=Y(r.read()),p.byteLength>0&&(d.push(p),c+=p.byteLength)),i||a<=c)do({cmd:o,size:a}=yield yield it(S()));while(a<c)}while(!i)}finally{yield it(A(e,n==="error"?s:null))}return yield it(null);function A(x,ot){return p=d=null,new Promise((lt,Pt)=>{for(let[Ot,Bt]of x)r.off(Ot,Bt);try{let Ot=r.destroy;Ot&&Ot.call(r,ot),ot=void 0}catch(Ot){ot=Ot||ot}finally{ot!=null?Pt(ot):lt()}})}})}var wt;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(wt||(wt={}));var At;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(At||(At={}));var Dt;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(Dt||(Dt={}));var kt;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(kt||(kt={}));var L;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(L||(L={}));var jt;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(jt||(jt={}));var Qe=new Int32Array(2),ws=new Float32Array(Qe.buffer),vs=new Float64Array(Qe.buffer),xn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var di;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(di||(di={}));var fe=class r{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new r(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Qe[0]=this.readInt32(t),ws[0]}readFloat64(t){return Qe[xn?0:1]=this.readInt32(t),Qe[xn?1:0]=this.readInt32(t+4),vs[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){ws[0]=e,this.writeInt32(t,Qe[0])}writeFloat64(t,e){vs[0]=e,this.writeInt32(t,Qe[xn?0:1]),this.writeInt32(t+4,Qe[xn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return e===di.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s)}return n}createObjList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s.unpack())}return n}};var on=class r{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=fe.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){let i=this.bb.capacity();this.bb=r.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){(this.force_defaults||e!==n)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=e<<1,i=fe.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let s=(n+i)*2;this.addInt16(s);let o=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let c=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(c)){for(let d=2;d<s;d+=2)if(this.bb.readInt16(a+d)!=this.bb.readInt16(c+d))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let i=n?4:0;if(e){let s=e;if(this.prep(this.minalign,8+i),s.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=3;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(i)&&this.bb.readInt16(i+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;return t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)e.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var fi;(function(r){r[r.BUFFER=0]="BUFFER"})(fi||(fi={}));var hi;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(hi||(hi={}));var Is=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):hi.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):fi.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,hi.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,fi.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return r.startBodyCompression(t),r.addCodec(t,e),r.addMethod(t,n),r.endBodyCompression(t)}};var Tn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n!=null?n:0)),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var En=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n!=null?n:0)),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var he=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new En).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Tn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new Is).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}};var lr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new he).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var Vr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Vr||(Vr={}));var pi;(function(r){r[r.DenseArray=0]="DenseArray"})(pi||(pi={}));var Oe=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,n){return r.startInt(t),r.addBitWidth(t,e),r.addIsSigned(t,n),r.endInt(t)}};var tr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Oe).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):pi.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,pi.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Wt=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return r.startKeyValue(t),r.addKey(t,e),r.addValue(t,n),r.endKeyValue(t)}};var mi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return r.startBinary(t),r.endBinary(t)}};var yi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return r.startBool(t),r.endBool(t)}};var Hr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):kt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,kt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return r.startDate(t),r.addUnit(t,e),r.endDate(t)}};var er=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,n,i){return r.startDecimal(t),r.addPrecision(t,e),r.addScale(t,n),r.addBitWidth(t,i),r.endDecimal(t)}};var zr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):L.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,L.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return r.startDuration(t),r.addUnit(t,e),r.endDuration(t)}};var jr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return r.startFixedSizeBinary(t),r.addByteWidth(t,e),r.endFixedSizeBinary(t)}};var Wr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return r.startFixedSizeList(t),r.addListSize(t,e),r.endFixedSizeList(t)}};var $r=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Dt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,Dt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return r.startFloatingPoint(t),r.addPrecision(t,e),r.endFloatingPoint(t)}};var Gr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):jt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,jt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return r.startInterval(t),r.addUnit(t,e),r.endInterval(t)}};var _i=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return r.startLargeBinary(t),r.endLargeBinary(t)}};var bi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return r.startLargeUtf8(t),r.endLargeUtf8(t)}};var gi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return r.startList(t),r.endList(t)}};var Kr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return r.startMap(t),r.addKeysSorted(t,e),r.endMap(t)}};var wi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return r.startNull(t),r.endNull(t)}};var vi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return r.startStruct_(t),r.endStruct_(t)}};var ur=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):L.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,L.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return r.startTime(t),r.addUnit(t,e),r.addBitWidth(t,n),r.endTime(t)}};var dr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):L.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,L.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return r.startTimestamp(t),r.addUnit(t,e),r.addTimezone(t,n),r.endTimestamp(t)}};var Me=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):At.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,At.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return r.startUnion(t),r.addMode(t,e),r.addTypeIds(t,n),r.endUnion(t)}};var Si=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return r.startUtf8(t),r.endUtf8(t)}};var xt;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(xt||(xt={}));var Zt=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):xt.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new tr).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?(e||new r).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,16);return n?(e||new Wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,xt.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}};var ie=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Vr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Zt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,Vr.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,s){return r.startSchema(t),r.addEndianness(t,e),r.addFields(t,n),r.addCustomMetadata(t,i),r.addFeatures(t,s),r.endSchema(t)}};var ut;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(ut||(ut={}));var h;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(h||(h={}));var ge;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(ge||(ge={}));var La={};Pr(La,{clampRange:()=>Fi,createElementComparator:()=>Xr,wrapIndex:()=>an});var ya={};Pr(ya,{valueToString:()=>Re});function Re(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return"".concat(r);case"bigint":return"".concat(r);case"string":return'"'.concat(r,'"')}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?"[".concat([...r].map(t=>Re(t)),"]"):"[".concat(r,"]"):ArrayBuffer.isView(r)?"[".concat(r,"]"):JSON.stringify(r,(t,e)=>typeof e=="bigint"?"".concat(e):e)}var wa={};Pr(wa,{BN:()=>Bi,bigNumToBigInt:()=>Xc,bigNumToNumber:()=>ga,bigNumToString:()=>Mn,isArrowBigNumSymbol:()=>Jc});function ht(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError("".concat(r," is not safe to convert to a number."));return Number(r)}function _a(r,t){return ht(r/t)+ht(r%t)/ht(t)}var Jc=Symbol.for("isArrowBigNum");function Le(r,...t){return t.length===0?Object.setPrototypeOf(at(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}Le.prototype[Jc]=!0;Le.prototype.toJSON=function(){return'"'.concat(Mn(this),'"')};Le.prototype.valueOf=function(r){return ga(this,r)};Le.prototype.toString=function(){return Mn(this)};Le.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return ga(this);case"string":return Mn(this);case"default":return Xc(this)}return Mn(this)};function Un(...r){return Le.apply(this,r)}function On(...r){return Le.apply(this,r)}function Ii(...r){return Le.apply(this,r)}Object.setPrototypeOf(Un.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(On.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Ii.prototype,Object.create(Uint32Array.prototype));Object.assign(Un.prototype,Le.prototype,{constructor:Un,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(On.prototype,Le.prototype,{constructor:On,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Ii.prototype,Le.prototype,{constructor:Ii,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Jh=BigInt(4294967296)*BigInt(4294967296),Xh=Jh-BigInt(1);function ga(r,t){let{buffer:e,byteOffset:n,byteLength:i,signed:s}=r,o=new BigUint64Array(e,n,i/8),a=s&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),d=0;if(a){for(let p of o)c|=(p^Xh)*(BigInt(1)<<BigInt(64*d++));c*=BigInt(-1),c-=BigInt(1)}else for(let p of o)c|=p*(BigInt(1)<<BigInt(64*d++));if(typeof t=="number"){let p=BigInt(Math.pow(10,t)),S=c/p,A=c%p;return ht(S)+ht(A)/ht(p)}return ht(c)}function Mn(r){if(r.byteLength===8){let s=new r.BigIntArray(r.buffer,r.byteOffset,1);return"".concat(s[0])}if(!r.signed)return ba(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return ba(r);t=t.slice();let n=1;for(let s=0;s<t.length;s++){let o=t[s],a=~o+n;t[s]=a,n&=o===0?1:0}let i=ba(t);return"-".concat(i)}function Xc(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Mn(r)}function ba(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),s=-1,o=n.length-1;do{for(e[0]=n[s=0];s<o;)n[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[s];n[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t="".concat(e[0]).concat(t)}while(i[0]||i[1]||i[2]||i[3]);return t!=null?t:"0"}var Bi=class r{static new(t,e){switch(e){case!0:return new Un(t);case!1:return new On(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Un(t)}return t.byteLength===16?new Ii(t):new On(t)}static signed(t){return new Un(t)}static unsigned(t){return new On(t)}static decimal(t){return new Ii(t)}constructor(t,e){return r.new(t,e)}};var Zc,Qc,tl,el,rl,nl,il,sl,ol,al,cl,ll,ul,dl,fl,hl,pl,ml,yl,_l,bl,gl,M=class r{static isNull(t){return(t==null?void 0:t.typeId)===h.Null}static isInt(t){return(t==null?void 0:t.typeId)===h.Int}static isFloat(t){return(t==null?void 0:t.typeId)===h.Float}static isBinary(t){return(t==null?void 0:t.typeId)===h.Binary}static isLargeBinary(t){return(t==null?void 0:t.typeId)===h.LargeBinary}static isUtf8(t){return(t==null?void 0:t.typeId)===h.Utf8}static isLargeUtf8(t){return(t==null?void 0:t.typeId)===h.LargeUtf8}static isBool(t){return(t==null?void 0:t.typeId)===h.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===h.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===h.Date}static isTime(t){return(t==null?void 0:t.typeId)===h.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===h.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===h.Interval}static isDuration(t){return(t==null?void 0:t.typeId)===h.Duration}static isList(t){return(t==null?void 0:t.typeId)===h.List}static isStruct(t){return(t==null?void 0:t.typeId)===h.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===h.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===h.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===h.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===h.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===h.Dictionary}static isDenseUnion(t){return r.isUnion(t)&&t.mode===At.Dense}static isSparseUnion(t){return r.isUnion(t)&&t.mode===At.Sparse}constructor(t){this.typeId=t}};Zc=Symbol.toStringTag;M[Zc]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(M.prototype);var ee=class extends M{constructor(){super(h.Null)}toString(){return"Null"}};Qc=Symbol.toStringTag;ee[Qc]=(r=>r[Symbol.toStringTag]="Null")(ee.prototype);var $t=class extends M{constructor(t,e){super(h.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}toString(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}};tl=Symbol.toStringTag;$t[tl]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))($t.prototype);var Bs=class extends $t{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Ds=class extends $t{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},rr=class extends $t{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Fs=class extends $t{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},As=class extends $t{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},xs=class extends $t{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Ts=class extends $t{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Es=class extends $t{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Bs.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Ds.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(rr.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Fs.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(As.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(xs.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ts.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Es.prototype,"ArrayType",{value:BigUint64Array});var we=class extends M{constructor(t){super(h.Float),this.precision=t}get ArrayType(){switch(this.precision){case Dt.HALF:return Uint16Array;case Dt.SINGLE:return Float32Array;case Dt.DOUBLE:return Float64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}toString(){return"Float".concat(this.precision<<5||16)}};el=Symbol.toStringTag;we[el]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(we.prototype);var Us=class extends we{constructor(){super(Dt.HALF)}},Os=class extends we{constructor(){super(Dt.SINGLE)}},Ms=class extends we{constructor(){super(Dt.DOUBLE)}};Object.defineProperty(Us.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Os.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Ms.prototype,"ArrayType",{value:Float64Array});var fr=class extends M{constructor(){super(h.Binary)}toString(){return"Binary"}};rl=Symbol.toStringTag;fr[rl]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(fr.prototype);var hr=class extends M{constructor(){super(h.LargeBinary)}toString(){return"LargeBinary"}};nl=Symbol.toStringTag;hr[nl]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(hr.prototype);var pr=class extends M{constructor(){super(h.Utf8)}toString(){return"Utf8"}};il=Symbol.toStringTag;pr[il]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(pr.prototype);var mr=class extends M{constructor(){super(h.LargeUtf8)}toString(){return"LargeUtf8"}};sl=Symbol.toStringTag;mr[sl]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(mr.prototype);var yr=class extends M{constructor(){super(h.Bool)}toString(){return"Bool"}};ol=Symbol.toStringTag;yr[ol]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(yr.prototype);var _r=class extends M{constructor(t,e,n=128){super(h.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return"Decimal[".concat(this.precision,"e").concat(this.scale>0?"+":"").concat(this.scale,"]")}};al=Symbol.toStringTag;_r[al]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(_r.prototype);var br=class extends M{constructor(t){super(h.Date),this.unit=t}toString(){return"Date".concat((this.unit+1)*32,"<").concat(kt[this.unit],">")}get ArrayType(){return this.unit===kt.DAY?Int32Array:BigInt64Array}};cl=Symbol.toStringTag;br[cl]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(br.prototype);var gr=class extends M{constructor(t,e){super(h.Time),this.unit=t,this.bitWidth=e}toString(){return"Time".concat(this.bitWidth,"<").concat(L[this.unit],">")}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}};ll=Symbol.toStringTag;gr[ll]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(gr.prototype);var wr=class extends M{constructor(t,e){super(h.Timestamp),this.unit=t,this.timezone=e}toString(){return"Timestamp<".concat(L[this.unit]).concat(this.timezone?", ".concat(this.timezone):"",">")}};ul=Symbol.toStringTag;wr[ul]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(wr.prototype);var vr=class extends M{constructor(t){super(h.Interval),this.unit=t}toString(){return"Interval<".concat(jt[this.unit],">")}};dl=Symbol.toStringTag;vr[dl]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(vr.prototype);var Sr=class extends M{constructor(t){super(h.Duration),this.unit=t}toString(){return"Duration<".concat(L[this.unit],">")}};fl=Symbol.toStringTag;Sr[fl]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(Sr.prototype);var Ne=class extends M{constructor(t){super(h.List),this.children=[t]}toString(){return"List<".concat(this.valueType,">")}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};hl=Symbol.toStringTag;Ne[hl]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Ne.prototype);var Et=class extends M{constructor(t){super(h.Struct),this.children=t}toString(){return"Struct<{".concat(this.children.map(t=>"".concat(t.name,":").concat(t.type)).join(", "),"}>")}};pl=Symbol.toStringTag;Et[pl]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(Et.prototype);var ke=class extends M{constructor(t,e,n){super(h.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return"".concat(this[Symbol.toStringTag],"<").concat(this.children.map(t=>"".concat(t.type)).join(" | "),">")}};ml=Symbol.toStringTag;ke[ml]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(ke.prototype);var Ir=class extends M{constructor(t){super(h.FixedSizeBinary),this.byteWidth=t}toString(){return"FixedSizeBinary[".concat(this.byteWidth,"]")}};yl=Symbol.toStringTag;Ir[yl]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Ir.prototype);var Ce=class extends M{constructor(t,e){super(h.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}};_l=Symbol.toStringTag;Ce[_l]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Ce.prototype);var Pe=class extends M{constructor(t,e=!1){var n,i,s;if(super(h.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t==null?void 0:t.type)===null||n===void 0)&&n.children)){let o=(i=t==null?void 0:t.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");let a=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return"Map<{".concat(this.children[0].type.children.map(t=>"".concat(t.name,":").concat(t.type)).join(", "),"}>")}};bl=Symbol.toStringTag;Pe[bl]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Pe.prototype);var Zh=(r=>()=>++r)(-1),pe=class extends M{constructor(t,e,n,i){super(h.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?Zh():ht(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return"Dictionary<".concat(this.indices,", ").concat(this.dictionary,">")}};gl=Symbol.toStringTag;pe[gl]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(pe.prototype);function me(r){let t=r;switch(r.typeId){case h.Decimal:return r.bitWidth/32;case h.Interval:return 1+t.unit;case h.FixedSizeList:return t.listSize;case h.FixedSizeBinary:return t.byteWidth;default:return 1}}var z=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return Qh(this,t,e)}getVisitFnByTypeId(t,e=!0){return Rn(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function Qh(r,t,e=!0){return typeof t=="number"?Rn(r,t,e):typeof t=="string"&&t in h?Rn(r,h[t],e):t&&t instanceof M?Rn(r,wl(t),e):t!=null&&t.type&&t.type instanceof M?Rn(r,wl(t.type),e):Rn(r,h.NONE,e)}function Rn(r,t,e=!0){let n=null;switch(t){case h.Null:n=r.visitNull;break;case h.Bool:n=r.visitBool;break;case h.Int:n=r.visitInt;break;case h.Int8:n=r.visitInt8||r.visitInt;break;case h.Int16:n=r.visitInt16||r.visitInt;break;case h.Int32:n=r.visitInt32||r.visitInt;break;case h.Int64:n=r.visitInt64||r.visitInt;break;case h.Uint8:n=r.visitUint8||r.visitInt;break;case h.Uint16:n=r.visitUint16||r.visitInt;break;case h.Uint32:n=r.visitUint32||r.visitInt;break;case h.Uint64:n=r.visitUint64||r.visitInt;break;case h.Float:n=r.visitFloat;break;case h.Float16:n=r.visitFloat16||r.visitFloat;break;case h.Float32:n=r.visitFloat32||r.visitFloat;break;case h.Float64:n=r.visitFloat64||r.visitFloat;break;case h.Utf8:n=r.visitUtf8;break;case h.LargeUtf8:n=r.visitLargeUtf8;break;case h.Binary:n=r.visitBinary;break;case h.LargeBinary:n=r.visitLargeBinary;break;case h.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case h.Date:n=r.visitDate;break;case h.DateDay:n=r.visitDateDay||r.visitDate;break;case h.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case h.Timestamp:n=r.visitTimestamp;break;case h.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case h.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case h.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case h.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case h.Time:n=r.visitTime;break;case h.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case h.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case h.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case h.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case h.Decimal:n=r.visitDecimal;break;case h.List:n=r.visitList;break;case h.Struct:n=r.visitStruct;break;case h.Union:n=r.visitUnion;break;case h.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case h.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case h.Dictionary:n=r.visitDictionary;break;case h.Interval:n=r.visitInterval;break;case h.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case h.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case h.Duration:n=r.visitDuration;break;case h.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case h.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case h.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case h.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case h.FixedSizeList:n=r.visitFixedSizeList;break;case h.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error("Unrecognized type '".concat(h[t],"'"))}function wl(r){switch(r.typeId){case h.Null:return h.Null;case h.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?h.Int8:h.Uint8;case 16:return e?h.Int16:h.Uint16;case 32:return e?h.Int32:h.Uint32;case 64:return e?h.Int64:h.Uint64}return h.Int}case h.Float:switch(r.precision){case Dt.HALF:return h.Float16;case Dt.SINGLE:return h.Float32;case Dt.DOUBLE:return h.Float64}return h.Float;case h.Binary:return h.Binary;case h.LargeBinary:return h.LargeBinary;case h.Utf8:return h.Utf8;case h.LargeUtf8:return h.LargeUtf8;case h.Bool:return h.Bool;case h.Decimal:return h.Decimal;case h.Time:switch(r.unit){case L.SECOND:return h.TimeSecond;case L.MILLISECOND:return h.TimeMillisecond;case L.MICROSECOND:return h.TimeMicrosecond;case L.NANOSECOND:return h.TimeNanosecond}return h.Time;case h.Timestamp:switch(r.unit){case L.SECOND:return h.TimestampSecond;case L.MILLISECOND:return h.TimestampMillisecond;case L.MICROSECOND:return h.TimestampMicrosecond;case L.NANOSECOND:return h.TimestampNanosecond}return h.Timestamp;case h.Date:switch(r.unit){case kt.DAY:return h.DateDay;case kt.MILLISECOND:return h.DateMillisecond}return h.Date;case h.Interval:switch(r.unit){case jt.DAY_TIME:return h.IntervalDayTime;case jt.YEAR_MONTH:return h.IntervalYearMonth}return h.Interval;case h.Duration:switch(r.unit){case L.SECOND:return h.DurationSecond;case L.MILLISECOND:return h.DurationMillisecond;case L.MICROSECOND:return h.DurationMicrosecond;case L.NANOSECOND:return h.DurationNanosecond}return h.Duration;case h.Map:return h.Map;case h.List:return h.List;case h.Struct:return h.Struct;case h.Union:switch(r.mode){case At.Dense:return h.DenseUnion;case At.Sparse:return h.SparseUnion}return h.Union;case h.FixedSizeBinary:return h.FixedSizeBinary;case h.FixedSizeList:return h.FixedSizeList;case h.Dictionary:return h.Dictionary}throw new Error("Unrecognized type '".concat(h[r.typeId],"'"))}z.prototype.visitInt8=null;z.prototype.visitInt16=null;z.prototype.visitInt32=null;z.prototype.visitInt64=null;z.prototype.visitUint8=null;z.prototype.visitUint16=null;z.prototype.visitUint32=null;z.prototype.visitUint64=null;z.prototype.visitFloat16=null;z.prototype.visitFloat32=null;z.prototype.visitFloat64=null;z.prototype.visitDateDay=null;z.prototype.visitDateMillisecond=null;z.prototype.visitTimestampSecond=null;z.prototype.visitTimestampMillisecond=null;z.prototype.visitTimestampMicrosecond=null;z.prototype.visitTimestampNanosecond=null;z.prototype.visitTimeSecond=null;z.prototype.visitTimeMillisecond=null;z.prototype.visitTimeMicrosecond=null;z.prototype.visitTimeNanosecond=null;z.prototype.visitDenseUnion=null;z.prototype.visitSparseUnion=null;z.prototype.visitIntervalDayTime=null;z.prototype.visitIntervalYearMonth=null;z.prototype.visitDuration=null;z.prototype.visitDurationSecond=null;z.prototype.visitDurationMillisecond=null;z.prototype.visitDurationMicrosecond=null;z.prototype.visitDurationNanosecond=null;var va={};Pr(va,{float64ToUint16:()=>Di,uint16ToFloat64:()=>Rs});var vl=new Float64Array(1),Ln=new Uint32Array(vl.buffer);function Rs(r){let t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function Di(r){if(r!==r)return 32256;vl[0]=r;let t=(Ln[1]&2147483648)>>16&65535,e=Ln[1]&2146435072,n=0;return e>=1089470464?Ln[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Ln[1]&1048575)>>10):e<=1056964608?(n=1048576+(Ln[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Ln[1]&1048575)+512>>10),t|e|n&65535}var K=class extends z{};function Q(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var tp=(r,t,e)=>{r[t]=Math.floor(e/864e5)},Sl=(r,t,e,n)=>{if(e+1<t.length){let i=ht(t[e]),s=ht(t[e+1]);r.set(n.subarray(0,s-i),i)}},ep=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Br=({values:r},t,e)=>{r[t]=e},Sa=({values:r},t,e)=>{r[t]=e},Il=({values:r},t,e)=>{r[t]=Di(e)},rp=(r,t,e)=>{switch(r.type.precision){case Dt.HALF:return Il(r,t,e);case Dt.SINGLE:case Dt.DOUBLE:return Sa(r,t,e)}},Ls=({values:r},t,e)=>{tp(r,t,e.valueOf())},Ns=({values:r},t,e)=>{r[t]=BigInt(e)},Ia=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},Bl=({values:r,valueOffsets:t},e,n)=>Sl(r,t,e,n),Dl=({values:r,valueOffsets:t},e,n)=>Sl(r,t,e,Xe(n)),Ba=(r,t,e)=>{r.type.unit===kt.DAY?Ls(r,t,e):Ns(r,t,e)},ks=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},Cs=({values:r},t,e)=>{r[t]=BigInt(e)},Ps=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},Vs=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},Da=(r,t,e)=>{switch(r.type.unit){case L.SECOND:return ks(r,t,e);case L.MILLISECOND:return Cs(r,t,e);case L.MICROSECOND:return Ps(r,t,e);case L.NANOSECOND:return Vs(r,t,e)}},Hs=({values:r},t,e)=>{r[t]=e},zs=({values:r},t,e)=>{r[t]=e},js=({values:r},t,e)=>{r[t]=e},Ws=({values:r},t,e)=>{r[t]=e},Fa=(r,t,e)=>{switch(r.type.unit){case L.SECOND:return Hs(r,t,e);case L.MILLISECOND:return zs(r,t,e);case L.MICROSECOND:return js(r,t,e);case L.NANOSECOND:return Ws(r,t,e)}},Aa=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},np=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=Yt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],c=i[t+1];a<c;)s(n,a++,e[++o]);else for(let o=-1,a=i[t],c=i[t+1];a<c;)s(n,a++,e.get(++o))},ip=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=Yt.getVisitFn(n),{[t]:o,[t+1]:a}=i,c=e instanceof Map?e.entries():Object.entries(e);for(let d of c)if(s(n,o,d),++o>=a)break},sp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),op=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),ap=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),cp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),lp=(r,t,e)=>{let n=r.type.children.map(s=>Yt.getVisitFn(s.type)),i=e instanceof Map?ap(t,e):e instanceof dt?op(t,e):Array.isArray(e)?sp(t,e):cp(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},up=(r,t,e)=>{r.type.mode===At.Dense?Fl(r,t,e):Al(r,t,e)},Fl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Yt.visit(i,r.valueOffsets[t],e)},Al=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Yt.visit(i,t,e)},dp=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},xa=(r,t,e)=>{r.type.unit===jt.DAY_TIME?$s(r,t,e):Gs(r,t,e)},$s=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Gs=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Ks=({values:r},t,e)=>{r[t]=e},qs=({values:r},t,e)=>{r[t]=e},Ys=({values:r},t,e)=>{r[t]=e},Js=({values:r},t,e)=>{r[t]=e},Ta=(r,t,e)=>{switch(r.type.unit){case L.SECOND:return Ks(r,t,e);case L.MILLISECOND:return qs(r,t,e);case L.MICROSECOND:return Ys(r,t,e);case L.NANOSECOND:return Js(r,t,e)}},fp=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=Yt.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=t*n;++o<n;)s(i,a+o,e[o]);else for(let o=-1,a=t*n;++o<n;)s(i,a+o,e.get(o))};K.prototype.visitBool=Q(ep);K.prototype.visitInt=Q(Br);K.prototype.visitInt8=Q(Br);K.prototype.visitInt16=Q(Br);K.prototype.visitInt32=Q(Br);K.prototype.visitInt64=Q(Br);K.prototype.visitUint8=Q(Br);K.prototype.visitUint16=Q(Br);K.prototype.visitUint32=Q(Br);K.prototype.visitUint64=Q(Br);K.prototype.visitFloat=Q(rp);K.prototype.visitFloat16=Q(Il);K.prototype.visitFloat32=Q(Sa);K.prototype.visitFloat64=Q(Sa);K.prototype.visitUtf8=Q(Dl);K.prototype.visitLargeUtf8=Q(Dl);K.prototype.visitBinary=Q(Bl);K.prototype.visitLargeBinary=Q(Bl);K.prototype.visitFixedSizeBinary=Q(Ia);K.prototype.visitDate=Q(Ba);K.prototype.visitDateDay=Q(Ls);K.prototype.visitDateMillisecond=Q(Ns);K.prototype.visitTimestamp=Q(Da);K.prototype.visitTimestampSecond=Q(ks);K.prototype.visitTimestampMillisecond=Q(Cs);K.prototype.visitTimestampMicrosecond=Q(Ps);K.prototype.visitTimestampNanosecond=Q(Vs);K.prototype.visitTime=Q(Fa);K.prototype.visitTimeSecond=Q(Hs);K.prototype.visitTimeMillisecond=Q(zs);K.prototype.visitTimeMicrosecond=Q(js);K.prototype.visitTimeNanosecond=Q(Ws);K.prototype.visitDecimal=Q(Aa);K.prototype.visitList=Q(np);K.prototype.visitStruct=Q(lp);K.prototype.visitUnion=Q(up);K.prototype.visitDenseUnion=Q(Fl);K.prototype.visitSparseUnion=Q(Al);K.prototype.visitDictionary=Q(dp);K.prototype.visitInterval=Q(xa);K.prototype.visitIntervalDayTime=Q($s);K.prototype.visitIntervalYearMonth=Q(Gs);K.prototype.visitDuration=Q(Ta);K.prototype.visitDurationSecond=Q(Ks);K.prototype.visitDurationMillisecond=Q(qs);K.prototype.visitDurationMicrosecond=Q(Ys);K.prototype.visitDurationNanosecond=Q(Js);K.prototype.visitFixedSizeList=Q(fp);K.prototype.visitMap=Q(ip);var Yt=new K;var Ve=Symbol.for("parent"),Nn=Symbol.for("rowIndex"),qr=class{constructor(t,e){return this[Ve]=t,this[Nn]=e,new Proxy(this,new Ua)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Nn],e=this[Ve],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=Vt.visit(e.children[s],t);return i}toString(){return"{".concat([...this].map(([t,e])=>"".concat(Re(t),": ").concat(Re(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Ea(this[Ve],this[Nn])}},Ea=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Vt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(qr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ve]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Nn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Ua=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ve].type.children.map(e=>e.name)}has(t,e){return t[Ve].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Ve].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Ve].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=Vt.visit(t[Ve].children[n],t[Nn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ve].type.children.findIndex(s=>s.name===e);return i!==-1?(Yt.visit(t[Ve].children[i],t[Nn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var j=class extends z{};function J(r){return(t,e)=>t.getValid(e)?r(t,e):null}var hp=(r,t)=>864e5*r[t],pp=(r,t)=>null,xl=(r,t,e)=>{if(e+1>=t.length)return null;let n=ht(t[e]),i=ht(t[e+1]);return r.subarray(n,i)},mp=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},Tl=({values:r},t)=>hp(r,t),El=({values:r},t)=>ht(r[t]),Yr=({stride:r,values:t},e)=>t[r*e],yp=({stride:r,values:t},e)=>Rs(t[r*e]),Ul=({values:r},t)=>r[t],_p=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Ol=({values:r,valueOffsets:t},e)=>xl(r,t,e),Ml=({values:r,valueOffsets:t},e)=>{let n=xl(r,t,e);return n!==null?ci(n):null},bp=({values:r},t)=>r[t],gp=({type:r,values:t},e)=>r.precision!==Dt.HALF?t[e]:Rs(t[e]),wp=(r,t)=>r.type.unit===kt.DAY?Tl(r,t):El(r,t),Rl=({values:r},t)=>1e3*ht(r[t]),Ll=({values:r},t)=>ht(r[t]),Nl=({values:r},t)=>_a(r[t],BigInt(1e3)),kl=({values:r},t)=>_a(r[t],BigInt(1e6)),vp=(r,t)=>{switch(r.type.unit){case L.SECOND:return Rl(r,t);case L.MILLISECOND:return Ll(r,t);case L.MICROSECOND:return Nl(r,t);case L.NANOSECOND:return kl(r,t)}},Cl=({values:r},t)=>r[t],Pl=({values:r},t)=>r[t],Vl=({values:r},t)=>r[t],Hl=({values:r},t)=>r[t],Sp=(r,t)=>{switch(r.type.unit){case L.SECOND:return Cl(r,t);case L.MILLISECOND:return Pl(r,t);case L.MICROSECOND:return Vl(r,t);case L.NANOSECOND:return Hl(r,t)}},Ip=({values:r,stride:t},e)=>Bi.decimal(r.subarray(t*e,t*(e+1))),Bp=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,c=i[0].slice(s,o-s);return new dt([c])},Dp=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new nr(o.slice(i,s-i))},Fp=(r,t)=>new qr(r,t),Ap=(r,t)=>r.type.mode===At.Dense?zl(r,t):jl(r,t),zl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Vt.visit(n,r.valueOffsets[t])},jl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Vt.visit(n,t)},xp=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},Tp=(r,t)=>r.type.unit===jt.DAY_TIME?Wl(r,t):$l(r,t),Wl=({values:r},t)=>r.subarray(2*t,2*(t+1)),$l=({values:r},t)=>{let e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},Gl=({values:r},t)=>r[t],Kl=({values:r},t)=>r[t],ql=({values:r},t)=>r[t],Yl=({values:r},t)=>r[t],Ep=(r,t)=>{switch(r.type.unit){case L.SECOND:return Gl(r,t);case L.MILLISECOND:return Kl(r,t);case L.MICROSECOND:return ql(r,t);case L.NANOSECOND:return Yl(r,t)}},Up=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new dt([s])};j.prototype.visitNull=J(pp);j.prototype.visitBool=J(mp);j.prototype.visitInt=J(bp);j.prototype.visitInt8=J(Yr);j.prototype.visitInt16=J(Yr);j.prototype.visitInt32=J(Yr);j.prototype.visitInt64=J(Ul);j.prototype.visitUint8=J(Yr);j.prototype.visitUint16=J(Yr);j.prototype.visitUint32=J(Yr);j.prototype.visitUint64=J(Ul);j.prototype.visitFloat=J(gp);j.prototype.visitFloat16=J(yp);j.prototype.visitFloat32=J(Yr);j.prototype.visitFloat64=J(Yr);j.prototype.visitUtf8=J(Ml);j.prototype.visitLargeUtf8=J(Ml);j.prototype.visitBinary=J(Ol);j.prototype.visitLargeBinary=J(Ol);j.prototype.visitFixedSizeBinary=J(_p);j.prototype.visitDate=J(wp);j.prototype.visitDateDay=J(Tl);j.prototype.visitDateMillisecond=J(El);j.prototype.visitTimestamp=J(vp);j.prototype.visitTimestampSecond=J(Rl);j.prototype.visitTimestampMillisecond=J(Ll);j.prototype.visitTimestampMicrosecond=J(Nl);j.prototype.visitTimestampNanosecond=J(kl);j.prototype.visitTime=J(Sp);j.prototype.visitTimeSecond=J(Cl);j.prototype.visitTimeMillisecond=J(Pl);j.prototype.visitTimeMicrosecond=J(Vl);j.prototype.visitTimeNanosecond=J(Hl);j.prototype.visitDecimal=J(Ip);j.prototype.visitList=J(Bp);j.prototype.visitStruct=J(Fp);j.prototype.visitUnion=J(Ap);j.prototype.visitDenseUnion=J(zl);j.prototype.visitSparseUnion=J(jl);j.prototype.visitDictionary=J(xp);j.prototype.visitInterval=J(Tp);j.prototype.visitIntervalDayTime=J(Wl);j.prototype.visitIntervalYearMonth=J($l);j.prototype.visitDuration=J(Ep);j.prototype.visitDurationSecond=J(Gl);j.prototype.visitDurationMillisecond=J(Kl);j.prototype.visitDurationMicrosecond=J(ql);j.prototype.visitDurationNanosecond=J(Yl);j.prototype.visitFixedSizeList=J(Up);j.prototype.visitMap=J(Dp);var Vt=new j;var Jr=Symbol.for("keys"),Cn=Symbol.for("vals"),kn=Symbol.for("kKeysAsStrings"),Oa=Symbol.for("_kKeysAsStrings"),nr=class{constructor(t){return this[Jr]=new dt([t.children[0]]).memoize(),this[Cn]=t.children[1],new Proxy(this,new Ra)}get[kn](){return this[Oa]||(this[Oa]=Array.from(this[Jr].toArray(),String))}[Symbol.iterator](){return new Ma(this[Jr],this[Cn])}get size(){return this[Jr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Jr],e=this[Cn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=Vt.visit(e,i);return n}toString(){return"{".concat([...this].map(([t,e])=>"".concat(Re(t),": ").concat(Re(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Ma=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Vt.visit(this.vals,t)]})}},Ra=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[kn]}has(t,e){return t[kn].includes(e)}getOwnPropertyDescriptor(t,e){if(t[kn].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[kn].indexOf(e);if(n!==-1){let i=Vt.visit(Reflect.get(t,Cn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[kn].indexOf(e);return i!==-1?(Yt.visit(Reflect.get(t,Cn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(nr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Jr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Cn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Oa]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var Jl;function Fi(r,t,e,n){let{length:i=0}=r,s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),o<s&&(Jl=s,s=o,o=Jl),o>i&&(o=i),n?n(r,s,o):[s,o]}var an=(r,t)=>r<0?t+r:r,Xl=r=>r!==r;function Xr(r){if(typeof r!=="object"||r===null)return Xl(r)?Xl:e=>e===r;if(r instanceof Date){let e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?fa(r,e):!1:r instanceof Map?Mp(r):Array.isArray(r)?Op(r):r instanceof dt?Rp(r):Lp(r,!0)}function Op(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Xr(r[e]);return Xs(t)}function Mp(r){let t=-1,e=[];for(let n of r.values())e[++t]=Xr(n);return Xs(e)}function Rp(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Xr(r.get(e));return Xs(t)}function Lp(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let i=-1,s=e.length;++i<s;)n[i]=Xr(r[e[i]]);return Xs(n,e)}function Xs(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Np(r,e);case Map:return Zl(r,e,e.keys());case nr:case qr:case Object:case void 0:return Zl(r,e,t||Object.keys(e))}return e instanceof dt?kp(r,e):!1}}function Np(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t[n]))return!1;return!0}function kp(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t.get(n)))return!1;return!0}function Zl(r,t,e){let n=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=r.length,c=s.next(),d=n.next(),p=i.next();for(;o<a&&!d.done&&!p.done&&!c.done&&!(d.value!==p.value||!r[o](c.value));++o,d=n.next(),p=i.next(),c=s.next());return o===a&&d.done&&p.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var Na={};Pr(Na,{BitIterator:()=>cn,getBit:()=>Ql,getBool:()=>Qs,packBools:()=>un,popcnt_array:()=>tu,popcnt_bit_range:()=>Ai,popcnt_uint32:()=>Zs,setBool:()=>Cp,truncateBitmap:()=>ln});function Qs(r,t,e,n){return(e&1<<n)!==0}function Ql(r,t,e,n){return(e&1<<n)>>n}function Cp(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function ln(r,t,e){let n=e.byteLength+7&-8;if(r>0||e.byteLength<n){let i=new Uint8Array(n);return i.set(r%8===0?e.subarray(r>>3):un(new cn(e,r,t,null,Qs)).subarray(0,n)),i}return e}function un(r){let t=[],e=0,n=0,i=0;for(let o of r)o&&(i|=1<<n),++n===8&&(t[e++]=i,i=n=0);(e===0||n>0)&&(t[e++]=i);let s=new Uint8Array(t.length+7&-8);return s.set(t),s}var cn=class{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function Ai(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new cn(r,t,e-t,r,Ql))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return Ai(r,t,i)+Ai(r,n,e)+tu(r,i>>3,n-i>>3)}function tu(r,t,e){let n=0,i=Math.trunc(t),s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:i+e;for(;o-i>=4;)n+=Zs(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=Zs(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=Zs(s.getUint8(i)),i+=1;return n}function Zs(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var Pp=-1,_t=class r{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return M.isSparseUnion(t)?this.children.some(e=>e.nullable):M.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:e,values:n,nullBitmap:i,typeIds:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(M.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=Pp&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-Ai(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;s instanceof r?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=me(t),s&&((c=s[0])&&(this.valueOffsets=c),(c=s[1])&&(this.values=c),(c=s[2])&&(this.nullBitmap=c),(c=s[3])&&(this.typeIds=c)))}getValid(t){let{type:e}=this;if(M.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===At.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n,{type:i}=this;if(M.isUnion(i)){let s=i,o=this.children[s.typeIdToChildIndex[this.typeIds[t]]],a=s.mode===At.Dense?this.valueOffsets[t]:t;n=o.getValid(a),o.setValid(a,e)}else{let{nullBitmap:s}=this,{offset:o,length:a}=this,c=o+t,d=1<<c%8,p=c>>3;(!s||s.byteLength<=p)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(ln(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));let S=s[p];n=(S&d)!==0,s[p]=e?S|d:S&~d}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,s=this,o=this.children){return new r(t,e,n,i,s,o,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,c,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===h.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(e&-8))-1,n>0&&i.set(ln(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[ge.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s,{buffers:o}=this;return(s=o[ge.TYPE])&&(o[ge.TYPE]=s.subarray(t,t+e)),(s=o[ge.OFFSET])&&(o[ge.OFFSET]=s.subarray(t,t+e+1))||(s=o[ge.DATA])&&(o[ge.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};_t.prototype.children=Object.freeze([]);var ka=class r extends z{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new _t(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.nullBitmap),s=at(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _t(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.nullBitmap),s=at(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _t(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.nullBitmap),s=at(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _t(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.data),s=Y(t.nullBitmap),o=sn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _t(e,n,a,c,[o,i,s])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.data),s=Y(t.nullBitmap),o=_s(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _t(e,n,a,c,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.data),s=Y(t.nullBitmap),o=sn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _t(e,n,a,c,[o,i,s])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.data),s=Y(t.nullBitmap),o=_s(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _t(e,n,a,c,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.nullBitmap),s=at(e.ArrayType,t.data),{["length"]:o=s.length/me(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _t(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.nullBitmap),s=at(e.ArrayType,t.data),{["length"]:o=s.length/me(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _t(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.nullBitmap),s=at(e.ArrayType,t.data),{["length"]:o=s.length/me(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _t(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.nullBitmap),s=at(e.ArrayType,t.data),{["length"]:o=s.length/me(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _t(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.nullBitmap),s=at(e.ArrayType,t.data),{["length"]:o=s.length/me(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _t(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=Y(t.nullBitmap),o=sn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _t(e,n,a,c,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=Y(t.nullBitmap),{length:o=i.reduce((c,{length:d})=>Math.max(c,d),0),nullCount:a=t.nullBitmap?-1:0}=t;return new _t(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=at(e.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(M.isSparseUnion(e))return new _t(e,n,o,a,[void 0,void 0,void 0,s],i);let c=sn(t.valueOffsets);return new _t(e,n,o,a,[c,void 0,void 0,s],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.nullBitmap),s=at(e.indices.ArrayType,t.data),{["dictionary"]:o=new dt([new r().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _t(e,n,a,c,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.nullBitmap),s=at(e.ArrayType,t.data),{["length"]:o=s.length/me(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _t(e,n,o,a,[void 0,s,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=Y(t.nullBitmap),s=at(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _t(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.valueType})}=t,s=Y(t.nullBitmap),{["length"]:o=i.length/me(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _t(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.childType})}=t,s=Y(t.nullBitmap),o=sn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _t(e,n,a,c,[o,void 0,s],[i])}},Vp=new ka;function tt(r){return Vp.visit(r)}var xi=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function eu(r){return r.some(t=>t.nullable)}function to(r){return r.reduce((t,e)=>t+e.nullCount,0)}function eo(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function ro(r,t,e,n){let i=[];for(let s=-1,o=r.length;++s<o;){let a=r[s],c=t[s],{length:d}=a;if(c>=n)break;if(e>=c+d)continue;if(c>=e&&c+d<=n){i.push(a);continue}let p=Math.max(0,e-c),S=Math.min(n-c,d);i.push(a.slice(p,S-p))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Ca(r,t,e,n){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e<t[o]?n(r,i,e-t[i]):null;s=i+Math.trunc((o-i)*.5),e<t[s]?o=s:i=s}while(i<o)}function Ti(r,t){return r.getValid(t)}function Pn(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Ca(n,this._offsets,e,t)}}function no(r){let t;function e(n,i,s){return r(n[i],s,t)}return function(n,i){let s=this.data;t=i;let o=Ca(s,this._offsets,n,e);return t=void 0,o}}function io(r){let t;function e(n,i,s){let o=s,a=0,c=0;for(let d=i-1,p=n.length;++d<p;){let S=n[d];if(~(a=r(S,t,o)))return c+a;o=0,c+=S.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):Ca(s,this._offsets,i,e);return t=void 0,o}}var W=class extends z{};function Hp(r,t){return t===null&&r.length>0?0:-1}function zp(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new cn(e,r.offset+(t||0),r.length,e,Qs)){if(!i)return n;++n}return-1}function et(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case h.Union:break;case h.Dictionary:break;default:return zp(r,e)}let n=Vt.getVisitFn(r),i=Xr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function ru(r,t,e){let n=Vt.getVisitFn(r),i=Xr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}W.prototype.visitNull=Hp;W.prototype.visitBool=et;W.prototype.visitInt=et;W.prototype.visitInt8=et;W.prototype.visitInt16=et;W.prototype.visitInt32=et;W.prototype.visitInt64=et;W.prototype.visitUint8=et;W.prototype.visitUint16=et;W.prototype.visitUint32=et;W.prototype.visitUint64=et;W.prototype.visitFloat=et;W.prototype.visitFloat16=et;W.prototype.visitFloat32=et;W.prototype.visitFloat64=et;W.prototype.visitUtf8=et;W.prototype.visitLargeUtf8=et;W.prototype.visitBinary=et;W.prototype.visitLargeBinary=et;W.prototype.visitFixedSizeBinary=et;W.prototype.visitDate=et;W.prototype.visitDateDay=et;W.prototype.visitDateMillisecond=et;W.prototype.visitTimestamp=et;W.prototype.visitTimestampSecond=et;W.prototype.visitTimestampMillisecond=et;W.prototype.visitTimestampMicrosecond=et;W.prototype.visitTimestampNanosecond=et;W.prototype.visitTime=et;W.prototype.visitTimeSecond=et;W.prototype.visitTimeMillisecond=et;W.prototype.visitTimeMicrosecond=et;W.prototype.visitTimeNanosecond=et;W.prototype.visitDecimal=et;W.prototype.visitList=et;W.prototype.visitStruct=et;W.prototype.visitUnion=et;W.prototype.visitDenseUnion=ru;W.prototype.visitSparseUnion=ru;W.prototype.visitDictionary=et;W.prototype.visitInterval=et;W.prototype.visitIntervalDayTime=et;W.prototype.visitIntervalYearMonth=et;W.prototype.visitDuration=et;W.prototype.visitDurationSecond=et;W.prototype.visitDurationMillisecond=et;W.prototype.visitDurationMicrosecond=et;W.prototype.visitDurationNanosecond=et;W.prototype.visitFixedSizeList=et;W.prototype.visitMap=et;var dn=new W;var $=class extends z{};function X(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(M.isInt(t)&&t.bitWidth!==64||M.isTime(t)&&t.bitWidth!==64||M.isFloat(t)&&t.precision!==Dt.HALF))return new xi(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new xi(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Pa(o)})}var Pa=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};$.prototype.visitNull=X;$.prototype.visitBool=X;$.prototype.visitInt=X;$.prototype.visitInt8=X;$.prototype.visitInt16=X;$.prototype.visitInt32=X;$.prototype.visitInt64=X;$.prototype.visitUint8=X;$.prototype.visitUint16=X;$.prototype.visitUint32=X;$.prototype.visitUint64=X;$.prototype.visitFloat=X;$.prototype.visitFloat16=X;$.prototype.visitFloat32=X;$.prototype.visitFloat64=X;$.prototype.visitUtf8=X;$.prototype.visitLargeUtf8=X;$.prototype.visitBinary=X;$.prototype.visitLargeBinary=X;$.prototype.visitFixedSizeBinary=X;$.prototype.visitDate=X;$.prototype.visitDateDay=X;$.prototype.visitDateMillisecond=X;$.prototype.visitTimestamp=X;$.prototype.visitTimestampSecond=X;$.prototype.visitTimestampMillisecond=X;$.prototype.visitTimestampMicrosecond=X;$.prototype.visitTimestampNanosecond=X;$.prototype.visitTime=X;$.prototype.visitTimeSecond=X;$.prototype.visitTimeMillisecond=X;$.prototype.visitTimeMicrosecond=X;$.prototype.visitTimeNanosecond=X;$.prototype.visitDecimal=X;$.prototype.visitList=X;$.prototype.visitStruct=X;$.prototype.visitUnion=X;$.prototype.visitDenseUnion=X;$.prototype.visitSparseUnion=X;$.prototype.visitDictionary=X;$.prototype.visitInterval=X;$.prototype.visitIntervalDayTime=X;$.prototype.visitIntervalYearMonth=X;$.prototype.visitDuration=X;$.prototype.visitDurationSecond=X;$.prototype.visitDurationMillisecond=X;$.prototype.visitDurationMicrosecond=X;$.prototype.visitDurationNanosecond=X;$.prototype.visitFixedSizeList=X;$.prototype.visitMap=X;var Vn=new $;var nu,iu={},su={},dt=class r{constructor(t){var e,n,i;let s=t[0]instanceof r?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof _t)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:d}=iu[o.typeId],p=s[0];this.isValid=S=>Ti(p,S),this.get=S=>a(p,S),this.set=(S,A)=>c(p,S,A),this.indexOf=S=>d(p,S),this._offsets=[0,p.length];break}default:Object.setPrototypeOf(this,su[o.typeId]),this._offsets=eo(s);break}this.data=s,this.type=o,this.stride=me(o),this.numChildren=(i=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return eu(this.data)}get nullCount(){return to(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return"".concat(this.VectorName,"<").concat(this.type[Symbol.toStringTag],">")}get VectorName(){return"".concat(h[this.type.typeId],"Vector")}isValid(t){return!1}get(t){return null}at(t){return this.get(an(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Vn.visit(this)}concat(...t){return new r(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new r(Fi(this,t,e,({data:n,_offsets:i},s,o)=>ro(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case h.Int:case h.Float:case h.Decimal:case h.Time:case h.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*i),o.offset),o.offset+=c*i,o),{array:new s(n*i),offset:0}).array}}return[...this]}toString(){return"[".concat([...this].join(","),"]")}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new r(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return M.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(M.isDictionary(this.type)){let t=new so(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new r(e)}return new so(this)}unmemoize(){if(M.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new r(e)}return this}};nu=Symbol.toStringTag;dt[nu]=(r=>{r.type=M.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(h).map(e=>h[e]).filter(e=>typeof e=="number"&&e!==h.NONE);for(let e of t){let n=Vt.getVisitFnByTypeId(e),i=Yt.getVisitFnByTypeId(e),s=dn.getVisitFnByTypeId(e);iu[e]={get:n,set:i,indexOf:s},su[e]=Object.create(r,{isValid:{value:Pn(Ti)},get:{value:Pn(Vt.getVisitFnByTypeId(e))},set:{value:no(Yt.getVisitFnByTypeId(e))},indexOf:{value:io(dn.getVisitFnByTypeId(e))}})}return"Vector"})(dt.prototype);var so=class r extends dt{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=s[o];if(a!==void 0)return a;let c=e.call(this,o);return s[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new r(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new dt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function ou(r){if(!r||r.length<=0)return function(i){return!0};let t="",e=r.filter(n=>n===n);return e.length>0&&(t="\n switch (x) {".concat(e.map(n=>"\n case ".concat(jp(n),":")).join(""),"\n return false;\n }")),r.length!==e.length&&(t="if (x !== x) return false;\n".concat(t)),new Function("x","".concat(t,"\nreturn true;"))}function jp(r){return typeof r!="bigint"?Re(r):"".concat(Re(r),"n")}function Va(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function au(r,t=0){return r.length>=t?r.subarray(0,t):ui(new r.constructor(t),r,0)}var He=class{constructor(t,e=0,n=1){this.length=Math.ceil(e/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let e=this.stride,n=this.length*e,i=this.buffer.length;n>=i&&this._resize(i===0?Va(n*1,this.BYTES_PER_ELEMENT):Va(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Va(t*this.stride,this.BYTES_PER_ELEMENT);let e=au(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=au(this.buffer,t)}},Dr=class extends He{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}},Hn=class extends Dr{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,s=t%8,o=n[i]>>s&1;return e?o===0&&(n[i]|=1<<s,++this.numValid):o===1&&(n[i]&=~(1<<s),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},zn=class extends Dr{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,e){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var Mt=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=me(t),this._nulls=new Hn,e&&e.length>0&&(this._isValid=ou(e))}toVector(){return new dt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:n,_nulls:i,_typeIds:s,children:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),o.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((e,n)=>e+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}setValue(t,e){this._setValue(this,t,e)}setValid(t,e){return this.length=this._nulls.set(t,+e).length,e}addChild(t,e="".concat(this.numChildren)){throw new Error('Cannot append children to non-nested type "'.concat(this.type,'"'))}getChildAt(t){return this.children[t]||null}flush(){let t,e,n,i,{type:s,length:o,nullCount:a,_typeIds:c,_offsets:d,_values:p,_nulls:S}=this;(e=c==null?void 0:c.flush(o))?i=d==null?void 0:d.flush(o):(i=d==null?void 0:d.flush(o))?t=p==null?void 0:p.flush(d.last()):t=p==null?void 0:p.flush(o),a>0&&(n=S==null?void 0:S.flush(o));let A=this.children.map(x=>x.flush());return this.clear(),tt({type:s,length:o,nullCount:a,children:A,child:A[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let s of this.children)s.clear();return this}};Mt.prototype.length=1;Mt.prototype.stride=1;Mt.prototype.children=null;Mt.prototype.finished=!1;Mt.prototype.nullValues=null;Mt.prototype._isValid=()=>!0;var Ht=class extends Mt{constructor(t){super(t),this._values=new Dr(this.ArrayType,0,this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},se=class extends Mt{constructor(t){super(t),this._pendingLength=0,this._offsets=new zn(t.type)}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof nr?e[Jr].length:e.length,n.set(t,e)}setValid(t,e){return super.setValid(t,e)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}};var fn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,i){return t.prep(8,24),t.writeInt64(BigInt(i!=null?i:0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var ye=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):wt.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new ie).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new fn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){let n=this.bb.__offset(this.bb_pos,10);return n?(e||new fn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new Wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,wt.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}};var St=class r{constructor(t=[],e,n,i=wt.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=Ha(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return"Schema<{ ".concat(this.fields.map((t,e)=>"".concat(e,": ").concat(t)).join(", ")," }>")}select(t){let e=new Set(t),n=this.fields.filter(i=>e.has(i.name));return new r(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new r(e,this.metadata)}assign(...t){let e=t[0]instanceof r?t[0]:Array.isArray(t[0])?new r(t[0]):new r(t),n=[...this.fields],i=oo(oo(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{let c=n.findIndex(d=>d.name===a.name);return~c?(n[c]=a.clone({metadata:oo(oo(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=Ha(s,new Map);return new r([...n,...s],i,new Map([...this.dictionaries,...o]))}};St.prototype.fields=null;St.prototype.metadata=null;St.prototype.dictionaries=null;var ct=class r{static new(...t){let[e,n,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new r("".concat(e),n,i,s)}constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return"".concat(this.name,": ").concat(this.type)}clone(...t){let[e,n,i,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,i=this.nullable,s=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],r.new(e,n,i,s)}};ct.prototype.type=null;ct.prototype.name=null;ct.prototype.nullable=null;ct.prototype.metadata=null;function oo(r,t){return new Map([...r||new Map,...t||new Map])}function Ha(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(M.isDictionary(s)){if(!t.has(s.id))t.set(s.id,s.dictionary);else if(t.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&Ha(s.children,t)}return t}var Wp=on,$p=fe,Fr=class{static decode(t){t=new $p(Y(t));let e=ye.getRootAsFooter(t),n=St.decode(e.schema(),new Map,e.version());return new za(n,e)}static encode(t){let e=new Wp,n=St.encode(e,t.schema);ye.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Ar.encode(e,o);let i=e.endVector();ye.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Ar.encode(e,o);let s=e.endVector();return ye.startFooter(e),ye.addSchema(e,n),ye.addVersion(e,wt.V5),ye.addRecordBatches(e,i),ye.addDictionaries(e,s),ye.finishFooterBuffer(e,ye.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=wt.V5,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e<n;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,n=this.numDictionaries;++e<n;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var za=class extends Fr{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Ar.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Ar.decode(e)}return null}},Ar=class r{static decode(t){return new r(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=BigInt(e.offset),s=BigInt(e.bodyLength);return fn.createBlock(t,i,n,s)}constructor(t,e,n){this.metaDataLength=t,this.offset=ht(n),this.bodyLength=ht(e)}};var Ut=Object.freeze({done:!0,value:void 0}),Ei=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},hn=class{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},ao=class extends hn{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return O(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Ut);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return qt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return qt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return O(this,void 0,void 0,function*(){return yield this.abort(t),Ut})}return(t){return O(this,void 0,void 0,function*(){return yield this.close(),Ut})}read(t){return O(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return O(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(Ut)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var ir=class extends ao{write(t){if((t=Y(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?ci(this.toUint8Array(!0)):this.toUint8Array(!1).then(ci)}toUint8Array(t=!1){return t?de(this._values)[0]:O(this,void 0,void 0,function*(){var e,n,i,s;let o=[],a=0;try{for(var c=!0,d=Ae(this),p;p=yield d.next(),e=p.done,!e;c=!0){s=p.value,c=!1;let S=s;o.push(S),a+=S.byteLength}}catch(S){n={error:S}}finally{try{!c&&!e&&(i=d.return)&&(yield i.call(d))}finally{if(n)throw n.error}}return de(o,a)[0]})}},sr=class{constructor(t){t&&(this.source=new ja(qt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},ve=class r{constructor(t){t instanceof r?this.source=t.source:t instanceof ir?this.source=new xr(qt.fromAsyncIterable(t)):ys(t)?this.source=new xr(qt.fromNodeStream(t)):li(t)?this.source=new xr(qt.fromDOMStream(t)):ps(t)?this.source=new xr(qt.fromDOMStream(t.body)):Te(t)?this.source=new xr(qt.fromIterable(t)):xe(t)?this.source=new xr(qt.fromAsyncIterable(t)):_e(t)&&(this.source=new xr(qt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},ja=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Ut)}return(t){return Object.create(this.source.return&&this.source.return(t)||Ut)}},xr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return O(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return O(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return O(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return O(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return O(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||Ut;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return O(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||Ut;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var Ui=class extends sr{constructor(t,e){super(),this.position=0,this.buffer=Y(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){let{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:e,size:n,position:i}=this;return e&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),e.subarray(i,this.position)):null}readAt(t,e){let n=this.buffer,i=Math.min(this.size,t+e);return n?n.subarray(t,i):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Zr=class extends ve{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=O(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return O(this,void 0,void 0,function*(){let{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return O(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return O(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:n,position:i}=this;if(e&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=i,o=0,a=0,c=Math.min(n,s+Math.min(n-s,t)),d=new Uint8Array(Math.max(0,(this.position=c)-s));for(;(s+=a)<c&&(o+=a)<d.byteLength;)({bytesRead:a}=yield e.read(d,o,d.byteLength-o,s));return d}return null})}readAt(t,e){return O(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+e<i){let s=Math.min(i,t+e),o=new Uint8Array(s-t);return(yield n.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return O(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return O(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return O(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var $a={};Pr($a,{BaseInt64:()=>Oi,Int128:()=>Mi,Int64:()=>Tr,Uint64:()=>Nt});function jn(r){return r<0&&(r=4294967295+r+1),"0x".concat(r.toString(16))}var Wn=8,Wa=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Oi=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=e[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*n[3],s+=i,i=e[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?65536:0,this.buffer[1]+=s>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return"".concat(jn(this.buffer[1])," ").concat(jn(this.buffer[0]))}},Nt=class r extends Oi{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new r(e);for(let s=0;s<n;){let o=Wn<n-s?Wn:n-s,a=new r(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new r(new Uint32Array([Wa[o],0]));i.times(c),i.plus(a),s+=o}return i}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)r.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}},Tr=class r extends Oi{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new r(e);for(let o=n?1:0;o<i;){let a=Wn<i-o?Wn:i-o,c=new r(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),d=new r(new Uint32Array([Wa[a],0]));s.times(d),s.plus(c),o+=a}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)r.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}},Mi=class r{constructor(t){this.buffer=t}high(){return new Tr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Tr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let e=new Nt(new Uint32Array([this.buffer[3],0])),n=new Nt(new Uint32Array([this.buffer[2],0])),i=new Nt(new Uint32Array([this.buffer[1],0])),s=new Nt(new Uint32Array([this.buffer[0],0])),o=new Nt(new Uint32Array([t.buffer[3],0])),a=new Nt(new Uint32Array([t.buffer[2],0])),c=new Nt(new Uint32Array([t.buffer[1],0])),d=new Nt(new Uint32Array([t.buffer[0],0])),p=Nt.multiply(s,d);this.buffer[0]=p.low();let S=new Nt(new Uint32Array([p.high(),0]));return p=Nt.multiply(i,d),S.plus(p),p=Nt.multiply(s,c),S.plus(p),this.buffer[1]=S.low(),this.buffer[3]=S.lessThan(p)?1:0,this.buffer[2]=S.high(),new Nt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Nt.multiply(n,d)).plus(Nt.multiply(i,c)).plus(Nt.multiply(s,a)),this.buffer[3]+=Nt.multiply(e,d).plus(Nt.multiply(n,c)).plus(Nt.multiply(i,a)).plus(Nt.multiply(s,o)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return"".concat(jn(this.buffer[3])," ").concat(jn(this.buffer[2])," ").concat(jn(this.buffer[1])," ").concat(jn(this.buffer[0]))}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new r(e);for(let o=n?1:0;o<i;){let a=Wn<i-o?Wn:i-o,c=new r(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),d=new r(new Uint32Array([Wa[a],0,0,0]));s.times(d),s.plus(c),o+=a}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)r.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var Ri=class extends z{constructor(t,e,n,i,s=wt.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i,this.metadataVersion=s}visit(t){return super.visit(t instanceof ct?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return tt({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<wt.V5&&this.readNullBitmap(t,n),t.mode===At.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:n}=this.nextFieldNode()){return tt({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,n=this.nextBufferRange()){return e>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}},co=class extends Ri{constructor(t,e,n,i,s){super(new Uint8Array(0),e,n,i,s),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):un(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return at(Uint8Array,at(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return at(Uint8Array,at(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return M.isTimestamp(t)?at(Uint8Array,Tr.convertArray(n[e])):(M.isInt(t)||M.isTime(t))&&t.bitWidth===64||M.isDuration(t)?at(Uint8Array,Tr.convertArray(n[e])):M.isDate(t)&&t.unit===kt.MILLISECOND?at(Uint8Array,Tr.convertArray(n[e])):M.isDecimal(t)?at(Uint8Array,Mi.convertArray(n[e])):M.isBinary(t)||M.isLargeBinary(t)||M.isFixedSizeBinary(t)?Gp(n[e]):M.isBool(t)?un(n[e]):M.isUtf8(t)||M.isLargeUtf8(t)?Xe(n[e].join("")):at(Uint8Array,at(t.ArrayType,n[e].map(i=>+i)))}};function Gp(r){let t=r.join(""),e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)e[n>>1]=Number.parseInt(t.slice(n,n+2),16);return e}var $n=class extends se{constructor(t){super(t),this._values=new He(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Y(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)n.set(o,0);else{let c=a.length;i.set(a,s),n.set(o,c),s+=c}}};var Gn=class extends se{constructor(t){super(t),this._values=new He(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Y(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)n.set(o,BigInt(0));else{let c=a.length;i.set(a,s),n.set(o,BigInt(c)),s+=c}}};var lo=class extends Mt{constructor(t){super(t),this._values=new Hn}setValue(t,e){this._values.set(t,+e)}};var pn=class extends Ht{};pn.prototype._setValue=Ba;var Li=class extends pn{};Li.prototype._setValue=Ls;var Ni=class extends pn{};Ni.prototype._setValue=Ns;var ki=class extends Ht{};ki.prototype._setValue=Aa;var uo=class extends Mt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new pe(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=mn({type:this.type.indices,nullValues:e}),this.dictionary=mn({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){let n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){let n=this._keysToIndices,i=this.valueToKey(e),s=n[i];return s===void 0&&(n[i]=s=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,s)}flush(){let t=this.type,e=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:"".concat(t)}};var Ci=class extends Ht{};Ci.prototype._setValue=Ia;var fo=class extends Mt{setValue(t,e){let[n]=this.children,i=t*this.stride;for(let s=-1,o=e.length;++s<o;)n.set(i+s,e[s])}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new Ce(this.type.listSize,new ct(e,t.type,!0)),n}};var yn=class extends Ht{setValue(t,e){this._values.set(t,e)}},ho=class extends yn{setValue(t,e){super.setValue(t,Di(e))}},po=class extends yn{},mo=class extends yn{};var _n=class extends Ht{};_n.prototype._setValue=xa;var Pi=class extends _n{};Pi.prototype._setValue=$s;var Vi=class extends _n{};Vi.prototype._setValue=Gs;var Er=class extends Ht{};Er.prototype._setValue=Ta;var Hi=class extends Er{};Hi.prototype._setValue=Ks;var zi=class extends Er{};zi.prototype._setValue=qs;var ji=class extends Er{};ji.prototype._setValue=Ys;var Wi=class extends Er{};Wi.prototype._setValue=Js;var Se=class extends Ht{setValue(t,e){this._values.set(t,e)}},yo=class extends Se{},_o=class extends Se{},bo=class extends Se{},go=class extends Se{},wo=class extends Se{},vo=class extends Se{},So=class extends Se{},Io=class extends Se{};var Bo=class extends se{constructor(t){super(t),this._offsets=new zn(t.type)}addChild(t,e="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ne(new ct(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(typeof s>"u")e.set(i,0);else{let o=s,a=o.length,c=e.set(i,a).buffer[i];for(let d=-1;++d<a;)n.set(c+d,o[d])}}};var Do=class extends se{set(t,e){return super.set(t,e)}setValue(t,e){let n=e instanceof Map?e:new Map(Object.entries(e)),i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,e="".concat(this.numChildren)){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Pe(new ct(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(s===void 0)e.set(i,0);else{let{[i]:o,[i+1]:a}=e.set(i,s.size).buffer;for(let c of s.entries())if(n.set(o,c),++o>=a)break}}};var Fo=class extends Mt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var Ao=class extends Mt{setValue(t,e){let{children:n,type:i}=this;switch(Array.isArray(e)||e.constructor){case!0:return i.children.forEach((s,o)=>n[o].set(t,e[o]));case Map:return i.children.forEach((s,o)=>n[o].set(t,e.get(s.name)));default:return i.children.forEach((s,o)=>n[o].set(t,e[s.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(n=>n.setValid(t,e)),e}addChild(t,e="".concat(this.numChildren)){let n=this.children.push(t);return this.type=new Et([...this.type.children,new ct(e,t.type,!0)]),n}};var Ur=class extends Ht{};Ur.prototype._setValue=Da;var $i=class extends Ur{};$i.prototype._setValue=ks;var Gi=class extends Ur{};Gi.prototype._setValue=Cs;var Ki=class extends Ur{};Ki.prototype._setValue=Ps;var qi=class extends Ur{};qi.prototype._setValue=Vs;var Or=class extends Ht{};Or.prototype._setValue=Fa;var Yi=class extends Or{};Yi.prototype._setValue=Hs;var Ji=class extends Or{};Ji.prototype._setValue=zs;var Xi=class extends Or{};Xi.prototype._setValue=js;var Zi=class extends Or{};Zi.prototype._setValue=Ws;var Kn=class extends Mt{constructor(t){super(t),this._typeIds=new Dr(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,n){return n===void 0&&(n=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,n),this}setValue(t,e,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],s=this.children[i];s==null||s.set(t,e)}addChild(t,e="".concat(this.children.length)){let n=this.children.push(t),{type:{children:i,mode:s,typeIds:o}}=this,a=[...i,new ct(e,t.type)];return this.type=new ke(s,[...o,n],a),n}_valueToChildTypeId(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},xo=class extends Kn{},To=class extends Kn{constructor(t){super(t),this._offsets=new Dr(Int32Array)}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[i]),o=this._offsets.set(t,s.length).buffer[t];s==null||s.set(o,e)}};var Qi=class extends se{constructor(t){super(t),this._values=new He(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Xe(e))}_flushPending(t,e){}};Qi.prototype._flushPending=$n.prototype._flushPending;var ts=class extends se{constructor(t){super(t),this._values=new He(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Xe(e))}_flushPending(t,e){}};ts.prototype._flushPending=Gn.prototype._flushPending;var Ga=class extends z{visitNull(){return Fo}visitBool(){return lo}visitInt(){return Se}visitInt8(){return yo}visitInt16(){return _o}visitInt32(){return bo}visitInt64(){return go}visitUint8(){return wo}visitUint16(){return vo}visitUint32(){return So}visitUint64(){return Io}visitFloat(){return yn}visitFloat16(){return ho}visitFloat32(){return po}visitFloat64(){return mo}visitUtf8(){return Qi}visitLargeUtf8(){return ts}visitBinary(){return $n}visitLargeBinary(){return Gn}visitFixedSizeBinary(){return Ci}visitDate(){return pn}visitDateDay(){return Li}visitDateMillisecond(){return Ni}visitTimestamp(){return Ur}visitTimestampSecond(){return $i}visitTimestampMillisecond(){return Gi}visitTimestampMicrosecond(){return Ki}visitTimestampNanosecond(){return qi}visitTime(){return Or}visitTimeSecond(){return Yi}visitTimeMillisecond(){return Ji}visitTimeMicrosecond(){return Xi}visitTimeNanosecond(){return Zi}visitDecimal(){return ki}visitList(){return Bo}visitStruct(){return Ao}visitUnion(){return Kn}visitDenseUnion(){return To}visitSparseUnion(){return xo}visitDictionary(){return uo}visitInterval(){return _n}visitIntervalDayTime(){return Pi}visitIntervalYearMonth(){return Vi}visitDuration(){return Er}visitDurationSecond(){return Hi}visitDurationMillisecond(){return zi}visitDurationMicrosecond(){return ji}visitDurationNanosecond(){return Wi}visitFixedSizeList(){return fo}visitMap(){return Do}},cu=new Ga;var G=class extends z{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,i)=>this.compareFields(n,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}};function re(r,t){return t instanceof r.constructor}function bn(r,t){return r===t||re(r,t)}function Mr(r,t){return r===t||re(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function Eo(r,t){return r===t||re(r,t)&&r.precision===t.precision}function Kp(r,t){return r===t||re(r,t)&&r.byteWidth===t.byteWidth}function Ka(r,t){return r===t||re(r,t)&&r.unit===t.unit}function es(r,t){return r===t||re(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function rs(r,t){return r===t||re(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function qp(r,t){return r===t||re(r,t)&&r.children.length===t.children.length&&or.compareManyFields(r.children,t.children)}function Yp(r,t){return r===t||re(r,t)&&r.children.length===t.children.length&&or.compareManyFields(r.children,t.children)}function qa(r,t){return r===t||re(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&or.compareManyFields(r.children,t.children)}function Jp(r,t){return r===t||re(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&or.visit(r.indices,t.indices)&&or.visit(r.dictionary,t.dictionary)}function Ya(r,t){return r===t||re(r,t)&&r.unit===t.unit}function ns(r,t){return r===t||re(r,t)&&r.unit===t.unit}function Xp(r,t){return r===t||re(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&or.compareManyFields(r.children,t.children)}function Zp(r,t){return r===t||re(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&or.compareManyFields(r.children,t.children)}G.prototype.visitNull=bn;G.prototype.visitBool=bn;G.prototype.visitInt=Mr;G.prototype.visitInt8=Mr;G.prototype.visitInt16=Mr;G.prototype.visitInt32=Mr;G.prototype.visitInt64=Mr;G.prototype.visitUint8=Mr;G.prototype.visitUint16=Mr;G.prototype.visitUint32=Mr;G.prototype.visitUint64=Mr;G.prototype.visitFloat=Eo;G.prototype.visitFloat16=Eo;G.prototype.visitFloat32=Eo;G.prototype.visitFloat64=Eo;G.prototype.visitUtf8=bn;G.prototype.visitLargeUtf8=bn;G.prototype.visitBinary=bn;G.prototype.visitLargeBinary=bn;G.prototype.visitFixedSizeBinary=Kp;G.prototype.visitDate=Ka;G.prototype.visitDateDay=Ka;G.prototype.visitDateMillisecond=Ka;G.prototype.visitTimestamp=es;G.prototype.visitTimestampSecond=es;G.prototype.visitTimestampMillisecond=es;G.prototype.visitTimestampMicrosecond=es;G.prototype.visitTimestampNanosecond=es;G.prototype.visitTime=rs;G.prototype.visitTimeSecond=rs;G.prototype.visitTimeMillisecond=rs;G.prototype.visitTimeMicrosecond=rs;G.prototype.visitTimeNanosecond=rs;G.prototype.visitDecimal=bn;G.prototype.visitList=qp;G.prototype.visitStruct=Yp;G.prototype.visitUnion=qa;G.prototype.visitDenseUnion=qa;G.prototype.visitSparseUnion=qa;G.prototype.visitDictionary=Jp;G.prototype.visitInterval=Ya;G.prototype.visitIntervalDayTime=Ya;G.prototype.visitIntervalYearMonth=Ya;G.prototype.visitDuration=ns;G.prototype.visitDurationSecond=ns;G.prototype.visitDurationMillisecond=ns;G.prototype.visitDurationMicrosecond=ns;G.prototype.visitDurationNanosecond=ns;G.prototype.visitFixedSizeList=Xp;G.prototype.visitMap=Zp;var or=new G;function gn(r,t){return or.compareSchemas(r,t)}function lu(r,t){return or.compareFields(r,t)}function uu(r,t){return or.visit(r,t)}function mn(r){let t=r.type,e=new(cu.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},s=Array.isArray(n)?(o,a)=>n[a]||i:({name:o})=>n[o]||i;for(let[o,a]of t.children.entries()){let{type:c}=a,d=s(a,o);e.children.push(mn(Object.assign(Object.assign({},d),{type:c})))}}return e}function Uo(r,t){return Qp(r,t.map(e=>e.data.concat()))}function Qp(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((S,A)=>Math.max(S,A.length),0)},s=0,o=0,a=-1,c=t.length,d,p=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)p[a]=d=t[a].shift(),o=Math.min(o,d?d.length:o);Number.isFinite(o)&&(p=tm(e,o,p,t,i),o>0&&(n[s++]=tt({type:new Et(e),length:o,nullCount:0,children:p.slice()})))}return[r=r.assign(e),n.map(S=>new Ct(r,S))]}function tm(r,t,e,n,i){var s;let o=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let d=e[a],p=d==null?void 0:d.length;if(p>=t)p===t?e[a]=d:(e[a]=d.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(d.slice(t,p-t))));else{let S=r[a];r[a]=S.clone({nullable:!0}),e[a]=(s=d==null?void 0:d._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:tt({type:S.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var du,ne=class r{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new St([]),this._offsets=[0],this;let i,s;t[0]instanceof St&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=c=>{if(c){if(c instanceof Ct)return[c];if(c instanceof r)return c.batches;if(c instanceof _t){if(c.type instanceof Et)return[new Ct(new St(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(d=>o(d));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(d=>o(d));if(typeof c=="object"){let d=Object.keys(c),p=d.map(x=>new dt([c[x]])),S=i!=null?i:new St(d.map((x,ot)=>new ct(String(x),p[ot].type,p[ot].nullable))),[,A]=Uo(S,p);return A.length===0?[new Ct(c)]:A}}}return[]},a=t.flatMap(c=>o(c));if(i=(n=i!=null?i:(e=a[0])===null||e===void 0?void 0:e.schema)!==null&&n!==void 0?n:new St([]),!(i instanceof St))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Ct))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!gn(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s!=null?s:eo(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=to(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(an(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Vn.visit(new dt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return"[\n ".concat(this.toArray().join(",\n "),"\n]")}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new r(e,n.map(i=>new Ct(e,i)))}slice(t,e){let n=this.schema;[t,e]=Fi({length:this.numRows},t,e);let i=ro(this.data,this._offsets,t,e);return new r(n,i.map(s=>new Ct(n,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],i=tt({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new dt(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new dt([tt({type:new ee,length:this.numRows})]));let s=n.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((c,d)=>this.getChildAt(d));[s[t],a[t]]=[o,e],[n,i]=Uo(n,a)}return new r(n,i)}select(t){let e=this.schema.fields.reduce((n,i,s)=>n.set(i.name,s),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new r(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,d)=>{let[p,S]=a,A=e.findIndex(x=>x.name===c.name);return~A?S[A]=d:p.push(d),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new r(...Uo(s,o))}};du=Symbol.toStringTag;ne[du]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Pn(Ti),r.get=Pn(Vt.getVisitFn(h.Struct)),r.set=no(Yt.getVisitFn(h.Struct)),r.indexOf=io(dn.getVisitFn(h.Struct)),"Table"))(ne.prototype);var hu,Ct=class r{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof St))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=tt({nullCount:0,type:new Et(this.schema.fields),children:this.schema.fields.map(e=>tt({type:e.type,nullCount:0}))})]=t,!(this.data instanceof _t))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=fu(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((c,d,p)=>(c.children[p]=e[d],c.length=Math.max(c.length,e[d].length),c.fields[p]=ct.new({name:d,type:e[d].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new St(n),a=tt({type:new Et(n),length:s,children:i,nullCount:0});[this.schema,this.data]=fu(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=pu(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return Vt.visit(this.data,t)}at(t){return this.get(an(t,this.numRows))}set(t,e){return Yt.visit(this.data,t,e)}indexOf(t,e){return dn.visit(this.data,t,e)}[Symbol.iterator](){return Vn.visit(new dt([this.data]))}toArray(){return[...this]}concat(...t){return new ne(this.schema,[this,...t])}slice(t,e){let[n]=new dt([this.data]).slice(t,e).data;return new r(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new dt([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){e||(e=new dt([tt({type:new ee,length:this.numRows})]));let s=n.fields.slice(),o=i.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],n=new St(s,new Map(this.schema.metadata)),i=tt({type:new Et(s),children:o})}return new r(n,i)}select(t){let e=this.schema.select(t),n=new Et(e.fields),i=[];for(let s of t){let o=this.schema.fields.findIndex(a=>a.name===s);~o&&(i[o]=this.data.children[o])}return new r(e,tt({type:n,length:this.numRows,children:i}))}selectAt(t){let e=this.schema.selectAt(t),n=t.map(s=>this.data.children[s]).filter(Boolean),i=tt({type:new Et(e.fields),length:this.numRows,children:n});return new r(e,i)}};hu=Symbol.toStringTag;Ct[hu]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Ct.prototype);function fu(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let d=t[a];(!d||d.length!==e)&&(i[a]=c.clone({nullable:!0}),s[a]=(n=d==null?void 0:d._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:tt({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),tt({type:new Et(i),length:e,children:s})]}function pu(r,t,e=new Map){var n,i;if(((n=r==null?void 0:r.length)!==null&&n!==void 0?n:0)>0&&(r==null?void 0:r.length)===(t==null?void 0:t.length))for(let s=-1,o=r.length;++s<o;){let{type:a}=r[s],c=t[s];for(let d of[c,...((i=c==null?void 0:c.dictionary)===null||i===void 0?void 0:i.data)||[]])pu(a.children,d==null?void 0:d.children,e);if(M.isDictionary(a)){let{id:d}=a;if(!e.has(d))c!=null&&c.dictionary&&e.set(d,c.dictionary);else if(e.get(d)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}var wn=class extends Ct{constructor(t){let e=t.fields.map(i=>tt({type:i.type})),n=tt({type:new Et(t.fields),nullCount:0,children:e});super(t,n)}};var ze=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):wt.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):ut.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new Wt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,wt.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,ut.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,s,o){return r.startMessage(t),r.addVersion(t,e),r.addHeaderType(t,n),r.addHeader(t,i),r.addBodyLength(t,s),r.addCustomMetadata(t,o),r.endMessage(t)}};var Ja=class extends z{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return wi.startNull(e),wi.endNull(e)}visitInt(t,e){return Oe.startInt(e),Oe.addBitWidth(e,t.bitWidth),Oe.addIsSigned(e,t.isSigned),Oe.endInt(e)}visitFloat(t,e){return $r.startFloatingPoint(e),$r.addPrecision(e,t.precision),$r.endFloatingPoint(e)}visitBinary(t,e){return mi.startBinary(e),mi.endBinary(e)}visitLargeBinary(t,e){return _i.startLargeBinary(e),_i.endLargeBinary(e)}visitBool(t,e){return yi.startBool(e),yi.endBool(e)}visitUtf8(t,e){return Si.startUtf8(e),Si.endUtf8(e)}visitLargeUtf8(t,e){return bi.startLargeUtf8(e),bi.endLargeUtf8(e)}visitDecimal(t,e){return er.startDecimal(e),er.addScale(e,t.scale),er.addPrecision(e,t.precision),er.addBitWidth(e,t.bitWidth),er.endDecimal(e)}visitDate(t,e){return Hr.startDate(e),Hr.addUnit(e,t.unit),Hr.endDate(e)}visitTime(t,e){return ur.startTime(e),ur.addUnit(e,t.unit),ur.addBitWidth(e,t.bitWidth),ur.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return dr.startTimestamp(e),dr.addUnit(e,t.unit),n!==void 0&&dr.addTimezone(e,n),dr.endTimestamp(e)}visitInterval(t,e){return Gr.startInterval(e),Gr.addUnit(e,t.unit),Gr.endInterval(e)}visitDuration(t,e){return zr.startDuration(e),zr.addUnit(e,t.unit),zr.endDuration(e)}visitList(t,e){return gi.startList(e),gi.endList(e)}visitStruct(t,e){return vi.startStruct_(e),vi.endStruct_(e)}visitUnion(t,e){Me.startTypeIdsVector(e,t.typeIds.length);let n=Me.createTypeIdsVector(e,t.typeIds);return Me.startUnion(e),Me.addMode(e,t.mode),Me.addTypeIds(e,n),Me.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return tr.startDictionaryEncoding(e),tr.addId(e,BigInt(t.id)),tr.addIsOrdered(e,t.isOrdered),n!==void 0&&tr.addIndexType(e,n),tr.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return jr.startFixedSizeBinary(e),jr.addByteWidth(e,t.byteWidth),jr.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Wr.startFixedSizeList(e),Wr.addListSize(e,t.listSize),Wr.endFixedSizeList(e)}visitMap(t,e){return Kr.startMap(e),Kr.addKeysSorted(e,t.keysSorted),Kr.endMap(e)}},Oo=new Ja;function bu(r,t=new Map){return new St(rm(r,t),Mo(r.metadata),t)}function Xa(r){return new Jt(r.count,wu(r.columns),vu(r.columns))}function gu(r){return new ae(Xa(r.data),r.id,r.isDelta)}function rm(r,t){return(r.fields||[]).filter(Boolean).map(e=>ct.fromJSON(e,t))}function mu(r,t){return(r.children||[]).filter(Boolean).map(e=>ct.fromJSON(e,t))}function wu(r){return(r||[]).reduce((t,e)=>[...t,new Ie(e.count,nm(e.VALIDITY)),...wu(e.children)],[])}function vu(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new oe(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new oe(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new oe(t.length,i.OFFSET.length)),i.DATA&&t.push(new oe(t.length,i.DATA.length)),t=vu(i.children,t)}return t}function nm(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Su(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=_u(r,mu(r,t)),i=new ct(r.name,o,r.nullable,Mo(r.metadata))):t.has(e=s.id)?(n=(n=s.indexType)?yu(n):new rr,a=new pe(t.get(e),n,e,s.isOrdered),i=new ct(r.name,a,r.nullable,Mo(r.metadata))):(n=(n=s.indexType)?yu(n):new rr,t.set(e,o=_u(r,mu(r,t))),a=new pe(o,n,e,s.isOrdered),i=new ct(r.name,a,r.nullable,Mo(r.metadata))),i||null}function Mo(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function yu(r){return new $t(r.isSigned,r.bitWidth)}function _u(r,t){let e=r.type.name;switch(e){case"NONE":return new ee;case"null":return new ee;case"binary":return new fr;case"largebinary":return new hr;case"utf8":return new pr;case"largeutf8":return new mr;case"bool":return new yr;case"list":return new Ne((t||[])[0]);case"struct":return new Et(t||[]);case"struct_":return new Et(t||[])}switch(e){case"int":{let n=r.type;return new $t(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new we(Dt[n.precision])}case"decimal":{let n=r.type;return new _r(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new br(kt[n.unit])}case"time":{let n=r.type;return new gr(L[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new wr(L[n.unit],n.timezone)}case"interval":{let n=r.type;return new vr(jt[n.unit])}case"duration":{let n=r.type;return new Sr(L[n.unit])}case"union":{let n=r.type,[i,...s]=(n.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new ke(At[o],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new Ir(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Ce(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Pe((t||[])[0],n.keysSorted)}}throw new Error('Unrecognized type: "'.concat(e,'"'))}var im=on,sm=fe,ce=class r{static fromJSON(t,e){let n=new r(0,wt.V5,e);return n._createHeader=om(t,e),n}static decode(t){t=new sm(Y(t));let e=ze.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new r(n,i,s);return o._createHeader=am(e,s),o}static encode(t){let e=new im,n=-1;return t.isSchema()?n=St.encode(e,t.header()):t.isRecordBatch()?n=Jt.encode(e,t.header()):t.isDictionaryBatch()&&(n=ae.encode(e,t.header())),ze.startMessage(e),ze.addVersion(e,wt.V5),ze.addHeader(e,n),ze.addHeaderType(e,t.headerType),ze.addBodyLength(e,BigInt(t.bodyLength)),ze.finishMessageBuffer(e,ze.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof St)return new r(0,wt.V5,ut.Schema,t);if(t instanceof Jt)return new r(e,wt.V5,ut.RecordBatch,t);if(t instanceof ae)return new r(e,wt.V5,ut.DictionaryBatch,t);throw new Error("Unrecognized Message header: ".concat(t))}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===ut.Schema}isRecordBatch(){return this.headerType===ut.RecordBatch}isDictionaryBatch(){return this.headerType===ut.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=ht(t)}},Jt=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=ht(t)}},ae=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=ht(e)}},oe=class{constructor(t,e){this.offset=ht(t),this.length=ht(e)}},Ie=class{constructor(t,e){this.length=ht(t),this.nullCount=ht(e)}};function om(r,t){return()=>{switch(t){case ut.Schema:return St.fromJSON(r);case ut.RecordBatch:return Jt.fromJSON(r);case ut.DictionaryBatch:return ae.fromJSON(r)}throw new Error("Unrecognized Message type: { name: ".concat(ut[t],", type: ").concat(t," }"))}}function am(r,t){return()=>{switch(t){case ut.Schema:return St.decode(r.header(new ie),new Map,r.version());case ut.RecordBatch:return Jt.decode(r.header(new he),r.version());case ut.DictionaryBatch:return ae.decode(r.header(new lr),r.version())}throw new Error("Unrecognized Message type: { name: ".concat(ut[t],", type: ").concat(t," }"))}}ct.encode=bm;ct.decode=ym;ct.fromJSON=Su;St.encode=_m;St.decode=cm;St.fromJSON=bu;Jt.encode=gm;Jt.decode=lm;Jt.fromJSON=Xa;ae.encode=wm;ae.decode=um;ae.fromJSON=gu;Ie.encode=vm;Ie.decode=fm;oe.encode=Sm;oe.decode=dm;function cm(r,t=new Map,e=wt.V5){let n=mm(r,t);return new St(n,Ro(r),t,e)}function lm(r,t=wt.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Jt(r.length(),hm(r),pm(r,t))}function um(r,t=wt.V5){return new ae(Jt.decode(r.data(),t),r.id(),r.isDelta())}function dm(r){return new oe(r.offset(),r.length())}function fm(r){return new Ie(r.length(),r.nullCount())}function hm(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=Ie.decode(e));return t}function pm(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<wt.V4&&(n.bb_pos+=8*(i+1)),e[++s]=oe.decode(n));return e}function mm(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=ct.decode(n,t));return e}function Iu(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=ct.decode(n,t));return e}function ym(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=Du(r,Iu(r,t)),n=new ct(r.name(),i,r.nullable(),Ro(r))):t.has(e=ht(a.id()))?(s=(s=a.indexType())?Bu(s):new rr,o=new pe(t.get(e),s,e,a.isOrdered()),n=new ct(r.name(),o,r.nullable(),Ro(r))):(s=(s=a.indexType())?Bu(s):new rr,t.set(e,i=Du(r,Iu(r,t))),o=new pe(i,s,e,a.isOrdered()),n=new ct(r.name(),o,r.nullable(),Ro(r))),n||null}function Ro(r){let t=new Map;if(r)for(let e,n,i=-1,s=Math.trunc(r.customMetadataLength());++i<s;)(e=r.customMetadata(i))&&(n=e.key())!=null&&t.set(n,e.value());return t}function Bu(r){return new $t(r.isSigned(),r.bitWidth())}function Du(r,t){let e=r.typeType();switch(e){case xt.NONE:return new ee;case xt.Null:return new ee;case xt.Binary:return new fr;case xt.LargeBinary:return new hr;case xt.Utf8:return new pr;case xt.LargeUtf8:return new mr;case xt.Bool:return new yr;case xt.List:return new Ne((t||[])[0]);case xt.Struct_:return new Et(t||[])}switch(e){case xt.Int:{let n=r.type(new Oe);return new $t(n.isSigned(),n.bitWidth())}case xt.FloatingPoint:{let n=r.type(new $r);return new we(n.precision())}case xt.Decimal:{let n=r.type(new er);return new _r(n.scale(),n.precision(),n.bitWidth())}case xt.Date:{let n=r.type(new Hr);return new br(n.unit())}case xt.Time:{let n=r.type(new ur);return new gr(n.unit(),n.bitWidth())}case xt.Timestamp:{let n=r.type(new dr);return new wr(n.unit(),n.timezone())}case xt.Interval:{let n=r.type(new Gr);return new vr(n.unit())}case xt.Duration:{let n=r.type(new zr);return new Sr(n.unit())}case xt.Union:{let n=r.type(new Me);return new ke(n.mode(),n.typeIdsArray()||[],t||[])}case xt.FixedSizeBinary:{let n=r.type(new jr);return new Ir(n.byteWidth())}case xt.FixedSizeList:{let n=r.type(new Wr);return new Ce(n.listSize(),(t||[])[0])}case xt.Map:{let n=r.type(new Kr);return new Pe((t||[])[0],n.keysSorted())}}throw new Error('Unrecognized type: "'.concat(xt[e],'" (').concat(e,")"))}function _m(r,t){let e=t.fields.map(s=>ct.encode(r,s));ie.startFieldsVector(r,e.length);let n=ie.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?ie.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString("".concat(s)),c=r.createString("".concat(o));return Wt.startKeyValue(r),Wt.addKey(r,a),Wt.addValue(r,c),Wt.endKeyValue(r)})):-1;return ie.startSchema(r),ie.addFields(r,n),ie.addEndianness(r,Im?Vr.Little:Vr.Big),i!==-1&&ie.addCustomMetadata(r,i),ie.endSchema(r)}function bm(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;M.isDictionary(s)?(o=s.dictionary.typeId,i=Oo.visit(s,r),n=Oo.visit(s.dictionary,r)):n=Oo.visit(s,r);let a=(s.children||[]).map(p=>ct.encode(r,p)),c=Zt.createChildrenVector(r,a),d=t.metadata&&t.metadata.size>0?Zt.createCustomMetadataVector(r,[...t.metadata].map(([p,S])=>{let A=r.createString("".concat(p)),x=r.createString("".concat(S));return Wt.startKeyValue(r),Wt.addKey(r,A),Wt.addValue(r,x),Wt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),Zt.startField(r),Zt.addType(r,n),Zt.addTypeType(r,o),Zt.addChildren(r,c),Zt.addNullable(r,!!t.nullable),e!==-1&&Zt.addName(r,e),i!==-1&&Zt.addDictionary(r,i),d!==-1&&Zt.addCustomMetadata(r,d),Zt.endField(r)}function gm(r,t){let e=t.nodes||[],n=t.buffers||[];he.startNodesVector(r,e.length);for(let o of e.slice().reverse())Ie.encode(r,o);let i=r.endVector();he.startBuffersVector(r,n.length);for(let o of n.slice().reverse())oe.encode(r,o);let s=r.endVector();return he.startRecordBatch(r),he.addLength(r,BigInt(t.length)),he.addNodes(r,i),he.addBuffers(r,s),he.endRecordBatch(r)}function wm(r,t){let e=Jt.encode(r,t.data);return lr.startDictionaryBatch(r),lr.addId(r,BigInt(t.id)),lr.addIsDelta(r,t.isDelta),lr.addData(r,e),lr.endDictionaryBatch(r)}function vm(r,t){return En.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Sm(r,t){return Tn.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var Im=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var Qa=r=>"Expected ".concat(ut[r]," Message in stream, but was null or length 0."),tc=r=>"Header pointer of flatbuffer-encoded ".concat(ut[r]," Message is null or length 0."),Fu=(r,t)=>"Expected to read ".concat(r," metadata bytes, but only read ").concat(t,"."),Au=(r,t)=>"Expected to read ".concat(r," bytes for message body, but only read ").concat(t,"."),qn=class{constructor(t){this.source=t instanceof sr?t:new sr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Ut:t.value===-1&&(t=this.readMetadataLength()).done?Ut:(t=this.readMetadata(t.value)).done?Ut:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Qa(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=Y(this.source.read(t));if(e.byteLength<t)throw new Error(Au(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=ut.Schema,n=this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(tc(e));return i}readMetadataLength(){let t=this.source.read(Lo),e=t&&new fe(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return Ut;if(e.byteLength<t)throw new Error(Fu(t,e.byteLength));return{done:!1,value:ce.decode(e)}}},is=class{constructor(t,e){this.source=t instanceof ve?t:hs(t)?new Zr(t,e):new ve(t)}[Symbol.asyncIterator](){return this}next(){return O(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?Ut:t.value===-1&&(t=yield this.readMetadataLength()).done?Ut:(t=yield this.readMetadata(t.value)).done?Ut:t})}throw(t){return O(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return O(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return O(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Qa(t));return e.value})}readMessageBody(t){return O(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=Y(yield this.source.read(t));if(e.byteLength<t)throw new Error(Au(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return O(this,arguments,void 0,function*(t=!1){let e=ut.Schema,n=yield this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(tc(e));return i})}readMetadataLength(){return O(this,void 0,void 0,function*(){let t=yield this.source.read(Lo),e=t&&new fe(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(t){return O(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return Ut;if(e.byteLength<t)throw new Error(Fu(t,e.byteLength));return{done:!1,value:ce.decode(e)}})}},ss=class extends qn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Ei?t:new Ei(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ce.fromJSON(t.schema,ut.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:ce.fromJSON(e,ut.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ce.fromJSON(e,ut.RecordBatch)}}return this._body=[],Ut}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Qa(t));return e.value}readSchema(){let t=ut.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(tc(t));return n}},Lo=4,Za="ARROW1",Yn=new Uint8Array(Za.length);for(let r=0;r<Za.length;r+=1)Yn[r]=Za.codePointAt(r);function No(r,t=0){for(let e=-1,n=Yn.length;++e<n;)if(Yn[e]!==r[t+e])return!1;return!0}var Jn=Yn.length,ec=Jn+Lo,xu=Jn*2+Lo;var Xt=class r extends hn{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return xe(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return qt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return qt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof r?t:ds(t)?Dm(t):hs(t)?xm(t):xe(t)?O(this,void 0,void 0,function*(){return yield r.from(yield t)}):ps(t)||li(t)||ys(t)||_e(t)?Am(new ve(t)):Fm(new sr(t))}static readAll(t){return t instanceof r?t.isSync()?Tu(t):Eu(t):ds(t)||ArrayBuffer.isView(t)||Te(t)||fs(t)?Tu(t):Eu(t)}},ar=class extends Xt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return ue(this,arguments,function*(){yield it(yield*nn(An(Ae(this[Symbol.iterator]()))))})}},Qr=class extends Xt{constructor(t){super(t),this._impl=t}readAll(){return O(this,void 0,void 0,function*(){var t,e,n,i;let s=new Array;try{for(var o=!0,a=Ae(this),c;c=yield a.next(),t=c.done,!t;o=!0){i=c.value,o=!1;let d=i;s.push(d)}}catch(d){e={error:d}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},tn=class extends ar{constructor(t){super(t),this._impl=t}},os=class extends Qr{constructor(t){super(t),this._impl=t}},ko=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){let n=this._loadVectors(t,e,this.schema.fields),i=tt({type:new Et(this.schema.fields),length:t.length,children:n});return new Ct(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(n),c=o.dictionaries.get(n),d=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new dt(d)):new dt(d)).memoize()}_loadVectors(t,e,n){return new Ri(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},Xn=class extends ko{constructor(t,e){super(e),this._reader=ds(t)?new ss(this._handle=t):new qn(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Uu(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):Ut}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Ut}next(){if(this.closed)return Ut;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new wn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Zn=class extends ko{constructor(t,e){super(e),this._reader=new is(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return O(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return O(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Uu(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return O(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Ut})}return(t){return O(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Ut})}next(){return O(this,void 0,void 0,function*(){if(this.closed)return Ut;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new wn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return O(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Co=class extends Xn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof Ui?t:new Ui(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(ut.RecordBatch);if(i!=null&&i.isRecordBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(ut.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-ec,n=t.readInt32(e),i=t.readAt(e-n,n);return Fr.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},rc=class extends Zn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){let n=typeof e[0]!="number"?e.shift():void 0,i=e[0]instanceof Map?e.shift():void 0;super(t instanceof Zr?t:new Zr(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return O(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return O(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(ut.RecordBatch);if(i!=null&&i.isRecordBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){return O(this,void 0,void 0,function*(){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(ut.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return O(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-ec,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return Fr.decode(i)})}_readNextMessageAndValidate(t){return O(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},nc=class extends Xn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new co(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function Uu(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Tu(r){let t=Xt.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Eu(r){return ue(this,arguments,function*(){let e=yield it(Xt.from(r));try{if(!(yield it(e.open({autoDestroy:!1}))).closed)do yield yield it(e);while(!(yield it(e.reset().open())).closed)}finally{yield it(e.cancel())}})}function Dm(r){return new ar(new nc(r))}function Fm(r){let t=r.peek(Jn+7&-8);return t&&t.byteLength>=4?No(t)?new tn(new Co(r.read())):new ar(new Xn(r)):new ar(new Xn(function*(){}()))}function Am(r){return O(this,void 0,void 0,function*(){let t=yield r.peek(Jn+7&-8);return t&&t.byteLength>=4?No(t)?new tn(new Co(yield r.read())):new Qr(new Zn(r)):new Qr(new Zn(function(){return ue(this,arguments,function*(){})}()))})}function xm(r){return O(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Zr(r,t);return t>=xu&&No(yield e.readAt(0,Jn+7&-8))?new os(new rc(e)):new Qr(new Zn(e))})}var Rt=class r extends z{static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof Ct?s.data.children:s.data),n=new r;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof dt)return this.visitMany(t.data),this;let{type:e}=t;if(!M.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(M.isUnion(e))this.nodes.push(new Ie(n,0));else{let{nullCount:i}=t;M.isNull(e)||je.call(this,i<=0?new Uint8Array(0):ln(t.offset,n,t.nullBitmap)),this.nodes.push(new Ie(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function je(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new oe(this._byteLength,t)),this._byteLength+=t,this}function Tm(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:s}=r;if(je.call(this,i),e.mode===At.Sparse)return ic.call(this,r);if(e.mode===At.Dense){if(r.offset<=0)return je.call(this,s),ic.call(this,r);{let o=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let d,p,S=-1;++S<n;)(d=i[S])!==void 0&&((p=a[d])===void 0&&(p=a[d]=s[S]),o[S]=s[S]-p,c[d]=((t=c[d])!==null&&t!==void 0?t:0)+1);je.call(this,o),this.visitMany(r.children.map((d,p)=>{let S=e.typeIds[p],A=a[S],x=c[S];return d.slice(A,Math.min(n,x))}))}}return this}function Em(r){let t;return r.nullCount>=r.length?je.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?je.call(this,ln(r.offset,r.length,t)):je.call(this,un(r.values))}function Rr(r){return je.call(this,r.values.subarray(0,r.length*r.stride))}function Po(r){let{length:t,values:e,valueOffsets:n}=r,i=ht(n[0]),s=ht(n[t]),o=Math.min(s-i,e.byteLength-i);return je.call(this,bs(-i,t+1,n)),je.call(this,e.subarray(i,i+o)),this}function sc(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return je.call(this,bs(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function ic(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}Rt.prototype.visitBool=Em;Rt.prototype.visitInt=Rr;Rt.prototype.visitFloat=Rr;Rt.prototype.visitUtf8=Po;Rt.prototype.visitLargeUtf8=Po;Rt.prototype.visitBinary=Po;Rt.prototype.visitLargeBinary=Po;Rt.prototype.visitFixedSizeBinary=Rr;Rt.prototype.visitDate=Rr;Rt.prototype.visitTimestamp=Rr;Rt.prototype.visitTime=Rr;Rt.prototype.visitDecimal=Rr;Rt.prototype.visitList=sc;Rt.prototype.visitStruct=ic;Rt.prototype.visitUnion=Tm;Rt.prototype.visitInterval=Rr;Rt.prototype.visitDuration=Rr;Rt.prototype.visitFixedSizeList=sc;Rt.prototype.visitMap=sc;var vn=class extends hn{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new ir,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,te(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return xe(t)?t.then(e=>this.writeAll(e)):_e(t)?ac(this,t):oc(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof ir?this._sink=t:(this._sink=new ir,t&&Kc(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&qc(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!gn(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof ne&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof Ct&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!gn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof Ct?t instanceof wn||this._writeRecordBatch(t):t instanceof ne?this.writeAll(t.batches):Te(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=ce.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,c=a-s-o;return t.headerType===ut.RecordBatch?this._recordBatchBlocks.push(new Ar(a,t.bodyLength,this._position)):t.headerType===ut.DictionaryBatch&&this._dictionaryBlocks.push(new Ar(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let e=Y(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(ce.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Yn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=Rt.assemble(t),o=new Jt(t.numRows,n,i),a=ce.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){let{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=Rt.assemble(new dt([t])),c=new Jt(t.length,s,o),d=new ae(c,e,n),p=ce.from(d,i);return this._writeMessage(p)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,i;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){var e,n;for(let[i,s]of t.dictionaries){let o=(e=s==null?void 0:s.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==o[0])for(let[d,p]of o.entries())this._writeDictionaryBatch(p,i,d>0);else if(c<o.length)for(let d of o.slice(c))this._writeDictionaryBatch(d,i,!0);this._seenDictionaries.set(i,s),this._dictionaryDeltaOffsets.set(i,o.length)}return this}},Sn=class r extends vn{static writeAll(t,e){let n=new r(e);return xe(t)?t.then(i=>n.writeAll(i)):_e(t)?ac(n,t):oc(n,t)}},In=class r extends vn{static writeAll(t){let e=new r;return xe(t)?t.then(n=>e.writeAll(n)):_e(t)?ac(e,t):oc(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){let e=Fr.encode(new Fr(t,wt.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function oc(r,t){let e=t;t instanceof ne&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function ac(r,t){return O(this,void 0,void 0,function*(){var e,n,i,s,o,a,c;try{for(e=!0,n=Ae(t);i=yield n.next(),s=i.done,!s;e=!0){c=i.value,e=!1;let d=c;r.write(d)}}catch(d){o={error:d}}finally{try{!e&&!s&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return r.finish()})}function Ou(r,t){if(_e(r))return Om(r,t);if(Te(r))return Um(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Um(r,t){let e=null,n=(t==null?void 0:t.type)==="bytes"||!1,i=(t==null?void 0:t.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){s(o,e||(e=r[Symbol.iterator]()))},pull(o){e?s(o,e):o.close()},cancel(){(e!=null&&e.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){let c,d=null,p=o.desiredSize||null;for(;!(d=a.next(n?p:null)).done;)if(ArrayBuffer.isView(d.value)&&(c=Y(d.value))&&(p!=null&&n&&(p=p-c.byteLength+1),d.value=c),o.enqueue(d.value),p!=null&&--p<=0)return;o.close()}}function Om(r,t){let e=null,n=(t==null?void 0:t.type)==="bytes"||!1,i=(t==null?void 0:t.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return O(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return O(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return O(this,void 0,void 0,function*(){(e!=null&&e.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){return O(this,void 0,void 0,function*(){let c,d=null,p=o.desiredSize||null;for(;!(d=yield a.next(n?p:null)).done;)if(ArrayBuffer.isView(d.value)&&(c=Y(d.value))&&(p!=null&&n&&(p=p-c.byteLength+1),d.value=c),o.enqueue(d.value),p!=null&&--p<=0)return;o.close()})}}function Lu(r){return new cc(r)}var cc=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=$c(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=mn(s),this._getSize=i!=="bytes"?Mu:Ru;let{["highWaterMark"]:o=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:o,size:i!=="bytes"?Mu:Ru}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}},Mu=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},Ru=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function Vo(r,t){let e=new ir,n=null,i=new ReadableStream({cancel(){return O(this,void 0,void 0,function*(){yield e.close()})},start(a){return O(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return O(this,void 0,void 0,function*(){n?yield o(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return O(this,void 0,void 0,function*(){return yield(yield Xt.from(e)).open(t)})}function o(a,c){return O(this,void 0,void 0,function*(){let d=a.desiredSize,p=null;for(;!(p=yield c.next()).done;)if(a.enqueue(p.value),d!=null&&--d<=0)return;a.close()})}}function Ho(r,t){let e=new this(r),n=new ve(e),i=new ReadableStream({cancel(){return O(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return O(this,void 0,void 0,function*(){yield s(o)})},start(o){return O(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function s(o){return O(this,void 0,void 0,function*(){let a=null,c=o.desiredSize;for(;a=yield n.read(c||null);)if(o.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;o.close()})}}function zo(r,t="stream"){return(t==="stream"?Sn:In).writeAll(r).toUint8Array(!0)}var Nm=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},wa),$a),Na),va),ha),La),ya),{compareSchemas:gn,compareFields:lu,compareTypes:uu});qt.toDOMStream=Ou;Mt.throughDOM=Lu;Xt.throughDOM=Vo;tn.throughDOM=Vo;ar.throughDOM=Vo;vn.throughDOM=Ho;In.throughDOM=Ho;Sn.throughDOM=Ho;function Qn(r){switch(r.typeId){case h.Binary:return{sqlType:"binary"};case h.Bool:return{sqlType:"bool"};case h.Date:return{sqlType:"date"};case h.DateDay:return{sqlType:"date32[d]"};case h.DateMillisecond:return{sqlType:"date64[ms]"};case h.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case h.Float:return{sqlType:"float"};case h.Float16:return{sqlType:"float16"};case h.Float32:return{sqlType:"float32"};case h.Float64:return{sqlType:"float64"};case h.Int:return{sqlType:"int32"};case h.Int16:return{sqlType:"int16"};case h.Int32:return{sqlType:"int32"};case h.Int64:return{sqlType:"int64"};case h.Uint16:return{sqlType:"uint16"};case h.Uint32:return{sqlType:"uint32"};case h.Uint64:return{sqlType:"uint64"};case h.Uint8:return{sqlType:"uint8"};case h.IntervalDayTime:return{sqlType:"interval[dt]"};case h.IntervalYearMonth:return{sqlType:"interval[m]"};case h.List:return{sqlType:"list",valueType:Qn(r.valueType)};case h.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case h.Null:return{sqlType:"null"};case h.Utf8:return{sqlType:"utf8"};case h.Struct:return{sqlType:"struct",fields:r.children.map(e=>jo(e.name,e.type))};case h.Map:{let t=r;return{sqlType:"map",keyType:Qn(t.keyType),valueType:Qn(t.valueType)}}case h.Time:return{sqlType:"time[s]"};case h.TimeMicrosecond:return{sqlType:"time[us]"};case h.TimeMillisecond:return{sqlType:"time[ms]"};case h.TimeNanosecond:return{sqlType:"time[ns]"};case h.TimeSecond:return{sqlType:"time[s]"};case h.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case h.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case h.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case h.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case h.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(r.toString()))}function jo(r,t){let e=Qn(t);return e.name=r,e}var Wo=class{constructor(t,e){this._bindings=t,this._conn=e}close(){this._bindings.disconnect(this._conn)}useUnsafe(t){return t(this._bindings,this._conn)}query(t){let e=this._bindings.runQuery(this._conn,t),n=Xt.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new ne(n)}async send(t,e=!1){let n=this._bindings.startPendingQuery(this._conn,t,e);for(;n==null;)n=await new Promise((o,a)=>{try{o(this._bindings.pollPendingQuery(this._conn))}catch(c){console.log(c),c.message.includes("worker is not set!")?a(new Error("Worker has been terminated")):a(c)}});let i=new $o(this._bindings,this._conn,n),s=Xt.from(i);return console.assert(s.isSync()),console.assert(s.isStream()),s}cancelSent(){return this._bindings.cancelPendingQuery(this._conn)}getTableNames(t){return this._bindings.getTableNames(this._conn,t)}prepare(t){let e=this._bindings.createPrepared(this._conn,t);return new lc(this._bindings,this._conn,e)}createScalarFunction(t,e,n){this._bindings.createScalarFunction(this._conn,t,e,n)}insertArrowTable(t,e){let n=zo(t,"stream");this.insertArrowFromIPCStream(n,e)}insertArrowFromIPCStream(t,e){this._bindings.insertArrowFromIPCStream(this._conn,t,e)}insertCSVFromPath(t,e){this._bindings.insertCSVFromPath(this._conn,t,e)}insertJSONFromPath(t,e){this._bindings.insertJSONFromPath(this._conn,t,e)}},$o=class{constructor(t,e,n){this.bindings=t;this.conn=e;this.header=n;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}},lc=class{constructor(t,e,n){this.bindings=t,this.connectionId=e,this.statementId=n}close(){this.bindings.closePrepared(this.connectionId,this.statementId)}query(...t){let e=this.bindings.runPrepared(this.connectionId,this.statementId,t),n=Xt.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new ne(n)}send(...t){let e=this.bindings.sendPrepared(this.connectionId,this.statementId,t),n=new $o(this.bindings,this.connectionId,e),i=Xt.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};function ku(r){return r<=255}function Cu(r){return r===256}var Hu=new TextEncoder,Pu=new TextDecoder("utf-8");function uc(r,t,e){let n=Hu.encode(e),i=r._malloc(n.byteLength),s=r.HEAPU8.subarray(i,i+n.byteLength);s.set(n),r.HEAPF64[(t>>3)+0]=1,r.HEAPF64[(t>>3)+1]=i,r.HEAPF64[(t>>3)+2]=s.byteLength}function fc(r){switch(r){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 dc(r,t,e,n){let i=r.HEAPU8.subarray(t,t+n*fc(e));switch(e){case"UINT8":return new Uint8Array(i.buffer,i.byteOffset,n);case"INT8":return new Int8Array(i.buffer,i.byteOffset,n);case"INT32":return new Int32Array(i.buffer,i.byteOffset,n);case"FLOAT":return new Float32Array(i.buffer,i.byteOffset,n);case"DOUBLE":return new Float64Array(i.buffer,i.byteOffset,n);case"VARCHAR":return new Float64Array(i.buffer,i.byteOffset,n);default:return new Array(0)}}function Vu(r,t,e){let n=r.HEAPU8.subarray(t,t+e);return new Uint8Array(n.buffer,n.byteOffset,e)}function Go(r,t,e){let n=r.HEAPU8.subarray(t,t+e*8);return new Float64Array(n.buffer,n.byteOffset,e)}function zu(r,t,e,n,i,s,o,a){try{let c=r._udfFunctions.get(n);if(!c){uc(t,e,"Unknown UDF with id: "+n);return}let d=Pu.decode(t.HEAPU8.subarray(i,i+s)),p=JSON.parse(d),S=Go(t,o,a/8),A=w=>{var F;let R=null;switch(w.validityBuffer!==void 0&&(R=Vu(t,S[w.validityBuffer],p.rows)),w.physicalType){case"VARCHAR":{if(w.dataBuffer===null||w.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(w.lengthBuffer===null||w.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let H=dc(t,S[w.dataBuffer],w.physicalType,p.rows),g=[],C=Go(t,S[w.lengthBuffer],p.rows);for(let q=0;q<p.rows;++q){if(R!=null&&!R[q]){g.push(null);continue}let T=t.HEAPU8.subarray(H[q],H[q]+C[q]),pt=Pu.decode(T);g.push(pt)}return q=>g[q]}case"STRUCT":{let H={},g=[];for(let C=0;C<(((F=w.children)==null?void 0:F.length)||0);++C){let q=w.children[C],T=A(q);g.push(pt=>{H[q.name]=T(pt)})}return R!=null?C=>{if(!R[C])return null;for(let q of g)q(C);return H}:C=>{for(let q of g)q(C);return H}}default:{if(w.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+w.physicalType);let H=dc(t,S[w.dataBuffer],w.physicalType,p.rows);return R!=null?g=>R[g]?H[g]:null:g=>H[g]}}},x=[];for(let w=0;w<p.args.length;++w)x.push(A(p.args[w]));let ot=p.rows*fc(p.ret.physicalType),lt=t._malloc(ot),Pt=dc(t,lt,p.ret.physicalType,p.rows),Ot=t._malloc(p.rows),Bt=Vu(t,Ot,p.rows);if(Pt.length==0||Bt.length==0){uc(t,e,"Can't create physical arrays for result");return}let bt=Pt;p.ret.physicalType=="VARCHAR"&&(bt=new Array(p.rows));let Qt=[];for(let w=0;w<p.args.length;++w)Qt.push(null);for(let w=0;w<p.rows;++w){for(let F=0;F<p.args.length;++F)Qt[F]=x[F](w);let R=c.func(...Qt);bt[w]=R,Bt[w]=R==null?0:1}let Gt=0;switch(p.ret.physicalType){case"VARCHAR":{let w=new Array(0);Gt=t._malloc(p.rows*fc("DOUBLE"));let R=Go(t,Gt,p.rows),F=0;for(let q=0;q<p.rows;++q){let T=Hu.encode(bt[q]||"");w.push(T),R[q]=T.length,F+=T.length}let H=t._malloc(F),g=t.HEAPU8.subarray(H,H+F),C=0;for(let q=0;q<p.rows;++q){Pt[q]=C;let T=w[q];g.subarray(C,C+T.length).set(T),C+=T.length}}}let _=3*8,E=t._malloc(_),k=Go(t,E,3);k[0]=lt,k[1]=Ot,k[2]=Gt,t.HEAPF64[(e>>3)+0]=0,t.HEAPF64[(e>>3)+1]=E,t.HEAPF64[(e>>3)+2]=0}catch(c){uc(t,e,c.toString())}}function Cm(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}var Pm=Cm();function We(r,t){console.error("FAIL WITH: ".concat(t)),r.ccall("duckdb_web_fail_with",null,["string"],[t])}function Bn(r,t,e){let n=new Uint8Array(r.HEAPU8.buffer,t>>>0,e),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function rt(r,t,e){return Pm(new Uint8Array(r.HEAPU8.buffer,t>>>0,e))}function It(r,t,e,n){let i=r.stackSave(),s=r.stackAlloc(3*8);e.unshift("number"),n.unshift(s),r.ccall(t,null,e,n);let o=r.HEAPF64[(s>>3)+0],a=r.HEAPF64[(s>>3)+1],c=r.HEAPF64[(s>>3)+2];return r.stackRestore(i),[o,a,c]}function Tt(r){r.ccall("duckdb_web_clear_response",null,[],[])}var Ko=class{constructor(t){let e=new Float64Array(t.buffer,t.byteOffset,t.byteLength/8),n=new Uint8Array(new ArrayBuffer(t.byteLength));n.set(t.subarray(7*8)),this.totalFileReadsCold=e[0],this.totalFileReadsAhead=e[1],this.totalFileReadsCached=e[2],this.totalFileWrites=e[3],this.totalPageAccesses=e[4],this.totalPageLoads=e[5],this.blockSize=e[6],this.blockStats=n}getBlockStats(t,e){return e=e||{file_reads_cold:0,file_reads_ahead:0,file_reads_cached:0,file_writes:0,page_accesses:0,page_loads:0},e.file_writes=this.blockStats[t*3+0]&15,e.file_reads_cold=this.blockStats[t*3+0]>>4,e.file_reads_ahead=this.blockStats[t*3+1]&15,e.file_reads_cached=this.blockStats[t*3+1]>>4,e.page_accesses=this.blockStats[t*3+1]&15,e.page_loads=this.blockStats[t*3+1]>>4,e}};var ti=new TextEncoder;var qo=class{constructor(t,e){this._instance=null;this._initPromise=null;this._initPromiseResolver=()=>{};this.onInstantiationProgress=[];this._logger=t,this._runtime=e,this._nextUDFId=1}get logger(){return this._logger}get mod(){return this._instance}get pthread(){return this.mod.PThread||null}async instantiate(t=e=>{}){return this._instance!=null?this:(this._initPromise!=null&&(this.onInstantiationProgress.push(t),await this._initPromise),this._initPromise=new Promise(e=>{this._initPromiseResolver=e}),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(e=>e!=t),globalThis.DUCKDB_BINDINGS=this,this)}open(t){let[e,n,i]=It(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(e!==0)throw new Error(rt(this.mod,n,i));Tt(this.mod)}reset(){let[t,e,n]=It(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(rt(this.mod,e,n));Tt(this.mod)}getVersion(){let[t,e,n]=It(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(rt(this.mod,e,n));let i=rt(this.mod,e,n);return Tt(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let e=ti.encode(t),n=this.mod._malloc(e.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,n,e.length).set(e);let[s,o,a]=It(this.mod,"duckdb_web_tokenize_buffer",["number","number"],[n,e.length]);if(this.mod._free(n),s!==0)throw new Error(rt(this.mod,o,a));let c=rt(this.mod,o,a);return Tt(this.mod),JSON.parse(c)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new Wo(this,t)}disconnect(t){if(this.mod.ccall("duckdb_web_disconnect",null,["number"],[t]),this.pthread)for(let e of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])e.postMessage({cmd:"dropUDFFunctions",connectionId:t})}runQuery(t,e){let n=ti.encode(e),i=this.mod._malloc(n.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,i,n.length).set(n);let[o,a,c]=It(this.mod,"duckdb_web_query_run_buffer",["number","number","number"],[t,i,n.length]);if(this.mod._free(i),o!==0)throw new Error(rt(this.mod,a,c));let d=Bn(this.mod,a,c);return Tt(this.mod),d}startPendingQuery(t,e,n=!1){let i=ti.encode(e),s=this.mod._malloc(i.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,s,i.length).set(i);let[a,c,d]=It(this.mod,"duckdb_web_pending_query_start_buffer",["number","number","number","boolean"],[t,s,i.length,n]);if(this.mod._free(s),a!==0)throw new Error(rt(this.mod,c,d));if(c==0)return null;let p=Bn(this.mod,c,d);return Tt(this.mod),p}pollPendingQuery(t){let[e,n,i]=It(this.mod,"duckdb_web_pending_query_poll",["number"],[t]);if(e!==0)throw new Error(rt(this.mod,n,i));if(n==0)return null;let s=Bn(this.mod,n,i);return Tt(this.mod),s}cancelPendingQuery(t){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[t])}fetchQueryResults(t){let[e,n,i]=It(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(Cu(e))return Tt(this.mod),null;if(!ku(e))throw new Error("Unexpected StatusCode from duckdb_web_query_fetch_results ("+e+") and with self reported error as"+rt(this.mod,n,i));if(e!==0)throw new Error(rt(this.mod,n,i));let s=Bn(this.mod,n,i);return Tt(this.mod),s}getTableNames(t,e){let n=ti.encode(e),i=this.mod._malloc(n.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,i,n.length).set(n);let[o,a,c]=It(this.mod,"duckdb_web_get_tablenames_buffer",["number","number","number"],[t,i,n.length]);if(this.mod._free(i),o!==0)throw new Error(rt(this.mod,a,c));let d=rt(this.mod,a,c);return Tt(this.mod),JSON.parse(d)}createScalarFunction(t,e,n,i){let s={functionId:this._nextUDFId,name:e,returnType:Qn(n)},o={functionId:s.functionId,connectionId:t,name:e,returnType:n,func:i};this._nextUDFId+=1;let[a,c,d]=It(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(s)]);if(a!==0)throw new Error(rt(this.mod,c,d));if(Tt(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(o.functionId,o),this.pthread)for(let p of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])p.postMessage({cmd:"registerUDFFunction",udf:o})}createPrepared(t,e){let n=ti.encode(e),i=this.mod._malloc(n.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,i,n.length).set(n);let[o,a,c]=It(this.mod,"duckdb_web_prepared_create_buffer",["number","number","number"],[t,i,n.length]);if(this.mod._free(i),o!==0)throw new Error(rt(this.mod,a,c));return Tt(this.mod),a}closePrepared(t,e){let[n,i,s]=It(this.mod,"duckdb_web_prepared_close",["number","number"],[t,e]);if(n!==0)throw new Error(rt(this.mod,i,s));Tt(this.mod)}runPrepared(t,e,n){let[i,s,o]=It(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(rt(this.mod,s,o));let a=Bn(this.mod,s,o);return Tt(this.mod),a}sendPrepared(t,e,n){let[i,s,o]=It(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(rt(this.mod,s,o));let a=Bn(this.mod,s,o);return Tt(this.mod),a}insertArrowFromIPCStream(t,e,n){if(e.length==0)return;let i=this.mod._malloc(e.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,i,e.length).set(e);let o=n?JSON.stringify(n):"",[a,c,d]=It(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,i,e.length,o]);if(this.mod._free(i),a!==0)throw new Error(rt(this.mod,c,d))}insertCSVFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let d in n.columns)n.columnsFlat.push(jo(d,n.columns[d]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,c]=It(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(rt(this.mod,a,c))}insertJSONFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let d in n.columns)n.columnsFlat.push(jo(d,n.columns[d]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,c]=It(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(rt(this.mod,a,c))}globFiles(t){let[e,n,i]=It(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(e!==0)throw new Error(rt(this.mod,n,i));let s=rt(this.mod,n,i);Tt(this.mod);let o=JSON.parse(s);return o==null?[]:o}registerFileURL(t,e,n,i=!1){e===void 0&&(e=t);let[s,o,a]=It(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[t,e,n,i]);if(s!==0)throw new Error(rt(this.mod,o,a));Tt(this.mod)}registerFileText(t,e){let n=ti.encode(e);this.registerFileBuffer(t,n)}registerFileBuffer(t,e){let n=this.mod._malloc(e.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,n,e.length).set(e);let[s,o,a]=It(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,n,e.length]);if(s!==0)throw new Error(rt(this.mod,o,a));Tt(this.mod)}async prepareFileHandle(t,e){if(e===3&&this._runtime.prepareFileHandles){let n=await this._runtime.prepareFileHandles([t],3);for(let i of n){let{handle:s,path:o,fromCached:a}=i;!a&&s.getSize()&&await this.registerFileHandleAsync(o,s,3,!0)}return}throw new Error("prepareFileHandle: unsupported protocol ".concat(e))}async prepareDBFileHandle(t,e){if(e===3&&this._runtime.prepareDBFileHandle){let n=await this._runtime.prepareDBFileHandle(t,3);for(let i of n){let{handle:s,path:o,fromCached:a}=i;!a&&s.getSize()&&await this.registerFileHandleAsync(o,s,3,!0)}return}throw new Error("prepareDBFileHandle: unsupported protocol ".concat(e))}async prepareFileHandleAsync(t,e,n,i){if(n===3&&!(e instanceof FileSystemSyncAccessHandle)){if(e instanceof FileSystemFileHandle){let s=e;try{e=await s.createSyncAccessHandle()}catch(o){throw new Error(o.message+":"+t)}}else if(t!=null)try{e=await(await(await navigator.storage.getDirectory()).getFileHandle(t)).createSyncAccessHandle()}catch(s){throw new Error(s.message+":"+t)}}return e}async registerFileHandleAsync(t,e,n,i){let s=await this.prepareFileHandleAsync(t,e,n,i);this.registerFileHandle(t,s,n,i)}registerFileHandle(t,e,n,i){var c;let[s,o,a]=It(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[t,t,n,i]);if(s!==0)throw new Error(rt(this.mod,o,a));if(Tt(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,e),(c=globalThis.DUCKDB_RUNTIME._preparedHandles)!=null&&c[t]&&delete globalThis.DUCKDB_RUNTIME._preparedHandles[t],this.pthread){for(let d of this.pthread.runningWorkers)d.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:e});for(let d of this.pthread.unusedWorkers)d.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[e,n,i]=It(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(e!==0)throw new Error(rt(this.mod,n,i));Tt(this.mod)}dropFiles(t){let e=[],n=-1;try{for(let a of t!=null?t:[])if(a!=null&&a.length>0){let c=this.mod.lengthBytesUTF8(a)+1,d=this.mod._malloc(c);if(!d)throw new Error("Failed to allocate memory for string: ".concat(a));this.mod.stringToUTF8(a,d,c),e.push(d)}if(n=this.mod._malloc(e.length*4),!n)throw new Error("Failed to allocate memory for pointers array");for(let a=0;a<e.length;a++)this.mod.HEAP32[(n>>2)+a]=e[a];let[i,s,o]=It(this.mod,"duckdb_web_fs_drop_files",["number","number"],[n,e.length]);if(i!==0)throw new Error(rt(this.mod,s,o));Tt(this.mod)}finally{for(let i of e)this.mod._free(i);n>0&&this.mod._free(n)}}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,e){let[n,i,s]=It(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,e]);if(n!==0)throw new Error(rt(this.mod,i,s));Tt(this.mod)}copyFileToBuffer(t){let[e,n,i]=It(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(e!==0)throw new Error(rt(this.mod,n,i));let s=new Uint8Array(this.mod.HEAPU8.buffer,n>>>0,i),o=new Uint8Array(s.length);return o.set(s),Tt(this.mod),o}async registerOPFSFileName(t){if(t.startsWith("opfs://"))return this.prepareFileHandle(t,3);throw new Error("Not an OPFS file name: "+t)}collectFileStatistics(t,e){let[n,i,s]=It(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,e]);if(n!==0)throw new Error(rt(this.mod,i,s))}exportFileStatistics(t){let[e,n,i]=It(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(e!==0)throw new Error(rt(this.mod,n,i));return new Ko(new Uint8Array(this.mod.HEAPU8.buffer,n>>>0,i))}};var Yo=class{constructor(){this._bindings=null;this._nextMessageId=0}log(t){this.postMessage({messageId:this._nextMessageId++,requestId:0,type:"LOG",data:t},[])}sendOK(t){this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"OK",data:null},[])}failWith(t,e){let n={name:e.name,message:e.message,stack:e.stack||void 0};this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"ERROR",data:n},[])}async onMessage(t){switch(t.type){case"PING":this.sendOK(t);return;case"INSTANTIATE":this._bindings!=null&&this.failWith(t,new Error("duckdb already initialized"));try{this._bindings=await this.instantiate(t.data[0],t.data[1],e=>{this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"INSTANTIATE_PROGRESS",data:e},[])}),this.sendOK(t)}catch(e){console.log(e),this._bindings=null,this.failWith(t,e)}return;default:break}if(!this._bindings)return this.failWith(t,new Error("duckdb is not initialized"));try{switch(t.type){case"GET_VERSION":this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"VERSION_STRING",data:this._bindings.getVersion()},[]);break;case"GET_FEATURE_FLAGS":this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FEATURE_FLAGS",data:this._bindings.getFeatureFlags()},[]);break;case"RESET":this._bindings.reset(),this.sendOK(t);break;case"OPEN":{let e=t.data.path,n=!!(this._bindings.getFeatureFlags()&32);e!=null&&e.startsWith("opfs://")&&!n&&(await this._bindings.prepareDBFileHandle(e,3),t.data.useDirectIO=!0),this._bindings.open(t.data),this.sendOK(t);break}case"DROP_FILE":this._bindings.dropFile(t.data),this.sendOK(t);break;case"DROP_FILES":this._bindings.dropFiles(t.data),this.sendOK(t);break;case"FLUSH_FILES":this._bindings.flushFiles(),this.sendOK(t);break;case"CONNECT":{let e=this._bindings.connect();this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"CONNECTION_INFO",data:e.useUnsafe((n,i)=>i)},[]);break}case"DISCONNECT":this._bindings.disconnect(t.data),this.sendOK(t);break;case"CREATE_PREPARED":{let e=this._bindings.createPrepared(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"PREPARED_STATEMENT_ID",data:e},[]);break}case"CLOSE_PREPARED":{this._bindings.closePrepared(t.data[0],t.data[1]),this.sendOK(t);break}case"RUN_PREPARED":{let e=this._bindings.runPrepared(t.data[0],t.data[1],t.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT",data:e},[e.buffer]);break}case"RUN_QUERY":{let e=this._bindings.runQuery(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT",data:e},[e.buffer]);break}case"SEND_PREPARED":{let e=this._bindings.sendPrepared(t.data[0],t.data[1],t.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_HEADER",data:e},[e.buffer]);break}case"START_PENDING_QUERY":{let e=this._bindings.startPendingQuery(t.data[0],t.data[1],t.data[2]),n=[];e&&n.push(e.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:e},n);break}case"POLL_PENDING_QUERY":{let e=this._bindings.pollPendingQuery(t.data),n=[];e&&n.push(e.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:e},n);break}case"CANCEL_PENDING_QUERY":{let e=this._bindings.cancelPendingQuery(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"SUCCESS",data:e},[]);break}case"FETCH_QUERY_RESULTS":{let e=this._bindings.fetchQueryResults(t.data),n=e?[e.buffer]:[];this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_CHUNK",data:e},n);break}case"GET_TABLE_NAMES":{let e=this._bindings.getTableNames(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"TABLE_NAMES",data:e},[]);break}case"GLOB_FILE_INFOS":{let e=this._bindings.globFiles(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_INFOS",data:e},[]);break}case"REGISTER_FILE_URL":this._bindings.registerFileURL(t.data[0],t.data[1],t.data[2],t.data[3]),this.sendOK(t);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(t.data[0],t.data[1]),this.sendOK(t);break;case"REGISTER_FILE_HANDLE":await this._bindings.registerFileHandleAsync(t.data[0],t.data[1],t.data[2],t.data[3]),this.sendOK(t);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(t.data[0],t.data[1]),this.sendOK(t);break;case"COPY_FILE_TO_BUFFER":{let e=this._bindings.copyFileToBuffer(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_BUFFER",data:e},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(t.data[0],t.data[1]),this.sendOK(t);break;case"REGISTER_OPFS_FILE_NAME":{!!(this._bindings.getFeatureFlags()&32)||await this._bindings.registerOPFSFileName(t.data[0]),this.sendOK(t);break}case"EXPORT_FILE_STATISTICS":{this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_STATISTICS",data:this._bindings.exportFileStatistics(t.data)},[]);break}case"INSERT_ARROW_FROM_IPC_STREAM":{this._bindings.insertArrowFromIPCStream(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break}case"IMPORT_CSV_FROM_PATH":{this._bindings.insertCSVFromPath(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break}case"IMPORT_JSON_FROM_PATH":{this._bindings.insertJSONFromPath(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break}case"TOKENIZE":{let e=this._bindings.tokenize(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"SCRIPT_TOKENS",data:e},[]);break}}}catch(e){return console.log(e),this.failWith(t,e)}}};var Ku=zc(Gu());var Xo=class extends qo{constructor(t,e,n,i){super(t,e),this.mainModuleURL=n,this.pthreadWorkerURL=i}locateFile(t,e){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(e," path=").concat(t))}instantiateWasm(t,e){globalThis.DUCKDB_RUNTIME=this._runtime;let n=this.onInstantiationProgress;if(WebAssembly.instantiateStreaming)if(typeof TransformStream=="function"){let s=(async()=>{var ot;let o=new Request(this.mainModuleURL),a=await fetch(o),c=a.headers.get("content-length"),d=c&&parseInt(c,10)||0,p=new Date,S={startedAt:p,updatedAt:p,bytesTotal:d||0,bytesLoaded:0},A={transform(lt,Pt){S.bytesLoaded+=lt.byteLength;let Ot=new Date;if(Ot.getTime()-S.updatedAt.getTime()<20){S.updatedAt=Ot,Pt.enqueue(lt);return}for(let Bt of n)Bt(S);Pt.enqueue(lt)}},x=new TransformStream(A);return new Response((ot=a.body)==null?void 0:ot.pipeThrough(x),a)})();WebAssembly.instantiateStreaming(s,t).then(o=>{e(o.instance,o.module)})}else{console.warn("instantiating without progress handler since transform streams are unavailable");let i=new Request(this.mainModuleURL);WebAssembly.instantiateStreaming(fetch(i),t).then(s=>{e(s.instance,s.module)})}else if(typeof XMLHttpRequest=="function"){let i=new XMLHttpRequest,s=this.mainModuleURL,o=new Date,a={startedAt:o,updatedAt:o,bytesTotal:0,bytesLoaded:0};i.open("GET",s),i.responseType="arraybuffer",i.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())},i.onprogress=c=>{a.bytesTotal=c.total,a.bytesLoaded=c.loaded;let d=new Date;if(d.getTime()-a.updatedAt.getTime()<20){a.updatedAt=d;return}for(let p of n)p(a)},i.onload=()=>{WebAssembly.instantiate(i.response,t).then(c=>{e(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)})},i.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let s=new Request(this.mainModuleURL),a=await(await fetch(s)).arrayBuffer();WebAssembly.instantiate(a,t).then(c=>{e(c.instance,c.module)})})();return[]}};var Zo=class extends Xo{constructor(t,e,n,i=null){super(t,e,n,i)}instantiateImpl(t){return(0,Ku.default)({...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};var en=zc(Ju()),Xu=function(r,t,e){var n;return(n=r==null?void 0:r.endpoint)!=null&&n.startsWith("http")?new URL(r.endpoint).host:r!=null&&r.endpoint?"".concat(e,".").concat(r==null?void 0:r.endpoint):"".concat(e,".s3.amazonaws.com")};function Hm(r,t,e){var s,o,a,c;let n=Zu(t),i=n.path;if(Qu(r)){let d="";if(r!=null&&r.endpoint){let p=new URL(r.endpoint);p.pathname!=="/"&&(d=p.pathname)}i="".concat(d,"/").concat(n.bucket).concat(i)}return{url:i,query:"",host:Xu(r,t,n.bucket),region:(s=r==null?void 0:r.region)!=null?s:"",service:"s3",method:e,accessKeyId:(o=r==null?void 0:r.accessKeyId)!=null?o:"",secretAccessKey:(a=r==null?void 0:r.secretAccessKey)!=null?a:"",sessionToken:(c=r==null?void 0:r.sessionToken)!=null?c:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function zm(r,t=!1){let e="0123456789ABCDEF",n="";for(let i=0;i<r.length;i++){let s=r[i];s>="A"&&s<="Z"||s>="a"&&s<="z"||s>="0"&&s<="9"||s=="_"||s=="-"||s=="~"||s=="."?n+=s:s=="/"?t?n+="%2F":n+=s:(n+="%",n+=e[s.charCodeAt(0)>>4],n+=e[s.charCodeAt(0)&15])}return n}function jm(r,t=null){var ot;let e=(ot=t==null?void 0:t.contentHash)!=null?ot:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",n=new Map;n.set("x-amz-date",r.datetimeNow),n.set("x-amz-content-sha256",e),r.sessionToken&&n.set("x-amz-security-token",r.sessionToken);let i="";t!=null&&t.contentType&&(i+="content-type;"),i+="host;x-amz-content-sha256;x-amz-date",r.sessionToken&&(i+=";x-amz-security-token");let s=r.method+"\n"+zm(r.url)+"\n"+r.query;t!=null&&t.contentType&&(s+="\ncontent-type:"+(t==null?void 0:t.contentType)),s+="\nhost:"+r.host+"\nx-amz-content-sha256:"+e+"\nx-amz-date:"+r.datetimeNow,r.sessionToken&&r.sessionToken.length>0&&(s+="\nx-amz-security-token:"+r.sessionToken),s+="\n\n"+i+"\n"+e;let o=(0,en.sha256)(s),a="AWS4-HMAC-SHA256\n"+r.datetimeNow+"\n"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request\n"+o,c="AWS4"+r.secretAccessKey,d=en.sha256.hmac.arrayBuffer(c,r.dateNow),p=en.sha256.hmac.arrayBuffer(d,r.region),S=en.sha256.hmac.arrayBuffer(p,r.service),A=en.sha256.hmac.arrayBuffer(S,"aws4_request"),x=en.sha256.hmac(A,a);return n.set("Authorization","AWS4-HMAC-SHA256 Credential="+r.accessKeyId+"/"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request, SignedHeaders="+i+", Signature="+x),n}var Wm=function(r,t,e,n=null,i=null){let s=Hm(r,t,e),o={contentType:n,contentHash:i?en.sha256.hex(i):null};return jm(s,o)};function $e(r,t,e,n,i=null,s=null){(t!=null&&t.accessKeyId||t!=null&&t.sessionToken)&&(Wm(t,e,n,i,s).forEach((a,c)=>{r.setRequestHeader(c,a)}),i&&r.setRequestHeader("content-type",i))}function Zu(r){if(r.indexOf("s3://")!=0)throw new Error("URL needs to start with s3://");let t=r.indexOf("/",5);if(t==-1)throw new Error("URL needs to contain a '/' after the host");let e=r.substring(5,t);if(!e)throw new Error("URL needs to contain a bucket name");let n=r.substring(t);if(!n)throw new Error("URL needs to contain key");return{bucket:e,path:n}}function Qu(r){var t;return!!((t=r==null?void 0:r.endpoint)!=null&&t.startsWith("http"))}function Ge(r,t){let e=Zu(t);return Qu(r)?"".concat(r==null?void 0:r.endpoint,"/").concat(e.bucket)+e.path:"https://"+Xu(r,t,e.bucket)+e.path}var $m=7,td=/\/|\\/,Z={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,_preparedHandles:{},_opfsRoot:null,getFileInfo(r,t){try{let e=Z._fileInfoCache.get(t),[n,i,s]=It(r,"duckdb_web_fs_get_file_info_by_id",["number","number"],[t,(e==null?void 0:e.cacheEpoch)||0]);if(n!==0)return null;if(s===0)return e;let o=rt(r,i,s);Tt(r);try{let a=JSON.parse(o);if(a==null)return null;let c={...a,blob:null};return Z._fileInfoCache.set(t,c),!Z._files.has(c.fileName)&&Z._preparedHandles[c.fileName]&&(Z._files.set(c.fileName,Z._preparedHandles[c.fileName]),delete Z._preparedHandles[c.fileName]),c}catch(a){return console.warn(a),null}}catch(e){return console.log(e),null}},getGlobalFileInfo(r){var t;try{let[e,n,i]=It(r,"duckdb_web_get_global_file_info",["number"],[((t=Z._globalFileInfo)==null?void 0:t.cacheEpoch)||0]);if(e!==0)return null;if(i===0)return Z._globalFileInfo;let s=rt(r,n,i);Tt(r);let o=JSON.parse(s);return o==null?null:(Z._globalFileInfo={...o,blob:null},Z._globalFileInfo)}catch(e){return console.log(e),null}},async assignOPFSRoot(){Z._opfsRoot||(Z._opfsRoot=await navigator.storage.getDirectory())},async prepareFileHandles(r,t){if(t===3){await Z.assignOPFSRoot();let e=async i=>{if(Z._files.has(i))return{path:i,handle:Z._files.get(i),fromCached:!0};let o=Z._opfsRoot,a=i.slice($m),c=a;if(td.test(a)){let p=a.split(td);if(p.length===0)throw new Error("Invalid path ".concat(a));if(c=p[p.length-1],!c)throw new Error("Invalid path ".concat(a,". File Not Found."));p.pop();for(let S of p)o=await o.getDirectoryHandle(S,{create:!0})}let d=await o.getFileHandle(c,{create:!1}).catch(p=>{if((p==null?void 0:p.name)==="NotFoundError")return console.debug("File ".concat(i," does not exists yet, creating...")),o.getFileHandle(c,{create:!0});throw p});try{let p=await d.createSyncAccessHandle();return Z._preparedHandles[i]=p,{path:i,handle:p,fromCached:!1}}catch(p){throw new Error(p.message+":"+name)}},n=[];for(let i of r){let s=await e(i);n.push(s)}return n}throw new Error("Unsupported protocol ".concat(t," for paths ").concat(r," with protocol ").concat(t))},async prepareDBFileHandle(r,t){if(t===3&&this.prepareFileHandles){let e=[r,"".concat(r,".wal")];return this.prepareFileHandles(e,t)}throw new Error("Unsupported protocol ".concat(t," for path ").concat(r," with protocol ").concat(t))},testPlatformFeature:(r,t)=>{switch(t){case 1:return typeof BigInt64Array<"u";default:return console.warn("test for unknown feature: ".concat(t)),!1}},getDefaultDataProtocol(r){return 2},openFile:(r,t,e)=>{var n,i,s,o,a,c;try{Z._fileInfoCache.delete(t);let d=Z.getFileInfo(r,t);switch(d==null?void 0:d.dataProtocol){case 4:case 5:{if(e&1&&e&2)throw new Error("Opening file ".concat(d.fileName," failed: cannot open file with both read and write flags set"));if(e&32)throw new Error("Opening file ".concat(d.fileName," failed: appending to HTTP/S3 files is not supported"));if(e&2){let A=new XMLHttpRequest;if(d.dataProtocol==5?(A.open("HEAD",Ge(d.s3Config,d.dataUrl),!1),$e(A,d.s3Config,d.dataUrl,"HEAD")):A.open("HEAD",d.dataUrl,!1),A.send(null),A.status!=200&&A.status!=404)throw new Error("Opening file ".concat(d.fileName," failed: Unexpected return status from server (").concat(A.status,")"));if(A.status==404&&!(e&8||e&16))throw new Error("Opening file ".concat(d.fileName," failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag."));let x=r._malloc(1),ot=new Uint8Array;r.HEAPU8.set(ot,x);let lt=r._malloc(3*8);return r.HEAPF64[(lt>>3)+0]=1,r.HEAPF64[(lt>>3)+1]=x,r.HEAPF64[(lt>>3)+2]=new Date().getTime()/1e3,lt}else if(!(e&1))throw new Error("Opening file ".concat(d.fileName," failed: unsupported file flags: ").concat(e));let p=null,S=null;if(!d.forceFullHttpReads&&(d.reliableHeadRequests||!d.allowFullHttpReads))try{let A=new XMLHttpRequest;d.dataProtocol==5?(A.open("HEAD",Ge(d.s3Config,d.dataUrl),!1),$e(A,d.s3Config,d.dataUrl,"HEAD")):A.open("HEAD",d.dataUrl,!1),A.setRequestHeader("Range","bytes=0-"),A.send(null),p=null;try{p=A.getResponseHeader("Content-Length")}catch(x){console.warn("Failed to get Content-Length on request")}if(p!==null&&A.status==206){let x=r._malloc(24);r.HEAPF64[(x>>3)+0]=+p,r.HEAPF64[(x>>3)+1]=0;let ot=0;try{ot=new Date((n=A.getResponseHeader("Last-Modified"))!=null?n:"").getTime()/1e3}catch(lt){console.warn("Failed to get Last-Modified on request")}return r.HEAPF64[(x>>3)+2]=+ot,x}}catch(A){S=A,console.warn("HEAD request with range header failed: ".concat(A))}if(d.allowFullHttpReads){if(!d.forceFullHttpReads){let x=new XMLHttpRequest;d.dataProtocol==5?(x.open("GET",Ge(d.s3Config,d.dataUrl),!1),$e(x,d.s3Config,d.dataUrl,"GET")):x.open("GET",d.dataUrl,!1),x.responseType="arraybuffer",x.setRequestHeader("Range","bytes=0-0"),x.send(null);let ot=null;try{ot=x.getResponseHeader("Content-Length")}catch(Bt){console.warn("Failed to get Content-Length on request")}let lt=ot==null?void 0:ot.split("/")[1],Pt=ot,Ot=null;if(lt!==void 0)Ot=lt;else if(!d.reliableHeadRequests){let Bt=new XMLHttpRequest;d.dataProtocol==5?(Bt.open("HEAD",Ge(d.s3Config,d.dataUrl),!1),$e(Bt,d.s3Config,d.dataUrl,"HEAD")):Bt.open("HEAD",d.dataUrl,!1),Bt.setRequestHeader("Range","bytes=0-"),Bt.send(null),p=null;try{p=Bt.getResponseHeader("Content-Length")}catch(bt){console.warn("Failed to get Content-Length on request")}p!==null&&+p>1&&(Ot=p)}if(x.status==206&&Pt!==null&&+Pt==1&&Ot!==null){let Bt=r._malloc(24);r.HEAPF64[(Bt>>3)+0]=+Ot,r.HEAPF64[(Bt>>3)+1]=0;let bt=0;try{bt=new Date((i=x.getResponseHeader("Last-Modified"))!=null?i:"").getTime()/1e3}catch(Qt){console.warn("Failed to get Last-Modified on request")}return r.HEAPF64[(Bt>>3)+2]=+bt,Bt}if(x.status==200&&Pt!==null&&p!==null&&+Pt==+p){console.warn("fall back to full HTTP read for: ".concat(d.dataUrl));let Bt=r._malloc(x.response.byteLength),bt=new Uint8Array(x.response,0,x.response.byteLength);r.HEAPU8.set(bt,Bt);let Qt=r._malloc(3*8);r.HEAPF64[(Qt>>3)+0]=x.response.byteLength,r.HEAPF64[(Qt>>3)+1]=Bt;let Gt=0;try{Gt=new Date((s=x.getResponseHeader("Last-Modified"))!=null?s:"").getTime()/1e3}catch(_){console.warn("Failed to get Last-Modified on request")}return r.HEAPF64[(Qt>>3)+2]=+Gt,Qt}console.warn("falling back to full HTTP read for: ".concat(d.dataUrl))}let A=new XMLHttpRequest;if(d.dataProtocol==5?(A.open("GET",Ge(d.s3Config,d.dataUrl),!1),$e(A,d.s3Config,d.dataUrl,"GET")):A.open("GET",d.dataUrl,!1),A.responseType="arraybuffer",A.send(null),A.status==200){let x=r._malloc(A.response.byteLength),ot=new Uint8Array(A.response,0,A.response.byteLength);r.HEAPU8.set(ot,x);let lt=r._malloc(3*8);r.HEAPF64[(lt>>3)+0]=A.response.byteLength,r.HEAPF64[(lt>>3)+1]=x;let Pt=0;try{Pt=new Date((o=A.getResponseHeader("Last-Modified"))!=null?o:"").getTime()/1e3}catch(Ot){console.warn("Failed to get Last-Modified on request")}return r.HEAPF64[(lt>>3)+2]=+Pt,lt}}if(S!=null)throw new Error("Reading file ".concat(d.fileName," failed with error: ").concat(S));return 0}case 2:{let p=(a=Z._files)==null?void 0:a.get(d.fileName);if(p){let x=r._malloc(24);return r.HEAPF64[(x>>3)+0]=p.size,r.HEAPF64[(x>>3)+1]=0,r.HEAPF64[(x>>3)+2]=0,x}if(e&128)return 0;console.warn("Buffering missing file: ".concat(d.fileName));let S=r._malloc(3*8),A=r._malloc(1);return r.HEAPF64[(S>>3)+0]=1,r.HEAPF64[(S>>3)+1]=A,r.HEAPF64[(S>>3)+2]=0,S}case 3:{let p=(c=Z._files)==null?void 0:c.get(d.fileName);if(!p)throw new Error("No OPFS access handle registered with name: ".concat(d.fileName));e&16&&p.truncate(0);let S=r._malloc(3*8),A=p.getSize();return r.HEAPF64[(S>>3)+0]=A,r.HEAPF64[(S>>3)+1]=0,r.HEAPF64[(S>>3)+2]=0,S}}}catch(d){console.error(d.toString()),We(r,d.toString())}return 0},glob:(r,t,e)=>{var n;try{let i=rt(r,t,e);if(i.startsWith("http")||i.startsWith("s3://")){let s=new XMLHttpRequest;if(i.startsWith("s3://")){let o=Z.getGlobalFileInfo(r);s.open("HEAD",Ge(o==null?void 0:o.s3Config,i),!1),$e(s,o==null?void 0:o.s3Config,i,"HEAD")}else s.open("HEAD",i,!1);if(s.send(null),s.status!=200&&s.status!==206){if(!((n=Z.getGlobalFileInfo(r))!=null&&n.allowFullHttpReads))return console.log("HEAD request failed: ".concat(i,", with full http reads are disabled")),0;let o=new XMLHttpRequest;if(i.startsWith("s3://")){let c=Z.getGlobalFileInfo(r);o.open("GET",Ge(c==null?void 0:c.s3Config,i),!1),$e(o,c==null?void 0:c.s3Config,i,"HEAD")}else o.open("GET",i,!1);if(o.setRequestHeader("Range","bytes=0-0"),o.send(null),o.status!=200&&o.status!==206)return console.log("HEAD and GET requests failed: ".concat(i)),0;let a=null;try{a=o.getResponseHeader("Content-Length")}catch(c){console.warn("Failed to get Content-Length on request")}a&&+a>1&&console.warn("Range request for ".concat(i," did not return a partial response: ").concat(o.status,' "').concat(o.statusText,'"'))}r.ccall("duckdb_web_fs_glob_add_path",null,["string"],[i])}else for(let[s]of Z._files.entries()||[])s.startsWith(i)&&r.ccall("duckdb_web_fs_glob_add_path",null,["string"],[s])}catch(i){return console.log(i),We(r,i.toString()),0}},checkFile:(r,t,e)=>{try{let n=rt(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=Z.getGlobalFileInfo(r);i.open("HEAD",Ge(s==null?void 0:s.s3Config,n),!1),$e(i,s==null?void 0:s.s3Config,n,"HEAD")}else i.open("HEAD",n,!1);return i.send(null),i.status==206||i.status==200}else return Z._files.has(n)}catch(n){return console.log(n),!1}return!1},syncFile:(r,t)=>{},closeFile:(r,t)=>{var n;let e=Z.getFileInfo(r,t);Z._fileInfoCache.delete(t);try{switch(e==null?void 0:e.dataProtocol){case 0:case 4:case 5:break;case 1:case 2:return;case 3:{let i=(n=Z._files)==null?void 0:n.get(e.fileName);if(!i)throw new Error("No OPFS access handle registered with name: ".concat(e.fileName));return i.flush()}}}catch(i){console.log(i),We(r,i.toString())}},dropFile:(r,t,e)=>{var s;let n=rt(r,t,e),i=(s=Z._files)==null?void 0:s.get(n);if(i){if(Z._files.delete(n),i instanceof FileSystemSyncAccessHandle)try{i.flush(),i.close()}catch(o){throw new Error("Cannot drop file with name: ".concat(n))}i instanceof Blob}},truncateFile:(r,t,e)=>{var i;let n=Z.getFileInfo(r,t);switch(n==null?void 0:n.dataProtocol){case 4:We(r,"Cannot truncate a http file");return;case 5:We(r,"Cannot truncate an s3 file");return;case 0:case 1:case 2:We(r,"truncateFile not implemented");return;case 3:{let s=(i=Z._files)==null?void 0:i.get(n.fileName);if(!s)throw new Error("No OPFS access handle registered with name: ".concat(n.fileName));return s.truncate(e)}}return 0},readFile(r,t,e,n,i){var s;if(n==0)return 0;try{let o=Z.getFileInfo(r,t);switch(o==null?void 0:o.dataProtocol){case 4:case 5:{if(!o.dataUrl)throw new Error("Missing data URL for file ".concat(t));try{let a=new XMLHttpRequest;if(o.dataProtocol==5?(a.open("GET",Ge(o==null?void 0:o.s3Config,o.dataUrl),!1),$e(a,o==null?void 0:o.s3Config,o.dataUrl,"GET")):a.open("GET",o.dataUrl,!1),a.responseType="arraybuffer",a.setRequestHeader("Range","bytes=".concat(i,"-").concat(i+n-1)),a.send(null),a.status==206||a.status==200&&n==a.response.byteLength&&i==0){let c=new Uint8Array(a.response,0,Math.min(a.response.byteLength,n));return r.HEAPU8.set(c,e),c.byteLength}else if(a.status==200){console.warn("Range request for ".concat(o.dataUrl," did not return a partial response: ").concat(a.status,' "').concat(a.statusText,'"'));let c=new Uint8Array(a.response,i,Math.min(a.response.byteLength-i,n));return r.HEAPU8.set(c,e),c.byteLength}else throw new Error("Range request for ".concat(o.dataUrl," did returned non-success status: ").concat(a.status,' "').concat(a.statusText,'"'))}catch(a){throw console.log(a),new Error("Range request for ".concat(o.dataUrl," failed with error: ").concat(a,'"'))}}case 2:{let a=(s=Z._files)==null?void 0:s.get(o.fileName);if(!a)throw new Error("No HTML5 file registered with name: ".concat(o.fileName));let c=a.slice(i,i+n),d=new Uint8Array(new FileReaderSync().readAsArrayBuffer(c));return r.HEAPU8.set(d,e),d.byteLength}case 3:{let a=Z._files.get(o.fileName);if(!a)throw new Error("No OPFS access handle registered with name: ".concat(o.fileName));let c=r.HEAPU8.subarray(e,e+n);return a.read(c,{at:i})}}return 0}catch(o){return console.log(o),We(r,o.toString()),0}},writeFile:(r,t,e,n,i)=>{var o;let s=Z.getFileInfo(r,t);switch(s==null?void 0:s.dataProtocol){case 4:return We(r,"Cannot write to HTTP file"),0;case 5:{let a=r.HEAPU8.subarray(e,e+n),c=new XMLHttpRequest;return c.open("PUT",Ge(s==null?void 0:s.s3Config,s.dataUrl),!1),$e(c,s==null?void 0:s.s3Config,s.dataUrl,"PUT","",a),c.send(a),c.status!==200?(We(r,"Failed writing file: HTTP "+c.status),0):n}case 2:return We(r,"cannot write using the html5 file reader api"),0;case 3:{let a=(o=Z._files)==null?void 0:o.get(s.fileName);if(!a)throw new Error("No OPFS access handle registered with name: ".concat(s.fileName));let c=r.HEAPU8.subarray(e,e+n);return a.write(c,{at:i})}}return 0},getLastFileModificationTime:(r,t)=>{var n;let e=Z.getFileInfo(r,t);switch(e==null?void 0:e.dataProtocol){case 2:{if(!((n=Z._files)==null?void 0:n.get(e.fileName)))throw Error("No handle available for file: ".concat(e.fileName));return 0}case 4:case 5:return new Date().getTime()/1e3}return 0},progressUpdate:(r,t,e)=>{postMessage&&postMessage({requestId:0,type:"PROGRESS_UPDATE",data:{status:r?"completed":"in-progress",percentage:t,repetitions:e}})},checkDirectory:(r,t,e)=>{let n=rt(r,t,e);return console.log("checkDirectory: ".concat(n)),!1},createDirectory:(r,t,e)=>{let n=rt(r,t,e);console.log("createDirectory: ".concat(n))},removeDirectory:(r,t,e)=>{let n=rt(r,t,e);console.log("removeDirectory: ".concat(n))},listDirectoryEntries:(r,t,e)=>{let n=rt(r,t,e);return console.log("listDirectoryEntries: ".concat(n)),!1},moveFile:(r,t,e,n,i)=>{var c,d;let s=rt(r,t,e),o=rt(r,n,i),a=(c=Z._files)==null?void 0:c.get(s);a!==void 0&&(Z._files.delete(a),Z._files.set(o,a));for(let[p,S]of((d=Z._fileInfoCache)==null?void 0:d.entries())||[])if(S.dataUrl==s){Z._fileInfoCache.delete(p);break}return!0},removeFile:(r,t,e)=>{},callScalarUDF:(r,t,e,n,i,s,o)=>{zu(Z,r,t,e,n,i,s,o)}};var pc=class extends Yo{postMessage(t,e){globalThis.postMessage(t,e)}async instantiate(t,e,n){return await new Zo(this,Z,t,e).instantiate(n)}};function ed(){let r=new pc;globalThis.onmessage=async t=>{await r.onMessage(t.data)}}ed();return yh(Gm);})();
|
|
2
|
-
/*! Bundled license information:
|
|
3
|
-
|
|
4
|
-
js-sha256/src/sha256.js:
|
|
5
|
-
(**
|
|
6
|
-
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
7
|
-
*
|
|
8
|
-
* @version 0.11.1
|
|
9
|
-
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
10
|
-
* @copyright Chen, Yi-Cyuan 2014-2025
|
|
11
|
-
* @license MIT
|
|
12
|
-
*)
|
|
13
|
-
*/
|
|
14
|
-
//# sourceMappingURL=duckdb-browser-eh.worker.js.map
|