@duckdb/duckdb-wasm 1.15.0 → 1.16.0

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.
Files changed (40) hide show
  1. package/dist/duckdb-browser-blocking.cjs +10 -10
  2. package/dist/duckdb-browser-blocking.cjs.map +2 -2
  3. package/dist/duckdb-browser-blocking.mjs +10 -10
  4. package/dist/duckdb-browser-blocking.mjs.map +2 -2
  5. package/dist/duckdb-browser-coi.pthread.worker.js +6 -6
  6. package/dist/duckdb-browser-coi.pthread.worker.js.map +2 -2
  7. package/dist/duckdb-browser-coi.worker.js +8 -8
  8. package/dist/duckdb-browser-coi.worker.js.map +2 -2
  9. package/dist/duckdb-browser-eh.worker.js +7 -7
  10. package/dist/duckdb-browser-eh.worker.js.map +2 -2
  11. package/dist/duckdb-browser-mvp.worker.js +7 -7
  12. package/dist/duckdb-browser-mvp.worker.js.map +2 -2
  13. package/dist/duckdb-browser.cjs +1 -1
  14. package/dist/duckdb-browser.cjs.map +2 -2
  15. package/dist/duckdb-browser.mjs +1 -1
  16. package/dist/duckdb-browser.mjs.map +2 -2
  17. package/dist/duckdb-coi.wasm +0 -0
  18. package/dist/duckdb-eh.wasm +0 -0
  19. package/dist/duckdb-mvp.wasm +0 -0
  20. package/dist/duckdb-node-blocking.cjs +4 -4
  21. package/dist/duckdb-node-blocking.cjs.map +2 -2
  22. package/dist/duckdb-node-eh.worker.cjs +4 -4
  23. package/dist/duckdb-node-eh.worker.cjs.map +2 -2
  24. package/dist/duckdb-node-mvp.worker.cjs +3 -3
  25. package/dist/duckdb-node-mvp.worker.cjs.map +2 -2
  26. package/dist/duckdb-node.cjs +1 -1
  27. package/dist/duckdb-node.cjs.map +2 -2
  28. package/dist/tests-browser.js +384 -257
  29. package/dist/tests-browser.js.map +2 -2
  30. package/dist/tests-node.cjs +383 -256
  31. package/dist/tests-node.cjs.map +2 -2
  32. package/dist/types/src/bindings/bindings_base.d.ts +11 -2
  33. package/dist/types/src/bindings/bindings_interface.d.ts +3 -1
  34. package/dist/types/src/bindings/config.d.ts +4 -0
  35. package/dist/types/src/bindings/connection.d.ts +3 -1
  36. package/dist/types/src/parallel/async_bindings.d.ts +6 -2
  37. package/dist/types/src/parallel/async_bindings_interface.d.ts +3 -1
  38. package/dist/types/src/parallel/async_connection.d.ts +2 -0
  39. package/dist/types/src/parallel/worker_request.d.ts +9 -6
  40. package/package.json +4 -4
@@ -1,15 +1,15 @@
1
- "use strict";var duckdb=(()=>{var Ih=Object.create;var as=Object.defineProperty;var Ah=Object.getOwnPropertyDescriptor;var Fh=Object.getOwnPropertyNames;var xh=Object.getPrototypeOf,Bh=Object.prototype.hasOwnProperty;var Th=(r=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(r,{get:(t,e)=>(typeof require!="undefined"?require:t)[e]}):r)(function(r){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var cs=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),cn=(r,t)=>{for(var e in t)as(r,e,{get:t[e],enumerable:!0})},Mc=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Fh(t))!Bh.call(r,i)&&i!==e&&as(r,i,{get:()=>t[i],enumerable:!(n=Ah(t,i))||n.enumerable});return r};var Rc=(r,t,e)=>(e=r!=null?Ih(xh(r)):{},Mc(t||!r||!r.__esModule?as(e,"default",{value:r,enumerable:!0}):e,r)),Dh=r=>Mc(as({},"__esModule",{value:!0}),r);var tl=cs((Ay,ds)=>{var Uc,Nc,kc,Lc,Cc,Pc,Vc,Hc,zc,ls,na,jc,Wc,$c,Fn,Yc,Xc,Gc,Kc,Jc,qc,Zc,Qc,us;(function(r){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){r(e(t,e(n)))}):typeof ds=="object"&&typeof ds.exports=="object"?r(e(t,e(ds.exports))):r(e(t));function e(n,i){return n!==t&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(s,o){return n[s]=i?i(s,o):o}}})(function(r){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])};Uc=function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");t(n,i);function s(){this.constructor=n}n.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)},Nc=Object.assign||function(n){for(var i,s=1,o=arguments.length;s<o;s++){i=arguments[s];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])}return n},kc=function(n,i){var s={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.indexOf(o)<0&&(s[o]=n[o]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,o=Object.getOwnPropertySymbols(n);a<o.length;a++)i.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(n,o[a])&&(s[o[a]]=n[o[a]]);return s},Lc=function(n,i,s,o){var a=arguments.length,c=a<3?i:o===null?o=Object.getOwnPropertyDescriptor(i,s):o,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(n,i,s,o);else for(var p=n.length-1;p>=0;p--)(d=n[p])&&(c=(a<3?d(c):a>3?d(i,s,c):d(i,s))||c);return a>3&&c&&Object.defineProperty(i,s,c),c},Cc=function(n,i){return function(s,o){i(s,o,n)}},Pc=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},Vc=function(n,i,s,o){function a(c){return c instanceof s?c:new s(function(d){d(c)})}return new(s||(s=Promise))(function(c,d){function p(S){try{y(o.next(S))}catch(J){d(J)}}function b(S){try{y(o.throw(S))}catch(J){d(J)}}function y(S){S.done?c(S.value):a(S.value).then(p,b)}y((o=o.apply(n,i||[])).next())})},Hc=function(n,i){var s={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},o,a,c,d;return d={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function p(y){return function(S){return b([y,S])}}function b(y){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,a&&(c=y[0]&2?a.return:y[0]?a.throw||((c=a.return)&&c.call(a),0):a.next)&&!(c=c.call(a,y[1])).done)return c;switch(a=0,c&&(y=[y[0]&2,c.value]),y[0]){case 0:case 1:c=y;break;case 4:return s.label++,{value:y[1],done:!1};case 5:s.label++,a=y[1],y=[0];continue;case 7:y=s.ops.pop(),s.trys.pop();continue;default:if(c=s.trys,!(c=c.length>0&&c[c.length-1])&&(y[0]===6||y[0]===2)){s=0;continue}if(y[0]===3&&(!c||y[1]>c[0]&&y[1]<c[3])){s.label=y[1];break}if(y[0]===6&&s.label<c[1]){s.label=c[1],c=y;break}if(c&&s.label<c[2]){s.label=c[2],s.ops.push(y);break}c[2]&&s.ops.pop(),s.trys.pop();continue}y=i.call(n,s)}catch(S){y=[6,S],a=0}finally{o=c=0}if(y[0]&5)throw y[1];return{value:y[0]?y[1]:void 0,done:!0}}},zc=function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&us(i,n,s)},us=Object.create?function(n,i,s,o){o===void 0&&(o=s),Object.defineProperty(n,o,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]},ls=function(n){var i=typeof Symbol=="function"&&Symbol.iterator,s=i&&n[i],o=0;if(s)return s.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},na=function(n,i){var s=typeof Symbol=="function"&&n[Symbol.iterator];if(!s)return n;var o=s.call(n),a,c=[],d;try{for(;(i===void 0||i-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(p){d={error:p}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(d)throw d.error}}return c},jc=function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(na(arguments[i]));return n},Wc=function(){for(var n=0,i=0,s=arguments.length;i<s;i++)n+=arguments[i].length;for(var o=Array(n),a=0,i=0;i<s;i++)for(var c=arguments[i],d=0,p=c.length;d<p;d++,a++)o[a]=c[d];return o},$c=function(n,i,s){if(s||arguments.length===2)for(var o=0,a=i.length,c;o<a;o++)(c||!(o in i))&&(c||(c=Array.prototype.slice.call(i,0,o)),c[o]=i[o]);return n.concat(c||Array.prototype.slice.call(i))},Fn=function(n){return this instanceof Fn?(this.v=n,this):new Fn(n)},Yc=function(n,i,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=s.apply(n,i||[]),a,c=[];return a={},d("next"),d("throw"),d("return"),a[Symbol.asyncIterator]=function(){return this},a;function d(q){o[q]&&(a[q]=function(ot){return new Promise(function(St,Qt){c.push([q,ot,St,Qt])>1||p(q,ot)})})}function p(q,ot){try{b(o[q](ot))}catch(St){J(c[0][3],St)}}function b(q){q.value instanceof Fn?Promise.resolve(q.value.v).then(y,S):J(c[0][2],q)}function y(q){p("next",q)}function S(q){p("throw",q)}function J(q,ot){q(ot),c.shift(),c.length&&p(c[0][0],c[0][1])}},Xc=function(n){var i,s;return i={},o("next"),o("throw",function(a){throw a}),o("return"),i[Symbol.iterator]=function(){return this},i;function o(a,c){i[a]=n[a]?function(d){return(s=!s)?{value:Fn(n[a](d)),done:a==="return"}:c?c(d):d}:c}},Gc=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n[Symbol.asyncIterator],s;return i?i.call(n):(n=typeof ls=="function"?ls(n):n[Symbol.iterator](),s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s);function o(c){s[c]=n[c]&&function(d){return new Promise(function(p,b){d=n[c](d),a(p,b,d.done,d.value)})}}function a(c,d,p,b){Promise.resolve(b).then(function(y){c({value:y,done:p})},d)}},Kc=function(n,i){return Object.defineProperty?Object.defineProperty(n,"raw",{value:i}):n.raw=i,n};var e=Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i};Jc=function(n){if(n&&n.__esModule)return n;var i={};if(n!=null)for(var s in n)s!=="default"&&Object.prototype.hasOwnProperty.call(n,s)&&us(i,n,s);return e(i,n),i},qc=function(n){return n&&n.__esModule?n:{default:n}},Zc=function(n,i,s,o){if(s==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?n!==i||!o:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?o:s==="a"?o.call(n):o?o.value:i.get(n)},Qc=function(n,i,s,o,a){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?n!==i||!a:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?a.call(n,s):a?a.value=s:i.set(n,s),s},r("__extends",Uc),r("__assign",Nc),r("__rest",kc),r("__decorate",Lc),r("__param",Cc),r("__metadata",Pc),r("__awaiter",Vc),r("__generator",Hc),r("__exportStar",zc),r("__createBinding",us),r("__values",ls),r("__read",na),r("__spread",jc),r("__spreadArrays",Wc),r("__spreadArray",$c),r("__await",Fn),r("__asyncGenerator",Yc),r("__asyncDelegator",Xc),r("__asyncValues",Gc),r("__makeTemplateObject",Kc),r("__importStar",Jc),r("__importDefault",qc),r("__classPrivateFieldGet",Zc),r("__classPrivateFieldSet",Qc)})});var ec=cs(()=>{});var Vu=cs(()=>{});var Xu=cs((exports,module)=>{(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(r){return Object.prototype.toString.call(r)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(r){return typeof r=="object"&&r.buffer&&r.buffer.constructor===ArrayBuffer});var createOutputMethod=function(r,t){return function(e){return new Sha256(t,!0).update(e)[r]()}},createMethod=function(r){var t=createOutputMethod("hex",r);NODE_JS&&(t=nodeWrap(t,r)),t.create=function(){return new Sha256(r)},t.update=function(i){return t.create().update(i)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createOutputMethod(n,r)}return t},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(r){if(typeof r=="string")return crypto.createHash(algorithm).update(r,"utf8").digest("hex");if(r==null)throw new Error(ERROR);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),Array.isArray(r)||ArrayBuffer.isView(r)||r.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(r)).digest("hex"):method(r)};return nodeMethod},createHmacOutputMethod=function(r,t){return function(e,n){return new HmacSha256(e,t,!0).update(n)[r]()}},createHmacMethod=function(r){var t=createHmacOutputMethod("hex",r);t.create=function(i){return new HmacSha256(i,r)},t.update=function(i,s){return t.create(i).update(s)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createHmacOutputMethod(n,r)}return t};function Sha256(r,t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r?(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=r}Sha256.prototype.update=function(r){if(!this.finalized){var t,e=typeof r;if(e!=="string"){if(e==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);t=!0}for(var n,i=0,s,o=r.length,a=this.blocks;i<o;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),t)for(s=this.start;i<o&&s<64;++i)a[s>>2]|=r[i]<<SHIFT[s++&3];else for(s=this.start;i<o&&s<64;++i)n=r.charCodeAt(i),n<128?a[s>>2]|=n<<SHIFT[s++&3]:n<2048?(a[s>>2]|=(192|n>>6)<<SHIFT[s++&3],a[s>>2]|=(128|n&63)<<SHIFT[s++&3]):n<55296||n>=57344?(a[s>>2]|=(224|n>>12)<<SHIFT[s++&3],a[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],a[s>>2]|=(128|n&63)<<SHIFT[s++&3]):(n=65536+((n&1023)<<10|r.charCodeAt(++i)&1023),a[s>>2]|=(240|n>>18)<<SHIFT[s++&3],a[s>>2]|=(128|n>>12&63)<<SHIFT[s++&3],a[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],a[s>>2]|=(128|n&63)<<SHIFT[s++&3]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=a[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var r=this.blocks,t=this.lastByteIndex;r[16]=this.block,r[t>>2]|=EXTRA[t&3],this.block=r[16],t>=56&&(this.hashed||this.hash(),r[0]=this.block,r[16]=r[1]=r[2]=r[3]=r[4]=r[5]=r[6]=r[7]=r[8]=r[9]=r[10]=r[11]=r[12]=r[13]=r[14]=r[15]=0),r[14]=this.hBytes<<3|this.bytes>>>29,r[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,c=this.blocks,d,p,b,y,S,J,q,ot,St,Qt,se;for(d=16;d<64;++d)S=c[d-15],p=(S>>>7|S<<25)^(S>>>18|S<<14)^S>>>3,S=c[d-2],b=(S>>>17|S<<15)^(S>>>19|S<<13)^S>>>10,c[d]=c[d-16]+p+c[d-7]+b<<0;for(se=t&e,d=0;d<64;d+=4)this.first?(this.is224?(ot=300032,S=c[0]-1413257819,a=S-150054599<<0,n=S+24177077<<0):(ot=704751109,S=c[0]-210244248,a=S-1521486534<<0,n=S+143694565<<0),this.first=!1):(p=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),b=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),ot=r&t,y=ot^r&e^se,q=i&s^~i&o,S=a+b+q+K[d]+c[d],J=p+y,a=n+S<<0,n=S+J<<0),p=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),b=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),St=n&r,y=St^n&t^ot,q=a&i^~a&s,S=o+b+q+K[d+1]+c[d+1],J=p+y,o=e+S<<0,e=S+J<<0,p=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),b=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),Qt=e&n,y=Qt^e&r^St,q=o&a^~o&i,S=s+b+q+K[d+2]+c[d+2],J=p+y,s=t+S<<0,t=S+J<<0,p=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),b=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),se=t&e,y=se^t&n^Qt,q=s&o^~s&a,S=i+b+q+K[d+3]+c[d+3],J=p+y,i=r+S<<0,r=S+J<<0;this.h0=this.h0+r<<0,this.h1=this.h1+t<<0,this.h2=this.h2+e<<0,this.h3=this.h3+n<<0,this.h4=this.h4+i<<0,this.h5=this.h5+s<<0,this.h6=this.h6+o<<0,this.h7=this.h7+a<<0},Sha256.prototype.hex=function(){this.finalize();var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,c=HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15];return this.is224||(c+=HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]),c},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,c=[r>>24&255,r>>16&255,r>>8&255,r&255,t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,i>>24&255,i>>16&255,i>>8&255,i&255,s>>24&255,s>>16&255,s>>8&255,s&255,o>>24&255,o>>16&255,o>>8&255,o&255];return this.is224||c.push(a>>24&255,a>>16&255,a>>8&255,a&255),c},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var r=new ArrayBuffer(this.is224?28:32),t=new DataView(r);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),r};function HmacSha256(r,t,e){var n,i=typeof r;if(i==="string"){var s=[],o=r.length,a=0,c;for(n=0;n<o;++n)c=r.charCodeAt(n),c<128?s[a++]=c:c<2048?(s[a++]=192|c>>6,s[a++]=128|c&63):c<55296||c>=57344?(s[a++]=224|c>>12,s[a++]=128|c>>6&63,s[a++]=128|c&63):(c=65536+((c&1023)<<10|r.charCodeAt(++n)&1023),s[a++]=240|c>>18,s[a++]=128|c>>12&63,s[a++]=128|c>>6&63,s[a++]=128|c&63);r=s}else if(i==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);r.length>64&&(r=new Sha256(t,!0).update(r).array());var d=[],p=[];for(n=0;n<64;++n){var b=r[n]||0;d[n]=92^b,p[n]=54^b}Sha256.call(this,t,e),this.update(p),this.oKeyPad=d,this.inner=!0,this.sharedMemory=e}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var r=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(r),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var wy={};cn(wy,{registerWorker:()=>Ju});var el=Rc(tl(),1),{__extends:Fy,__assign:xy,__rest:rl,__decorate:By,__param:Ty,__metadata:Dy,__awaiter:I,__generator:Ey,__exportStar:Oy,__createBinding:My,__values:Ry,__read:Uy,__spread:Ny,__spreadArrays:ky,__spreadArray:Ly,__await:W,__asyncGenerator:ae,__asyncDelegator:xn,__asyncValues:De,__makeTemplateObject:Cy,__importStar:Py,__importDefault:Vy,__classPrivateFieldGet:Hy,__classPrivateFieldSet:zy}=el.default;var la={};cn(la,{compareArrayLike:()=>ca,joinUint8Arrays:()=>we,memcpy:()=>Tn,rebaseValueOffsets:()=>ui,toArrayBufferView:()=>$,toArrayBufferViewAsyncIterator:()=>Ve,toArrayBufferViewIterator:()=>er,toBigInt64Array:()=>kh,toBigUint64Array:()=>Ph,toFloat32Array:()=>Vh,toFloat32ArrayAsyncIterator:()=>rp,toFloat32ArrayIterator:()=>Gh,toFloat64Array:()=>Hh,toFloat64ArrayAsyncIterator:()=>np,toFloat64ArrayIterator:()=>Kh,toInt16Array:()=>Nh,toInt16ArrayAsyncIterator:()=>Zh,toInt16ArrayIterator:()=>Wh,toInt32Array:()=>ln,toInt32ArrayAsyncIterator:()=>Qh,toInt32ArrayIterator:()=>$h,toInt8Array:()=>Uh,toInt8ArrayAsyncIterator:()=>qh,toInt8ArrayIterator:()=>jh,toUint16Array:()=>Lh,toUint16ArrayAsyncIterator:()=>tp,toUint16ArrayIterator:()=>Yh,toUint32Array:()=>Ch,toUint32ArrayAsyncIterator:()=>ep,toUint32ArrayIterator:()=>Xh,toUint8Array:()=>N,toUint8ArrayAsyncIterator:()=>aa,toUint8ArrayIterator:()=>oa,toUint8ClampedArray:()=>zh,toUint8ClampedArrayAsyncIterator:()=>ip,toUint8ClampedArrayIterator:()=>Jh});var Eh=new TextDecoder("utf-8"),ai=r=>Eh.decode(r),Oh=new TextEncoder,Pr=r=>Oh.encode(r);var[$y,fs]=(()=>{let r=()=>{throw new Error("BigInt is not available in this environment")};function t(){throw r()}return t.asIntN=()=>{throw r()},t.asUintN=()=>{throw r()},typeof BigInt<"u"?[BigInt,!0]:[t,!1]})(),[ci,Yy]=(()=>{let r=()=>{throw new Error("BigInt64Array is not available in this environment")};class t{static get BYTES_PER_ELEMENT(){return 8}static of(){throw r()}static from(){throw r()}constructor(){throw r()}}return typeof BigInt64Array<"u"?[BigInt64Array,!0]:[t,!1]})(),[Bn,Xy]=(()=>{let r=()=>{throw new Error("BigUint64Array is not available in this environment")};class t{static get BYTES_PER_ELEMENT(){return 8}static of(){throw r()}static from(){throw r()}constructor(){throw r()}}return typeof BigUint64Array<"u"?[BigUint64Array,!0]:[t,!1]})();var Mh=r=>typeof r=="number",nl=r=>typeof r=="boolean",Mt=r=>typeof r=="function",ee=r=>r!=null&&Object(r)===r,Ce=r=>ee(r)&&Mt(r.then);var Pe=r=>ee(r)&&Mt(r[Symbol.iterator]),Ee=r=>ee(r)&&Mt(r[Symbol.asyncIterator]),hs=r=>ee(r)&&ee(r.schema);var ps=r=>ee(r)&&"done"in r&&"value"in r;var ms=r=>ee(r)&&Mt(r.stat)&&Mh(r.fd);var ys=r=>ee(r)&&li(r.body),_s=r=>"_getDOMStream"in r&&"_getNodeStream"in r,il=r=>ee(r)&&Mt(r.abort)&&Mt(r.getWriter)&&!_s(r),li=r=>ee(r)&&Mt(r.cancel)&&Mt(r.getReader)&&!_s(r),sl=r=>ee(r)&&Mt(r.end)&&Mt(r.write)&&nl(r.writable)&&!_s(r),bs=r=>ee(r)&&Mt(r.read)&&Mt(r.pipe)&&nl(r.readable)&&!_s(r),ol=r=>ee(r)&&Mt(r.clear)&&Mt(r.bytes)&&Mt(r.position)&&Mt(r.setPosition)&&Mt(r.capacity)&&Mt(r.getBufferIdentifier)&&Mt(r.createLong);var sa=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Rh(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 Tn(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 we(r,t){let e=Rh(r),n=e.reduce((p,b)=>p+b.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?Tn(o,s,a):o=s;break}Tn(o||(o=new Uint8Array(d)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),n-(o?o.byteLength:0)]}function $(r,t){let e=ps(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Pr(e)),e instanceof ArrayBuffer?new r(e):e instanceof sa?new r(e):ol(e)?$(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 Uh=r=>$(Int8Array,r),Nh=r=>$(Int16Array,r),ln=r=>$(Int32Array,r),kh=r=>$(ci,r),N=r=>$(Uint8Array,r),Lh=r=>$(Uint16Array,r),Ch=r=>$(Uint32Array,r),Ph=r=>$(Bn,r),Vh=r=>$(Float32Array,r),Hh=r=>$(Float64Array,r),zh=r=>$(Uint8ClampedArray,r),ia=r=>(r.next(),r);function*er(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof sa?e(t):Pe(t)?t:e(t);return yield*ia(function*(i){let s=null;do s=i.next(yield $(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}var jh=r=>er(Int8Array,r),Wh=r=>er(Int16Array,r),$h=r=>er(Int32Array,r),oa=r=>er(Uint8Array,r),Yh=r=>er(Uint16Array,r),Xh=r=>er(Uint32Array,r),Gh=r=>er(Float32Array,r),Kh=r=>er(Float64Array,r),Jh=r=>er(Uint8ClampedArray,r);function Ve(r,t){return ae(this,arguments,function*(){if(Ce(t))return yield W(yield W(yield*xn(De(Ve(r,yield W(t))))));let n=function(o){return ae(this,arguments,function*(){yield yield W(yield W(o))})},i=function(o){return ae(this,arguments,function*(){yield W(yield*xn(De(ia(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 sa?n(t):Pe(t)?i(t):Ee(t)?t:n(t);return yield W(yield*xn(De(ia(function(o){return ae(this,arguments,function*(){let a=null;do a=yield W(o.next(yield yield W($(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield W(new r)})}var qh=r=>Ve(Int8Array,r),Zh=r=>Ve(Int16Array,r),Qh=r=>Ve(Int32Array,r),aa=r=>Ve(Uint8Array,r),tp=r=>Ve(Uint16Array,r),ep=r=>Ve(Uint32Array,r),rp=r=>Ve(Float32Array,r),np=r=>Ve(Float64Array,r),ip=r=>Ve(Uint8ClampedArray,r);function ui(r,t,e){if(r!==0){e=e.slice(0,t+1);for(let n=-1;++n<=t;)e[n]+=r}return e}function ca(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 $t={fromIterable(r){return gs(sp(r))},fromAsyncIterable(r){return gs(op(r))},fromDOMStream(r){return gs(ap(r))},fromNodeStream(r){return gs(cp(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*sp(r){let t,e=!1,n=[],i,s,o,a=0;function c(){return s==="peek"?we(n,o)[0]:([i,n,a]=we(n,o),i)}({cmd:s,size:o}=yield null);let d=oa(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 op(r){return ae(this,arguments,function*(){let e,n=!1,i=[],s,o,a,c=0;function d(){return o==="peek"?we(i,a)[0]:([s,i,c]=we(i,a),s)}({cmd:o,size:a}=yield yield W(null));let p=aa(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield W(p.next()):yield W(p.next(a-c)),!e&&s.byteLength>0&&(i.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield W(d()));while(a<c);while(!e)}catch(b){(n=!0)&&typeof p.throw=="function"&&(yield W(p.throw(b)))}finally{n===!1&&typeof p.return=="function"&&(yield W(p.return(new Uint8Array(0))))}return yield W(null)})}function ap(r){return ae(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,c=0;function d(){return o==="peek"?we(i,a)[0]:([s,i,c]=we(i,a),s)}({cmd:o,size:a}=yield yield W(null));let p=new da(r);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield W(p.read()):yield W(p.read(a-c)),!e&&s.byteLength>0&&(i.push(N(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield W(d()));while(a<c);while(!e)}catch(b){(n=!0)&&(yield W(p.cancel(b)))}finally{n===!1?yield W(p.cancel()):r.locked&&p.releaseLock()}return yield W(null)})}var da=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 I(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 I(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=N(e)),e})}},ua=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function cp(r){return ae(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,c=0,d=[],p;function b(){return o==="peek"?we(d,a)[0]:([p,d,c]=we(d,a),p)}if({cmd:o,size:a}=yield yield W(null),r.isTTY)return yield yield W(new Uint8Array(0)),yield W(null);try{e[0]=ua(r,"end"),e[1]=ua(r,"error");do{if(e[2]=ua(r,"readable"),[n,s]=yield W(Promise.race(e.map(S=>S[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(p=N(r.read(a-c)),p.byteLength<a-c&&(p=N(r.read()))):p=N(r.read()),p.byteLength>0&&(d.push(p),c+=p.byteLength)),i||a<=c)do({cmd:o,size:a}=yield yield W(b()));while(a<c)}while(!i)}finally{yield W(y(e,n==="error"?s:null))}return yield W(null);function y(S,J){return p=d=null,new Promise((q,ot)=>{for(let[St,Qt]of S)r.off(St,Qt);try{let St=r.destroy;St&&St.call(r,J),J=void 0}catch(St){J=St||J}finally{J!=null?ot(J):q()}})}})}var Ut;(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"})(Ut||(Ut={}));var gt;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(gt||(gt={}));var pt;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(pt||(pt={}));var Yt;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Yt||(Yt={}));var X;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(X||(X={}));var re;(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"})(re||(re={}));var Q;(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"})(Q||(Q={}));var f;(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.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"})(f||(f={}));var Oe;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Oe||(Oe={}));var Ta={};cn(Ta,{clampIndex:()=>Zp,clampRange:()=>hi,createElementComparator:()=>jr});function He(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>He(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var ha={};cn(ha,{BN:()=>un,bignumToBigInt:()=>ws,bignumToString:()=>Vr,isArrowBigNumSymbol:()=>al});var al=Symbol.for("isArrowBigNum");function ze(r,...t){return t.length===0?Object.setPrototypeOf($(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}ze.prototype[al]=!0;ze.prototype.toJSON=function(){return`"${Vr(this)}"`};ze.prototype.valueOf=function(){return cl(this)};ze.prototype.toString=function(){return Vr(this)};ze.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return cl(this);case"string":return Vr(this);case"default":return ws(this)}return Vr(this)};function Dn(...r){return ze.apply(this,r)}function En(...r){return ze.apply(this,r)}function di(...r){return ze.apply(this,r)}Object.setPrototypeOf(Dn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(En.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(di.prototype,Object.create(Uint32Array.prototype));Object.assign(Dn.prototype,ze.prototype,{constructor:Dn,signed:!0,TypedArray:Int32Array,BigIntArray:ci});Object.assign(En.prototype,ze.prototype,{constructor:En,signed:!1,TypedArray:Uint32Array,BigIntArray:Bn});Object.assign(di.prototype,ze.prototype,{constructor:di,signed:!0,TypedArray:Uint32Array,BigIntArray:Bn});function cl(r){let{buffer:t,byteOffset:e,length:n,signed:i}=r,s=new Bn(t,e,n),o=i&&s[s.length-1]&BigInt(1)<<BigInt(63),a=BigInt(o?1:0),c=BigInt(0);if(o){for(let d of s)a+=~d*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(let d of s)a+=d*(BigInt(1)<<BigInt(32)*c++);return a}var Vr,ws;fs?(ws=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:fa(r),Vr=r=>r.byteLength===8?`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`:fa(r)):(Vr=fa,ws=Vr);function fa(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=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t||"0"}var un=class{static new(t,e){switch(e){case!0:return new Dn(t);case!1:return new En(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case ci:return new Dn(t)}return t.byteLength===16?new di(t):new En(t)}static signed(t){return new Dn(t)}static unsigned(t){return new En(t)}static decimal(t){return new di(t)}constructor(t,e){return un.new(t,e)}};var ll,ul,dl,fl,hl,pl,ml,yl,_l,bl,gl,wl,vl,Sl,Il,Al,Fl,xl,Bl,F=class{static isNull(t){return(t==null?void 0:t.typeId)===f.Null}static isInt(t){return(t==null?void 0:t.typeId)===f.Int}static isFloat(t){return(t==null?void 0:t.typeId)===f.Float}static isBinary(t){return(t==null?void 0:t.typeId)===f.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===f.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===f.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===f.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===f.Date}static isTime(t){return(t==null?void 0:t.typeId)===f.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===f.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===f.Interval}static isList(t){return(t==null?void 0:t.typeId)===f.List}static isStruct(t){return(t==null?void 0:t.typeId)===f.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===f.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===f.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===f.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===f.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===f.Dictionary}static isDenseUnion(t){return F.isUnion(t)&&t.mode===gt.Dense}static isSparseUnion(t){return F.isUnion(t)&&t.mode===gt.Sparse}get typeId(){return f.NONE}};ll=Symbol.toStringTag;F[ll]=(r=>(r.children=null,r.ArrayType=Array,r[Symbol.toStringTag]="DataType"))(F.prototype);var ne=class extends F{toString(){return"Null"}get typeId(){return f.Null}};ul=Symbol.toStringTag;ne[ul]=(r=>r[Symbol.toStringTag]="Null")(ne.prototype);var At=class extends F{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return f.Int}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 ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};dl=Symbol.toStringTag;At[dl]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(At.prototype);var vs=class extends At{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Ss=class extends At{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},rr=class extends At{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Is=class extends At{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},As=class extends At{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Fs=class extends At{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},xs=class extends At{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Bs=class extends At{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(vs.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Ss.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(rr.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Is.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(As.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Fs.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(xs.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Bs.prototype,"ArrayType",{value:BigUint64Array});var ce=class extends F{constructor(t){super(),this.precision=t}get typeId(){return f.Float}get ArrayType(){switch(this.precision){case pt.HALF:return Uint16Array;case pt.SINGLE:return Float32Array;case pt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};fl=Symbol.toStringTag;ce[fl]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(ce.prototype);var Ts=class extends ce{constructor(){super(pt.HALF)}},Ds=class extends ce{constructor(){super(pt.SINGLE)}},Es=class extends ce{constructor(){super(pt.DOUBLE)}};Object.defineProperty(Ts.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ds.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Es.prototype,"ArrayType",{value:Float64Array});var vr=class extends F{constructor(){super()}get typeId(){return f.Binary}toString(){return"Binary"}};hl=Symbol.toStringTag;vr[hl]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(vr.prototype);var Sr=class extends F{constructor(){super()}get typeId(){return f.Utf8}toString(){return"Utf8"}};pl=Symbol.toStringTag;Sr[pl]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Sr.prototype);var Ir=class extends F{constructor(){super()}get typeId(){return f.Bool}toString(){return"Bool"}};ml=Symbol.toStringTag;Ir[ml]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Ir.prototype);var Ar=class extends F{constructor(t,e,n=128){super(),this.scale=t,this.precision=e,this.bitWidth=n}get typeId(){return f.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};yl=Symbol.toStringTag;Ar[yl]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(Ar.prototype);var Fr=class extends F{constructor(t){super(),this.unit=t}get typeId(){return f.Date}toString(){return`Date${(this.unit+1)*32}<${Yt[this.unit]}>`}};_l=Symbol.toStringTag;Fr[_l]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(Fr.prototype);var je=class extends F{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return f.Time}toString(){return`Time${this.bitWidth}<${X[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};bl=Symbol.toStringTag;je[bl]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(je.prototype);var xr=class extends F{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return f.Timestamp}toString(){return`Timestamp<${X[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};gl=Symbol.toStringTag;xr[gl]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(xr.prototype);var Br=class extends F{constructor(t){super(),this.unit=t}get typeId(){return f.Interval}toString(){return`Interval<${re[this.unit]}>`}};wl=Symbol.toStringTag;Br[wl]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Br.prototype);var We=class extends F{constructor(t){super(),this.children=[t]}get typeId(){return f.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};vl=Symbol.toStringTag;We[vl]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(We.prototype);var ut=class extends F{constructor(t){super(),this.children=t}get typeId(){return f.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Sl=Symbol.toStringTag;ut[Sl]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(ut.prototype);var $e=class extends F{constructor(t,e,n){super(),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))}get typeId(){return f.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Il=Symbol.toStringTag;$e[Il]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))($e.prototype);var Tr=class extends F{constructor(t){super(),this.byteWidth=t}get typeId(){return f.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Al=Symbol.toStringTag;Tr[Al]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Tr.prototype);var Ye=class extends F{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return f.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Fl=Symbol.toStringTag;Ye[Fl]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Ye.prototype);var Xe=class extends F{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return f.Map}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<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};xl=Symbol.toStringTag;Xe[xl]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Xe.prototype);var lp=(r=>()=>++r)(-1),ve=class extends F{constructor(t,e,n,i){super(),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?lp():typeof n=="number"?n:n.low}get typeId(){return f.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Bl=Symbol.toStringTag;ve[Bl]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(ve.prototype);function Se(r){let t=r;switch(r.typeId){case f.Decimal:return r.bitWidth/32;case f.Timestamp:return 2;case f.Date:return 1+t.unit;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}var D=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 up(this,t,e)}getVisitFnByTypeId(t,e=!0){return On(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}visitBinary(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}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function up(r,t,e=!0){return typeof t=="number"?On(r,t,e):typeof t=="string"&&t in f?On(r,f[t],e):t&&t instanceof F?On(r,Tl(t),e):(t==null?void 0:t.type)&&t.type instanceof F?On(r,Tl(t.type),e):On(r,f.NONE,e)}function On(r,t,e=!0){let n=null;switch(t){case f.Null:n=r.visitNull;break;case f.Bool:n=r.visitBool;break;case f.Int:n=r.visitInt;break;case f.Int8:n=r.visitInt8||r.visitInt;break;case f.Int16:n=r.visitInt16||r.visitInt;break;case f.Int32:n=r.visitInt32||r.visitInt;break;case f.Int64:n=r.visitInt64||r.visitInt;break;case f.Uint8:n=r.visitUint8||r.visitInt;break;case f.Uint16:n=r.visitUint16||r.visitInt;break;case f.Uint32:n=r.visitUint32||r.visitInt;break;case f.Uint64:n=r.visitUint64||r.visitInt;break;case f.Float:n=r.visitFloat;break;case f.Float16:n=r.visitFloat16||r.visitFloat;break;case f.Float32:n=r.visitFloat32||r.visitFloat;break;case f.Float64:n=r.visitFloat64||r.visitFloat;break;case f.Utf8:n=r.visitUtf8;break;case f.Binary:n=r.visitBinary;break;case f.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case f.Date:n=r.visitDate;break;case f.DateDay:n=r.visitDateDay||r.visitDate;break;case f.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case f.Timestamp:n=r.visitTimestamp;break;case f.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case f.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case f.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case f.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case f.Time:n=r.visitTime;break;case f.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case f.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case f.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case f.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case f.Decimal:n=r.visitDecimal;break;case f.List:n=r.visitList;break;case f.Struct:n=r.visitStruct;break;case f.Union:n=r.visitUnion;break;case f.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case f.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case f.Dictionary:n=r.visitDictionary;break;case f.Interval:n=r.visitInterval;break;case f.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case f.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case f.FixedSizeList:n=r.visitFixedSizeList;break;case f.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function Tl(r){switch(r.typeId){case f.Null:return f.Null;case f.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?f.Int8:f.Uint8;case 16:return e?f.Int16:f.Uint16;case 32:return e?f.Int32:f.Uint32;case 64:return e?f.Int64:f.Uint64}return f.Int}case f.Float:switch(r.precision){case pt.HALF:return f.Float16;case pt.SINGLE:return f.Float32;case pt.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.Utf8:return f.Utf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(r.unit){case X.SECOND:return f.TimeSecond;case X.MILLISECOND:return f.TimeMillisecond;case X.MICROSECOND:return f.TimeMicrosecond;case X.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(r.unit){case X.SECOND:return f.TimestampSecond;case X.MILLISECOND:return f.TimestampMillisecond;case X.MICROSECOND:return f.TimestampMicrosecond;case X.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(r.unit){case Yt.DAY:return f.DateDay;case Yt.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(r.unit){case re.DAY_TIME:return f.IntervalDayTime;case re.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(r.mode){case gt.Dense:return f.DenseUnion;case gt.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[r.typeId]}'`)}D.prototype.visitInt8=null;D.prototype.visitInt16=null;D.prototype.visitInt32=null;D.prototype.visitInt64=null;D.prototype.visitUint8=null;D.prototype.visitUint16=null;D.prototype.visitUint32=null;D.prototype.visitUint64=null;D.prototype.visitFloat16=null;D.prototype.visitFloat32=null;D.prototype.visitFloat64=null;D.prototype.visitDateDay=null;D.prototype.visitDateMillisecond=null;D.prototype.visitTimestampSecond=null;D.prototype.visitTimestampMillisecond=null;D.prototype.visitTimestampMicrosecond=null;D.prototype.visitTimestampNanosecond=null;D.prototype.visitTimeSecond=null;D.prototype.visitTimeMillisecond=null;D.prototype.visitTimeMicrosecond=null;D.prototype.visitTimeNanosecond=null;D.prototype.visitDenseUnion=null;D.prototype.visitSparseUnion=null;D.prototype.visitIntervalDayTime=null;D.prototype.visitIntervalYearMonth=null;var pa={};cn(pa,{float64ToUint16:()=>fi,uint16ToFloat64:()=>Os});var Dl=new Float64Array(1),Mn=new Uint32Array(Dl.buffer);function Os(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 fi(r){if(r!==r)return 32256;Dl[0]=r;let t=(Mn[1]&2147483648)>>16&65535,e=Mn[1]&2146435072,n=0;return e>=1089470464?Mn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Mn[1]&1048575)>>10):e<=1056964608?(n=1048576+(Mn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Mn[1]&1048575)+512>>10),t|e|n&65535}var k=class extends D{};function z(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var dp=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},ma=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},fp=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},hp=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},El=(r,t,e,n)=>{if(e+1<t.length){let{[e]:i,[e+1]:s}=t;r.set(n.subarray(0,s-i),i)}},pp=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Dr=({values:r},t,e)=>{r[t]=e},ya=({values:r},t,e)=>{r[t]=e},Ol=({values:r},t,e)=>{r[t]=fi(e)},mp=(r,t,e)=>{switch(r.type.precision){case pt.HALF:return Ol(r,t,e);case pt.SINGLE:case pt.DOUBLE:return ya(r,t,e)}},Ms=({values:r},t,e)=>{dp(r,t,e.valueOf())},Rs=({values:r},t,e)=>{ma(r,t*2,e.valueOf())},_a=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},yp=({values:r,valueOffsets:t},e,n)=>El(r,t,e,n),_p=({values:r,valueOffsets:t},e,n)=>{El(r,t,e,Pr(n))},ba=(r,t,e)=>{r.type.unit===Yt.DAY?Ms(r,t,e):Rs(r,t,e)},Us=({values:r},t,e)=>ma(r,t*2,e/1e3),Ns=({values:r},t,e)=>ma(r,t*2,e),ks=({values:r},t,e)=>fp(r,t*2,e),Ls=({values:r},t,e)=>hp(r,t*2,e),ga=(r,t,e)=>{switch(r.type.unit){case X.SECOND:return Us(r,t,e);case X.MILLISECOND:return Ns(r,t,e);case X.MICROSECOND:return ks(r,t,e);case X.NANOSECOND:return Ls(r,t,e)}},Cs=({values:r},t,e)=>{r[t]=e},Ps=({values:r},t,e)=>{r[t]=e},Vs=({values:r},t,e)=>{r[t]=e},Hs=({values:r},t,e)=>{r[t]=e},wa=(r,t,e)=>{switch(r.type.unit){case X.SECOND:return Cs(r,t,e);case X.MILLISECOND:return Ps(r,t,e);case X.MICROSECOND:return Vs(r,t,e);case X.NANOSECOND:return Hs(r,t,e)}},va=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},bp=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=Xt.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))},gp=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=Xt.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},wp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),vp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),Sp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),Ip=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),Ap=(r,t,e)=>{let n=r.type.children.map(s=>Xt.getVisitFn(s.type)),i=e instanceof Map?Sp(t,e):e instanceof L?vp(t,e):Array.isArray(e)?wp(t,e):Ip(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},Fp=(r,t,e)=>{r.type.mode===gt.Dense?Ml(r,t,e):Rl(r,t,e)},Ml=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Xt.visit(i,r.valueOffsets[t],e)},Rl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Xt.visit(i,t,e)},xp=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Sa=(r,t,e)=>{r.type.unit===re.DAY_TIME?zs(r,t,e):js(r,t,e)},zs=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},js=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Bp=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=Xt.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=z(pp);k.prototype.visitInt=z(Dr);k.prototype.visitInt8=z(Dr);k.prototype.visitInt16=z(Dr);k.prototype.visitInt32=z(Dr);k.prototype.visitInt64=z(Dr);k.prototype.visitUint8=z(Dr);k.prototype.visitUint16=z(Dr);k.prototype.visitUint32=z(Dr);k.prototype.visitUint64=z(Dr);k.prototype.visitFloat=z(mp);k.prototype.visitFloat16=z(Ol);k.prototype.visitFloat32=z(ya);k.prototype.visitFloat64=z(ya);k.prototype.visitUtf8=z(_p);k.prototype.visitBinary=z(yp);k.prototype.visitFixedSizeBinary=z(_a);k.prototype.visitDate=z(ba);k.prototype.visitDateDay=z(Ms);k.prototype.visitDateMillisecond=z(Rs);k.prototype.visitTimestamp=z(ga);k.prototype.visitTimestampSecond=z(Us);k.prototype.visitTimestampMillisecond=z(Ns);k.prototype.visitTimestampMicrosecond=z(ks);k.prototype.visitTimestampNanosecond=z(Ls);k.prototype.visitTime=z(wa);k.prototype.visitTimeSecond=z(Cs);k.prototype.visitTimeMillisecond=z(Ps);k.prototype.visitTimeMicrosecond=z(Vs);k.prototype.visitTimeNanosecond=z(Hs);k.prototype.visitDecimal=z(va);k.prototype.visitList=z(bp);k.prototype.visitStruct=z(Ap);k.prototype.visitUnion=z(Fp);k.prototype.visitDenseUnion=z(Ml);k.prototype.visitSparseUnion=z(Rl);k.prototype.visitDictionary=z(xp);k.prototype.visitInterval=z(Sa);k.prototype.visitIntervalDayTime=z(zs);k.prototype.visitIntervalYearMonth=z(js);k.prototype.visitFixedSizeList=z(Bp);k.prototype.visitMap=z(gp);var Xt=new k;var Ge=Symbol.for("parent"),Rn=Symbol.for("rowIndex"),Hr=class{constructor(t,e){return this[Ge]=t,this[Rn]=e,new Proxy(this,new Aa)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Rn],e=this[Ge],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=Bt.visit(e.children[s],t);return i}toString(){return`{${[...this].map(([t,e])=>`${He(t)}: ${He(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Ia(this[Ge],this[Rn])}},Ia=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,Bt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Hr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ge]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Rn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Aa=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ge].type.children.map(e=>e.name)}has(t,e){return t[Ge].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Ge].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[Ge].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=Bt.visit(t[Ge].children[n],t[Rn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ge].type.children.findIndex(s=>s.name===e);return i!==-1?(Xt.visit(t[Ge].children[i],t[Rn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var O=class extends D{};function P(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Tp=(r,t)=>864e5*r[t],Fa=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),Dp=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,Ep=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,Ul=r=>new Date(r),Op=(r,t)=>Ul(Tp(r,t)),Mp=(r,t)=>Ul(Fa(r,t)),Rp=(r,t)=>null,Nl=(r,t,e)=>{if(e+1>=t.length)return null;let n=t[e],i=t[e+1];return r.subarray(n,i)},Up=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},kl=({values:r},t)=>Op(r,t),Ll=({values:r},t)=>Mp(r,t*2),zr=({stride:r,values:t},e)=>t[r*e],Np=({stride:r,values:t},e)=>Os(t[r*e]),Cl=({values:r},t)=>r[t],kp=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Lp=({values:r,valueOffsets:t},e)=>Nl(r,t,e),Cp=({values:r,valueOffsets:t},e)=>{let n=Nl(r,t,e);return n!==null?ai(n):null},Pp=({values:r},t)=>r[t],Vp=({type:r,values:t},e)=>r.precision!==pt.HALF?t[e]:Os(t[e]),Hp=(r,t)=>r.type.unit===Yt.DAY?kl(r,t):Ll(r,t),Pl=({values:r},t)=>1e3*Fa(r,t*2),Vl=({values:r},t)=>Fa(r,t*2),Hl=({values:r},t)=>Dp(r,t*2),zl=({values:r},t)=>Ep(r,t*2),zp=(r,t)=>{switch(r.type.unit){case X.SECOND:return Pl(r,t);case X.MILLISECOND:return Vl(r,t);case X.MICROSECOND:return Hl(r,t);case X.NANOSECOND:return zl(r,t)}},jl=({values:r},t)=>r[t],Wl=({values:r},t)=>r[t],$l=({values:r},t)=>r[t],Yl=({values:r},t)=>r[t],jp=(r,t)=>{switch(r.type.unit){case X.SECOND:return jl(r,t);case X.MILLISECOND:return Wl(r,t);case X.MICROSECOND:return $l(r,t);case X.NANOSECOND:return Yl(r,t)}},Wp=({values:r,stride:t},e)=>un.decimal(r.subarray(t*e,t*(e+1))),$p=(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 L([c])},Yp=(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))},Xp=(r,t)=>new Hr(r,t),Gp=(r,t)=>r.type.mode===gt.Dense?Xl(r,t):Gl(r,t),Xl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Bt.visit(n,r.valueOffsets[t])},Gl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Bt.visit(n,t)},Kp=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},Jp=(r,t)=>r.type.unit===re.DAY_TIME?Kl(r,t):Jl(r,t),Kl=({values:r},t)=>r.subarray(2*t,2*(t+1)),Jl=({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},qp=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new L([s])};O.prototype.visitNull=P(Rp);O.prototype.visitBool=P(Up);O.prototype.visitInt=P(Pp);O.prototype.visitInt8=P(zr);O.prototype.visitInt16=P(zr);O.prototype.visitInt32=P(zr);O.prototype.visitInt64=P(Cl);O.prototype.visitUint8=P(zr);O.prototype.visitUint16=P(zr);O.prototype.visitUint32=P(zr);O.prototype.visitUint64=P(Cl);O.prototype.visitFloat=P(Vp);O.prototype.visitFloat16=P(Np);O.prototype.visitFloat32=P(zr);O.prototype.visitFloat64=P(zr);O.prototype.visitUtf8=P(Cp);O.prototype.visitBinary=P(Lp);O.prototype.visitFixedSizeBinary=P(kp);O.prototype.visitDate=P(Hp);O.prototype.visitDateDay=P(kl);O.prototype.visitDateMillisecond=P(Ll);O.prototype.visitTimestamp=P(zp);O.prototype.visitTimestampSecond=P(Pl);O.prototype.visitTimestampMillisecond=P(Vl);O.prototype.visitTimestampMicrosecond=P(Hl);O.prototype.visitTimestampNanosecond=P(zl);O.prototype.visitTime=P(jp);O.prototype.visitTimeSecond=P(jl);O.prototype.visitTimeMillisecond=P(Wl);O.prototype.visitTimeMicrosecond=P($l);O.prototype.visitTimeNanosecond=P(Yl);O.prototype.visitDecimal=P(Wp);O.prototype.visitList=P($p);O.prototype.visitStruct=P(Xp);O.prototype.visitUnion=P(Gp);O.prototype.visitDenseUnion=P(Xl);O.prototype.visitSparseUnion=P(Gl);O.prototype.visitDictionary=P(Kp);O.prototype.visitInterval=P(Jp);O.prototype.visitIntervalDayTime=P(Kl);O.prototype.visitIntervalYearMonth=P(Jl);O.prototype.visitFixedSizeList=P(qp);O.prototype.visitMap=P(Yp);var Bt=new O;var Me=Symbol.for("keys"),Un=Symbol.for("vals"),nr=class{constructor(t){return this[Me]=new L([t.children[0]]).memoize(),this[Un]=t.children[1],new Proxy(this,new Ba)}[Symbol.iterator](){return new xa(this[Me],this[Un])}get size(){return this[Me].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Me],e=this[Un],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=Bt.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${He(t)}: ${He(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},xa=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),Bt.visit(this.vals,t)]})}},Ba=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Me].toArray().map(String)}has(t,e){return t[Me].includes(e)}getOwnPropertyDescriptor(t,e){if(t[Me].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Me].indexOf(e);if(n!==-1){let i=Bt.visit(Reflect.get(t,Un),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Me].indexOf(e);return i!==-1?(Xt.visit(Reflect.get(t,Un),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"},[Me]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Un]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function Zp(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var ql;function hi(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&&(ql=s,s=o,o=ql),o>i&&(o=i),n?n(r,s,o):[s,o]}var Zl=r=>r!==r;function jr(r){if(typeof r!=="object"||r===null)return Zl(r)?Zl: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?ca(r,e):!1:r instanceof Map?tm(r):Array.isArray(r)?Qp(r):r instanceof L?em(r):rm(r,!0)}function Qp(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=jr(r[e]);return Ws(t)}function tm(r){let t=-1,e=[];for(let n of r.values())e[++t]=jr(n);return Ws(e)}function em(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=jr(r.get(e));return Ws(t)}function rm(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]=jr(r[e[i]]);return Ws(n,e)}function Ws(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return nm(r,e);case Map:return Ql(r,e,e.keys());case nr:case Hr:case Object:case void 0:return Ql(r,e,t||Object.keys(e))}return e instanceof L?im(r,e):!1}}function nm(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 im(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 Ql(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 Da={};cn(Da,{BitIterator:()=>dn,getBit:()=>tu,getBool:()=>Ys,packBools:()=>fn,popcnt_array:()=>eu,popcnt_bit_range:()=>pi,popcnt_uint32:()=>$s,setBool:()=>sm,truncateBitmap:()=>Nn});function Ys(r,t,e,n){return(e&1<<n)!==0}function tu(r,t,e,n){return(e&1<<n)>>n}function sm(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Nn(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):fn(new dn(e,r,t,null,Ys)).subarray(0,n)),i}return e}function fn(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 dn=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 pi(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new dn(r,t,e-t,r,tu))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return pi(r,t,i)+pi(r,n,e)+eu(r,i>>3,n-i>>3)}function eu(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+=$s(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=$s(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=$s(s.getUint8(i)),i+=1;return n}function $s(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 om=-1,et=class{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 et?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=Se(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))),this.nullable=this._nullCount!==0&&this.nullBitmap&&this.nullBitmap.byteLength>0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}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(){let t=this._nullCount,e;return t<=om&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-pi(e,this.offset,this.offset+this.length)),t}getValid(t){if(this.nullable&&this.nullCount>0){let e=this.offset+t;return(this.nullBitmap[e>>3]&1<<e%8)!==0}return!0}setValid(t,e){if(!this.nullable)return e;if(!this.nullBitmap||this.nullBitmap.byteLength<=t>>3){let{nullBitmap:c}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:c,_nullCount:0})}let{nullBitmap:n,offset:i}=this,s=i+t>>3,o=(i+t)%8,a=n[s]>>o&1;return e?a===0&&(n[s]|=1<<o,this._nullCount=this.nullCount+1):a===1&&(n[s]&=~(1<<o),this._nullCount=this.nullCount-1),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,s=this,o=this.children){return new et(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===f.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(Nn(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[Oe.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[Oe.TYPE])&&(o[Oe.TYPE]=s.subarray(t,t+e)),(s=o[Oe.OFFSET])&&(o[Oe.OFFSET]=s.subarray(t,t+e+1))||(s=o[Oe.DATA])&&(o[Oe.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};et.prototype.children=Object.freeze([]);var hn=class extends D{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new et(e,n,i,0)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.data),s=N(t.nullBitmap),o=ln(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new et(e,n,a,c,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.data),s=N(t.nullBitmap),o=ln(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new et(e,n,a,c,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=N(t.nullBitmap),o=ln(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new et(e,n,a,c,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=N(t.nullBitmap),{length:o=i.reduce((c,{length:d})=>Math.max(c,d),0),nullCount:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=N(t.nullBitmap),o=$(e.ArrayType,t.typeIds),{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;if(F.isSparseUnion(e))return new et(e,n,a,c,[void 0,void 0,s,o],i);let d=ln(t.valueOffsets);return new et(e,n,a,c,[d,void 0,s,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.indices.ArrayType,t.data),{["dictionary"]:o=new L([new hn().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new et(e,n,a,c,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new hn().visit({type:e.valueType})}=t,s=N(t.nullBitmap),{["length"]:o=i.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new hn().visit({type:e.childType})}=t,s=N(t.nullBitmap),o=ln(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new et(e,n,a,c,[o,void 0,s],[i])}};function C(r){return new hn().visit(r)}var mi=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 Xs(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Gs(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Ks(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),b=Math.min(n-c,d);i.push(a.slice(p,b-p))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Ea(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 yi(r,t){return r.getValid(t)}function Wr(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Ea(n,this._offsets,e,t)}}function Js(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=Ea(s,this._offsets,n,e);return t=void 0,o}}function qs(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 b=n[d];if(~(a=r(b,t,o)))return c+a;o=0,c+=b.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):Ea(s,this._offsets,i,e);return t=void 0,o}}var M=class extends D{};function am(r,t){return t===null&&r.length>0?0:-1}function cm(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new dn(e,r.offset+(t||0),r.length,e,Ys)){if(!i)return n;++n}return-1}function Y(r,t,e){if(t===void 0)return-1;if(t===null)return cm(r,e);let n=Bt.getVisitFn(r),i=jr(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=Bt.getVisitFn(r),i=jr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}M.prototype.visitNull=am;M.prototype.visitBool=Y;M.prototype.visitInt=Y;M.prototype.visitInt8=Y;M.prototype.visitInt16=Y;M.prototype.visitInt32=Y;M.prototype.visitInt64=Y;M.prototype.visitUint8=Y;M.prototype.visitUint16=Y;M.prototype.visitUint32=Y;M.prototype.visitUint64=Y;M.prototype.visitFloat=Y;M.prototype.visitFloat16=Y;M.prototype.visitFloat32=Y;M.prototype.visitFloat64=Y;M.prototype.visitUtf8=Y;M.prototype.visitBinary=Y;M.prototype.visitFixedSizeBinary=Y;M.prototype.visitDate=Y;M.prototype.visitDateDay=Y;M.prototype.visitDateMillisecond=Y;M.prototype.visitTimestamp=Y;M.prototype.visitTimestampSecond=Y;M.prototype.visitTimestampMillisecond=Y;M.prototype.visitTimestampMicrosecond=Y;M.prototype.visitTimestampNanosecond=Y;M.prototype.visitTime=Y;M.prototype.visitTimeSecond=Y;M.prototype.visitTimeMillisecond=Y;M.prototype.visitTimeMicrosecond=Y;M.prototype.visitTimeNanosecond=Y;M.prototype.visitDecimal=Y;M.prototype.visitList=Y;M.prototype.visitStruct=Y;M.prototype.visitUnion=Y;M.prototype.visitDenseUnion=ru;M.prototype.visitSparseUnion=ru;M.prototype.visitDictionary=Y;M.prototype.visitInterval=Y;M.prototype.visitIntervalDayTime=Y;M.prototype.visitIntervalYearMonth=Y;M.prototype.visitFixedSizeList=Y;M.prototype.visitMap=Y;var pn=new M;var R=class extends D{};function V(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===f.Timestamp||t instanceof At&&t.bitWidth!==64||t instanceof je&&t.bitWidth!==64||t instanceof ce&&t.precision!==pt.HALF))return new mi(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new mi(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Oa(o)})}var Oa=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}};R.prototype.visitNull=V;R.prototype.visitBool=V;R.prototype.visitInt=V;R.prototype.visitInt8=V;R.prototype.visitInt16=V;R.prototype.visitInt32=V;R.prototype.visitInt64=V;R.prototype.visitUint8=V;R.prototype.visitUint16=V;R.prototype.visitUint32=V;R.prototype.visitUint64=V;R.prototype.visitFloat=V;R.prototype.visitFloat16=V;R.prototype.visitFloat32=V;R.prototype.visitFloat64=V;R.prototype.visitUtf8=V;R.prototype.visitBinary=V;R.prototype.visitFixedSizeBinary=V;R.prototype.visitDate=V;R.prototype.visitDateDay=V;R.prototype.visitDateMillisecond=V;R.prototype.visitTimestamp=V;R.prototype.visitTimestampSecond=V;R.prototype.visitTimestampMillisecond=V;R.prototype.visitTimestampMicrosecond=V;R.prototype.visitTimestampNanosecond=V;R.prototype.visitTime=V;R.prototype.visitTimeSecond=V;R.prototype.visitTimeMillisecond=V;R.prototype.visitTimeMicrosecond=V;R.prototype.visitTimeNanosecond=V;R.prototype.visitDecimal=V;R.prototype.visitList=V;R.prototype.visitStruct=V;R.prototype.visitUnion=V;R.prototype.visitDenseUnion=V;R.prototype.visitSparseUnion=V;R.prototype.visitDictionary=V;R.prototype.visitInterval=V;R.prototype.visitIntervalDayTime=V;R.prototype.visitIntervalYearMonth=V;R.prototype.visitFixedSizeList=V;R.prototype.visitMap=V;var kn=new R;var lm=(r,t)=>r+t,ir=class extends D{visitNull(t,e){return 0}visitInt(t,e){return t.type.bitWidth/8}visitFloat(t,e){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,e){return 1/8}visitDecimal(t,e){return t.type.bitWidth/8}visitDate(t,e){return(t.type.unit+1)*4}visitTime(t,e){return t.type.bitWidth/8}visitTimestamp(t,e){return t.type.unit===X.SECOND?4:8}visitInterval(t,e){return(t.type.unit+1)*4}visitStruct(t,e){return t.children.reduce((n,i)=>n+Ie.visit(i,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((n,i)=>n+Ie.visit(i,e),0)}visitDictionary(t,e){var n;return t.type.indices.bitWidth/8+(((n=t.dictionary)===null||n===void 0?void 0:n.getByteLength(t.values[e]))||0)}},um=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),dm=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),fm=({valueOffsets:r,stride:t,children:e},n)=>{let i=e[0],{[n*t]:s}=r,{[n*t+1]:o}=r,a=Ie.getVisitFn(i.type),c=i.slice(s,o-s),d=8;for(let p=-1,b=o-s;++p<b;)d+=a(c,p);return d},hm=({stride:r,children:t},e)=>{let n=t[0],i=n.slice(e*r,r),s=Ie.getVisitFn(n.type),o=0;for(let a=-1,c=i.length;++a<c;)o+=s(i,a);return o},pm=(r,t)=>r.type.mode===gt.Dense?nu(r,t):iu(r,t),nu=({type:r,children:t,typeIds:e,valueOffsets:n},i)=>{let s=r.typeIdToChildIndex[e[i]];return 8+Ie.visit(t[s],n[i])},iu=({children:r},t)=>4+Ie.visitMany(r,r.map(()=>t)).reduce(lm,0);ir.prototype.visitUtf8=um;ir.prototype.visitBinary=dm;ir.prototype.visitList=fm;ir.prototype.visitFixedSizeList=hm;ir.prototype.visitUnion=pm;ir.prototype.visitDenseUnion=nu;ir.prototype.visitSparseUnion=iu;var Ie=new ir;var su,ou={},au={},L=class{constructor(t){var e,n,i;let s=t[0]instanceof L?t.flatMap(a=>a.data):t;if(s.some(a=>!(a instanceof et)))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,byteLength:p}=ou[o.typeId],b=s[0];this.isValid=y=>yi(b,y),this.get=y=>a(b,y),this.set=(y,S)=>c(b,y,S),this.indexOf=y=>d(b,y),this.getByteLength=y=>p(b,y),this._offsets=[0,b.length];break}default:Object.setPrototypeOf(this,au[o.typeId]),this._offsets=Gs(s);break}this.data=s,this.type=o,this.stride=Se(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[this._offsets.length-1]}get byteLength(){return this._byteLength===-1&&(this._byteLength=this.data.reduce((t,e)=>t+e.byteLength,0)),this._byteLength}get nullCount(){return this._nullCount===-1&&(this._nullCount=Xs(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>0}getByteLength(t){return 0}[Symbol.iterator](){return kn.visit(this)}concat(...t){return new L(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new L(hi(this,t,e,({data:n,_offsets:i},s,o)=>Ks(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.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})=>(o.array.set(a,o.offset),o.offset+=a.length,o),{array:new s(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...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 L(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return F.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(F.isDictionary(this.type)){let t=new Ln(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new L(e)}return new Ln(this)}unmemoize(){if(F.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 L(e)}return this}};su=Symbol.toStringTag;L[su]=(r=>{r.type=F.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._nullCount=-1,r._byteLength=-1,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(f).map(e=>f[e]).filter(e=>typeof e=="number"&&e!==f.NONE);for(let e of t){let n=Bt.getVisitFnByTypeId(e),i=Xt.getVisitFnByTypeId(e),s=pn.getVisitFnByTypeId(e),o=Ie.getVisitFnByTypeId(e);ou[e]={get:n,set:i,indexOf:s,byteLength:o},au[e]=Object.create(r,{isValid:{value:Wr(yi)},get:{value:Wr(Bt.getVisitFnByTypeId(e))},set:{value:Js(Xt.getVisitFnByTypeId(e))},indexOf:{value:qs(pn.getVisitFnByTypeId(e))},getByteLength:{value:Wr(Ie.getVisitFnByTypeId(e))}})}return"Vector"})(L.prototype);var Ln=class extends L{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 Ln(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new L(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function cu(r){if(!r||r.length<=0)return function(i){return!0};let t="",e=r.filter(n=>n===n);return e.length>0&&(t=`
1
+ "use strict";var duckdb=(()=>{var Fh=Object.create;var as=Object.defineProperty;var xh=Object.getOwnPropertyDescriptor;var Bh=Object.getOwnPropertyNames;var Th=Object.getPrototypeOf,Dh=Object.prototype.hasOwnProperty;var Eh=(r=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(r,{get:(t,e)=>(typeof require!="undefined"?require:t)[e]}):r)(function(r){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var cs=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),cn=(r,t)=>{for(var e in t)as(r,e,{get:t[e],enumerable:!0})},Mc=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Bh(t))!Dh.call(r,i)&&i!==e&&as(r,i,{get:()=>t[i],enumerable:!(n=xh(t,i))||n.enumerable});return r};var Rc=(r,t,e)=>(e=r!=null?Fh(Th(r)):{},Mc(t||!r||!r.__esModule?as(e,"default",{value:r,enumerable:!0}):e,r)),Oh=r=>Mc(as({},"__esModule",{value:!0}),r);var tl=cs((x_,ds)=>{var Uc,Nc,kc,Lc,Cc,Pc,Vc,Hc,zc,ls,na,jc,Wc,$c,xn,Yc,Xc,Gc,Kc,Jc,qc,Zc,Qc,us;(function(r){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){r(e(t,e(n)))}):typeof ds=="object"&&typeof ds.exports=="object"?r(e(t,e(ds.exports))):r(e(t));function e(n,i){return n!==t&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(s,o){return n[s]=i?i(s,o):o}}})(function(r){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])};Uc=function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");t(n,i);function s(){this.constructor=n}n.prototype=i===null?Object.create(i):(s.prototype=i.prototype,new s)},Nc=Object.assign||function(n){for(var i,s=1,o=arguments.length;s<o;s++){i=arguments[s];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])}return n},kc=function(n,i){var s={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.indexOf(o)<0&&(s[o]=n[o]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,o=Object.getOwnPropertySymbols(n);a<o.length;a++)i.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(n,o[a])&&(s[o[a]]=n[o[a]]);return s},Lc=function(n,i,s,o){var a=arguments.length,c=a<3?i:o===null?o=Object.getOwnPropertyDescriptor(i,s):o,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(n,i,s,o);else for(var p=n.length-1;p>=0;p--)(d=n[p])&&(c=(a<3?d(c):a>3?d(i,s,c):d(i,s))||c);return a>3&&c&&Object.defineProperty(i,s,c),c},Cc=function(n,i){return function(s,o){i(s,o,n)}},Pc=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},Vc=function(n,i,s,o){function a(c){return c instanceof s?c:new s(function(d){d(c)})}return new(s||(s=Promise))(function(c,d){function p(S){try{_(o.next(S))}catch(J){d(J)}}function b(S){try{_(o.throw(S))}catch(J){d(J)}}function _(S){S.done?c(S.value):a(S.value).then(p,b)}_((o=o.apply(n,i||[])).next())})},Hc=function(n,i){var s={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},o,a,c,d;return d={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(d[Symbol.iterator]=function(){return this}),d;function p(_){return function(S){return b([_,S])}}function b(_){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,a&&(c=_[0]&2?a.return:_[0]?a.throw||((c=a.return)&&c.call(a),0):a.next)&&!(c=c.call(a,_[1])).done)return c;switch(a=0,c&&(_=[_[0]&2,c.value]),_[0]){case 0:case 1:c=_;break;case 4:return s.label++,{value:_[1],done:!1};case 5:s.label++,a=_[1],_=[0];continue;case 7:_=s.ops.pop(),s.trys.pop();continue;default:if(c=s.trys,!(c=c.length>0&&c[c.length-1])&&(_[0]===6||_[0]===2)){s=0;continue}if(_[0]===3&&(!c||_[1]>c[0]&&_[1]<c[3])){s.label=_[1];break}if(_[0]===6&&s.label<c[1]){s.label=c[1],c=_;break}if(c&&s.label<c[2]){s.label=c[2],s.ops.push(_);break}c[2]&&s.ops.pop(),s.trys.pop();continue}_=i.call(n,s)}catch(S){_=[6,S],a=0}finally{o=c=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}},zc=function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&us(i,n,s)},us=Object.create?function(n,i,s,o){o===void 0&&(o=s),Object.defineProperty(n,o,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]},ls=function(n){var i=typeof Symbol=="function"&&Symbol.iterator,s=i&&n[i],o=0;if(s)return s.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},na=function(n,i){var s=typeof Symbol=="function"&&n[Symbol.iterator];if(!s)return n;var o=s.call(n),a,c=[],d;try{for(;(i===void 0||i-- >0)&&!(a=o.next()).done;)c.push(a.value)}catch(p){d={error:p}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(d)throw d.error}}return c},jc=function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(na(arguments[i]));return n},Wc=function(){for(var n=0,i=0,s=arguments.length;i<s;i++)n+=arguments[i].length;for(var o=Array(n),a=0,i=0;i<s;i++)for(var c=arguments[i],d=0,p=c.length;d<p;d++,a++)o[a]=c[d];return o},$c=function(n,i,s){if(s||arguments.length===2)for(var o=0,a=i.length,c;o<a;o++)(c||!(o in i))&&(c||(c=Array.prototype.slice.call(i,0,o)),c[o]=i[o]);return n.concat(c||Array.prototype.slice.call(i))},xn=function(n){return this instanceof xn?(this.v=n,this):new xn(n)},Yc=function(n,i,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=s.apply(n,i||[]),a,c=[];return a={},d("next"),d("throw"),d("return"),a[Symbol.asyncIterator]=function(){return this},a;function d(q){o[q]&&(a[q]=function(ot){return new Promise(function(St,Qt){c.push([q,ot,St,Qt])>1||p(q,ot)})})}function p(q,ot){try{b(o[q](ot))}catch(St){J(c[0][3],St)}}function b(q){q.value instanceof xn?Promise.resolve(q.value.v).then(_,S):J(c[0][2],q)}function _(q){p("next",q)}function S(q){p("throw",q)}function J(q,ot){q(ot),c.shift(),c.length&&p(c[0][0],c[0][1])}},Xc=function(n){var i,s;return i={},o("next"),o("throw",function(a){throw a}),o("return"),i[Symbol.iterator]=function(){return this},i;function o(a,c){i[a]=n[a]?function(d){return(s=!s)?{value:xn(n[a](d)),done:a==="return"}:c?c(d):d}:c}},Gc=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n[Symbol.asyncIterator],s;return i?i.call(n):(n=typeof ls=="function"?ls(n):n[Symbol.iterator](),s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s);function o(c){s[c]=n[c]&&function(d){return new Promise(function(p,b){d=n[c](d),a(p,b,d.done,d.value)})}}function a(c,d,p,b){Promise.resolve(b).then(function(_){c({value:_,done:p})},d)}},Kc=function(n,i){return Object.defineProperty?Object.defineProperty(n,"raw",{value:i}):n.raw=i,n};var e=Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i};Jc=function(n){if(n&&n.__esModule)return n;var i={};if(n!=null)for(var s in n)s!=="default"&&Object.prototype.hasOwnProperty.call(n,s)&&us(i,n,s);return e(i,n),i},qc=function(n){return n&&n.__esModule?n:{default:n}},Zc=function(n,i,s,o){if(s==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?n!==i||!o:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?o:s==="a"?o.call(n):o?o.value:i.get(n)},Qc=function(n,i,s,o,a){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?n!==i||!a:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?a.call(n,s):a?a.value=s:i.set(n,s),s},r("__extends",Uc),r("__assign",Nc),r("__rest",kc),r("__decorate",Lc),r("__param",Cc),r("__metadata",Pc),r("__awaiter",Vc),r("__generator",Hc),r("__exportStar",zc),r("__createBinding",us),r("__values",ls),r("__read",na),r("__spread",jc),r("__spreadArrays",Wc),r("__spreadArray",$c),r("__await",xn),r("__asyncGenerator",Yc),r("__asyncDelegator",Xc),r("__asyncValues",Gc),r("__makeTemplateObject",Kc),r("__importStar",Jc),r("__importDefault",qc),r("__classPrivateFieldGet",Zc),r("__classPrivateFieldSet",Qc)})});var ec=cs(()=>{});var Vu=cs(()=>{});var Xu=cs((exports,module)=>{(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(r){return Object.prototype.toString.call(r)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(r){return typeof r=="object"&&r.buffer&&r.buffer.constructor===ArrayBuffer});var createOutputMethod=function(r,t){return function(e){return new Sha256(t,!0).update(e)[r]()}},createMethod=function(r){var t=createOutputMethod("hex",r);NODE_JS&&(t=nodeWrap(t,r)),t.create=function(){return new Sha256(r)},t.update=function(i){return t.create().update(i)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createOutputMethod(n,r)}return t},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(r){if(typeof r=="string")return crypto.createHash(algorithm).update(r,"utf8").digest("hex");if(r==null)throw new Error(ERROR);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),Array.isArray(r)||ArrayBuffer.isView(r)||r.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(r)).digest("hex"):method(r)};return nodeMethod},createHmacOutputMethod=function(r,t){return function(e,n){return new HmacSha256(e,t,!0).update(n)[r]()}},createHmacMethod=function(r){var t=createHmacOutputMethod("hex",r);t.create=function(i){return new HmacSha256(i,r)},t.update=function(i,s){return t.create(i).update(s)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createHmacOutputMethod(n,r)}return t};function Sha256(r,t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r?(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=r}Sha256.prototype.update=function(r){if(!this.finalized){var t,e=typeof r;if(e!=="string"){if(e==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);t=!0}for(var n,i=0,s,o=r.length,a=this.blocks;i<o;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),t)for(s=this.start;i<o&&s<64;++i)a[s>>2]|=r[i]<<SHIFT[s++&3];else for(s=this.start;i<o&&s<64;++i)n=r.charCodeAt(i),n<128?a[s>>2]|=n<<SHIFT[s++&3]:n<2048?(a[s>>2]|=(192|n>>6)<<SHIFT[s++&3],a[s>>2]|=(128|n&63)<<SHIFT[s++&3]):n<55296||n>=57344?(a[s>>2]|=(224|n>>12)<<SHIFT[s++&3],a[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],a[s>>2]|=(128|n&63)<<SHIFT[s++&3]):(n=65536+((n&1023)<<10|r.charCodeAt(++i)&1023),a[s>>2]|=(240|n>>18)<<SHIFT[s++&3],a[s>>2]|=(128|n>>12&63)<<SHIFT[s++&3],a[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],a[s>>2]|=(128|n&63)<<SHIFT[s++&3]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=a[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var r=this.blocks,t=this.lastByteIndex;r[16]=this.block,r[t>>2]|=EXTRA[t&3],this.block=r[16],t>=56&&(this.hashed||this.hash(),r[0]=this.block,r[16]=r[1]=r[2]=r[3]=r[4]=r[5]=r[6]=r[7]=r[8]=r[9]=r[10]=r[11]=r[12]=r[13]=r[14]=r[15]=0),r[14]=this.hBytes<<3|this.bytes>>>29,r[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,c=this.blocks,d,p,b,_,S,J,q,ot,St,Qt,se;for(d=16;d<64;++d)S=c[d-15],p=(S>>>7|S<<25)^(S>>>18|S<<14)^S>>>3,S=c[d-2],b=(S>>>17|S<<15)^(S>>>19|S<<13)^S>>>10,c[d]=c[d-16]+p+c[d-7]+b<<0;for(se=t&e,d=0;d<64;d+=4)this.first?(this.is224?(ot=300032,S=c[0]-1413257819,a=S-150054599<<0,n=S+24177077<<0):(ot=704751109,S=c[0]-210244248,a=S-1521486534<<0,n=S+143694565<<0),this.first=!1):(p=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),b=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),ot=r&t,_=ot^r&e^se,q=i&s^~i&o,S=a+b+q+K[d]+c[d],J=p+_,a=n+S<<0,n=S+J<<0),p=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),b=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),St=n&r,_=St^n&t^ot,q=a&i^~a&s,S=o+b+q+K[d+1]+c[d+1],J=p+_,o=e+S<<0,e=S+J<<0,p=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),b=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),Qt=e&n,_=Qt^e&r^St,q=o&a^~o&i,S=s+b+q+K[d+2]+c[d+2],J=p+_,s=t+S<<0,t=S+J<<0,p=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),b=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),se=t&e,_=se^t&n^Qt,q=s&o^~s&a,S=i+b+q+K[d+3]+c[d+3],J=p+_,i=r+S<<0,r=S+J<<0;this.h0=this.h0+r<<0,this.h1=this.h1+t<<0,this.h2=this.h2+e<<0,this.h3=this.h3+n<<0,this.h4=this.h4+i<<0,this.h5=this.h5+s<<0,this.h6=this.h6+o<<0,this.h7=this.h7+a<<0},Sha256.prototype.hex=function(){this.finalize();var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,c=HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15];return this.is224||(c+=HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]),c},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,c=[r>>24&255,r>>16&255,r>>8&255,r&255,t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,i>>24&255,i>>16&255,i>>8&255,i&255,s>>24&255,s>>16&255,s>>8&255,s&255,o>>24&255,o>>16&255,o>>8&255,o&255];return this.is224||c.push(a>>24&255,a>>16&255,a>>8&255,a&255),c},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var r=new ArrayBuffer(this.is224?28:32),t=new DataView(r);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),r};function HmacSha256(r,t,e){var n,i=typeof r;if(i==="string"){var s=[],o=r.length,a=0,c;for(n=0;n<o;++n)c=r.charCodeAt(n),c<128?s[a++]=c:c<2048?(s[a++]=192|c>>6,s[a++]=128|c&63):c<55296||c>=57344?(s[a++]=224|c>>12,s[a++]=128|c>>6&63,s[a++]=128|c&63):(c=65536+((c&1023)<<10|r.charCodeAt(++n)&1023),s[a++]=240|c>>18,s[a++]=128|c>>12&63,s[a++]=128|c>>6&63,s[a++]=128|c&63);r=s}else if(i==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);r.length>64&&(r=new Sha256(t,!0).update(r).array());var d=[],p=[];for(n=0;n<64;++n){var b=r[n]||0;d[n]=92^b,p[n]=54^b}Sha256.call(this,t,e),this.update(p),this.oKeyPad=d,this.inner=!0,this.sharedMemory=e}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var r=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(r),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var S_={};cn(S_,{registerWorker:()=>Ju});var el=Rc(tl(),1),{__extends:B_,__assign:T_,__rest:rl,__decorate:D_,__param:E_,__metadata:O_,__awaiter:I,__generator:M_,__exportStar:R_,__createBinding:U_,__values:N_,__read:k_,__spread:L_,__spreadArrays:C_,__spreadArray:P_,__await:W,__asyncGenerator:ae,__asyncDelegator:Bn,__asyncValues:De,__makeTemplateObject:V_,__importStar:H_,__importDefault:z_,__classPrivateFieldGet:j_,__classPrivateFieldSet:W_}=el.default;var la={};cn(la,{compareArrayLike:()=>ca,joinUint8Arrays:()=>we,memcpy:()=>Dn,rebaseValueOffsets:()=>ui,toArrayBufferView:()=>$,toArrayBufferViewAsyncIterator:()=>Ve,toArrayBufferViewIterator:()=>er,toBigInt64Array:()=>Ch,toBigUint64Array:()=>Hh,toFloat32Array:()=>zh,toFloat32ArrayAsyncIterator:()=>ip,toFloat32ArrayIterator:()=>Jh,toFloat64Array:()=>jh,toFloat64ArrayAsyncIterator:()=>sp,toFloat64ArrayIterator:()=>qh,toInt16Array:()=>Lh,toInt16ArrayAsyncIterator:()=>tp,toInt16ArrayIterator:()=>Yh,toInt32Array:()=>ln,toInt32ArrayAsyncIterator:()=>ep,toInt32ArrayIterator:()=>Xh,toInt8Array:()=>kh,toInt8ArrayAsyncIterator:()=>Qh,toInt8ArrayIterator:()=>$h,toUint16Array:()=>Ph,toUint16ArrayAsyncIterator:()=>rp,toUint16ArrayIterator:()=>Gh,toUint32Array:()=>Vh,toUint32ArrayAsyncIterator:()=>np,toUint32ArrayIterator:()=>Kh,toUint8Array:()=>N,toUint8ArrayAsyncIterator:()=>aa,toUint8ArrayIterator:()=>oa,toUint8ClampedArray:()=>Wh,toUint8ClampedArrayAsyncIterator:()=>op,toUint8ClampedArrayIterator:()=>Zh});var Mh=new TextDecoder("utf-8"),ai=r=>Mh.decode(r),Rh=new TextEncoder,Pr=r=>Rh.encode(r);var[X_,fs]=(()=>{let r=()=>{throw new Error("BigInt is not available in this environment")};function t(){throw r()}return t.asIntN=()=>{throw r()},t.asUintN=()=>{throw r()},typeof BigInt<"u"?[BigInt,!0]:[t,!1]})(),[ci,G_]=(()=>{let r=()=>{throw new Error("BigInt64Array is not available in this environment")};class t{static get BYTES_PER_ELEMENT(){return 8}static of(){throw r()}static from(){throw r()}constructor(){throw r()}}return typeof BigInt64Array<"u"?[BigInt64Array,!0]:[t,!1]})(),[Tn,K_]=(()=>{let r=()=>{throw new Error("BigUint64Array is not available in this environment")};class t{static get BYTES_PER_ELEMENT(){return 8}static of(){throw r()}static from(){throw r()}constructor(){throw r()}}return typeof BigUint64Array<"u"?[BigUint64Array,!0]:[t,!1]})();var Uh=r=>typeof r=="number",nl=r=>typeof r=="boolean",Mt=r=>typeof r=="function",ee=r=>r!=null&&Object(r)===r,Ce=r=>ee(r)&&Mt(r.then);var Pe=r=>ee(r)&&Mt(r[Symbol.iterator]),Ee=r=>ee(r)&&Mt(r[Symbol.asyncIterator]),hs=r=>ee(r)&&ee(r.schema);var ps=r=>ee(r)&&"done"in r&&"value"in r;var ms=r=>ee(r)&&Mt(r.stat)&&Uh(r.fd);var _s=r=>ee(r)&&li(r.body),ys=r=>"_getDOMStream"in r&&"_getNodeStream"in r,il=r=>ee(r)&&Mt(r.abort)&&Mt(r.getWriter)&&!ys(r),li=r=>ee(r)&&Mt(r.cancel)&&Mt(r.getReader)&&!ys(r),sl=r=>ee(r)&&Mt(r.end)&&Mt(r.write)&&nl(r.writable)&&!ys(r),bs=r=>ee(r)&&Mt(r.read)&&Mt(r.pipe)&&nl(r.readable)&&!ys(r),ol=r=>ee(r)&&Mt(r.clear)&&Mt(r.bytes)&&Mt(r.position)&&Mt(r.setPosition)&&Mt(r.capacity)&&Mt(r.getBufferIdentifier)&&Mt(r.createLong);var sa=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Nh(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 Dn(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 we(r,t){let e=Nh(r),n=e.reduce((p,b)=>p+b.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?Dn(o,s,a):o=s;break}Dn(o||(o=new Uint8Array(d)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),n-(o?o.byteLength:0)]}function $(r,t){let e=ps(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Pr(e)),e instanceof ArrayBuffer?new r(e):e instanceof sa?new r(e):ol(e)?$(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 kh=r=>$(Int8Array,r),Lh=r=>$(Int16Array,r),ln=r=>$(Int32Array,r),Ch=r=>$(ci,r),N=r=>$(Uint8Array,r),Ph=r=>$(Uint16Array,r),Vh=r=>$(Uint32Array,r),Hh=r=>$(Tn,r),zh=r=>$(Float32Array,r),jh=r=>$(Float64Array,r),Wh=r=>$(Uint8ClampedArray,r),ia=r=>(r.next(),r);function*er(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof sa?e(t):Pe(t)?t:e(t);return yield*ia(function*(i){let s=null;do s=i.next(yield $(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}var $h=r=>er(Int8Array,r),Yh=r=>er(Int16Array,r),Xh=r=>er(Int32Array,r),oa=r=>er(Uint8Array,r),Gh=r=>er(Uint16Array,r),Kh=r=>er(Uint32Array,r),Jh=r=>er(Float32Array,r),qh=r=>er(Float64Array,r),Zh=r=>er(Uint8ClampedArray,r);function Ve(r,t){return ae(this,arguments,function*(){if(Ce(t))return yield W(yield W(yield*Bn(De(Ve(r,yield W(t))))));let n=function(o){return ae(this,arguments,function*(){yield yield W(yield W(o))})},i=function(o){return ae(this,arguments,function*(){yield W(yield*Bn(De(ia(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 sa?n(t):Pe(t)?i(t):Ee(t)?t:n(t);return yield W(yield*Bn(De(ia(function(o){return ae(this,arguments,function*(){let a=null;do a=yield W(o.next(yield yield W($(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield W(new r)})}var Qh=r=>Ve(Int8Array,r),tp=r=>Ve(Int16Array,r),ep=r=>Ve(Int32Array,r),aa=r=>Ve(Uint8Array,r),rp=r=>Ve(Uint16Array,r),np=r=>Ve(Uint32Array,r),ip=r=>Ve(Float32Array,r),sp=r=>Ve(Float64Array,r),op=r=>Ve(Uint8ClampedArray,r);function ui(r,t,e){if(r!==0){e=e.slice(0,t+1);for(let n=-1;++n<=t;)e[n]+=r}return e}function ca(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 $t={fromIterable(r){return gs(ap(r))},fromAsyncIterable(r){return gs(cp(r))},fromDOMStream(r){return gs(lp(r))},fromNodeStream(r){return gs(up(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*ap(r){let t,e=!1,n=[],i,s,o,a=0;function c(){return s==="peek"?we(n,o)[0]:([i,n,a]=we(n,o),i)}({cmd:s,size:o}=yield null);let d=oa(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 cp(r){return ae(this,arguments,function*(){let e,n=!1,i=[],s,o,a,c=0;function d(){return o==="peek"?we(i,a)[0]:([s,i,c]=we(i,a),s)}({cmd:o,size:a}=yield yield W(null));let p=aa(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield W(p.next()):yield W(p.next(a-c)),!e&&s.byteLength>0&&(i.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield W(d()));while(a<c);while(!e)}catch(b){(n=!0)&&typeof p.throw=="function"&&(yield W(p.throw(b)))}finally{n===!1&&typeof p.return=="function"&&(yield W(p.return(new Uint8Array(0))))}return yield W(null)})}function lp(r){return ae(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,c=0;function d(){return o==="peek"?we(i,a)[0]:([s,i,c]=we(i,a),s)}({cmd:o,size:a}=yield yield W(null));let p=new da(r);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield W(p.read()):yield W(p.read(a-c)),!e&&s.byteLength>0&&(i.push(N(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield W(d()));while(a<c);while(!e)}catch(b){(n=!0)&&(yield W(p.cancel(b)))}finally{n===!1?yield W(p.cancel()):r.locked&&p.releaseLock()}return yield W(null)})}var da=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 I(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 I(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=N(e)),e})}},ua=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function up(r){return ae(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,c=0,d=[],p;function b(){return o==="peek"?we(d,a)[0]:([p,d,c]=we(d,a),p)}if({cmd:o,size:a}=yield yield W(null),r.isTTY)return yield yield W(new Uint8Array(0)),yield W(null);try{e[0]=ua(r,"end"),e[1]=ua(r,"error");do{if(e[2]=ua(r,"readable"),[n,s]=yield W(Promise.race(e.map(S=>S[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(p=N(r.read(a-c)),p.byteLength<a-c&&(p=N(r.read()))):p=N(r.read()),p.byteLength>0&&(d.push(p),c+=p.byteLength)),i||a<=c)do({cmd:o,size:a}=yield yield W(b()));while(a<c)}while(!i)}finally{yield W(_(e,n==="error"?s:null))}return yield W(null);function _(S,J){return p=d=null,new Promise((q,ot)=>{for(let[St,Qt]of S)r.off(St,Qt);try{let St=r.destroy;St&&St.call(r,J),J=void 0}catch(St){J=St||J}finally{J!=null?ot(J):q()}})}})}var Ut;(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"})(Ut||(Ut={}));var gt;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(gt||(gt={}));var mt;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(mt||(mt={}));var Yt;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Yt||(Yt={}));var X;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(X||(X={}));var re;(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"})(re||(re={}));var Q;(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"})(Q||(Q={}));var f;(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.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"})(f||(f={}));var Oe;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Oe||(Oe={}));var Ta={};cn(Ta,{clampIndex:()=>tm,clampRange:()=>hi,createElementComparator:()=>jr});function He(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>He(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var ha={};cn(ha,{BN:()=>un,bignumToBigInt:()=>ws,bignumToString:()=>Vr,isArrowBigNumSymbol:()=>al});var al=Symbol.for("isArrowBigNum");function ze(r,...t){return t.length===0?Object.setPrototypeOf($(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}ze.prototype[al]=!0;ze.prototype.toJSON=function(){return`"${Vr(this)}"`};ze.prototype.valueOf=function(){return cl(this)};ze.prototype.toString=function(){return Vr(this)};ze.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return cl(this);case"string":return Vr(this);case"default":return ws(this)}return Vr(this)};function En(...r){return ze.apply(this,r)}function On(...r){return ze.apply(this,r)}function di(...r){return ze.apply(this,r)}Object.setPrototypeOf(En.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(On.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(di.prototype,Object.create(Uint32Array.prototype));Object.assign(En.prototype,ze.prototype,{constructor:En,signed:!0,TypedArray:Int32Array,BigIntArray:ci});Object.assign(On.prototype,ze.prototype,{constructor:On,signed:!1,TypedArray:Uint32Array,BigIntArray:Tn});Object.assign(di.prototype,ze.prototype,{constructor:di,signed:!0,TypedArray:Uint32Array,BigIntArray:Tn});function cl(r){let{buffer:t,byteOffset:e,length:n,signed:i}=r,s=new Tn(t,e,n),o=i&&s[s.length-1]&BigInt(1)<<BigInt(63),a=BigInt(o?1:0),c=BigInt(0);if(o){for(let d of s)a+=~d*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(let d of s)a+=d*(BigInt(1)<<BigInt(32)*c++);return a}var Vr,ws;fs?(ws=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:fa(r),Vr=r=>r.byteLength===8?`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`:fa(r)):(Vr=fa,ws=Vr);function fa(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=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t||"0"}var un=class{static new(t,e){switch(e){case!0:return new En(t);case!1:return new On(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case ci:return new En(t)}return t.byteLength===16?new di(t):new On(t)}static signed(t){return new En(t)}static unsigned(t){return new On(t)}static decimal(t){return new di(t)}constructor(t,e){return un.new(t,e)}};var ll,ul,dl,fl,hl,pl,ml,_l,yl,bl,gl,wl,vl,Sl,Il,Al,Fl,xl,Bl,F=class{static isNull(t){return(t==null?void 0:t.typeId)===f.Null}static isInt(t){return(t==null?void 0:t.typeId)===f.Int}static isFloat(t){return(t==null?void 0:t.typeId)===f.Float}static isBinary(t){return(t==null?void 0:t.typeId)===f.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===f.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===f.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===f.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===f.Date}static isTime(t){return(t==null?void 0:t.typeId)===f.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===f.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===f.Interval}static isList(t){return(t==null?void 0:t.typeId)===f.List}static isStruct(t){return(t==null?void 0:t.typeId)===f.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===f.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===f.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===f.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===f.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===f.Dictionary}static isDenseUnion(t){return F.isUnion(t)&&t.mode===gt.Dense}static isSparseUnion(t){return F.isUnion(t)&&t.mode===gt.Sparse}get typeId(){return f.NONE}};ll=Symbol.toStringTag;F[ll]=(r=>(r.children=null,r.ArrayType=Array,r[Symbol.toStringTag]="DataType"))(F.prototype);var ne=class extends F{toString(){return"Null"}get typeId(){return f.Null}};ul=Symbol.toStringTag;ne[ul]=(r=>r[Symbol.toStringTag]="Null")(ne.prototype);var At=class extends F{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return f.Int}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 ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};dl=Symbol.toStringTag;At[dl]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(At.prototype);var vs=class extends At{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Ss=class extends At{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},rr=class extends At{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Is=class extends At{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},As=class extends At{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Fs=class extends At{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},xs=class extends At{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Bs=class extends At{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(vs.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Ss.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(rr.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Is.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(As.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Fs.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(xs.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Bs.prototype,"ArrayType",{value:BigUint64Array});var ce=class extends F{constructor(t){super(),this.precision=t}get typeId(){return f.Float}get ArrayType(){switch(this.precision){case mt.HALF:return Uint16Array;case mt.SINGLE:return Float32Array;case mt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};fl=Symbol.toStringTag;ce[fl]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(ce.prototype);var Ts=class extends ce{constructor(){super(mt.HALF)}},Ds=class extends ce{constructor(){super(mt.SINGLE)}},Es=class extends ce{constructor(){super(mt.DOUBLE)}};Object.defineProperty(Ts.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ds.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Es.prototype,"ArrayType",{value:Float64Array});var vr=class extends F{constructor(){super()}get typeId(){return f.Binary}toString(){return"Binary"}};hl=Symbol.toStringTag;vr[hl]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(vr.prototype);var Sr=class extends F{constructor(){super()}get typeId(){return f.Utf8}toString(){return"Utf8"}};pl=Symbol.toStringTag;Sr[pl]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Sr.prototype);var Ir=class extends F{constructor(){super()}get typeId(){return f.Bool}toString(){return"Bool"}};ml=Symbol.toStringTag;Ir[ml]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Ir.prototype);var Ar=class extends F{constructor(t,e,n=128){super(),this.scale=t,this.precision=e,this.bitWidth=n}get typeId(){return f.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};_l=Symbol.toStringTag;Ar[_l]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(Ar.prototype);var Fr=class extends F{constructor(t){super(),this.unit=t}get typeId(){return f.Date}toString(){return`Date${(this.unit+1)*32}<${Yt[this.unit]}>`}};yl=Symbol.toStringTag;Fr[yl]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(Fr.prototype);var je=class extends F{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return f.Time}toString(){return`Time${this.bitWidth}<${X[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};bl=Symbol.toStringTag;je[bl]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(je.prototype);var xr=class extends F{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return f.Timestamp}toString(){return`Timestamp<${X[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};gl=Symbol.toStringTag;xr[gl]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(xr.prototype);var Br=class extends F{constructor(t){super(),this.unit=t}get typeId(){return f.Interval}toString(){return`Interval<${re[this.unit]}>`}};wl=Symbol.toStringTag;Br[wl]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Br.prototype);var We=class extends F{constructor(t){super(),this.children=[t]}get typeId(){return f.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};vl=Symbol.toStringTag;We[vl]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(We.prototype);var ut=class extends F{constructor(t){super(),this.children=t}get typeId(){return f.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Sl=Symbol.toStringTag;ut[Sl]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(ut.prototype);var $e=class extends F{constructor(t,e,n){super(),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))}get typeId(){return f.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Il=Symbol.toStringTag;$e[Il]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))($e.prototype);var Tr=class extends F{constructor(t){super(),this.byteWidth=t}get typeId(){return f.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Al=Symbol.toStringTag;Tr[Al]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Tr.prototype);var Ye=class extends F{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return f.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Fl=Symbol.toStringTag;Ye[Fl]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Ye.prototype);var Xe=class extends F{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return f.Map}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<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};xl=Symbol.toStringTag;Xe[xl]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Xe.prototype);var dp=(r=>()=>++r)(-1),ve=class extends F{constructor(t,e,n,i){super(),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?dp():typeof n=="number"?n:n.low}get typeId(){return f.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Bl=Symbol.toStringTag;ve[Bl]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(ve.prototype);function Se(r){let t=r;switch(r.typeId){case f.Decimal:return r.bitWidth/32;case f.Timestamp:return 2;case f.Date:return 1+t.unit;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}var D=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 fp(this,t,e)}getVisitFnByTypeId(t,e=!0){return Mn(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}visitBinary(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}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function fp(r,t,e=!0){return typeof t=="number"?Mn(r,t,e):typeof t=="string"&&t in f?Mn(r,f[t],e):t&&t instanceof F?Mn(r,Tl(t),e):(t==null?void 0:t.type)&&t.type instanceof F?Mn(r,Tl(t.type),e):Mn(r,f.NONE,e)}function Mn(r,t,e=!0){let n=null;switch(t){case f.Null:n=r.visitNull;break;case f.Bool:n=r.visitBool;break;case f.Int:n=r.visitInt;break;case f.Int8:n=r.visitInt8||r.visitInt;break;case f.Int16:n=r.visitInt16||r.visitInt;break;case f.Int32:n=r.visitInt32||r.visitInt;break;case f.Int64:n=r.visitInt64||r.visitInt;break;case f.Uint8:n=r.visitUint8||r.visitInt;break;case f.Uint16:n=r.visitUint16||r.visitInt;break;case f.Uint32:n=r.visitUint32||r.visitInt;break;case f.Uint64:n=r.visitUint64||r.visitInt;break;case f.Float:n=r.visitFloat;break;case f.Float16:n=r.visitFloat16||r.visitFloat;break;case f.Float32:n=r.visitFloat32||r.visitFloat;break;case f.Float64:n=r.visitFloat64||r.visitFloat;break;case f.Utf8:n=r.visitUtf8;break;case f.Binary:n=r.visitBinary;break;case f.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case f.Date:n=r.visitDate;break;case f.DateDay:n=r.visitDateDay||r.visitDate;break;case f.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case f.Timestamp:n=r.visitTimestamp;break;case f.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case f.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case f.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case f.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case f.Time:n=r.visitTime;break;case f.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case f.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case f.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case f.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case f.Decimal:n=r.visitDecimal;break;case f.List:n=r.visitList;break;case f.Struct:n=r.visitStruct;break;case f.Union:n=r.visitUnion;break;case f.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case f.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case f.Dictionary:n=r.visitDictionary;break;case f.Interval:n=r.visitInterval;break;case f.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case f.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case f.FixedSizeList:n=r.visitFixedSizeList;break;case f.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function Tl(r){switch(r.typeId){case f.Null:return f.Null;case f.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?f.Int8:f.Uint8;case 16:return e?f.Int16:f.Uint16;case 32:return e?f.Int32:f.Uint32;case 64:return e?f.Int64:f.Uint64}return f.Int}case f.Float:switch(r.precision){case mt.HALF:return f.Float16;case mt.SINGLE:return f.Float32;case mt.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.Utf8:return f.Utf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(r.unit){case X.SECOND:return f.TimeSecond;case X.MILLISECOND:return f.TimeMillisecond;case X.MICROSECOND:return f.TimeMicrosecond;case X.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(r.unit){case X.SECOND:return f.TimestampSecond;case X.MILLISECOND:return f.TimestampMillisecond;case X.MICROSECOND:return f.TimestampMicrosecond;case X.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(r.unit){case Yt.DAY:return f.DateDay;case Yt.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(r.unit){case re.DAY_TIME:return f.IntervalDayTime;case re.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(r.mode){case gt.Dense:return f.DenseUnion;case gt.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[r.typeId]}'`)}D.prototype.visitInt8=null;D.prototype.visitInt16=null;D.prototype.visitInt32=null;D.prototype.visitInt64=null;D.prototype.visitUint8=null;D.prototype.visitUint16=null;D.prototype.visitUint32=null;D.prototype.visitUint64=null;D.prototype.visitFloat16=null;D.prototype.visitFloat32=null;D.prototype.visitFloat64=null;D.prototype.visitDateDay=null;D.prototype.visitDateMillisecond=null;D.prototype.visitTimestampSecond=null;D.prototype.visitTimestampMillisecond=null;D.prototype.visitTimestampMicrosecond=null;D.prototype.visitTimestampNanosecond=null;D.prototype.visitTimeSecond=null;D.prototype.visitTimeMillisecond=null;D.prototype.visitTimeMicrosecond=null;D.prototype.visitTimeNanosecond=null;D.prototype.visitDenseUnion=null;D.prototype.visitSparseUnion=null;D.prototype.visitIntervalDayTime=null;D.prototype.visitIntervalYearMonth=null;var pa={};cn(pa,{float64ToUint16:()=>fi,uint16ToFloat64:()=>Os});var Dl=new Float64Array(1),Rn=new Uint32Array(Dl.buffer);function Os(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 fi(r){if(r!==r)return 32256;Dl[0]=r;let t=(Rn[1]&2147483648)>>16&65535,e=Rn[1]&2146435072,n=0;return e>=1089470464?Rn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Rn[1]&1048575)>>10):e<=1056964608?(n=1048576+(Rn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Rn[1]&1048575)+512>>10),t|e|n&65535}var k=class extends D{};function j(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var hp=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},ma=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},pp=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},mp=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},El=(r,t,e,n)=>{if(e+1<t.length){let{[e]:i,[e+1]:s}=t;r.set(n.subarray(0,s-i),i)}},_p=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Dr=({values:r},t,e)=>{r[t]=e},_a=({values:r},t,e)=>{r[t]=e},Ol=({values:r},t,e)=>{r[t]=fi(e)},yp=(r,t,e)=>{switch(r.type.precision){case mt.HALF:return Ol(r,t,e);case mt.SINGLE:case mt.DOUBLE:return _a(r,t,e)}},Ms=({values:r},t,e)=>{hp(r,t,e.valueOf())},Rs=({values:r},t,e)=>{ma(r,t*2,e.valueOf())},ya=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},bp=({values:r,valueOffsets:t},e,n)=>El(r,t,e,n),gp=({values:r,valueOffsets:t},e,n)=>{El(r,t,e,Pr(n))},ba=(r,t,e)=>{r.type.unit===Yt.DAY?Ms(r,t,e):Rs(r,t,e)},Us=({values:r},t,e)=>ma(r,t*2,e/1e3),Ns=({values:r},t,e)=>ma(r,t*2,e),ks=({values:r},t,e)=>pp(r,t*2,e),Ls=({values:r},t,e)=>mp(r,t*2,e),ga=(r,t,e)=>{switch(r.type.unit){case X.SECOND:return Us(r,t,e);case X.MILLISECOND:return Ns(r,t,e);case X.MICROSECOND:return ks(r,t,e);case X.NANOSECOND:return Ls(r,t,e)}},Cs=({values:r},t,e)=>{r[t]=e},Ps=({values:r},t,e)=>{r[t]=e},Vs=({values:r},t,e)=>{r[t]=e},Hs=({values:r},t,e)=>{r[t]=e},wa=(r,t,e)=>{switch(r.type.unit){case X.SECOND:return Cs(r,t,e);case X.MILLISECOND:return Ps(r,t,e);case X.MICROSECOND:return Vs(r,t,e);case X.NANOSECOND:return Hs(r,t,e)}},va=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},wp=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=Xt.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))},vp=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=Xt.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]),Ip=(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)),Fp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),xp=(r,t,e)=>{let n=r.type.children.map(s=>Xt.getVisitFn(s.type)),i=e instanceof Map?Ap(t,e):e instanceof L?Ip(t,e):Array.isArray(e)?Sp(t,e):Fp(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},Bp=(r,t,e)=>{r.type.mode===gt.Dense?Ml(r,t,e):Rl(r,t,e)},Ml=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Xt.visit(i,r.valueOffsets[t],e)},Rl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Xt.visit(i,t,e)},Tp=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Sa=(r,t,e)=>{r.type.unit===re.DAY_TIME?zs(r,t,e):js(r,t,e)},zs=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},js=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Dp=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=Xt.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=j(_p);k.prototype.visitInt=j(Dr);k.prototype.visitInt8=j(Dr);k.prototype.visitInt16=j(Dr);k.prototype.visitInt32=j(Dr);k.prototype.visitInt64=j(Dr);k.prototype.visitUint8=j(Dr);k.prototype.visitUint16=j(Dr);k.prototype.visitUint32=j(Dr);k.prototype.visitUint64=j(Dr);k.prototype.visitFloat=j(yp);k.prototype.visitFloat16=j(Ol);k.prototype.visitFloat32=j(_a);k.prototype.visitFloat64=j(_a);k.prototype.visitUtf8=j(gp);k.prototype.visitBinary=j(bp);k.prototype.visitFixedSizeBinary=j(ya);k.prototype.visitDate=j(ba);k.prototype.visitDateDay=j(Ms);k.prototype.visitDateMillisecond=j(Rs);k.prototype.visitTimestamp=j(ga);k.prototype.visitTimestampSecond=j(Us);k.prototype.visitTimestampMillisecond=j(Ns);k.prototype.visitTimestampMicrosecond=j(ks);k.prototype.visitTimestampNanosecond=j(Ls);k.prototype.visitTime=j(wa);k.prototype.visitTimeSecond=j(Cs);k.prototype.visitTimeMillisecond=j(Ps);k.prototype.visitTimeMicrosecond=j(Vs);k.prototype.visitTimeNanosecond=j(Hs);k.prototype.visitDecimal=j(va);k.prototype.visitList=j(wp);k.prototype.visitStruct=j(xp);k.prototype.visitUnion=j(Bp);k.prototype.visitDenseUnion=j(Ml);k.prototype.visitSparseUnion=j(Rl);k.prototype.visitDictionary=j(Tp);k.prototype.visitInterval=j(Sa);k.prototype.visitIntervalDayTime=j(zs);k.prototype.visitIntervalYearMonth=j(js);k.prototype.visitFixedSizeList=j(Dp);k.prototype.visitMap=j(vp);var Xt=new k;var Ge=Symbol.for("parent"),Un=Symbol.for("rowIndex"),Hr=class{constructor(t,e){return this[Ge]=t,this[Un]=e,new Proxy(this,new Aa)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Un],e=this[Ge],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=Bt.visit(e.children[s],t);return i}toString(){return`{${[...this].map(([t,e])=>`${He(t)}: ${He(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Ia(this[Ge],this[Un])}},Ia=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,Bt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Hr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ge]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Un]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Aa=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ge].type.children.map(e=>e.name)}has(t,e){return t[Ge].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Ge].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[Ge].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=Bt.visit(t[Ge].children[n],t[Un]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ge].type.children.findIndex(s=>s.name===e);return i!==-1?(Xt.visit(t[Ge].children[i],t[Un],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var O=class extends D{};function P(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Ep=(r,t)=>864e5*r[t],Fa=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),Op=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,Mp=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,Ul=r=>new Date(r),Rp=(r,t)=>Ul(Ep(r,t)),Up=(r,t)=>Ul(Fa(r,t)),Np=(r,t)=>null,Nl=(r,t,e)=>{if(e+1>=t.length)return null;let n=t[e],i=t[e+1];return r.subarray(n,i)},kp=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},kl=({values:r},t)=>Rp(r,t),Ll=({values:r},t)=>Up(r,t*2),zr=({stride:r,values:t},e)=>t[r*e],Lp=({stride:r,values:t},e)=>Os(t[r*e]),Cl=({values:r},t)=>r[t],Cp=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Pp=({values:r,valueOffsets:t},e)=>Nl(r,t,e),Vp=({values:r,valueOffsets:t},e)=>{let n=Nl(r,t,e);return n!==null?ai(n):null},Hp=({values:r},t)=>r[t],zp=({type:r,values:t},e)=>r.precision!==mt.HALF?t[e]:Os(t[e]),jp=(r,t)=>r.type.unit===Yt.DAY?kl(r,t):Ll(r,t),Pl=({values:r},t)=>1e3*Fa(r,t*2),Vl=({values:r},t)=>Fa(r,t*2),Hl=({values:r},t)=>Op(r,t*2),zl=({values:r},t)=>Mp(r,t*2),Wp=(r,t)=>{switch(r.type.unit){case X.SECOND:return Pl(r,t);case X.MILLISECOND:return Vl(r,t);case X.MICROSECOND:return Hl(r,t);case X.NANOSECOND:return zl(r,t)}},jl=({values:r},t)=>r[t],Wl=({values:r},t)=>r[t],$l=({values:r},t)=>r[t],Yl=({values:r},t)=>r[t],$p=(r,t)=>{switch(r.type.unit){case X.SECOND:return jl(r,t);case X.MILLISECOND:return Wl(r,t);case X.MICROSECOND:return $l(r,t);case X.NANOSECOND:return Yl(r,t)}},Yp=({values:r,stride:t},e)=>un.decimal(r.subarray(t*e,t*(e+1))),Xp=(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 L([c])},Gp=(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))},Kp=(r,t)=>new Hr(r,t),Jp=(r,t)=>r.type.mode===gt.Dense?Xl(r,t):Gl(r,t),Xl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Bt.visit(n,r.valueOffsets[t])},Gl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Bt.visit(n,t)},qp=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},Zp=(r,t)=>r.type.unit===re.DAY_TIME?Kl(r,t):Jl(r,t),Kl=({values:r},t)=>r.subarray(2*t,2*(t+1)),Jl=({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},Qp=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new L([s])};O.prototype.visitNull=P(Np);O.prototype.visitBool=P(kp);O.prototype.visitInt=P(Hp);O.prototype.visitInt8=P(zr);O.prototype.visitInt16=P(zr);O.prototype.visitInt32=P(zr);O.prototype.visitInt64=P(Cl);O.prototype.visitUint8=P(zr);O.prototype.visitUint16=P(zr);O.prototype.visitUint32=P(zr);O.prototype.visitUint64=P(Cl);O.prototype.visitFloat=P(zp);O.prototype.visitFloat16=P(Lp);O.prototype.visitFloat32=P(zr);O.prototype.visitFloat64=P(zr);O.prototype.visitUtf8=P(Vp);O.prototype.visitBinary=P(Pp);O.prototype.visitFixedSizeBinary=P(Cp);O.prototype.visitDate=P(jp);O.prototype.visitDateDay=P(kl);O.prototype.visitDateMillisecond=P(Ll);O.prototype.visitTimestamp=P(Wp);O.prototype.visitTimestampSecond=P(Pl);O.prototype.visitTimestampMillisecond=P(Vl);O.prototype.visitTimestampMicrosecond=P(Hl);O.prototype.visitTimestampNanosecond=P(zl);O.prototype.visitTime=P($p);O.prototype.visitTimeSecond=P(jl);O.prototype.visitTimeMillisecond=P(Wl);O.prototype.visitTimeMicrosecond=P($l);O.prototype.visitTimeNanosecond=P(Yl);O.prototype.visitDecimal=P(Yp);O.prototype.visitList=P(Xp);O.prototype.visitStruct=P(Kp);O.prototype.visitUnion=P(Jp);O.prototype.visitDenseUnion=P(Xl);O.prototype.visitSparseUnion=P(Gl);O.prototype.visitDictionary=P(qp);O.prototype.visitInterval=P(Zp);O.prototype.visitIntervalDayTime=P(Kl);O.prototype.visitIntervalYearMonth=P(Jl);O.prototype.visitFixedSizeList=P(Qp);O.prototype.visitMap=P(Gp);var Bt=new O;var Me=Symbol.for("keys"),Nn=Symbol.for("vals"),nr=class{constructor(t){return this[Me]=new L([t.children[0]]).memoize(),this[Nn]=t.children[1],new Proxy(this,new Ba)}[Symbol.iterator](){return new xa(this[Me],this[Nn])}get size(){return this[Me].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Me],e=this[Nn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=Bt.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${He(t)}: ${He(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},xa=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),Bt.visit(this.vals,t)]})}},Ba=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Me].toArray().map(String)}has(t,e){return t[Me].includes(e)}getOwnPropertyDescriptor(t,e){if(t[Me].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Me].indexOf(e);if(n!==-1){let i=Bt.visit(Reflect.get(t,Nn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Me].indexOf(e);return i!==-1?(Xt.visit(Reflect.get(t,Nn),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"},[Me]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Nn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function tm(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var ql;function hi(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&&(ql=s,s=o,o=ql),o>i&&(o=i),n?n(r,s,o):[s,o]}var Zl=r=>r!==r;function jr(r){if(typeof r!=="object"||r===null)return Zl(r)?Zl: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?ca(r,e):!1:r instanceof Map?rm(r):Array.isArray(r)?em(r):r instanceof L?nm(r):im(r,!0)}function em(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=jr(r[e]);return Ws(t)}function rm(r){let t=-1,e=[];for(let n of r.values())e[++t]=jr(n);return Ws(e)}function nm(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=jr(r.get(e));return Ws(t)}function im(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]=jr(r[e[i]]);return Ws(n,e)}function Ws(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return sm(r,e);case Map:return Ql(r,e,e.keys());case nr:case Hr:case Object:case void 0:return Ql(r,e,t||Object.keys(e))}return e instanceof L?om(r,e):!1}}function sm(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 om(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 Ql(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 Da={};cn(Da,{BitIterator:()=>dn,getBit:()=>tu,getBool:()=>Ys,packBools:()=>fn,popcnt_array:()=>eu,popcnt_bit_range:()=>pi,popcnt_uint32:()=>$s,setBool:()=>am,truncateBitmap:()=>kn});function Ys(r,t,e,n){return(e&1<<n)!==0}function tu(r,t,e,n){return(e&1<<n)>>n}function am(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function kn(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):fn(new dn(e,r,t,null,Ys)).subarray(0,n)),i}return e}function fn(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 dn=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 pi(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new dn(r,t,e-t,r,tu))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return pi(r,t,i)+pi(r,n,e)+eu(r,i>>3,n-i>>3)}function eu(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+=$s(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=$s(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=$s(s.getUint8(i)),i+=1;return n}function $s(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 cm=-1,et=class{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 et?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=Se(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))),this.nullable=this._nullCount!==0&&this.nullBitmap&&this.nullBitmap.byteLength>0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}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(){let t=this._nullCount,e;return t<=cm&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-pi(e,this.offset,this.offset+this.length)),t}getValid(t){if(this.nullable&&this.nullCount>0){let e=this.offset+t;return(this.nullBitmap[e>>3]&1<<e%8)!==0}return!0}setValid(t,e){if(!this.nullable)return e;if(!this.nullBitmap||this.nullBitmap.byteLength<=t>>3){let{nullBitmap:c}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:c,_nullCount:0})}let{nullBitmap:n,offset:i}=this,s=i+t>>3,o=(i+t)%8,a=n[s]>>o&1;return e?a===0&&(n[s]|=1<<o,this._nullCount=this.nullCount+1):a===1&&(n[s]&=~(1<<o),this._nullCount=this.nullCount-1),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,s=this,o=this.children){return new et(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===f.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(kn(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[Oe.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[Oe.TYPE])&&(o[Oe.TYPE]=s.subarray(t,t+e)),(s=o[Oe.OFFSET])&&(o[Oe.OFFSET]=s.subarray(t,t+e+1))||(s=o[Oe.DATA])&&(o[Oe.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};et.prototype.children=Object.freeze([]);var hn=class extends D{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new et(e,n,i,0)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.data),s=N(t.nullBitmap),o=ln(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new et(e,n,a,c,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.data),s=N(t.nullBitmap),o=ln(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new et(e,n,a,c,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=N(t.nullBitmap),o=ln(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new et(e,n,a,c,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=N(t.nullBitmap),{length:o=i.reduce((c,{length:d})=>Math.max(c,d),0),nullCount:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=N(t.nullBitmap),o=$(e.ArrayType,t.typeIds),{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;if(F.isSparseUnion(e))return new et(e,n,a,c,[void 0,void 0,s,o],i);let d=ln(t.valueOffsets);return new et(e,n,a,c,[d,void 0,s,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.indices.ArrayType,t.data),{["dictionary"]:o=new L([new hn().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new et(e,n,a,c,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new hn().visit({type:e.valueType})}=t,s=N(t.nullBitmap),{["length"]:o=i.length/Se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new et(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new hn().visit({type:e.childType})}=t,s=N(t.nullBitmap),o=ln(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new et(e,n,a,c,[o,void 0,s],[i])}};function C(r){return new hn().visit(r)}var mi=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 Xs(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Gs(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Ks(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),b=Math.min(n-c,d);i.push(a.slice(p,b-p))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Ea(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 _i(r,t){return r.getValid(t)}function Wr(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Ea(n,this._offsets,e,t)}}function Js(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=Ea(s,this._offsets,n,e);return t=void 0,o}}function qs(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 b=n[d];if(~(a=r(b,t,o)))return c+a;o=0,c+=b.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):Ea(s,this._offsets,i,e);return t=void 0,o}}var M=class extends D{};function lm(r,t){return t===null&&r.length>0?0:-1}function um(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new dn(e,r.offset+(t||0),r.length,e,Ys)){if(!i)return n;++n}return-1}function Y(r,t,e){if(t===void 0)return-1;if(t===null)return um(r,e);let n=Bt.getVisitFn(r),i=jr(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=Bt.getVisitFn(r),i=jr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}M.prototype.visitNull=lm;M.prototype.visitBool=Y;M.prototype.visitInt=Y;M.prototype.visitInt8=Y;M.prototype.visitInt16=Y;M.prototype.visitInt32=Y;M.prototype.visitInt64=Y;M.prototype.visitUint8=Y;M.prototype.visitUint16=Y;M.prototype.visitUint32=Y;M.prototype.visitUint64=Y;M.prototype.visitFloat=Y;M.prototype.visitFloat16=Y;M.prototype.visitFloat32=Y;M.prototype.visitFloat64=Y;M.prototype.visitUtf8=Y;M.prototype.visitBinary=Y;M.prototype.visitFixedSizeBinary=Y;M.prototype.visitDate=Y;M.prototype.visitDateDay=Y;M.prototype.visitDateMillisecond=Y;M.prototype.visitTimestamp=Y;M.prototype.visitTimestampSecond=Y;M.prototype.visitTimestampMillisecond=Y;M.prototype.visitTimestampMicrosecond=Y;M.prototype.visitTimestampNanosecond=Y;M.prototype.visitTime=Y;M.prototype.visitTimeSecond=Y;M.prototype.visitTimeMillisecond=Y;M.prototype.visitTimeMicrosecond=Y;M.prototype.visitTimeNanosecond=Y;M.prototype.visitDecimal=Y;M.prototype.visitList=Y;M.prototype.visitStruct=Y;M.prototype.visitUnion=Y;M.prototype.visitDenseUnion=ru;M.prototype.visitSparseUnion=ru;M.prototype.visitDictionary=Y;M.prototype.visitInterval=Y;M.prototype.visitIntervalDayTime=Y;M.prototype.visitIntervalYearMonth=Y;M.prototype.visitFixedSizeList=Y;M.prototype.visitMap=Y;var pn=new M;var R=class extends D{};function V(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===f.Timestamp||t instanceof At&&t.bitWidth!==64||t instanceof je&&t.bitWidth!==64||t instanceof ce&&t.precision!==mt.HALF))return new mi(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new mi(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Oa(o)})}var Oa=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}};R.prototype.visitNull=V;R.prototype.visitBool=V;R.prototype.visitInt=V;R.prototype.visitInt8=V;R.prototype.visitInt16=V;R.prototype.visitInt32=V;R.prototype.visitInt64=V;R.prototype.visitUint8=V;R.prototype.visitUint16=V;R.prototype.visitUint32=V;R.prototype.visitUint64=V;R.prototype.visitFloat=V;R.prototype.visitFloat16=V;R.prototype.visitFloat32=V;R.prototype.visitFloat64=V;R.prototype.visitUtf8=V;R.prototype.visitBinary=V;R.prototype.visitFixedSizeBinary=V;R.prototype.visitDate=V;R.prototype.visitDateDay=V;R.prototype.visitDateMillisecond=V;R.prototype.visitTimestamp=V;R.prototype.visitTimestampSecond=V;R.prototype.visitTimestampMillisecond=V;R.prototype.visitTimestampMicrosecond=V;R.prototype.visitTimestampNanosecond=V;R.prototype.visitTime=V;R.prototype.visitTimeSecond=V;R.prototype.visitTimeMillisecond=V;R.prototype.visitTimeMicrosecond=V;R.prototype.visitTimeNanosecond=V;R.prototype.visitDecimal=V;R.prototype.visitList=V;R.prototype.visitStruct=V;R.prototype.visitUnion=V;R.prototype.visitDenseUnion=V;R.prototype.visitSparseUnion=V;R.prototype.visitDictionary=V;R.prototype.visitInterval=V;R.prototype.visitIntervalDayTime=V;R.prototype.visitIntervalYearMonth=V;R.prototype.visitFixedSizeList=V;R.prototype.visitMap=V;var Ln=new R;var dm=(r,t)=>r+t,ir=class extends D{visitNull(t,e){return 0}visitInt(t,e){return t.type.bitWidth/8}visitFloat(t,e){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,e){return 1/8}visitDecimal(t,e){return t.type.bitWidth/8}visitDate(t,e){return(t.type.unit+1)*4}visitTime(t,e){return t.type.bitWidth/8}visitTimestamp(t,e){return t.type.unit===X.SECOND?4:8}visitInterval(t,e){return(t.type.unit+1)*4}visitStruct(t,e){return t.children.reduce((n,i)=>n+Ie.visit(i,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((n,i)=>n+Ie.visit(i,e),0)}visitDictionary(t,e){var n;return t.type.indices.bitWidth/8+(((n=t.dictionary)===null||n===void 0?void 0:n.getByteLength(t.values[e]))||0)}},fm=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),hm=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),pm=({valueOffsets:r,stride:t,children:e},n)=>{let i=e[0],{[n*t]:s}=r,{[n*t+1]:o}=r,a=Ie.getVisitFn(i.type),c=i.slice(s,o-s),d=8;for(let p=-1,b=o-s;++p<b;)d+=a(c,p);return d},mm=({stride:r,children:t},e)=>{let n=t[0],i=n.slice(e*r,r),s=Ie.getVisitFn(n.type),o=0;for(let a=-1,c=i.length;++a<c;)o+=s(i,a);return o},_m=(r,t)=>r.type.mode===gt.Dense?nu(r,t):iu(r,t),nu=({type:r,children:t,typeIds:e,valueOffsets:n},i)=>{let s=r.typeIdToChildIndex[e[i]];return 8+Ie.visit(t[s],n[i])},iu=({children:r},t)=>4+Ie.visitMany(r,r.map(()=>t)).reduce(dm,0);ir.prototype.visitUtf8=fm;ir.prototype.visitBinary=hm;ir.prototype.visitList=pm;ir.prototype.visitFixedSizeList=mm;ir.prototype.visitUnion=_m;ir.prototype.visitDenseUnion=nu;ir.prototype.visitSparseUnion=iu;var Ie=new ir;var su,ou={},au={},L=class{constructor(t){var e,n,i;let s=t[0]instanceof L?t.flatMap(a=>a.data):t;if(s.some(a=>!(a instanceof et)))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,byteLength:p}=ou[o.typeId],b=s[0];this.isValid=_=>_i(b,_),this.get=_=>a(b,_),this.set=(_,S)=>c(b,_,S),this.indexOf=_=>d(b,_),this.getByteLength=_=>p(b,_),this._offsets=[0,b.length];break}default:Object.setPrototypeOf(this,au[o.typeId]),this._offsets=Gs(s);break}this.data=s,this.type=o,this.stride=Se(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[this._offsets.length-1]}get byteLength(){return this._byteLength===-1&&(this._byteLength=this.data.reduce((t,e)=>t+e.byteLength,0)),this._byteLength}get nullCount(){return this._nullCount===-1&&(this._nullCount=Xs(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>0}getByteLength(t){return 0}[Symbol.iterator](){return Ln.visit(this)}concat(...t){return new L(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new L(hi(this,t,e,({data:n,_offsets:i},s,o)=>Ks(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.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})=>(o.array.set(a,o.offset),o.offset+=a.length,o),{array:new s(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...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 L(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return F.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(F.isDictionary(this.type)){let t=new Cn(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new L(e)}return new Cn(this)}unmemoize(){if(F.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 L(e)}return this}};su=Symbol.toStringTag;L[su]=(r=>{r.type=F.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._nullCount=-1,r._byteLength=-1,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(f).map(e=>f[e]).filter(e=>typeof e=="number"&&e!==f.NONE);for(let e of t){let n=Bt.getVisitFnByTypeId(e),i=Xt.getVisitFnByTypeId(e),s=pn.getVisitFnByTypeId(e),o=Ie.getVisitFnByTypeId(e);ou[e]={get:n,set:i,indexOf:s,byteLength:o},au[e]=Object.create(r,{isValid:{value:Wr(_i)},get:{value:Wr(Bt.getVisitFnByTypeId(e))},set:{value:Js(Xt.getVisitFnByTypeId(e))},indexOf:{value:qs(pn.getVisitFnByTypeId(e))},getByteLength:{value:Wr(Ie.getVisitFnByTypeId(e))}})}return"Vector"})(L.prototype);var Cn=class extends L{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 Cn(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new L(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function cu(r){if(!r||r.length<=0)return function(i){return!0};let t="",e=r.filter(n=>n===n);return e.length>0&&(t=`
2
2
  switch (x) {${e.map(n=>`
3
- case ${mm(n)}:`).join("")}
3
+ case ${ym(n)}:`).join("")}
4
4
  return false;
5
5
  }`),r.length!==e.length&&(t=`if (x !== x) return false;
6
6
  ${t}`),new Function("x",`${t}
7
- return true;`)}function mm(r){return typeof r!="bigint"?He(r):fs?`${He(r)}n`:`"${He(r)}"`}var Ma=(r,t)=>(r*t+63&-64||64)/t,ym=(r,t=0)=>r.length>=t?r.subarray(0,t):Tn(new r.constructor(t),r,0),$r=class{constructor(t,e=1){this.buffer=t,this.stride=e,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.trunc(t.length/e))}get byteLength(){return Math.trunc(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?Ma(n*1,this.BYTES_PER_ELEMENT):Ma(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Ma(t*this.stride,this.BYTES_PER_ELEMENT);let e=ym(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=Tn(new this.ArrayType(t),this.buffer)}};$r.prototype.offset=0;var Er=class extends $r{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}},Cn=class extends Er{constructor(t=new Uint8Array(0)){super(t,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()}},Pn=class extends Er{constructor(t=new Int32Array(1)){super(t,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++&&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,0),super.flush(t+1)}};var mt=class{constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=Se(t),this._nulls=new Cn,e&&e.length>0&&(this._isValid=cu(e))}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}toVector(){return new L([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=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${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:b}=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=b==null?void 0:b.flush(o));let y=this.children.map(S=>S.flush());return this.clear(),C({type:s,length:o,nullCount:a,children:y,child:y[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 Nt=class extends mt{constructor(t){super(t),this._values=new Er(new this.ArrayType(0),this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},sr=class extends mt{constructor(t){super(t),this._pendingLength=0,this._offsets=new Pn}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[Me].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 mn=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(i),t.pad(4),t.writeInt32(n),t.writeInt64(e),t.offset()}};var or=new Int32Array(2),Zs=new Float32Array(or.buffer),Qs=new Float64Array(or.buffer),Vn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Tt=class{constructor(t,e){this.low=t|0,this.high=e|0}static create(t,e){return t==0&&e==0?Tt.ZERO:new Tt(t,e)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(t){return this.low==t.low&&this.high==t.high}};Tt.ZERO=new Tt(0,0);var _i;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(_i||(_i={}));var ie=class{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new ie(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 new Tt(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new Tt(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return or[0]=this.readInt32(t),Zs[0]}readFloat64(t){return or[Vn?0:1]=this.readInt32(t),or[Vn?1:0]=this.readInt32(t+4),Qs[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,e.low),this.writeInt32(t+4,e.high)}writeUint64(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)}writeFloat32(t,e){Zs[0]=e,this.writeInt32(t,or[0])}writeFloat64(t,e){Qs[0]=e,this.writeInt32(t,or[Vn?0:1]),this.writeInt32(t+4,or[Vn?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),i="",s=0;if(t+=4,e===_i.UTF8_BYTES)return this.bytes_.subarray(t,t+n);for(;s<n;){let o,a=this.readUint8(t+s++);if(a<192)o=a;else{let c=this.readUint8(t+s++);if(a<224)o=(a&31)<<6|c&63;else{let d=this.readUint8(t+s++);if(a<240)o=(a&15)<<12|(c&63)<<6|d&63;else{let p=this.readUint8(t+s++);o=(a&7)<<18|(c&63)<<12|(d&63)<<6|p&63}}}o<65536?i+=String.fromCharCode(o):(o-=65536,i+=String.fromCharCode((o>>10)+55296,(o&(1<<10)-1)+56320))}return 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}createLong(t,e){return Tt.create(t,e)}createScalarList(t,e){let n=[];for(let i=0;i<e;++i)t(i)!==null&&n.push(t(i));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 Or=class{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;let e;t?e=t:e=1024,this.bb=ie.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=Or.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.equals(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 Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("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=ie.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,4+4+i),s.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let o=4-1;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(!(this.bb.readInt16(i+e)!=0))throw new Error("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)return 0;let e;if(t instanceof Uint8Array)e=t;else{e=[];let n=0;for(;n<t.length;){let i,s=t.charCodeAt(n++);if(s<55296||s>=56320)i=s;else{let o=t.charCodeAt(n++);i=(s<<10)+o+(65536-(55296<<10)-56320)}i<128?e.push(i):(i<2048?e.push(i>>6&31|192):(i<65536?e.push(i>>12&15|224):e.push(i>>18&7|240,i>>12&63|128),e.push(i>>6&63|128)),e.push(i&63|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let n=0,i=this.space,s=this.bb.bytes();n<e.length;n++)s[i++]=e[n];return this.endVector()}createLong(t,e){return Tt.create(t,e)}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 Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t),this.endVector()}};var dt=class{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 dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new dt).__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 dt.startKeyValue(t),dt.addKey(t,e),dt.addValue(t,n),dt.endKeyValue(t)}};var Yr;(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"})(Yr||(Yr={}));var Xr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Xr||(Xr={}));var bi;(function(r){r[r.DenseArray=0]="DenseArray"})(bi||(bi={}));var kt=class{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 kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new kt).__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 kt.startInt(t),kt.addBitWidth(t,e),kt.addIsSigned(t,n),kt.endInt(t)}};var Ae=class{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 Ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new Ae).__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):this.bb.createLong(0,0)}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new kt).__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):bi.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,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,bi.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var ar=class{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 ar).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new ar).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return ar.startBinary(t),ar.endBinary(t)}};var cr=class{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 cr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new cr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return cr.startBool(t),cr.endBool(t)}};var gi;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(gi||(gi={}));var le=class{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 le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new le).__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):gi.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,gi.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return le.startDate(t),le.addUnit(t,e),le.endDate(t)}};var Lt=class{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 Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new Lt).__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 Lt.startDecimal(t),Lt.addPrecision(t,e),Lt.addScale(t,n),Lt.addBitWidth(t,i),Lt.endDecimal(t)}};var Gr;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Gr||(Gr={}));var ue=class{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 ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new ue).__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 ue.startFixedSizeBinary(t),ue.addByteWidth(t,e),ue.endFixedSizeBinary(t)}};var de=class{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 de).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new de).__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 de.startFixedSizeList(t),de.addListSize(t,e),de.endFixedSizeList(t)}};var wi;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(wi||(wi={}));var fe=class{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 fe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new fe).__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):wi.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,wi.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return fe.startFloatingPoint(t),fe.addPrecision(t,e),fe.endFloatingPoint(t)}};var vi;(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"})(vi||(vi={}));var he=class{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 he).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new he).__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):vi.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,vi.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return he.startInterval(t),he.addUnit(t,e),he.endInterval(t)}};var lr=class{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 lr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new lr).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return lr.startList(t),lr.endList(t)}};var pe=class{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 pe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new pe).__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 pe.startMap(t),pe.addKeysSorted(t,e),pe.endMap(t)}};var ur=class{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 ur).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new ur).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return ur.startNull(t),ur.endNull(t)}};var dr=class{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 dr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new dr).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return dr.startStruct_(t),dr.endStruct_(t)}};var Kt=class{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 Kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new Kt).__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):Gr.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,Gr.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return Kt.startTime(t),Kt.addUnit(t,e),Kt.addBitWidth(t,n),Kt.endTime(t)}};var Jt=class{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 Jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new Jt).__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):Gr.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,Gr.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return Jt.startTimestamp(t),Jt.addUnit(t,e),Jt.addTimezone(t,n),Jt.endTimestamp(t)}};var Si;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Si||(Si={}));var Ct=class{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 Ct).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new Ct).__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):Si.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,Si.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 Ct.startUnion(t),Ct.addMode(t,e),Ct.addTypeIds(t,n),Ct.endUnion(t)}};var fr=class{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 fr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new fr).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return fr.startUtf8(t),fr.endUtf8(t)}};var yt;(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"})(yt||(yt={}));var Dt=class{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 Dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new Dt).__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):yt.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 Ae).__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 Dt).__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 dt).__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,yt.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 wt=class{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 wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new wt).__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):Xr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Dt).__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 dt).__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):this.bb.createLong(0,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,Xr.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 wt.startSchema(t),wt.addEndianness(t,e),wt.addFields(t,n),wt.addCustomMetadata(t,i),wt.addFeatures(t,s),wt.endSchema(t)}};var qt=class{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 qt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new qt).__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):Yr.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new wt).__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 mn).__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 mn).__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 dt).__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,Yr.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 G=class{constructor(t=[],e,n){this.fields=t||[],this.metadata=e||new Map,n||(n=Ra(t)),this.dictionaries=n}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){let e=new Set(t),n=this.fields.filter(i=>e.has(i.name));return new G(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new G(e,this.metadata)}assign(...t){let e=t[0]instanceof G?t[0]:Array.isArray(t[0])?new G(t[0]):new G(t),n=[...this.fields],i=eo(eo(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:eo(eo(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=Ra(s,new Map);return new G([...n,...s],i,new Map([...this.dictionaries,...o]))}};G.prototype.fields=null;G.prototype.metadata=null;G.prototype.dictionaries=null;var H=class{constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}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 H(`${e}`,n,i,s)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${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],H.new(e,n,i,s)}};H.prototype.type=null;H.prototype.name=null;H.prototype.nullable=null;H.prototype.metadata=null;function eo(r,t){return new Map([...r||new Map,...t||new Map])}function Ra(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(F.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&&Ra(s.children,t)}return t}var lu=Tt,_m=Or,bm=ie,Mr=class{constructor(t,e=Ut.V4,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}static decode(t){t=new bm(N(t));let e=qt.getRootAsFooter(t),n=G.decode(e.schema());return new Ua(n,e)}static encode(t){let e=new _m,n=G.encode(e,t.schema);qt.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Je.encode(e,o);let i=e.endVector();qt.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Je.encode(e,o);let s=e.endVector();return qt.startFooter(e),qt.addSchema(e,n),qt.addVersion(e,Ut.V4),qt.addRecordBatches(e,i),qt.addDictionaries(e,s),qt.finishFooterBuffer(e,qt.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*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 Ua=class extends Mr{constructor(t,e){super(t,e.version()),this._footer=e}get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Je.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Je.decode(e)}return null}},Je=class{constructor(t,e,n){this.metaDataLength=t,this.offset=typeof n=="number"?n:n.low,this.bodyLength=typeof e=="number"?e:e.low}static decode(t){return new Je(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=new lu(e.offset,0),s=new lu(e.bodyLength,0);return mn.createBlock(t,i,n,s)}};var ft=Object.freeze({done:!0,value:void 0}),Ii=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},yn=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())}},ro=class extends yn{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return I(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(ft);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return $t.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return $t.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return I(this,void 0,void 0,function*(){return yield this.abort(t),ft})}return(t){return I(this,void 0,void 0,function*(){return yield this.close(),ft})}read(t){return I(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return I(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(ft)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var hr=class extends ro{write(t){if((t=N(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?ai(this.toUint8Array(!0)):this.toUint8Array(!1).then(ai)}toUint8Array(t=!1){return t?we(this._values)[0]:(()=>I(this,void 0,void 0,function*(){var e,n;let i=[],s=0;try{for(var o=De(this),a;a=yield o.next(),!a.done;){let c=a.value;i.push(c),s+=c.byteLength}}catch(c){e={error:c}}finally{try{a&&!a.done&&(n=o.return)&&(yield n.call(o))}finally{if(e)throw e.error}}return we(i,s)[0]}))()}},pr=class{constructor(t){t&&(this.source=new Na($t.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)}},me=class{constructor(t){t instanceof me?this.source=t.source:t instanceof hr?this.source=new Rr($t.fromAsyncIterable(t)):bs(t)?this.source=new Rr($t.fromNodeStream(t)):li(t)?this.source=new Rr($t.fromDOMStream(t)):ys(t)?this.source=new Rr($t.fromDOMStream(t.body)):Pe(t)?this.source=new Rr($t.fromIterable(t)):Ce(t)?this.source=new Rr($t.fromAsyncIterable(t)):Ee(t)&&(this.source=new Rr($t.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)}},Na=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)||ft)}return(t){return Object.create(this.source.return&&this.source.return(t)||ft)}},Rr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return I(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return I(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return I(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return I(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return I(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||ft;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return I(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||ft;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var Ai=class extends pr{constructor(t,e){super(),this.position=0,this.buffer=N(t),this.size=typeof e>"u"?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}}},Kr=class extends me{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>I(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return I(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 I(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 I(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 I(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 I(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return I(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return I(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var La={};cn(La,{BaseInt64:()=>Fi,Int128:()=>ye,Int64:()=>Pt,Uint64:()=>rt});function Hn(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var zn=8,ka=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Fi=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`${Hn(this.buffer[1])} ${Hn(this.buffer[0])}`}},rt=class extends Fi{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return rt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return rt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new rt(e);for(let s=0;s<n;){let o=zn<n-s?zn:n-s,a=new rt(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new rt(new Uint32Array([ka[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;)rt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new rt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new rt(new Uint32Array(t.buffer)).plus(e)}},Pt=class extends Fi{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 Pt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return Pt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new Pt(e);for(let o=n?1:0;o<i;){let a=zn<i-o?zn:i-o,c=new Pt(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),d=new Pt(new Uint32Array([ka[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;)Pt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new Pt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Pt(new Uint32Array(t.buffer)).plus(e)}},ye=class{constructor(t){this.buffer=t}high(){return new Pt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Pt(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 rt(new Uint32Array([this.buffer[3],0])),n=new rt(new Uint32Array([this.buffer[2],0])),i=new rt(new Uint32Array([this.buffer[1],0])),s=new rt(new Uint32Array([this.buffer[0],0])),o=new rt(new Uint32Array([t.buffer[3],0])),a=new rt(new Uint32Array([t.buffer[2],0])),c=new rt(new Uint32Array([t.buffer[1],0])),d=new rt(new Uint32Array([t.buffer[0],0])),p=rt.multiply(s,d);this.buffer[0]=p.low();let b=new rt(new Uint32Array([p.high(),0]));return p=rt.multiply(i,d),b.plus(p),p=rt.multiply(s,c),b.plus(p),this.buffer[1]=b.low(),this.buffer[3]=b.lessThan(p)?1:0,this.buffer[2]=b.high(),new rt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(rt.multiply(n,d)).plus(rt.multiply(i,c)).plus(rt.multiply(s,a)),this.buffer[3]+=rt.multiply(e,d).plus(rt.multiply(n,c)).plus(rt.multiply(i,a)).plus(rt.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`${Hn(this.buffer[3])} ${Hn(this.buffer[2])} ${Hn(this.buffer[1])} ${Hn(this.buffer[0])}`}static multiply(t,e){return new ye(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new ye(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return ye.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return ye.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new ye(e);for(let o=n?1:0;o<i;){let a=zn<i-o?zn:i-o,c=new ye(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),d=new ye(new Uint32Array([ka[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;)ye.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var xi=class extends D{constructor(t,e,n,i){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i}visit(t){return super.visit(t instanceof H?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return C({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({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 C({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 C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({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 C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===gt.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({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 C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({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 C({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)}},no=class extends xi{constructor(t,e,n,i){super(new Uint8Array(0),e,n,i),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):fn(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return $(Uint8Array,$(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return $(Uint8Array,$(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return F.isTimestamp(t)?$(Uint8Array,Pt.convertArray(n[e])):(F.isInt(t)||F.isTime(t))&&t.bitWidth===64?$(Uint8Array,Pt.convertArray(n[e])):F.isDate(t)&&t.unit===Yt.MILLISECOND?$(Uint8Array,Pt.convertArray(n[e])):F.isDecimal(t)?$(Uint8Array,ye.convertArray(n[e])):F.isBinary(t)||F.isFixedSizeBinary(t)?gm(n[e]):F.isBool(t)?fn(n[e]):F.isUtf8(t)?Pr(n[e].join("")):$(Uint8Array,$(t.ArrayType,n[e].map(i=>+i)))}};function gm(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 jn=class extends sr{constructor(t){super(t),this._values=new $r(new Uint8Array(0))}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,N(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 io=class extends mt{constructor(t){super(t),this._values=new Cn}setValue(t,e){this._values.set(t,+e)}};var _n=class extends Nt{};_n.prototype._setValue=ba;var Bi=class extends _n{};Bi.prototype._setValue=Ms;var Ti=class extends _n{};Ti.prototype._setValue=Rs;var Di=class extends Nt{};Di.prototype._setValue=va;var so=class extends mt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new ve(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=bn({type:this.type.indices,nullValues:e}),this.dictionary=bn({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:`${t}`}};var Ei=class extends Nt{};Ei.prototype._setValue=_a;var oo=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 Ye(this.type.listSize,new H(e,t.type,!0)),n}};var gn=class extends Nt{setValue(t,e){this._values.set(t,e)}},ao=class extends gn{setValue(t,e){super.setValue(t,fi(e))}},co=class extends gn{},lo=class extends gn{};var wn=class extends Nt{};wn.prototype._setValue=Sa;var Oi=class extends wn{};Oi.prototype._setValue=zs;var Mi=class extends wn{};Mi.prototype._setValue=js;var Ue=class extends Nt{setValue(t,e){this._values.set(t,e)}},uo=class extends Ue{},fo=class extends Ue{},ho=class extends Ue{},po=class extends Ue{},mo=class extends Ue{},yo=class extends Ue{},_o=class extends Ue{},bo=class extends Ue{};var go=class extends sr{constructor(t){super(t),this._offsets=new Pn}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 We(new H(e,t.type,!0)),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 o=s.length,a=e.set(i,o).buffer[i];for(let c=-1;++c<o;)n.set(a+c,s[c])}}};var wo=class extends sr{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=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Xe(new H(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 vo=class extends mt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var So=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=`${this.numChildren}`){let n=this.children.push(t);return this.type=new ut([...this.type.children,new H(e,t.type,!0)]),n}};var Ur=class extends Nt{};Ur.prototype._setValue=ga;var Ri=class extends Ur{};Ri.prototype._setValue=Us;var Ui=class extends Ur{};Ui.prototype._setValue=Ns;var Ni=class extends Ur{};Ni.prototype._setValue=ks;var ki=class extends Ur{};ki.prototype._setValue=Ls;var Nr=class extends Nt{};Nr.prototype._setValue=wa;var Li=class extends Nr{};Li.prototype._setValue=Cs;var Ci=class extends Nr{};Ci.prototype._setValue=Ps;var Pi=class extends Nr{};Pi.prototype._setValue=Vs;var Vi=class extends Nr{};Vi.prototype._setValue=Hs;var Wn=class extends mt{constructor(t){super(t),this._typeIds=new Er(new 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.setValid(t,this.isValid(e))&&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=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:s,typeIds:o}}=this,a=[...i,new H(e,t.type)];return this.type=new $e(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.")}},Io=class extends Wn{},Ao=class extends Wn{constructor(t){super(t),this._offsets=new Er(new Int32Array(0))}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 Hi=class extends sr{constructor(t){super(t),this._values=new $r(new Uint8Array(0))}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,Pr(e))}_flushPending(t,e){}};Hi.prototype._flushPending=jn.prototype._flushPending;var Ca=class extends D{visitNull(){return vo}visitBool(){return io}visitInt(){return Ue}visitInt8(){return uo}visitInt16(){return fo}visitInt32(){return ho}visitInt64(){return po}visitUint8(){return mo}visitUint16(){return yo}visitUint32(){return _o}visitUint64(){return bo}visitFloat(){return gn}visitFloat16(){return ao}visitFloat32(){return co}visitFloat64(){return lo}visitUtf8(){return Hi}visitBinary(){return jn}visitFixedSizeBinary(){return Ei}visitDate(){return _n}visitDateDay(){return Bi}visitDateMillisecond(){return Ti}visitTimestamp(){return Ur}visitTimestampSecond(){return Ri}visitTimestampMillisecond(){return Ui}visitTimestampMicrosecond(){return Ni}visitTimestampNanosecond(){return ki}visitTime(){return Nr}visitTimeSecond(){return Li}visitTimeMillisecond(){return Ci}visitTimeMicrosecond(){return Pi}visitTimeNanosecond(){return Vi}visitDecimal(){return Di}visitList(){return go}visitStruct(){return So}visitUnion(){return Wn}visitDenseUnion(){return Ao}visitSparseUnion(){return Io}visitDictionary(){return so}visitInterval(){return wn}visitIntervalDayTime(){return Oi}visitIntervalYearMonth(){return Mi}visitFixedSizeList(){return oo}visitMap(){return wo}},uu=new Ca;var U=class extends D{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 _e(r,t){return t instanceof r.constructor}function zi(r,t){return r===t||_e(r,t)}function kr(r,t){return r===t||_e(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function Fo(r,t){return r===t||_e(r,t)&&r.precision===t.precision}function wm(r,t){return r===t||_e(r,t)&&r.byteWidth===t.byteWidth}function Pa(r,t){return r===t||_e(r,t)&&r.unit===t.unit}function ji(r,t){return r===t||_e(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Wi(r,t){return r===t||_e(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function vm(r,t){return r===t||_e(r,t)&&r.children.length===t.children.length&&mr.compareManyFields(r.children,t.children)}function Sm(r,t){return r===t||_e(r,t)&&r.children.length===t.children.length&&mr.compareManyFields(r.children,t.children)}function Va(r,t){return r===t||_e(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&mr.compareManyFields(r.children,t.children)}function Im(r,t){return r===t||_e(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&mr.visit(r.indices,t.indices)&&mr.visit(r.dictionary,t.dictionary)}function Ha(r,t){return r===t||_e(r,t)&&r.unit===t.unit}function Am(r,t){return r===t||_e(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&mr.compareManyFields(r.children,t.children)}function Fm(r,t){return r===t||_e(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&mr.compareManyFields(r.children,t.children)}U.prototype.visitNull=zi;U.prototype.visitBool=zi;U.prototype.visitInt=kr;U.prototype.visitInt8=kr;U.prototype.visitInt16=kr;U.prototype.visitInt32=kr;U.prototype.visitInt64=kr;U.prototype.visitUint8=kr;U.prototype.visitUint16=kr;U.prototype.visitUint32=kr;U.prototype.visitUint64=kr;U.prototype.visitFloat=Fo;U.prototype.visitFloat16=Fo;U.prototype.visitFloat32=Fo;U.prototype.visitFloat64=Fo;U.prototype.visitUtf8=zi;U.prototype.visitBinary=zi;U.prototype.visitFixedSizeBinary=wm;U.prototype.visitDate=Pa;U.prototype.visitDateDay=Pa;U.prototype.visitDateMillisecond=Pa;U.prototype.visitTimestamp=ji;U.prototype.visitTimestampSecond=ji;U.prototype.visitTimestampMillisecond=ji;U.prototype.visitTimestampMicrosecond=ji;U.prototype.visitTimestampNanosecond=ji;U.prototype.visitTime=Wi;U.prototype.visitTimeSecond=Wi;U.prototype.visitTimeMillisecond=Wi;U.prototype.visitTimeMicrosecond=Wi;U.prototype.visitTimeNanosecond=Wi;U.prototype.visitDecimal=zi;U.prototype.visitList=vm;U.prototype.visitStruct=Sm;U.prototype.visitUnion=Va;U.prototype.visitDenseUnion=Va;U.prototype.visitSparseUnion=Va;U.prototype.visitDictionary=Im;U.prototype.visitInterval=Ha;U.prototype.visitIntervalDayTime=Ha;U.prototype.visitIntervalYearMonth=Ha;U.prototype.visitFixedSizeList=Am;U.prototype.visitMap=Fm;var mr=new U;function vn(r,t){return mr.compareSchemas(r,t)}function du(r,t){return mr.compareFields(r,t)}function fu(r,t){return mr.visit(r,t)}function bn(r){let t=r.type,e=new(uu.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(bn(Object.assign(Object.assign({},d),{type:c})))}}return e}function xo(r,t){return xm(r,t.map(e=>e.data.concat()))}function xm(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((b,y)=>Math.max(b,y.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=Bm(e,o,p,t,i),o>0&&(n[s++]=C({type:new ut(e),length:o,nullCount:0,children:p.slice()})))}return[r=r.assign(e),n.map(b=>new ct(r,b))]}function Bm(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 b=r[a];r[a]=b.clone({nullable:!0}),e[a]=(s=d==null?void 0:d._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:C({type:b.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var hu,It=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new G([]),this._offsets=[0],this;let i,s;t[0]instanceof G&&(i=t.shift()),t[t.length-1]instanceof Uint32Array&&(s=t.pop());let o=c=>{if(c){if(c instanceof ct)return[c];if(c instanceof It)return c.batches;if(c instanceof et){if(c.type instanceof ut)return[new ct(new G(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(S=>new L([c[S]])),b=new G(d.map((S,J)=>new H(String(S),p[J].type))),[,y]=xo(b,p);return y.length===0?[new ct(c)]:y}}}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 G([]),!(i instanceof G))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(!vn(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:Gs(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=Xs(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}getByteLength(t){return 0}[Symbol.iterator](){return kn.visit(new L(this.data))}toArray(){return[...this]}toString(){return`[
7
+ return true;`)}function ym(r){return typeof r!="bigint"?He(r):fs?`${He(r)}n`:`"${He(r)}"`}var Ma=(r,t)=>(r*t+63&-64||64)/t,bm=(r,t=0)=>r.length>=t?r.subarray(0,t):Dn(new r.constructor(t),r,0),$r=class{constructor(t,e=1){this.buffer=t,this.stride=e,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.trunc(t.length/e))}get byteLength(){return Math.trunc(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?Ma(n*1,this.BYTES_PER_ELEMENT):Ma(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Ma(t*this.stride,this.BYTES_PER_ELEMENT);let e=bm(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=Dn(new this.ArrayType(t),this.buffer)}};$r.prototype.offset=0;var Er=class extends $r{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}},Pn=class extends Er{constructor(t=new Uint8Array(0)){super(t,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()}},Vn=class extends Er{constructor(t=new Int32Array(1)){super(t,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++&&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,0),super.flush(t+1)}};var _t=class{constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=Se(t),this._nulls=new Pn,e&&e.length>0&&(this._isValid=cu(e))}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}toVector(){return new L([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=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${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:b}=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=b==null?void 0:b.flush(o));let _=this.children.map(S=>S.flush());return this.clear(),C({type:s,length:o,nullCount:a,children:_,child:_[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}};_t.prototype.length=1;_t.prototype.stride=1;_t.prototype.children=null;_t.prototype.finished=!1;_t.prototype.nullValues=null;_t.prototype._isValid=()=>!0;var Nt=class extends _t{constructor(t){super(t),this._values=new Er(new this.ArrayType(0),this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},sr=class extends _t{constructor(t){super(t),this._pendingLength=0,this._offsets=new Vn}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[Me].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 mn=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(i),t.pad(4),t.writeInt32(n),t.writeInt64(e),t.offset()}};var or=new Int32Array(2),Zs=new Float32Array(or.buffer),Qs=new Float64Array(or.buffer),Hn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Tt=class{constructor(t,e){this.low=t|0,this.high=e|0}static create(t,e){return t==0&&e==0?Tt.ZERO:new Tt(t,e)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(t){return this.low==t.low&&this.high==t.high}};Tt.ZERO=new Tt(0,0);var yi;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(yi||(yi={}));var ie=class{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new ie(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 new Tt(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new Tt(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return or[0]=this.readInt32(t),Zs[0]}readFloat64(t){return or[Hn?0:1]=this.readInt32(t),or[Hn?1:0]=this.readInt32(t+4),Qs[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,e.low),this.writeInt32(t+4,e.high)}writeUint64(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)}writeFloat32(t,e){Zs[0]=e,this.writeInt32(t,or[0])}writeFloat64(t,e){Qs[0]=e,this.writeInt32(t,or[Hn?0:1]),this.writeInt32(t+4,or[Hn?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),i="",s=0;if(t+=4,e===yi.UTF8_BYTES)return this.bytes_.subarray(t,t+n);for(;s<n;){let o,a=this.readUint8(t+s++);if(a<192)o=a;else{let c=this.readUint8(t+s++);if(a<224)o=(a&31)<<6|c&63;else{let d=this.readUint8(t+s++);if(a<240)o=(a&15)<<12|(c&63)<<6|d&63;else{let p=this.readUint8(t+s++);o=(a&7)<<18|(c&63)<<12|(d&63)<<6|p&63}}}o<65536?i+=String.fromCharCode(o):(o-=65536,i+=String.fromCharCode((o>>10)+55296,(o&(1<<10)-1)+56320))}return 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}createLong(t,e){return Tt.create(t,e)}createScalarList(t,e){let n=[];for(let i=0;i<e;++i)t(i)!==null&&n.push(t(i));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 Or=class{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;let e;t?e=t:e=1024,this.bb=ie.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=Or.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.equals(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 Error("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new Error("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=ie.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,4+4+i),s.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let o=4-1;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(!(this.bb.readInt16(i+e)!=0))throw new Error("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)return 0;let e;if(t instanceof Uint8Array)e=t;else{e=[];let n=0;for(;n<t.length;){let i,s=t.charCodeAt(n++);if(s<55296||s>=56320)i=s;else{let o=t.charCodeAt(n++);i=(s<<10)+o+(65536-(55296<<10)-56320)}i<128?e.push(i):(i<2048?e.push(i>>6&31|192):(i<65536?e.push(i>>12&15|224):e.push(i>>18&7|240,i>>12&63|128),e.push(i>>6&63|128)),e.push(i&63|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let n=0,i=this.space,s=this.bb.bytes();n<e.length;n++)s[i++]=e[n];return this.endVector()}createLong(t,e){return Tt.create(t,e)}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 Error("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t),this.endVector()}};var dt=class{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 dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new dt).__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 dt.startKeyValue(t),dt.addKey(t,e),dt.addValue(t,n),dt.endKeyValue(t)}};var Yr;(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"})(Yr||(Yr={}));var Xr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Xr||(Xr={}));var bi;(function(r){r[r.DenseArray=0]="DenseArray"})(bi||(bi={}));var kt=class{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 kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new kt).__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 kt.startInt(t),kt.addBitWidth(t,e),kt.addIsSigned(t,n),kt.endInt(t)}};var Ae=class{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 Ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new Ae).__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):this.bb.createLong(0,0)}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new kt).__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):bi.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,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,bi.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var ar=class{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 ar).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new ar).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return ar.startBinary(t),ar.endBinary(t)}};var cr=class{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 cr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new cr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return cr.startBool(t),cr.endBool(t)}};var gi;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(gi||(gi={}));var le=class{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 le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new le).__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):gi.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,gi.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return le.startDate(t),le.addUnit(t,e),le.endDate(t)}};var Lt=class{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 Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new Lt).__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 Lt.startDecimal(t),Lt.addPrecision(t,e),Lt.addScale(t,n),Lt.addBitWidth(t,i),Lt.endDecimal(t)}};var Gr;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Gr||(Gr={}));var ue=class{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 ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new ue).__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 ue.startFixedSizeBinary(t),ue.addByteWidth(t,e),ue.endFixedSizeBinary(t)}};var de=class{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 de).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new de).__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 de.startFixedSizeList(t),de.addListSize(t,e),de.endFixedSizeList(t)}};var wi;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(wi||(wi={}));var fe=class{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 fe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new fe).__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):wi.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,wi.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return fe.startFloatingPoint(t),fe.addPrecision(t,e),fe.endFloatingPoint(t)}};var vi;(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"})(vi||(vi={}));var he=class{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 he).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new he).__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):vi.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,vi.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return he.startInterval(t),he.addUnit(t,e),he.endInterval(t)}};var lr=class{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 lr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new lr).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return lr.startList(t),lr.endList(t)}};var pe=class{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 pe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new pe).__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 pe.startMap(t),pe.addKeysSorted(t,e),pe.endMap(t)}};var ur=class{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 ur).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new ur).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return ur.startNull(t),ur.endNull(t)}};var dr=class{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 dr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new dr).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return dr.startStruct_(t),dr.endStruct_(t)}};var Kt=class{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 Kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new Kt).__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):Gr.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,Gr.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return Kt.startTime(t),Kt.addUnit(t,e),Kt.addBitWidth(t,n),Kt.endTime(t)}};var Jt=class{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 Jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new Jt).__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):Gr.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,Gr.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return Jt.startTimestamp(t),Jt.addUnit(t,e),Jt.addTimezone(t,n),Jt.endTimestamp(t)}};var Si;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Si||(Si={}));var Ct=class{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 Ct).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new Ct).__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):Si.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,Si.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 Ct.startUnion(t),Ct.addMode(t,e),Ct.addTypeIds(t,n),Ct.endUnion(t)}};var fr=class{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 fr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new fr).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return fr.startUtf8(t),fr.endUtf8(t)}};var yt;(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"})(yt||(yt={}));var Dt=class{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 Dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new Dt).__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):yt.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 Ae).__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 Dt).__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 dt).__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,yt.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 wt=class{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 wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new wt).__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):Xr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Dt).__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 dt).__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):this.bb.createLong(0,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,Xr.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 wt.startSchema(t),wt.addEndianness(t,e),wt.addFields(t,n),wt.addCustomMetadata(t,i),wt.addFeatures(t,s),wt.endSchema(t)}};var qt=class{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 qt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new qt).__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):Yr.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new wt).__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 mn).__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 mn).__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 dt).__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,Yr.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 G=class{constructor(t=[],e,n){this.fields=t||[],this.metadata=e||new Map,n||(n=Ra(t)),this.dictionaries=n}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){let e=new Set(t),n=this.fields.filter(i=>e.has(i.name));return new G(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new G(e,this.metadata)}assign(...t){let e=t[0]instanceof G?t[0]:Array.isArray(t[0])?new G(t[0]):new G(t),n=[...this.fields],i=eo(eo(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:eo(eo(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=Ra(s,new Map);return new G([...n,...s],i,new Map([...this.dictionaries,...o]))}};G.prototype.fields=null;G.prototype.metadata=null;G.prototype.dictionaries=null;var H=class{constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}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 H(`${e}`,n,i,s)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${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],H.new(e,n,i,s)}};H.prototype.type=null;H.prototype.name=null;H.prototype.nullable=null;H.prototype.metadata=null;function eo(r,t){return new Map([...r||new Map,...t||new Map])}function Ra(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(F.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&&Ra(s.children,t)}return t}var lu=Tt,gm=Or,wm=ie,Mr=class{constructor(t,e=Ut.V4,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}static decode(t){t=new wm(N(t));let e=qt.getRootAsFooter(t),n=G.decode(e.schema());return new Ua(n,e)}static encode(t){let e=new gm,n=G.encode(e,t.schema);qt.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Je.encode(e,o);let i=e.endVector();qt.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Je.encode(e,o);let s=e.endVector();return qt.startFooter(e),qt.addSchema(e,n),qt.addVersion(e,Ut.V4),qt.addRecordBatches(e,i),qt.addDictionaries(e,s),qt.finishFooterBuffer(e,qt.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*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 Ua=class extends Mr{constructor(t,e){super(t,e.version()),this._footer=e}get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Je.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Je.decode(e)}return null}},Je=class{constructor(t,e,n){this.metaDataLength=t,this.offset=typeof n=="number"?n:n.low,this.bodyLength=typeof e=="number"?e:e.low}static decode(t){return new Je(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=new lu(e.offset,0),s=new lu(e.bodyLength,0);return mn.createBlock(t,i,n,s)}};var ft=Object.freeze({done:!0,value:void 0}),Ii=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},_n=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())}},ro=class extends _n{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return I(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(ft);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return $t.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return $t.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return I(this,void 0,void 0,function*(){return yield this.abort(t),ft})}return(t){return I(this,void 0,void 0,function*(){return yield this.close(),ft})}read(t){return I(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return I(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(ft)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var hr=class extends ro{write(t){if((t=N(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?ai(this.toUint8Array(!0)):this.toUint8Array(!1).then(ai)}toUint8Array(t=!1){return t?we(this._values)[0]:(()=>I(this,void 0,void 0,function*(){var e,n;let i=[],s=0;try{for(var o=De(this),a;a=yield o.next(),!a.done;){let c=a.value;i.push(c),s+=c.byteLength}}catch(c){e={error:c}}finally{try{a&&!a.done&&(n=o.return)&&(yield n.call(o))}finally{if(e)throw e.error}}return we(i,s)[0]}))()}},pr=class{constructor(t){t&&(this.source=new Na($t.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)}},me=class{constructor(t){t instanceof me?this.source=t.source:t instanceof hr?this.source=new Rr($t.fromAsyncIterable(t)):bs(t)?this.source=new Rr($t.fromNodeStream(t)):li(t)?this.source=new Rr($t.fromDOMStream(t)):_s(t)?this.source=new Rr($t.fromDOMStream(t.body)):Pe(t)?this.source=new Rr($t.fromIterable(t)):Ce(t)?this.source=new Rr($t.fromAsyncIterable(t)):Ee(t)&&(this.source=new Rr($t.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)}},Na=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)||ft)}return(t){return Object.create(this.source.return&&this.source.return(t)||ft)}},Rr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return I(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return I(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return I(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return I(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return I(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||ft;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return I(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||ft;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var Ai=class extends pr{constructor(t,e){super(),this.position=0,this.buffer=N(t),this.size=typeof e>"u"?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}}},Kr=class extends me{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>I(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return I(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 I(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 I(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 I(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 I(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return I(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return I(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var La={};cn(La,{BaseInt64:()=>Fi,Int128:()=>_e,Int64:()=>Pt,Uint64:()=>rt});function zn(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var jn=8,ka=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Fi=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`${zn(this.buffer[1])} ${zn(this.buffer[0])}`}},rt=class extends Fi{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return rt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return rt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new rt(e);for(let s=0;s<n;){let o=jn<n-s?jn:n-s,a=new rt(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new rt(new Uint32Array([ka[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;)rt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new rt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new rt(new Uint32Array(t.buffer)).plus(e)}},Pt=class extends Fi{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 Pt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return Pt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new Pt(e);for(let o=n?1:0;o<i;){let a=jn<i-o?jn:i-o,c=new Pt(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),d=new Pt(new Uint32Array([ka[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;)Pt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new Pt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Pt(new Uint32Array(t.buffer)).plus(e)}},_e=class{constructor(t){this.buffer=t}high(){return new Pt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Pt(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 rt(new Uint32Array([this.buffer[3],0])),n=new rt(new Uint32Array([this.buffer[2],0])),i=new rt(new Uint32Array([this.buffer[1],0])),s=new rt(new Uint32Array([this.buffer[0],0])),o=new rt(new Uint32Array([t.buffer[3],0])),a=new rt(new Uint32Array([t.buffer[2],0])),c=new rt(new Uint32Array([t.buffer[1],0])),d=new rt(new Uint32Array([t.buffer[0],0])),p=rt.multiply(s,d);this.buffer[0]=p.low();let b=new rt(new Uint32Array([p.high(),0]));return p=rt.multiply(i,d),b.plus(p),p=rt.multiply(s,c),b.plus(p),this.buffer[1]=b.low(),this.buffer[3]=b.lessThan(p)?1:0,this.buffer[2]=b.high(),new rt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(rt.multiply(n,d)).plus(rt.multiply(i,c)).plus(rt.multiply(s,a)),this.buffer[3]+=rt.multiply(e,d).plus(rt.multiply(n,c)).plus(rt.multiply(i,a)).plus(rt.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`${zn(this.buffer[3])} ${zn(this.buffer[2])} ${zn(this.buffer[1])} ${zn(this.buffer[0])}`}static multiply(t,e){return new _e(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new _e(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return _e.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return _e.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new _e(e);for(let o=n?1:0;o<i;){let a=jn<i-o?jn:i-o,c=new _e(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),d=new _e(new Uint32Array([ka[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;)_e.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var xi=class extends D{constructor(t,e,n,i){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i}visit(t){return super.visit(t instanceof H?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return C({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({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 C({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 C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({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 C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===gt.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({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 C({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return C({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 C({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)}},no=class extends xi{constructor(t,e,n,i){super(new Uint8Array(0),e,n,i),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):fn(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return $(Uint8Array,$(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return $(Uint8Array,$(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return F.isTimestamp(t)?$(Uint8Array,Pt.convertArray(n[e])):(F.isInt(t)||F.isTime(t))&&t.bitWidth===64?$(Uint8Array,Pt.convertArray(n[e])):F.isDate(t)&&t.unit===Yt.MILLISECOND?$(Uint8Array,Pt.convertArray(n[e])):F.isDecimal(t)?$(Uint8Array,_e.convertArray(n[e])):F.isBinary(t)||F.isFixedSizeBinary(t)?vm(n[e]):F.isBool(t)?fn(n[e]):F.isUtf8(t)?Pr(n[e].join("")):$(Uint8Array,$(t.ArrayType,n[e].map(i=>+i)))}};function vm(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 Wn=class extends sr{constructor(t){super(t),this._values=new $r(new Uint8Array(0))}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,N(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 io=class extends _t{constructor(t){super(t),this._values=new Pn}setValue(t,e){this._values.set(t,+e)}};var yn=class extends Nt{};yn.prototype._setValue=ba;var Bi=class extends yn{};Bi.prototype._setValue=Ms;var Ti=class extends yn{};Ti.prototype._setValue=Rs;var Di=class extends Nt{};Di.prototype._setValue=va;var so=class extends _t{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new ve(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=bn({type:this.type.indices,nullValues:e}),this.dictionary=bn({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:`${t}`}};var Ei=class extends Nt{};Ei.prototype._setValue=ya;var oo=class extends _t{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 Ye(this.type.listSize,new H(e,t.type,!0)),n}};var gn=class extends Nt{setValue(t,e){this._values.set(t,e)}},ao=class extends gn{setValue(t,e){super.setValue(t,fi(e))}},co=class extends gn{},lo=class extends gn{};var wn=class extends Nt{};wn.prototype._setValue=Sa;var Oi=class extends wn{};Oi.prototype._setValue=zs;var Mi=class extends wn{};Mi.prototype._setValue=js;var Ue=class extends Nt{setValue(t,e){this._values.set(t,e)}},uo=class extends Ue{},fo=class extends Ue{},ho=class extends Ue{},po=class extends Ue{},mo=class extends Ue{},_o=class extends Ue{},yo=class extends Ue{},bo=class extends Ue{};var go=class extends sr{constructor(t){super(t),this._offsets=new Vn}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 We(new H(e,t.type,!0)),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 o=s.length,a=e.set(i,o).buffer[i];for(let c=-1;++c<o;)n.set(a+c,s[c])}}};var wo=class extends sr{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=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Xe(new H(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 vo=class extends _t{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var So=class extends _t{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=`${this.numChildren}`){let n=this.children.push(t);return this.type=new ut([...this.type.children,new H(e,t.type,!0)]),n}};var Ur=class extends Nt{};Ur.prototype._setValue=ga;var Ri=class extends Ur{};Ri.prototype._setValue=Us;var Ui=class extends Ur{};Ui.prototype._setValue=Ns;var Ni=class extends Ur{};Ni.prototype._setValue=ks;var ki=class extends Ur{};ki.prototype._setValue=Ls;var Nr=class extends Nt{};Nr.prototype._setValue=wa;var Li=class extends Nr{};Li.prototype._setValue=Cs;var Ci=class extends Nr{};Ci.prototype._setValue=Ps;var Pi=class extends Nr{};Pi.prototype._setValue=Vs;var Vi=class extends Nr{};Vi.prototype._setValue=Hs;var $n=class extends _t{constructor(t){super(t),this._typeIds=new Er(new 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.setValid(t,this.isValid(e))&&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=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:s,typeIds:o}}=this,a=[...i,new H(e,t.type)];return this.type=new $e(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.")}},Io=class extends $n{},Ao=class extends $n{constructor(t){super(t),this._offsets=new Er(new Int32Array(0))}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 Hi=class extends sr{constructor(t){super(t),this._values=new $r(new Uint8Array(0))}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,Pr(e))}_flushPending(t,e){}};Hi.prototype._flushPending=Wn.prototype._flushPending;var Ca=class extends D{visitNull(){return vo}visitBool(){return io}visitInt(){return Ue}visitInt8(){return uo}visitInt16(){return fo}visitInt32(){return ho}visitInt64(){return po}visitUint8(){return mo}visitUint16(){return _o}visitUint32(){return yo}visitUint64(){return bo}visitFloat(){return gn}visitFloat16(){return ao}visitFloat32(){return co}visitFloat64(){return lo}visitUtf8(){return Hi}visitBinary(){return Wn}visitFixedSizeBinary(){return Ei}visitDate(){return yn}visitDateDay(){return Bi}visitDateMillisecond(){return Ti}visitTimestamp(){return Ur}visitTimestampSecond(){return Ri}visitTimestampMillisecond(){return Ui}visitTimestampMicrosecond(){return Ni}visitTimestampNanosecond(){return ki}visitTime(){return Nr}visitTimeSecond(){return Li}visitTimeMillisecond(){return Ci}visitTimeMicrosecond(){return Pi}visitTimeNanosecond(){return Vi}visitDecimal(){return Di}visitList(){return go}visitStruct(){return So}visitUnion(){return $n}visitDenseUnion(){return Ao}visitSparseUnion(){return Io}visitDictionary(){return so}visitInterval(){return wn}visitIntervalDayTime(){return Oi}visitIntervalYearMonth(){return Mi}visitFixedSizeList(){return oo}visitMap(){return wo}},uu=new Ca;var U=class extends D{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 ye(r,t){return t instanceof r.constructor}function zi(r,t){return r===t||ye(r,t)}function kr(r,t){return r===t||ye(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function Fo(r,t){return r===t||ye(r,t)&&r.precision===t.precision}function Sm(r,t){return r===t||ye(r,t)&&r.byteWidth===t.byteWidth}function Pa(r,t){return r===t||ye(r,t)&&r.unit===t.unit}function ji(r,t){return r===t||ye(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Wi(r,t){return r===t||ye(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function Im(r,t){return r===t||ye(r,t)&&r.children.length===t.children.length&&mr.compareManyFields(r.children,t.children)}function Am(r,t){return r===t||ye(r,t)&&r.children.length===t.children.length&&mr.compareManyFields(r.children,t.children)}function Va(r,t){return r===t||ye(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&mr.compareManyFields(r.children,t.children)}function Fm(r,t){return r===t||ye(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&mr.visit(r.indices,t.indices)&&mr.visit(r.dictionary,t.dictionary)}function Ha(r,t){return r===t||ye(r,t)&&r.unit===t.unit}function xm(r,t){return r===t||ye(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&mr.compareManyFields(r.children,t.children)}function Bm(r,t){return r===t||ye(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&mr.compareManyFields(r.children,t.children)}U.prototype.visitNull=zi;U.prototype.visitBool=zi;U.prototype.visitInt=kr;U.prototype.visitInt8=kr;U.prototype.visitInt16=kr;U.prototype.visitInt32=kr;U.prototype.visitInt64=kr;U.prototype.visitUint8=kr;U.prototype.visitUint16=kr;U.prototype.visitUint32=kr;U.prototype.visitUint64=kr;U.prototype.visitFloat=Fo;U.prototype.visitFloat16=Fo;U.prototype.visitFloat32=Fo;U.prototype.visitFloat64=Fo;U.prototype.visitUtf8=zi;U.prototype.visitBinary=zi;U.prototype.visitFixedSizeBinary=Sm;U.prototype.visitDate=Pa;U.prototype.visitDateDay=Pa;U.prototype.visitDateMillisecond=Pa;U.prototype.visitTimestamp=ji;U.prototype.visitTimestampSecond=ji;U.prototype.visitTimestampMillisecond=ji;U.prototype.visitTimestampMicrosecond=ji;U.prototype.visitTimestampNanosecond=ji;U.prototype.visitTime=Wi;U.prototype.visitTimeSecond=Wi;U.prototype.visitTimeMillisecond=Wi;U.prototype.visitTimeMicrosecond=Wi;U.prototype.visitTimeNanosecond=Wi;U.prototype.visitDecimal=zi;U.prototype.visitList=Im;U.prototype.visitStruct=Am;U.prototype.visitUnion=Va;U.prototype.visitDenseUnion=Va;U.prototype.visitSparseUnion=Va;U.prototype.visitDictionary=Fm;U.prototype.visitInterval=Ha;U.prototype.visitIntervalDayTime=Ha;U.prototype.visitIntervalYearMonth=Ha;U.prototype.visitFixedSizeList=xm;U.prototype.visitMap=Bm;var mr=new U;function vn(r,t){return mr.compareSchemas(r,t)}function du(r,t){return mr.compareFields(r,t)}function fu(r,t){return mr.visit(r,t)}function bn(r){let t=r.type,e=new(uu.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(bn(Object.assign(Object.assign({},d),{type:c})))}}return e}function xo(r,t){return Tm(r,t.map(e=>e.data.concat()))}function Tm(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((b,_)=>Math.max(b,_.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=Dm(e,o,p,t,i),o>0&&(n[s++]=C({type:new ut(e),length:o,nullCount:0,children:p.slice()})))}return[r=r.assign(e),n.map(b=>new ct(r,b))]}function Dm(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 b=r[a];r[a]=b.clone({nullable:!0}),e[a]=(s=d==null?void 0:d._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:C({type:b.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var hu,It=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new G([]),this._offsets=[0],this;let i,s;t[0]instanceof G&&(i=t.shift()),t[t.length-1]instanceof Uint32Array&&(s=t.pop());let o=c=>{if(c){if(c instanceof ct)return[c];if(c instanceof It)return c.batches;if(c instanceof et){if(c.type instanceof ut)return[new ct(new G(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(S=>new L([c[S]])),b=new G(d.map((S,J)=>new H(String(S),p[J].type))),[,_]=xo(b,p);return _.length===0?[new ct(c)]:_}}}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 G([]),!(i instanceof G))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(!vn(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:Gs(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=Xs(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}getByteLength(t){return 0}[Symbol.iterator](){return Ln.visit(new L(this.data))}toArray(){return[...this]}toString(){return`[
8
8
  ${this.toArray().join(`,
9
9
  `)}
10
- ]`}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new It(e,n.map(i=>new ct(e,i)))}slice(t,e){let n=this.schema;[t,e]=hi({length:this.numRows},t,e);let i=Ks(this.data,this._offsets,t,e);return new It(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=C({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new L(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 L([C({type:new ne,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]=xo(n,a)}return new It(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 It(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,d)=>{let[p,b]=a,y=e.findIndex(S=>S.name===c.name);return~y?b[y]=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 It(...xo(s,o))}};hu=Symbol.toStringTag;It[hu]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Wr(yi),r.get=Wr(Bt.getVisitFn(f.Struct)),r.set=Js(Xt.getVisitFn(f.Struct)),r.indexOf=qs(pn.getVisitFn(f.Struct)),r.getByteLength=Wr(Ie.getVisitFn(f.Struct)),"Table"))(It.prototype);var mu,ct=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof G))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=C({nullCount:0,type:new ut(this.schema.fields),children:this.schema.fields.map(e=>C({type:e.type,nullCount:0}))})]=t,!(this.data instanceof et))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=pu(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]=H.new({name:d,type:e[d].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new G(n),a=C({type:new ut(n),length:s,children:i,nullCount:0});[this.schema,this.data]=pu(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=yu(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 Bt.visit(this.data,t)}set(t,e){return Xt.visit(this.data,t,e)}indexOf(t,e){return pn.visit(this.data,t,e)}getByteLength(t){return Ie.visit(this.data,t)}[Symbol.iterator](){return kn.visit(new L([this.data]))}toArray(){return[...this]}concat(...t){return new It(this.schema,[this,...t])}slice(t,e){let[n]=new L([this.data]).slice(t,e).data;return new ct(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 L([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 L([C({type:new ne,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 G(s,new Map(this.schema.metadata)),i=C({type:new ut(s),children:o})}return new ct(n,i)}select(t){let e=this.schema.select(t),n=new ut(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 ct(e,C({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=C({type:new ut(e.fields),length:this.numRows,children:n});return new ct(e,i)}};mu=Symbol.toStringTag;ct[mu]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ct.prototype);function pu(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:C({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),C({type:new ut(i),length:e,children:s})]}function yu(r,t,e=new Map){for(let n=-1,i=r.length;++n<i;){let o=r[n].type,a=t[n];if(F.isDictionary(o)){if(!e.has(o.id))a.dictionary&&e.set(o.id,a.dictionary);else if(e.get(o.id)!==a.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&yu(o.children,a.children,e)}return e}var Sn=class extends ct{constructor(t){let e=t.fields.map(i=>C({type:i.type})),n=C({type:new ut(t.fields),nullCount:0,children:e});super(t,n)}};var $i;(function(r){r[r.BUFFER=0]="BUFFER"})($i||($i={}));var Yi;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Yi||(Yi={}));var qe=class{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 qe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new qe).__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):Yi.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):$i.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Yi.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,$i.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return qe.startBodyCompression(t),qe.addCodec(t,e),qe.addMethod(t,n),qe.endBodyCompression(t)}};var $n=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(n),t.writeInt64(e),t.offset()}};var Yn=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(n),t.writeInt64(e),t.offset()}};var Zt=class{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 Zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new Zt).__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):this.bb.createLong(0,0)}nodes(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Yn).__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 $n).__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 qe).__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,t.createLong(0,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 Ne=class{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 Ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new Ne).__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):this.bb.createLong(0,0)}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Zt).__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,t.createLong(0,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 Xn;(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"})(Xn||(Xn={}));var Ft=class{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 Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new Ft).__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):Yr.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Xn.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):this.bb.createLong(0,0)}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new dt).__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,Yr.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,Xn.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,t.createLong(0,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 Ft.startMessage(t),Ft.addVersion(t,e),Ft.addHeaderType(t,n),Ft.addHeader(t,i),Ft.addBodyLength(t,s),Ft.addCustomMetadata(t,o),Ft.endMessage(t)}};var Dm=Tt,za=class extends D{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return ur.startNull(e),ur.endNull(e)}visitInt(t,e){return kt.startInt(e),kt.addBitWidth(e,t.bitWidth),kt.addIsSigned(e,t.isSigned),kt.endInt(e)}visitFloat(t,e){return fe.startFloatingPoint(e),fe.addPrecision(e,t.precision),fe.endFloatingPoint(e)}visitBinary(t,e){return ar.startBinary(e),ar.endBinary(e)}visitBool(t,e){return cr.startBool(e),cr.endBool(e)}visitUtf8(t,e){return fr.startUtf8(e),fr.endUtf8(e)}visitDecimal(t,e){return Lt.startDecimal(e),Lt.addScale(e,t.scale),Lt.addPrecision(e,t.precision),Lt.addBitWidth(e,t.bitWidth),Lt.endDecimal(e)}visitDate(t,e){return le.startDate(e),le.addUnit(e,t.unit),le.endDate(e)}visitTime(t,e){return Kt.startTime(e),Kt.addUnit(e,t.unit),Kt.addBitWidth(e,t.bitWidth),Kt.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return Jt.startTimestamp(e),Jt.addUnit(e,t.unit),n!==void 0&&Jt.addTimezone(e,n),Jt.endTimestamp(e)}visitInterval(t,e){return he.startInterval(e),he.addUnit(e,t.unit),he.endInterval(e)}visitList(t,e){return lr.startList(e),lr.endList(e)}visitStruct(t,e){return dr.startStruct_(e),dr.endStruct_(e)}visitUnion(t,e){Ct.startTypeIdsVector(e,t.typeIds.length);let n=Ct.createTypeIdsVector(e,t.typeIds);return Ct.startUnion(e),Ct.addMode(e,t.mode),Ct.addTypeIds(e,n),Ct.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return Ae.startDictionaryEncoding(e),Ae.addId(e,new Dm(t.id,0)),Ae.addIsOrdered(e,t.isOrdered),n!==void 0&&Ae.addIndexType(e,n),Ae.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return ue.startFixedSizeBinary(e),ue.addByteWidth(e,t.byteWidth),ue.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return de.startFixedSizeList(e),de.addListSize(e,t.listSize),de.endFixedSizeList(e)}visitMap(t,e){return pe.startMap(e),pe.addKeysSorted(e,t.keysSorted),pe.endMap(e)}},Bo=new za;function wu(r,t=new Map){return new G(Em(r,t),To(r.customMetadata),t)}function ja(r){return new Gt(r.count,Su(r.columns),Iu(r.columns))}function vu(r){return new ge(ja(r.data),r.id,r.isDelta)}function Em(r,t){return(r.fields||[]).filter(Boolean).map(e=>H.fromJSON(e,t))}function _u(r,t){return(r.children||[]).filter(Boolean).map(e=>H.fromJSON(e,t))}function Su(r){return(r||[]).reduce((t,e)=>[...t,new Ze(e.count,Om(e.VALIDITY)),...Su(e.children)],[])}function Iu(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new be(t.length,i.VALIDITY.length)),i.TYPE&&t.push(new be(t.length,i.TYPE.length)),i.OFFSET&&t.push(new be(t.length,i.OFFSET.length)),i.DATA&&t.push(new be(t.length,i.DATA.length)),t=Iu(i.children,t)}return t}function Om(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Au(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=gu(r,_u(r,t)),i=new H(r.name,o,r.nullable,To(r.customMetadata))):t.has(e=s.id)?(n=(n=s.indexType)?bu(n):new rr,a=new ve(t.get(e),n,e,s.isOrdered),i=new H(r.name,a,r.nullable,To(r.customMetadata))):(n=(n=s.indexType)?bu(n):new rr,t.set(e,o=gu(r,_u(r,t))),a=new ve(o,n,e,s.isOrdered),i=new H(r.name,a,r.nullable,To(r.customMetadata))),i||null}function To(r){return new Map(Object.entries(r||{}))}function bu(r){return new At(r.isSigned,r.bitWidth)}function gu(r,t){let e=r.type.name;switch(e){case"NONE":return new ne;case"null":return new ne;case"binary":return new vr;case"utf8":return new Sr;case"bool":return new Ir;case"list":return new We((t||[])[0]);case"struct":return new ut(t||[]);case"struct_":return new ut(t||[])}switch(e){case"int":{let n=r.type;return new At(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new ce(pt[n.precision])}case"decimal":{let n=r.type;return new Ar(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new Fr(Yt[n.unit])}case"time":{let n=r.type;return new je(X[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new xr(X[n.unit],n.timezone)}case"interval":{let n=r.type;return new Br(re[n.unit])}case"union":{let n=r.type;return new $e(gt[n.mode],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new Tr(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Ye(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Xe((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var In=Tt,Mm=Or,Rm=ie,Et=class{constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=typeof t=="number"?t:t.low}static fromJSON(t,e){let n=new Et(0,Ut.V4,e);return n._createHeader=Um(t,e),n}static decode(t){t=new Rm(N(t));let e=Ft.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new Et(n,i,s);return o._createHeader=Nm(e,s),o}static encode(t){let e=new Mm,n=-1;return t.isSchema()?n=G.encode(e,t.header()):t.isRecordBatch()?n=Gt.encode(e,t.header()):t.isDictionaryBatch()&&(n=ge.encode(e,t.header())),Ft.startMessage(e),Ft.addVersion(e,Ut.V4),Ft.addHeader(e,n),Ft.addHeaderType(e,t.headerType),Ft.addBodyLength(e,new In(t.bodyLength,0)),Ft.finishMessageBuffer(e,Ft.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof G)return new Et(0,Ut.V4,Q.Schema,t);if(t instanceof Gt)return new Et(e,Ut.V4,Q.RecordBatch,t);if(t instanceof ge)return new Et(e,Ut.V4,Q.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${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===Q.Schema}isRecordBatch(){return this.headerType===Q.RecordBatch}isDictionaryBatch(){return this.headerType===Q.DictionaryBatch}},Gt=class{constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=typeof t=="number"?t:t.low}get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}},ge=class{constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=typeof e=="number"?e:e.low}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}},be=class{constructor(t,e){this.offset=typeof t=="number"?t:t.low,this.length=typeof e=="number"?e:e.low}},Ze=class{constructor(t,e){this.length=typeof t=="number"?t:t.low,this.nullCount=typeof e=="number"?e:e.low}};function Um(r,t){return()=>{switch(t){case Q.Schema:return G.fromJSON(r);case Q.RecordBatch:return Gt.fromJSON(r);case Q.DictionaryBatch:return ge.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${Q[t]}, type: ${t} }`)}}function Nm(r,t){return()=>{switch(t){case Q.Schema:return G.decode(r.header(new wt));case Q.RecordBatch:return Gt.decode(r.header(new Zt),r.version());case Q.DictionaryBatch:return ge.decode(r.header(new Ne),r.version())}throw new Error(`Unrecognized Message type: { name: ${Q[t]}, type: ${t} }`)}}H.encode=Ym;H.decode=Wm;H.fromJSON=Au;G.encode=$m;G.decode=km;G.fromJSON=wu;Gt.encode=Xm;Gt.decode=Lm;Gt.fromJSON=ja;ge.encode=Gm;ge.decode=Cm;ge.fromJSON=vu;Ze.encode=Km;Ze.decode=Vm;be.encode=Jm;be.decode=Pm;function km(r,t=new Map){let e=jm(r,t);return new G(e,Do(r),t)}function Lm(r,t=Ut.V4){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Gt(r.length(),Hm(r),zm(r,t))}function Cm(r,t=Ut.V4){return new ge(Gt.decode(r.data(),t),r.id(),r.isDelta())}function Pm(r){return new be(r.offset(),r.length())}function Vm(r){return new Ze(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]=Ze.decode(e));return t}function zm(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<Ut.V4&&(n.bb_pos+=8*(i+1)),e[++s]=be.decode(n));return e}function jm(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=H.decode(n,t));return e}function Fu(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=H.decode(n,t));return e}function Wm(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=Bu(r,Fu(r,t)),n=new H(r.name(),i,r.nullable(),Do(r))):t.has(e=a.id().low)?(s=(s=a.indexType())?xu(s):new rr,o=new ve(t.get(e),s,e,a.isOrdered()),n=new H(r.name(),o,r.nullable(),Do(r))):(s=(s=a.indexType())?xu(s):new rr,t.set(e,i=Bu(r,Fu(r,t))),o=new ve(i,s,e,a.isOrdered()),n=new H(r.name(),o,r.nullable(),Do(r))),n||null}function Do(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 xu(r){return new At(r.isSigned(),r.bitWidth())}function Bu(r,t){let e=r.typeType();switch(e){case yt.NONE:return new ne;case yt.Null:return new ne;case yt.Binary:return new vr;case yt.Utf8:return new Sr;case yt.Bool:return new Ir;case yt.List:return new We((t||[])[0]);case yt.Struct_:return new ut(t||[])}switch(e){case yt.Int:{let n=r.type(new kt);return new At(n.isSigned(),n.bitWidth())}case yt.FloatingPoint:{let n=r.type(new fe);return new ce(n.precision())}case yt.Decimal:{let n=r.type(new Lt);return new Ar(n.scale(),n.precision(),n.bitWidth())}case yt.Date:{let n=r.type(new le);return new Fr(n.unit())}case yt.Time:{let n=r.type(new Kt);return new je(n.unit(),n.bitWidth())}case yt.Timestamp:{let n=r.type(new Jt);return new xr(n.unit(),n.timezone())}case yt.Interval:{let n=r.type(new he);return new Br(n.unit())}case yt.Union:{let n=r.type(new Ct);return new $e(n.mode(),n.typeIdsArray()||[],t||[])}case yt.FixedSizeBinary:{let n=r.type(new ue);return new Tr(n.byteWidth())}case yt.FixedSizeList:{let n=r.type(new de);return new Ye(n.listSize(),(t||[])[0])}case yt.Map:{let n=r.type(new pe);return new Xe((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${yt[e]}" (${e})`)}function $m(r,t){let e=t.fields.map(s=>H.encode(r,s));wt.startFieldsVector(r,e.length);let n=wt.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?wt.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString(`${s}`),c=r.createString(`${o}`);return dt.startKeyValue(r),dt.addKey(r,a),dt.addValue(r,c),dt.endKeyValue(r)})):-1;return wt.startSchema(r),wt.addFields(r,n),wt.addEndianness(r,qm?Xr.Little:Xr.Big),i!==-1&&wt.addCustomMetadata(r,i),wt.endSchema(r)}function Ym(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;F.isDictionary(s)?(o=s.dictionary.typeId,i=Bo.visit(s,r),n=Bo.visit(s.dictionary,r)):n=Bo.visit(s,r);let a=(s.children||[]).map(p=>H.encode(r,p)),c=Dt.createChildrenVector(r,a),d=t.metadata&&t.metadata.size>0?Dt.createCustomMetadataVector(r,[...t.metadata].map(([p,b])=>{let y=r.createString(`${p}`),S=r.createString(`${b}`);return dt.startKeyValue(r),dt.addKey(r,y),dt.addValue(r,S),dt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),Dt.startField(r),Dt.addType(r,n),Dt.addTypeType(r,o),Dt.addChildren(r,c),Dt.addNullable(r,!!t.nullable),e!==-1&&Dt.addName(r,e),i!==-1&&Dt.addDictionary(r,i),d!==-1&&Dt.addCustomMetadata(r,d),Dt.endField(r)}function Xm(r,t){let e=t.nodes||[],n=t.buffers||[];Zt.startNodesVector(r,e.length);for(let o of e.slice().reverse())Ze.encode(r,o);let i=r.endVector();Zt.startBuffersVector(r,n.length);for(let o of n.slice().reverse())be.encode(r,o);let s=r.endVector();return Zt.startRecordBatch(r),Zt.addLength(r,new In(t.length,0)),Zt.addNodes(r,i),Zt.addBuffers(r,s),Zt.endRecordBatch(r)}function Gm(r,t){let e=Gt.encode(r,t.data);return Ne.startDictionaryBatch(r),Ne.addId(r,new In(t.id,0)),Ne.addIsDelta(r,t.isDelta),Ne.addData(r,e),Ne.endDictionaryBatch(r)}function Km(r,t){return Yn.createFieldNode(r,new In(t.length,0),new In(t.nullCount,0))}function Jm(r,t){return $n.createBuffer(r,new In(t.offset,0),new In(t.length,0))}var qm=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var $a=r=>`Expected ${Q[r]} Message in stream, but was null or length 0.`,Ya=r=>`Header pointer of flatbuffer-encoded ${Q[r]} Message is null or length 0.`,Tu=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Du=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,Gn=class{constructor(t){this.source=t instanceof pr?t:new pr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?ft:t.value===-1&&(t=this.readMetadataLength()).done?ft:(t=this.readMetadata(t.value)).done?ft: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($a(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=N(this.source.read(t));if(e.byteLength<t)throw new Error(Du(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=Q.Schema,n=this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(Ya(e));return i}readMetadataLength(){let t=this.source.read(Eo),e=t&&new ie(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 ft;if(e.byteLength<t)throw new Error(Tu(t,e.byteLength));return{done:!1,value:Et.decode(e)}}},Xi=class{constructor(t,e){this.source=t instanceof me?t:ms(t)?new Kr(t,e):new me(t)}[Symbol.asyncIterator](){return this}next(){return I(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?ft:t.value===-1&&(t=yield this.readMetadataLength()).done?ft:(t=yield this.readMetadata(t.value)).done?ft:t})}throw(t){return I(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return I(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return I(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($a(t));return e.value})}readMessageBody(t){return I(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=N(yield this.source.read(t));if(e.byteLength<t)throw new Error(Du(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return I(this,void 0,void 0,function*(){let e=Q.Schema,n=yield this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(Ya(e));return i})}readMetadataLength(){return I(this,void 0,void 0,function*(){let t=yield this.source.read(Eo),e=t&&new ie(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(t){return I(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return ft;if(e.byteLength<t)throw new Error(Tu(t,e.byteLength));return{done:!1,value:Et.decode(e)}})}},Gi=class extends Gn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Ii?t:new Ii(t)}next(){let{_json:t}=this;if(!this._schema){this._schema=!0;let e=Et.fromJSON(t.schema,Q.Schema);return{done:!1,value:e}}if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];this._body=e.data.columns;let n=Et.fromJSON(e,Q.DictionaryBatch);return{done:!1,value:n}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];this._body=e.columns;let n=Et.fromJSON(e,Q.RecordBatch);return{done:!1,value:n}}return this._body=[],ft}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE&&[s.TYPE]||[],...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($a(t));return e.value}readSchema(){let t=Q.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(Ya(t));return n}},Eo=4,Wa="ARROW1",Kn=new Uint8Array(Wa.length);for(let r=0;r<Wa.length;r+=1)Kn[r]=Wa.codePointAt(r);function Oo(r,t=0){for(let e=-1,n=Kn.length;++e<n;)if(Kn[e]!==r[t+e])return!1;return!0}var Jn=Kn.length,Xa=Jn+Eo,Eu=Jn*2+Eo;var xt=class extends yn{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 Ce(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 $t.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return $t.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 xt?t:hs(t)?Qm(t):ms(t)?ry(t):Ce(t)?(()=>I(this,void 0,void 0,function*(){return yield xt.from(yield t)}))():ys(t)||li(t)||bs(t)||Ee(t)?ey(new me(t)):ty(new pr(t))}static readAll(t){return t instanceof xt?t.isSync()?Ou(t):Mu(t):hs(t)||ArrayBuffer.isView(t)||Pe(t)||ps(t)?Ou(t):Mu(t)}},yr=class extends xt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return ae(this,arguments,function*(){yield W(yield*xn(De(this[Symbol.iterator]())))})}},Jr=class extends xt{constructor(t){super(t),this._impl=t}readAll(){var t,e;return I(this,void 0,void 0,function*(){let n=new Array;try{for(var i=De(this),s;s=yield i.next(),!s.done;){let o=s.value;n.push(o)}}catch(o){t={error:o}}finally{try{s&&!s.done&&(e=i.return)&&(yield e.call(i))}finally{if(t)throw t.error}}return n})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},qr=class extends yr{constructor(t){super(t),this._impl=t}},Ki=class extends Jr{constructor(t){super(t),this._impl=t}},Mo=class{constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}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=C({type:new ut(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);if(i||!a){let c=o.dictionaries.get(n),d=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new L(d)):new L(d)).memoize()}return a.memoize()}_loadVectors(t,e,n){return new xi(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}},qn=class extends Mo{constructor(t,e){super(e),this._reader=hs(t)?new Gi(this._handle=t):new Gn(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=Ru(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):ft}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):ft}next(){if(this.closed)return ft;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),s=this._loadRecordBatch(n,i);return{done:!1,value:s}}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 Sn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Zn=class extends Mo{constructor(t,e){super(e),this._reader=new Xi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return I(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 I(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Ru(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return I(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):ft})}return(t){return I(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):ft})}next(){return I(this,void 0,void 0,function*(){if(this.closed)return ft;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),s=this._loadRecordBatch(n,i);return{done:!1,value:s}}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 Sn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return I(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Ro=class extends qn{constructor(t,e){super(t instanceof Ai?t:new Ai(t),e)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}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(Q.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(Q.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-Xa,n=t.readInt32(e),i=t.readAt(e-n,n);return Mr.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}},Ga=class extends Zn{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 Kr?t:new Kr(t,n),i)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return I(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){var e;return I(this,void 0,void 0,function*(){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(Q.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){var e;return I(this,void 0,void 0,function*(){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(Q.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 I(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-Xa,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return Mr.decode(i)})}_readNextMessageAndValidate(t){return I(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})}},Ka=class extends qn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new no(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}};function Ru(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Ou(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 Mu(r){return ae(this,arguments,function*(){let e=yield W(xt.from(r));try{if(!(yield W(e.open({autoDestroy:!1}))).closed)do yield yield W(e);while(!(yield W(e.reset().open())).closed)}finally{yield W(e.cancel())}})}function Qm(r){return new yr(new Ka(r))}function ty(r){let t=r.peek(Jn+7&-8);return t&&t.byteLength>=4?Oo(t)?new qr(new Ro(r.read())):new yr(new qn(r)):new yr(new qn(function*(){}()))}function ey(r){return I(this,void 0,void 0,function*(){let t=yield r.peek(Jn+7&-8);return t&&t.byteLength>=4?Oo(t)?new qr(new Ro(yield r.read())):new Jr(new Zn(r)):new Jr(new Zn(function(){return ae(this,arguments,function*(){})}()))})}function ry(r){return I(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Kr(r,t);return t>=Eu&&Oo(yield e.readAt(0,Jn+7&-8))?new Ki(new Ga(e)):new Jr(new Zn(e))})}var vt=class extends D{constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof ct?s.data.children:s.data),n=new vt;return n.visitMany(e(t)),n}visit(t){if(t instanceof L)return this.visitMany(t.data),this;let{type:e}=t;if(!F.isDictionary(e)){let{length:n,nullCount:i}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");F.isNull(e)||Qe.call(this,i<=0?new Uint8Array(0):Nn(t.offset,n,t.nullBitmap)),this.nodes.push(new Ze(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 Qe(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new be(this._byteLength,t)),this._byteLength+=t,this}function ny(r){let{type:t,length:e,typeIds:n,valueOffsets:i}=r;if(Qe.call(this,n),t.mode===gt.Sparse)return Ja.call(this,r);if(t.mode===gt.Dense){if(r.offset<=0)return Qe.call(this,i),Ja.call(this,r);{let s=n.reduce((p,b)=>Math.max(p,b),n[0]),o=new Int32Array(s+1),a=new Int32Array(s+1).fill(-1),c=new Int32Array(e),d=ui(-i[0],e,i);for(let p,b,y=-1;++y<e;)(b=a[p=n[y]])===-1&&(b=a[p]=d[p]),c[y]=d[y]-b,++o[p];Qe.call(this,c);for(let p,b=-1,y=t.children.length;++b<y;)if(p=r.children[b]){let S=t.typeIds[b],J=Math.min(e,o[S]);this.visit(p.slice(a[S],J))}}}return this}function iy(r){let t;return r.nullCount>=r.length?Qe.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?Qe.call(this,Nn(r.offset,r.length,t)):Qe.call(this,fn(r.values))}function Zr(r){return Qe.call(this,r.values.subarray(0,r.length*r.stride))}function Uu(r){let{length:t,values:e,valueOffsets:n}=r,i=n[0],s=n[t],o=Math.min(s-i,e.byteLength-i);return Qe.call(this,ui(-n[0],t,n)),Qe.call(this,e.subarray(i,i+o)),this}function qa(r){let{length:t,valueOffsets:e}=r;return e&&Qe.call(this,ui(e[0],t,e)),this.visit(r.children[0])}function Ja(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}vt.prototype.visitBool=iy;vt.prototype.visitInt=Zr;vt.prototype.visitFloat=Zr;vt.prototype.visitUtf8=Uu;vt.prototype.visitBinary=Uu;vt.prototype.visitFixedSizeBinary=Zr;vt.prototype.visitDate=Zr;vt.prototype.visitTimestamp=Zr;vt.prototype.visitTime=Zr;vt.prototype.visitDecimal=Zr;vt.prototype.visitList=qa;vt.prototype.visitStruct=Ja;vt.prototype.visitUnion=ny;vt.prototype.visitInterval=Zr;vt.prototype.visitFixedSizeList=qa;vt.prototype.visitMap=qa;var Qr=class extends yn{constructor(t){super(),this._position=0,this._started=!1,this._sink=new hr,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,ee(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}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')}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Ce(t)?t.then(e=>this.writeAll(e)):Ee(t)?Qa(this,t):Za(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 hr?this._sink=t:(this._sink=new hr,t&&il(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&sl(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!e||!vn(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 It&&!(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&&!vn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof ct?t instanceof Sn||this._writeRecordBatch(t):t instanceof It?this.writeAll(t.batches):Pe(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=Et.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,c=a-s-o;return t.headerType===Q.RecordBatch?this._recordBatchBlocks.push(new Je(a,t.bodyLength,this._position)):t.headerType===Q.DictionaryBatch&&this._dictionaryBlocks.push(new Je(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=N(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(Et.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Kn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=vt.assemble(t),o=new Gt(t.numRows,n,i),a=Et.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));let{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=vt.assemble(new L([t])),c=new Gt(t.length,s,o),d=new ge(c,e,n),p=Et.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){for(let[e,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(e)||0;if(i===0||(n=n==null?void 0:n.slice(i)).length>0)for(let s of n.data)this._writeDictionaryBatch(s,e,i>0),i+=s.length}return this}},_r=class extends Qr{static writeAll(t,e){let n=new _r(e);return Ce(t)?t.then(i=>n.writeAll(i)):Ee(t)?Qa(n,t):Za(n,t)}},tn=class extends Qr{static writeAll(t){let e=new tn;return Ce(t)?t.then(n=>e.writeAll(n)):Ee(t)?Qa(e,t):Za(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=Mr.encode(new Mr(t,Ut.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function Za(r,t){let e=t;t instanceof It&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function Qa(r,t){var e,n,i,s;return I(this,void 0,void 0,function*(){try{for(e=De(t);n=yield e.next(),!n.done;){let o=n.value;r.write(o)}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=e.return)&&(yield s.call(e))}finally{if(i)throw i.error}}return r.finish()})}function Nu(r,t){if(Ee(r))return oy(r,t);if(Pe(r))return sy(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function sy(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?void 0: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=N(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 oy(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 I(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return I(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return I(this,void 0,void 0,function*(){((e==null?void 0:e.return)&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){return I(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=N(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 Cu(r){return new tc(r)}var tc=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=rl(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=bn(s),this._getSize=i!=="bytes"?ku:Lu;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"?ku:Lu}),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)}},ku=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},Lu=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function Uo(r,t){let e=new hr,n=null,i=new ReadableStream({cancel(){return I(this,void 0,void 0,function*(){yield e.close()})},start(a){return I(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return I(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 I(this,void 0,void 0,function*(){return yield(yield xt.from(e)).open(t)})}function o(a,c){return I(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 No(r,t){let e=new this(r),n=new me(e),i=new ReadableStream({cancel(){return I(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return I(this,void 0,void 0,function*(){yield s(o)})},start(o){return I(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 I(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()})}}var uy=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},ha),La),Da),pa),la),Ta),{compareSchemas:vn,compareFields:du,compareTypes:fu});$t.toDOMStream=Nu;mt.throughDOM=Cu;xt.throughDOM=Uo;qr.throughDOM=Uo;yr.throughDOM=Uo;Qr.throughDOM=No;tn.throughDOM=No;_r.throughDOM=No;function Qn(r){switch(r.typeId){case f.Binary:return{sqlType:"binary"};case f.Bool:return{sqlType:"bool"};case f.Date:return{sqlType:"date"};case f.DateDay:return{sqlType:"date32[d]"};case f.DateMillisecond:return{sqlType:"date64[ms]"};case f.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case f.Float:return{sqlType:"float"};case f.Float16:return{sqlType:"float16"};case f.Float32:return{sqlType:"float32"};case f.Float64:return{sqlType:"float64"};case f.Int:return{sqlType:"int32"};case f.Int16:return{sqlType:"int16"};case f.Int32:return{sqlType:"int32"};case f.Int64:return{sqlType:"int64"};case f.Uint16:return{sqlType:"uint16"};case f.Uint32:return{sqlType:"uint32"};case f.Uint64:return{sqlType:"uint64"};case f.Uint8:return{sqlType:"uint8"};case f.IntervalDayTime:return{sqlType:"interval[dt]"};case f.IntervalYearMonth:return{sqlType:"interval[m]"};case f.List:return{sqlType:"list",valueType:Qn(r.valueType)};case f.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case f.Null:return{sqlType:"null"};case f.Utf8:return{sqlType:"utf8"};case f.Struct:return{sqlType:"struct",fields:r.children.map(e=>ko(e.name,e.type))};case f.Map:{let t=r;return{sqlType:"map",keyType:Qn(t.keyType),valueType:Qn(t.valueType)}}case f.Time:return{sqlType:"time[s]"};case f.TimeMicrosecond:return{sqlType:"time[us]"};case f.TimeMillisecond:return{sqlType:"time[ms]"};case f.TimeNanosecond:return{sqlType:"time[ns]"};case f.TimeSecond:return{sqlType:"time[s]"};case f.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case f.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case f.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case f.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case f.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error(`unsupported arrow type: ${r.toString()}`)}function ko(r,t){let e=Qn(t);return e.name=r,e}var Lo=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){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":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(),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_START",data:e},[e.buffer]);break}case"SEND_QUERY":{let e=this._bindings.sendQuery(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_START",data:e},[e.buffer]);break}case"FETCH_QUERY_RESULTS":{let e=this._bindings.fetchQueryResults(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_CHUNK",data:e},[e.buffer]);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]),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":this._bindings.registerFileHandle(t.data[0],t.data[1]),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"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 this.failWith(t,e)}}};var Hu={},dy=(()=>{var r=Hu.url;return function(t){t=t||{};var e=typeof t<"u"?t:{},n,i;e.ready=new Promise(function(l,u){n=l,i=u});var s=Object.assign({},e),o=[],a="./this.program",c=(l,u)=>{throw u},d=typeof window=="object",p=typeof importScripts=="function",b=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",y="";function S(l){return e.locateFile?e.locateFile(l,y):y+l}var J,q,ot,St;function Qt(l){if(l instanceof ss)return;Fe("exiting due to exception: "+l)}var se,Lr,sn;b?(p?y=ec().dirname(y)+"/":y=__dirname+"/",sn=()=>{Lr||(se=Vu(),Lr=ec())},J=function(u,h){return sn(),u=Lr.normalize(u),se.readFileSync(u,h?void 0:"utf8")},ot=l=>{var u=J(l,!0);return u.buffer||(u=new Uint8Array(u)),u},q=(l,u,h)=>{sn(),l=Lr.normalize(l),se.readFile(l,function(m,_){m?h(m):u(_.buffer)})},process.argv.length>1&&(a=process.argv[1].replace(/\\/g,"/")),o=process.argv.slice(2),process.on("uncaughtException",function(l){if(!(l instanceof ss))throw l}),process.on("unhandledRejection",function(l){throw l}),c=(l,u)=>{if(yc())throw process.exitCode=l,u;Qt(u),process.exit(l)},e.inspect=function(){return"[Emscripten Module object]"}):(d||p)&&(p?y=self.location.href:typeof document<"u"&&document.currentScript&&(y=document.currentScript.src),r&&(y=r),y.indexOf("blob:")!==0?y=y.substr(0,y.replace(/[?#].*/,"").lastIndexOf("/")+1):y="",J=l=>{var u=new XMLHttpRequest;return u.open("GET",l,!1),u.send(null),u.responseText},p&&(ot=l=>{var u=new XMLHttpRequest;return u.open("GET",l,!1),u.responseType="arraybuffer",u.send(null),new Uint8Array(u.response)}),q=(l,u,h)=>{var m=new XMLHttpRequest;m.open("GET",l,!0),m.responseType="arraybuffer",m.onload=()=>{if(m.status==200||m.status==0&&m.response){u(m.response);return}h()},m.onerror=h,m.send(null)},St=l=>document.title=l);var $o=e.print||console.log.bind(console),Fe=e.printErr||console.warn.bind(console);Object.assign(e,s),s=null,e.arguments&&(o=e.arguments),e.thisProgram&&(a=e.thisProgram),e.quit&&(c=e.quit);var gr;e.wasmBinary&&(gr=e.wasmBinary);var Z=e.noExitRuntime||!0;typeof WebAssembly!="object"&&ke("no native wasm support detected");var Rt,te=!1,Vt;function Ht(l,u){l||ke(u)}function zt(l){var u=e["_"+l];return u}function at(l,u,h,m,_){var A={string:function(Ot){var Le=0;if(Ot!=null&&Ot!==0){var tr=(Ot.length<<2)+1;Le=ea(tr),Yo(Ot,Le,tr)}return Le},array:function(Ot){var Le=ea(Ot.length);return cc(Ot,Le),Le}};function v(Ot){return u==="string"?wr(Ot):u==="boolean"?Boolean(Ot):Ot}var w=zt(l),x=[],tt=0;if(m)for(var it=0;it<m.length;it++){var Te=A[h[it]];Te?(tt===0&&(tt=Dc()),x[it]=Te(m[it])):x[it]=m[it]}var ht=w.apply(null,x);function An(Ot){return tt!==0&&Ec(tt),v(Ot)}return ht=An(ht),ht}var oe=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function on(l,u,h){for(var m=u+h,_=u;l[_]&&!(_>=m);)++_;if(_-u>16&&l.buffer&&oe)return oe.decode(l.subarray(u,_));for(var A="";u<_;){var v=l[u++];if(!(v&128)){A+=String.fromCharCode(v);continue}var w=l[u++]&63;if((v&224)==192){A+=String.fromCharCode((v&31)<<6|w);continue}var x=l[u++]&63;if((v&240)==224?v=(v&15)<<12|w<<6|x:v=(v&7)<<18|w<<12|x<<6|l[u++]&63,v<65536)A+=String.fromCharCode(v);else{var tt=v-65536;A+=String.fromCharCode(55296|tt>>10,56320|tt&1023)}}return A}function wr(l,u){return l?on(Cr,l,u):""}function ac(l,u,h,m){if(!(m>0))return 0;for(var _=h,A=h+m-1,v=0;v<l.length;++v){var w=l.charCodeAt(v);if(w>=55296&&w<=57343){var x=l.charCodeAt(++v);w=65536+((w&1023)<<10)|x&1023}if(w<=127){if(h>=A)break;u[h++]=w}else if(w<=2047){if(h+1>=A)break;u[h++]=192|w>>6,u[h++]=128|w&63}else if(w<=65535){if(h+2>=A)break;u[h++]=224|w>>12,u[h++]=128|w>>6&63,u[h++]=128|w&63}else{if(h+3>=A)break;u[h++]=240|w>>18,u[h++]=128|w>>12&63,u[h++]=128|w>>6&63,u[h++]=128|w&63}}return u[h]=0,h-_}function Yo(l,u,h){return ac(l,Cr,u,h)}function qu(l){for(var u=0,h=0;h<l.length;++h){var m=l.charCodeAt(h);m>=55296&&m<=57343&&(m=65536+((m&1023)<<10)|l.charCodeAt(++h)&1023),m<=127?++u:m<=2047?u+=2:m<=65535?u+=3:u+=4}return u}function cc(l,u){ei.set(l,u)}function Zu(l,u,h){for(var m=0;m<l.length;++m)ei[u++>>0]=l.charCodeAt(m);h||(ei[u>>0]=0)}var lc,ei,Cr,ri,uc,T,Qu,td,ed;function dc(l){lc=l,e.HEAP8=ei=new Int8Array(l),e.HEAP16=ri=new Int16Array(l),e.HEAP32=T=new Int32Array(l),e.HEAPU8=Cr=new Uint8Array(l),e.HEAPU16=uc=new Uint16Array(l),e.HEAPU32=Qu=new Uint32Array(l),e.HEAPF32=td=new Float32Array(l),e.HEAPF64=ed=new Float64Array(l)}var vy=e.INITIAL_MEMORY||16777216,fc,hc=[],pc=[],rd=[],mc=[],nd=!1;function yc(){return Z}function id(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)cd(e.preRun.shift());Ji(hc)}function sd(){nd=!0,Ji(pc)}function od(){Ji(rd)}function ad(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)ud(e.postRun.shift());Ji(mc)}function cd(l){hc.unshift(l)}function ld(l){pc.unshift(l)}function ud(l){mc.unshift(l)}var an=0,Xo=null,ni=null;function dd(l){an++,e.monitorRunDependencies&&e.monitorRunDependencies(an)}function fd(l){if(an--,e.monitorRunDependencies&&e.monitorRunDependencies(an),an==0&&(Xo!==null&&(clearInterval(Xo),Xo=null),ni)){var u=ni;ni=null,u()}}function ke(l){e.onAbort&&e.onAbort(l),l="Aborted("+l+")",Fe(l),te=!0,Vt=1,l+=". Build with -sASSERTIONS for more info.";var u=new WebAssembly.RuntimeError(l);throw i(u),u}var hd="data:application/octet-stream;base64,";function _c(l){return l.startsWith(hd)}var xe;e.locateFile?(xe="./duckdb-eh.wasm",_c(xe)||(xe=S(xe))):xe=new URL("./duckdb-eh.wasm",Hu.url).toString();function bc(l){try{if(l==xe&&gr)return new Uint8Array(gr);if(ot)return ot(l);throw"both async and sync fetching of the wasm failed"}catch(u){ke(u)}}function pd(){return!gr&&(d||p)&&typeof fetch=="function"?fetch(xe,{credentials:"same-origin"}).then(function(l){if(!l.ok)throw"failed to load wasm binary file at '"+xe+"'";return l.arrayBuffer()}).catch(function(){return bc(xe)}):Promise.resolve().then(function(){return bc(xe)})}function md(){var l={a:Of};function u(v,w){var x=v.exports;e.asm=x,Rt=e.asm.ha,dc(Rt.buffer),fc=e.asm.bb,ld(e.asm.ia),fd("wasm-instantiate")}dd("wasm-instantiate");function h(v){u(v.instance)}function m(v){return pd().then(function(w){return WebAssembly.instantiate(w,l)}).then(function(w){return w}).then(v,function(w){Fe("failed to asynchronously prepare wasm: "+w),ke(w)})}function _(){return!gr&&typeof WebAssembly.instantiateStreaming=="function"&&!_c(xe)&&typeof fetch=="function"?fetch(xe,{credentials:"same-origin"}).then(function(v){var w=WebAssembly.instantiateStreaming(v,l);return w.then(h,function(x){return Fe("wasm streaming compile failed: "+x),Fe("falling back to ArrayBuffer instantiation"),m(h)})}):m(h)}if(e.instantiateWasm)try{var A=e.instantiateWasm(l,u);return A}catch(v){return Fe("Module.instantiateWasm callback failed with error: "+v),!1}return _().catch(i),{}}function Ji(l){for(;l.length>0;){var u=l.shift();if(typeof u=="function"){u(e);continue}var h=u.func;typeof h=="number"?u.arg===void 0?gc(h)():gc(h)(u.arg):h(u.arg===void 0?null:u.arg)}}var qi=[];function gc(l){var u=qi[l];return u||(l>=qi.length&&(qi.length=l+1),qi[l]=u=fc.get(l)),u}function yd(l){if(l instanceof ss||l=="unwind")return Vt;c(1,l)}function _d(l,u,h,m){ke("Assertion failed: "+wr(l)+", at: "+[u?wr(u):"unknown filename",h,m?wr(m):"unknown function"])}var jt={buffers:[null,[],[]],printChar:function(l,u){var h=jt.buffers[l];u===0||u===10?((l===1?$o:Fe)(on(h,0)),h.length=0):h.push(u)},varargs:void 0,get:function(){jt.varargs+=4;var l=T[jt.varargs-4>>2];return l},getStr:function(l){var u=wr(l);return u}};function bd(l,u,h,m,_){}function gd(){Fe("missing function: $SOCKFS"),ke(-1)}function wc(){Fe("missing function: $FS"),ke(-1)}function ii(l){var u=gd.getSocket(l);if(!u)throw new wc.ErrnoError(8);return u}function Go(l){return(l&255)+"."+(l>>8&255)+"."+(l>>16&255)+"."+(l>>24&255)}function vc(l){var u="",h=0,m=0,_=0,A=0,v=0,w=0,x=[l[0]&65535,l[0]>>16,l[1]&65535,l[1]>>16,l[2]&65535,l[2]>>16,l[3]&65535,l[3]>>16],tt=!0,it="";for(w=0;w<5;w++)if(x[w]!==0){tt=!1;break}if(tt){if(it=Go(x[6]|x[7]<<16),x[5]===-1)return u="::ffff:",u+=it,u;if(x[5]===0)return u="::",it==="0.0.0.0"&&(it=""),it==="0.0.0.1"&&(it="1"),u+=it,u}for(h=0;h<8;h++)x[h]===0&&(h-_>1&&(v=0),_=h,v++),v>m&&(m=v,A=h-m+1);for(h=0;h<8;h++){if(m>1&&x[h]===0&&h>=A&&h<A+m){h===A&&(u+=":",A===0&&(u+=":"));continue}u+=Number(Qo(x[h]&65535)).toString(16),u+=h<7?":":""}return u}function Sc(l,u){var h=ri[l>>1],m=Qo(uc[l+2>>1]),_;switch(h){case 2:if(u!==16)return{errno:28};_=T[l+4>>2],_=Go(_);break;case 10:if(u!==28)return{errno:28};_=[T[l+8>>2],T[l+12>>2],T[l+16>>2],T[l+20>>2]],_=vc(_);break;default:return{errno:5}}return{family:h,addr:_,port:m}}function Zi(l){for(var u=l.split("."),h=0;h<4;h++){var m=Number(u[h]);if(isNaN(m))return null;u[h]=m}return(u[0]|u[1]<<8|u[2]<<16|u[3]<<24)>>>0}function Qi(l){return parseInt(l)}function Ko(l){var u,h,m,_,A=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,v=[];if(!A.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]=Qi(u[u.length-4])+Qi(u[u.length-3])*256,u[u.length-3]=Qi(u[u.length-2])+Qi(u[u.length-1])*256,u=u.slice(0,u.length-2)):u=l.split(":"),m=0,_=0,h=0;h<u.length;h++)if(typeof u[h]=="string")if(u[h]==="Z"){for(_=0;_<8-u.length+1;_++)v[h+_]=0;m=_-1}else v[h+m]=ns(parseInt(u[h],16));else v[h+m]=u[h];return[v[1]<<16|v[0],v[3]<<16|v[2],v[5]<<16|v[4],v[7]<<16|v[6]]}var Be={address_map:{id:1,addrs:{},names:{}},lookup_name:function(l){var u=Zi(l);if(u!==null||(u=Ko(l),u!==null))return l;var h;if(Be.address_map.addrs[l])h=Be.address_map.addrs[l];else{var m=Be.address_map.id++;Ht(m<65535,"exceeded max address mappings of 65535"),h="172.29."+(m&255)+"."+(m&65280),Be.address_map.names[h]=l,Be.address_map.addrs[l]=h}return h},lookup_addr:function(l){return Be.address_map.names[l]?Be.address_map.names[l]:null}};function Ic(l,u,h){if(h&&l===0)return null;var m=Sc(l,u);if(m.errno)throw new wc.ErrnoError(m.errno);return m.addr=Be.lookup_addr(m.addr)||m.addr,m}function wd(l,u,h){var m=ii(l),_=Ic(u,h);return m.sock_ops.bind(m,_.addr,_.port),0}function vd(l,u,h){var m=ii(l),_=Ic(u,h);return m.sock_ops.connect(m,_.addr,_.port),0}function Sd(l,u,h,m){return u=jt.getStr(u),u=jt.calculateAt(l,u),jt.doAccess(u,h)}function Id(l,u,h){return jt.varargs=h,0}function Ad(l,u){}function Fd(l,u,h){}function xd(l,u,h){}function Ac(l,u){Cr.fill(0,l,l+u)}function Jo(l,u,h,m,_){switch(u){case 2:h=Zi(h),Ac(l,16),_&&(T[_>>2]=16),ri[l>>1]=u,T[l+4>>2]=h,ri[l+2>>1]=ns(m);break;case 10:h=Ko(h),Ac(l,28),_&&(T[_>>2]=28),T[l>>2]=u,T[l+8>>2]=h[0],T[l+12>>2]=h[1],T[l+16>>2]=h[2],T[l+20>>2]=h[3],ri[l+2>>1]=ns(m);break;default:return 5}return 0}function Bd(l,u,h){var m=ii(l);if(!m.daddr)return-53;var _=Jo(u,m.family,Be.lookup_name(m.daddr),m.dport,h);return 0}function Td(l,u,h,m,_){var A=ii(l);return u===1&&h===4?(T[m>>2]=A.error,T[_>>2]=4,A.error=null,0):-50}function Dd(l,u,h){return jt.varargs=h,0}function Ed(l,u){}function Od(l,u,h){}function Md(l,u,h,m){}function Rd(l,u,h,m){jt.varargs=m}function Ud(l,u,h,m,_,A){var v=ii(l),w=v.sock_ops.recvmsg(v,h);if(!w)return 0;if(_)var x=Jo(_,v.family,Be.lookup_name(w.addr),w.port,A);return Cr.set(w.buffer,u),w.buffer.byteLength}function Nd(l,u,h,m){}function kd(l){}function Ld(l,u,h,m,_,A){}function Cd(l,u,h){}function Pd(l,u){}function Vd(l,u,h){}function Hd(l){}var Fc="To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking";function zd(l,u){ke(Fc)}function jd(l,u){ke(Fc)}function Wd(){return Date.now()}var $d=!0;function Yd(){return $d}function Xd(){ke("")}function Gd(l,u){return globalThis.DUCKDB_RUNTIME.createDirectory(e,l,u)}function Kd(l,u){return globalThis.DUCKDB_RUNTIME.checkDirectory(e,l,u)}function Jd(l,u){return globalThis.DUCKDB_RUNTIME.listDirectoryEntries(e,l,u)}function qd(l,u){return globalThis.DUCKDB_RUNTIME.removeDirectory(e,l,u)}function Zd(l){return globalThis.DUCKDB_RUNTIME.closeFile(e,l)}function Qd(l,u){return globalThis.DUCKDB_RUNTIME.checkFile(e,l,u)}function tf(l){return globalThis.DUCKDB_RUNTIME.getLastFileModificationTime(e,l)}function ef(l,u,h,m){return globalThis.DUCKDB_RUNTIME.moveFile(e,l,u,h,m)}function rf(l,u){return globalThis.DUCKDB_RUNTIME.openFile(e,l,u)}function nf(l,u,h,m){return globalThis.DUCKDB_RUNTIME.readFile(e,l,u,h,m)}function sf(l,u){return globalThis.DUCKDB_RUNTIME.truncateFile(e,l,u)}function of(l,u,h,m){return globalThis.DUCKDB_RUNTIME.writeFile(e,l,u,h,m)}function af(l,u){return globalThis.DUCKDB_RUNTIME.glob(e,l,u)}function cf(l){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(e,l)}function lf(l,u,h,m,_,A){return globalThis.DUCKDB_RUNTIME.callScalarUDF(e,l,u,h,m,_,A)}function xc(){return 2147483648}var qo;b?qo=()=>{var l=process.hrtime();return l[0]*1e3+l[1]/1e6}:qo=()=>performance.now();function uf(l,u,h){Cr.copyWithin(l,u,u+h)}function df(l){try{return Rt.grow(l-lc.byteLength+65535>>>16),dc(Rt.buffer),1}catch(u){}}function ff(l){var u=Cr.length;l=l>>>0;var h=xc();if(l>h)return!1;let m=(x,tt)=>x+(tt-x%tt)%tt;for(var _=1;_<=4;_*=2){var A=u*(1+.2/_);A=Math.min(A,l+100663296);var v=Math.min(h,m(Math.max(l,A),65536)),w=df(v);if(w)return!0}return!1}var Zo={};function hf(){return a||"./this.program"}function si(){if(!si.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,_:hf()};for(var h in Zo)Zo[h]===void 0?delete u[h]:u[h]=Zo[h];var m=[];for(var h in u)m.push(h+"="+u[h]);si.strings=m}return si.strings}function pf(l,u){var h=0;return si().forEach(function(m,_){var A=u+h;T[l+_*4>>2]=A,Zu(m,A),h+=m.length+1}),0}function mf(l,u){var h=si();T[l>>2]=h.length;var m=0;return h.forEach(function(_){m+=_.length+1}),T[u>>2]=m,0}function yf(l){return 0}function _f(l,u,h,m,_,A){var v=jt.getStreamFromFD(l),w=jt.doReadv(v,u,h,m);return T[A>>2]=w,0}function bf(l,u,h,m,_,A){var v=jt.getStreamFromFD(l),w=jt.doWritev(v,u,h,m);return T[A>>2]=w,0}function gf(l,u,h,m){var _=jt.getStreamFromFD(l),A=jt.doReadv(_,u,h);return T[m>>2]=A,0}function wf(l,u,h,m,_){}function vf(l){var u=jt.getStreamFromFD(l);return u.stream_ops&&u.stream_ops.fsync?-u.stream_ops.fsync(u):0}function Sf(l,u,h,m){for(var _=0,A=0;A<h;A++){var v=T[u>>2],w=T[u+4>>2];u+=8;for(var x=0;x<w;x++)jt.printChar(l,Cr[v+x]);_+=w}return T[m>>2]=_,0}function If(l,u,h,m){var _=0,A=0,v=0,w=0,x=0,tt=0,it;function Te(ht,An,Ot,Le,tr,oi){var g,E,bt,Wt;return E=ht===10?28:16,tr=ht===10?vc(tr):Go(tr),g=ta(E),Wt=Jo(g,ht,tr,oi),Ht(!Wt),bt=ta(32),T[bt+4>>2]=ht,T[bt+8>>2]=An,T[bt+12>>2]=Ot,T[bt+24>>2]=Le,T[bt+20>>2]=g,ht===10?T[bt+16>>2]=28:T[bt+16>>2]=16,T[bt+28>>2]=0,bt}if(h&&(v=T[h>>2],w=T[h+4>>2],x=T[h+8>>2],tt=T[h+12>>2]),x&&!tt&&(tt=x===2?17:6),!x&&tt&&(x=tt===17?2:1),tt===0&&(tt=6),x===0&&(x=1),!l&&!u)return-2;if(v&-1088||h!==0&&T[h>>2]&2&&!l)return-1;if(v&32)return-2;if(x!==0&&x!==1&&x!==2)return-7;if(w!==0&&w!==2&&w!==10)return-6;if(u&&(u=wr(u),A=parseInt(u,10),isNaN(A)))return v&1024?-2:-8;if(!l)return w===0&&(w=2),(v&1)===0&&(w===2?_=rs(2130706433):_=[0,0,0,1]),it=Te(w,x,tt,null,_,A),T[m>>2]=it,0;if(l=wr(l),_=Zi(l),_!==null)if(w===0||w===2)w=2;else if(w===10&&v&8)_=[0,0,rs(65535),_],w=10;else return-2;else if(_=Ko(l),_!==null)if(w===0||w===10)w=10;else return-2;return _!=null?(it=Te(w,x,tt,l,_,A),T[m>>2]=it,0):v&4?-2:(l=Be.lookup_name(l),_=Zi(l),w===0?w=2:w===10&&(_=[0,0,rs(65535),_]),it=Te(w,x,tt,null,_,A),T[m>>2]=it,0)}function Af(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var l=new Uint8Array(1);return function(){return crypto.getRandomValues(l),l[0]}}else if(b)try{var u=Th("crypto");return function(){return u.randomBytes(1)[0]}}catch(h){}return function(){ke("randomDevice")}}function ts(l,u){ts.randomDevice||(ts.randomDevice=Af());for(var h=0;h<u;h++)ei[l+h>>0]=ts.randomDevice();return 0}function Ff(l,u,h,m,_,A,v){var w=Sc(l,u);if(w.errno)return-6;var x=w.port,tt=w.addr,it=!1;if(h&&m){var Te;if(v&1||!(Te=Be.lookup_addr(tt))){if(v&8)return-2}else tt=Te;var ht=Yo(tt,h,m);ht+1>=m&&(it=!0)}if(_&&A){x=""+x;var ht=Yo(x,_,A);ht+1>=A&&(it=!0)}return it?-12:0}function es(l){return l%4===0&&(l%100!==0||l%400===0)}function xf(l,u){for(var h=0,m=0;m<=u;h+=l[m++]);return h}var Bc=[31,29,31,30,31,30,31,31,30,31,30,31],Tc=[31,28,31,30,31,30,31,31,30,31,30,31];function Bf(l,u){for(var h=new Date(l.getTime());u>0;){var m=es(h.getFullYear()),_=h.getMonth(),A=(m?Bc:Tc)[_];if(u>A-h.getDate())u-=A-h.getDate()+1,h.setDate(1),_<11?h.setMonth(_+1):(h.setMonth(0),h.setFullYear(h.getFullYear()+1));else return h.setDate(h.getDate()+u),h}return h}function Tf(l,u,h,m){var _=T[m+40>>2],A={tm_sec:T[m>>2],tm_min:T[m+4>>2],tm_hour:T[m+8>>2],tm_mday:T[m+12>>2],tm_mon:T[m+16>>2],tm_year:T[m+20>>2],tm_wday:T[m+24>>2],tm_yday:T[m+28>>2],tm_isdst:T[m+32>>2],tm_gmtoff:T[m+36>>2],tm_zone:_?wr(_):""},v=wr(h),w={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var x in w)v=v.replace(new RegExp(x,"g"),w[x]);var tt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],it=["January","February","March","April","May","June","July","August","September","October","November","December"];function Te(g,E,bt){for(var Wt=typeof g=="number"?g.toString():g||"";Wt.length<E;)Wt=bt[0]+Wt;return Wt}function ht(g,E){return Te(g,E,"0")}function An(g,E){function bt(os){return os<0?-1:os>0?1:0}var Wt;return(Wt=bt(g.getFullYear()-E.getFullYear()))===0&&(Wt=bt(g.getMonth()-E.getMonth()))===0&&(Wt=bt(g.getDate()-E.getDate())),Wt}function Ot(g){switch(g.getDay()){case 0:return new Date(g.getFullYear()-1,11,29);case 1:return g;case 2:return new Date(g.getFullYear(),0,3);case 3:return new Date(g.getFullYear(),0,2);case 4:return new Date(g.getFullYear(),0,1);case 5:return new Date(g.getFullYear()-1,11,31);case 6:return new Date(g.getFullYear()-1,11,30)}}function Le(g){var E=Bf(new Date(g.tm_year+1900,0,1),g.tm_yday),bt=new Date(E.getFullYear(),0,4),Wt=new Date(E.getFullYear()+1,0,4),os=Ot(bt),Sh=Ot(Wt);return An(os,E)<=0?An(Sh,E)<=0?E.getFullYear()+1:E.getFullYear():E.getFullYear()-1}var tr={"%a":function(g){return tt[g.tm_wday].substring(0,3)},"%A":function(g){return tt[g.tm_wday]},"%b":function(g){return it[g.tm_mon].substring(0,3)},"%B":function(g){return it[g.tm_mon]},"%C":function(g){var E=g.tm_year+1900;return ht(E/100|0,2)},"%d":function(g){return ht(g.tm_mday,2)},"%e":function(g){return Te(g.tm_mday,2," ")},"%g":function(g){return Le(g).toString().substring(2)},"%G":function(g){return Le(g)},"%H":function(g){return ht(g.tm_hour,2)},"%I":function(g){var E=g.tm_hour;return E==0?E=12:E>12&&(E-=12),ht(E,2)},"%j":function(g){return ht(g.tm_mday+xf(es(g.tm_year+1900)?Bc:Tc,g.tm_mon-1),3)},"%m":function(g){return ht(g.tm_mon+1,2)},"%M":function(g){return ht(g.tm_min,2)},"%n":function(){return`
11
- `},"%p":function(g){return g.tm_hour>=0&&g.tm_hour<12?"AM":"PM"},"%S":function(g){return ht(g.tm_sec,2)},"%t":function(){return" "},"%u":function(g){return g.tm_wday||7},"%U":function(g){var E=g.tm_yday+7-g.tm_wday;return ht(Math.floor(E/7),2)},"%V":function(g){var E=Math.floor((g.tm_yday+7-(g.tm_wday+6)%7)/7);if((g.tm_wday+371-g.tm_yday-2)%7<=2&&E++,E){if(E==53){var Wt=(g.tm_wday+371-g.tm_yday)%7;Wt!=4&&(Wt!=3||!es(g.tm_year))&&(E=1)}}else{E=52;var bt=(g.tm_wday+7-g.tm_yday-1)%7;(bt==4||bt==5&&es(g.tm_year%400-1))&&E++}return ht(E,2)},"%w":function(g){return g.tm_wday},"%W":function(g){var E=g.tm_yday+7-(g.tm_wday+6)%7;return ht(Math.floor(E/7),2)},"%y":function(g){return(g.tm_year+1900).toString().substring(2)},"%Y":function(g){return g.tm_year+1900},"%z":function(g){var E=g.tm_gmtoff,bt=E>=0;return E=Math.abs(E)/60,E=E/60*100+E%60,(bt?"+":"-")+String("0000"+E).slice(-4)},"%Z":function(g){return g.tm_zone},"%%":function(){return"%"}};v=v.replace(/%%/g,"\0\0");for(var x in tr)v.includes(x)&&(v=v.replace(new RegExp(x,"g"),tr[x](A)));v=v.replace(/\0\0/g,"%");var oi=Ef(v,!1);return oi.length>u?0:(cc(oi,l),oi.length-1)}function Df(l,u,h,m){return Tf(l,u,h,m)}function Ef(l,u,h){var m=h>0?h:qu(l)+1,_=new Array(m),A=ac(l,_,0,_.length);return u&&(_.length=A),_}var Of={a:_d,P:bd,R:wd,Q:vd,J:Sd,b:Id,$:Ad,u:Fd,X:xd,L:Bd,O:Td,ba:Dd,Y:Ed,aa:Od,Z:Md,o:Rd,M:Ud,H:Nd,m:kd,N:Ld,k:Cd,_:Pd,n:Vd,T:Hd,V:zd,U:jd,da:Wd,ca:Yd,d:Xd,B:Gd,C:Kd,z:Jd,A:qd,i:Zd,x:Qd,E:tf,y:ef,F:rf,f:nf,D:sf,j:of,w:af,g:cf,G:lf,ea:xc,S:qo,fa:uf,ga:ff,q:pf,r:mf,c:yf,t:_f,s:bf,h:gf,v:wf,I:vf,e:Sf,l:If,W:ts,K:Ff,p:Df},Sy=md(),Mf=e.___wasm_call_ctors=function(){return(Mf=e.___wasm_call_ctors=e.asm.ia).apply(null,arguments)},Rf=e._main=function(){return(Rf=e._main=e.asm.ja).apply(null,arguments)},Uf=e._duckdb_web_fs_glob_add_path=function(){return(Uf=e._duckdb_web_fs_glob_add_path=e.asm.ka).apply(null,arguments)},Nf=e._duckdb_web_clear_response=function(){return(Nf=e._duckdb_web_clear_response=e.asm.la).apply(null,arguments)},kf=e._duckdb_web_fail_with=function(){return(kf=e._duckdb_web_fail_with=e.asm.ma).apply(null,arguments)},Lf=e._duckdb_web_reset=function(){return(Lf=e._duckdb_web_reset=e.asm.na).apply(null,arguments)},Cf=e._duckdb_web_connect=function(){return(Cf=e._duckdb_web_connect=e.asm.oa).apply(null,arguments)},Pf=e._duckdb_web_disconnect=function(){return(Pf=e._duckdb_web_disconnect=e.asm.pa).apply(null,arguments)},Vf=e._duckdb_web_flush_files=function(){return(Vf=e._duckdb_web_flush_files=e.asm.qa).apply(null,arguments)},Hf=e._duckdb_web_flush_file=function(){return(Hf=e._duckdb_web_flush_file=e.asm.ra).apply(null,arguments)},zf=e._duckdb_web_open=function(){return(zf=e._duckdb_web_open=e.asm.sa).apply(null,arguments)},jf=e._duckdb_web_get_global_file_info=function(){return(jf=e._duckdb_web_get_global_file_info=e.asm.ta).apply(null,arguments)},Wf=e._duckdb_web_collect_file_stats=function(){return(Wf=e._duckdb_web_collect_file_stats=e.asm.ua).apply(null,arguments)},$f=e._duckdb_web_export_file_stats=function(){return($f=e._duckdb_web_export_file_stats=e.asm.va).apply(null,arguments)},Yf=e._duckdb_web_fs_drop_file=function(){return(Yf=e._duckdb_web_fs_drop_file=e.asm.wa).apply(null,arguments)},Xf=e._duckdb_web_fs_drop_files=function(){return(Xf=e._duckdb_web_fs_drop_files=e.asm.xa).apply(null,arguments)},Gf=e._duckdb_web_fs_glob_file_infos=function(){return(Gf=e._duckdb_web_fs_glob_file_infos=e.asm.ya).apply(null,arguments)},Kf=e._duckdb_web_fs_get_file_info_by_id=function(){return(Kf=e._duckdb_web_fs_get_file_info_by_id=e.asm.za).apply(null,arguments)},Jf=e._duckdb_web_fs_get_file_info_by_name=function(){return(Jf=e._duckdb_web_fs_get_file_info_by_name=e.asm.Aa).apply(null,arguments)},qf=e._duckdb_web_fs_set_file_descriptor=function(){return(qf=e._duckdb_web_fs_set_file_descriptor=e.asm.Ba).apply(null,arguments)},Zf=e._duckdb_web_fs_register_file_url=function(){return(Zf=e._duckdb_web_fs_register_file_url=e.asm.Ca).apply(null,arguments)},Qf=e._duckdb_web_fs_register_file_buffer=function(){return(Qf=e._duckdb_web_fs_register_file_buffer=e.asm.Da).apply(null,arguments)},th=e._duckdb_web_copy_file_to_buffer=function(){return(th=e._duckdb_web_copy_file_to_buffer=e.asm.Ea).apply(null,arguments)},eh=e._duckdb_web_copy_file_to_path=function(){return(eh=e._duckdb_web_copy_file_to_path=e.asm.Fa).apply(null,arguments)},rh=e._duckdb_web_get_version=function(){return(rh=e._duckdb_web_get_version=e.asm.Ga).apply(null,arguments)},nh=e._duckdb_web_get_feature_flags=function(){return(nh=e._duckdb_web_get_feature_flags=e.asm.Ha).apply(null,arguments)},ih=e._duckdb_web_tokenize=function(){return(ih=e._duckdb_web_tokenize=e.asm.Ia).apply(null,arguments)},sh=e._duckdb_web_udf_scalar_create=function(){return(sh=e._duckdb_web_udf_scalar_create=e.asm.Ja).apply(null,arguments)},oh=e._duckdb_web_prepared_create=function(){return(oh=e._duckdb_web_prepared_create=e.asm.Ka).apply(null,arguments)},ah=e._duckdb_web_prepared_close=function(){return(ah=e._duckdb_web_prepared_close=e.asm.La).apply(null,arguments)},ch=e._duckdb_web_prepared_run=function(){return(ch=e._duckdb_web_prepared_run=e.asm.Ma).apply(null,arguments)},lh=e._duckdb_web_prepared_send=function(){return(lh=e._duckdb_web_prepared_send=e.asm.Na).apply(null,arguments)},uh=e._duckdb_web_query_run=function(){return(uh=e._duckdb_web_query_run=e.asm.Oa).apply(null,arguments)},dh=e._duckdb_web_query_send=function(){return(dh=e._duckdb_web_query_send=e.asm.Pa).apply(null,arguments)},fh=e._duckdb_web_query_fetch_results=function(){return(fh=e._duckdb_web_query_fetch_results=e.asm.Qa).apply(null,arguments)},hh=e._duckdb_web_get_tablenames=function(){return(hh=e._duckdb_web_get_tablenames=e.asm.Ra).apply(null,arguments)},ph=e._duckdb_web_insert_arrow_from_ipc_stream=function(){return(ph=e._duckdb_web_insert_arrow_from_ipc_stream=e.asm.Sa).apply(null,arguments)},mh=e._duckdb_web_insert_csv_from_path=function(){return(mh=e._duckdb_web_insert_csv_from_path=e.asm.Ta).apply(null,arguments)},yh=e._duckdb_web_insert_json_from_path=function(){return(yh=e._duckdb_web_insert_json_from_path=e.asm.Ua).apply(null,arguments)},rs=e._htonl=function(){return(rs=e._htonl=e.asm.Va).apply(null,arguments)},ns=e._htons=function(){return(ns=e._htons=e.asm.Wa).apply(null,arguments)},Qo=e._ntohs=function(){return(Qo=e._ntohs=e.asm.Xa).apply(null,arguments)},ta=e._malloc=function(){return(ta=e._malloc=e.asm.Ya).apply(null,arguments)},_h=e._free=function(){return(_h=e._free=e.asm.Za).apply(null,arguments)},Dc=e.stackSave=function(){return(Dc=e.stackSave=e.asm._a).apply(null,arguments)},Ec=e.stackRestore=function(){return(Ec=e.stackRestore=e.asm.$a).apply(null,arguments)},ea=e.stackAlloc=function(){return(ea=e.stackAlloc=e.asm.ab).apply(null,arguments)};e.ccall=at;var is;function ss(l){this.name="ExitStatus",this.message="Program terminated with exit("+l+")",this.status=l}var bh=!1;ni=function l(){is||ra(),is||(ni=l)};function gh(l){var u=e._main,h=0,m=0;try{var _=u(h,m);return wh(_,!0),_}catch(A){return yd(A)}finally{bh=!0}}function ra(l){if(l=l||o,an>0||(id(),an>0))return;function u(){is||(is=!0,e.calledRun=!0,!te&&(sd(),od(),n(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),Oc&&gh(l),ad()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),u()},1)):u()}e.run=ra;function wh(l,u){Vt=l,vh(l)}function vh(l){Vt=l,yc()||(e.onExit&&e.onExit(l),te=!0),c(l,new ss(l))}if(e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();var Oc=!0;return e.noInitialRun&&(Oc=!1),ra(),t.ready}})(),zu=dy;var Co=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 It(n)}send(t){let e=this._bindings.sendQuery(this._conn,t),n=new Po(this._bindings,this._conn,e),i=xt.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}getTableNames(t){return this._bindings.getTableNames(this._conn,t)}prepare(t){let e=this._bindings.createPrepared(this._conn,t);return new rc(this._bindings,this._conn,e)}createScalarFunction(t,e,n){this._bindings.createScalarFunction(this._conn,t,e,n)}insertArrowTable(t,e){let n=new _r;n.writeAll(t);let i=n.toUint8Array(!0);this.insertArrowFromIPCStream(i,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)}},Po=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=this.bindings.fetchQueryResults(this.conn);return this._depleted=t.length==0,{done:this._depleted,value:t}}[Symbol.iterator](){return this}},rc=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 It(n)}send(...t){let e=this.bindings.sendPrepared(this.connectionId,this.statementId,t),n=new Po(this.bindings,this.connectionId,e),i=xt.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};var $u=new TextEncoder,ju=new TextDecoder("utf-8");function nc(r,t,e){let n=$u.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 sc(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 ic(r,t,e,n){let i=r.HEAPU8.subarray(t,t+n*sc(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 Wu(r,t,e){let n=r.HEAPU8.subarray(t,t+e);return new Uint8Array(n.buffer,n.byteOffset,e)}function Vo(r,t,e){let n=r.HEAPU8.subarray(t,t+e*8);return new Float64Array(n.buffer,n.byteOffset,e)}function Yu(r,t,e,n,i,s,o,a){try{let c=r._udfFunctions.get(n);if(!c){nc(t,e,"Unknown UDF with id: "+n);return}let d=ju.decode(t.HEAPU8.subarray(i,i+s)),p=JSON.parse(d),b=Vo(t,o,a/8),y=Z=>{var te;let Rt=null;switch(Z.validityBuffer!==void 0&&(Rt=Wu(t,b[Z.validityBuffer],p.rows)),Z.physicalType){case"VARCHAR":{if(Z.dataBuffer===null||Z.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(Z.lengthBuffer===null||Z.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let Vt=ic(t,b[Z.dataBuffer],Z.physicalType,p.rows),Ht=[],zt=Vo(t,b[Z.lengthBuffer],p.rows);for(let at=0;at<p.rows;++at){if(Rt!=null&&!Rt[at]){Ht.push(null);continue}let oe=t.HEAPU8.subarray(Vt[at],Vt[at]+zt[at]),on=ju.decode(oe);Ht.push(on)}return at=>Ht[at]}case"STRUCT":{let Vt={},Ht=[];for(let zt=0;zt<(((te=Z.children)==null?void 0:te.length)||0);++zt){let at=Z.children[zt],oe=y(at);Ht.push(on=>{Vt[at.name]=oe(on)})}return Rt!=null?zt=>{if(!Rt[zt])return null;for(let at of Ht)at(zt);return Vt}:zt=>{for(let at of Ht)at(zt);return Vt}}default:{if(Z.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+Z.physicalType);let Vt=ic(t,b[Z.dataBuffer],Z.physicalType,p.rows);return Rt!=null?Ht=>Rt[Ht]?Vt[Ht]:null:Ht=>Vt[Ht]}}},S=[];for(let Z=0;Z<p.args.length;++Z)S.push(y(p.args[Z]));let J=p.rows*sc(p.ret.physicalType),q=t._malloc(J),ot=ic(t,q,p.ret.physicalType,p.rows),St=t._malloc(p.rows),Qt=Wu(t,St,p.rows);if(ot.length==0||Qt.length==0){nc(t,e,"Can't create physical arrays for result");return}let se=ot;p.ret.physicalType=="VARCHAR"&&(se=new Array(p.rows));let Lr=[];for(let Z=0;Z<p.args.length;++Z)Lr.push(null);for(let Z=0;Z<p.rows;++Z){for(let te=0;te<p.args.length;++te)Lr[te]=S[te](Z);let Rt=c.func(...Lr);se[Z]=Rt,Qt[Z]=Rt==null?0:1}let sn=0;switch(p.ret.physicalType){case"VARCHAR":{let Z=new Array(0);sn=t._malloc(p.rows*sc("DOUBLE"));let Rt=Vo(t,sn,p.rows),te=0;for(let at=0;at<p.rows;++at){let oe=$u.encode(se[at]||"");Z.push(oe),Rt[at]=oe.length,te+=oe.length}let Vt=t._malloc(te),Ht=t.HEAPU8.subarray(Vt,Vt+te),zt=0;for(let at=0;at<p.rows;++at){ot[at]=zt;let oe=Z[at];Ht.subarray(zt,zt+oe.length).set(oe),zt+=oe.length}}}let $o=3*8,Fe=t._malloc($o),gr=Vo(t,Fe,3);gr[0]=q,gr[1]=St,gr[2]=sn,t.HEAPF64[(e>>3)+0]=0,t.HEAPF64[(e>>3)+1]=Fe,t.HEAPF64[(e>>3)+2]=0}catch(c){nc(t,e,c.toString())}}function hy(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}var py=hy();function br(r,t){r.ccall("duckdb_web_fail_with",null,["string"],[t])}function ti(r,t,e){let n=r.HEAPU8.subarray(t,t+e),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function j(r,t,e){return py(r.HEAPU8.subarray(t,t+e))}function nt(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 _t(r){r.ccall("duckdb_web_clear_response",null,[],[])}var Ho=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 my=new TextEncoder;var zo=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),this)}open(t){let[e,n,i]=nt(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(e!==0)throw new Error(j(this.mod,n,i));_t(this.mod)}reset(){let[t,e,n]=nt(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(j(this.mod,e,n));_t(this.mod)}getVersion(){let[t,e,n]=nt(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(j(this.mod,e,n));let i=j(this.mod,e,n);return _t(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let[e,n,i]=nt(this.mod,"duckdb_web_tokenize",["string"],[t]);if(e!==0)throw new Error(j(this.mod,n,i));let s=j(this.mod,n,i);return _t(this.mod),JSON.parse(s)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new Co(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,i,s]=nt(this.mod,"duckdb_web_query_run",["number","string"],[t,e]);if(n!==0)throw new Error(j(this.mod,i,s));let o=ti(this.mod,i,s);return _t(this.mod),o}sendQuery(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_query_send",["number","string"],[t,e]);if(n!==0)throw new Error(j(this.mod,i,s));let o=ti(this.mod,i,s);return _t(this.mod),o}fetchQueryResults(t){let[e,n,i]=nt(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(e!==0)throw new Error(j(this.mod,n,i));let s=ti(this.mod,n,i);return _t(this.mod),s}getTableNames(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_get_tablenames",["number","string"],[t,e]);if(n!==0)throw new Error(j(this.mod,i,s));let o=j(this.mod,i,s);return _t(this.mod),JSON.parse(o)}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]=nt(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(s)]);if(a!==0)throw new Error(j(this.mod,c,d));if(_t(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,i,s]=nt(this.mod,"duckdb_web_prepared_create",["number","string"],[t,e]);if(n!==0)throw new Error(j(this.mod,i,s));return _t(this.mod),i}closePrepared(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_prepared_close",["number","number"],[t,e]);if(n!==0)throw new Error(j(this.mod,i,s));_t(this.mod)}runPrepared(t,e,n){let[i,s,o]=nt(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(j(this.mod,s,o));let a=ti(this.mod,s,o);return _t(this.mod),a}sendPrepared(t,e,n){let[i,s,o]=nt(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(j(this.mod,s,o));let a=ti(this.mod,s,o);return _t(this.mod),a}insertArrowFromIPCStream(t,e,n){if(e.length==0)return;let i=this.mod._malloc(e.length);this.mod.HEAPU8.subarray(i,i+e.length).set(e);let o=n?JSON.stringify(n):"",[a,c,d]=nt(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,i,e.length,o]);if(a!==0)throw new Error(j(this.mod,c,d))}insertCSVFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let d in n.columns)n.columnsFlat.push(ko(d,n.columns[d]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,c]=nt(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(j(this.mod,a,c))}insertJSONFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let d in n.columns)n.columnsFlat.push(ko(d,n.columns[d]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,c]=nt(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(j(this.mod,a,c))}globFiles(t){let[e,n,i]=nt(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(e!==0)throw new Error(j(this.mod,n,i));let s=j(this.mod,n,i);_t(this.mod);let o=JSON.parse(s);return o==null?[]:o}registerFileURL(t,e){e===void 0&&(e=t);let[n,i,s]=nt(this.mod,"duckdb_web_fs_register_file_url",["string","string","number"],[t,e,-1]);if(n!==0)throw new Error(j(this.mod,i,s));_t(this.mod)}registerFileText(t,e){let n=my.encode(e);this.registerFileBuffer(t,n)}registerFileBuffer(t,e){let n=this.mod._malloc(e.length);this.mod.HEAPU8.subarray(n,n+e.length).set(e);let[s,o,a]=nt(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,n,e.length]);if(s!==0)throw new Error(j(this.mod,o,a));_t(this.mod)}registerFileHandle(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_fs_register_file_url",["string","string","number"],[t,t,-1]);if(n!==0)throw new Error(j(this.mod,i,s));if(_t(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,e),this.pthread){for(let o of this.pthread.runningWorkers)o.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:e});for(let o of this.pthread.unusedWorkers)o.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[e,n,i]=nt(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(e!==0)throw new Error(j(this.mod,n,i));_t(this.mod)}dropFiles(){let[t,e,n]=nt(this.mod,"duckdb_web_fs_drop_files",[],[]);if(t!==0)throw new Error(j(this.mod,e,n));_t(this.mod)}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,e]);if(n!==0)throw new Error(j(this.mod,i,s));_t(this.mod)}copyFileToBuffer(t){let[e,n,i]=nt(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(e!==0)throw new Error(j(this.mod,n,i));let s=this.mod.HEAPU8.subarray(n,n+i),o=new Uint8Array(s.length);return o.set(s),_t(this.mod),o}collectFileStatistics(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,e]);if(n!==0)throw new Error(j(this.mod,i,s))}exportFileStatistics(t){let[e,n,i]=nt(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(e!==0)throw new Error(j(this.mod,n,i));return new Ho(this.mod.HEAPU8.subarray(n,n+i))}};var jo=class extends zo{constructor(e,n,i,s){super(e,n);this.mainModuleURL=i,this.pthreadWorkerURL=s}locateFile(e,n){if(e.endsWith(".wasm"))return this.mainModuleURL;if(e.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=${n} path=${e}`)}instantiateWasm(e,n){globalThis.DUCKDB_RUNTIME=this._runtime;let i=this.onInstantiationProgress;if(WebAssembly.instantiateStreaming)if(typeof TransformStream=="function"){let o=(async()=>{var q;let a=new Request(this.mainModuleURL),c=await fetch(a),d=c.headers.get("content-length"),p=d&&parseInt(d,10)||0,b=new Date,y={startedAt:b,updatedAt:b,bytesTotal:p||0,bytesLoaded:0},S={transform(ot,St){y.bytesLoaded+=ot.byteLength;let Qt=new Date;if(Qt.getTime()-y.updatedAt.getTime()<20){y.updatedAt=Qt,St.enqueue(ot);return}for(let se of i)se(y);St.enqueue(ot)}},J=new TransformStream(S);return new Response((q=c.body)==null?void 0:q.pipeThrough(J),c)})();WebAssembly.instantiateStreaming(o,e).then(a=>{n(a.instance,a.module)})}else{console.warn("instantiating without progress handler since transform streams are unavailable");let s=new Request(this.mainModuleURL);WebAssembly.instantiateStreaming(fetch(s),e).then(o=>{n(o.instance,o.module)})}else if(typeof XMLHttpRequest=="function"){let s=new XMLHttpRequest,o=this.mainModuleURL,a=new Date,c={startedAt:a,updatedAt:a,bytesTotal:0,bytesLoaded:0};s.open("GET",o),s.responseType="arraybuffer",s.onerror=d=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+d}),new Error(d.toString())},s.onprogress=d=>{c.bytesTotal=d.total,c.bytesLoaded=d.loaded;let p=new Date;if(p.getTime()-c.updatedAt.getTime()<20){c.updatedAt=p;return}for(let b of i)b(c)},s.onload=()=>{WebAssembly.instantiate(s.response,e).then(d=>{n(d.instance,d.module)}).catch(d=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+d}),new Error(d)})},s.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let o=new Request(this.mainModuleURL),c=await(await fetch(o)).arrayBuffer();WebAssembly.instantiate(c,e).then(d=>{n(d.instance,d.module)})})();return[]}};var Wo=class extends jo{constructor(t,e,n,i=null){super(t,e,n,i)}instantiateImpl(t){return zu({...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};var en=Rc(Xu()),Gu=function(r,t,e){var n;if((n=r==null?void 0:r.endpoint)!=null&&n.startsWith("http")){let i=`${r==null?void 0:r.endpoint}`,s=i.indexOf("://")+3;return i.substring(s)}else return r!=null&&r.endpoint?`${e}.${r==null?void 0:r.endpoint}`:`${e}.s3.amazonaws.com`};function yy(r,t,e){var i,s,o,a;let n=Ku(t);return{url:n.path,query:"",host:Gu(r,t,n.bucket),region:(i=r==null?void 0:r.region)!=null?i:"",service:"s3",method:e,accessKeyId:(s=r==null?void 0:r.accessKeyId)!=null?s:"",secretAccessKey:(o=r==null?void 0:r.secretAccessKey)!=null?o:"",sessionToken:(a=r==null?void 0:r.sessionToken)!=null?a:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function _y(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 by(r,t=null){var J;let e=(J=t==null?void 0:t.contentHash)!=null?J:"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+`
12
- `+_y(r.url)+`
10
+ ]`}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new It(e,n.map(i=>new ct(e,i)))}slice(t,e){let n=this.schema;[t,e]=hi({length:this.numRows},t,e);let i=Ks(this.data,this._offsets,t,e);return new It(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=C({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new L(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 L([C({type:new ne,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]=xo(n,a)}return new It(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 It(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,d)=>{let[p,b]=a,_=e.findIndex(S=>S.name===c.name);return~_?b[_]=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 It(...xo(s,o))}};hu=Symbol.toStringTag;It[hu]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Wr(_i),r.get=Wr(Bt.getVisitFn(f.Struct)),r.set=Js(Xt.getVisitFn(f.Struct)),r.indexOf=qs(pn.getVisitFn(f.Struct)),r.getByteLength=Wr(Ie.getVisitFn(f.Struct)),"Table"))(It.prototype);var mu,ct=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof G))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=C({nullCount:0,type:new ut(this.schema.fields),children:this.schema.fields.map(e=>C({type:e.type,nullCount:0}))})]=t,!(this.data instanceof et))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=pu(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]=H.new({name:d,type:e[d].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new G(n),a=C({type:new ut(n),length:s,children:i,nullCount:0});[this.schema,this.data]=pu(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=_u(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 Bt.visit(this.data,t)}set(t,e){return Xt.visit(this.data,t,e)}indexOf(t,e){return pn.visit(this.data,t,e)}getByteLength(t){return Ie.visit(this.data,t)}[Symbol.iterator](){return Ln.visit(new L([this.data]))}toArray(){return[...this]}concat(...t){return new It(this.schema,[this,...t])}slice(t,e){let[n]=new L([this.data]).slice(t,e).data;return new ct(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 L([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 L([C({type:new ne,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 G(s,new Map(this.schema.metadata)),i=C({type:new ut(s),children:o})}return new ct(n,i)}select(t){let e=this.schema.select(t),n=new ut(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 ct(e,C({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=C({type:new ut(e.fields),length:this.numRows,children:n});return new ct(e,i)}};mu=Symbol.toStringTag;ct[mu]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ct.prototype);function pu(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:C({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),C({type:new ut(i),length:e,children:s})]}function _u(r,t,e=new Map){for(let n=-1,i=r.length;++n<i;){let o=r[n].type,a=t[n];if(F.isDictionary(o)){if(!e.has(o.id))a.dictionary&&e.set(o.id,a.dictionary);else if(e.get(o.id)!==a.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&_u(o.children,a.children,e)}return e}var Sn=class extends ct{constructor(t){let e=t.fields.map(i=>C({type:i.type})),n=C({type:new ut(t.fields),nullCount:0,children:e});super(t,n)}};var $i;(function(r){r[r.BUFFER=0]="BUFFER"})($i||($i={}));var Yi;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Yi||(Yi={}));var qe=class{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 qe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new qe).__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):Yi.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):$i.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Yi.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,$i.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return qe.startBodyCompression(t),qe.addCodec(t,e),qe.addMethod(t,n),qe.endBodyCompression(t)}};var Yn=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(n),t.writeInt64(e),t.offset()}};var Xn=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(n),t.writeInt64(e),t.offset()}};var Zt=class{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 Zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new Zt).__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):this.bb.createLong(0,0)}nodes(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Xn).__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 Yn).__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 qe).__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,t.createLong(0,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 Ne=class{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 Ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new Ne).__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):this.bb.createLong(0,0)}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Zt).__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,t.createLong(0,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 Gn;(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"})(Gn||(Gn={}));var Ft=class{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 Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new Ft).__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):Yr.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Gn.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):this.bb.createLong(0,0)}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new dt).__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,Yr.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,Gn.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,t.createLong(0,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 Ft.startMessage(t),Ft.addVersion(t,e),Ft.addHeaderType(t,n),Ft.addHeader(t,i),Ft.addBodyLength(t,s),Ft.addCustomMetadata(t,o),Ft.endMessage(t)}};var Om=Tt,za=class extends D{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return ur.startNull(e),ur.endNull(e)}visitInt(t,e){return kt.startInt(e),kt.addBitWidth(e,t.bitWidth),kt.addIsSigned(e,t.isSigned),kt.endInt(e)}visitFloat(t,e){return fe.startFloatingPoint(e),fe.addPrecision(e,t.precision),fe.endFloatingPoint(e)}visitBinary(t,e){return ar.startBinary(e),ar.endBinary(e)}visitBool(t,e){return cr.startBool(e),cr.endBool(e)}visitUtf8(t,e){return fr.startUtf8(e),fr.endUtf8(e)}visitDecimal(t,e){return Lt.startDecimal(e),Lt.addScale(e,t.scale),Lt.addPrecision(e,t.precision),Lt.addBitWidth(e,t.bitWidth),Lt.endDecimal(e)}visitDate(t,e){return le.startDate(e),le.addUnit(e,t.unit),le.endDate(e)}visitTime(t,e){return Kt.startTime(e),Kt.addUnit(e,t.unit),Kt.addBitWidth(e,t.bitWidth),Kt.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return Jt.startTimestamp(e),Jt.addUnit(e,t.unit),n!==void 0&&Jt.addTimezone(e,n),Jt.endTimestamp(e)}visitInterval(t,e){return he.startInterval(e),he.addUnit(e,t.unit),he.endInterval(e)}visitList(t,e){return lr.startList(e),lr.endList(e)}visitStruct(t,e){return dr.startStruct_(e),dr.endStruct_(e)}visitUnion(t,e){Ct.startTypeIdsVector(e,t.typeIds.length);let n=Ct.createTypeIdsVector(e,t.typeIds);return Ct.startUnion(e),Ct.addMode(e,t.mode),Ct.addTypeIds(e,n),Ct.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return Ae.startDictionaryEncoding(e),Ae.addId(e,new Om(t.id,0)),Ae.addIsOrdered(e,t.isOrdered),n!==void 0&&Ae.addIndexType(e,n),Ae.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return ue.startFixedSizeBinary(e),ue.addByteWidth(e,t.byteWidth),ue.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return de.startFixedSizeList(e),de.addListSize(e,t.listSize),de.endFixedSizeList(e)}visitMap(t,e){return pe.startMap(e),pe.addKeysSorted(e,t.keysSorted),pe.endMap(e)}},Bo=new za;function wu(r,t=new Map){return new G(Mm(r,t),To(r.customMetadata),t)}function ja(r){return new Gt(r.count,Su(r.columns),Iu(r.columns))}function vu(r){return new ge(ja(r.data),r.id,r.isDelta)}function Mm(r,t){return(r.fields||[]).filter(Boolean).map(e=>H.fromJSON(e,t))}function yu(r,t){return(r.children||[]).filter(Boolean).map(e=>H.fromJSON(e,t))}function Su(r){return(r||[]).reduce((t,e)=>[...t,new Ze(e.count,Rm(e.VALIDITY)),...Su(e.children)],[])}function Iu(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new be(t.length,i.VALIDITY.length)),i.TYPE&&t.push(new be(t.length,i.TYPE.length)),i.OFFSET&&t.push(new be(t.length,i.OFFSET.length)),i.DATA&&t.push(new be(t.length,i.DATA.length)),t=Iu(i.children,t)}return t}function Rm(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Au(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=gu(r,yu(r,t)),i=new H(r.name,o,r.nullable,To(r.customMetadata))):t.has(e=s.id)?(n=(n=s.indexType)?bu(n):new rr,a=new ve(t.get(e),n,e,s.isOrdered),i=new H(r.name,a,r.nullable,To(r.customMetadata))):(n=(n=s.indexType)?bu(n):new rr,t.set(e,o=gu(r,yu(r,t))),a=new ve(o,n,e,s.isOrdered),i=new H(r.name,a,r.nullable,To(r.customMetadata))),i||null}function To(r){return new Map(Object.entries(r||{}))}function bu(r){return new At(r.isSigned,r.bitWidth)}function gu(r,t){let e=r.type.name;switch(e){case"NONE":return new ne;case"null":return new ne;case"binary":return new vr;case"utf8":return new Sr;case"bool":return new Ir;case"list":return new We((t||[])[0]);case"struct":return new ut(t||[]);case"struct_":return new ut(t||[])}switch(e){case"int":{let n=r.type;return new At(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new ce(mt[n.precision])}case"decimal":{let n=r.type;return new Ar(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new Fr(Yt[n.unit])}case"time":{let n=r.type;return new je(X[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new xr(X[n.unit],n.timezone)}case"interval":{let n=r.type;return new Br(re[n.unit])}case"union":{let n=r.type;return new $e(gt[n.mode],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new Tr(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Ye(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Xe((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var In=Tt,Um=Or,Nm=ie,Et=class{constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=typeof t=="number"?t:t.low}static fromJSON(t,e){let n=new Et(0,Ut.V4,e);return n._createHeader=km(t,e),n}static decode(t){t=new Nm(N(t));let e=Ft.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new Et(n,i,s);return o._createHeader=Lm(e,s),o}static encode(t){let e=new Um,n=-1;return t.isSchema()?n=G.encode(e,t.header()):t.isRecordBatch()?n=Gt.encode(e,t.header()):t.isDictionaryBatch()&&(n=ge.encode(e,t.header())),Ft.startMessage(e),Ft.addVersion(e,Ut.V4),Ft.addHeader(e,n),Ft.addHeaderType(e,t.headerType),Ft.addBodyLength(e,new In(t.bodyLength,0)),Ft.finishMessageBuffer(e,Ft.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof G)return new Et(0,Ut.V4,Q.Schema,t);if(t instanceof Gt)return new Et(e,Ut.V4,Q.RecordBatch,t);if(t instanceof ge)return new Et(e,Ut.V4,Q.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${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===Q.Schema}isRecordBatch(){return this.headerType===Q.RecordBatch}isDictionaryBatch(){return this.headerType===Q.DictionaryBatch}},Gt=class{constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=typeof t=="number"?t:t.low}get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}},ge=class{constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=typeof e=="number"?e:e.low}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}},be=class{constructor(t,e){this.offset=typeof t=="number"?t:t.low,this.length=typeof e=="number"?e:e.low}},Ze=class{constructor(t,e){this.length=typeof t=="number"?t:t.low,this.nullCount=typeof e=="number"?e:e.low}};function km(r,t){return()=>{switch(t){case Q.Schema:return G.fromJSON(r);case Q.RecordBatch:return Gt.fromJSON(r);case Q.DictionaryBatch:return ge.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${Q[t]}, type: ${t} }`)}}function Lm(r,t){return()=>{switch(t){case Q.Schema:return G.decode(r.header(new wt));case Q.RecordBatch:return Gt.decode(r.header(new Zt),r.version());case Q.DictionaryBatch:return ge.decode(r.header(new Ne),r.version())}throw new Error(`Unrecognized Message type: { name: ${Q[t]}, type: ${t} }`)}}H.encode=Gm;H.decode=Ym;H.fromJSON=Au;G.encode=Xm;G.decode=Cm;G.fromJSON=wu;Gt.encode=Km;Gt.decode=Pm;Gt.fromJSON=ja;ge.encode=Jm;ge.decode=Vm;ge.fromJSON=vu;Ze.encode=qm;Ze.decode=zm;be.encode=Zm;be.decode=Hm;function Cm(r,t=new Map){let e=$m(r,t);return new G(e,Do(r),t)}function Pm(r,t=Ut.V4){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Gt(r.length(),jm(r),Wm(r,t))}function Vm(r,t=Ut.V4){return new ge(Gt.decode(r.data(),t),r.id(),r.isDelta())}function Hm(r){return new be(r.offset(),r.length())}function zm(r){return new Ze(r.length(),r.nullCount())}function jm(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=Ze.decode(e));return t}function Wm(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<Ut.V4&&(n.bb_pos+=8*(i+1)),e[++s]=be.decode(n));return e}function $m(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=H.decode(n,t));return e}function Fu(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=H.decode(n,t));return e}function Ym(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=Bu(r,Fu(r,t)),n=new H(r.name(),i,r.nullable(),Do(r))):t.has(e=a.id().low)?(s=(s=a.indexType())?xu(s):new rr,o=new ve(t.get(e),s,e,a.isOrdered()),n=new H(r.name(),o,r.nullable(),Do(r))):(s=(s=a.indexType())?xu(s):new rr,t.set(e,i=Bu(r,Fu(r,t))),o=new ve(i,s,e,a.isOrdered()),n=new H(r.name(),o,r.nullable(),Do(r))),n||null}function Do(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 xu(r){return new At(r.isSigned(),r.bitWidth())}function Bu(r,t){let e=r.typeType();switch(e){case yt.NONE:return new ne;case yt.Null:return new ne;case yt.Binary:return new vr;case yt.Utf8:return new Sr;case yt.Bool:return new Ir;case yt.List:return new We((t||[])[0]);case yt.Struct_:return new ut(t||[])}switch(e){case yt.Int:{let n=r.type(new kt);return new At(n.isSigned(),n.bitWidth())}case yt.FloatingPoint:{let n=r.type(new fe);return new ce(n.precision())}case yt.Decimal:{let n=r.type(new Lt);return new Ar(n.scale(),n.precision(),n.bitWidth())}case yt.Date:{let n=r.type(new le);return new Fr(n.unit())}case yt.Time:{let n=r.type(new Kt);return new je(n.unit(),n.bitWidth())}case yt.Timestamp:{let n=r.type(new Jt);return new xr(n.unit(),n.timezone())}case yt.Interval:{let n=r.type(new he);return new Br(n.unit())}case yt.Union:{let n=r.type(new Ct);return new $e(n.mode(),n.typeIdsArray()||[],t||[])}case yt.FixedSizeBinary:{let n=r.type(new ue);return new Tr(n.byteWidth())}case yt.FixedSizeList:{let n=r.type(new de);return new Ye(n.listSize(),(t||[])[0])}case yt.Map:{let n=r.type(new pe);return new Xe((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${yt[e]}" (${e})`)}function Xm(r,t){let e=t.fields.map(s=>H.encode(r,s));wt.startFieldsVector(r,e.length);let n=wt.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?wt.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString(`${s}`),c=r.createString(`${o}`);return dt.startKeyValue(r),dt.addKey(r,a),dt.addValue(r,c),dt.endKeyValue(r)})):-1;return wt.startSchema(r),wt.addFields(r,n),wt.addEndianness(r,Qm?Xr.Little:Xr.Big),i!==-1&&wt.addCustomMetadata(r,i),wt.endSchema(r)}function Gm(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;F.isDictionary(s)?(o=s.dictionary.typeId,i=Bo.visit(s,r),n=Bo.visit(s.dictionary,r)):n=Bo.visit(s,r);let a=(s.children||[]).map(p=>H.encode(r,p)),c=Dt.createChildrenVector(r,a),d=t.metadata&&t.metadata.size>0?Dt.createCustomMetadataVector(r,[...t.metadata].map(([p,b])=>{let _=r.createString(`${p}`),S=r.createString(`${b}`);return dt.startKeyValue(r),dt.addKey(r,_),dt.addValue(r,S),dt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),Dt.startField(r),Dt.addType(r,n),Dt.addTypeType(r,o),Dt.addChildren(r,c),Dt.addNullable(r,!!t.nullable),e!==-1&&Dt.addName(r,e),i!==-1&&Dt.addDictionary(r,i),d!==-1&&Dt.addCustomMetadata(r,d),Dt.endField(r)}function Km(r,t){let e=t.nodes||[],n=t.buffers||[];Zt.startNodesVector(r,e.length);for(let o of e.slice().reverse())Ze.encode(r,o);let i=r.endVector();Zt.startBuffersVector(r,n.length);for(let o of n.slice().reverse())be.encode(r,o);let s=r.endVector();return Zt.startRecordBatch(r),Zt.addLength(r,new In(t.length,0)),Zt.addNodes(r,i),Zt.addBuffers(r,s),Zt.endRecordBatch(r)}function Jm(r,t){let e=Gt.encode(r,t.data);return Ne.startDictionaryBatch(r),Ne.addId(r,new In(t.id,0)),Ne.addIsDelta(r,t.isDelta),Ne.addData(r,e),Ne.endDictionaryBatch(r)}function qm(r,t){return Xn.createFieldNode(r,new In(t.length,0),new In(t.nullCount,0))}function Zm(r,t){return Yn.createBuffer(r,new In(t.offset,0),new In(t.length,0))}var Qm=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var $a=r=>`Expected ${Q[r]} Message in stream, but was null or length 0.`,Ya=r=>`Header pointer of flatbuffer-encoded ${Q[r]} Message is null or length 0.`,Tu=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Du=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,Kn=class{constructor(t){this.source=t instanceof pr?t:new pr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?ft:t.value===-1&&(t=this.readMetadataLength()).done?ft:(t=this.readMetadata(t.value)).done?ft: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($a(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=N(this.source.read(t));if(e.byteLength<t)throw new Error(Du(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=Q.Schema,n=this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(Ya(e));return i}readMetadataLength(){let t=this.source.read(Eo),e=t&&new ie(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 ft;if(e.byteLength<t)throw new Error(Tu(t,e.byteLength));return{done:!1,value:Et.decode(e)}}},Xi=class{constructor(t,e){this.source=t instanceof me?t:ms(t)?new Kr(t,e):new me(t)}[Symbol.asyncIterator](){return this}next(){return I(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?ft:t.value===-1&&(t=yield this.readMetadataLength()).done?ft:(t=yield this.readMetadata(t.value)).done?ft:t})}throw(t){return I(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return I(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return I(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($a(t));return e.value})}readMessageBody(t){return I(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=N(yield this.source.read(t));if(e.byteLength<t)throw new Error(Du(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return I(this,void 0,void 0,function*(){let e=Q.Schema,n=yield this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(Ya(e));return i})}readMetadataLength(){return I(this,void 0,void 0,function*(){let t=yield this.source.read(Eo),e=t&&new ie(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(t){return I(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return ft;if(e.byteLength<t)throw new Error(Tu(t,e.byteLength));return{done:!1,value:Et.decode(e)}})}},Gi=class extends Kn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Ii?t:new Ii(t)}next(){let{_json:t}=this;if(!this._schema){this._schema=!0;let e=Et.fromJSON(t.schema,Q.Schema);return{done:!1,value:e}}if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];this._body=e.data.columns;let n=Et.fromJSON(e,Q.DictionaryBatch);return{done:!1,value:n}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];this._body=e.columns;let n=Et.fromJSON(e,Q.RecordBatch);return{done:!1,value:n}}return this._body=[],ft}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE&&[s.TYPE]||[],...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($a(t));return e.value}readSchema(){let t=Q.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(Ya(t));return n}},Eo=4,Wa="ARROW1",Jn=new Uint8Array(Wa.length);for(let r=0;r<Wa.length;r+=1)Jn[r]=Wa.codePointAt(r);function Oo(r,t=0){for(let e=-1,n=Jn.length;++e<n;)if(Jn[e]!==r[t+e])return!1;return!0}var qn=Jn.length,Xa=qn+Eo,Eu=qn*2+Eo;var xt=class extends _n{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 Ce(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 $t.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return $t.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 xt?t:hs(t)?e_(t):ms(t)?i_(t):Ce(t)?(()=>I(this,void 0,void 0,function*(){return yield xt.from(yield t)}))():_s(t)||li(t)||bs(t)||Ee(t)?n_(new me(t)):r_(new pr(t))}static readAll(t){return t instanceof xt?t.isSync()?Ou(t):Mu(t):hs(t)||ArrayBuffer.isView(t)||Pe(t)||ps(t)?Ou(t):Mu(t)}},_r=class extends xt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return ae(this,arguments,function*(){yield W(yield*Bn(De(this[Symbol.iterator]())))})}},Jr=class extends xt{constructor(t){super(t),this._impl=t}readAll(){var t,e;return I(this,void 0,void 0,function*(){let n=new Array;try{for(var i=De(this),s;s=yield i.next(),!s.done;){let o=s.value;n.push(o)}}catch(o){t={error:o}}finally{try{s&&!s.done&&(e=i.return)&&(yield e.call(i))}finally{if(t)throw t.error}}return n})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},qr=class extends _r{constructor(t){super(t),this._impl=t}},Ki=class extends Jr{constructor(t){super(t),this._impl=t}},Mo=class{constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}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=C({type:new ut(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);if(i||!a){let c=o.dictionaries.get(n),d=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new L(d)):new L(d)).memoize()}return a.memoize()}_loadVectors(t,e,n){return new xi(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}},Zn=class extends Mo{constructor(t,e){super(e),this._reader=hs(t)?new Gi(this._handle=t):new Kn(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=Ru(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):ft}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):ft}next(){if(this.closed)return ft;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),s=this._loadRecordBatch(n,i);return{done:!1,value:s}}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 Sn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Qn=class extends Mo{constructor(t,e){super(e),this._reader=new Xi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return I(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 I(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Ru(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return I(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):ft})}return(t){return I(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):ft})}next(){return I(this,void 0,void 0,function*(){if(this.closed)return ft;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),s=this._loadRecordBatch(n,i);return{done:!1,value:s}}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 Sn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return I(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Ro=class extends Zn{constructor(t,e){super(t instanceof Ai?t:new Ai(t),e)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}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(Q.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(Q.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-Xa,n=t.readInt32(e),i=t.readAt(e-n,n);return Mr.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}},Ga=class extends Qn{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 Kr?t:new Kr(t,n),i)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return I(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){var e;return I(this,void 0,void 0,function*(){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(Q.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){var e;return I(this,void 0,void 0,function*(){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(Q.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 I(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-Xa,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return Mr.decode(i)})}_readNextMessageAndValidate(t){return I(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})}},Ka=class extends Zn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new no(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}};function Ru(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Ou(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 Mu(r){return ae(this,arguments,function*(){let e=yield W(xt.from(r));try{if(!(yield W(e.open({autoDestroy:!1}))).closed)do yield yield W(e);while(!(yield W(e.reset().open())).closed)}finally{yield W(e.cancel())}})}function e_(r){return new _r(new Ka(r))}function r_(r){let t=r.peek(qn+7&-8);return t&&t.byteLength>=4?Oo(t)?new qr(new Ro(r.read())):new _r(new Zn(r)):new _r(new Zn(function*(){}()))}function n_(r){return I(this,void 0,void 0,function*(){let t=yield r.peek(qn+7&-8);return t&&t.byteLength>=4?Oo(t)?new qr(new Ro(yield r.read())):new Jr(new Qn(r)):new Jr(new Qn(function(){return ae(this,arguments,function*(){})}()))})}function i_(r){return I(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Kr(r,t);return t>=Eu&&Oo(yield e.readAt(0,qn+7&-8))?new Ki(new Ga(e)):new Jr(new Qn(e))})}var vt=class extends D{constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof ct?s.data.children:s.data),n=new vt;return n.visitMany(e(t)),n}visit(t){if(t instanceof L)return this.visitMany(t.data),this;let{type:e}=t;if(!F.isDictionary(e)){let{length:n,nullCount:i}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");F.isNull(e)||Qe.call(this,i<=0?new Uint8Array(0):kn(t.offset,n,t.nullBitmap)),this.nodes.push(new Ze(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 Qe(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new be(this._byteLength,t)),this._byteLength+=t,this}function s_(r){let{type:t,length:e,typeIds:n,valueOffsets:i}=r;if(Qe.call(this,n),t.mode===gt.Sparse)return Ja.call(this,r);if(t.mode===gt.Dense){if(r.offset<=0)return Qe.call(this,i),Ja.call(this,r);{let s=n.reduce((p,b)=>Math.max(p,b),n[0]),o=new Int32Array(s+1),a=new Int32Array(s+1).fill(-1),c=new Int32Array(e),d=ui(-i[0],e,i);for(let p,b,_=-1;++_<e;)(b=a[p=n[_]])===-1&&(b=a[p]=d[p]),c[_]=d[_]-b,++o[p];Qe.call(this,c);for(let p,b=-1,_=t.children.length;++b<_;)if(p=r.children[b]){let S=t.typeIds[b],J=Math.min(e,o[S]);this.visit(p.slice(a[S],J))}}}return this}function o_(r){let t;return r.nullCount>=r.length?Qe.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?Qe.call(this,kn(r.offset,r.length,t)):Qe.call(this,fn(r.values))}function Zr(r){return Qe.call(this,r.values.subarray(0,r.length*r.stride))}function Uu(r){let{length:t,values:e,valueOffsets:n}=r,i=n[0],s=n[t],o=Math.min(s-i,e.byteLength-i);return Qe.call(this,ui(-n[0],t,n)),Qe.call(this,e.subarray(i,i+o)),this}function qa(r){let{length:t,valueOffsets:e}=r;return e&&Qe.call(this,ui(e[0],t,e)),this.visit(r.children[0])}function Ja(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}vt.prototype.visitBool=o_;vt.prototype.visitInt=Zr;vt.prototype.visitFloat=Zr;vt.prototype.visitUtf8=Uu;vt.prototype.visitBinary=Uu;vt.prototype.visitFixedSizeBinary=Zr;vt.prototype.visitDate=Zr;vt.prototype.visitTimestamp=Zr;vt.prototype.visitTime=Zr;vt.prototype.visitDecimal=Zr;vt.prototype.visitList=qa;vt.prototype.visitStruct=Ja;vt.prototype.visitUnion=s_;vt.prototype.visitInterval=Zr;vt.prototype.visitFixedSizeList=qa;vt.prototype.visitMap=qa;var Qr=class extends _n{constructor(t){super(),this._position=0,this._started=!1,this._sink=new hr,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,ee(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}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')}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Ce(t)?t.then(e=>this.writeAll(e)):Ee(t)?Qa(this,t):Za(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 hr?this._sink=t:(this._sink=new hr,t&&il(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&sl(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!e||!vn(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 It&&!(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&&!vn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof ct?t instanceof Sn||this._writeRecordBatch(t):t instanceof It?this.writeAll(t.batches):Pe(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=Et.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,c=a-s-o;return t.headerType===Q.RecordBatch?this._recordBatchBlocks.push(new Je(a,t.bodyLength,this._position)):t.headerType===Q.DictionaryBatch&&this._dictionaryBlocks.push(new Je(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=N(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(Et.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Jn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=vt.assemble(t),o=new Gt(t.numRows,n,i),a=Et.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));let{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=vt.assemble(new L([t])),c=new Gt(t.length,s,o),d=new ge(c,e,n),p=Et.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){for(let[e,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(e)||0;if(i===0||(n=n==null?void 0:n.slice(i)).length>0)for(let s of n.data)this._writeDictionaryBatch(s,e,i>0),i+=s.length}return this}},yr=class extends Qr{static writeAll(t,e){let n=new yr(e);return Ce(t)?t.then(i=>n.writeAll(i)):Ee(t)?Qa(n,t):Za(n,t)}},tn=class extends Qr{static writeAll(t){let e=new tn;return Ce(t)?t.then(n=>e.writeAll(n)):Ee(t)?Qa(e,t):Za(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=Mr.encode(new Mr(t,Ut.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function Za(r,t){let e=t;t instanceof It&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function Qa(r,t){var e,n,i,s;return I(this,void 0,void 0,function*(){try{for(e=De(t);n=yield e.next(),!n.done;){let o=n.value;r.write(o)}}catch(o){i={error:o}}finally{try{n&&!n.done&&(s=e.return)&&(yield s.call(e))}finally{if(i)throw i.error}}return r.finish()})}function Nu(r,t){if(Ee(r))return c_(r,t);if(Pe(r))return a_(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function a_(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?void 0: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=N(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 c_(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 I(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return I(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return I(this,void 0,void 0,function*(){((e==null?void 0:e.return)&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){return I(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=N(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 Cu(r){return new tc(r)}var tc=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=rl(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=bn(s),this._getSize=i!=="bytes"?ku:Lu;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"?ku:Lu}),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)}},ku=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},Lu=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function Uo(r,t){let e=new hr,n=null,i=new ReadableStream({cancel(){return I(this,void 0,void 0,function*(){yield e.close()})},start(a){return I(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return I(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 I(this,void 0,void 0,function*(){return yield(yield xt.from(e)).open(t)})}function o(a,c){return I(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 No(r,t){let e=new this(r),n=new me(e),i=new ReadableStream({cancel(){return I(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return I(this,void 0,void 0,function*(){yield s(o)})},start(o){return I(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 I(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()})}}var f_=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},ha),La),Da),pa),la),Ta),{compareSchemas:vn,compareFields:du,compareTypes:fu});$t.toDOMStream=Nu;_t.throughDOM=Cu;xt.throughDOM=Uo;qr.throughDOM=Uo;_r.throughDOM=Uo;Qr.throughDOM=No;tn.throughDOM=No;yr.throughDOM=No;function ti(r){switch(r.typeId){case f.Binary:return{sqlType:"binary"};case f.Bool:return{sqlType:"bool"};case f.Date:return{sqlType:"date"};case f.DateDay:return{sqlType:"date32[d]"};case f.DateMillisecond:return{sqlType:"date64[ms]"};case f.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case f.Float:return{sqlType:"float"};case f.Float16:return{sqlType:"float16"};case f.Float32:return{sqlType:"float32"};case f.Float64:return{sqlType:"float64"};case f.Int:return{sqlType:"int32"};case f.Int16:return{sqlType:"int16"};case f.Int32:return{sqlType:"int32"};case f.Int64:return{sqlType:"int64"};case f.Uint16:return{sqlType:"uint16"};case f.Uint32:return{sqlType:"uint32"};case f.Uint64:return{sqlType:"uint64"};case f.Uint8:return{sqlType:"uint8"};case f.IntervalDayTime:return{sqlType:"interval[dt]"};case f.IntervalYearMonth:return{sqlType:"interval[m]"};case f.List:return{sqlType:"list",valueType:ti(r.valueType)};case f.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case f.Null:return{sqlType:"null"};case f.Utf8:return{sqlType:"utf8"};case f.Struct:return{sqlType:"struct",fields:r.children.map(e=>ko(e.name,e.type))};case f.Map:{let t=r;return{sqlType:"map",keyType:ti(t.keyType),valueType:ti(t.valueType)}}case f.Time:return{sqlType:"time[s]"};case f.TimeMicrosecond:return{sqlType:"time[us]"};case f.TimeMillisecond:return{sqlType:"time[ms]"};case f.TimeNanosecond:return{sqlType:"time[ns]"};case f.TimeSecond:return{sqlType:"time[s]"};case f.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case f.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case f.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case f.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case f.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error(`unsupported arrow type: ${r.toString()}`)}function ko(r,t){let e=ti(t);return e.name=r,e}var Lo=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){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":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(),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]),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);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_CHUNK",data:e},[e.buffer]);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]),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":this._bindings.registerFileHandle(t.data[0],t.data[1]),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"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 this.failWith(t,e)}}};var Hu={},h_=(()=>{var r=Hu.url;return function(t){t=t||{};var e=typeof t<"u"?t:{},n,i;e.ready=new Promise(function(l,u){n=l,i=u});var s=Object.assign({},e),o=[],a="./this.program",c=(l,u)=>{throw u},d=typeof window=="object",p=typeof importScripts=="function",b=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",_="";function S(l){return e.locateFile?e.locateFile(l,_):_+l}var J,q,ot,St;function Qt(l){if(l instanceof ss)return;Fe("exiting due to exception: "+l)}var se,Lr,sn;b?(p?_=ec().dirname(_)+"/":_=__dirname+"/",sn=()=>{Lr||(se=Vu(),Lr=ec())},J=function(u,h){return sn(),u=Lr.normalize(u),se.readFileSync(u,h?void 0:"utf8")},ot=l=>{var u=J(l,!0);return u.buffer||(u=new Uint8Array(u)),u},q=(l,u,h)=>{sn(),l=Lr.normalize(l),se.readFile(l,function(m,y){m?h(m):u(y.buffer)})},process.argv.length>1&&(a=process.argv[1].replace(/\\/g,"/")),o=process.argv.slice(2),process.on("uncaughtException",function(l){if(!(l instanceof ss))throw l}),process.on("unhandledRejection",function(l){throw l}),c=(l,u)=>{if(_c())throw process.exitCode=l,u;Qt(u),process.exit(l)},e.inspect=function(){return"[Emscripten Module object]"}):(d||p)&&(p?_=self.location.href:typeof document<"u"&&document.currentScript&&(_=document.currentScript.src),r&&(_=r),_.indexOf("blob:")!==0?_=_.substr(0,_.replace(/[?#].*/,"").lastIndexOf("/")+1):_="",J=l=>{var u=new XMLHttpRequest;return u.open("GET",l,!1),u.send(null),u.responseText},p&&(ot=l=>{var u=new XMLHttpRequest;return u.open("GET",l,!1),u.responseType="arraybuffer",u.send(null),new Uint8Array(u.response)}),q=(l,u,h)=>{var m=new XMLHttpRequest;m.open("GET",l,!0),m.responseType="arraybuffer",m.onload=()=>{if(m.status==200||m.status==0&&m.response){u(m.response);return}h()},m.onerror=h,m.send(null)},St=l=>document.title=l);var $o=e.print||console.log.bind(console),Fe=e.printErr||console.warn.bind(console);Object.assign(e,s),s=null,e.arguments&&(o=e.arguments),e.thisProgram&&(a=e.thisProgram),e.quit&&(c=e.quit);var gr;e.wasmBinary&&(gr=e.wasmBinary);var Z=e.noExitRuntime||!0;typeof WebAssembly!="object"&&ke("no native wasm support detected");var Rt,te=!1,Vt;function Ht(l,u){l||ke(u)}function zt(l){var u=e["_"+l];return u}function at(l,u,h,m,y){var A={string:function(Ot){var Le=0;if(Ot!=null&&Ot!==0){var tr=(Ot.length<<2)+1;Le=ea(tr),Yo(Ot,Le,tr)}return Le},array:function(Ot){var Le=ea(Ot.length);return cc(Ot,Le),Le}};function v(Ot){return u==="string"?wr(Ot):u==="boolean"?Boolean(Ot):Ot}var w=zt(l),x=[],tt=0;if(m)for(var it=0;it<m.length;it++){var Te=A[h[it]];Te?(tt===0&&(tt=Dc()),x[it]=Te(m[it])):x[it]=m[it]}var pt=w.apply(null,x);function Fn(Ot){return tt!==0&&Ec(tt),v(Ot)}return pt=Fn(pt),pt}var oe=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function on(l,u,h){for(var m=u+h,y=u;l[y]&&!(y>=m);)++y;if(y-u>16&&l.buffer&&oe)return oe.decode(l.subarray(u,y));for(var A="";u<y;){var v=l[u++];if(!(v&128)){A+=String.fromCharCode(v);continue}var w=l[u++]&63;if((v&224)==192){A+=String.fromCharCode((v&31)<<6|w);continue}var x=l[u++]&63;if((v&240)==224?v=(v&15)<<12|w<<6|x:v=(v&7)<<18|w<<12|x<<6|l[u++]&63,v<65536)A+=String.fromCharCode(v);else{var tt=v-65536;A+=String.fromCharCode(55296|tt>>10,56320|tt&1023)}}return A}function wr(l,u){return l?on(Cr,l,u):""}function ac(l,u,h,m){if(!(m>0))return 0;for(var y=h,A=h+m-1,v=0;v<l.length;++v){var w=l.charCodeAt(v);if(w>=55296&&w<=57343){var x=l.charCodeAt(++v);w=65536+((w&1023)<<10)|x&1023}if(w<=127){if(h>=A)break;u[h++]=w}else if(w<=2047){if(h+1>=A)break;u[h++]=192|w>>6,u[h++]=128|w&63}else if(w<=65535){if(h+2>=A)break;u[h++]=224|w>>12,u[h++]=128|w>>6&63,u[h++]=128|w&63}else{if(h+3>=A)break;u[h++]=240|w>>18,u[h++]=128|w>>12&63,u[h++]=128|w>>6&63,u[h++]=128|w&63}}return u[h]=0,h-y}function Yo(l,u,h){return ac(l,Cr,u,h)}function qu(l){for(var u=0,h=0;h<l.length;++h){var m=l.charCodeAt(h);m>=55296&&m<=57343&&(m=65536+((m&1023)<<10)|l.charCodeAt(++h)&1023),m<=127?++u:m<=2047?u+=2:m<=65535?u+=3:u+=4}return u}function cc(l,u){ei.set(l,u)}function Zu(l,u,h){for(var m=0;m<l.length;++m)ei[u++>>0]=l.charCodeAt(m);h||(ei[u>>0]=0)}var lc,ei,Cr,ri,uc,T,Qu,td,ed;function dc(l){lc=l,e.HEAP8=ei=new Int8Array(l),e.HEAP16=ri=new Int16Array(l),e.HEAP32=T=new Int32Array(l),e.HEAPU8=Cr=new Uint8Array(l),e.HEAPU16=uc=new Uint16Array(l),e.HEAPU32=Qu=new Uint32Array(l),e.HEAPF32=td=new Float32Array(l),e.HEAPF64=ed=new Float64Array(l)}var I_=e.INITIAL_MEMORY||16777216,fc,hc=[],pc=[],rd=[],mc=[],nd=!1;function _c(){return Z}function id(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)cd(e.preRun.shift());Ji(hc)}function sd(){nd=!0,Ji(pc)}function od(){Ji(rd)}function ad(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)ud(e.postRun.shift());Ji(mc)}function cd(l){hc.unshift(l)}function ld(l){pc.unshift(l)}function ud(l){mc.unshift(l)}var an=0,Xo=null,ni=null;function dd(l){an++,e.monitorRunDependencies&&e.monitorRunDependencies(an)}function fd(l){if(an--,e.monitorRunDependencies&&e.monitorRunDependencies(an),an==0&&(Xo!==null&&(clearInterval(Xo),Xo=null),ni)){var u=ni;ni=null,u()}}function ke(l){e.onAbort&&e.onAbort(l),l="Aborted("+l+")",Fe(l),te=!0,Vt=1,l+=". Build with -sASSERTIONS for more info.";var u=new WebAssembly.RuntimeError(l);throw i(u),u}var hd="data:application/octet-stream;base64,";function yc(l){return l.startsWith(hd)}var xe;e.locateFile?(xe="./duckdb-eh.wasm",yc(xe)||(xe=S(xe))):xe=new URL("./duckdb-eh.wasm",Hu.url).toString();function bc(l){try{if(l==xe&&gr)return new Uint8Array(gr);if(ot)return ot(l);throw"both async and sync fetching of the wasm failed"}catch(u){ke(u)}}function pd(){return!gr&&(d||p)&&typeof fetch=="function"?fetch(xe,{credentials:"same-origin"}).then(function(l){if(!l.ok)throw"failed to load wasm binary file at '"+xe+"'";return l.arrayBuffer()}).catch(function(){return bc(xe)}):Promise.resolve().then(function(){return bc(xe)})}function md(){var l={a:Of};function u(v,w){var x=v.exports;e.asm=x,Rt=e.asm.ha,dc(Rt.buffer),fc=e.asm.db,ld(e.asm.ia),fd("wasm-instantiate")}dd("wasm-instantiate");function h(v){u(v.instance)}function m(v){return pd().then(function(w){return WebAssembly.instantiate(w,l)}).then(function(w){return w}).then(v,function(w){Fe("failed to asynchronously prepare wasm: "+w),ke(w)})}function y(){return!gr&&typeof WebAssembly.instantiateStreaming=="function"&&!yc(xe)&&typeof fetch=="function"?fetch(xe,{credentials:"same-origin"}).then(function(v){var w=WebAssembly.instantiateStreaming(v,l);return w.then(h,function(x){return Fe("wasm streaming compile failed: "+x),Fe("falling back to ArrayBuffer instantiation"),m(h)})}):m(h)}if(e.instantiateWasm)try{var A=e.instantiateWasm(l,u);return A}catch(v){return Fe("Module.instantiateWasm callback failed with error: "+v),!1}return y().catch(i),{}}function Ji(l){for(;l.length>0;){var u=l.shift();if(typeof u=="function"){u(e);continue}var h=u.func;typeof h=="number"?u.arg===void 0?gc(h)():gc(h)(u.arg):h(u.arg===void 0?null:u.arg)}}var qi=[];function gc(l){var u=qi[l];return u||(l>=qi.length&&(qi.length=l+1),qi[l]=u=fc.get(l)),u}function _d(l){if(l instanceof ss||l=="unwind")return Vt;c(1,l)}function yd(l,u,h,m){ke("Assertion failed: "+wr(l)+", at: "+[u?wr(u):"unknown filename",h,m?wr(m):"unknown function"])}var jt={buffers:[null,[],[]],printChar:function(l,u){var h=jt.buffers[l];u===0||u===10?((l===1?$o:Fe)(on(h,0)),h.length=0):h.push(u)},varargs:void 0,get:function(){jt.varargs+=4;var l=T[jt.varargs-4>>2];return l},getStr:function(l){var u=wr(l);return u}};function bd(l,u,h,m,y){}function gd(){Fe("missing function: $SOCKFS"),ke(-1)}function wc(){Fe("missing function: $FS"),ke(-1)}function ii(l){var u=gd.getSocket(l);if(!u)throw new wc.ErrnoError(8);return u}function Go(l){return(l&255)+"."+(l>>8&255)+"."+(l>>16&255)+"."+(l>>24&255)}function vc(l){var u="",h=0,m=0,y=0,A=0,v=0,w=0,x=[l[0]&65535,l[0]>>16,l[1]&65535,l[1]>>16,l[2]&65535,l[2]>>16,l[3]&65535,l[3]>>16],tt=!0,it="";for(w=0;w<5;w++)if(x[w]!==0){tt=!1;break}if(tt){if(it=Go(x[6]|x[7]<<16),x[5]===-1)return u="::ffff:",u+=it,u;if(x[5]===0)return u="::",it==="0.0.0.0"&&(it=""),it==="0.0.0.1"&&(it="1"),u+=it,u}for(h=0;h<8;h++)x[h]===0&&(h-y>1&&(v=0),y=h,v++),v>m&&(m=v,A=h-m+1);for(h=0;h<8;h++){if(m>1&&x[h]===0&&h>=A&&h<A+m){h===A&&(u+=":",A===0&&(u+=":"));continue}u+=Number(Qo(x[h]&65535)).toString(16),u+=h<7?":":""}return u}function Sc(l,u){var h=ri[l>>1],m=Qo(uc[l+2>>1]),y;switch(h){case 2:if(u!==16)return{errno:28};y=T[l+4>>2],y=Go(y);break;case 10:if(u!==28)return{errno:28};y=[T[l+8>>2],T[l+12>>2],T[l+16>>2],T[l+20>>2]],y=vc(y);break;default:return{errno:5}}return{family:h,addr:y,port:m}}function Zi(l){for(var u=l.split("."),h=0;h<4;h++){var m=Number(u[h]);if(isNaN(m))return null;u[h]=m}return(u[0]|u[1]<<8|u[2]<<16|u[3]<<24)>>>0}function Qi(l){return parseInt(l)}function Ko(l){var u,h,m,y,A=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,v=[];if(!A.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]=Qi(u[u.length-4])+Qi(u[u.length-3])*256,u[u.length-3]=Qi(u[u.length-2])+Qi(u[u.length-1])*256,u=u.slice(0,u.length-2)):u=l.split(":"),m=0,y=0,h=0;h<u.length;h++)if(typeof u[h]=="string")if(u[h]==="Z"){for(y=0;y<8-u.length+1;y++)v[h+y]=0;m=y-1}else v[h+m]=ns(parseInt(u[h],16));else v[h+m]=u[h];return[v[1]<<16|v[0],v[3]<<16|v[2],v[5]<<16|v[4],v[7]<<16|v[6]]}var Be={address_map:{id:1,addrs:{},names:{}},lookup_name:function(l){var u=Zi(l);if(u!==null||(u=Ko(l),u!==null))return l;var h;if(Be.address_map.addrs[l])h=Be.address_map.addrs[l];else{var m=Be.address_map.id++;Ht(m<65535,"exceeded max address mappings of 65535"),h="172.29."+(m&255)+"."+(m&65280),Be.address_map.names[h]=l,Be.address_map.addrs[l]=h}return h},lookup_addr:function(l){return Be.address_map.names[l]?Be.address_map.names[l]:null}};function Ic(l,u,h){if(h&&l===0)return null;var m=Sc(l,u);if(m.errno)throw new wc.ErrnoError(m.errno);return m.addr=Be.lookup_addr(m.addr)||m.addr,m}function wd(l,u,h){var m=ii(l),y=Ic(u,h);return m.sock_ops.bind(m,y.addr,y.port),0}function vd(l,u,h){var m=ii(l),y=Ic(u,h);return m.sock_ops.connect(m,y.addr,y.port),0}function Sd(l,u,h,m){return u=jt.getStr(u),u=jt.calculateAt(l,u),jt.doAccess(u,h)}function Id(l,u,h){return jt.varargs=h,0}function Ad(l,u){}function Fd(l,u,h){}function xd(l,u,h){}function Ac(l,u){Cr.fill(0,l,l+u)}function Jo(l,u,h,m,y){switch(u){case 2:h=Zi(h),Ac(l,16),y&&(T[y>>2]=16),ri[l>>1]=u,T[l+4>>2]=h,ri[l+2>>1]=ns(m);break;case 10:h=Ko(h),Ac(l,28),y&&(T[y>>2]=28),T[l>>2]=u,T[l+8>>2]=h[0],T[l+12>>2]=h[1],T[l+16>>2]=h[2],T[l+20>>2]=h[3],ri[l+2>>1]=ns(m);break;default:return 5}return 0}function Bd(l,u,h){var m=ii(l);if(!m.daddr)return-53;var y=Jo(u,m.family,Be.lookup_name(m.daddr),m.dport,h);return 0}function Td(l,u,h,m,y){var A=ii(l);return u===1&&h===4?(T[m>>2]=A.error,T[y>>2]=4,A.error=null,0):-50}function Dd(l,u,h){return jt.varargs=h,0}function Ed(l,u){}function Od(l,u,h){}function Md(l,u,h,m){}function Rd(l,u,h,m){jt.varargs=m}function Ud(l,u,h,m,y,A){var v=ii(l),w=v.sock_ops.recvmsg(v,h);if(!w)return 0;if(y)var x=Jo(y,v.family,Be.lookup_name(w.addr),w.port,A);return Cr.set(w.buffer,u),w.buffer.byteLength}function Nd(l,u,h,m){}function kd(l){}function Ld(l,u,h,m,y,A){}function Cd(l,u,h){}function Pd(l,u){}function Vd(l,u,h){}function Hd(l){}var Fc="To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking";function zd(l,u){ke(Fc)}function jd(l,u){ke(Fc)}function Wd(){return Date.now()}var $d=!0;function Yd(){return $d}function Xd(){ke("")}function Gd(l,u){return globalThis.DUCKDB_RUNTIME.createDirectory(e,l,u)}function Kd(l,u){return globalThis.DUCKDB_RUNTIME.checkDirectory(e,l,u)}function Jd(l,u){return globalThis.DUCKDB_RUNTIME.listDirectoryEntries(e,l,u)}function qd(l,u){return globalThis.DUCKDB_RUNTIME.removeDirectory(e,l,u)}function Zd(l){return globalThis.DUCKDB_RUNTIME.closeFile(e,l)}function Qd(l,u){return globalThis.DUCKDB_RUNTIME.checkFile(e,l,u)}function tf(l){return globalThis.DUCKDB_RUNTIME.getLastFileModificationTime(e,l)}function ef(l,u,h,m){return globalThis.DUCKDB_RUNTIME.moveFile(e,l,u,h,m)}function rf(l,u){return globalThis.DUCKDB_RUNTIME.openFile(e,l,u)}function nf(l,u,h,m){return globalThis.DUCKDB_RUNTIME.readFile(e,l,u,h,m)}function sf(l,u){return globalThis.DUCKDB_RUNTIME.truncateFile(e,l,u)}function of(l,u,h,m){return globalThis.DUCKDB_RUNTIME.writeFile(e,l,u,h,m)}function af(l,u){return globalThis.DUCKDB_RUNTIME.glob(e,l,u)}function cf(l){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(e,l)}function lf(l,u,h,m,y,A){return globalThis.DUCKDB_RUNTIME.callScalarUDF(e,l,u,h,m,y,A)}function xc(){return 2147483648}var qo;b?qo=()=>{var l=process.hrtime();return l[0]*1e3+l[1]/1e6}:qo=()=>performance.now();function uf(l,u,h){Cr.copyWithin(l,u,u+h)}function df(l){try{return Rt.grow(l-lc.byteLength+65535>>>16),dc(Rt.buffer),1}catch(u){}}function ff(l){var u=Cr.length;l=l>>>0;var h=xc();if(l>h)return!1;let m=(x,tt)=>x+(tt-x%tt)%tt;for(var y=1;y<=4;y*=2){var A=u*(1+.2/y);A=Math.min(A,l+100663296);var v=Math.min(h,m(Math.max(l,A),65536)),w=df(v);if(w)return!0}return!1}var Zo={};function hf(){return a||"./this.program"}function si(){if(!si.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,_:hf()};for(var h in Zo)Zo[h]===void 0?delete u[h]:u[h]=Zo[h];var m=[];for(var h in u)m.push(h+"="+u[h]);si.strings=m}return si.strings}function pf(l,u){var h=0;return si().forEach(function(m,y){var A=u+h;T[l+y*4>>2]=A,Zu(m,A),h+=m.length+1}),0}function mf(l,u){var h=si();T[l>>2]=h.length;var m=0;return h.forEach(function(y){m+=y.length+1}),T[u>>2]=m,0}function _f(l){return 0}function yf(l,u,h,m,y,A){var v=jt.getStreamFromFD(l),w=jt.doReadv(v,u,h,m);return T[A>>2]=w,0}function bf(l,u,h,m,y,A){var v=jt.getStreamFromFD(l),w=jt.doWritev(v,u,h,m);return T[A>>2]=w,0}function gf(l,u,h,m){var y=jt.getStreamFromFD(l),A=jt.doReadv(y,u,h);return T[m>>2]=A,0}function wf(l,u,h,m,y){}function vf(l){var u=jt.getStreamFromFD(l);return u.stream_ops&&u.stream_ops.fsync?-u.stream_ops.fsync(u):0}function Sf(l,u,h,m){for(var y=0,A=0;A<h;A++){var v=T[u>>2],w=T[u+4>>2];u+=8;for(var x=0;x<w;x++)jt.printChar(l,Cr[v+x]);y+=w}return T[m>>2]=y,0}function If(l,u,h,m){var y=0,A=0,v=0,w=0,x=0,tt=0,it;function Te(pt,Fn,Ot,Le,tr,oi){var g,E,bt,Wt;return E=pt===10?28:16,tr=pt===10?vc(tr):Go(tr),g=ta(E),Wt=Jo(g,pt,tr,oi),Ht(!Wt),bt=ta(32),T[bt+4>>2]=pt,T[bt+8>>2]=Fn,T[bt+12>>2]=Ot,T[bt+24>>2]=Le,T[bt+20>>2]=g,pt===10?T[bt+16>>2]=28:T[bt+16>>2]=16,T[bt+28>>2]=0,bt}if(h&&(v=T[h>>2],w=T[h+4>>2],x=T[h+8>>2],tt=T[h+12>>2]),x&&!tt&&(tt=x===2?17:6),!x&&tt&&(x=tt===17?2:1),tt===0&&(tt=6),x===0&&(x=1),!l&&!u)return-2;if(v&-1088||h!==0&&T[h>>2]&2&&!l)return-1;if(v&32)return-2;if(x!==0&&x!==1&&x!==2)return-7;if(w!==0&&w!==2&&w!==10)return-6;if(u&&(u=wr(u),A=parseInt(u,10),isNaN(A)))return v&1024?-2:-8;if(!l)return w===0&&(w=2),(v&1)===0&&(w===2?y=rs(2130706433):y=[0,0,0,1]),it=Te(w,x,tt,null,y,A),T[m>>2]=it,0;if(l=wr(l),y=Zi(l),y!==null)if(w===0||w===2)w=2;else if(w===10&&v&8)y=[0,0,rs(65535),y],w=10;else return-2;else if(y=Ko(l),y!==null)if(w===0||w===10)w=10;else return-2;return y!=null?(it=Te(w,x,tt,l,y,A),T[m>>2]=it,0):v&4?-2:(l=Be.lookup_name(l),y=Zi(l),w===0?w=2:w===10&&(y=[0,0,rs(65535),y]),it=Te(w,x,tt,null,y,A),T[m>>2]=it,0)}function Af(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var l=new Uint8Array(1);return function(){return crypto.getRandomValues(l),l[0]}}else if(b)try{var u=Eh("crypto");return function(){return u.randomBytes(1)[0]}}catch(h){}return function(){ke("randomDevice")}}function ts(l,u){ts.randomDevice||(ts.randomDevice=Af());for(var h=0;h<u;h++)ei[l+h>>0]=ts.randomDevice();return 0}function Ff(l,u,h,m,y,A,v){var w=Sc(l,u);if(w.errno)return-6;var x=w.port,tt=w.addr,it=!1;if(h&&m){var Te;if(v&1||!(Te=Be.lookup_addr(tt))){if(v&8)return-2}else tt=Te;var pt=Yo(tt,h,m);pt+1>=m&&(it=!0)}if(y&&A){x=""+x;var pt=Yo(x,y,A);pt+1>=A&&(it=!0)}return it?-12:0}function es(l){return l%4===0&&(l%100!==0||l%400===0)}function xf(l,u){for(var h=0,m=0;m<=u;h+=l[m++]);return h}var Bc=[31,29,31,30,31,30,31,31,30,31,30,31],Tc=[31,28,31,30,31,30,31,31,30,31,30,31];function Bf(l,u){for(var h=new Date(l.getTime());u>0;){var m=es(h.getFullYear()),y=h.getMonth(),A=(m?Bc:Tc)[y];if(u>A-h.getDate())u-=A-h.getDate()+1,h.setDate(1),y<11?h.setMonth(y+1):(h.setMonth(0),h.setFullYear(h.getFullYear()+1));else return h.setDate(h.getDate()+u),h}return h}function Tf(l,u,h,m){var y=T[m+40>>2],A={tm_sec:T[m>>2],tm_min:T[m+4>>2],tm_hour:T[m+8>>2],tm_mday:T[m+12>>2],tm_mon:T[m+16>>2],tm_year:T[m+20>>2],tm_wday:T[m+24>>2],tm_yday:T[m+28>>2],tm_isdst:T[m+32>>2],tm_gmtoff:T[m+36>>2],tm_zone:y?wr(y):""},v=wr(h),w={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var x in w)v=v.replace(new RegExp(x,"g"),w[x]);var tt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],it=["January","February","March","April","May","June","July","August","September","October","November","December"];function Te(g,E,bt){for(var Wt=typeof g=="number"?g.toString():g||"";Wt.length<E;)Wt=bt[0]+Wt;return Wt}function pt(g,E){return Te(g,E,"0")}function Fn(g,E){function bt(os){return os<0?-1:os>0?1:0}var Wt;return(Wt=bt(g.getFullYear()-E.getFullYear()))===0&&(Wt=bt(g.getMonth()-E.getMonth()))===0&&(Wt=bt(g.getDate()-E.getDate())),Wt}function Ot(g){switch(g.getDay()){case 0:return new Date(g.getFullYear()-1,11,29);case 1:return g;case 2:return new Date(g.getFullYear(),0,3);case 3:return new Date(g.getFullYear(),0,2);case 4:return new Date(g.getFullYear(),0,1);case 5:return new Date(g.getFullYear()-1,11,31);case 6:return new Date(g.getFullYear()-1,11,30)}}function Le(g){var E=Bf(new Date(g.tm_year+1900,0,1),g.tm_yday),bt=new Date(E.getFullYear(),0,4),Wt=new Date(E.getFullYear()+1,0,4),os=Ot(bt),Ah=Ot(Wt);return Fn(os,E)<=0?Fn(Ah,E)<=0?E.getFullYear()+1:E.getFullYear():E.getFullYear()-1}var tr={"%a":function(g){return tt[g.tm_wday].substring(0,3)},"%A":function(g){return tt[g.tm_wday]},"%b":function(g){return it[g.tm_mon].substring(0,3)},"%B":function(g){return it[g.tm_mon]},"%C":function(g){var E=g.tm_year+1900;return pt(E/100|0,2)},"%d":function(g){return pt(g.tm_mday,2)},"%e":function(g){return Te(g.tm_mday,2," ")},"%g":function(g){return Le(g).toString().substring(2)},"%G":function(g){return Le(g)},"%H":function(g){return pt(g.tm_hour,2)},"%I":function(g){var E=g.tm_hour;return E==0?E=12:E>12&&(E-=12),pt(E,2)},"%j":function(g){return pt(g.tm_mday+xf(es(g.tm_year+1900)?Bc:Tc,g.tm_mon-1),3)},"%m":function(g){return pt(g.tm_mon+1,2)},"%M":function(g){return pt(g.tm_min,2)},"%n":function(){return`
11
+ `},"%p":function(g){return g.tm_hour>=0&&g.tm_hour<12?"AM":"PM"},"%S":function(g){return pt(g.tm_sec,2)},"%t":function(){return" "},"%u":function(g){return g.tm_wday||7},"%U":function(g){var E=g.tm_yday+7-g.tm_wday;return pt(Math.floor(E/7),2)},"%V":function(g){var E=Math.floor((g.tm_yday+7-(g.tm_wday+6)%7)/7);if((g.tm_wday+371-g.tm_yday-2)%7<=2&&E++,E){if(E==53){var Wt=(g.tm_wday+371-g.tm_yday)%7;Wt!=4&&(Wt!=3||!es(g.tm_year))&&(E=1)}}else{E=52;var bt=(g.tm_wday+7-g.tm_yday-1)%7;(bt==4||bt==5&&es(g.tm_year%400-1))&&E++}return pt(E,2)},"%w":function(g){return g.tm_wday},"%W":function(g){var E=g.tm_yday+7-(g.tm_wday+6)%7;return pt(Math.floor(E/7),2)},"%y":function(g){return(g.tm_year+1900).toString().substring(2)},"%Y":function(g){return g.tm_year+1900},"%z":function(g){var E=g.tm_gmtoff,bt=E>=0;return E=Math.abs(E)/60,E=E/60*100+E%60,(bt?"+":"-")+String("0000"+E).slice(-4)},"%Z":function(g){return g.tm_zone},"%%":function(){return"%"}};v=v.replace(/%%/g,"\0\0");for(var x in tr)v.includes(x)&&(v=v.replace(new RegExp(x,"g"),tr[x](A)));v=v.replace(/\0\0/g,"%");var oi=Ef(v,!1);return oi.length>u?0:(cc(oi,l),oi.length-1)}function Df(l,u,h,m){return Tf(l,u,h,m)}function Ef(l,u,h){var m=h>0?h:qu(l)+1,y=new Array(m),A=ac(l,y,0,y.length);return u&&(y.length=A),y}var Of={a:yd,P:bd,R:wd,Q:vd,J:Sd,b:Id,$:Ad,u:Fd,X:xd,L:Bd,O:Td,ba:Dd,Y:Ed,aa:Od,Z:Md,o:Rd,M:Ud,H:Nd,m:kd,N:Ld,k:Cd,_:Pd,n:Vd,T:Hd,V:zd,U:jd,da:Wd,ca:Yd,d:Xd,B:Gd,C:Kd,z:Jd,A:qd,i:Zd,x:Qd,E:tf,y:ef,F:rf,f:nf,D:sf,j:of,w:af,g:cf,G:lf,ea:xc,S:qo,fa:uf,ga:ff,q:pf,r:mf,c:_f,t:yf,s:bf,h:gf,v:wf,I:vf,e:Sf,l:If,W:ts,K:Ff,p:Df},A_=md(),Mf=e.___wasm_call_ctors=function(){return(Mf=e.___wasm_call_ctors=e.asm.ia).apply(null,arguments)},Rf=e._main=function(){return(Rf=e._main=e.asm.ja).apply(null,arguments)},Uf=e._duckdb_web_fs_glob_add_path=function(){return(Uf=e._duckdb_web_fs_glob_add_path=e.asm.ka).apply(null,arguments)},Nf=e._duckdb_web_clear_response=function(){return(Nf=e._duckdb_web_clear_response=e.asm.la).apply(null,arguments)},kf=e._duckdb_web_fail_with=function(){return(kf=e._duckdb_web_fail_with=e.asm.ma).apply(null,arguments)},Lf=e._duckdb_web_reset=function(){return(Lf=e._duckdb_web_reset=e.asm.na).apply(null,arguments)},Cf=e._duckdb_web_connect=function(){return(Cf=e._duckdb_web_connect=e.asm.oa).apply(null,arguments)},Pf=e._duckdb_web_disconnect=function(){return(Pf=e._duckdb_web_disconnect=e.asm.pa).apply(null,arguments)},Vf=e._duckdb_web_flush_files=function(){return(Vf=e._duckdb_web_flush_files=e.asm.qa).apply(null,arguments)},Hf=e._duckdb_web_flush_file=function(){return(Hf=e._duckdb_web_flush_file=e.asm.ra).apply(null,arguments)},zf=e._duckdb_web_open=function(){return(zf=e._duckdb_web_open=e.asm.sa).apply(null,arguments)},jf=e._duckdb_web_get_global_file_info=function(){return(jf=e._duckdb_web_get_global_file_info=e.asm.ta).apply(null,arguments)},Wf=e._duckdb_web_collect_file_stats=function(){return(Wf=e._duckdb_web_collect_file_stats=e.asm.ua).apply(null,arguments)},$f=e._duckdb_web_export_file_stats=function(){return($f=e._duckdb_web_export_file_stats=e.asm.va).apply(null,arguments)},Yf=e._duckdb_web_fs_drop_file=function(){return(Yf=e._duckdb_web_fs_drop_file=e.asm.wa).apply(null,arguments)},Xf=e._duckdb_web_fs_drop_files=function(){return(Xf=e._duckdb_web_fs_drop_files=e.asm.xa).apply(null,arguments)},Gf=e._duckdb_web_fs_glob_file_infos=function(){return(Gf=e._duckdb_web_fs_glob_file_infos=e.asm.ya).apply(null,arguments)},Kf=e._duckdb_web_fs_get_file_info_by_id=function(){return(Kf=e._duckdb_web_fs_get_file_info_by_id=e.asm.za).apply(null,arguments)},Jf=e._duckdb_web_fs_get_file_info_by_name=function(){return(Jf=e._duckdb_web_fs_get_file_info_by_name=e.asm.Aa).apply(null,arguments)},qf=e._duckdb_web_fs_set_file_descriptor=function(){return(qf=e._duckdb_web_fs_set_file_descriptor=e.asm.Ba).apply(null,arguments)},Zf=e._duckdb_web_fs_register_file_url=function(){return(Zf=e._duckdb_web_fs_register_file_url=e.asm.Ca).apply(null,arguments)},Qf=e._duckdb_web_fs_register_file_buffer=function(){return(Qf=e._duckdb_web_fs_register_file_buffer=e.asm.Da).apply(null,arguments)},th=e._duckdb_web_copy_file_to_buffer=function(){return(th=e._duckdb_web_copy_file_to_buffer=e.asm.Ea).apply(null,arguments)},eh=e._duckdb_web_copy_file_to_path=function(){return(eh=e._duckdb_web_copy_file_to_path=e.asm.Fa).apply(null,arguments)},rh=e._duckdb_web_get_version=function(){return(rh=e._duckdb_web_get_version=e.asm.Ga).apply(null,arguments)},nh=e._duckdb_web_get_feature_flags=function(){return(nh=e._duckdb_web_get_feature_flags=e.asm.Ha).apply(null,arguments)},ih=e._duckdb_web_tokenize=function(){return(ih=e._duckdb_web_tokenize=e.asm.Ia).apply(null,arguments)},sh=e._duckdb_web_udf_scalar_create=function(){return(sh=e._duckdb_web_udf_scalar_create=e.asm.Ja).apply(null,arguments)},oh=e._duckdb_web_prepared_create=function(){return(oh=e._duckdb_web_prepared_create=e.asm.Ka).apply(null,arguments)},ah=e._duckdb_web_prepared_close=function(){return(ah=e._duckdb_web_prepared_close=e.asm.La).apply(null,arguments)},ch=e._duckdb_web_prepared_run=function(){return(ch=e._duckdb_web_prepared_run=e.asm.Ma).apply(null,arguments)},lh=e._duckdb_web_prepared_send=function(){return(lh=e._duckdb_web_prepared_send=e.asm.Na).apply(null,arguments)},uh=e._duckdb_web_query_run=function(){return(uh=e._duckdb_web_query_run=e.asm.Oa).apply(null,arguments)},dh=e._duckdb_web_pending_query_start=function(){return(dh=e._duckdb_web_pending_query_start=e.asm.Pa).apply(null,arguments)},fh=e._duckdb_web_pending_query_poll=function(){return(fh=e._duckdb_web_pending_query_poll=e.asm.Qa).apply(null,arguments)},hh=e._duckdb_web_pending_query_cancel=function(){return(hh=e._duckdb_web_pending_query_cancel=e.asm.Ra).apply(null,arguments)},ph=e._duckdb_web_query_fetch_results=function(){return(ph=e._duckdb_web_query_fetch_results=e.asm.Sa).apply(null,arguments)},mh=e._duckdb_web_get_tablenames=function(){return(mh=e._duckdb_web_get_tablenames=e.asm.Ta).apply(null,arguments)},_h=e._duckdb_web_insert_arrow_from_ipc_stream=function(){return(_h=e._duckdb_web_insert_arrow_from_ipc_stream=e.asm.Ua).apply(null,arguments)},yh=e._duckdb_web_insert_csv_from_path=function(){return(yh=e._duckdb_web_insert_csv_from_path=e.asm.Va).apply(null,arguments)},bh=e._duckdb_web_insert_json_from_path=function(){return(bh=e._duckdb_web_insert_json_from_path=e.asm.Wa).apply(null,arguments)},rs=e._htonl=function(){return(rs=e._htonl=e.asm.Xa).apply(null,arguments)},ns=e._htons=function(){return(ns=e._htons=e.asm.Ya).apply(null,arguments)},Qo=e._ntohs=function(){return(Qo=e._ntohs=e.asm.Za).apply(null,arguments)},ta=e._malloc=function(){return(ta=e._malloc=e.asm._a).apply(null,arguments)},gh=e._free=function(){return(gh=e._free=e.asm.$a).apply(null,arguments)},Dc=e.stackSave=function(){return(Dc=e.stackSave=e.asm.ab).apply(null,arguments)},Ec=e.stackRestore=function(){return(Ec=e.stackRestore=e.asm.bb).apply(null,arguments)},ea=e.stackAlloc=function(){return(ea=e.stackAlloc=e.asm.cb).apply(null,arguments)};e.ccall=at;var is;function ss(l){this.name="ExitStatus",this.message="Program terminated with exit("+l+")",this.status=l}var wh=!1;ni=function l(){is||ra(),is||(ni=l)};function vh(l){var u=e._main,h=0,m=0;try{var y=u(h,m);return Sh(y,!0),y}catch(A){return _d(A)}finally{wh=!0}}function ra(l){if(l=l||o,an>0||(id(),an>0))return;function u(){is||(is=!0,e.calledRun=!0,!te&&(sd(),od(),n(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),Oc&&vh(l),ad()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),u()},1)):u()}e.run=ra;function Sh(l,u){Vt=l,Ih(l)}function Ih(l){Vt=l,_c()||(e.onExit&&e.onExit(l),te=!0),c(l,new ss(l))}if(e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();var Oc=!0;return e.noInitialRun&&(Oc=!1),ra(),t.ready}})(),zu=h_;var Co=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 It(n)}async send(t){let e=this._bindings.startPendingQuery(this._conn,t);for(;e==null;)e=await new Promise((s,o)=>{try{s(this._bindings.pollPendingQuery(this._conn))}catch(a){o(a)}});let n=new Po(this._bindings,this._conn,e),i=xt.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}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 rc(this._bindings,this._conn,e)}createScalarFunction(t,e,n){this._bindings.createScalarFunction(this._conn,t,e,n)}insertArrowTable(t,e){let n=new yr;n.writeAll(t);let i=n.toUint8Array(!0);this.insertArrowFromIPCStream(i,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)}},Po=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=this.bindings.fetchQueryResults(this.conn);return this._depleted=t.length==0,{done:this._depleted,value:t}}[Symbol.iterator](){return this}},rc=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 It(n)}send(...t){let e=this.bindings.sendPrepared(this.connectionId,this.statementId,t),n=new Po(this.bindings,this.connectionId,e),i=xt.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};var $u=new TextEncoder,ju=new TextDecoder("utf-8");function nc(r,t,e){let n=$u.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 sc(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 ic(r,t,e,n){let i=r.HEAPU8.subarray(t,t+n*sc(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 Wu(r,t,e){let n=r.HEAPU8.subarray(t,t+e);return new Uint8Array(n.buffer,n.byteOffset,e)}function Vo(r,t,e){let n=r.HEAPU8.subarray(t,t+e*8);return new Float64Array(n.buffer,n.byteOffset,e)}function Yu(r,t,e,n,i,s,o,a){try{let c=r._udfFunctions.get(n);if(!c){nc(t,e,"Unknown UDF with id: "+n);return}let d=ju.decode(t.HEAPU8.subarray(i,i+s)),p=JSON.parse(d),b=Vo(t,o,a/8),_=Z=>{var te;let Rt=null;switch(Z.validityBuffer!==void 0&&(Rt=Wu(t,b[Z.validityBuffer],p.rows)),Z.physicalType){case"VARCHAR":{if(Z.dataBuffer===null||Z.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(Z.lengthBuffer===null||Z.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let Vt=ic(t,b[Z.dataBuffer],Z.physicalType,p.rows),Ht=[],zt=Vo(t,b[Z.lengthBuffer],p.rows);for(let at=0;at<p.rows;++at){if(Rt!=null&&!Rt[at]){Ht.push(null);continue}let oe=t.HEAPU8.subarray(Vt[at],Vt[at]+zt[at]),on=ju.decode(oe);Ht.push(on)}return at=>Ht[at]}case"STRUCT":{let Vt={},Ht=[];for(let zt=0;zt<(((te=Z.children)==null?void 0:te.length)||0);++zt){let at=Z.children[zt],oe=_(at);Ht.push(on=>{Vt[at.name]=oe(on)})}return Rt!=null?zt=>{if(!Rt[zt])return null;for(let at of Ht)at(zt);return Vt}:zt=>{for(let at of Ht)at(zt);return Vt}}default:{if(Z.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+Z.physicalType);let Vt=ic(t,b[Z.dataBuffer],Z.physicalType,p.rows);return Rt!=null?Ht=>Rt[Ht]?Vt[Ht]:null:Ht=>Vt[Ht]}}},S=[];for(let Z=0;Z<p.args.length;++Z)S.push(_(p.args[Z]));let J=p.rows*sc(p.ret.physicalType),q=t._malloc(J),ot=ic(t,q,p.ret.physicalType,p.rows),St=t._malloc(p.rows),Qt=Wu(t,St,p.rows);if(ot.length==0||Qt.length==0){nc(t,e,"Can't create physical arrays for result");return}let se=ot;p.ret.physicalType=="VARCHAR"&&(se=new Array(p.rows));let Lr=[];for(let Z=0;Z<p.args.length;++Z)Lr.push(null);for(let Z=0;Z<p.rows;++Z){for(let te=0;te<p.args.length;++te)Lr[te]=S[te](Z);let Rt=c.func(...Lr);se[Z]=Rt,Qt[Z]=Rt==null?0:1}let sn=0;switch(p.ret.physicalType){case"VARCHAR":{let Z=new Array(0);sn=t._malloc(p.rows*sc("DOUBLE"));let Rt=Vo(t,sn,p.rows),te=0;for(let at=0;at<p.rows;++at){let oe=$u.encode(se[at]||"");Z.push(oe),Rt[at]=oe.length,te+=oe.length}let Vt=t._malloc(te),Ht=t.HEAPU8.subarray(Vt,Vt+te),zt=0;for(let at=0;at<p.rows;++at){ot[at]=zt;let oe=Z[at];Ht.subarray(zt,zt+oe.length).set(oe),zt+=oe.length}}}let $o=3*8,Fe=t._malloc($o),gr=Vo(t,Fe,3);gr[0]=q,gr[1]=St,gr[2]=sn,t.HEAPF64[(e>>3)+0]=0,t.HEAPF64[(e>>3)+1]=Fe,t.HEAPF64[(e>>3)+2]=0}catch(c){nc(t,e,c.toString())}}function m_(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}var __=m_();function br(r,t){r.ccall("duckdb_web_fail_with",null,["string"],[t])}function An(r,t,e){let n=r.HEAPU8.subarray(t,t+e),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function z(r,t,e){return __(r.HEAPU8.subarray(t,t+e))}function nt(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 ht(r){r.ccall("duckdb_web_clear_response",null,[],[])}var Ho=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 y_=new TextEncoder;var zo=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),this)}open(t){let[e,n,i]=nt(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(e!==0)throw new Error(z(this.mod,n,i));ht(this.mod)}reset(){let[t,e,n]=nt(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(z(this.mod,e,n));ht(this.mod)}getVersion(){let[t,e,n]=nt(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(z(this.mod,e,n));let i=z(this.mod,e,n);return ht(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let[e,n,i]=nt(this.mod,"duckdb_web_tokenize",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));let s=z(this.mod,n,i);return ht(this.mod),JSON.parse(s)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new Co(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,i,s]=nt(this.mod,"duckdb_web_query_run",["number","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));let o=An(this.mod,i,s);return ht(this.mod),o}startPendingQuery(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_pending_query_start",["number","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));if(i==0)return null;let o=An(this.mod,i,s);return ht(this.mod),o}pollPendingQuery(t){let[e,n,i]=nt(this.mod,"duckdb_web_pending_query_poll",["number"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));if(n==0)return null;let s=An(this.mod,n,i);return ht(this.mod),s}cancelPendingQuery(t){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[t])}fetchQueryResults(t){let[e,n,i]=nt(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));let s=An(this.mod,n,i);return ht(this.mod),s}getTableNames(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_get_tablenames",["number","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));let o=z(this.mod,i,s);return ht(this.mod),JSON.parse(o)}createScalarFunction(t,e,n,i){let s={functionId:this._nextUDFId,name:e,returnType:ti(n)},o={functionId:s.functionId,connectionId:t,name:e,returnType:n,func:i};this._nextUDFId+=1;let[a,c,d]=nt(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(s)]);if(a!==0)throw new Error(z(this.mod,c,d));if(ht(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,i,s]=nt(this.mod,"duckdb_web_prepared_create",["number","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));return ht(this.mod),i}closePrepared(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_prepared_close",["number","number"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));ht(this.mod)}runPrepared(t,e,n){let[i,s,o]=nt(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(z(this.mod,s,o));let a=An(this.mod,s,o);return ht(this.mod),a}sendPrepared(t,e,n){let[i,s,o]=nt(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(z(this.mod,s,o));let a=An(this.mod,s,o);return ht(this.mod),a}insertArrowFromIPCStream(t,e,n){if(e.length==0)return;let i=this.mod._malloc(e.length);this.mod.HEAPU8.subarray(i,i+e.length).set(e);let o=n?JSON.stringify(n):"",[a,c,d]=nt(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,i,e.length,o]);if(a!==0)throw new Error(z(this.mod,c,d))}insertCSVFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let d in n.columns)n.columnsFlat.push(ko(d,n.columns[d]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,c]=nt(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(z(this.mod,a,c))}insertJSONFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let d in n.columns)n.columnsFlat.push(ko(d,n.columns[d]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,c]=nt(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(z(this.mod,a,c))}globFiles(t){let[e,n,i]=nt(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));let s=z(this.mod,n,i);ht(this.mod);let o=JSON.parse(s);return o==null?[]:o}registerFileURL(t,e){e===void 0&&(e=t);let[n,i,s]=nt(this.mod,"duckdb_web_fs_register_file_url",["string","string","number"],[t,e,-1]);if(n!==0)throw new Error(z(this.mod,i,s));ht(this.mod)}registerFileText(t,e){let n=y_.encode(e);this.registerFileBuffer(t,n)}registerFileBuffer(t,e){let n=this.mod._malloc(e.length);this.mod.HEAPU8.subarray(n,n+e.length).set(e);let[s,o,a]=nt(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,n,e.length]);if(s!==0)throw new Error(z(this.mod,o,a));ht(this.mod)}registerFileHandle(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_fs_register_file_url",["string","string","number"],[t,t,-1]);if(n!==0)throw new Error(z(this.mod,i,s));if(ht(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,e),this.pthread){for(let o of this.pthread.runningWorkers)o.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:e});for(let o of this.pthread.unusedWorkers)o.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[e,n,i]=nt(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));ht(this.mod)}dropFiles(){let[t,e,n]=nt(this.mod,"duckdb_web_fs_drop_files",[],[]);if(t!==0)throw new Error(z(this.mod,e,n));ht(this.mod)}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));ht(this.mod)}copyFileToBuffer(t){let[e,n,i]=nt(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));let s=this.mod.HEAPU8.subarray(n,n+i),o=new Uint8Array(s.length);return o.set(s),ht(this.mod),o}collectFileStatistics(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s))}exportFileStatistics(t){let[e,n,i]=nt(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));return new Ho(this.mod.HEAPU8.subarray(n,n+i))}};var jo=class extends zo{constructor(e,n,i,s){super(e,n);this.mainModuleURL=i,this.pthreadWorkerURL=s}locateFile(e,n){if(e.endsWith(".wasm"))return this.mainModuleURL;if(e.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=${n} path=${e}`)}instantiateWasm(e,n){globalThis.DUCKDB_RUNTIME=this._runtime;let i=this.onInstantiationProgress;if(WebAssembly.instantiateStreaming)if(typeof TransformStream=="function"){let o=(async()=>{var q;let a=new Request(this.mainModuleURL),c=await fetch(a),d=c.headers.get("content-length"),p=d&&parseInt(d,10)||0,b=new Date,_={startedAt:b,updatedAt:b,bytesTotal:p||0,bytesLoaded:0},S={transform(ot,St){_.bytesLoaded+=ot.byteLength;let Qt=new Date;if(Qt.getTime()-_.updatedAt.getTime()<20){_.updatedAt=Qt,St.enqueue(ot);return}for(let se of i)se(_);St.enqueue(ot)}},J=new TransformStream(S);return new Response((q=c.body)==null?void 0:q.pipeThrough(J),c)})();WebAssembly.instantiateStreaming(o,e).then(a=>{n(a.instance,a.module)})}else{console.warn("instantiating without progress handler since transform streams are unavailable");let s=new Request(this.mainModuleURL);WebAssembly.instantiateStreaming(fetch(s),e).then(o=>{n(o.instance,o.module)})}else if(typeof XMLHttpRequest=="function"){let s=new XMLHttpRequest,o=this.mainModuleURL,a=new Date,c={startedAt:a,updatedAt:a,bytesTotal:0,bytesLoaded:0};s.open("GET",o),s.responseType="arraybuffer",s.onerror=d=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+d}),new Error(d.toString())},s.onprogress=d=>{c.bytesTotal=d.total,c.bytesLoaded=d.loaded;let p=new Date;if(p.getTime()-c.updatedAt.getTime()<20){c.updatedAt=p;return}for(let b of i)b(c)},s.onload=()=>{WebAssembly.instantiate(s.response,e).then(d=>{n(d.instance,d.module)}).catch(d=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+d}),new Error(d)})},s.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let o=new Request(this.mainModuleURL),c=await(await fetch(o)).arrayBuffer();WebAssembly.instantiate(c,e).then(d=>{n(d.instance,d.module)})})();return[]}};var Wo=class extends jo{constructor(t,e,n,i=null){super(t,e,n,i)}instantiateImpl(t){return zu({...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};var en=Rc(Xu()),Gu=function(r,t,e){var n;if((n=r==null?void 0:r.endpoint)!=null&&n.startsWith("http")){let i=`${r==null?void 0:r.endpoint}`,s=i.indexOf("://")+3;return i.substring(s)}else return r!=null&&r.endpoint?`${e}.${r==null?void 0:r.endpoint}`:`${e}.s3.amazonaws.com`};function b_(r,t,e){var i,s,o,a;let n=Ku(t);return{url:n.path,query:"",host:Gu(r,t,n.bucket),region:(i=r==null?void 0:r.region)!=null?i:"",service:"s3",method:e,accessKeyId:(s=r==null?void 0:r.accessKeyId)!=null?s:"",secretAccessKey:(o=r==null?void 0:r.secretAccessKey)!=null?o:"",sessionToken:(a=r==null?void 0:r.sessionToken)!=null?a:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function g_(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 w_(r,t=null){var J;let e=(J=t==null?void 0:t.contentHash)!=null?J:"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+`
12
+ `+g_(r.url)+`
13
13
  `+r.query;t!=null&&t.contentType&&(s+=`
14
14
  content-type:`+(t==null?void 0:t.contentType)),s+=`
15
15
  host:`+r.host+`
@@ -21,7 +21,7 @@ x-amz-security-token:`+r.sessionToken),s+=`
21
21
  `+e;let o=(0,en.sha256)(s),a=`AWS4-HMAC-SHA256
22
22
  `+r.datetimeNow+`
23
23
  `+r.dateNow+"/"+r.region+"/"+r.service+`/aws4_request
24
- `+o,c="AWS4"+r.secretAccessKey,d=en.sha256.hmac.arrayBuffer(c,r.dateNow),p=en.sha256.hmac.arrayBuffer(d,r.region),b=en.sha256.hmac.arrayBuffer(p,r.service),y=en.sha256.hmac.arrayBuffer(b,"aws4_request"),S=en.sha256.hmac(y,a);return n.set("Authorization","AWS4-HMAC-SHA256 Credential="+r.accessKeyId+"/"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request, SignedHeaders="+i+", Signature="+S),n}var gy=function(r,t,e,n=null,i=null){let s=yy(r,t,e),o={contentType:n,contentHash:i?en.sha256.hex(i):null};return by(s,o)};function rn(r,t,e,n,i=null,s=null){((t==null?void 0:t.accessKeyId)||(t==null?void 0:t.sessionToken))&&(gy(t,e,n,i,s).forEach((a,c)=>{r.setRequestHeader(c,a)}),i&&r.setRequestHeader("content-type",i))}function Ku(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 nn(r,t){var n;let e=Ku(t);return(n=r==null?void 0:r.endpoint)!=null&&n.startsWith("http")?`${r==null?void 0:r.endpoint}/${e.bucket}`+e.path:"https://"+Gu(r,t,e.bucket)+e.path}var lt={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,getFileInfo(r,t){try{let e=lt._fileInfoCache.get(t),[n,i,s]=nt(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=j(r,i,s);_t(r);let a=JSON.parse(o);if(a==null)return null;let c={...a,blob:null};return lt._fileInfoCache.set(t,c),c}catch(e){return null}},getGlobalFileInfo(r){var t;try{let[e,n,i]=nt(r,"duckdb_web_get_global_file_info",["number"],[((t=lt._globalFileInfo)==null?void 0:t.cacheEpoch)||0]);if(e!==0)return null;if(i===0)return lt._globalFileInfo;let s=j(r,n,i);_t(r);let o=JSON.parse(s);return o==null?null:(lt._globalFileInfo={...o,blob:null},lt._globalFileInfo)}catch(e){return null}},testPlatformFeature:(r,t)=>{switch(t){case 1:return typeof BigInt64Array<"u";default:return console.warn(`test for unknown feature: ${t}`),!1}},openFile:(r,t,e)=>{var n;try{lt._fileInfoCache.delete(t);let i=lt.getFileInfo(r,t);switch(i==null?void 0:i.dataProtocol){case 3:case 4:{if(e&1&&e&2)throw new Error(`Opening file ${i.fileName} failed: cannot open file with both read and write flags set`);if(e&32)throw new Error(`Opening file ${i.fileName} failed: appending to HTTP/S3 files is not supported`);if(e&2){let o=new XMLHttpRequest;if(i.dataProtocol==4?(o.open("HEAD",nn(i.s3Config,i.dataUrl),!1),rn(o,i.s3Config,i.dataUrl,"HEAD")):o.open("HEAD",i.dataUrl,!1),o.send(null),o.status!=200&&o.status!=404)throw new Error(`Opening file ${i.fileName} failed: Unexpected return status from server (${o.status})`);if(o.status==404&&!(e&8||e&16))throw new Error(`Opening file ${i.fileName} failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag.`);let a=r._malloc(1),c=new Uint8Array;r.HEAPU8.set(c,a);let d=r._malloc(2*8);return r.HEAPF64[(d>>3)+0]=1,r.HEAPF64[(d>>3)+1]=a,d}else if(e!=1)throw new Error(`Opening file ${i.fileName} failed: unsupported file flags: ${e}`);let s=null;try{let o=new XMLHttpRequest;i.dataProtocol==4?(o.open("HEAD",nn(i.s3Config,i.dataUrl),!1),rn(o,i.s3Config,i.dataUrl,"HEAD")):o.open("HEAD",i.dataUrl,!1),o.setRequestHeader("Range","bytes=0-"),o.send(null);let a=o.getResponseHeader("Content-Length");if(o.status==206&&a!==null){let c=r._malloc(16);return r.HEAPF64[(c>>3)+0]=+a,r.HEAPF64[(c>>3)+1]=0,c}}catch(o){s=o,console.warn(`HEAD request with range header failed: ${o}`)}if(i.allowFullHttpReads){console.warn(`falling back to full HTTP read for: ${i.dataUrl}`);let o=new XMLHttpRequest;if(i.dataProtocol==4?(o.open("GET",nn(i.s3Config,i.dataUrl),!1),rn(o,i.s3Config,i.dataUrl,"GET")):o.open("GET",i.dataUrl,!1),o.responseType="arraybuffer",o.send(null),o.status==200){let a=r._malloc(o.response.byteLength),c=new Uint8Array(o.response,0,o.response.byteLength);r.HEAPU8.set(c,a);let d=r._malloc(2*8);return r.HEAPF64[(d>>3)+0]=o.response.byteLength,r.HEAPF64[(d>>3)+1]=a,d}}if(s!=null)throw new Error(`Reading file ${i.fileName} failed with error: ${s}`);return 0}case 1:{let s=(n=lt._files)==null?void 0:n.get(i.fileName);if(s){let c=r._malloc(16);return r.HEAPF64[(c>>3)+0]=s.size,r.HEAPF64[(c>>3)+1]=0,c}console.warn(`Buffering missing file: ${i.fileName}`);let o=r._malloc(2*8),a=r._malloc(1);return r.HEAPF64[(o>>3)+0]=1,r.HEAPF64[(o>>3)+1]=a,o}}}catch(i){console.error(i.toString()),br(r,i.toString())}return 0},glob:(r,t,e)=>{try{let n=j(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=lt.getGlobalFileInfo(r);i.open("HEAD",nn(s==null?void 0:s.s3Config,n),!1),rn(i,s==null?void 0:s.s3Config,n,"HEAD")}else i.open("HEAD",n,!1);if(i.send(null),i.status!=200&&i.status!==206){br(r,`HEAD request failed: ${n}`);return}r.ccall("duckdb_web_fs_glob_add_path",null,["string"],[n])}}catch(n){return br(r,n.toString()),0}},checkFile:(r,t,e)=>{try{let n=j(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=lt.getGlobalFileInfo(r);i.open("HEAD",nn(s==null?void 0:s.s3Config,n),!1),rn(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}}catch(n){return!1}return!1},syncFile:(r,t)=>{},closeFile:(r,t)=>{let e=lt.getFileInfo(r,t);switch(lt._fileInfoCache.delete(t),e==null?void 0:e.dataProtocol){case 3:case 4:break;case 1:return}},truncateFile:(r,t,e)=>{let n=lt.getFileInfo(r,t);switch(n==null?void 0:n.dataProtocol){case 3:br(r,"Cannot truncate a http file");return;case 4:br(r,"Cannot truncate an s3 file");return;case 1:br(r,"truncateFile not implemented");return}return 0},readFile(r,t,e,n,i){var s;try{let o=lt.getFileInfo(r,t);switch(o==null?void 0:o.dataProtocol){case 3:case 4:{if(!o.dataUrl)throw new Error(`Missing data URL for file ${t}`);try{let a=new XMLHttpRequest;if(o.dataProtocol==4?(a.open("GET",nn(o==null?void 0:o.s3Config,o.dataUrl),!1),rn(a,o==null?void 0:o.s3Config,o.dataUrl,"GET")):a.open("GET",o.dataUrl,!1),a.responseType="arraybuffer",a.setRequestHeader("Range",`bytes=${i}-${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 throw a.status==200?new Error(`Range request for ${o.dataUrl} did not return a partial response: ${a.status} "${a.statusText}"`):new Error(`Range request for ${o.dataUrl} did returned non-success status: ${a.status} "${a.statusText}"`)}catch(a){throw new Error(`Range request for ${o.dataUrl} failed with error: ${a}"`)}}case 1:{let a=(s=lt._files)==null?void 0:s.get(o.fileName);if(!a)throw new Error(`No handle available for file: ${o.fileName}`);let c=a.slice(i,i+n),d=new Uint8Array(new FileReaderSync().readAsArrayBuffer(c));return r.HEAPU8.set(d,e),d.byteLength}}return 0}catch(o){return br(r,o.toString()),0}},writeFile:(r,t,e,n,i)=>{let s=lt.getFileInfo(r,t);switch(s==null?void 0:s.dataProtocol){case 3:return br(r,"Cannot write to HTTP file"),0;case 4:{let o=r.HEAPU8.subarray(e,e+n),a=new XMLHttpRequest;return a.open("PUT",nn(s==null?void 0:s.s3Config,s.dataUrl),!1),rn(a,s==null?void 0:s.s3Config,s.dataUrl,"PUT","",o),a.send(o),n}case 1:return br(r,"writefile not implemented"),0}return 0},getLastFileModificationTime:(r,t)=>{var n;let e=lt.getFileInfo(r,t);switch(e==null?void 0:e.dataProtocol){case 1:{if(!((n=lt._files)==null?void 0:n.get(e.fileName)))throw Error(`No handle available for file: ${e.fileName}`);return 0}case 3:case 4:return new Date().getTime()}return 0},checkDirectory:(r,t,e)=>{let n=j(r,t,e);return console.log(`checkDirectory: ${n}`),!1},createDirectory:(r,t,e)=>{let n=j(r,t,e);console.log(`createDirectory: ${n}`)},removeDirectory:(r,t,e)=>{let n=j(r,t,e);console.log(`removeDirectory: ${n}`)},listDirectoryEntries:(r,t,e)=>{let n=j(r,t,e);return console.log(`listDirectoryEntries: ${n}`),!1},moveFile:(r,t,e,n,i)=>{var c,d;let s=j(r,t,e),o=j(r,n,i),a=(c=lt._files)==null?void 0:c.get(s);a!==void 0&&(lt._files.delete(a),lt._files.set(o,a));for(let[p,b]of((d=lt._fileInfoCache)==null?void 0:d.entries())||[])if(b.dataUrl==s){lt._fileInfoCache.delete(p);break}return!0},removeFile:(r,t,e)=>{},callScalarUDF:(r,t,e,n,i,s,o)=>{Yu(lt,r,t,e,n,i,s,o)}};var oc=class extends Lo{postMessage(t,e){globalThis.postMessage(t,e)}async instantiate(t,e,n){return await new Wo(this,lt,t,e).instantiate(n)}};function Ju(){let r=new oc;globalThis.onmessage=async t=>{await r.onMessage(t.data)}}Ju();return Dh(wy);})();
24
+ `+o,c="AWS4"+r.secretAccessKey,d=en.sha256.hmac.arrayBuffer(c,r.dateNow),p=en.sha256.hmac.arrayBuffer(d,r.region),b=en.sha256.hmac.arrayBuffer(p,r.service),_=en.sha256.hmac.arrayBuffer(b,"aws4_request"),S=en.sha256.hmac(_,a);return n.set("Authorization","AWS4-HMAC-SHA256 Credential="+r.accessKeyId+"/"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request, SignedHeaders="+i+", Signature="+S),n}var v_=function(r,t,e,n=null,i=null){let s=b_(r,t,e),o={contentType:n,contentHash:i?en.sha256.hex(i):null};return w_(s,o)};function rn(r,t,e,n,i=null,s=null){((t==null?void 0:t.accessKeyId)||(t==null?void 0:t.sessionToken))&&(v_(t,e,n,i,s).forEach((a,c)=>{r.setRequestHeader(c,a)}),i&&r.setRequestHeader("content-type",i))}function Ku(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 nn(r,t){var n;let e=Ku(t);return(n=r==null?void 0:r.endpoint)!=null&&n.startsWith("http")?`${r==null?void 0:r.endpoint}/${e.bucket}`+e.path:"https://"+Gu(r,t,e.bucket)+e.path}var lt={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,getFileInfo(r,t){try{let e=lt._fileInfoCache.get(t),[n,i,s]=nt(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=z(r,i,s);ht(r);let a=JSON.parse(o);if(a==null)return null;let c={...a,blob:null};return lt._fileInfoCache.set(t,c),c}catch(e){return null}},getGlobalFileInfo(r){var t;try{let[e,n,i]=nt(r,"duckdb_web_get_global_file_info",["number"],[((t=lt._globalFileInfo)==null?void 0:t.cacheEpoch)||0]);if(e!==0)return null;if(i===0)return lt._globalFileInfo;let s=z(r,n,i);ht(r);let o=JSON.parse(s);return o==null?null:(lt._globalFileInfo={...o,blob:null},lt._globalFileInfo)}catch(e){return null}},testPlatformFeature:(r,t)=>{switch(t){case 1:return typeof BigInt64Array<"u";default:return console.warn(`test for unknown feature: ${t}`),!1}},openFile:(r,t,e)=>{var n;try{lt._fileInfoCache.delete(t);let i=lt.getFileInfo(r,t);switch(i==null?void 0:i.dataProtocol){case 3:case 4:{if(e&1&&e&2)throw new Error(`Opening file ${i.fileName} failed: cannot open file with both read and write flags set`);if(e&32)throw new Error(`Opening file ${i.fileName} failed: appending to HTTP/S3 files is not supported`);if(e&2){let o=new XMLHttpRequest;if(i.dataProtocol==4?(o.open("HEAD",nn(i.s3Config,i.dataUrl),!1),rn(o,i.s3Config,i.dataUrl,"HEAD")):o.open("HEAD",i.dataUrl,!1),o.send(null),o.status!=200&&o.status!=404)throw new Error(`Opening file ${i.fileName} failed: Unexpected return status from server (${o.status})`);if(o.status==404&&!(e&8||e&16))throw new Error(`Opening file ${i.fileName} failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag.`);let a=r._malloc(1),c=new Uint8Array;r.HEAPU8.set(c,a);let d=r._malloc(2*8);return r.HEAPF64[(d>>3)+0]=1,r.HEAPF64[(d>>3)+1]=a,d}else if(e!=1)throw new Error(`Opening file ${i.fileName} failed: unsupported file flags: ${e}`);let s=null;try{let o=new XMLHttpRequest;i.dataProtocol==4?(o.open("HEAD",nn(i.s3Config,i.dataUrl),!1),rn(o,i.s3Config,i.dataUrl,"HEAD")):o.open("HEAD",i.dataUrl,!1),o.setRequestHeader("Range","bytes=0-"),o.send(null);let a=o.getResponseHeader("Content-Length");if(o.status==206&&a!==null){let c=r._malloc(16);return r.HEAPF64[(c>>3)+0]=+a,r.HEAPF64[(c>>3)+1]=0,c}}catch(o){s=o,console.warn(`HEAD request with range header failed: ${o}`)}if(i.allowFullHttpReads){console.warn(`falling back to full HTTP read for: ${i.dataUrl}`);let o=new XMLHttpRequest;if(i.dataProtocol==4?(o.open("GET",nn(i.s3Config,i.dataUrl),!1),rn(o,i.s3Config,i.dataUrl,"GET")):o.open("GET",i.dataUrl,!1),o.responseType="arraybuffer",o.send(null),o.status==200){let a=r._malloc(o.response.byteLength),c=new Uint8Array(o.response,0,o.response.byteLength);r.HEAPU8.set(c,a);let d=r._malloc(2*8);return r.HEAPF64[(d>>3)+0]=o.response.byteLength,r.HEAPF64[(d>>3)+1]=a,d}}if(s!=null)throw new Error(`Reading file ${i.fileName} failed with error: ${s}`);return 0}case 1:{let s=(n=lt._files)==null?void 0:n.get(i.fileName);if(s){let c=r._malloc(16);return r.HEAPF64[(c>>3)+0]=s.size,r.HEAPF64[(c>>3)+1]=0,c}console.warn(`Buffering missing file: ${i.fileName}`);let o=r._malloc(2*8),a=r._malloc(1);return r.HEAPF64[(o>>3)+0]=1,r.HEAPF64[(o>>3)+1]=a,o}}}catch(i){console.error(i.toString()),br(r,i.toString())}return 0},glob:(r,t,e)=>{try{let n=z(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=lt.getGlobalFileInfo(r);i.open("HEAD",nn(s==null?void 0:s.s3Config,n),!1),rn(i,s==null?void 0:s.s3Config,n,"HEAD")}else i.open("HEAD",n,!1);if(i.send(null),i.status!=200&&i.status!==206){br(r,`HEAD request failed: ${n}`);return}r.ccall("duckdb_web_fs_glob_add_path",null,["string"],[n])}}catch(n){return br(r,n.toString()),0}},checkFile:(r,t,e)=>{try{let n=z(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=lt.getGlobalFileInfo(r);i.open("HEAD",nn(s==null?void 0:s.s3Config,n),!1),rn(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}}catch(n){return!1}return!1},syncFile:(r,t)=>{},closeFile:(r,t)=>{let e=lt.getFileInfo(r,t);switch(lt._fileInfoCache.delete(t),e==null?void 0:e.dataProtocol){case 3:case 4:break;case 1:return}},truncateFile:(r,t,e)=>{let n=lt.getFileInfo(r,t);switch(n==null?void 0:n.dataProtocol){case 3:br(r,"Cannot truncate a http file");return;case 4:br(r,"Cannot truncate an s3 file");return;case 1:br(r,"truncateFile not implemented");return}return 0},readFile(r,t,e,n,i){var s;try{let o=lt.getFileInfo(r,t);switch(o==null?void 0:o.dataProtocol){case 3:case 4:{if(!o.dataUrl)throw new Error(`Missing data URL for file ${t}`);try{let a=new XMLHttpRequest;if(o.dataProtocol==4?(a.open("GET",nn(o==null?void 0:o.s3Config,o.dataUrl),!1),rn(a,o==null?void 0:o.s3Config,o.dataUrl,"GET")):a.open("GET",o.dataUrl,!1),a.responseType="arraybuffer",a.setRequestHeader("Range",`bytes=${i}-${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 throw a.status==200?new Error(`Range request for ${o.dataUrl} did not return a partial response: ${a.status} "${a.statusText}"`):new Error(`Range request for ${o.dataUrl} did returned non-success status: ${a.status} "${a.statusText}"`)}catch(a){throw new Error(`Range request for ${o.dataUrl} failed with error: ${a}"`)}}case 1:{let a=(s=lt._files)==null?void 0:s.get(o.fileName);if(!a)throw new Error(`No handle available for file: ${o.fileName}`);let c=a.slice(i,i+n),d=new Uint8Array(new FileReaderSync().readAsArrayBuffer(c));return r.HEAPU8.set(d,e),d.byteLength}}return 0}catch(o){return br(r,o.toString()),0}},writeFile:(r,t,e,n,i)=>{let s=lt.getFileInfo(r,t);switch(s==null?void 0:s.dataProtocol){case 3:return br(r,"Cannot write to HTTP file"),0;case 4:{let o=r.HEAPU8.subarray(e,e+n),a=new XMLHttpRequest;return a.open("PUT",nn(s==null?void 0:s.s3Config,s.dataUrl),!1),rn(a,s==null?void 0:s.s3Config,s.dataUrl,"PUT","",o),a.send(o),n}case 1:return br(r,"writefile not implemented"),0}return 0},getLastFileModificationTime:(r,t)=>{var n;let e=lt.getFileInfo(r,t);switch(e==null?void 0:e.dataProtocol){case 1:{if(!((n=lt._files)==null?void 0:n.get(e.fileName)))throw Error(`No handle available for file: ${e.fileName}`);return 0}case 3:case 4:return new Date().getTime()}return 0},checkDirectory:(r,t,e)=>{let n=z(r,t,e);return console.log(`checkDirectory: ${n}`),!1},createDirectory:(r,t,e)=>{let n=z(r,t,e);console.log(`createDirectory: ${n}`)},removeDirectory:(r,t,e)=>{let n=z(r,t,e);console.log(`removeDirectory: ${n}`)},listDirectoryEntries:(r,t,e)=>{let n=z(r,t,e);return console.log(`listDirectoryEntries: ${n}`),!1},moveFile:(r,t,e,n,i)=>{var c,d;let s=z(r,t,e),o=z(r,n,i),a=(c=lt._files)==null?void 0:c.get(s);a!==void 0&&(lt._files.delete(a),lt._files.set(o,a));for(let[p,b]of((d=lt._fileInfoCache)==null?void 0:d.entries())||[])if(b.dataUrl==s){lt._fileInfoCache.delete(p);break}return!0},removeFile:(r,t,e)=>{},callScalarUDF:(r,t,e,n,i,s,o)=>{Yu(lt,r,t,e,n,i,s,o)}};var oc=class extends Lo{postMessage(t,e){globalThis.postMessage(t,e)}async instantiate(t,e,n){return await new Wo(this,lt,t,e).instantiate(n)}};function Ju(){let r=new oc;globalThis.onmessage=async t=>{await r.onMessage(t.data)}}Ju();return Oh(S_);})();
25
25
  /*! *****************************************************************************
26
26
  Copyright (c) Microsoft Corporation.
27
27