@duckdb/duckdb-wasm 1.20.0 → 1.21.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.
- package/dist/duckdb-browser-blocking.cjs +11 -11
- package/dist/duckdb-browser-blocking.cjs.map +3 -3
- package/dist/duckdb-browser-blocking.mjs +11 -11
- package/dist/duckdb-browser-blocking.mjs.map +3 -3
- package/dist/duckdb-browser-coi.pthread.worker.js +6 -6
- package/dist/duckdb-browser-coi.pthread.worker.js.map +3 -3
- package/dist/duckdb-browser-coi.worker.js +8 -8
- package/dist/duckdb-browser-coi.worker.js.map +3 -3
- package/dist/duckdb-browser-eh.worker.js +7 -7
- package/dist/duckdb-browser-eh.worker.js.map +3 -3
- package/dist/duckdb-browser-mvp.worker.js +8 -8
- package/dist/duckdb-browser-mvp.worker.js.map +3 -3
- package/dist/duckdb-browser.cjs +1 -1
- package/dist/duckdb-browser.cjs.map +2 -2
- package/dist/duckdb-browser.mjs +1 -1
- package/dist/duckdb-browser.mjs.map +2 -2
- package/dist/duckdb-coi.wasm +0 -0
- package/dist/duckdb-eh.wasm +0 -0
- package/dist/duckdb-mvp.wasm +0 -0
- package/dist/duckdb-node-blocking.cjs +4 -4
- package/dist/duckdb-node-blocking.cjs.map +3 -3
- package/dist/duckdb-node-eh.worker.cjs +4 -4
- package/dist/duckdb-node-eh.worker.cjs.map +3 -3
- package/dist/duckdb-node-mvp.worker.cjs +3 -3
- package/dist/duckdb-node-mvp.worker.cjs.map +3 -3
- package/dist/duckdb-node.cjs +1 -1
- package/dist/duckdb-node.cjs.map +3 -3
- package/dist/img/duckdb_version_badge.svg +1 -1
- package/dist/tests-browser.js +958 -825
- package/dist/tests-browser.js.map +2 -2
- package/dist/tests-node.cjs +959 -824
- package/dist/tests-node.cjs.map +2 -2
- package/package.json +12 -12
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";var duckdb=(()=>{var Up=Object.create;var ws=Object.defineProperty;var kp=Object.getOwnPropertyDescriptor;var Lp=Object.getOwnPropertyNames;var Np=Object.getPrototypeOf,Cp=Object.prototype.hasOwnProperty;var ba=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var un=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),dn=(r,t)=>{for(var e in t)ws(r,e,{get:t[e],enumerable:!0})},Jl=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Lp(t))!Cp.call(r,i)&&i!==e&&ws(r,i,{get:()=>t[i],enumerable:!(n=kp(t,i))||n.enumerable});return r};var ql=(r,t,e)=>(e=r!=null?Up(Np(r)):{},Jl(t||!r||!r.__esModule?ws(e,"default",{value:r,enumerable:!0}):e,r)),Pp=r=>Jl(ws({},"__esModule",{value:!0}),r);var gu=un((ky,Is)=>{var Zl,Ql,tu,eu,ru,nu,iu,su,ou,vs,ga,au,cu,lu,En,uu,du,fu,hu,pu,mu,_u,yu,bu,Ss;(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 Is=="object"&&typeof Is.exports=="object"?r(e(t,e(Is.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])};Zl=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)},Ql=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},tu=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},eu=function(n,i,s,o){var a=arguments.length,u=a<3?i:o===null?o=Object.getOwnPropertyDescriptor(i,s):o,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,i,s,o);else for(var m=n.length-1;m>=0;m--)(c=n[m])&&(u=(a<3?c(u):a>3?c(i,s,u):c(i,s))||u);return a>3&&u&&Object.defineProperty(i,s,u),u},ru=function(n,i){return function(s,o){i(s,o,n)}},nu=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},iu=function(n,i,s,o){function a(u){return u instanceof s?u:new s(function(c){c(u)})}return new(s||(s=Promise))(function(u,c){function m(I){try{b(o.next(I))}catch(Z){c(Z)}}function y(I){try{b(o.throw(I))}catch(Z){c(Z)}}function b(I){I.done?u(I.value):a(I.value).then(m,y)}b((o=o.apply(n,i||[])).next())})},su=function(n,i){var s={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,c;return c={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function m(b){return function(I){return y([b,I])}}function y(b){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,a&&(u=b[0]&2?a.return:b[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,b[1])).done)return u;switch(a=0,u&&(b=[b[0]&2,u.value]),b[0]){case 0:case 1:u=b;break;case 4:return s.label++,{value:b[1],done:!1};case 5:s.label++,a=b[1],b=[0];continue;case 7:b=s.ops.pop(),s.trys.pop();continue;default:if(u=s.trys,!(u=u.length>0&&u[u.length-1])&&(b[0]===6||b[0]===2)){s=0;continue}if(b[0]===3&&(!u||b[1]>u[0]&&b[1]<u[3])){s.label=b[1];break}if(b[0]===6&&s.label<u[1]){s.label=u[1],u=b;break}if(u&&s.label<u[2]){s.label=u[2],s.ops.push(b);break}u[2]&&s.ops.pop(),s.trys.pop();continue}b=i.call(n,s)}catch(I){b=[6,I],a=0}finally{o=u=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}},ou=function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&Ss(i,n,s)},Ss=Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]},vs=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.")},ga=function(n,i){var s=typeof Symbol=="function"&&n[Symbol.iterator];if(!s)return n;var o=s.call(n),a,u=[],c;try{for(;(i===void 0||i-- >0)&&!(a=o.next()).done;)u.push(a.value)}catch(m){c={error:m}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(c)throw c.error}}return u},au=function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(ga(arguments[i]));return n},cu=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 u=arguments[i],c=0,m=u.length;c<m;c++,a++)o[a]=u[c];return o},lu=function(n,i,s){if(s||arguments.length===2)for(var o=0,a=i.length,u;o<a;o++)(u||!(o in i))&&(u||(u=Array.prototype.slice.call(i,0,o)),u[o]=i[o]);return n.concat(u||Array.prototype.slice.call(i))},En=function(n){return this instanceof En?(this.v=n,this):new En(n)},uu=function(n,i,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=s.apply(n,i||[]),a,u=[];return a={},c("next"),c("throw"),c("return"),a[Symbol.asyncIterator]=function(){return this},a;function c(J){o[J]&&(a[J]=function(_t){return new Promise(function(ft,yt){u.push([J,_t,ft,yt])>1||m(J,_t)})})}function m(J,_t){try{y(o[J](_t))}catch(ft){Z(u[0][3],ft)}}function y(J){J.value instanceof En?Promise.resolve(J.value.v).then(b,I):Z(u[0][2],J)}function b(J){m("next",J)}function I(J){m("throw",J)}function Z(J,_t){J(_t),u.shift(),u.length&&m(u[0][0],u[0][1])}},du=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,u){i[a]=n[a]?function(c){return(s=!s)?{value:En(n[a](c)),done:a==="return"}:u?u(c):c}:u}},fu=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 vs=="function"?vs(n):n[Symbol.iterator](),s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s);function o(u){s[u]=n[u]&&function(c){return new Promise(function(m,y){c=n[u](c),a(m,y,c.done,c.value)})}}function a(u,c,m,y){Promise.resolve(y).then(function(b){u({value:b,done:m})},c)}},hu=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};pu=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)&&Ss(i,n,s);return e(i,n),i},mu=function(n){return n&&n.__esModule?n:{default:n}},_u=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)},yu=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},bu=function(n,i){if(i===null||typeof i!="object"&&typeof i!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?i===n:n.has(i)},r("__extends",Zl),r("__assign",Ql),r("__rest",tu),r("__decorate",eu),r("__param",ru),r("__metadata",nu),r("__awaiter",iu),r("__generator",su),r("__exportStar",ou),r("__createBinding",Ss),r("__values",vs),r("__read",ga),r("__spread",au),r("__spreadArrays",cu),r("__spreadArray",lu),r("__await",En),r("__asyncGenerator",uu),r("__asyncDelegator",du),r("__asyncValues",fu),r("__makeTemplateObject",hu),r("__importStar",pu),r("__importDefault",mu),r("__classPrivateFieldGet",_u),r("__classPrivateFieldSet",yu),r("__classPrivateFieldIn",bu)})});var yc=un(()=>{});var of=un(()=>{});var af=un(()=>{});var cf=un(()=>{});var lf=un(()=>{});var mf=un((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,u=this.blocks,c,m,y,b,I,Z,J,_t,ft,yt,F;for(c=16;c<64;++c)I=u[c-15],m=(I>>>7|I<<25)^(I>>>18|I<<14)^I>>>3,I=u[c-2],y=(I>>>17|I<<15)^(I>>>19|I<<13)^I>>>10,u[c]=u[c-16]+m+u[c-7]+y<<0;for(F=t&e,c=0;c<64;c+=4)this.first?(this.is224?(_t=300032,I=u[0]-1413257819,a=I-150054599<<0,n=I+24177077<<0):(_t=704751109,I=u[0]-210244248,a=I-1521486534<<0,n=I+143694565<<0),this.first=!1):(m=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),y=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),_t=r&t,b=_t^r&e^F,J=i&s^~i&o,I=a+y+J+K[c]+u[c],Z=m+b,a=n+I<<0,n=I+Z<<0),m=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),y=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),ft=n&r,b=ft^n&t^_t,J=a&i^~a&s,I=o+y+J+K[c+1]+u[c+1],Z=m+b,o=e+I<<0,e=I+Z<<0,m=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),y=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),yt=e&n,b=yt^e&r^ft,J=o&a^~o&i,I=s+y+J+K[c+2]+u[c+2],Z=m+b,s=t+I<<0,t=I+Z<<0,m=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),y=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),F=t&e,b=F^t&n^yt,J=s&o^~s&a,I=i+y+J+K[c+3]+u[c+3],Z=m+b,i=r+I<<0,r=I+Z<<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,u=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||(u+=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]),u},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,u=[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||u.push(a>>24&255,a>>16&255,a>>8&255,a&255),u},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,u;for(n=0;n<o;++n)u=r.charCodeAt(n),u<128?s[a++]=u:u<2048?(s[a++]=192|u>>6,s[a++]=128|u&63):u<55296||u>=57344?(s[a++]=224|u>>12,s[a++]=128|u>>6&63,s[a++]=128|u&63):(u=65536+((u&1023)<<10|r.charCodeAt(++n)&1023),s[a++]=240|u>>18,s[a++]=128|u>>12&63,s[a++]=128|u>>6&63,s[a++]=128|u&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 c=[],m=[];for(n=0;n<64;++n){var y=r[n]||0;c[n]=92^y,m[n]=54^y}Sha256.call(this,t,e),this.update(m),this.oKeyPad=c,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 Ey={};dn(Ey,{registerWorker:()=>bf});var wu=ql(gu(),1),{__extends:Ly,__assign:Ny,__rest:vu,__decorate:Cy,__param:Py,__metadata:Vy,__awaiter:A,__generator:Hy,__exportStar:zy,__createBinding:Wy,__values:jy,__read:$y,__spread:Yy,__spreadArrays:Xy,__spreadArray:Gy,__await:$,__asyncGenerator:pe,__asyncDelegator:On,__asyncValues:Ue,__makeTemplateObject:Ky,__importStar:Jy,__importDefault:qy,__classPrivateFieldGet:Zy,__classPrivateFieldSet:Qy,__classPrivateFieldIn:tb}=wu.default;var Fa={};dn(Fa,{compareArrayLike:()=>Aa,joinUint8Arrays:()=>Te,memcpy:()=>Mn,rebaseValueOffsets:()=>gi,toArrayBufferView:()=>Y,toArrayBufferViewAsyncIterator:()=>je,toArrayBufferViewIterator:()=>sr,toBigInt64Array:()=>Yp,toBigUint64Array:()=>Kp,toFloat32Array:()=>Jp,toFloat32ArrayAsyncIterator:()=>fm,toFloat32ArrayIterator:()=>im,toFloat64Array:()=>qp,toFloat64ArrayAsyncIterator:()=>hm,toFloat64ArrayIterator:()=>sm,toInt16Array:()=>$p,toInt16ArrayAsyncIterator:()=>cm,toInt16ArrayIterator:()=>tm,toInt32Array:()=>fn,toInt32ArrayAsyncIterator:()=>lm,toInt32ArrayIterator:()=>em,toInt8Array:()=>jp,toInt8ArrayAsyncIterator:()=>am,toInt8ArrayIterator:()=>Qp,toUint16Array:()=>Xp,toUint16ArrayAsyncIterator:()=>um,toUint16ArrayIterator:()=>rm,toUint32Array:()=>Gp,toUint32ArrayAsyncIterator:()=>dm,toUint32ArrayIterator:()=>nm,toUint8Array:()=>k,toUint8ArrayAsyncIterator:()=>Ia,toUint8ArrayIterator:()=>Sa,toUint8ClampedArray:()=>Zp,toUint8ClampedArrayAsyncIterator:()=>pm,toUint8ClampedArrayIterator:()=>om});var Vp=new TextDecoder("utf-8"),_i=r=>Vp.decode(r),Hp=new TextEncoder,jr=r=>Hp.encode(r);var[nb,As]=(()=>{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]})(),[yi,ib]=(()=>{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]})(),[Rn,sb]=(()=>{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 zp=r=>typeof r=="number",Su=r=>typeof r=="boolean",Ct=r=>typeof r=="function",ae=r=>r!=null&&Object(r)===r,ze=r=>ae(r)&&Ct(r.then);var We=r=>ae(r)&&Ct(r[Symbol.iterator]),ke=r=>ae(r)&&Ct(r[Symbol.asyncIterator]),Fs=r=>ae(r)&&ae(r.schema);var xs=r=>ae(r)&&"done"in r&&"value"in r;var Ts=r=>ae(r)&&Ct(r.stat)&&zp(r.fd);var Bs=r=>ae(r)&&bi(r.body),Ds=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Iu=r=>ae(r)&&Ct(r.abort)&&Ct(r.getWriter)&&!Ds(r),bi=r=>ae(r)&&Ct(r.cancel)&&Ct(r.getReader)&&!Ds(r),Au=r=>ae(r)&&Ct(r.end)&&Ct(r.write)&&Su(r.writable)&&!Ds(r),Es=r=>ae(r)&&Ct(r.read)&&Ct(r.pipe)&&Su(r.readable)&&!Ds(r),Fu=r=>ae(r)&&Ct(r.clear)&&Ct(r.bytes)&&Ct(r.position)&&Ct(r.setPosition)&&Ct(r.capacity)&&Ct(r.getBufferIdentifier)&&Ct(r.createLong);var va=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Wp(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,a,u=0,c=0,m=r.length;++u<m;){if(o=t[c],a=r[u],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++c]=a);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:n,byteLength:s}=a,e+i<n||n+s<e){a&&(t[++c]=a);continue}t[c]=new Uint8Array(o.buffer,e,n-e+s)}return t}function Mn(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 Te(r,t){let e=Wp(r),n=e.reduce((m,y)=>m+y.byteLength,0),i,s,o,a=0,u=-1,c=Math.min(t||Number.POSITIVE_INFINITY,n);for(let m=e.length;++u<m;){if(i=e[u],s=i.subarray(0,Math.min(i.length,c-a)),c<=a+s.length){s.length<i.length?e[u]=i.subarray(s.length):s.length===i.length&&u++,o?Mn(o,s,a):o=s;break}Mn(o||(o=new Uint8Array(c)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(u),n-(o?o.byteLength:0)]}function Y(r,t){let e=xs(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=jr(e)),e instanceof ArrayBuffer?new r(e):e instanceof va?new r(e):Fu(e)?Y(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 jp=r=>Y(Int8Array,r),$p=r=>Y(Int16Array,r),fn=r=>Y(Int32Array,r),Yp=r=>Y(yi,r),k=r=>Y(Uint8Array,r),Xp=r=>Y(Uint16Array,r),Gp=r=>Y(Uint32Array,r),Kp=r=>Y(Rn,r),Jp=r=>Y(Float32Array,r),qp=r=>Y(Float64Array,r),Zp=r=>Y(Uint8ClampedArray,r),wa=r=>(r.next(),r);function*sr(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof va?e(t):We(t)?t:e(t);return yield*wa(function*(i){let s=null;do s=i.next(yield Y(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}var Qp=r=>sr(Int8Array,r),tm=r=>sr(Int16Array,r),em=r=>sr(Int32Array,r),Sa=r=>sr(Uint8Array,r),rm=r=>sr(Uint16Array,r),nm=r=>sr(Uint32Array,r),im=r=>sr(Float32Array,r),sm=r=>sr(Float64Array,r),om=r=>sr(Uint8ClampedArray,r);function je(r,t){return pe(this,arguments,function*(){if(ze(t))return yield $(yield $(yield*On(Ue(je(r,yield $(t))))));let n=function(o){return pe(this,arguments,function*(){yield yield $(yield $(o))})},i=function(o){return pe(this,arguments,function*(){yield $(yield*On(Ue(wa(function*(a){let u=null;do u=a.next(yield u==null?void 0:u.value);while(!u.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof va?n(t):We(t)?i(t):ke(t)?t:n(t);return yield $(yield*On(Ue(wa(function(o){return pe(this,arguments,function*(){let a=null;do a=yield $(o.next(yield yield $(Y(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield $(new r)})}var am=r=>je(Int8Array,r),cm=r=>je(Int16Array,r),lm=r=>je(Int32Array,r),Ia=r=>je(Uint8Array,r),um=r=>je(Uint16Array,r),dm=r=>je(Uint32Array,r),fm=r=>je(Float32Array,r),hm=r=>je(Float64Array,r),pm=r=>je(Uint8ClampedArray,r);function gi(r,t,e){if(r!==0){e=e.slice(0,t+1);for(let n=-1;++n<=t;)e[n]+=r}return e}function Aa(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 Kt={fromIterable(r){return Os(mm(r))},fromAsyncIterable(r){return Os(_m(r))},fromDOMStream(r){return Os(ym(r))},fromNodeStream(r){return Os(bm(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')}},Os=r=>(r.next(),r);function*mm(r){let t,e=!1,n=[],i,s,o,a=0;function u(){return s==="peek"?Te(n,o)[0]:([i,n,a]=Te(n,o),i)}({cmd:s,size:o}=yield null);let c=Sa(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?c.next():c.next(o-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield u());while(o<a);while(!t)}catch(m){(e=!0)&&typeof c.throw=="function"&&c.throw(m)}finally{e===!1&&typeof c.return=="function"&&c.return(null)}return null}function _m(r){return pe(this,arguments,function*(){let e,n=!1,i=[],s,o,a,u=0;function c(){return o==="peek"?Te(i,a)[0]:([s,i,u]=Te(i,a),s)}({cmd:o,size:a}=yield yield $(null));let m=Ia(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-u)?yield $(m.next()):yield $(m.next(a-u)),!e&&s.byteLength>0&&(i.push(s),u+=s.byteLength),e||a<=u)do({cmd:o,size:a}=yield yield $(c()));while(a<u);while(!e)}catch(y){(n=!0)&&typeof m.throw=="function"&&(yield $(m.throw(y)))}finally{n===!1&&typeof m.return=="function"&&(yield $(m.return(new Uint8Array(0))))}return yield $(null)})}function ym(r){return pe(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,u=0;function c(){return o==="peek"?Te(i,a)[0]:([s,i,u]=Te(i,a),s)}({cmd:o,size:a}=yield yield $(null));let m=new Ta(r);try{do if({done:e,value:s}=Number.isNaN(a-u)?yield $(m.read()):yield $(m.read(a-u)),!e&&s.byteLength>0&&(i.push(k(s)),u+=s.byteLength),e||a<=u)do({cmd:o,size:a}=yield yield $(c()));while(a<u);while(!e)}catch(y){(n=!0)&&(yield $(m.cancel(y)))}finally{n===!1?yield $(m.cancel()):r.locked&&m.releaseLock()}return yield $(null)})}var Ta=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 A(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 A(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=k(e)),e})}},xa=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function bm(r){return pe(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,u=0,c=[],m;function y(){return o==="peek"?Te(c,a)[0]:([m,c,u]=Te(c,a),m)}if({cmd:o,size:a}=yield yield $(null),r.isTTY)return yield yield $(new Uint8Array(0)),yield $(null);try{e[0]=xa(r,"end"),e[1]=xa(r,"error");do{if(e[2]=xa(r,"readable"),[n,s]=yield $(Promise.race(e.map(I=>I[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-u)?(m=k(r.read(a-u)),m.byteLength<a-u&&(m=k(r.read()))):m=k(r.read()),m.byteLength>0&&(c.push(m),u+=m.byteLength)),i||a<=u)do({cmd:o,size:a}=yield yield $(y()));while(a<u)}while(!i)}finally{yield $(b(e,n==="error"?s:null))}return yield $(null);function b(I,Z){return m=c=null,new Promise((J,_t)=>{for(let[ft,yt]of I)r.off(ft,yt);try{let ft=r.destroy;ft&&ft.call(r,Z),Z=void 0}catch(ft){Z=ft||Z}finally{Z!=null?_t(Z):J()}})}})}var Vt;(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"})(Vt||(Vt={}));var Tt;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Tt||(Tt={}));var It;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(It||(It={}));var Jt;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Jt||(Jt={}));var G;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(G||(G={}));var ce;(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"})(ce||(ce={}));var rt;(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"})(rt||(rt={}));var h;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.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"})(h||(h={}));var Le;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Le||(Le={}));var ja={};dn(ja,{clampIndex:()=>c_,clampRange:()=>Si,createElementComparator:()=>Gr});function $e(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=>$e(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var Da={};dn(Da,{BN:()=>hn,bignumToBigInt:()=>Rs,bignumToString:()=>$r,isArrowBigNumSymbol:()=>xu});var xu=Symbol.for("isArrowBigNum");function Ye(r,...t){return t.length===0?Object.setPrototypeOf(Y(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}Ye.prototype[xu]=!0;Ye.prototype.toJSON=function(){return`"${$r(this)}"`};Ye.prototype.valueOf=function(){return Tu(this)};Ye.prototype.toString=function(){return $r(this)};Ye.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Tu(this);case"string":return $r(this);case"default":return Rs(this)}return $r(this)};function Un(...r){return Ye.apply(this,r)}function kn(...r){return Ye.apply(this,r)}function wi(...r){return Ye.apply(this,r)}Object.setPrototypeOf(Un.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(kn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(wi.prototype,Object.create(Uint32Array.prototype));Object.assign(Un.prototype,Ye.prototype,{constructor:Un,signed:!0,TypedArray:Int32Array,BigIntArray:yi});Object.assign(kn.prototype,Ye.prototype,{constructor:kn,signed:!1,TypedArray:Uint32Array,BigIntArray:Rn});Object.assign(wi.prototype,Ye.prototype,{constructor:wi,signed:!0,TypedArray:Uint32Array,BigIntArray:Rn});function Tu(r){let{buffer:t,byteOffset:e,length:n,signed:i}=r,s=new Rn(t,e,n),o=i&&s[s.length-1]&BigInt(1)<<BigInt(63),a=BigInt(o?1:0),u=BigInt(0);if(o){for(let c of s)a+=~c*(BigInt(1)<<BigInt(32)*u++);a*=BigInt(-1)}else for(let c of s)a+=c*(BigInt(1)<<BigInt(32)*u++);return a}var $r,Rs;As?(Rs=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Ba(r),$r=r=>r.byteLength===8?`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`:Ba(r)):($r=Ba,Rs=$r);function Ba(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),s=-1,o=n.length-1;do{for(e[0]=n[s=0];s<o;)n[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[s];n[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t||"0"}var hn=class{static new(t,e){switch(e){case!0:return new Un(t);case!1:return new kn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case yi:return new Un(t)}return t.byteLength===16?new wi(t):new kn(t)}static signed(t){return new Un(t)}static unsigned(t){return new kn(t)}static decimal(t){return new wi(t)}constructor(t,e){return hn.new(t,e)}};var Bu,Du,Eu,Ou,Ru,Mu,Uu,ku,Lu,Nu,Cu,Pu,Vu,Hu,zu,Wu,ju,$u,Yu,T=class{static isNull(t){return(t==null?void 0:t.typeId)===h.Null}static isInt(t){return(t==null?void 0:t.typeId)===h.Int}static isFloat(t){return(t==null?void 0:t.typeId)===h.Float}static isBinary(t){return(t==null?void 0:t.typeId)===h.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===h.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===h.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===h.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===h.Date}static isTime(t){return(t==null?void 0:t.typeId)===h.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===h.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===h.Interval}static isList(t){return(t==null?void 0:t.typeId)===h.List}static isStruct(t){return(t==null?void 0:t.typeId)===h.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===h.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===h.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===h.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===h.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===h.Dictionary}static isDenseUnion(t){return T.isUnion(t)&&t.mode===Tt.Dense}static isSparseUnion(t){return T.isUnion(t)&&t.mode===Tt.Sparse}get typeId(){return h.NONE}};Bu=Symbol.toStringTag;T[Bu]=(r=>(r.children=null,r.ArrayType=Array,r[Symbol.toStringTag]="DataType"))(T.prototype);var le=class extends T{toString(){return"Null"}get typeId(){return h.Null}};Du=Symbol.toStringTag;le[Du]=(r=>r[Symbol.toStringTag]="Null")(le.prototype);var Ot=class extends T{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return h.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}`}};Eu=Symbol.toStringTag;Ot[Eu]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Ot.prototype);var Ms=class extends Ot{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Us=class extends Ot{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},or=class extends Ot{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},ks=class extends Ot{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Ls=class extends Ot{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Ns=class extends Ot{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Cs=class extends Ot{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Ps=class extends Ot{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Ms.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Us.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(or.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(ks.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Ls.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Ns.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Cs.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Ps.prototype,"ArrayType",{value:BigUint64Array});var me=class extends T{constructor(t){super(),this.precision=t}get typeId(){return h.Float}get ArrayType(){switch(this.precision){case It.HALF:return Uint16Array;case It.SINGLE:return Float32Array;case It.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Ou=Symbol.toStringTag;me[Ou]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(me.prototype);var Vs=class extends me{constructor(){super(It.HALF)}},Hs=class extends me{constructor(){super(It.SINGLE)}},zs=class extends me{constructor(){super(It.DOUBLE)}};Object.defineProperty(Vs.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Hs.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(zs.prototype,"ArrayType",{value:Float64Array});var Fr=class extends T{constructor(){super()}get typeId(){return h.Binary}toString(){return"Binary"}};Ru=Symbol.toStringTag;Fr[Ru]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(Fr.prototype);var xr=class extends T{constructor(){super()}get typeId(){return h.Utf8}toString(){return"Utf8"}};Mu=Symbol.toStringTag;xr[Mu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(xr.prototype);var Tr=class extends T{constructor(){super()}get typeId(){return h.Bool}toString(){return"Bool"}};Uu=Symbol.toStringTag;Tr[Uu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Tr.prototype);var Br=class extends T{constructor(t,e,n=128){super(),this.scale=t,this.precision=e,this.bitWidth=n}get typeId(){return h.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};ku=Symbol.toStringTag;Br[ku]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(Br.prototype);var Dr=class extends T{constructor(t){super(),this.unit=t}get typeId(){return h.Date}toString(){return`Date${(this.unit+1)*32}<${Jt[this.unit]}>`}};Lu=Symbol.toStringTag;Dr[Lu]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(Dr.prototype);var Xe=class extends T{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return h.Time}toString(){return`Time${this.bitWidth}<${G[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Nu=Symbol.toStringTag;Xe[Nu]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Xe.prototype);var Er=class extends T{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return h.Timestamp}toString(){return`Timestamp<${G[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Cu=Symbol.toStringTag;Er[Cu]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(Er.prototype);var Or=class extends T{constructor(t){super(),this.unit=t}get typeId(){return h.Interval}toString(){return`Interval<${ce[this.unit]}>`}};Pu=Symbol.toStringTag;Or[Pu]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Or.prototype);var Ge=class extends T{constructor(t){super(),this.children=[t]}get typeId(){return h.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}};Vu=Symbol.toStringTag;Ge[Vu]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Ge.prototype);var bt=class extends T{constructor(t){super(),this.children=t}get typeId(){return h.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Hu=Symbol.toStringTag;bt[Hu]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(bt.prototype);var Ke=class extends T{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 h.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};zu=Symbol.toStringTag;Ke[zu]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Ke.prototype);var Rr=class extends T{constructor(t){super(),this.byteWidth=t}get typeId(){return h.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Wu=Symbol.toStringTag;Rr[Wu]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Rr.prototype);var Je=class extends T{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return h.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}>`}};ju=Symbol.toStringTag;Je[ju]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Je.prototype);var qe=class extends T{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return h.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(", ")}}>`}};$u=Symbol.toStringTag;qe[$u]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(qe.prototype);var gm=(r=>()=>++r)(-1),Be=class extends T{constructor(t,e,n,i){super(),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?gm():typeof n=="number"?n:n.low}get typeId(){return h.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}>`}};Yu=Symbol.toStringTag;Be[Yu]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Be.prototype);function De(r){let t=r;switch(r.typeId){case h.Decimal:return r.bitWidth/32;case h.Timestamp:return 2;case h.Date:return 1+t.unit;case h.Interval:return 1+t.unit;case h.FixedSizeList:return t.listSize;case h.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 wm(this,t,e)}getVisitFnByTypeId(t,e=!0){return Ln(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 wm(r,t,e=!0){return typeof t=="number"?Ln(r,t,e):typeof t=="string"&&t in h?Ln(r,h[t],e):t&&t instanceof T?Ln(r,Xu(t),e):(t==null?void 0:t.type)&&t.type instanceof T?Ln(r,Xu(t.type),e):Ln(r,h.NONE,e)}function Ln(r,t,e=!0){let n=null;switch(t){case h.Null:n=r.visitNull;break;case h.Bool:n=r.visitBool;break;case h.Int:n=r.visitInt;break;case h.Int8:n=r.visitInt8||r.visitInt;break;case h.Int16:n=r.visitInt16||r.visitInt;break;case h.Int32:n=r.visitInt32||r.visitInt;break;case h.Int64:n=r.visitInt64||r.visitInt;break;case h.Uint8:n=r.visitUint8||r.visitInt;break;case h.Uint16:n=r.visitUint16||r.visitInt;break;case h.Uint32:n=r.visitUint32||r.visitInt;break;case h.Uint64:n=r.visitUint64||r.visitInt;break;case h.Float:n=r.visitFloat;break;case h.Float16:n=r.visitFloat16||r.visitFloat;break;case h.Float32:n=r.visitFloat32||r.visitFloat;break;case h.Float64:n=r.visitFloat64||r.visitFloat;break;case h.Utf8:n=r.visitUtf8;break;case h.Binary:n=r.visitBinary;break;case h.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case h.Date:n=r.visitDate;break;case h.DateDay:n=r.visitDateDay||r.visitDate;break;case h.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case h.Timestamp:n=r.visitTimestamp;break;case h.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case h.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case h.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case h.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case h.Time:n=r.visitTime;break;case h.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case h.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case h.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case h.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case h.Decimal:n=r.visitDecimal;break;case h.List:n=r.visitList;break;case h.Struct:n=r.visitStruct;break;case h.Union:n=r.visitUnion;break;case h.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case h.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case h.Dictionary:n=r.visitDictionary;break;case h.Interval:n=r.visitInterval;break;case h.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case h.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case h.FixedSizeList:n=r.visitFixedSizeList;break;case h.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${h[t]}'`)}function Xu(r){switch(r.typeId){case h.Null:return h.Null;case h.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?h.Int8:h.Uint8;case 16:return e?h.Int16:h.Uint16;case 32:return e?h.Int32:h.Uint32;case 64:return e?h.Int64:h.Uint64}return h.Int}case h.Float:switch(r.precision){case It.HALF:return h.Float16;case It.SINGLE:return h.Float32;case It.DOUBLE:return h.Float64}return h.Float;case h.Binary:return h.Binary;case h.Utf8:return h.Utf8;case h.Bool:return h.Bool;case h.Decimal:return h.Decimal;case h.Time:switch(r.unit){case G.SECOND:return h.TimeSecond;case G.MILLISECOND:return h.TimeMillisecond;case G.MICROSECOND:return h.TimeMicrosecond;case G.NANOSECOND:return h.TimeNanosecond}return h.Time;case h.Timestamp:switch(r.unit){case G.SECOND:return h.TimestampSecond;case G.MILLISECOND:return h.TimestampMillisecond;case G.MICROSECOND:return h.TimestampMicrosecond;case G.NANOSECOND:return h.TimestampNanosecond}return h.Timestamp;case h.Date:switch(r.unit){case Jt.DAY:return h.DateDay;case Jt.MILLISECOND:return h.DateMillisecond}return h.Date;case h.Interval:switch(r.unit){case ce.DAY_TIME:return h.IntervalDayTime;case ce.YEAR_MONTH:return h.IntervalYearMonth}return h.Interval;case h.Map:return h.Map;case h.List:return h.List;case h.Struct:return h.Struct;case h.Union:switch(r.mode){case Tt.Dense:return h.DenseUnion;case Tt.Sparse:return h.SparseUnion}return h.Union;case h.FixedSizeBinary:return h.FixedSizeBinary;case h.FixedSizeList:return h.FixedSizeList;case h.Dictionary:return h.Dictionary}throw new Error(`Unrecognized type '${h[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 Ea={};dn(Ea,{float64ToUint16:()=>vi,uint16ToFloat64:()=>Ws});var Gu=new Float64Array(1),Nn=new Uint32Array(Gu.buffer);function Ws(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 vi(r){if(r!==r)return 32256;Gu[0]=r;let t=(Nn[1]&2147483648)>>16&65535,e=Nn[1]&2146435072,n=0;return e>=1089470464?Nn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Nn[1]&1048575)>>10):e<=1056964608?(n=1048576+(Nn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Nn[1]&1048575)+512>>10),t|e|n&65535}var L=class extends D{};function j(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var vm=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},Oa=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},Sm=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},Im=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},Ku=(r,t,e,n)=>{if(e+1<t.length){let{[e]:i,[e+1]:s}=t;r.set(n.subarray(0,s-i),i)}},Am=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Mr=({values:r},t,e)=>{r[t]=e},Ra=({values:r},t,e)=>{r[t]=e},Ju=({values:r},t,e)=>{r[t]=vi(e)},Fm=(r,t,e)=>{switch(r.type.precision){case It.HALF:return Ju(r,t,e);case It.SINGLE:case It.DOUBLE:return Ra(r,t,e)}},js=({values:r},t,e)=>{vm(r,t,e.valueOf())},$s=({values:r},t,e)=>{Oa(r,t*2,e.valueOf())},Ma=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},xm=({values:r,valueOffsets:t},e,n)=>Ku(r,t,e,n),Tm=({values:r,valueOffsets:t},e,n)=>{Ku(r,t,e,jr(n))},Ua=(r,t,e)=>{r.type.unit===Jt.DAY?js(r,t,e):$s(r,t,e)},Ys=({values:r},t,e)=>Oa(r,t*2,e/1e3),Xs=({values:r},t,e)=>Oa(r,t*2,e),Gs=({values:r},t,e)=>Sm(r,t*2,e),Ks=({values:r},t,e)=>Im(r,t*2,e),ka=(r,t,e)=>{switch(r.type.unit){case G.SECOND:return Ys(r,t,e);case G.MILLISECOND:return Xs(r,t,e);case G.MICROSECOND:return Gs(r,t,e);case G.NANOSECOND:return Ks(r,t,e)}},Js=({values:r},t,e)=>{r[t]=e},qs=({values:r},t,e)=>{r[t]=e},Zs=({values:r},t,e)=>{r[t]=e},Qs=({values:r},t,e)=>{r[t]=e},La=(r,t,e)=>{switch(r.type.unit){case G.SECOND:return Js(r,t,e);case G.MILLISECOND:return qs(r,t,e);case G.MICROSECOND:return Zs(r,t,e);case G.NANOSECOND:return Qs(r,t,e)}},Na=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},Bm=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=qt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],u=i[t+1];a<u;)s(n,a++,e[++o]);else for(let o=-1,a=i[t],u=i[t+1];a<u;)s(n,a++,e.get(++o))},Dm=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=qt.getVisitFn(n),{[t]:o,[t+1]:a}=i,u=e instanceof Map?e.entries():Object.entries(e);for(let c of u)if(s(n,o,c),++o>=a)break},Em=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),Om=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),Rm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),Mm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),Um=(r,t,e)=>{let n=r.type.children.map(s=>qt.getVisitFn(s.type)),i=e instanceof Map?Rm(t,e):e instanceof N?Om(t,e):Array.isArray(e)?Em(t,e):Mm(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},km=(r,t,e)=>{r.type.mode===Tt.Dense?qu(r,t,e):Zu(r,t,e)},qu=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];qt.visit(i,r.valueOffsets[t],e)},Zu=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];qt.visit(i,t,e)},Lm=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Ca=(r,t,e)=>{r.type.unit===ce.DAY_TIME?to(r,t,e):eo(r,t,e)},to=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},eo=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Nm=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=qt.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))};L.prototype.visitBool=j(Am);L.prototype.visitInt=j(Mr);L.prototype.visitInt8=j(Mr);L.prototype.visitInt16=j(Mr);L.prototype.visitInt32=j(Mr);L.prototype.visitInt64=j(Mr);L.prototype.visitUint8=j(Mr);L.prototype.visitUint16=j(Mr);L.prototype.visitUint32=j(Mr);L.prototype.visitUint64=j(Mr);L.prototype.visitFloat=j(Fm);L.prototype.visitFloat16=j(Ju);L.prototype.visitFloat32=j(Ra);L.prototype.visitFloat64=j(Ra);L.prototype.visitUtf8=j(Tm);L.prototype.visitBinary=j(xm);L.prototype.visitFixedSizeBinary=j(Ma);L.prototype.visitDate=j(Ua);L.prototype.visitDateDay=j(js);L.prototype.visitDateMillisecond=j($s);L.prototype.visitTimestamp=j(ka);L.prototype.visitTimestampSecond=j(Ys);L.prototype.visitTimestampMillisecond=j(Xs);L.prototype.visitTimestampMicrosecond=j(Gs);L.prototype.visitTimestampNanosecond=j(Ks);L.prototype.visitTime=j(La);L.prototype.visitTimeSecond=j(Js);L.prototype.visitTimeMillisecond=j(qs);L.prototype.visitTimeMicrosecond=j(Zs);L.prototype.visitTimeNanosecond=j(Qs);L.prototype.visitDecimal=j(Na);L.prototype.visitList=j(Bm);L.prototype.visitStruct=j(Um);L.prototype.visitUnion=j(km);L.prototype.visitDenseUnion=j(qu);L.prototype.visitSparseUnion=j(Zu);L.prototype.visitDictionary=j(Lm);L.prototype.visitInterval=j(Ca);L.prototype.visitIntervalDayTime=j(to);L.prototype.visitIntervalYearMonth=j(eo);L.prototype.visitFixedSizeList=j(Nm);L.prototype.visitMap=j(Dm);var qt=new L;var Ze=Symbol.for("parent"),Cn=Symbol.for("rowIndex"),Yr=class{constructor(t,e){return this[Ze]=t,this[Cn]=e,new Proxy(this,new Va)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Cn],e=this[Ze],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=Ut.visit(e.children[s],t);return i}toString(){return`{${[...this].map(([t,e])=>`${$e(t)}: ${$e(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Pa(this[Ze],this[Cn])}},Pa=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,Ut.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Yr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ze]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Cn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Va=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ze].type.children.map(e=>e.name)}has(t,e){return t[Ze].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Ze].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[Ze].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=Ut.visit(t[Ze].children[n],t[Cn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ze].type.children.findIndex(s=>s.name===e);return i!==-1?(qt.visit(t[Ze].children[i],t[Cn],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 V(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Cm=(r,t)=>864e5*r[t],Ha=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),Pm=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,Vm=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,Qu=r=>new Date(r),Hm=(r,t)=>Qu(Cm(r,t)),zm=(r,t)=>Qu(Ha(r,t)),Wm=(r,t)=>null,td=(r,t,e)=>{if(e+1>=t.length)return null;let n=t[e],i=t[e+1];return r.subarray(n,i)},jm=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},ed=({values:r},t)=>Hm(r,t),rd=({values:r},t)=>zm(r,t*2),Xr=({stride:r,values:t},e)=>t[r*e],$m=({stride:r,values:t},e)=>Ws(t[r*e]),nd=({values:r},t)=>r[t],Ym=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Xm=({values:r,valueOffsets:t},e)=>td(r,t,e),Gm=({values:r,valueOffsets:t},e)=>{let n=td(r,t,e);return n!==null?_i(n):null},Km=({values:r},t)=>r[t],Jm=({type:r,values:t},e)=>r.precision!==It.HALF?t[e]:Ws(t[e]),qm=(r,t)=>r.type.unit===Jt.DAY?ed(r,t):rd(r,t),id=({values:r},t)=>1e3*Ha(r,t*2),sd=({values:r},t)=>Ha(r,t*2),od=({values:r},t)=>Pm(r,t*2),ad=({values:r},t)=>Vm(r,t*2),Zm=(r,t)=>{switch(r.type.unit){case G.SECOND:return id(r,t);case G.MILLISECOND:return sd(r,t);case G.MICROSECOND:return od(r,t);case G.NANOSECOND:return ad(r,t)}},cd=({values:r},t)=>r[t],ld=({values:r},t)=>r[t],ud=({values:r},t)=>r[t],dd=({values:r},t)=>r[t],Qm=(r,t)=>{switch(r.type.unit){case G.SECOND:return cd(r,t);case G.MILLISECOND:return ld(r,t);case G.MICROSECOND:return ud(r,t);case G.NANOSECOND:return dd(r,t)}},t_=({values:r,stride:t},e)=>hn.decimal(r.subarray(t*e,t*(e+1))),e_=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,u=i[0].slice(s,o-s);return new N([u])},r_=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new ar(o.slice(i,s-i))},n_=(r,t)=>new Yr(r,t),i_=(r,t)=>r.type.mode===Tt.Dense?fd(r,t):hd(r,t),fd=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Ut.visit(n,r.valueOffsets[t])},hd=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Ut.visit(n,t)},s_=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},o_=(r,t)=>r.type.unit===ce.DAY_TIME?pd(r,t):md(r,t),pd=({values:r},t)=>r.subarray(2*t,2*(t+1)),md=({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},a_=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new N([s])};O.prototype.visitNull=V(Wm);O.prototype.visitBool=V(jm);O.prototype.visitInt=V(Km);O.prototype.visitInt8=V(Xr);O.prototype.visitInt16=V(Xr);O.prototype.visitInt32=V(Xr);O.prototype.visitInt64=V(nd);O.prototype.visitUint8=V(Xr);O.prototype.visitUint16=V(Xr);O.prototype.visitUint32=V(Xr);O.prototype.visitUint64=V(nd);O.prototype.visitFloat=V(Jm);O.prototype.visitFloat16=V($m);O.prototype.visitFloat32=V(Xr);O.prototype.visitFloat64=V(Xr);O.prototype.visitUtf8=V(Gm);O.prototype.visitBinary=V(Xm);O.prototype.visitFixedSizeBinary=V(Ym);O.prototype.visitDate=V(qm);O.prototype.visitDateDay=V(ed);O.prototype.visitDateMillisecond=V(rd);O.prototype.visitTimestamp=V(Zm);O.prototype.visitTimestampSecond=V(id);O.prototype.visitTimestampMillisecond=V(sd);O.prototype.visitTimestampMicrosecond=V(od);O.prototype.visitTimestampNanosecond=V(ad);O.prototype.visitTime=V(Qm);O.prototype.visitTimeSecond=V(cd);O.prototype.visitTimeMillisecond=V(ld);O.prototype.visitTimeMicrosecond=V(ud);O.prototype.visitTimeNanosecond=V(dd);O.prototype.visitDecimal=V(t_);O.prototype.visitList=V(e_);O.prototype.visitStruct=V(n_);O.prototype.visitUnion=V(i_);O.prototype.visitDenseUnion=V(fd);O.prototype.visitSparseUnion=V(hd);O.prototype.visitDictionary=V(s_);O.prototype.visitInterval=V(o_);O.prototype.visitIntervalDayTime=V(pd);O.prototype.visitIntervalYearMonth=V(md);O.prototype.visitFixedSizeList=V(a_);O.prototype.visitMap=V(r_);var Ut=new O;var Ne=Symbol.for("keys"),Pn=Symbol.for("vals"),ar=class{constructor(t){return this[Ne]=new N([t.children[0]]).memoize(),this[Pn]=t.children[1],new Proxy(this,new Wa)}[Symbol.iterator](){return new za(this[Ne],this[Pn])}get size(){return this[Ne].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Ne],e=this[Pn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=Ut.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${$e(t)}: ${$e(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},za=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),Ut.visit(this.vals,t)]})}},Wa=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ne].toArray().map(String)}has(t,e){return t[Ne].includes(e)}getOwnPropertyDescriptor(t,e){if(t[Ne].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Ne].indexOf(e);if(n!==-1){let i=Ut.visit(Reflect.get(t,Pn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ne].indexOf(e);return i!==-1?(qt.visit(Reflect.get(t,Pn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(ar.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ne]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Pn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function c_(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var _d;function Si(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&&(_d=s,s=o,o=_d),o>i&&(o=i),n?n(r,s,o):[s,o]}var yd=r=>r!==r;function Gr(r){if(typeof r!=="object"||r===null)return yd(r)?yd: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?Aa(r,e):!1:r instanceof Map?u_(r):Array.isArray(r)?l_(r):r instanceof N?d_(r):f_(r,!0)}function l_(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Gr(r[e]);return ro(t)}function u_(r){let t=-1,e=[];for(let n of r.values())e[++t]=Gr(n);return ro(e)}function d_(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Gr(r.get(e));return ro(t)}function f_(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]=Gr(r[e[i]]);return ro(n,e)}function ro(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return h_(r,e);case Map:return bd(r,e,e.keys());case ar:case Yr:case Object:case void 0:return bd(r,e,t||Object.keys(e))}return e instanceof N?p_(r,e):!1}}function h_(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 p_(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 bd(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,u=s.next(),c=n.next(),m=i.next();for(;o<a&&!c.done&&!m.done&&!u.done&&!(c.value!==m.value||!r[o](u.value));++o,c=n.next(),m=i.next(),u=s.next());return o===a&&c.done&&m.done&&u.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var $a={};dn($a,{BitIterator:()=>pn,getBit:()=>gd,getBool:()=>io,packBools:()=>mn,popcnt_array:()=>wd,popcnt_bit_range:()=>Ii,popcnt_uint32:()=>no,setBool:()=>m_,truncateBitmap:()=>Vn});function io(r,t,e,n){return(e&1<<n)!==0}function gd(r,t,e,n){return(e&1<<n)>>n}function m_(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Vn(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):mn(new pn(e,r,t,null,io)).subarray(0,n)),i}return e}function mn(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 pn=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 Ii(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new pn(r,t,e-t,r,gd))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return Ii(r,t,i)+Ii(r,n,e)+wd(r,i>>3,n-i>>3)}function wd(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+=no(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=no(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=no(s.getUint8(i)),i+=1;return n}function no(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 __=-1,it=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 u;s instanceof it?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=De(t),s&&((u=s[0])&&(this.valueOffsets=u),(u=s[1])&&(this.values=u),(u=s[2])&&(this.nullBitmap=u),(u=s[3])&&(this.typeIds=u))),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<=__&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-Ii(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:u}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:u,_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 it(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,u=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,u,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===h.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(e&-8))-1,n>0&&i.set(Vn(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[Le.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[Le.TYPE])&&(o[Le.TYPE]=s.subarray(t,t+e)),(s=o[Le.OFFSET])&&(o[Le.OFFSET]=s.subarray(t,t+e+1))||(s=o[Le.DATA])&&(o[Le.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};it.prototype.children=Object.freeze([]);var _n=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 it(e,n,i,0)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.data),s=k(t.nullBitmap),o=fn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new it(e,n,a,u,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.data),s=k(t.nullBitmap),o=fn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new it(e,n,a,u,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=k(t.nullBitmap),o=fn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new it(e,n,a,u,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=k(t.nullBitmap),{length:o=i.reduce((u,{length:c})=>Math.max(u,c),0),nullCount:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=k(t.nullBitmap),o=Y(e.ArrayType,t.typeIds),{["length"]:a=o.length,["nullCount"]:u=t.nullBitmap?-1:0}=t;if(T.isSparseUnion(e))return new it(e,n,a,u,[void 0,void 0,s,o],i);let c=fn(t.valueOffsets);return new it(e,n,a,u,[c,void 0,s,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.indices.ArrayType,t.data),{["dictionary"]:o=new N([new _n().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new it(e,n,a,u,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new _n().visit({type:e.valueType})}=t,s=k(t.nullBitmap),{["length"]:o=i.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new _n().visit({type:e.childType})}=t,s=k(t.nullBitmap),o=fn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new it(e,n,a,u,[o,void 0,s],[i])}};function P(r){return new _n().visit(r)}var Ai=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 so(r){return r.reduce((t,e)=>t+e.nullCount,0)}function oo(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function ao(r,t,e,n){let i=[];for(let s=-1,o=r.length;++s<o;){let a=r[s],u=t[s],{length:c}=a;if(u>=n)break;if(e>=u+c)continue;if(u>=e&&u+c<=n){i.push(a);continue}let m=Math.max(0,e-u),y=Math.min(n-u,c);i.push(a.slice(m,y-m))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Ya(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 Fi(r,t){return r.getValid(t)}function Kr(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Ya(n,this._offsets,e,t)}}function co(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=Ya(s,this._offsets,n,e);return t=void 0,o}}function lo(r){let t;function e(n,i,s){let o=s,a=0,u=0;for(let c=i-1,m=n.length;++c<m;){let y=n[c];if(~(a=r(y,t,o)))return u+a;o=0,u+=y.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):Ya(s,this._offsets,i,e);return t=void 0,o}}var R=class extends D{};function y_(r,t){return t===null&&r.length>0?0:-1}function b_(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new pn(e,r.offset+(t||0),r.length,e,io)){if(!i)return n;++n}return-1}function X(r,t,e){if(t===void 0)return-1;if(t===null)return b_(r,e);let n=Ut.getVisitFn(r),i=Gr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function vd(r,t,e){let n=Ut.getVisitFn(r),i=Gr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}R.prototype.visitNull=y_;R.prototype.visitBool=X;R.prototype.visitInt=X;R.prototype.visitInt8=X;R.prototype.visitInt16=X;R.prototype.visitInt32=X;R.prototype.visitInt64=X;R.prototype.visitUint8=X;R.prototype.visitUint16=X;R.prototype.visitUint32=X;R.prototype.visitUint64=X;R.prototype.visitFloat=X;R.prototype.visitFloat16=X;R.prototype.visitFloat32=X;R.prototype.visitFloat64=X;R.prototype.visitUtf8=X;R.prototype.visitBinary=X;R.prototype.visitFixedSizeBinary=X;R.prototype.visitDate=X;R.prototype.visitDateDay=X;R.prototype.visitDateMillisecond=X;R.prototype.visitTimestamp=X;R.prototype.visitTimestampSecond=X;R.prototype.visitTimestampMillisecond=X;R.prototype.visitTimestampMicrosecond=X;R.prototype.visitTimestampNanosecond=X;R.prototype.visitTime=X;R.prototype.visitTimeSecond=X;R.prototype.visitTimeMillisecond=X;R.prototype.visitTimeMicrosecond=X;R.prototype.visitTimeNanosecond=X;R.prototype.visitDecimal=X;R.prototype.visitList=X;R.prototype.visitStruct=X;R.prototype.visitUnion=X;R.prototype.visitDenseUnion=vd;R.prototype.visitSparseUnion=vd;R.prototype.visitDictionary=X;R.prototype.visitInterval=X;R.prototype.visitIntervalDayTime=X;R.prototype.visitIntervalYearMonth=X;R.prototype.visitFixedSizeList=X;R.prototype.visitMap=X;var yn=new R;var M=class extends D{};function H(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===h.Timestamp||t instanceof Ot&&t.bitWidth!==64||t instanceof Xe&&t.bitWidth!==64||t instanceof me&&t.precision!==It.HALF))return new Ai(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new Ai(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Xa(o)})}var Xa=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}};M.prototype.visitNull=H;M.prototype.visitBool=H;M.prototype.visitInt=H;M.prototype.visitInt8=H;M.prototype.visitInt16=H;M.prototype.visitInt32=H;M.prototype.visitInt64=H;M.prototype.visitUint8=H;M.prototype.visitUint16=H;M.prototype.visitUint32=H;M.prototype.visitUint64=H;M.prototype.visitFloat=H;M.prototype.visitFloat16=H;M.prototype.visitFloat32=H;M.prototype.visitFloat64=H;M.prototype.visitUtf8=H;M.prototype.visitBinary=H;M.prototype.visitFixedSizeBinary=H;M.prototype.visitDate=H;M.prototype.visitDateDay=H;M.prototype.visitDateMillisecond=H;M.prototype.visitTimestamp=H;M.prototype.visitTimestampSecond=H;M.prototype.visitTimestampMillisecond=H;M.prototype.visitTimestampMicrosecond=H;M.prototype.visitTimestampNanosecond=H;M.prototype.visitTime=H;M.prototype.visitTimeSecond=H;M.prototype.visitTimeMillisecond=H;M.prototype.visitTimeMicrosecond=H;M.prototype.visitTimeNanosecond=H;M.prototype.visitDecimal=H;M.prototype.visitList=H;M.prototype.visitStruct=H;M.prototype.visitUnion=H;M.prototype.visitDenseUnion=H;M.prototype.visitSparseUnion=H;M.prototype.visitDictionary=H;M.prototype.visitInterval=H;M.prototype.visitIntervalDayTime=H;M.prototype.visitIntervalYearMonth=H;M.prototype.visitFixedSizeList=H;M.prototype.visitMap=H;var Hn=new M;var g_=(r,t)=>r+t,cr=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===G.SECOND?4:8}visitInterval(t,e){return(t.type.unit+1)*4}visitStruct(t,e){return t.children.reduce((n,i)=>n+Ee.visit(i,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((n,i)=>n+Ee.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)}},w_=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),v_=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),S_=({valueOffsets:r,stride:t,children:e},n)=>{let i=e[0],{[n*t]:s}=r,{[n*t+1]:o}=r,a=Ee.getVisitFn(i.type),u=i.slice(s,o-s),c=8;for(let m=-1,y=o-s;++m<y;)c+=a(u,m);return c},I_=({stride:r,children:t},e)=>{let n=t[0],i=n.slice(e*r,r),s=Ee.getVisitFn(n.type),o=0;for(let a=-1,u=i.length;++a<u;)o+=s(i,a);return o},A_=(r,t)=>r.type.mode===Tt.Dense?Sd(r,t):Id(r,t),Sd=({type:r,children:t,typeIds:e,valueOffsets:n},i)=>{let s=r.typeIdToChildIndex[e[i]];return 8+Ee.visit(t[s],n[i])},Id=({children:r},t)=>4+Ee.visitMany(r,r.map(()=>t)).reduce(g_,0);cr.prototype.visitUtf8=w_;cr.prototype.visitBinary=v_;cr.prototype.visitList=S_;cr.prototype.visitFixedSizeList=I_;cr.prototype.visitUnion=A_;cr.prototype.visitDenseUnion=Sd;cr.prototype.visitSparseUnion=Id;var Ee=new cr;var Ad,Fd={},xd={},N=class{constructor(t){var e,n,i;let s=t[0]instanceof N?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof it)))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:u,indexOf:c,byteLength:m}=Fd[o.typeId],y=s[0];this.isValid=b=>Fi(y,b),this.get=b=>a(y,b),this.set=(b,I)=>u(y,b,I),this.indexOf=b=>c(y,b),this.getByteLength=b=>m(y,b),this._offsets=[0,y.length];break}default:Object.setPrototypeOf(this,xd[o.typeId]),this._offsets=oo(s);break}this.data=s,this.type=o,this.stride=De(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=so(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${h[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 Hn.visit(this)}concat(...t){return new N(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new N(Si(this,t,e,({data:n,_offsets:i},s,o)=>ao(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case h.Int:case h.Float:case h.Decimal:case h.Time:case h.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a})=>(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 N(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return T.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(T.isDictionary(this.type)){let t=new zn(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new N(e)}return new zn(this)}unmemoize(){if(T.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 N(e)}return this}};Ad=Symbol.toStringTag;N[Ad]=(r=>{r.type=T.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(h).map(e=>h[e]).filter(e=>typeof e=="number"&&e!==h.NONE);for(let e of t){let n=Ut.getVisitFnByTypeId(e),i=qt.getVisitFnByTypeId(e),s=yn.getVisitFnByTypeId(e),o=Ee.getVisitFnByTypeId(e);Fd[e]={get:n,set:i,indexOf:s,byteLength:o},xd[e]=Object.create(r,{isValid:{value:Kr(Fi)},get:{value:Kr(Ut.getVisitFnByTypeId(e))},set:{value:co(qt.getVisitFnByTypeId(e))},indexOf:{value:lo(yn.getVisitFnByTypeId(e))},getByteLength:{value:Kr(Ee.getVisitFnByTypeId(e))}})}return"Vector"})(N.prototype);var zn=class extends N{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 u=e.call(this,o);return s[o]=u,u}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new zn(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new N(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Td(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 kp=Object.create;var ws=Object.defineProperty;var Lp=Object.getOwnPropertyDescriptor;var Np=Object.getOwnPropertyNames;var Cp=Object.getPrototypeOf,Pp=Object.prototype.hasOwnProperty;var ba=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var un=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),dn=(r,t)=>{for(var e in t)ws(r,e,{get:t[e],enumerable:!0})},ql=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Np(t))!Pp.call(r,i)&&i!==e&&ws(r,i,{get:()=>t[i],enumerable:!(n=Lp(t,i))||n.enumerable});return r};var Zl=(r,t,e)=>(e=r!=null?kp(Cp(r)):{},ql(t||!r||!r.__esModule?ws(e,"default",{value:r,enumerable:!0}):e,r)),Vp=r=>ql(ws({},"__esModule",{value:!0}),r);var wu=un((Ly,Is)=>{var Ql,tu,eu,ru,nu,iu,su,ou,au,vs,ga,cu,lu,uu,En,du,fu,hu,pu,mu,_u,yu,bu,gu,Ss;(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 Is=="object"&&typeof Is.exports=="object"?r(e(t,e(Is.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])};Ql=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)},tu=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},eu=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},ru=function(n,i,s,o){var a=arguments.length,u=a<3?i:o===null?o=Object.getOwnPropertyDescriptor(i,s):o,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,i,s,o);else for(var m=n.length-1;m>=0;m--)(c=n[m])&&(u=(a<3?c(u):a>3?c(i,s,u):c(i,s))||u);return a>3&&u&&Object.defineProperty(i,s,u),u},nu=function(n,i){return function(s,o){i(s,o,n)}},iu=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},su=function(n,i,s,o){function a(u){return u instanceof s?u:new s(function(c){c(u)})}return new(s||(s=Promise))(function(u,c){function m(I){try{b(o.next(I))}catch(Z){c(Z)}}function y(I){try{b(o.throw(I))}catch(Z){c(Z)}}function b(I){I.done?u(I.value):a(I.value).then(m,y)}b((o=o.apply(n,i||[])).next())})},ou=function(n,i){var s={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,a,u,c;return c={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function m(b){return function(I){return y([b,I])}}function y(b){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,a&&(u=b[0]&2?a.return:b[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,b[1])).done)return u;switch(a=0,u&&(b=[b[0]&2,u.value]),b[0]){case 0:case 1:u=b;break;case 4:return s.label++,{value:b[1],done:!1};case 5:s.label++,a=b[1],b=[0];continue;case 7:b=s.ops.pop(),s.trys.pop();continue;default:if(u=s.trys,!(u=u.length>0&&u[u.length-1])&&(b[0]===6||b[0]===2)){s=0;continue}if(b[0]===3&&(!u||b[1]>u[0]&&b[1]<u[3])){s.label=b[1];break}if(b[0]===6&&s.label<u[1]){s.label=u[1],u=b;break}if(u&&s.label<u[2]){s.label=u[2],s.ops.push(b);break}u[2]&&s.ops.pop(),s.trys.pop();continue}b=i.call(n,s)}catch(I){b=[6,I],a=0}finally{o=u=0}if(b[0]&5)throw b[1];return{value:b[0]?b[1]:void 0,done:!0}}},au=function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&Ss(i,n,s)},Ss=Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]},vs=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.")},ga=function(n,i){var s=typeof Symbol=="function"&&n[Symbol.iterator];if(!s)return n;var o=s.call(n),a,u=[],c;try{for(;(i===void 0||i-- >0)&&!(a=o.next()).done;)u.push(a.value)}catch(m){c={error:m}}finally{try{a&&!a.done&&(s=o.return)&&s.call(o)}finally{if(c)throw c.error}}return u},cu=function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(ga(arguments[i]));return n},lu=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 u=arguments[i],c=0,m=u.length;c<m;c++,a++)o[a]=u[c];return o},uu=function(n,i,s){if(s||arguments.length===2)for(var o=0,a=i.length,u;o<a;o++)(u||!(o in i))&&(u||(u=Array.prototype.slice.call(i,0,o)),u[o]=i[o]);return n.concat(u||Array.prototype.slice.call(i))},En=function(n){return this instanceof En?(this.v=n,this):new En(n)},du=function(n,i,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=s.apply(n,i||[]),a,u=[];return a={},c("next"),c("throw"),c("return"),a[Symbol.asyncIterator]=function(){return this},a;function c(J){o[J]&&(a[J]=function(_t){return new Promise(function(ft,yt){u.push([J,_t,ft,yt])>1||m(J,_t)})})}function m(J,_t){try{y(o[J](_t))}catch(ft){Z(u[0][3],ft)}}function y(J){J.value instanceof En?Promise.resolve(J.value.v).then(b,I):Z(u[0][2],J)}function b(J){m("next",J)}function I(J){m("throw",J)}function Z(J,_t){J(_t),u.shift(),u.length&&m(u[0][0],u[0][1])}},fu=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,u){i[a]=n[a]?function(c){return(s=!s)?{value:En(n[a](c)),done:a==="return"}:u?u(c):c}:u}},hu=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 vs=="function"?vs(n):n[Symbol.iterator](),s={},o("next"),o("throw"),o("return"),s[Symbol.asyncIterator]=function(){return this},s);function o(u){s[u]=n[u]&&function(c){return new Promise(function(m,y){c=n[u](c),a(m,y,c.done,c.value)})}}function a(u,c,m,y){Promise.resolve(y).then(function(b){u({value:b,done:m})},c)}},pu=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};mu=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)&&Ss(i,n,s);return e(i,n),i},_u=function(n){return n&&n.__esModule?n:{default:n}},yu=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)},bu=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},gu=function(n,i){if(i===null||typeof i!="object"&&typeof i!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?i===n:n.has(i)},r("__extends",Ql),r("__assign",tu),r("__rest",eu),r("__decorate",ru),r("__param",nu),r("__metadata",iu),r("__awaiter",su),r("__generator",ou),r("__exportStar",au),r("__createBinding",Ss),r("__values",vs),r("__read",ga),r("__spread",cu),r("__spreadArrays",lu),r("__spreadArray",uu),r("__await",En),r("__asyncGenerator",du),r("__asyncDelegator",fu),r("__asyncValues",hu),r("__makeTemplateObject",pu),r("__importStar",mu),r("__importDefault",_u),r("__classPrivateFieldGet",yu),r("__classPrivateFieldSet",bu),r("__classPrivateFieldIn",gu)})});var yc=un(()=>{});var af=un(()=>{});var cf=un(()=>{});var lf=un(()=>{});var uf=un(()=>{});var _f=un((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,u=this.blocks,c,m,y,b,I,Z,J,_t,ft,yt,F;for(c=16;c<64;++c)I=u[c-15],m=(I>>>7|I<<25)^(I>>>18|I<<14)^I>>>3,I=u[c-2],y=(I>>>17|I<<15)^(I>>>19|I<<13)^I>>>10,u[c]=u[c-16]+m+u[c-7]+y<<0;for(F=t&e,c=0;c<64;c+=4)this.first?(this.is224?(_t=300032,I=u[0]-1413257819,a=I-150054599<<0,n=I+24177077<<0):(_t=704751109,I=u[0]-210244248,a=I-1521486534<<0,n=I+143694565<<0),this.first=!1):(m=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),y=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),_t=r&t,b=_t^r&e^F,J=i&s^~i&o,I=a+y+J+K[c]+u[c],Z=m+b,a=n+I<<0,n=I+Z<<0),m=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),y=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),ft=n&r,b=ft^n&t^_t,J=a&i^~a&s,I=o+y+J+K[c+1]+u[c+1],Z=m+b,o=e+I<<0,e=I+Z<<0,m=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),y=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),yt=e&n,b=yt^e&r^ft,J=o&a^~o&i,I=s+y+J+K[c+2]+u[c+2],Z=m+b,s=t+I<<0,t=I+Z<<0,m=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),y=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),F=t&e,b=F^t&n^yt,J=s&o^~s&a,I=i+y+J+K[c+3]+u[c+3],Z=m+b,i=r+I<<0,r=I+Z<<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,u=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||(u+=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]),u},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,u=[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||u.push(a>>24&255,a>>16&255,a>>8&255,a&255),u},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,u;for(n=0;n<o;++n)u=r.charCodeAt(n),u<128?s[a++]=u:u<2048?(s[a++]=192|u>>6,s[a++]=128|u&63):u<55296||u>=57344?(s[a++]=224|u>>12,s[a++]=128|u>>6&63,s[a++]=128|u&63):(u=65536+((u&1023)<<10|r.charCodeAt(++n)&1023),s[a++]=240|u>>18,s[a++]=128|u>>12&63,s[a++]=128|u>>6&63,s[a++]=128|u&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 c=[],m=[];for(n=0;n<64;++n){var y=r[n]||0;c[n]=92^y,m[n]=54^y}Sha256.call(this,t,e),this.update(m),this.oKeyPad=c,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 Oy={};dn(Oy,{registerWorker:()=>gf});var vu=Zl(wu(),1),{__extends:Ny,__assign:Cy,__rest:Su,__decorate:Py,__param:Vy,__metadata:Hy,__awaiter:A,__generator:zy,__exportStar:Wy,__createBinding:jy,__values:$y,__read:Yy,__spread:Xy,__spreadArrays:Gy,__spreadArray:Ky,__await:$,__asyncGenerator:pe,__asyncDelegator:On,__asyncValues:ke,__makeTemplateObject:Jy,__importStar:qy,__importDefault:Zy,__classPrivateFieldGet:Qy,__classPrivateFieldSet:tb,__classPrivateFieldIn:eb}=vu.default;var Fa={};dn(Fa,{compareArrayLike:()=>Aa,joinUint8Arrays:()=>Te,memcpy:()=>Mn,rebaseValueOffsets:()=>gi,toArrayBufferView:()=>Y,toArrayBufferViewAsyncIterator:()=>je,toArrayBufferViewIterator:()=>sr,toBigInt64Array:()=>Xp,toBigUint64Array:()=>Jp,toFloat32Array:()=>qp,toFloat32ArrayAsyncIterator:()=>hm,toFloat32ArrayIterator:()=>sm,toFloat64Array:()=>Zp,toFloat64ArrayAsyncIterator:()=>pm,toFloat64ArrayIterator:()=>om,toInt16Array:()=>Yp,toInt16ArrayAsyncIterator:()=>lm,toInt16ArrayIterator:()=>em,toInt32Array:()=>fn,toInt32ArrayAsyncIterator:()=>um,toInt32ArrayIterator:()=>rm,toInt8Array:()=>$p,toInt8ArrayAsyncIterator:()=>cm,toInt8ArrayIterator:()=>tm,toUint16Array:()=>Gp,toUint16ArrayAsyncIterator:()=>dm,toUint16ArrayIterator:()=>nm,toUint32Array:()=>Kp,toUint32ArrayAsyncIterator:()=>fm,toUint32ArrayIterator:()=>im,toUint8Array:()=>k,toUint8ArrayAsyncIterator:()=>Ia,toUint8ArrayIterator:()=>Sa,toUint8ClampedArray:()=>Qp,toUint8ClampedArrayAsyncIterator:()=>mm,toUint8ClampedArrayIterator:()=>am});var Hp=new TextDecoder("utf-8"),_i=r=>Hp.decode(r),zp=new TextEncoder,jr=r=>zp.encode(r);var[ib,As]=(()=>{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]})(),[yi,sb]=(()=>{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]})(),[Rn,ob]=(()=>{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 Wp=r=>typeof r=="number",Iu=r=>typeof r=="boolean",Ct=r=>typeof r=="function",ae=r=>r!=null&&Object(r)===r,ze=r=>ae(r)&&Ct(r.then);var We=r=>ae(r)&&Ct(r[Symbol.iterator]),Le=r=>ae(r)&&Ct(r[Symbol.asyncIterator]),Fs=r=>ae(r)&&ae(r.schema);var xs=r=>ae(r)&&"done"in r&&"value"in r;var Ts=r=>ae(r)&&Ct(r.stat)&&Wp(r.fd);var Bs=r=>ae(r)&&bi(r.body),Ds=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Au=r=>ae(r)&&Ct(r.abort)&&Ct(r.getWriter)&&!Ds(r),bi=r=>ae(r)&&Ct(r.cancel)&&Ct(r.getReader)&&!Ds(r),Fu=r=>ae(r)&&Ct(r.end)&&Ct(r.write)&&Iu(r.writable)&&!Ds(r),Es=r=>ae(r)&&Ct(r.read)&&Ct(r.pipe)&&Iu(r.readable)&&!Ds(r),xu=r=>ae(r)&&Ct(r.clear)&&Ct(r.bytes)&&Ct(r.position)&&Ct(r.setPosition)&&Ct(r.capacity)&&Ct(r.getBufferIdentifier)&&Ct(r.createLong);var va=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function jp(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,a,u=0,c=0,m=r.length;++u<m;){if(o=t[c],a=r[u],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++c]=a);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:n,byteLength:s}=a,e+i<n||n+s<e){a&&(t[++c]=a);continue}t[c]=new Uint8Array(o.buffer,e,n-e+s)}return t}function Mn(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 Te(r,t){let e=jp(r),n=e.reduce((m,y)=>m+y.byteLength,0),i,s,o,a=0,u=-1,c=Math.min(t||Number.POSITIVE_INFINITY,n);for(let m=e.length;++u<m;){if(i=e[u],s=i.subarray(0,Math.min(i.length,c-a)),c<=a+s.length){s.length<i.length?e[u]=i.subarray(s.length):s.length===i.length&&u++,o?Mn(o,s,a):o=s;break}Mn(o||(o=new Uint8Array(c)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(u),n-(o?o.byteLength:0)]}function Y(r,t){let e=xs(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=jr(e)),e instanceof ArrayBuffer?new r(e):e instanceof va?new r(e):xu(e)?Y(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 $p=r=>Y(Int8Array,r),Yp=r=>Y(Int16Array,r),fn=r=>Y(Int32Array,r),Xp=r=>Y(yi,r),k=r=>Y(Uint8Array,r),Gp=r=>Y(Uint16Array,r),Kp=r=>Y(Uint32Array,r),Jp=r=>Y(Rn,r),qp=r=>Y(Float32Array,r),Zp=r=>Y(Float64Array,r),Qp=r=>Y(Uint8ClampedArray,r),wa=r=>(r.next(),r);function*sr(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof va?e(t):We(t)?t:e(t);return yield*wa(function*(i){let s=null;do s=i.next(yield Y(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}var tm=r=>sr(Int8Array,r),em=r=>sr(Int16Array,r),rm=r=>sr(Int32Array,r),Sa=r=>sr(Uint8Array,r),nm=r=>sr(Uint16Array,r),im=r=>sr(Uint32Array,r),sm=r=>sr(Float32Array,r),om=r=>sr(Float64Array,r),am=r=>sr(Uint8ClampedArray,r);function je(r,t){return pe(this,arguments,function*(){if(ze(t))return yield $(yield $(yield*On(ke(je(r,yield $(t))))));let n=function(o){return pe(this,arguments,function*(){yield yield $(yield $(o))})},i=function(o){return pe(this,arguments,function*(){yield $(yield*On(ke(wa(function*(a){let u=null;do u=a.next(yield u==null?void 0:u.value);while(!u.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof va?n(t):We(t)?i(t):Le(t)?t:n(t);return yield $(yield*On(ke(wa(function(o){return pe(this,arguments,function*(){let a=null;do a=yield $(o.next(yield yield $(Y(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield $(new r)})}var cm=r=>je(Int8Array,r),lm=r=>je(Int16Array,r),um=r=>je(Int32Array,r),Ia=r=>je(Uint8Array,r),dm=r=>je(Uint16Array,r),fm=r=>je(Uint32Array,r),hm=r=>je(Float32Array,r),pm=r=>je(Float64Array,r),mm=r=>je(Uint8ClampedArray,r);function gi(r,t,e){if(r!==0){e=e.slice(0,t+1);for(let n=-1;++n<=t;)e[n]+=r}return e}function Aa(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 Kt={fromIterable(r){return Os(_m(r))},fromAsyncIterable(r){return Os(ym(r))},fromDOMStream(r){return Os(bm(r))},fromNodeStream(r){return Os(gm(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')}},Os=r=>(r.next(),r);function*_m(r){let t,e=!1,n=[],i,s,o,a=0;function u(){return s==="peek"?Te(n,o)[0]:([i,n,a]=Te(n,o),i)}({cmd:s,size:o}=yield null);let c=Sa(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?c.next():c.next(o-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield u());while(o<a);while(!t)}catch(m){(e=!0)&&typeof c.throw=="function"&&c.throw(m)}finally{e===!1&&typeof c.return=="function"&&c.return(null)}return null}function ym(r){return pe(this,arguments,function*(){let e,n=!1,i=[],s,o,a,u=0;function c(){return o==="peek"?Te(i,a)[0]:([s,i,u]=Te(i,a),s)}({cmd:o,size:a}=yield yield $(null));let m=Ia(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-u)?yield $(m.next()):yield $(m.next(a-u)),!e&&s.byteLength>0&&(i.push(s),u+=s.byteLength),e||a<=u)do({cmd:o,size:a}=yield yield $(c()));while(a<u);while(!e)}catch(y){(n=!0)&&typeof m.throw=="function"&&(yield $(m.throw(y)))}finally{n===!1&&typeof m.return=="function"&&(yield $(m.return(new Uint8Array(0))))}return yield $(null)})}function bm(r){return pe(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,u=0;function c(){return o==="peek"?Te(i,a)[0]:([s,i,u]=Te(i,a),s)}({cmd:o,size:a}=yield yield $(null));let m=new Ta(r);try{do if({done:e,value:s}=Number.isNaN(a-u)?yield $(m.read()):yield $(m.read(a-u)),!e&&s.byteLength>0&&(i.push(k(s)),u+=s.byteLength),e||a<=u)do({cmd:o,size:a}=yield yield $(c()));while(a<u);while(!e)}catch(y){(n=!0)&&(yield $(m.cancel(y)))}finally{n===!1?yield $(m.cancel()):r.locked&&m.releaseLock()}return yield $(null)})}var Ta=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 A(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 A(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=k(e)),e})}},xa=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function gm(r){return pe(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,u=0,c=[],m;function y(){return o==="peek"?Te(c,a)[0]:([m,c,u]=Te(c,a),m)}if({cmd:o,size:a}=yield yield $(null),r.isTTY)return yield yield $(new Uint8Array(0)),yield $(null);try{e[0]=xa(r,"end"),e[1]=xa(r,"error");do{if(e[2]=xa(r,"readable"),[n,s]=yield $(Promise.race(e.map(I=>I[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-u)?(m=k(r.read(a-u)),m.byteLength<a-u&&(m=k(r.read()))):m=k(r.read()),m.byteLength>0&&(c.push(m),u+=m.byteLength)),i||a<=u)do({cmd:o,size:a}=yield yield $(y()));while(a<u)}while(!i)}finally{yield $(b(e,n==="error"?s:null))}return yield $(null);function b(I,Z){return m=c=null,new Promise((J,_t)=>{for(let[ft,yt]of I)r.off(ft,yt);try{let ft=r.destroy;ft&&ft.call(r,Z),Z=void 0}catch(ft){Z=ft||Z}finally{Z!=null?_t(Z):J()}})}})}var Vt;(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"})(Vt||(Vt={}));var Tt;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Tt||(Tt={}));var It;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(It||(It={}));var Jt;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Jt||(Jt={}));var G;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(G||(G={}));var ce;(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"})(ce||(ce={}));var rt;(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"})(rt||(rt={}));var h;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.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"})(h||(h={}));var Ne;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Ne||(Ne={}));var ja={};dn(ja,{clampIndex:()=>l_,clampRange:()=>Si,createElementComparator:()=>Gr});function $e(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=>$e(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var Da={};dn(Da,{BN:()=>hn,bignumToBigInt:()=>Rs,bignumToString:()=>$r,isArrowBigNumSymbol:()=>Tu});var Tu=Symbol.for("isArrowBigNum");function Ye(r,...t){return t.length===0?Object.setPrototypeOf(Y(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}Ye.prototype[Tu]=!0;Ye.prototype.toJSON=function(){return`"${$r(this)}"`};Ye.prototype.valueOf=function(){return Bu(this)};Ye.prototype.toString=function(){return $r(this)};Ye.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Bu(this);case"string":return $r(this);case"default":return Rs(this)}return $r(this)};function Un(...r){return Ye.apply(this,r)}function kn(...r){return Ye.apply(this,r)}function wi(...r){return Ye.apply(this,r)}Object.setPrototypeOf(Un.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(kn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(wi.prototype,Object.create(Uint32Array.prototype));Object.assign(Un.prototype,Ye.prototype,{constructor:Un,signed:!0,TypedArray:Int32Array,BigIntArray:yi});Object.assign(kn.prototype,Ye.prototype,{constructor:kn,signed:!1,TypedArray:Uint32Array,BigIntArray:Rn});Object.assign(wi.prototype,Ye.prototype,{constructor:wi,signed:!0,TypedArray:Uint32Array,BigIntArray:Rn});function Bu(r){let{buffer:t,byteOffset:e,length:n,signed:i}=r,s=new Rn(t,e,n),o=i&&s[s.length-1]&BigInt(1)<<BigInt(63),a=BigInt(o?1:0),u=BigInt(0);if(o){for(let c of s)a+=~c*(BigInt(1)<<BigInt(32)*u++);a*=BigInt(-1)}else for(let c of s)a+=c*(BigInt(1)<<BigInt(32)*u++);return a}var $r,Rs;As?(Rs=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Ba(r),$r=r=>r.byteLength===8?`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`:Ba(r)):($r=Ba,Rs=$r);function Ba(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),s=-1,o=n.length-1;do{for(e[0]=n[s=0];s<o;)n[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[s];n[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t||"0"}var hn=class{static new(t,e){switch(e){case!0:return new Un(t);case!1:return new kn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case yi:return new Un(t)}return t.byteLength===16?new wi(t):new kn(t)}static signed(t){return new Un(t)}static unsigned(t){return new kn(t)}static decimal(t){return new wi(t)}constructor(t,e){return hn.new(t,e)}};var Du,Eu,Ou,Ru,Mu,Uu,ku,Lu,Nu,Cu,Pu,Vu,Hu,zu,Wu,ju,$u,Yu,Xu,T=class{static isNull(t){return(t==null?void 0:t.typeId)===h.Null}static isInt(t){return(t==null?void 0:t.typeId)===h.Int}static isFloat(t){return(t==null?void 0:t.typeId)===h.Float}static isBinary(t){return(t==null?void 0:t.typeId)===h.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===h.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===h.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===h.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===h.Date}static isTime(t){return(t==null?void 0:t.typeId)===h.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===h.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===h.Interval}static isList(t){return(t==null?void 0:t.typeId)===h.List}static isStruct(t){return(t==null?void 0:t.typeId)===h.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===h.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===h.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===h.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===h.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===h.Dictionary}static isDenseUnion(t){return T.isUnion(t)&&t.mode===Tt.Dense}static isSparseUnion(t){return T.isUnion(t)&&t.mode===Tt.Sparse}get typeId(){return h.NONE}};Du=Symbol.toStringTag;T[Du]=(r=>(r.children=null,r.ArrayType=Array,r[Symbol.toStringTag]="DataType"))(T.prototype);var le=class extends T{toString(){return"Null"}get typeId(){return h.Null}};Eu=Symbol.toStringTag;le[Eu]=(r=>r[Symbol.toStringTag]="Null")(le.prototype);var Ot=class extends T{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return h.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}`}};Ou=Symbol.toStringTag;Ot[Ou]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Ot.prototype);var Ms=class extends Ot{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Us=class extends Ot{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},or=class extends Ot{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},ks=class extends Ot{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Ls=class extends Ot{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Ns=class extends Ot{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Cs=class extends Ot{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Ps=class extends Ot{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Ms.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Us.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(or.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(ks.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Ls.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Ns.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Cs.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Ps.prototype,"ArrayType",{value:BigUint64Array});var me=class extends T{constructor(t){super(),this.precision=t}get typeId(){return h.Float}get ArrayType(){switch(this.precision){case It.HALF:return Uint16Array;case It.SINGLE:return Float32Array;case It.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};Ru=Symbol.toStringTag;me[Ru]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(me.prototype);var Vs=class extends me{constructor(){super(It.HALF)}},Hs=class extends me{constructor(){super(It.SINGLE)}},zs=class extends me{constructor(){super(It.DOUBLE)}};Object.defineProperty(Vs.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Hs.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(zs.prototype,"ArrayType",{value:Float64Array});var Fr=class extends T{constructor(){super()}get typeId(){return h.Binary}toString(){return"Binary"}};Mu=Symbol.toStringTag;Fr[Mu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(Fr.prototype);var xr=class extends T{constructor(){super()}get typeId(){return h.Utf8}toString(){return"Utf8"}};Uu=Symbol.toStringTag;xr[Uu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(xr.prototype);var Tr=class extends T{constructor(){super()}get typeId(){return h.Bool}toString(){return"Bool"}};ku=Symbol.toStringTag;Tr[ku]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Tr.prototype);var Br=class extends T{constructor(t,e,n=128){super(),this.scale=t,this.precision=e,this.bitWidth=n}get typeId(){return h.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Lu=Symbol.toStringTag;Br[Lu]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(Br.prototype);var Dr=class extends T{constructor(t){super(),this.unit=t}get typeId(){return h.Date}toString(){return`Date${(this.unit+1)*32}<${Jt[this.unit]}>`}};Nu=Symbol.toStringTag;Dr[Nu]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(Dr.prototype);var Xe=class extends T{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return h.Time}toString(){return`Time${this.bitWidth}<${G[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Cu=Symbol.toStringTag;Xe[Cu]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Xe.prototype);var Er=class extends T{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return h.Timestamp}toString(){return`Timestamp<${G[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Pu=Symbol.toStringTag;Er[Pu]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(Er.prototype);var Or=class extends T{constructor(t){super(),this.unit=t}get typeId(){return h.Interval}toString(){return`Interval<${ce[this.unit]}>`}};Vu=Symbol.toStringTag;Or[Vu]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Or.prototype);var Ge=class extends T{constructor(t){super(),this.children=[t]}get typeId(){return h.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}};Hu=Symbol.toStringTag;Ge[Hu]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Ge.prototype);var bt=class extends T{constructor(t){super(),this.children=t}get typeId(){return h.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};zu=Symbol.toStringTag;bt[zu]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(bt.prototype);var Ke=class extends T{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 h.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Wu=Symbol.toStringTag;Ke[Wu]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Ke.prototype);var Rr=class extends T{constructor(t){super(),this.byteWidth=t}get typeId(){return h.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};ju=Symbol.toStringTag;Rr[ju]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Rr.prototype);var Je=class extends T{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return h.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}>`}};$u=Symbol.toStringTag;Je[$u]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Je.prototype);var qe=class extends T{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return h.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(", ")}}>`}};Yu=Symbol.toStringTag;qe[Yu]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(qe.prototype);var wm=(r=>()=>++r)(-1),Be=class extends T{constructor(t,e,n,i){super(),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?wm():typeof n=="number"?n:n.low}get typeId(){return h.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}>`}};Xu=Symbol.toStringTag;Be[Xu]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Be.prototype);function De(r){let t=r;switch(r.typeId){case h.Decimal:return r.bitWidth/32;case h.Timestamp:return 2;case h.Date:return 1+t.unit;case h.Interval:return 1+t.unit;case h.FixedSizeList:return t.listSize;case h.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 vm(this,t,e)}getVisitFnByTypeId(t,e=!0){return Ln(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 vm(r,t,e=!0){return typeof t=="number"?Ln(r,t,e):typeof t=="string"&&t in h?Ln(r,h[t],e):t&&t instanceof T?Ln(r,Gu(t),e):(t==null?void 0:t.type)&&t.type instanceof T?Ln(r,Gu(t.type),e):Ln(r,h.NONE,e)}function Ln(r,t,e=!0){let n=null;switch(t){case h.Null:n=r.visitNull;break;case h.Bool:n=r.visitBool;break;case h.Int:n=r.visitInt;break;case h.Int8:n=r.visitInt8||r.visitInt;break;case h.Int16:n=r.visitInt16||r.visitInt;break;case h.Int32:n=r.visitInt32||r.visitInt;break;case h.Int64:n=r.visitInt64||r.visitInt;break;case h.Uint8:n=r.visitUint8||r.visitInt;break;case h.Uint16:n=r.visitUint16||r.visitInt;break;case h.Uint32:n=r.visitUint32||r.visitInt;break;case h.Uint64:n=r.visitUint64||r.visitInt;break;case h.Float:n=r.visitFloat;break;case h.Float16:n=r.visitFloat16||r.visitFloat;break;case h.Float32:n=r.visitFloat32||r.visitFloat;break;case h.Float64:n=r.visitFloat64||r.visitFloat;break;case h.Utf8:n=r.visitUtf8;break;case h.Binary:n=r.visitBinary;break;case h.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case h.Date:n=r.visitDate;break;case h.DateDay:n=r.visitDateDay||r.visitDate;break;case h.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case h.Timestamp:n=r.visitTimestamp;break;case h.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case h.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case h.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case h.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case h.Time:n=r.visitTime;break;case h.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case h.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case h.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case h.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case h.Decimal:n=r.visitDecimal;break;case h.List:n=r.visitList;break;case h.Struct:n=r.visitStruct;break;case h.Union:n=r.visitUnion;break;case h.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case h.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case h.Dictionary:n=r.visitDictionary;break;case h.Interval:n=r.visitInterval;break;case h.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case h.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case h.FixedSizeList:n=r.visitFixedSizeList;break;case h.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${h[t]}'`)}function Gu(r){switch(r.typeId){case h.Null:return h.Null;case h.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?h.Int8:h.Uint8;case 16:return e?h.Int16:h.Uint16;case 32:return e?h.Int32:h.Uint32;case 64:return e?h.Int64:h.Uint64}return h.Int}case h.Float:switch(r.precision){case It.HALF:return h.Float16;case It.SINGLE:return h.Float32;case It.DOUBLE:return h.Float64}return h.Float;case h.Binary:return h.Binary;case h.Utf8:return h.Utf8;case h.Bool:return h.Bool;case h.Decimal:return h.Decimal;case h.Time:switch(r.unit){case G.SECOND:return h.TimeSecond;case G.MILLISECOND:return h.TimeMillisecond;case G.MICROSECOND:return h.TimeMicrosecond;case G.NANOSECOND:return h.TimeNanosecond}return h.Time;case h.Timestamp:switch(r.unit){case G.SECOND:return h.TimestampSecond;case G.MILLISECOND:return h.TimestampMillisecond;case G.MICROSECOND:return h.TimestampMicrosecond;case G.NANOSECOND:return h.TimestampNanosecond}return h.Timestamp;case h.Date:switch(r.unit){case Jt.DAY:return h.DateDay;case Jt.MILLISECOND:return h.DateMillisecond}return h.Date;case h.Interval:switch(r.unit){case ce.DAY_TIME:return h.IntervalDayTime;case ce.YEAR_MONTH:return h.IntervalYearMonth}return h.Interval;case h.Map:return h.Map;case h.List:return h.List;case h.Struct:return h.Struct;case h.Union:switch(r.mode){case Tt.Dense:return h.DenseUnion;case Tt.Sparse:return h.SparseUnion}return h.Union;case h.FixedSizeBinary:return h.FixedSizeBinary;case h.FixedSizeList:return h.FixedSizeList;case h.Dictionary:return h.Dictionary}throw new Error(`Unrecognized type '${h[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 Ea={};dn(Ea,{float64ToUint16:()=>vi,uint16ToFloat64:()=>Ws});var Ku=new Float64Array(1),Nn=new Uint32Array(Ku.buffer);function Ws(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 vi(r){if(r!==r)return 32256;Ku[0]=r;let t=(Nn[1]&2147483648)>>16&65535,e=Nn[1]&2146435072,n=0;return e>=1089470464?Nn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Nn[1]&1048575)>>10):e<=1056964608?(n=1048576+(Nn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Nn[1]&1048575)+512>>10),t|e|n&65535}var L=class extends D{};function j(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var Sm=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},Oa=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},Im=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},Am=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},Ju=(r,t,e,n)=>{if(e+1<t.length){let{[e]:i,[e+1]:s}=t;r.set(n.subarray(0,s-i),i)}},Fm=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Mr=({values:r},t,e)=>{r[t]=e},Ra=({values:r},t,e)=>{r[t]=e},qu=({values:r},t,e)=>{r[t]=vi(e)},xm=(r,t,e)=>{switch(r.type.precision){case It.HALF:return qu(r,t,e);case It.SINGLE:case It.DOUBLE:return Ra(r,t,e)}},js=({values:r},t,e)=>{Sm(r,t,e.valueOf())},$s=({values:r},t,e)=>{Oa(r,t*2,e.valueOf())},Ma=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},Tm=({values:r,valueOffsets:t},e,n)=>Ju(r,t,e,n),Bm=({values:r,valueOffsets:t},e,n)=>{Ju(r,t,e,jr(n))},Ua=(r,t,e)=>{r.type.unit===Jt.DAY?js(r,t,e):$s(r,t,e)},Ys=({values:r},t,e)=>Oa(r,t*2,e/1e3),Xs=({values:r},t,e)=>Oa(r,t*2,e),Gs=({values:r},t,e)=>Im(r,t*2,e),Ks=({values:r},t,e)=>Am(r,t*2,e),ka=(r,t,e)=>{switch(r.type.unit){case G.SECOND:return Ys(r,t,e);case G.MILLISECOND:return Xs(r,t,e);case G.MICROSECOND:return Gs(r,t,e);case G.NANOSECOND:return Ks(r,t,e)}},Js=({values:r},t,e)=>{r[t]=e},qs=({values:r},t,e)=>{r[t]=e},Zs=({values:r},t,e)=>{r[t]=e},Qs=({values:r},t,e)=>{r[t]=e},La=(r,t,e)=>{switch(r.type.unit){case G.SECOND:return Js(r,t,e);case G.MILLISECOND:return qs(r,t,e);case G.MICROSECOND:return Zs(r,t,e);case G.NANOSECOND:return Qs(r,t,e)}},Na=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},Dm=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=qt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],u=i[t+1];a<u;)s(n,a++,e[++o]);else for(let o=-1,a=i[t],u=i[t+1];a<u;)s(n,a++,e.get(++o))},Em=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=qt.getVisitFn(n),{[t]:o,[t+1]:a}=i,u=e instanceof Map?e.entries():Object.entries(e);for(let c of u)if(s(n,o,c),++o>=a)break},Om=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),Rm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),Mm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),Um=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),km=(r,t,e)=>{let n=r.type.children.map(s=>qt.getVisitFn(s.type)),i=e instanceof Map?Mm(t,e):e instanceof N?Rm(t,e):Array.isArray(e)?Om(t,e):Um(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},Lm=(r,t,e)=>{r.type.mode===Tt.Dense?Zu(r,t,e):Qu(r,t,e)},Zu=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];qt.visit(i,r.valueOffsets[t],e)},Qu=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];qt.visit(i,t,e)},Nm=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Ca=(r,t,e)=>{r.type.unit===ce.DAY_TIME?to(r,t,e):eo(r,t,e)},to=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},eo=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Cm=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=qt.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))};L.prototype.visitBool=j(Fm);L.prototype.visitInt=j(Mr);L.prototype.visitInt8=j(Mr);L.prototype.visitInt16=j(Mr);L.prototype.visitInt32=j(Mr);L.prototype.visitInt64=j(Mr);L.prototype.visitUint8=j(Mr);L.prototype.visitUint16=j(Mr);L.prototype.visitUint32=j(Mr);L.prototype.visitUint64=j(Mr);L.prototype.visitFloat=j(xm);L.prototype.visitFloat16=j(qu);L.prototype.visitFloat32=j(Ra);L.prototype.visitFloat64=j(Ra);L.prototype.visitUtf8=j(Bm);L.prototype.visitBinary=j(Tm);L.prototype.visitFixedSizeBinary=j(Ma);L.prototype.visitDate=j(Ua);L.prototype.visitDateDay=j(js);L.prototype.visitDateMillisecond=j($s);L.prototype.visitTimestamp=j(ka);L.prototype.visitTimestampSecond=j(Ys);L.prototype.visitTimestampMillisecond=j(Xs);L.prototype.visitTimestampMicrosecond=j(Gs);L.prototype.visitTimestampNanosecond=j(Ks);L.prototype.visitTime=j(La);L.prototype.visitTimeSecond=j(Js);L.prototype.visitTimeMillisecond=j(qs);L.prototype.visitTimeMicrosecond=j(Zs);L.prototype.visitTimeNanosecond=j(Qs);L.prototype.visitDecimal=j(Na);L.prototype.visitList=j(Dm);L.prototype.visitStruct=j(km);L.prototype.visitUnion=j(Lm);L.prototype.visitDenseUnion=j(Zu);L.prototype.visitSparseUnion=j(Qu);L.prototype.visitDictionary=j(Nm);L.prototype.visitInterval=j(Ca);L.prototype.visitIntervalDayTime=j(to);L.prototype.visitIntervalYearMonth=j(eo);L.prototype.visitFixedSizeList=j(Cm);L.prototype.visitMap=j(Em);var qt=new L;var Ze=Symbol.for("parent"),Cn=Symbol.for("rowIndex"),Yr=class{constructor(t,e){return this[Ze]=t,this[Cn]=e,new Proxy(this,new Va)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Cn],e=this[Ze],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=Ut.visit(e.children[s],t);return i}toString(){return`{${[...this].map(([t,e])=>`${$e(t)}: ${$e(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Pa(this[Ze],this[Cn])}},Pa=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,Ut.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Yr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ze]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Cn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Va=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ze].type.children.map(e=>e.name)}has(t,e){return t[Ze].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Ze].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[Ze].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=Ut.visit(t[Ze].children[n],t[Cn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ze].type.children.findIndex(s=>s.name===e);return i!==-1?(qt.visit(t[Ze].children[i],t[Cn],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 V(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Pm=(r,t)=>864e5*r[t],Ha=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),Vm=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,Hm=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,td=r=>new Date(r),zm=(r,t)=>td(Pm(r,t)),Wm=(r,t)=>td(Ha(r,t)),jm=(r,t)=>null,ed=(r,t,e)=>{if(e+1>=t.length)return null;let n=t[e],i=t[e+1];return r.subarray(n,i)},$m=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},rd=({values:r},t)=>zm(r,t),nd=({values:r},t)=>Wm(r,t*2),Xr=({stride:r,values:t},e)=>t[r*e],Ym=({stride:r,values:t},e)=>Ws(t[r*e]),id=({values:r},t)=>r[t],Xm=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Gm=({values:r,valueOffsets:t},e)=>ed(r,t,e),Km=({values:r,valueOffsets:t},e)=>{let n=ed(r,t,e);return n!==null?_i(n):null},Jm=({values:r},t)=>r[t],qm=({type:r,values:t},e)=>r.precision!==It.HALF?t[e]:Ws(t[e]),Zm=(r,t)=>r.type.unit===Jt.DAY?rd(r,t):nd(r,t),sd=({values:r},t)=>1e3*Ha(r,t*2),od=({values:r},t)=>Ha(r,t*2),ad=({values:r},t)=>Vm(r,t*2),cd=({values:r},t)=>Hm(r,t*2),Qm=(r,t)=>{switch(r.type.unit){case G.SECOND:return sd(r,t);case G.MILLISECOND:return od(r,t);case G.MICROSECOND:return ad(r,t);case G.NANOSECOND:return cd(r,t)}},ld=({values:r},t)=>r[t],ud=({values:r},t)=>r[t],dd=({values:r},t)=>r[t],fd=({values:r},t)=>r[t],t_=(r,t)=>{switch(r.type.unit){case G.SECOND:return ld(r,t);case G.MILLISECOND:return ud(r,t);case G.MICROSECOND:return dd(r,t);case G.NANOSECOND:return fd(r,t)}},e_=({values:r,stride:t},e)=>hn.decimal(r.subarray(t*e,t*(e+1))),r_=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,u=i[0].slice(s,o-s);return new N([u])},n_=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new ar(o.slice(i,s-i))},i_=(r,t)=>new Yr(r,t),s_=(r,t)=>r.type.mode===Tt.Dense?hd(r,t):pd(r,t),hd=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Ut.visit(n,r.valueOffsets[t])},pd=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Ut.visit(n,t)},o_=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},a_=(r,t)=>r.type.unit===ce.DAY_TIME?md(r,t):_d(r,t),md=({values:r},t)=>r.subarray(2*t,2*(t+1)),_d=({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},c_=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new N([s])};O.prototype.visitNull=V(jm);O.prototype.visitBool=V($m);O.prototype.visitInt=V(Jm);O.prototype.visitInt8=V(Xr);O.prototype.visitInt16=V(Xr);O.prototype.visitInt32=V(Xr);O.prototype.visitInt64=V(id);O.prototype.visitUint8=V(Xr);O.prototype.visitUint16=V(Xr);O.prototype.visitUint32=V(Xr);O.prototype.visitUint64=V(id);O.prototype.visitFloat=V(qm);O.prototype.visitFloat16=V(Ym);O.prototype.visitFloat32=V(Xr);O.prototype.visitFloat64=V(Xr);O.prototype.visitUtf8=V(Km);O.prototype.visitBinary=V(Gm);O.prototype.visitFixedSizeBinary=V(Xm);O.prototype.visitDate=V(Zm);O.prototype.visitDateDay=V(rd);O.prototype.visitDateMillisecond=V(nd);O.prototype.visitTimestamp=V(Qm);O.prototype.visitTimestampSecond=V(sd);O.prototype.visitTimestampMillisecond=V(od);O.prototype.visitTimestampMicrosecond=V(ad);O.prototype.visitTimestampNanosecond=V(cd);O.prototype.visitTime=V(t_);O.prototype.visitTimeSecond=V(ld);O.prototype.visitTimeMillisecond=V(ud);O.prototype.visitTimeMicrosecond=V(dd);O.prototype.visitTimeNanosecond=V(fd);O.prototype.visitDecimal=V(e_);O.prototype.visitList=V(r_);O.prototype.visitStruct=V(i_);O.prototype.visitUnion=V(s_);O.prototype.visitDenseUnion=V(hd);O.prototype.visitSparseUnion=V(pd);O.prototype.visitDictionary=V(o_);O.prototype.visitInterval=V(a_);O.prototype.visitIntervalDayTime=V(md);O.prototype.visitIntervalYearMonth=V(_d);O.prototype.visitFixedSizeList=V(c_);O.prototype.visitMap=V(n_);var Ut=new O;var Ce=Symbol.for("keys"),Pn=Symbol.for("vals"),ar=class{constructor(t){return this[Ce]=new N([t.children[0]]).memoize(),this[Pn]=t.children[1],new Proxy(this,new Wa)}[Symbol.iterator](){return new za(this[Ce],this[Pn])}get size(){return this[Ce].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Ce],e=this[Pn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=Ut.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${$e(t)}: ${$e(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},za=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),Ut.visit(this.vals,t)]})}},Wa=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ce].toArray().map(String)}has(t,e){return t[Ce].includes(e)}getOwnPropertyDescriptor(t,e){if(t[Ce].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Ce].indexOf(e);if(n!==-1){let i=Ut.visit(Reflect.get(t,Pn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ce].indexOf(e);return i!==-1?(qt.visit(Reflect.get(t,Pn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(ar.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ce]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Pn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function l_(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var yd;function Si(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&&(yd=s,s=o,o=yd),o>i&&(o=i),n?n(r,s,o):[s,o]}var bd=r=>r!==r;function Gr(r){if(typeof r!=="object"||r===null)return bd(r)?bd: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?Aa(r,e):!1:r instanceof Map?d_(r):Array.isArray(r)?u_(r):r instanceof N?f_(r):h_(r,!0)}function u_(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Gr(r[e]);return ro(t)}function d_(r){let t=-1,e=[];for(let n of r.values())e[++t]=Gr(n);return ro(e)}function f_(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Gr(r.get(e));return ro(t)}function h_(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]=Gr(r[e[i]]);return ro(n,e)}function ro(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return p_(r,e);case Map:return gd(r,e,e.keys());case ar:case Yr:case Object:case void 0:return gd(r,e,t||Object.keys(e))}return e instanceof N?m_(r,e):!1}}function p_(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 m_(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 gd(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,u=s.next(),c=n.next(),m=i.next();for(;o<a&&!c.done&&!m.done&&!u.done&&!(c.value!==m.value||!r[o](u.value));++o,c=n.next(),m=i.next(),u=s.next());return o===a&&c.done&&m.done&&u.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var $a={};dn($a,{BitIterator:()=>pn,getBit:()=>wd,getBool:()=>io,packBools:()=>mn,popcnt_array:()=>vd,popcnt_bit_range:()=>Ii,popcnt_uint32:()=>no,setBool:()=>__,truncateBitmap:()=>Vn});function io(r,t,e,n){return(e&1<<n)!==0}function wd(r,t,e,n){return(e&1<<n)>>n}function __(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Vn(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):mn(new pn(e,r,t,null,io)).subarray(0,n)),i}return e}function mn(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 pn=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 Ii(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new pn(r,t,e-t,r,wd))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return Ii(r,t,i)+Ii(r,n,e)+vd(r,i>>3,n-i>>3)}function vd(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+=no(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=no(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=no(s.getUint8(i)),i+=1;return n}function no(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 y_=-1,it=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 u;s instanceof it?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=De(t),s&&((u=s[0])&&(this.valueOffsets=u),(u=s[1])&&(this.values=u),(u=s[2])&&(this.nullBitmap=u),(u=s[3])&&(this.typeIds=u))),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<=y_&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-Ii(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:u}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:u,_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 it(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,u=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,u,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===h.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(e&-8))-1,n>0&&i.set(Vn(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[Ne.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[Ne.TYPE])&&(o[Ne.TYPE]=s.subarray(t,t+e)),(s=o[Ne.OFFSET])&&(o[Ne.OFFSET]=s.subarray(t,t+e+1))||(s=o[Ne.DATA])&&(o[Ne.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};it.prototype.children=Object.freeze([]);var _n=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 it(e,n,i,0)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.data),s=k(t.nullBitmap),o=fn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new it(e,n,a,u,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.data),s=k(t.nullBitmap),o=fn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new it(e,n,a,u,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=k(t.nullBitmap),o=fn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new it(e,n,a,u,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=k(t.nullBitmap),{length:o=i.reduce((u,{length:c})=>Math.max(u,c),0),nullCount:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=k(t.nullBitmap),o=Y(e.ArrayType,t.typeIds),{["length"]:a=o.length,["nullCount"]:u=t.nullBitmap?-1:0}=t;if(T.isSparseUnion(e))return new it(e,n,a,u,[void 0,void 0,s,o],i);let c=fn(t.valueOffsets);return new it(e,n,a,u,[c,void 0,s,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.indices.ArrayType,t.data),{["dictionary"]:o=new N([new _n().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new it(e,n,a,u,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=k(t.nullBitmap),s=Y(e.ArrayType,t.data),{["length"]:o=s.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new _n().visit({type:e.valueType})}=t,s=k(t.nullBitmap),{["length"]:o=i.length/De(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new it(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new _n().visit({type:e.childType})}=t,s=k(t.nullBitmap),o=fn(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new it(e,n,a,u,[o,void 0,s],[i])}};function P(r){return new _n().visit(r)}var Ai=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 so(r){return r.reduce((t,e)=>t+e.nullCount,0)}function oo(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function ao(r,t,e,n){let i=[];for(let s=-1,o=r.length;++s<o;){let a=r[s],u=t[s],{length:c}=a;if(u>=n)break;if(e>=u+c)continue;if(u>=e&&u+c<=n){i.push(a);continue}let m=Math.max(0,e-u),y=Math.min(n-u,c);i.push(a.slice(m,y-m))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Ya(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 Fi(r,t){return r.getValid(t)}function Kr(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Ya(n,this._offsets,e,t)}}function co(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=Ya(s,this._offsets,n,e);return t=void 0,o}}function lo(r){let t;function e(n,i,s){let o=s,a=0,u=0;for(let c=i-1,m=n.length;++c<m;){let y=n[c];if(~(a=r(y,t,o)))return u+a;o=0,u+=y.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):Ya(s,this._offsets,i,e);return t=void 0,o}}var R=class extends D{};function b_(r,t){return t===null&&r.length>0?0:-1}function g_(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new pn(e,r.offset+(t||0),r.length,e,io)){if(!i)return n;++n}return-1}function X(r,t,e){if(t===void 0)return-1;if(t===null)return g_(r,e);let n=Ut.getVisitFn(r),i=Gr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function Sd(r,t,e){let n=Ut.getVisitFn(r),i=Gr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}R.prototype.visitNull=b_;R.prototype.visitBool=X;R.prototype.visitInt=X;R.prototype.visitInt8=X;R.prototype.visitInt16=X;R.prototype.visitInt32=X;R.prototype.visitInt64=X;R.prototype.visitUint8=X;R.prototype.visitUint16=X;R.prototype.visitUint32=X;R.prototype.visitUint64=X;R.prototype.visitFloat=X;R.prototype.visitFloat16=X;R.prototype.visitFloat32=X;R.prototype.visitFloat64=X;R.prototype.visitUtf8=X;R.prototype.visitBinary=X;R.prototype.visitFixedSizeBinary=X;R.prototype.visitDate=X;R.prototype.visitDateDay=X;R.prototype.visitDateMillisecond=X;R.prototype.visitTimestamp=X;R.prototype.visitTimestampSecond=X;R.prototype.visitTimestampMillisecond=X;R.prototype.visitTimestampMicrosecond=X;R.prototype.visitTimestampNanosecond=X;R.prototype.visitTime=X;R.prototype.visitTimeSecond=X;R.prototype.visitTimeMillisecond=X;R.prototype.visitTimeMicrosecond=X;R.prototype.visitTimeNanosecond=X;R.prototype.visitDecimal=X;R.prototype.visitList=X;R.prototype.visitStruct=X;R.prototype.visitUnion=X;R.prototype.visitDenseUnion=Sd;R.prototype.visitSparseUnion=Sd;R.prototype.visitDictionary=X;R.prototype.visitInterval=X;R.prototype.visitIntervalDayTime=X;R.prototype.visitIntervalYearMonth=X;R.prototype.visitFixedSizeList=X;R.prototype.visitMap=X;var yn=new R;var M=class extends D{};function H(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===h.Timestamp||t instanceof Ot&&t.bitWidth!==64||t instanceof Xe&&t.bitWidth!==64||t instanceof me&&t.precision!==It.HALF))return new Ai(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new Ai(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Xa(o)})}var Xa=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}};M.prototype.visitNull=H;M.prototype.visitBool=H;M.prototype.visitInt=H;M.prototype.visitInt8=H;M.prototype.visitInt16=H;M.prototype.visitInt32=H;M.prototype.visitInt64=H;M.prototype.visitUint8=H;M.prototype.visitUint16=H;M.prototype.visitUint32=H;M.prototype.visitUint64=H;M.prototype.visitFloat=H;M.prototype.visitFloat16=H;M.prototype.visitFloat32=H;M.prototype.visitFloat64=H;M.prototype.visitUtf8=H;M.prototype.visitBinary=H;M.prototype.visitFixedSizeBinary=H;M.prototype.visitDate=H;M.prototype.visitDateDay=H;M.prototype.visitDateMillisecond=H;M.prototype.visitTimestamp=H;M.prototype.visitTimestampSecond=H;M.prototype.visitTimestampMillisecond=H;M.prototype.visitTimestampMicrosecond=H;M.prototype.visitTimestampNanosecond=H;M.prototype.visitTime=H;M.prototype.visitTimeSecond=H;M.prototype.visitTimeMillisecond=H;M.prototype.visitTimeMicrosecond=H;M.prototype.visitTimeNanosecond=H;M.prototype.visitDecimal=H;M.prototype.visitList=H;M.prototype.visitStruct=H;M.prototype.visitUnion=H;M.prototype.visitDenseUnion=H;M.prototype.visitSparseUnion=H;M.prototype.visitDictionary=H;M.prototype.visitInterval=H;M.prototype.visitIntervalDayTime=H;M.prototype.visitIntervalYearMonth=H;M.prototype.visitFixedSizeList=H;M.prototype.visitMap=H;var Hn=new M;var w_=(r,t)=>r+t,cr=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===G.SECOND?4:8}visitInterval(t,e){return(t.type.unit+1)*4}visitStruct(t,e){return t.children.reduce((n,i)=>n+Ee.visit(i,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((n,i)=>n+Ee.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)}},v_=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),S_=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),I_=({valueOffsets:r,stride:t,children:e},n)=>{let i=e[0],{[n*t]:s}=r,{[n*t+1]:o}=r,a=Ee.getVisitFn(i.type),u=i.slice(s,o-s),c=8;for(let m=-1,y=o-s;++m<y;)c+=a(u,m);return c},A_=({stride:r,children:t},e)=>{let n=t[0],i=n.slice(e*r,r),s=Ee.getVisitFn(n.type),o=0;for(let a=-1,u=i.length;++a<u;)o+=s(i,a);return o},F_=(r,t)=>r.type.mode===Tt.Dense?Id(r,t):Ad(r,t),Id=({type:r,children:t,typeIds:e,valueOffsets:n},i)=>{let s=r.typeIdToChildIndex[e[i]];return 8+Ee.visit(t[s],n[i])},Ad=({children:r},t)=>4+Ee.visitMany(r,r.map(()=>t)).reduce(w_,0);cr.prototype.visitUtf8=v_;cr.prototype.visitBinary=S_;cr.prototype.visitList=I_;cr.prototype.visitFixedSizeList=A_;cr.prototype.visitUnion=F_;cr.prototype.visitDenseUnion=Id;cr.prototype.visitSparseUnion=Ad;var Ee=new cr;var Fd,xd={},Td={},N=class{constructor(t){var e,n,i;let s=t[0]instanceof N?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof it)))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:u,indexOf:c,byteLength:m}=xd[o.typeId],y=s[0];this.isValid=b=>Fi(y,b),this.get=b=>a(y,b),this.set=(b,I)=>u(y,b,I),this.indexOf=b=>c(y,b),this.getByteLength=b=>m(y,b),this._offsets=[0,y.length];break}default:Object.setPrototypeOf(this,Td[o.typeId]),this._offsets=oo(s);break}this.data=s,this.type=o,this.stride=De(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=so(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${h[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 Hn.visit(this)}concat(...t){return new N(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new N(Si(this,t,e,({data:n,_offsets:i},s,o)=>ao(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case h.Int:case h.Float:case h.Decimal:case h.Time:case h.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a})=>(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 N(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return T.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(T.isDictionary(this.type)){let t=new zn(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new N(e)}return new zn(this)}unmemoize(){if(T.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 N(e)}return this}};Fd=Symbol.toStringTag;N[Fd]=(r=>{r.type=T.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(h).map(e=>h[e]).filter(e=>typeof e=="number"&&e!==h.NONE);for(let e of t){let n=Ut.getVisitFnByTypeId(e),i=qt.getVisitFnByTypeId(e),s=yn.getVisitFnByTypeId(e),o=Ee.getVisitFnByTypeId(e);xd[e]={get:n,set:i,indexOf:s,byteLength:o},Td[e]=Object.create(r,{isValid:{value:Kr(Fi)},get:{value:Kr(Ut.getVisitFnByTypeId(e))},set:{value:co(qt.getVisitFnByTypeId(e))},indexOf:{value:lo(yn.getVisitFnByTypeId(e))},getByteLength:{value:Kr(Ee.getVisitFnByTypeId(e))}})}return"Vector"})(N.prototype);var zn=class extends N{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 u=e.call(this,o);return s[o]=u,u}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new zn(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new N(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Bd(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 ${
|
|
3
|
+
case ${x_(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 F_(r){return typeof r!="bigint"?$e(r):As?`${$e(r)}n`:`"${$e(r)}"`}var Ga=(r,t)=>(r*t+63&-64||64)/t,x_=(r,t=0)=>r.length>=t?r.subarray(0,t):Mn(new r.constructor(t),r,0),Jr=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?Ga(n*1,this.BYTES_PER_ELEMENT):Ga(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Ga(t*this.stride,this.BYTES_PER_ELEMENT);let e=x_(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=Mn(new this.ArrayType(t),this.buffer)}};Jr.prototype.offset=0;var Ur=class extends Jr{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}},Wn=class extends Ur{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()}},jn=class extends Ur{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 At=class{constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=De(t),this._nulls=new Wn,e&&e.length>0&&(this._isValid=Td(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 N([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,u)=>a+u.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:u,_offsets:c,_values:m,_nulls:y}=this;(e=u==null?void 0:u.flush(o))?i=c==null?void 0:c.flush(o):(i=c==null?void 0:c.flush(o))?t=m==null?void 0:m.flush(c.last()):t=m==null?void 0:m.flush(o),a>0&&(n=y==null?void 0:y.flush(o));let b=this.children.map(I=>I.flush());return this.clear(),P({type:s,length:o,nullCount:a,children:b,child:b[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}};At.prototype.length=1;At.prototype.stride=1;At.prototype.children=null;At.prototype.finished=!1;At.prototype.nullValues=null;At.prototype._isValid=()=>!0;var Ht=class extends At{constructor(t){super(t),this._values=new Ur(new this.ArrayType(0),this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},lr=class extends At{constructor(t){super(t),this._pendingLength=0,this._offsets=new jn}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof ar?e[Ne].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 bn=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 ur=new Int32Array(2),uo=new Float32Array(ur.buffer),fo=new Float64Array(ur.buffer),$n=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var kt=class{constructor(t,e){this.low=t|0,this.high=e|0}static create(t,e){return t==0&&e==0?kt.ZERO:new kt(t,e)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(t){return this.low==t.low&&this.high==t.high}};kt.ZERO=new kt(0,0);var xi;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(xi||(xi={}));var ue=class{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new ue(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 kt(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new kt(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return ur[0]=this.readInt32(t),uo[0]}readFloat64(t){return ur[$n?0:1]=this.readInt32(t),ur[$n?1:0]=this.readInt32(t+4),fo[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){uo[0]=e,this.writeInt32(t,ur[0])}writeFloat64(t,e){fo[0]=e,this.writeInt32(t,ur[$n?0:1]),this.writeInt32(t+4,ur[$n?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===xi.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 u=this.readUint8(t+s++);if(a<224)o=(a&31)<<6|u&63;else{let c=this.readUint8(t+s++);if(a<240)o=(a&15)<<12|(u&63)<<6|c&63;else{let m=this.readUint8(t+s++);o=(a&7)<<18|(u&63)<<12|(c&63)<<6|m&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 kt.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 kr=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=ue.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=kr.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=ue.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 u=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(u)){for(let c=2;c<s;c+=2)if(this.bb.readInt16(a+c)!=this.bb.readInt16(u+c))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 kt.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 gt=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 gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new gt).__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 gt.startKeyValue(t),gt.addKey(t,e),gt.addValue(t,n),gt.endKeyValue(t)}};var qr;(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"})(qr||(qr={}));var Zr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Zr||(Zr={}));var Ti;(function(r){r[r.DenseArray=0]="DenseArray"})(Ti||(Ti={}));var zt=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 zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new zt).__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 zt.startInt(t),zt.addBitWidth(t,e),zt.addIsSigned(t,n),zt.endInt(t)}};var Oe=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 Oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new Oe).__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 zt).__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):Ti.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,Ti.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var dr=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 dr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new dr).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return dr.startBinary(t),dr.endBinary(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 getRootAsBool(t,e){return(e||new fr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new fr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return fr.startBool(t),fr.endBool(t)}};var Bi;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Bi||(Bi={}));var _e=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 _e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new _e).__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):Bi.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Bi.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return _e.startDate(t),_e.addUnit(t,e),_e.endDate(t)}};var Wt=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 Wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new Wt).__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 Wt.startDecimal(t),Wt.addPrecision(t,e),Wt.addScale(t,n),Wt.addBitWidth(t,i),Wt.endDecimal(t)}};var Qr;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Qr||(Qr={}));var ye=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 ye).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new ye).__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 ye.startFixedSizeBinary(t),ye.addByteWidth(t,e),ye.endFixedSizeBinary(t)}};var be=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 be).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new be).__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 be.startFixedSizeList(t),be.addListSize(t,e),be.endFixedSizeList(t)}};var Di;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(Di||(Di={}));var ge=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 ge).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new ge).__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):Di.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,Di.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return ge.startFloatingPoint(t),ge.addPrecision(t,e),ge.endFloatingPoint(t)}};var Ei;(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"})(Ei||(Ei={}));var we=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 we).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new we).__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):Ei.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Ei.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return we.startInterval(t),we.addUnit(t,e),we.endInterval(t)}};var hr=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 hr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new hr).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return hr.startList(t),hr.endList(t)}};var ve=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 ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new ve).__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 ve.startMap(t),ve.addKeysSorted(t,e),ve.endMap(t)}};var pr=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 pr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new pr).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return pr.startNull(t),pr.endNull(t)}};var mr=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 mr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new mr).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return mr.startStruct_(t),mr.endStruct_(t)}};var te=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 te).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new te).__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):Qr.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,Qr.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return te.startTime(t),te.addUnit(t,e),te.addBitWidth(t,n),te.endTime(t)}};var ee=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 ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new ee).__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):Qr.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,Qr.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return ee.startTimestamp(t),ee.addUnit(t,e),ee.addTimezone(t,n),ee.endTimestamp(t)}};var Oi;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Oi||(Oi={}));var jt=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 jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new jt).__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):Oi.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,Oi.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 jt.startUnion(t),jt.addMode(t,e),jt.addTypeIds(t,n),jt.endUnion(t)}};var _r=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 _r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new _r).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return _r.startUtf8(t),_r.endUtf8(t)}};var Ft;(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"})(Ft||(Ft={}));var Lt=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 Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new Lt).__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):Ft.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 Oe).__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 Lt).__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 gt).__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,Ft.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 Bt=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 Bt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new Bt).__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):Zr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Lt).__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 gt).__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,Zr.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 Bt.startSchema(t),Bt.addEndianness(t,e),Bt.addFields(t,n),Bt.addCustomMetadata(t,i),Bt.addFeatures(t,s),Bt.endSchema(t)}};var re=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 re).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new re).__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):qr.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Bt).__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 bn).__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 bn).__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 gt).__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,qr.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 q=class{constructor(t=[],e,n){this.fields=t||[],this.metadata=e||new Map,n||(n=Ka(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 q(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new q(e,this.metadata)}assign(...t){let e=t[0]instanceof q?t[0]:Array.isArray(t[0])?new q(t[0]):new q(t),n=[...this.fields],i=po(po(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{let u=n.findIndex(c=>c.name===a.name);return~u?(n[u]=a.clone({metadata:po(po(new Map,n[u].metadata),a.metadata)}))&&!1:!0}),o=Ka(s,new Map);return new q([...n,...s],i,new Map([...this.dictionaries,...o]))}};q.prototype.fields=null;q.prototype.metadata=null;q.prototype.dictionaries=null;var z=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 z(`${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],z.new(e,n,i,s)}};z.prototype.type=null;z.prototype.name=null;z.prototype.nullable=null;z.prototype.metadata=null;function po(r,t){return new Map([...r||new Map,...t||new Map])}function Ka(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(T.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&&Ka(s.children,t)}return t}var Bd=kt,T_=kr,B_=ue,Lr=class{constructor(t,e=Vt.V4,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}static decode(t){t=new B_(k(t));let e=re.getRootAsFooter(t),n=q.decode(e.schema());return new Ja(n,e)}static encode(t){let e=new T_,n=q.encode(e,t.schema);re.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())tr.encode(e,o);let i=e.endVector();re.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())tr.encode(e,o);let s=e.endVector();return re.startFooter(e),re.addSchema(e,n),re.addVersion(e,Vt.V4),re.addRecordBatches(e,i),re.addDictionaries(e,s),re.finishFooterBuffer(e,re.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 Ja=class extends Lr{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 tr.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return tr.decode(e)}return null}},tr=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 tr(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=new Bd(e.offset,0),s=new Bd(e.bodyLength,0);return bn.createBlock(t,i,n,s)}};var wt=Object.freeze({done:!0,value:void 0}),Ri=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},gn=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())}},mo=class extends gn{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return A(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(wt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Kt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Kt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return A(this,void 0,void 0,function*(){return yield this.abort(t),wt})}return(t){return A(this,void 0,void 0,function*(){return yield this.close(),wt})}read(t){return A(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return A(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(wt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var yr=class extends mo{write(t){if((t=k(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?_i(this.toUint8Array(!0)):this.toUint8Array(!1).then(_i)}toUint8Array(t=!1){return t?Te(this._values)[0]:(()=>A(this,void 0,void 0,function*(){var e,n;let i=[],s=0;try{for(var o=Ue(this),a;a=yield o.next(),!a.done;){let u=a.value;i.push(u),s+=u.byteLength}}catch(u){e={error:u}}finally{try{a&&!a.done&&(n=o.return)&&(yield n.call(o))}finally{if(e)throw e.error}}return Te(i,s)[0]}))()}},br=class{constructor(t){t&&(this.source=new qa(Kt.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)}},Se=class{constructor(t){t instanceof Se?this.source=t.source:t instanceof yr?this.source=new Nr(Kt.fromAsyncIterable(t)):Es(t)?this.source=new Nr(Kt.fromNodeStream(t)):bi(t)?this.source=new Nr(Kt.fromDOMStream(t)):Bs(t)?this.source=new Nr(Kt.fromDOMStream(t.body)):We(t)?this.source=new Nr(Kt.fromIterable(t)):ze(t)?this.source=new Nr(Kt.fromAsyncIterable(t)):ke(t)&&(this.source=new Nr(Kt.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)}},qa=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)||wt)}return(t){return Object.create(this.source.return&&this.source.return(t)||wt)}},Nr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return A(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return A(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return A(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return A(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return A(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||wt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return A(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||wt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var Mi=class extends br{constructor(t,e){super(),this.position=0,this.buffer=k(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}}},tn=class extends Se{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>A(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return A(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 A(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 A(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,u=Math.min(n,s+Math.min(n-s,t)),c=new Uint8Array(Math.max(0,(this.position=u)-s));for(;(s+=a)<u&&(o+=a)<c.byteLength;)({bytesRead:a}=yield e.read(c,o,c.byteLength-o,s));return c}return null})}readAt(t,e){return A(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 A(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return A(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return A(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Qa={};dn(Qa,{BaseInt64:()=>Ui,Int128:()=>Ie,Int64:()=>$t,Uint64:()=>st});function Yn(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var Xn=8,Za=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Ui=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`${Yn(this.buffer[1])} ${Yn(this.buffer[0])}`}},st=class extends Ui{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return st.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return st.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new st(e);for(let s=0;s<n;){let o=Xn<n-s?Xn:n-s,a=new st(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),u=new st(new Uint32Array([Za[o],0]));i.times(u),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;)st.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new st(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new st(new Uint32Array(t.buffer)).plus(e)}},$t=class extends Ui{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 $t.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return $t.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new $t(e);for(let o=n?1:0;o<i;){let a=Xn<i-o?Xn:i-o,u=new $t(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),c=new $t(new Uint32Array([Za[a],0]));s.times(c),s.plus(u),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;)$t.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new $t(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new $t(new Uint32Array(t.buffer)).plus(e)}},Ie=class{constructor(t){this.buffer=t}high(){return new $t(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new $t(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 st(new Uint32Array([this.buffer[3],0])),n=new st(new Uint32Array([this.buffer[2],0])),i=new st(new Uint32Array([this.buffer[1],0])),s=new st(new Uint32Array([this.buffer[0],0])),o=new st(new Uint32Array([t.buffer[3],0])),a=new st(new Uint32Array([t.buffer[2],0])),u=new st(new Uint32Array([t.buffer[1],0])),c=new st(new Uint32Array([t.buffer[0],0])),m=st.multiply(s,c);this.buffer[0]=m.low();let y=new st(new Uint32Array([m.high(),0]));return m=st.multiply(i,c),y.plus(m),m=st.multiply(s,u),y.plus(m),this.buffer[1]=y.low(),this.buffer[3]=y.lessThan(m)?1:0,this.buffer[2]=y.high(),new st(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(st.multiply(n,c)).plus(st.multiply(i,u)).plus(st.multiply(s,a)),this.buffer[3]+=st.multiply(e,c).plus(st.multiply(n,u)).plus(st.multiply(i,a)).plus(st.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`${Yn(this.buffer[3])} ${Yn(this.buffer[2])} ${Yn(this.buffer[1])} ${Yn(this.buffer[0])}`}static multiply(t,e){return new Ie(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Ie(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Ie.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Ie.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new Ie(e);for(let o=n?1:0;o<i;){let a=Xn<i-o?Xn:i-o,u=new Ie(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),c=new Ie(new Uint32Array([Za[a],0,0,0]));s.times(c),s.plus(u),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;)Ie.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var ki=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 z?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return P({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({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 P({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 P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({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 P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===Tt.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({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 P({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 P({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 P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({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 P({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)}},_o=class extends ki{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):mn(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return Y(Uint8Array,Y(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return Y(Uint8Array,Y(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return T.isTimestamp(t)?Y(Uint8Array,$t.convertArray(n[e])):(T.isInt(t)||T.isTime(t))&&t.bitWidth===64?Y(Uint8Array,$t.convertArray(n[e])):T.isDate(t)&&t.unit===Jt.MILLISECOND?Y(Uint8Array,$t.convertArray(n[e])):T.isDecimal(t)?Y(Uint8Array,Ie.convertArray(n[e])):T.isBinary(t)||T.isFixedSizeBinary(t)?D_(n[e]):T.isBool(t)?mn(n[e]):T.isUtf8(t)?jr(n[e].join("")):Y(Uint8Array,Y(t.ArrayType,n[e].map(i=>+i)))}};function D_(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 Gn=class extends lr{constructor(t){super(t),this._values=new Jr(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,k(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 u=a.length;i.set(a,s),n.set(o,u),s+=u}}};var yo=class extends At{constructor(t){super(t),this._values=new Wn}setValue(t,e){this._values.set(t,+e)}};var wn=class extends Ht{};wn.prototype._setValue=Ua;var Li=class extends wn{};Li.prototype._setValue=js;var Ni=class extends wn{};Ni.prototype._setValue=$s;var Ci=class extends Ht{};Ci.prototype._setValue=Na;var bo=class extends At{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new Be(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=vn({type:this.type.indices,nullValues:e}),this.dictionary=vn({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 Pi=class extends Ht{};Pi.prototype._setValue=Ma;var go=class extends At{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 Je(this.type.listSize,new z(e,t.type,!0)),n}};var Sn=class extends Ht{setValue(t,e){this._values.set(t,e)}},wo=class extends Sn{setValue(t,e){super.setValue(t,vi(e))}},vo=class extends Sn{},So=class extends Sn{};var In=class extends Ht{};In.prototype._setValue=Ca;var Vi=class extends In{};Vi.prototype._setValue=to;var Hi=class extends In{};Hi.prototype._setValue=eo;var Pe=class extends Ht{setValue(t,e){this._values.set(t,e)}},Io=class extends Pe{},Ao=class extends Pe{},Fo=class extends Pe{},xo=class extends Pe{},To=class extends Pe{},Bo=class extends Pe{},Do=class extends Pe{},Eo=class extends Pe{};var Oo=class extends lr{constructor(t){super(t),this._offsets=new jn}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 Ge(new z(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 u=-1;++u<o;)n.set(a+u,s[u])}}};var Ro=class extends lr{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 qe(new z(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 u of s.entries())if(n.set(o,u),++o>=a)break}}};var Mo=class extends At{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var Uo=class extends At{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 bt([...this.type.children,new z(e,t.type,!0)]),n}};var Cr=class extends Ht{};Cr.prototype._setValue=ka;var zi=class extends Cr{};zi.prototype._setValue=Ys;var Wi=class extends Cr{};Wi.prototype._setValue=Xs;var ji=class extends Cr{};ji.prototype._setValue=Gs;var $i=class extends Cr{};$i.prototype._setValue=Ks;var Pr=class extends Ht{};Pr.prototype._setValue=La;var Yi=class extends Pr{};Yi.prototype._setValue=Js;var Xi=class extends Pr{};Xi.prototype._setValue=qs;var Gi=class extends Pr{};Gi.prototype._setValue=Zs;var Ki=class extends Pr{};Ki.prototype._setValue=Qs;var Kn=class extends At{constructor(t){super(t),this._typeIds=new Ur(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 z(e,t.type)];return this.type=new Ke(s,[...o,n],a),n}_valueToChildTypeId(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},ko=class extends Kn{},Lo=class extends Kn{constructor(t){super(t),this._offsets=new Ur(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 Ji=class extends lr{constructor(t){super(t),this._values=new Jr(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,jr(e))}_flushPending(t,e){}};Ji.prototype._flushPending=Gn.prototype._flushPending;var tc=class extends D{visitNull(){return Mo}visitBool(){return yo}visitInt(){return Pe}visitInt8(){return Io}visitInt16(){return Ao}visitInt32(){return Fo}visitInt64(){return xo}visitUint8(){return To}visitUint16(){return Bo}visitUint32(){return Do}visitUint64(){return Eo}visitFloat(){return Sn}visitFloat16(){return wo}visitFloat32(){return vo}visitFloat64(){return So}visitUtf8(){return Ji}visitBinary(){return Gn}visitFixedSizeBinary(){return Pi}visitDate(){return wn}visitDateDay(){return Li}visitDateMillisecond(){return Ni}visitTimestamp(){return Cr}visitTimestampSecond(){return zi}visitTimestampMillisecond(){return Wi}visitTimestampMicrosecond(){return ji}visitTimestampNanosecond(){return $i}visitTime(){return Pr}visitTimeSecond(){return Yi}visitTimeMillisecond(){return Xi}visitTimeMicrosecond(){return Gi}visitTimeNanosecond(){return Ki}visitDecimal(){return Ci}visitList(){return Oo}visitStruct(){return Uo}visitUnion(){return Kn}visitDenseUnion(){return Lo}visitSparseUnion(){return ko}visitDictionary(){return bo}visitInterval(){return In}visitIntervalDayTime(){return Vi}visitIntervalYearMonth(){return Hi}visitFixedSizeList(){return go}visitMap(){return Ro}},Dd=new tc;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 Ae(r,t){return t instanceof r.constructor}function qi(r,t){return r===t||Ae(r,t)}function Vr(r,t){return r===t||Ae(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function No(r,t){return r===t||Ae(r,t)&&r.precision===t.precision}function E_(r,t){return r===t||Ae(r,t)&&r.byteWidth===t.byteWidth}function ec(r,t){return r===t||Ae(r,t)&&r.unit===t.unit}function Zi(r,t){return r===t||Ae(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Qi(r,t){return r===t||Ae(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function O_(r,t){return r===t||Ae(r,t)&&r.children.length===t.children.length&&gr.compareManyFields(r.children,t.children)}function R_(r,t){return r===t||Ae(r,t)&&r.children.length===t.children.length&&gr.compareManyFields(r.children,t.children)}function rc(r,t){return r===t||Ae(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&gr.compareManyFields(r.children,t.children)}function M_(r,t){return r===t||Ae(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&gr.visit(r.indices,t.indices)&&gr.visit(r.dictionary,t.dictionary)}function nc(r,t){return r===t||Ae(r,t)&&r.unit===t.unit}function U_(r,t){return r===t||Ae(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&gr.compareManyFields(r.children,t.children)}function k_(r,t){return r===t||Ae(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&gr.compareManyFields(r.children,t.children)}U.prototype.visitNull=qi;U.prototype.visitBool=qi;U.prototype.visitInt=Vr;U.prototype.visitInt8=Vr;U.prototype.visitInt16=Vr;U.prototype.visitInt32=Vr;U.prototype.visitInt64=Vr;U.prototype.visitUint8=Vr;U.prototype.visitUint16=Vr;U.prototype.visitUint32=Vr;U.prototype.visitUint64=Vr;U.prototype.visitFloat=No;U.prototype.visitFloat16=No;U.prototype.visitFloat32=No;U.prototype.visitFloat64=No;U.prototype.visitUtf8=qi;U.prototype.visitBinary=qi;U.prototype.visitFixedSizeBinary=E_;U.prototype.visitDate=ec;U.prototype.visitDateDay=ec;U.prototype.visitDateMillisecond=ec;U.prototype.visitTimestamp=Zi;U.prototype.visitTimestampSecond=Zi;U.prototype.visitTimestampMillisecond=Zi;U.prototype.visitTimestampMicrosecond=Zi;U.prototype.visitTimestampNanosecond=Zi;U.prototype.visitTime=Qi;U.prototype.visitTimeSecond=Qi;U.prototype.visitTimeMillisecond=Qi;U.prototype.visitTimeMicrosecond=Qi;U.prototype.visitTimeNanosecond=Qi;U.prototype.visitDecimal=qi;U.prototype.visitList=O_;U.prototype.visitStruct=R_;U.prototype.visitUnion=rc;U.prototype.visitDenseUnion=rc;U.prototype.visitSparseUnion=rc;U.prototype.visitDictionary=M_;U.prototype.visitInterval=nc;U.prototype.visitIntervalDayTime=nc;U.prototype.visitIntervalYearMonth=nc;U.prototype.visitFixedSizeList=U_;U.prototype.visitMap=k_;var gr=new U;function An(r,t){return gr.compareSchemas(r,t)}function Ed(r,t){return gr.compareFields(r,t)}function Od(r,t){return gr.visit(r,t)}function vn(r){let t=r.type,e=new(Dd.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:u}=a,c=s(a,o);e.children.push(vn(Object.assign(Object.assign({},c),{type:u})))}}return e}function Co(r,t){return L_(r,t.map(e=>e.data.concat()))}function L_(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((y,b)=>Math.max(y,b.length),0)},s=0,o=0,a=-1,u=t.length,c,m=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<u;)m[a]=c=t[a].shift(),o=Math.min(o,c?c.length:o);Number.isFinite(o)&&(m=N_(e,o,m,t,i),o>0&&(n[s++]=P({type:new bt(e),length:o,nullCount:0,children:m.slice()})))}return[r=r.assign(e),n.map(y=>new mt(r,y))]}function N_(r,t,e,n,i){var s;let o=(t+63&-64)>>3;for(let a=-1,u=n.length;++a<u;){let c=e[a],m=c==null?void 0:c.length;if(m>=t)m===t?e[a]=c:(e[a]=c.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(c.slice(t,m-t))));else{let y=r[a];r[a]=y.clone({nullable:!0}),e[a]=(s=c==null?void 0:c._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:P({type:y.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var Rd,Et=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new q([]),this._offsets=[0],this;let i,s;t[0]instanceof q&&(i=t.shift()),t[t.length-1]instanceof Uint32Array&&(s=t.pop());let o=u=>{if(u){if(u instanceof mt)return[u];if(u instanceof Et)return u.batches;if(u instanceof it){if(u.type instanceof bt)return[new mt(new q(u.type.children),u)]}else{if(Array.isArray(u))return u.flatMap(c=>o(c));if(typeof u[Symbol.iterator]=="function")return[...u].flatMap(c=>o(c));if(typeof u=="object"){let c=Object.keys(u),m=c.map(I=>new N([u[I]])),y=new q(c.map((I,Z)=>new z(String(I),m[Z].type))),[,b]=Co(y,m);return b.length===0?[new mt(u)]:b}}}return[]},a=t.flatMap(u=>o(u));if(i=(n=i!=null?i:(e=a[0])===null||e===void 0?void 0:e.schema)!==null&&n!==void 0?n:new q([]),!(i instanceof q))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let u of a){if(!(u instanceof mt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!An(i,u.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s!=null?s:oo(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=so(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 this.batches.length>0?Hn.visit(new N(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
7
|
+
return true;`)}function x_(r){return typeof r!="bigint"?$e(r):As?`${$e(r)}n`:`"${$e(r)}"`}var Ga=(r,t)=>(r*t+63&-64||64)/t,T_=(r,t=0)=>r.length>=t?r.subarray(0,t):Mn(new r.constructor(t),r,0),Jr=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?Ga(n*1,this.BYTES_PER_ELEMENT):Ga(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Ga(t*this.stride,this.BYTES_PER_ELEMENT);let e=T_(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=Mn(new this.ArrayType(t),this.buffer)}};Jr.prototype.offset=0;var Ur=class extends Jr{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}},Wn=class extends Ur{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()}},jn=class extends Ur{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 At=class{constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=De(t),this._nulls=new Wn,e&&e.length>0&&(this._isValid=Bd(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 N([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,u)=>a+u.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:u,_offsets:c,_values:m,_nulls:y}=this;(e=u==null?void 0:u.flush(o))?i=c==null?void 0:c.flush(o):(i=c==null?void 0:c.flush(o))?t=m==null?void 0:m.flush(c.last()):t=m==null?void 0:m.flush(o),a>0&&(n=y==null?void 0:y.flush(o));let b=this.children.map(I=>I.flush());return this.clear(),P({type:s,length:o,nullCount:a,children:b,child:b[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}};At.prototype.length=1;At.prototype.stride=1;At.prototype.children=null;At.prototype.finished=!1;At.prototype.nullValues=null;At.prototype._isValid=()=>!0;var Ht=class extends At{constructor(t){super(t),this._values=new Ur(new this.ArrayType(0),this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},lr=class extends At{constructor(t){super(t),this._pendingLength=0,this._offsets=new jn}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof ar?e[Ce].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 bn=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 ur=new Int32Array(2),uo=new Float32Array(ur.buffer),fo=new Float64Array(ur.buffer),$n=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var kt=class{constructor(t,e){this.low=t|0,this.high=e|0}static create(t,e){return t==0&&e==0?kt.ZERO:new kt(t,e)}toFloat64(){return(this.low>>>0)+this.high*4294967296}equals(t){return this.low==t.low&&this.high==t.high}};kt.ZERO=new kt(0,0);var xi;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(xi||(xi={}));var ue=class{constructor(t){this.bytes_=t,this.position_=0}static allocate(t){return new ue(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 kt(this.readInt32(t),this.readInt32(t+4))}readUint64(t){return new kt(this.readUint32(t),this.readUint32(t+4))}readFloat32(t){return ur[0]=this.readInt32(t),uo[0]}readFloat64(t){return ur[$n?0:1]=this.readInt32(t),ur[$n?1:0]=this.readInt32(t+4),fo[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){uo[0]=e,this.writeInt32(t,ur[0])}writeFloat64(t,e){fo[0]=e,this.writeInt32(t,ur[$n?0:1]),this.writeInt32(t+4,ur[$n?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===xi.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 u=this.readUint8(t+s++);if(a<224)o=(a&31)<<6|u&63;else{let c=this.readUint8(t+s++);if(a<240)o=(a&15)<<12|(u&63)<<6|c&63;else{let m=this.readUint8(t+s++);o=(a&7)<<18|(u&63)<<12|(c&63)<<6|m&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 kt.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 kr=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=ue.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=kr.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=ue.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 u=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(u)){for(let c=2;c<s;c+=2)if(this.bb.readInt16(a+c)!=this.bb.readInt16(u+c))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 kt.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 gt=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 gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new gt).__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 gt.startKeyValue(t),gt.addKey(t,e),gt.addValue(t,n),gt.endKeyValue(t)}};var qr;(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"})(qr||(qr={}));var Zr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Zr||(Zr={}));var Ti;(function(r){r[r.DenseArray=0]="DenseArray"})(Ti||(Ti={}));var zt=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 zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new zt).__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 zt.startInt(t),zt.addBitWidth(t,e),zt.addIsSigned(t,n),zt.endInt(t)}};var Oe=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 Oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new Oe).__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 zt).__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):Ti.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,Ti.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var dr=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 dr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new dr).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return dr.startBinary(t),dr.endBinary(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 getRootAsBool(t,e){return(e||new fr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new fr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return fr.startBool(t),fr.endBool(t)}};var Bi;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Bi||(Bi={}));var _e=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 _e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new _e).__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):Bi.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Bi.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return _e.startDate(t),_e.addUnit(t,e),_e.endDate(t)}};var Wt=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 Wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new Wt).__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 Wt.startDecimal(t),Wt.addPrecision(t,e),Wt.addScale(t,n),Wt.addBitWidth(t,i),Wt.endDecimal(t)}};var Qr;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Qr||(Qr={}));var ye=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 ye).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new ye).__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 ye.startFixedSizeBinary(t),ye.addByteWidth(t,e),ye.endFixedSizeBinary(t)}};var be=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 be).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new be).__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 be.startFixedSizeList(t),be.addListSize(t,e),be.endFixedSizeList(t)}};var Di;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(Di||(Di={}));var ge=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 ge).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new ge).__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):Di.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,Di.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return ge.startFloatingPoint(t),ge.addPrecision(t,e),ge.endFloatingPoint(t)}};var Ei;(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"})(Ei||(Ei={}));var we=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 we).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new we).__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):Ei.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Ei.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return we.startInterval(t),we.addUnit(t,e),we.endInterval(t)}};var hr=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 hr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new hr).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return hr.startList(t),hr.endList(t)}};var ve=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 ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new ve).__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 ve.startMap(t),ve.addKeysSorted(t,e),ve.endMap(t)}};var pr=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 pr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new pr).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return pr.startNull(t),pr.endNull(t)}};var mr=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 mr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new mr).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return mr.startStruct_(t),mr.endStruct_(t)}};var te=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 te).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new te).__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):Qr.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,Qr.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return te.startTime(t),te.addUnit(t,e),te.addBitWidth(t,n),te.endTime(t)}};var ee=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 ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new ee).__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):Qr.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,Qr.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return ee.startTimestamp(t),ee.addUnit(t,e),ee.addTimezone(t,n),ee.endTimestamp(t)}};var Oi;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Oi||(Oi={}));var jt=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 jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new jt).__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):Oi.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,Oi.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 jt.startUnion(t),jt.addMode(t,e),jt.addTypeIds(t,n),jt.endUnion(t)}};var _r=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 _r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new _r).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return _r.startUtf8(t),_r.endUtf8(t)}};var Ft;(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"})(Ft||(Ft={}));var Lt=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 Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new Lt).__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):Ft.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 Oe).__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 Lt).__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 gt).__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,Ft.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 Bt=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 Bt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new Bt).__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):Zr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Lt).__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 gt).__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,Zr.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 Bt.startSchema(t),Bt.addEndianness(t,e),Bt.addFields(t,n),Bt.addCustomMetadata(t,i),Bt.addFeatures(t,s),Bt.endSchema(t)}};var re=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 re).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new re).__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):qr.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Bt).__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 bn).__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 bn).__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 gt).__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,qr.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 q=class{constructor(t=[],e,n){this.fields=t||[],this.metadata=e||new Map,n||(n=Ka(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 q(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new q(e,this.metadata)}assign(...t){let e=t[0]instanceof q?t[0]:Array.isArray(t[0])?new q(t[0]):new q(t),n=[...this.fields],i=po(po(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{let u=n.findIndex(c=>c.name===a.name);return~u?(n[u]=a.clone({metadata:po(po(new Map,n[u].metadata),a.metadata)}))&&!1:!0}),o=Ka(s,new Map);return new q([...n,...s],i,new Map([...this.dictionaries,...o]))}};q.prototype.fields=null;q.prototype.metadata=null;q.prototype.dictionaries=null;var z=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 z(`${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],z.new(e,n,i,s)}};z.prototype.type=null;z.prototype.name=null;z.prototype.nullable=null;z.prototype.metadata=null;function po(r,t){return new Map([...r||new Map,...t||new Map])}function Ka(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(T.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&&Ka(s.children,t)}return t}var Dd=kt,B_=kr,D_=ue,Lr=class{constructor(t,e=Vt.V4,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}static decode(t){t=new D_(k(t));let e=re.getRootAsFooter(t),n=q.decode(e.schema());return new Ja(n,e)}static encode(t){let e=new B_,n=q.encode(e,t.schema);re.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())tr.encode(e,o);let i=e.endVector();re.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())tr.encode(e,o);let s=e.endVector();return re.startFooter(e),re.addSchema(e,n),re.addVersion(e,Vt.V4),re.addRecordBatches(e,i),re.addDictionaries(e,s),re.finishFooterBuffer(e,re.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 Ja=class extends Lr{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 tr.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return tr.decode(e)}return null}},tr=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 tr(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=new Dd(e.offset,0),s=new Dd(e.bodyLength,0);return bn.createBlock(t,i,n,s)}};var wt=Object.freeze({done:!0,value:void 0}),Ri=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},gn=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())}},mo=class extends gn{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return A(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(wt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Kt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Kt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return A(this,void 0,void 0,function*(){return yield this.abort(t),wt})}return(t){return A(this,void 0,void 0,function*(){return yield this.close(),wt})}read(t){return A(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return A(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(wt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var yr=class extends mo{write(t){if((t=k(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?_i(this.toUint8Array(!0)):this.toUint8Array(!1).then(_i)}toUint8Array(t=!1){return t?Te(this._values)[0]:(()=>A(this,void 0,void 0,function*(){var e,n;let i=[],s=0;try{for(var o=ke(this),a;a=yield o.next(),!a.done;){let u=a.value;i.push(u),s+=u.byteLength}}catch(u){e={error:u}}finally{try{a&&!a.done&&(n=o.return)&&(yield n.call(o))}finally{if(e)throw e.error}}return Te(i,s)[0]}))()}},br=class{constructor(t){t&&(this.source=new qa(Kt.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)}},Se=class{constructor(t){t instanceof Se?this.source=t.source:t instanceof yr?this.source=new Nr(Kt.fromAsyncIterable(t)):Es(t)?this.source=new Nr(Kt.fromNodeStream(t)):bi(t)?this.source=new Nr(Kt.fromDOMStream(t)):Bs(t)?this.source=new Nr(Kt.fromDOMStream(t.body)):We(t)?this.source=new Nr(Kt.fromIterable(t)):ze(t)?this.source=new Nr(Kt.fromAsyncIterable(t)):Le(t)&&(this.source=new Nr(Kt.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)}},qa=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)||wt)}return(t){return Object.create(this.source.return&&this.source.return(t)||wt)}},Nr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return A(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return A(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return A(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return A(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return A(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||wt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return A(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||wt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var Mi=class extends br{constructor(t,e){super(),this.position=0,this.buffer=k(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}}},tn=class extends Se{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>A(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return A(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 A(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 A(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,u=Math.min(n,s+Math.min(n-s,t)),c=new Uint8Array(Math.max(0,(this.position=u)-s));for(;(s+=a)<u&&(o+=a)<c.byteLength;)({bytesRead:a}=yield e.read(c,o,c.byteLength-o,s));return c}return null})}readAt(t,e){return A(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 A(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return A(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return A(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Qa={};dn(Qa,{BaseInt64:()=>Ui,Int128:()=>Ie,Int64:()=>$t,Uint64:()=>st});function Yn(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var Xn=8,Za=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Ui=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`${Yn(this.buffer[1])} ${Yn(this.buffer[0])}`}},st=class extends Ui{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return st.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return st.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new st(e);for(let s=0;s<n;){let o=Xn<n-s?Xn:n-s,a=new st(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),u=new st(new Uint32Array([Za[o],0]));i.times(u),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;)st.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new st(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new st(new Uint32Array(t.buffer)).plus(e)}},$t=class extends Ui{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 $t.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return $t.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new $t(e);for(let o=n?1:0;o<i;){let a=Xn<i-o?Xn:i-o,u=new $t(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),c=new $t(new Uint32Array([Za[a],0]));s.times(c),s.plus(u),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;)$t.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new $t(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new $t(new Uint32Array(t.buffer)).plus(e)}},Ie=class{constructor(t){this.buffer=t}high(){return new $t(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new $t(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 st(new Uint32Array([this.buffer[3],0])),n=new st(new Uint32Array([this.buffer[2],0])),i=new st(new Uint32Array([this.buffer[1],0])),s=new st(new Uint32Array([this.buffer[0],0])),o=new st(new Uint32Array([t.buffer[3],0])),a=new st(new Uint32Array([t.buffer[2],0])),u=new st(new Uint32Array([t.buffer[1],0])),c=new st(new Uint32Array([t.buffer[0],0])),m=st.multiply(s,c);this.buffer[0]=m.low();let y=new st(new Uint32Array([m.high(),0]));return m=st.multiply(i,c),y.plus(m),m=st.multiply(s,u),y.plus(m),this.buffer[1]=y.low(),this.buffer[3]=y.lessThan(m)?1:0,this.buffer[2]=y.high(),new st(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(st.multiply(n,c)).plus(st.multiply(i,u)).plus(st.multiply(s,a)),this.buffer[3]+=st.multiply(e,c).plus(st.multiply(n,u)).plus(st.multiply(i,a)).plus(st.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`${Yn(this.buffer[3])} ${Yn(this.buffer[2])} ${Yn(this.buffer[1])} ${Yn(this.buffer[0])}`}static multiply(t,e){return new Ie(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Ie(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Ie.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Ie.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new Ie(e);for(let o=n?1:0;o<i;){let a=Xn<i-o?Xn:i-o,u=new Ie(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),c=new Ie(new Uint32Array([Za[a],0,0,0]));s.times(c),s.plus(u),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;)Ie.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var ki=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 z?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return P({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({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 P({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 P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({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 P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===Tt.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({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 P({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 P({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 P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({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 P({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)}},_o=class extends ki{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):mn(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return Y(Uint8Array,Y(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return Y(Uint8Array,Y(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return T.isTimestamp(t)?Y(Uint8Array,$t.convertArray(n[e])):(T.isInt(t)||T.isTime(t))&&t.bitWidth===64?Y(Uint8Array,$t.convertArray(n[e])):T.isDate(t)&&t.unit===Jt.MILLISECOND?Y(Uint8Array,$t.convertArray(n[e])):T.isDecimal(t)?Y(Uint8Array,Ie.convertArray(n[e])):T.isBinary(t)||T.isFixedSizeBinary(t)?E_(n[e]):T.isBool(t)?mn(n[e]):T.isUtf8(t)?jr(n[e].join("")):Y(Uint8Array,Y(t.ArrayType,n[e].map(i=>+i)))}};function E_(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 Gn=class extends lr{constructor(t){super(t),this._values=new Jr(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,k(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 u=a.length;i.set(a,s),n.set(o,u),s+=u}}};var yo=class extends At{constructor(t){super(t),this._values=new Wn}setValue(t,e){this._values.set(t,+e)}};var wn=class extends Ht{};wn.prototype._setValue=Ua;var Li=class extends wn{};Li.prototype._setValue=js;var Ni=class extends wn{};Ni.prototype._setValue=$s;var Ci=class extends Ht{};Ci.prototype._setValue=Na;var bo=class extends At{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new Be(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=vn({type:this.type.indices,nullValues:e}),this.dictionary=vn({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 Pi=class extends Ht{};Pi.prototype._setValue=Ma;var go=class extends At{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 Je(this.type.listSize,new z(e,t.type,!0)),n}};var Sn=class extends Ht{setValue(t,e){this._values.set(t,e)}},wo=class extends Sn{setValue(t,e){super.setValue(t,vi(e))}},vo=class extends Sn{},So=class extends Sn{};var In=class extends Ht{};In.prototype._setValue=Ca;var Vi=class extends In{};Vi.prototype._setValue=to;var Hi=class extends In{};Hi.prototype._setValue=eo;var Ve=class extends Ht{setValue(t,e){this._values.set(t,e)}},Io=class extends Ve{},Ao=class extends Ve{},Fo=class extends Ve{},xo=class extends Ve{},To=class extends Ve{},Bo=class extends Ve{},Do=class extends Ve{},Eo=class extends Ve{};var Oo=class extends lr{constructor(t){super(t),this._offsets=new jn}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 Ge(new z(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 u=-1;++u<o;)n.set(a+u,s[u])}}};var Ro=class extends lr{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 qe(new z(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 u of s.entries())if(n.set(o,u),++o>=a)break}}};var Mo=class extends At{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var Uo=class extends At{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 bt([...this.type.children,new z(e,t.type,!0)]),n}};var Cr=class extends Ht{};Cr.prototype._setValue=ka;var zi=class extends Cr{};zi.prototype._setValue=Ys;var Wi=class extends Cr{};Wi.prototype._setValue=Xs;var ji=class extends Cr{};ji.prototype._setValue=Gs;var $i=class extends Cr{};$i.prototype._setValue=Ks;var Pr=class extends Ht{};Pr.prototype._setValue=La;var Yi=class extends Pr{};Yi.prototype._setValue=Js;var Xi=class extends Pr{};Xi.prototype._setValue=qs;var Gi=class extends Pr{};Gi.prototype._setValue=Zs;var Ki=class extends Pr{};Ki.prototype._setValue=Qs;var Kn=class extends At{constructor(t){super(t),this._typeIds=new Ur(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 z(e,t.type)];return this.type=new Ke(s,[...o,n],a),n}_valueToChildTypeId(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},ko=class extends Kn{},Lo=class extends Kn{constructor(t){super(t),this._offsets=new Ur(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 Ji=class extends lr{constructor(t){super(t),this._values=new Jr(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,jr(e))}_flushPending(t,e){}};Ji.prototype._flushPending=Gn.prototype._flushPending;var tc=class extends D{visitNull(){return Mo}visitBool(){return yo}visitInt(){return Ve}visitInt8(){return Io}visitInt16(){return Ao}visitInt32(){return Fo}visitInt64(){return xo}visitUint8(){return To}visitUint16(){return Bo}visitUint32(){return Do}visitUint64(){return Eo}visitFloat(){return Sn}visitFloat16(){return wo}visitFloat32(){return vo}visitFloat64(){return So}visitUtf8(){return Ji}visitBinary(){return Gn}visitFixedSizeBinary(){return Pi}visitDate(){return wn}visitDateDay(){return Li}visitDateMillisecond(){return Ni}visitTimestamp(){return Cr}visitTimestampSecond(){return zi}visitTimestampMillisecond(){return Wi}visitTimestampMicrosecond(){return ji}visitTimestampNanosecond(){return $i}visitTime(){return Pr}visitTimeSecond(){return Yi}visitTimeMillisecond(){return Xi}visitTimeMicrosecond(){return Gi}visitTimeNanosecond(){return Ki}visitDecimal(){return Ci}visitList(){return Oo}visitStruct(){return Uo}visitUnion(){return Kn}visitDenseUnion(){return Lo}visitSparseUnion(){return ko}visitDictionary(){return bo}visitInterval(){return In}visitIntervalDayTime(){return Vi}visitIntervalYearMonth(){return Hi}visitFixedSizeList(){return go}visitMap(){return Ro}},Ed=new tc;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 Ae(r,t){return t instanceof r.constructor}function qi(r,t){return r===t||Ae(r,t)}function Vr(r,t){return r===t||Ae(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function No(r,t){return r===t||Ae(r,t)&&r.precision===t.precision}function O_(r,t){return r===t||Ae(r,t)&&r.byteWidth===t.byteWidth}function ec(r,t){return r===t||Ae(r,t)&&r.unit===t.unit}function Zi(r,t){return r===t||Ae(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Qi(r,t){return r===t||Ae(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function R_(r,t){return r===t||Ae(r,t)&&r.children.length===t.children.length&&gr.compareManyFields(r.children,t.children)}function M_(r,t){return r===t||Ae(r,t)&&r.children.length===t.children.length&&gr.compareManyFields(r.children,t.children)}function rc(r,t){return r===t||Ae(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&gr.compareManyFields(r.children,t.children)}function U_(r,t){return r===t||Ae(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&gr.visit(r.indices,t.indices)&&gr.visit(r.dictionary,t.dictionary)}function nc(r,t){return r===t||Ae(r,t)&&r.unit===t.unit}function k_(r,t){return r===t||Ae(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&gr.compareManyFields(r.children,t.children)}function L_(r,t){return r===t||Ae(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&gr.compareManyFields(r.children,t.children)}U.prototype.visitNull=qi;U.prototype.visitBool=qi;U.prototype.visitInt=Vr;U.prototype.visitInt8=Vr;U.prototype.visitInt16=Vr;U.prototype.visitInt32=Vr;U.prototype.visitInt64=Vr;U.prototype.visitUint8=Vr;U.prototype.visitUint16=Vr;U.prototype.visitUint32=Vr;U.prototype.visitUint64=Vr;U.prototype.visitFloat=No;U.prototype.visitFloat16=No;U.prototype.visitFloat32=No;U.prototype.visitFloat64=No;U.prototype.visitUtf8=qi;U.prototype.visitBinary=qi;U.prototype.visitFixedSizeBinary=O_;U.prototype.visitDate=ec;U.prototype.visitDateDay=ec;U.prototype.visitDateMillisecond=ec;U.prototype.visitTimestamp=Zi;U.prototype.visitTimestampSecond=Zi;U.prototype.visitTimestampMillisecond=Zi;U.prototype.visitTimestampMicrosecond=Zi;U.prototype.visitTimestampNanosecond=Zi;U.prototype.visitTime=Qi;U.prototype.visitTimeSecond=Qi;U.prototype.visitTimeMillisecond=Qi;U.prototype.visitTimeMicrosecond=Qi;U.prototype.visitTimeNanosecond=Qi;U.prototype.visitDecimal=qi;U.prototype.visitList=R_;U.prototype.visitStruct=M_;U.prototype.visitUnion=rc;U.prototype.visitDenseUnion=rc;U.prototype.visitSparseUnion=rc;U.prototype.visitDictionary=U_;U.prototype.visitInterval=nc;U.prototype.visitIntervalDayTime=nc;U.prototype.visitIntervalYearMonth=nc;U.prototype.visitFixedSizeList=k_;U.prototype.visitMap=L_;var gr=new U;function An(r,t){return gr.compareSchemas(r,t)}function Od(r,t){return gr.compareFields(r,t)}function Rd(r,t){return gr.visit(r,t)}function vn(r){let t=r.type,e=new(Ed.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:u}=a,c=s(a,o);e.children.push(vn(Object.assign(Object.assign({},c),{type:u})))}}return e}function Co(r,t){return N_(r,t.map(e=>e.data.concat()))}function N_(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((y,b)=>Math.max(y,b.length),0)},s=0,o=0,a=-1,u=t.length,c,m=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<u;)m[a]=c=t[a].shift(),o=Math.min(o,c?c.length:o);Number.isFinite(o)&&(m=C_(e,o,m,t,i),o>0&&(n[s++]=P({type:new bt(e),length:o,nullCount:0,children:m.slice()})))}return[r=r.assign(e),n.map(y=>new mt(r,y))]}function C_(r,t,e,n,i){var s;let o=(t+63&-64)>>3;for(let a=-1,u=n.length;++a<u;){let c=e[a],m=c==null?void 0:c.length;if(m>=t)m===t?e[a]=c:(e[a]=c.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(c.slice(t,m-t))));else{let y=r[a];r[a]=y.clone({nullable:!0}),e[a]=(s=c==null?void 0:c._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:P({type:y.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var Md,Et=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new q([]),this._offsets=[0],this;let i,s;t[0]instanceof q&&(i=t.shift()),t[t.length-1]instanceof Uint32Array&&(s=t.pop());let o=u=>{if(u){if(u instanceof mt)return[u];if(u instanceof Et)return u.batches;if(u instanceof it){if(u.type instanceof bt)return[new mt(new q(u.type.children),u)]}else{if(Array.isArray(u))return u.flatMap(c=>o(c));if(typeof u[Symbol.iterator]=="function")return[...u].flatMap(c=>o(c));if(typeof u=="object"){let c=Object.keys(u),m=c.map(I=>new N([u[I]])),y=new q(c.map((I,Z)=>new z(String(I),m[Z].type))),[,b]=Co(y,m);return b.length===0?[new mt(u)]:b}}}return[]},a=t.flatMap(u=>o(u));if(i=(n=i!=null?i:(e=a[0])===null||e===void 0?void 0:e.schema)!==null&&n!==void 0?n:new q([]),!(i instanceof q))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let u of a){if(!(u instanceof mt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!An(i,u.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s!=null?s:oo(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=so(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 this.batches.length>0?Hn.visit(new N(this.data)):new Array(0)[Symbol.iterator]()}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 Et(e,n.map(i=>new mt(e,i)))}slice(t,e){let n=this.schema;[t,e]=Si({length:this.numRows},t,e);let i=ao(this.data,this._offsets,t,e);return new Et(n,i.map(s=>new mt(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=P({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new N(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 N([P({type:new le,length:this.numRows})]));let s=n.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((u,c)=>this.getChildAt(c));[s[t],a[t]]=[o,e],[n,i]=Co(n,a)}return new Et(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 Et(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,u,c)=>{let[m,y]=a,b=e.findIndex(I=>I.name===u.name);return~b?y[b]=c:m.push(c),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,u)=>[u,i[u]]).map(([a,u])=>u===void 0?this.getChildAt(a):t.getChildAt(u)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new Et(...Co(s,o))}};Rd=Symbol.toStringTag;Et[Rd]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Kr(Fi),r.get=Kr(Ut.getVisitFn(h.Struct)),r.set=co(qt.getVisitFn(h.Struct)),r.indexOf=lo(yn.getVisitFn(h.Struct)),r.getByteLength=Kr(Ee.getVisitFn(h.Struct)),"Table"))(Et.prototype);var Ud,mt=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof q))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=P({nullCount:0,type:new bt(this.schema.fields),children:this.schema.fields.map(e=>P({type:e.type,nullCount:0}))})]=t,!(this.data instanceof it))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Md(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((u,c,m)=>(u.children[m]=e[c],u.length=Math.max(u.length,e[c].length),u.fields[m]=z.new({name:c,type:e[c].type,nullable:!0}),u),{length:0,fields:new Array,children:new Array}),o=new q(n),a=P({type:new bt(n),length:s,children:i,nullCount:0});[this.schema,this.data]=Md(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=kd(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 Ut.visit(this.data,t)}set(t,e){return qt.visit(this.data,t,e)}indexOf(t,e){return yn.visit(this.data,t,e)}getByteLength(t){return Ee.visit(this.data,t)}[Symbol.iterator](){return Hn.visit(new N([this.data]))}toArray(){return[...this]}concat(...t){return new Et(this.schema,[this,...t])}slice(t,e){let[n]=new N([this.data]).slice(t,e).data;return new mt(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 N([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 N([P({type:new le,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 q(s,new Map(this.schema.metadata)),i=P({type:new bt(s),children:o})}return new mt(n,i)}select(t){let e=this.schema.select(t),n=new bt(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 mt(e,P({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=P({type:new bt(e.fields),length:this.numRows,children:n});return new mt(e,i)}};Ud=Symbol.toStringTag;mt[Ud]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(mt.prototype);function Md(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,u]of r.fields.entries()){let c=t[a];(!c||c.length!==e)&&(i[a]=u.clone({nullable:!0}),s[a]=(n=c==null?void 0:c._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:P({type:u.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),P({type:new bt(i),length:e,children:s})]}function kd(r,t,e=new Map){for(let n=-1,i=r.length;++n<i;){let o=r[n].type,a=t[n];if(T.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&&kd(o.children,a.children,e)}return e}var Fn=class extends mt{constructor(t){let e=t.fields.map(i=>P({type:i.type})),n=P({type:new bt(t.fields),nullCount:0,children:e});super(t,n)}};var ts;(function(r){r[r.BUFFER=0]="BUFFER"})(ts||(ts={}));var es;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(es||(es={}));var er=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 er).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new er).__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):es.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):ts.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,es.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,ts.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return er.startBodyCompression(t),er.addCodec(t,e),er.addMethod(t,n),er.endBodyCompression(t)}};var Jn=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 qn=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 ne=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 ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new ne).__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 qn).__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 Jn).__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 er).__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 Ve=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 Ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new Ve).__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 ne).__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 Zn;(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"})(Zn||(Zn={}));var Rt=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 Rt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new Rt).__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):qr.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Zn.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 gt).__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,qr.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,Zn.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 Rt.startMessage(t),Rt.addVersion(t,e),Rt.addHeaderType(t,n),Rt.addHeader(t,i),Rt.addBodyLength(t,s),Rt.addCustomMetadata(t,o),Rt.endMessage(t)}};var P_=kt,ic=class extends D{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return pr.startNull(e),pr.endNull(e)}visitInt(t,e){return zt.startInt(e),zt.addBitWidth(e,t.bitWidth),zt.addIsSigned(e,t.isSigned),zt.endInt(e)}visitFloat(t,e){return ge.startFloatingPoint(e),ge.addPrecision(e,t.precision),ge.endFloatingPoint(e)}visitBinary(t,e){return dr.startBinary(e),dr.endBinary(e)}visitBool(t,e){return fr.startBool(e),fr.endBool(e)}visitUtf8(t,e){return _r.startUtf8(e),_r.endUtf8(e)}visitDecimal(t,e){return Wt.startDecimal(e),Wt.addScale(e,t.scale),Wt.addPrecision(e,t.precision),Wt.addBitWidth(e,t.bitWidth),Wt.endDecimal(e)}visitDate(t,e){return _e.startDate(e),_e.addUnit(e,t.unit),_e.endDate(e)}visitTime(t,e){return te.startTime(e),te.addUnit(e,t.unit),te.addBitWidth(e,t.bitWidth),te.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return ee.startTimestamp(e),ee.addUnit(e,t.unit),n!==void 0&&ee.addTimezone(e,n),ee.endTimestamp(e)}visitInterval(t,e){return we.startInterval(e),we.addUnit(e,t.unit),we.endInterval(e)}visitList(t,e){return hr.startList(e),hr.endList(e)}visitStruct(t,e){return mr.startStruct_(e),mr.endStruct_(e)}visitUnion(t,e){jt.startTypeIdsVector(e,t.typeIds.length);let n=jt.createTypeIdsVector(e,t.typeIds);return jt.startUnion(e),jt.addMode(e,t.mode),jt.addTypeIds(e,n),jt.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return Oe.startDictionaryEncoding(e),Oe.addId(e,new P_(t.id,0)),Oe.addIsOrdered(e,t.isOrdered),n!==void 0&&Oe.addIndexType(e,n),Oe.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return ye.startFixedSizeBinary(e),ye.addByteWidth(e,t.byteWidth),ye.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return be.startFixedSizeList(e),be.addListSize(e,t.listSize),be.endFixedSizeList(e)}visitMap(t,e){return ve.startMap(e),ve.addKeysSorted(e,t.keysSorted),ve.endMap(e)}},Po=new ic;function Pd(r,t=new Map){return new q(V_(r,t),Vo(r.customMetadata),t)}function sc(r){return new Zt(r.count,Hd(r.columns),zd(r.columns))}function Vd(r){return new xe(sc(r.data),r.id,r.isDelta)}function V_(r,t){return(r.fields||[]).filter(Boolean).map(e=>z.fromJSON(e,t))}function Ld(r,t){return(r.children||[]).filter(Boolean).map(e=>z.fromJSON(e,t))}function Hd(r){return(r||[]).reduce((t,e)=>[...t,new rr(e.count,H_(e.VALIDITY)),...Hd(e.children)],[])}function zd(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new Fe(t.length,i.VALIDITY.length)),i.TYPE&&t.push(new Fe(t.length,i.TYPE.length)),i.OFFSET&&t.push(new Fe(t.length,i.OFFSET.length)),i.DATA&&t.push(new Fe(t.length,i.DATA.length)),t=zd(i.children,t)}return t}function H_(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Wd(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=Cd(r,Ld(r,t)),i=new z(r.name,o,r.nullable,Vo(r.customMetadata))):t.has(e=s.id)?(n=(n=s.indexType)?Nd(n):new or,a=new Be(t.get(e),n,e,s.isOrdered),i=new z(r.name,a,r.nullable,Vo(r.customMetadata))):(n=(n=s.indexType)?Nd(n):new or,t.set(e,o=Cd(r,Ld(r,t))),a=new Be(o,n,e,s.isOrdered),i=new z(r.name,a,r.nullable,Vo(r.customMetadata))),i||null}function Vo(r){return new Map(Object.entries(r||{}))}function Nd(r){return new Ot(r.isSigned,r.bitWidth)}function Cd(r,t){let e=r.type.name;switch(e){case"NONE":return new le;case"null":return new le;case"binary":return new Fr;case"utf8":return new xr;case"bool":return new Tr;case"list":return new Ge((t||[])[0]);case"struct":return new bt(t||[]);case"struct_":return new bt(t||[])}switch(e){case"int":{let n=r.type;return new Ot(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new me(It[n.precision])}case"decimal":{let n=r.type;return new Br(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new Dr(Jt[n.unit])}case"time":{let n=r.type;return new Xe(G[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Er(G[n.unit],n.timezone)}case"interval":{let n=r.type;return new Or(ce[n.unit])}case"union":{let n=r.type;return new Ke(Tt[n.mode],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new Rr(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Je(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new qe((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var xn=kt,z_=kr,W_=ue,Nt=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 Nt(0,Vt.V4,e);return n._createHeader=j_(t,e),n}static decode(t){t=new W_(k(t));let e=Rt.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new Nt(n,i,s);return o._createHeader=$_(e,s),o}static encode(t){let e=new z_,n=-1;return t.isSchema()?n=q.encode(e,t.header()):t.isRecordBatch()?n=Zt.encode(e,t.header()):t.isDictionaryBatch()&&(n=xe.encode(e,t.header())),Rt.startMessage(e),Rt.addVersion(e,Vt.V4),Rt.addHeader(e,n),Rt.addHeaderType(e,t.headerType),Rt.addBodyLength(e,new xn(t.bodyLength,0)),Rt.finishMessageBuffer(e,Rt.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof q)return new Nt(0,Vt.V4,rt.Schema,t);if(t instanceof Zt)return new Nt(e,Vt.V4,rt.RecordBatch,t);if(t instanceof xe)return new Nt(e,Vt.V4,rt.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===rt.Schema}isRecordBatch(){return this.headerType===rt.RecordBatch}isDictionaryBatch(){return this.headerType===rt.DictionaryBatch}},Zt=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}},xe=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}},Fe=class{constructor(t,e){this.offset=typeof t=="number"?t:t.low,this.length=typeof e=="number"?e:e.low}},rr=class{constructor(t,e){this.length=typeof t=="number"?t:t.low,this.nullCount=typeof e=="number"?e:e.low}};function j_(r,t){return()=>{switch(t){case rt.Schema:return q.fromJSON(r);case rt.RecordBatch:return Zt.fromJSON(r);case rt.DictionaryBatch:return xe.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${rt[t]}, type: ${t} }`)}}function $_(r,t){return()=>{switch(t){case rt.Schema:return q.decode(r.header(new Bt));case rt.RecordBatch:return Zt.decode(r.header(new ne),r.version());case rt.DictionaryBatch:return xe.decode(r.header(new Ve),r.version())}throw new Error(`Unrecognized Message type: { name: ${rt[t]}, type: ${t} }`)}}z.encode=ry;z.decode=ty;z.fromJSON=Wd;q.encode=ey;q.decode=Y_;q.fromJSON=Pd;Zt.encode=ny;Zt.decode=X_;Zt.fromJSON=sc;xe.encode=iy;xe.decode=G_;xe.fromJSON=Vd;rr.encode=sy;rr.decode=J_;Fe.encode=oy;Fe.decode=K_;function Y_(r,t=new Map){let e=Q_(r,t);return new q(e,Ho(r),t)}function X_(r,t=Vt.V4){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Zt(r.length(),q_(r),Z_(r,t))}function G_(r,t=Vt.V4){return new xe(Zt.decode(r.data(),t),r.id(),r.isDelta())}function K_(r){return new Fe(r.offset(),r.length())}function J_(r){return new rr(r.length(),r.nullCount())}function q_(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=rr.decode(e));return t}function Z_(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<Vt.V4&&(n.bb_pos+=8*(i+1)),e[++s]=Fe.decode(n));return e}function Q_(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=z.decode(n,t));return e}function jd(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=z.decode(n,t));return e}function ty(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=Yd(r,jd(r,t)),n=new z(r.name(),i,r.nullable(),Ho(r))):t.has(e=a.id().low)?(s=(s=a.indexType())?$d(s):new or,o=new Be(t.get(e),s,e,a.isOrdered()),n=new z(r.name(),o,r.nullable(),Ho(r))):(s=(s=a.indexType())?$d(s):new or,t.set(e,i=Yd(r,jd(r,t))),o=new Be(i,s,e,a.isOrdered()),n=new z(r.name(),o,r.nullable(),Ho(r))),n||null}function Ho(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 $d(r){return new Ot(r.isSigned(),r.bitWidth())}function Yd(r,t){let e=r.typeType();switch(e){case Ft.NONE:return new le;case Ft.Null:return new le;case Ft.Binary:return new Fr;case Ft.Utf8:return new xr;case Ft.Bool:return new Tr;case Ft.List:return new Ge((t||[])[0]);case Ft.Struct_:return new bt(t||[])}switch(e){case Ft.Int:{let n=r.type(new zt);return new Ot(n.isSigned(),n.bitWidth())}case Ft.FloatingPoint:{let n=r.type(new ge);return new me(n.precision())}case Ft.Decimal:{let n=r.type(new Wt);return new Br(n.scale(),n.precision(),n.bitWidth())}case Ft.Date:{let n=r.type(new _e);return new Dr(n.unit())}case Ft.Time:{let n=r.type(new te);return new Xe(n.unit(),n.bitWidth())}case Ft.Timestamp:{let n=r.type(new ee);return new Er(n.unit(),n.timezone())}case Ft.Interval:{let n=r.type(new we);return new Or(n.unit())}case Ft.Union:{let n=r.type(new jt);return new Ke(n.mode(),n.typeIdsArray()||[],t||[])}case Ft.FixedSizeBinary:{let n=r.type(new ye);return new Rr(n.byteWidth())}case Ft.FixedSizeList:{let n=r.type(new be);return new Je(n.listSize(),(t||[])[0])}case Ft.Map:{let n=r.type(new ve);return new qe((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Ft[e]}" (${e})`)}function ey(r,t){let e=t.fields.map(s=>z.encode(r,s));Bt.startFieldsVector(r,e.length);let n=Bt.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?Bt.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString(`${s}`),u=r.createString(`${o}`);return gt.startKeyValue(r),gt.addKey(r,a),gt.addValue(r,u),gt.endKeyValue(r)})):-1;return Bt.startSchema(r),Bt.addFields(r,n),Bt.addEndianness(r,ay?Zr.Little:Zr.Big),i!==-1&&Bt.addCustomMetadata(r,i),Bt.endSchema(r)}function ry(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;T.isDictionary(s)?(o=s.dictionary.typeId,i=Po.visit(s,r),n=Po.visit(s.dictionary,r)):n=Po.visit(s,r);let a=(s.children||[]).map(m=>z.encode(r,m)),u=Lt.createChildrenVector(r,a),c=t.metadata&&t.metadata.size>0?Lt.createCustomMetadataVector(r,[...t.metadata].map(([m,y])=>{let b=r.createString(`${m}`),I=r.createString(`${y}`);return gt.startKeyValue(r),gt.addKey(r,b),gt.addValue(r,I),gt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),Lt.startField(r),Lt.addType(r,n),Lt.addTypeType(r,o),Lt.addChildren(r,u),Lt.addNullable(r,!!t.nullable),e!==-1&&Lt.addName(r,e),i!==-1&&Lt.addDictionary(r,i),c!==-1&&Lt.addCustomMetadata(r,c),Lt.endField(r)}function ny(r,t){let e=t.nodes||[],n=t.buffers||[];ne.startNodesVector(r,e.length);for(let o of e.slice().reverse())rr.encode(r,o);let i=r.endVector();ne.startBuffersVector(r,n.length);for(let o of n.slice().reverse())Fe.encode(r,o);let s=r.endVector();return ne.startRecordBatch(r),ne.addLength(r,new xn(t.length,0)),ne.addNodes(r,i),ne.addBuffers(r,s),ne.endRecordBatch(r)}function iy(r,t){let e=Zt.encode(r,t.data);return Ve.startDictionaryBatch(r),Ve.addId(r,new xn(t.id,0)),Ve.addIsDelta(r,t.isDelta),Ve.addData(r,e),Ve.endDictionaryBatch(r)}function sy(r,t){return qn.createFieldNode(r,new xn(t.length,0),new xn(t.nullCount,0))}function oy(r,t){return Jn.createBuffer(r,new xn(t.offset,0),new xn(t.length,0))}var ay=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var ac=r=>`Expected ${rt[r]} Message in stream, but was null or length 0.`,cc=r=>`Header pointer of flatbuffer-encoded ${rt[r]} Message is null or length 0.`,Xd=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Gd=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,Qn=class{constructor(t){this.source=t instanceof br?t:new br(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?wt:t.value===-1&&(t=this.readMetadataLength()).done?wt:(t=this.readMetadata(t.value)).done?wt: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(ac(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=k(this.source.read(t));if(e.byteLength<t)throw new Error(Gd(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=rt.Schema,n=this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(cc(e));return i}readMetadataLength(){let t=this.source.read(zo),e=t&&new ue(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 wt;if(e.byteLength<t)throw new Error(Xd(t,e.byteLength));return{done:!1,value:Nt.decode(e)}}},rs=class{constructor(t,e){this.source=t instanceof Se?t:Ts(t)?new tn(t,e):new Se(t)}[Symbol.asyncIterator](){return this}next(){return A(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?wt:t.value===-1&&(t=yield this.readMetadataLength()).done?wt:(t=yield this.readMetadata(t.value)).done?wt:t})}throw(t){return A(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return A(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return A(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(ac(t));return e.value})}readMessageBody(t){return A(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=k(yield this.source.read(t));if(e.byteLength<t)throw new Error(Gd(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return A(this,void 0,void 0,function*(){let e=rt.Schema,n=yield this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(cc(e));return i})}readMetadataLength(){return A(this,void 0,void 0,function*(){let t=yield this.source.read(zo),e=t&&new ue(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(t){return A(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return wt;if(e.byteLength<t)throw new Error(Xd(t,e.byteLength));return{done:!1,value:Nt.decode(e)}})}},ns=class extends Qn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Ri?t:new Ri(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Nt.fromJSON(t.schema,rt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:Nt.fromJSON(e,rt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:Nt.fromJSON(e,rt.RecordBatch)}}return this._body=[],wt}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(ac(t));return e.value}readSchema(){let t=rt.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(cc(t));return n}},zo=4,oc="ARROW1",ti=new Uint8Array(oc.length);for(let r=0;r<oc.length;r+=1)ti[r]=oc.codePointAt(r);function Wo(r,t=0){for(let e=-1,n=ti.length;++e<n;)if(ti[e]!==r[t+e])return!1;return!0}var ei=ti.length,lc=ei+zo,Kd=ei*2+zo;var Mt=class extends gn{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 ze(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 Kt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Kt.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 Mt?t:Fs(t)?ly(t):Ts(t)?fy(t):ze(t)?(()=>A(this,void 0,void 0,function*(){return yield Mt.from(yield t)}))():Bs(t)||bi(t)||Es(t)||ke(t)?dy(new Se(t)):uy(new br(t))}static readAll(t){return t instanceof Mt?t.isSync()?Jd(t):qd(t):Fs(t)||ArrayBuffer.isView(t)||We(t)||xs(t)?Jd(t):qd(t)}},wr=class extends Mt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return pe(this,arguments,function*(){yield $(yield*On(Ue(this[Symbol.iterator]())))})}},en=class extends Mt{constructor(t){super(t),this._impl=t}readAll(){var t,e;return A(this,void 0,void 0,function*(){let n=new Array;try{for(var i=Ue(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]()}},rn=class extends wr{constructor(t){super(t),this._impl=t}},is=class extends en{constructor(t){super(t),this._impl=t}},jo=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=P({type:new bt(this.schema.fields),length:t.length,children:n});return new mt(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 u=o.dictionaries.get(n),c=this._loadVectors(t.data,e,[u]);return(a&&i?a.concat(new N(c)):new N(c)).memoize()}return a.memoize()}_loadVectors(t,e,n){return new ki(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}},ri=class extends jo{constructor(t,e){super(e),this._reader=Fs(t)?new ns(this._handle=t):new Qn(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Zd(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):wt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):wt}next(){if(this.closed)return wt;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Fn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},ni=class extends jo{constructor(t,e){super(e),this._reader=new rs(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return A(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 A(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Zd(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return A(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):wt})}return(t){return A(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):wt})}next(){return A(this,void 0,void 0,function*(){if(this.closed)return wt;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Fn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return A(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},$o=class extends ri{constructor(t,e){super(t instanceof Mi?t:new Mi(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(rt.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(rt.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-lc,n=t.readInt32(e),i=t.readAt(e-n,n);return Lr.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}},uc=class extends ni{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 tn?t:new tn(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 A(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 A(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(rt.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 A(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(rt.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 A(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-lc,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return Lr.decode(i)})}_readNextMessageAndValidate(t){return A(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})}},dc=class extends ri{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new _o(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}};function Zd(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Jd(r){let t=Mt.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function qd(r){return pe(this,arguments,function*(){let e=yield $(Mt.from(r));try{if(!(yield $(e.open({autoDestroy:!1}))).closed)do yield yield $(e);while(!(yield $(e.reset().open())).closed)}finally{yield $(e.cancel())}})}function ly(r){return new wr(new dc(r))}function uy(r){let t=r.peek(ei+7&-8);return t&&t.byteLength>=4?Wo(t)?new rn(new $o(r.read())):new wr(new ri(r)):new wr(new ri(function*(){}()))}function dy(r){return A(this,void 0,void 0,function*(){let t=yield r.peek(ei+7&-8);return t&&t.byteLength>=4?Wo(t)?new rn(new $o(yield r.read())):new en(new ni(r)):new en(new ni(function(){return pe(this,arguments,function*(){})}()))})}function fy(r){return A(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new tn(r,t);return t>=Kd&&Wo(yield e.readAt(0,ei+7&-8))?new is(new uc(e)):new en(new ni(e))})}var Dt=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 mt?s.data.children:s.data),n=new Dt;return n.visitMany(e(t)),n}visit(t){if(t instanceof N)return this.visitMany(t.data),this;let{type:e}=t;if(!T.isDictionary(e)){let{length:n,nullCount:i}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");T.isNull(e)||nr.call(this,i<=0?new Uint8Array(0):Vn(t.offset,n,t.nullBitmap)),this.nodes.push(new rr(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 nr(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Fe(this._byteLength,t)),this._byteLength+=t,this}function hy(r){let{type:t,length:e,typeIds:n,valueOffsets:i}=r;if(nr.call(this,n),t.mode===Tt.Sparse)return fc.call(this,r);if(t.mode===Tt.Dense){if(r.offset<=0)return nr.call(this,i),fc.call(this,r);{let s=n.reduce((m,y)=>Math.max(m,y),n[0]),o=new Int32Array(s+1),a=new Int32Array(s+1).fill(-1),u=new Int32Array(e),c=gi(-i[0],e,i);for(let m,y,b=-1;++b<e;)(y=a[m=n[b]])===-1&&(y=a[m]=c[m]),u[b]=c[b]-y,++o[m];nr.call(this,u);for(let m,y=-1,b=t.children.length;++y<b;)if(m=r.children[y]){let I=t.typeIds[y],Z=Math.min(e,o[I]);this.visit(m.slice(a[I],Z))}}}return this}function py(r){let t;return r.nullCount>=r.length?nr.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?nr.call(this,Vn(r.offset,r.length,t)):nr.call(this,mn(r.values))}function nn(r){return nr.call(this,r.values.subarray(0,r.length*r.stride))}function Qd(r){let{length:t,values:e,valueOffsets:n}=r,i=n[0],s=n[t],o=Math.min(s-i,e.byteLength-i);return nr.call(this,gi(-n[0],t,n)),nr.call(this,e.subarray(i,i+o)),this}function hc(r){let{length:t,valueOffsets:e}=r;return e&&nr.call(this,gi(e[0],t,e)),this.visit(r.children[0])}function fc(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}Dt.prototype.visitBool=py;Dt.prototype.visitInt=nn;Dt.prototype.visitFloat=nn;Dt.prototype.visitUtf8=Qd;Dt.prototype.visitBinary=Qd;Dt.prototype.visitFixedSizeBinary=nn;Dt.prototype.visitDate=nn;Dt.prototype.visitTimestamp=nn;Dt.prototype.visitTime=nn;Dt.prototype.visitDecimal=nn;Dt.prototype.visitList=hc;Dt.prototype.visitStruct=fc;Dt.prototype.visitUnion=hy;Dt.prototype.visitInterval=nn;Dt.prototype.visitFixedSizeList=hc;Dt.prototype.visitMap=hc;var Tn=class extends gn{constructor(t){super(),this._position=0,this._started=!1,this._sink=new yr,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,ae(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 ze(t)?t.then(e=>this.writeAll(e)):ke(t)?mc(this,t):pc(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 yr?this._sink=t:(this._sink=new yr,t&&Iu(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Au(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||!An(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 Et&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof mt&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!An(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof mt?t instanceof Fn||this._writeRecordBatch(t):t instanceof Et?this.writeAll(t.batches):We(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=Nt.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,u=a-s-o;return t.headerType===rt.RecordBatch?this._recordBatchBlocks.push(new tr(a,t.bodyLength,this._position)):t.headerType===rt.DictionaryBatch&&this._dictionaryBlocks.push(new tr(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(u)}_write(t){if(this._started){let e=k(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(Nt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ti)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=Dt.assemble(t),o=new Zt(t.numRows,n,i),a=Nt.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}=Dt.assemble(new N([t])),u=new Zt(t.length,s,o),c=new xe(u,e,n),m=Nt.from(c,i);return this._writeMessage(m)._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}},Hr=class extends Tn{static writeAll(t,e){let n=new Hr(e);return ze(t)?t.then(i=>n.writeAll(i)):ke(t)?mc(n,t):pc(n,t)}},zr=class extends Tn{static writeAll(t){let e=new zr;return ze(t)?t.then(n=>e.writeAll(n)):ke(t)?mc(e,t):pc(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=Lr.encode(new Lr(t,Vt.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function pc(r,t){let e=t;t instanceof Et&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function mc(r,t){var e,n,i,s;return A(this,void 0,void 0,function*(){try{for(e=Ue(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 tf(r,t){if(ke(r))return _y(r,t);if(We(r))return my(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function my(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 u,c=null,m=o.desiredSize||null;for(;!(c=a.next(n?m:null)).done;)if(ArrayBuffer.isView(c.value)&&(u=k(c.value))&&(m!=null&&n&&(m=m-u.byteLength+1),c.value=u),o.enqueue(c.value),m!=null&&--m<=0)return;o.close()}}function _y(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 A(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return A(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return A(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 A(this,void 0,void 0,function*(){let u,c=null,m=o.desiredSize||null;for(;!(c=yield a.next(n?m:null)).done;)if(ArrayBuffer.isView(c.value)&&(u=k(c.value))&&(m!=null&&n&&(m=m-u.byteLength+1),c.value=u),o.enqueue(c.value),m!=null&&--m<=0)return;o.close()})}}function nf(r){return new _c(r)}var _c=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=vu(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=vn(s),this._getSize=i!=="bytes"?ef:rf;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:u=>{this._maybeFlush(this._builder,this._controller=u)},start:u=>{this._maybeFlush(this._builder,this._controller=u)}},{highWaterMark:o,size:i!=="bytes"?ef:rf}),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:u=>this._writeValueAndReturnChunkSize(u)})}_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)}},ef=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},rf=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function Yo(r,t){let e=new yr,n=null,i=new ReadableStream({cancel(){return A(this,void 0,void 0,function*(){yield e.close()})},start(a){return A(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return A(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 A(this,void 0,void 0,function*(){return yield(yield Mt.from(e)).open(t)})}function o(a,u){return A(this,void 0,void 0,function*(){let c=a.desiredSize,m=null;for(;!(m=yield u.next()).done;)if(a.enqueue(m.value),c!=null&&--c<=0)return;a.close()})}}function Xo(r,t){let e=new this(r),n=new Se(e),i=new ReadableStream({cancel(){return A(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return A(this,void 0,void 0,function*(){yield s(o)})},start(o){return A(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 A(this,void 0,void 0,function*(){let a=null,u=o.desiredSize;for(;a=yield n.read(u||null);)if(o.enqueue(a),u!=null&&(u-=a.byteLength)<=0)return;o.close()})}}function Go(r,t="stream"){return(t==="stream"?Hr:zr).writeAll(r).toUint8Array(!0)}var wy=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Da),Qa),$a),Ea),Fa),ja),{compareSchemas:An,compareFields:Ed,compareTypes:Od});Kt.toDOMStream=tf;At.throughDOM=nf;Mt.throughDOM=Yo;rn.throughDOM=Yo;wr.throughDOM=Yo;Tn.throughDOM=Xo;zr.throughDOM=Xo;Hr.throughDOM=Xo;function ii(r){switch(r.typeId){case h.Binary:return{sqlType:"binary"};case h.Bool:return{sqlType:"bool"};case h.Date:return{sqlType:"date"};case h.DateDay:return{sqlType:"date32[d]"};case h.DateMillisecond:return{sqlType:"date64[ms]"};case h.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case h.Float:return{sqlType:"float"};case h.Float16:return{sqlType:"float16"};case h.Float32:return{sqlType:"float32"};case h.Float64:return{sqlType:"float64"};case h.Int:return{sqlType:"int32"};case h.Int16:return{sqlType:"int16"};case h.Int32:return{sqlType:"int32"};case h.Int64:return{sqlType:"int64"};case h.Uint16:return{sqlType:"uint16"};case h.Uint32:return{sqlType:"uint32"};case h.Uint64:return{sqlType:"uint64"};case h.Uint8:return{sqlType:"uint8"};case h.IntervalDayTime:return{sqlType:"interval[dt]"};case h.IntervalYearMonth:return{sqlType:"interval[m]"};case h.List:return{sqlType:"list",valueType:ii(r.valueType)};case h.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case h.Null:return{sqlType:"null"};case h.Utf8:return{sqlType:"utf8"};case h.Struct:return{sqlType:"struct",fields:r.children.map(e=>Ko(e.name,e.type))};case h.Map:{let t=r;return{sqlType:"map",keyType:ii(t.keyType),valueType:ii(t.valueType)}}case h.Time:return{sqlType:"time[s]"};case h.TimeMicrosecond:return{sqlType:"time[us]"};case h.TimeMillisecond:return{sqlType:"time[ms]"};case h.TimeNanosecond:return{sqlType:"time[ns]"};case h.TimeSecond:return{sqlType:"time[s]"};case h.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case h.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case h.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case h.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case h.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error(`unsupported arrow type: ${r.toString()}`)}function Ko(r,t){let e=ii(t);return e.name=r,e}var Jo=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],t.data[2],t.data[3]),this.sendOK(t);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(t.data[0],t.data[1]),this.sendOK(t);break;case"REGISTER_FILE_HANDLE":this._bindings.registerFileHandle(t.data[0],t.data[1],t.data[2],t.data[3]),this.sendOK(t);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(t.data[0],t.data[1]),this.sendOK(t);break;case"COPY_FILE_TO_BUFFER":{let e=this._bindings.copyFileToBuffer(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_BUFFER",data:e},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(t.data[0],t.data[1]),this.sendOK(t);break;case"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 bc={};var vy=(()=>{var r=bc.url;return function(t){t=t||{};function e(){return St.buffer!=de&&Ir(St.buffer),Dc}function n(){return St.buffer!=de&&Ir(St.buffer),Ec}function i(){return St.buffer!=de&&Ir(St.buffer),Oc}function s(){return St.buffer!=de&&Ir(St.buffer),Rc}function o(){return St.buffer!=de&&Ir(St.buffer),Mc}function a(){return St.buffer!=de&&Ir(St.buffer),Uc}function u(){return St.buffer!=de&&Ir(St.buffer),kc}var c=typeof t<"u"?t:{},m,y;c.ready=new Promise(function(l,d){m=l,y=d});var b=Object.assign({},c),I=[],Z="./this.program",J=(l,d)=>{throw d},_t=typeof window=="object",ft=typeof importScripts=="function",yt=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",F=c.ENVIRONMENT_IS_PTHREAD||!1,Yt="";function Dn(l){return c.locateFile?c.locateFile(l,Yt):Yt+l}var si,oi,Wr,et;function ie(l){if(l instanceof di)return;ct("exiting due to exception: "+l)}if(yt){ft?Yt=yc().dirname(Yt)+"/":Yt=__dirname+"/";var Xt,Qt;typeof ba=="function"&&(Xt=of(),Qt=yc()),si=(d,f)=>(d=Qt.normalize(d),Xt.readFileSync(d,f?void 0:"utf8")),Wr=d=>{var f=si(d,!0);return f.buffer||(f=new Uint8Array(f)),f},oi=(d,f,p)=>{d=Qt.normalize(d),Xt.readFile(d,function(_,S){_?p(_):f(S.buffer)})},process.argv.length>1&&(Z=process.argv[1].replace(/\\/g,"/")),I=process.argv.slice(2),process.on("uncaughtException",function(d){if(!(d instanceof di))throw d}),process.on("unhandledRejection",function(d){throw d}),J=(d,f)=>{if(ss())throw process.exitCode=d,f;ie(f),process.exit(d)},c.inspect=function(){return"[Emscripten Module object]"};let l;try{l=af()}catch(d){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),d}global.Worker=l.Worker}else(_t||ft)&&(ft?Yt=self.location.href:typeof document<"u"&&document.currentScript&&(Yt=document.currentScript.src),r&&(Yt=r),Yt.indexOf("blob:")!==0?Yt=Yt.substr(0,Yt.replace(/[?#].*/,"").lastIndexOf("/")+1):Yt="",yt||(si=l=>{var d=new XMLHttpRequest;return d.open("GET",l,!1),d.send(null),d.responseText},ft&&(Wr=l=>{var d=new XMLHttpRequest;return d.open("GET",l,!1),d.responseType="arraybuffer",d.send(null),new Uint8Array(d.response)}),oi=(l,d,f)=>{var p=new XMLHttpRequest;p.open("GET",l,!0),p.responseType="arraybuffer",p.onload=()=>{if(p.status==200||p.status==0&&p.response){d(p.response);return}f()},p.onerror=f,p.send(null)}),et=l=>document.title=l);yt&&typeof performance>"u"&&(global.performance=cf().performance);var Gt=console.log.bind(console),Pt=console.warn.bind(console);yt&&(Gt=l=>Xt.writeSync(1,l+`
|
|
10
|
+
]`}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new Et(e,n.map(i=>new mt(e,i)))}slice(t,e){let n=this.schema;[t,e]=Si({length:this.numRows},t,e);let i=ao(this.data,this._offsets,t,e);return new Et(n,i.map(s=>new mt(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=P({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new N(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 N([P({type:new le,length:this.numRows})]));let s=n.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((u,c)=>this.getChildAt(c));[s[t],a[t]]=[o,e],[n,i]=Co(n,a)}return new Et(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 Et(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,u,c)=>{let[m,y]=a,b=e.findIndex(I=>I.name===u.name);return~b?y[b]=c:m.push(c),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,u)=>[u,i[u]]).map(([a,u])=>u===void 0?this.getChildAt(a):t.getChildAt(u)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new Et(...Co(s,o))}};Md=Symbol.toStringTag;Et[Md]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Kr(Fi),r.get=Kr(Ut.getVisitFn(h.Struct)),r.set=co(qt.getVisitFn(h.Struct)),r.indexOf=lo(yn.getVisitFn(h.Struct)),r.getByteLength=Kr(Ee.getVisitFn(h.Struct)),"Table"))(Et.prototype);var kd,mt=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof q))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=P({nullCount:0,type:new bt(this.schema.fields),children:this.schema.fields.map(e=>P({type:e.type,nullCount:0}))})]=t,!(this.data instanceof it))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Ud(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((u,c,m)=>(u.children[m]=e[c],u.length=Math.max(u.length,e[c].length),u.fields[m]=z.new({name:c,type:e[c].type,nullable:!0}),u),{length:0,fields:new Array,children:new Array}),o=new q(n),a=P({type:new bt(n),length:s,children:i,nullCount:0});[this.schema,this.data]=Ud(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=Ld(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 Ut.visit(this.data,t)}set(t,e){return qt.visit(this.data,t,e)}indexOf(t,e){return yn.visit(this.data,t,e)}getByteLength(t){return Ee.visit(this.data,t)}[Symbol.iterator](){return Hn.visit(new N([this.data]))}toArray(){return[...this]}concat(...t){return new Et(this.schema,[this,...t])}slice(t,e){let[n]=new N([this.data]).slice(t,e).data;return new mt(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 N([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 N([P({type:new le,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 q(s,new Map(this.schema.metadata)),i=P({type:new bt(s),children:o})}return new mt(n,i)}select(t){let e=this.schema.select(t),n=new bt(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 mt(e,P({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=P({type:new bt(e.fields),length:this.numRows,children:n});return new mt(e,i)}};kd=Symbol.toStringTag;mt[kd]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(mt.prototype);function Ud(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,u]of r.fields.entries()){let c=t[a];(!c||c.length!==e)&&(i[a]=u.clone({nullable:!0}),s[a]=(n=c==null?void 0:c._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:P({type:u.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),P({type:new bt(i),length:e,children:s})]}function Ld(r,t,e=new Map){for(let n=-1,i=r.length;++n<i;){let o=r[n].type,a=t[n];if(T.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&&Ld(o.children,a.children,e)}return e}var Fn=class extends mt{constructor(t){let e=t.fields.map(i=>P({type:i.type})),n=P({type:new bt(t.fields),nullCount:0,children:e});super(t,n)}};var ts;(function(r){r[r.BUFFER=0]="BUFFER"})(ts||(ts={}));var es;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(es||(es={}));var er=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 er).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new er).__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):es.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):ts.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,es.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,ts.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return er.startBodyCompression(t),er.addCodec(t,e),er.addMethod(t,n),er.endBodyCompression(t)}};var Jn=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 qn=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 ne=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 ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new ne).__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 qn).__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 Jn).__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 er).__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 He=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 He).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new He).__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 ne).__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 Zn;(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"})(Zn||(Zn={}));var Rt=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 Rt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new Rt).__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):qr.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Zn.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 gt).__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,qr.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,Zn.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 Rt.startMessage(t),Rt.addVersion(t,e),Rt.addHeaderType(t,n),Rt.addHeader(t,i),Rt.addBodyLength(t,s),Rt.addCustomMetadata(t,o),Rt.endMessage(t)}};var V_=kt,ic=class extends D{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return pr.startNull(e),pr.endNull(e)}visitInt(t,e){return zt.startInt(e),zt.addBitWidth(e,t.bitWidth),zt.addIsSigned(e,t.isSigned),zt.endInt(e)}visitFloat(t,e){return ge.startFloatingPoint(e),ge.addPrecision(e,t.precision),ge.endFloatingPoint(e)}visitBinary(t,e){return dr.startBinary(e),dr.endBinary(e)}visitBool(t,e){return fr.startBool(e),fr.endBool(e)}visitUtf8(t,e){return _r.startUtf8(e),_r.endUtf8(e)}visitDecimal(t,e){return Wt.startDecimal(e),Wt.addScale(e,t.scale),Wt.addPrecision(e,t.precision),Wt.addBitWidth(e,t.bitWidth),Wt.endDecimal(e)}visitDate(t,e){return _e.startDate(e),_e.addUnit(e,t.unit),_e.endDate(e)}visitTime(t,e){return te.startTime(e),te.addUnit(e,t.unit),te.addBitWidth(e,t.bitWidth),te.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return ee.startTimestamp(e),ee.addUnit(e,t.unit),n!==void 0&&ee.addTimezone(e,n),ee.endTimestamp(e)}visitInterval(t,e){return we.startInterval(e),we.addUnit(e,t.unit),we.endInterval(e)}visitList(t,e){return hr.startList(e),hr.endList(e)}visitStruct(t,e){return mr.startStruct_(e),mr.endStruct_(e)}visitUnion(t,e){jt.startTypeIdsVector(e,t.typeIds.length);let n=jt.createTypeIdsVector(e,t.typeIds);return jt.startUnion(e),jt.addMode(e,t.mode),jt.addTypeIds(e,n),jt.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return Oe.startDictionaryEncoding(e),Oe.addId(e,new V_(t.id,0)),Oe.addIsOrdered(e,t.isOrdered),n!==void 0&&Oe.addIndexType(e,n),Oe.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return ye.startFixedSizeBinary(e),ye.addByteWidth(e,t.byteWidth),ye.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return be.startFixedSizeList(e),be.addListSize(e,t.listSize),be.endFixedSizeList(e)}visitMap(t,e){return ve.startMap(e),ve.addKeysSorted(e,t.keysSorted),ve.endMap(e)}},Po=new ic;function Vd(r,t=new Map){return new q(H_(r,t),Vo(r.customMetadata),t)}function sc(r){return new Zt(r.count,zd(r.columns),Wd(r.columns))}function Hd(r){return new xe(sc(r.data),r.id,r.isDelta)}function H_(r,t){return(r.fields||[]).filter(Boolean).map(e=>z.fromJSON(e,t))}function Nd(r,t){return(r.children||[]).filter(Boolean).map(e=>z.fromJSON(e,t))}function zd(r){return(r||[]).reduce((t,e)=>[...t,new rr(e.count,z_(e.VALIDITY)),...zd(e.children)],[])}function Wd(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new Fe(t.length,i.VALIDITY.length)),i.TYPE&&t.push(new Fe(t.length,i.TYPE.length)),i.OFFSET&&t.push(new Fe(t.length,i.OFFSET.length)),i.DATA&&t.push(new Fe(t.length,i.DATA.length)),t=Wd(i.children,t)}return t}function z_(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function jd(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=Pd(r,Nd(r,t)),i=new z(r.name,o,r.nullable,Vo(r.customMetadata))):t.has(e=s.id)?(n=(n=s.indexType)?Cd(n):new or,a=new Be(t.get(e),n,e,s.isOrdered),i=new z(r.name,a,r.nullable,Vo(r.customMetadata))):(n=(n=s.indexType)?Cd(n):new or,t.set(e,o=Pd(r,Nd(r,t))),a=new Be(o,n,e,s.isOrdered),i=new z(r.name,a,r.nullable,Vo(r.customMetadata))),i||null}function Vo(r){return new Map(Object.entries(r||{}))}function Cd(r){return new Ot(r.isSigned,r.bitWidth)}function Pd(r,t){let e=r.type.name;switch(e){case"NONE":return new le;case"null":return new le;case"binary":return new Fr;case"utf8":return new xr;case"bool":return new Tr;case"list":return new Ge((t||[])[0]);case"struct":return new bt(t||[]);case"struct_":return new bt(t||[])}switch(e){case"int":{let n=r.type;return new Ot(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new me(It[n.precision])}case"decimal":{let n=r.type;return new Br(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new Dr(Jt[n.unit])}case"time":{let n=r.type;return new Xe(G[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Er(G[n.unit],n.timezone)}case"interval":{let n=r.type;return new Or(ce[n.unit])}case"union":{let n=r.type;return new Ke(Tt[n.mode],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new Rr(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Je(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new qe((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var xn=kt,W_=kr,j_=ue,Nt=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 Nt(0,Vt.V4,e);return n._createHeader=$_(t,e),n}static decode(t){t=new j_(k(t));let e=Rt.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new Nt(n,i,s);return o._createHeader=Y_(e,s),o}static encode(t){let e=new W_,n=-1;return t.isSchema()?n=q.encode(e,t.header()):t.isRecordBatch()?n=Zt.encode(e,t.header()):t.isDictionaryBatch()&&(n=xe.encode(e,t.header())),Rt.startMessage(e),Rt.addVersion(e,Vt.V4),Rt.addHeader(e,n),Rt.addHeaderType(e,t.headerType),Rt.addBodyLength(e,new xn(t.bodyLength,0)),Rt.finishMessageBuffer(e,Rt.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof q)return new Nt(0,Vt.V4,rt.Schema,t);if(t instanceof Zt)return new Nt(e,Vt.V4,rt.RecordBatch,t);if(t instanceof xe)return new Nt(e,Vt.V4,rt.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===rt.Schema}isRecordBatch(){return this.headerType===rt.RecordBatch}isDictionaryBatch(){return this.headerType===rt.DictionaryBatch}},Zt=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}},xe=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}},Fe=class{constructor(t,e){this.offset=typeof t=="number"?t:t.low,this.length=typeof e=="number"?e:e.low}},rr=class{constructor(t,e){this.length=typeof t=="number"?t:t.low,this.nullCount=typeof e=="number"?e:e.low}};function $_(r,t){return()=>{switch(t){case rt.Schema:return q.fromJSON(r);case rt.RecordBatch:return Zt.fromJSON(r);case rt.DictionaryBatch:return xe.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${rt[t]}, type: ${t} }`)}}function Y_(r,t){return()=>{switch(t){case rt.Schema:return q.decode(r.header(new Bt));case rt.RecordBatch:return Zt.decode(r.header(new ne),r.version());case rt.DictionaryBatch:return xe.decode(r.header(new He),r.version())}throw new Error(`Unrecognized Message type: { name: ${rt[t]}, type: ${t} }`)}}z.encode=ny;z.decode=ey;z.fromJSON=jd;q.encode=ry;q.decode=X_;q.fromJSON=Vd;Zt.encode=iy;Zt.decode=G_;Zt.fromJSON=sc;xe.encode=sy;xe.decode=K_;xe.fromJSON=Hd;rr.encode=oy;rr.decode=q_;Fe.encode=ay;Fe.decode=J_;function X_(r,t=new Map){let e=ty(r,t);return new q(e,Ho(r),t)}function G_(r,t=Vt.V4){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Zt(r.length(),Z_(r),Q_(r,t))}function K_(r,t=Vt.V4){return new xe(Zt.decode(r.data(),t),r.id(),r.isDelta())}function J_(r){return new Fe(r.offset(),r.length())}function q_(r){return new rr(r.length(),r.nullCount())}function Z_(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=rr.decode(e));return t}function Q_(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<Vt.V4&&(n.bb_pos+=8*(i+1)),e[++s]=Fe.decode(n));return e}function ty(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=z.decode(n,t));return e}function $d(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=z.decode(n,t));return e}function ey(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=Xd(r,$d(r,t)),n=new z(r.name(),i,r.nullable(),Ho(r))):t.has(e=a.id().low)?(s=(s=a.indexType())?Yd(s):new or,o=new Be(t.get(e),s,e,a.isOrdered()),n=new z(r.name(),o,r.nullable(),Ho(r))):(s=(s=a.indexType())?Yd(s):new or,t.set(e,i=Xd(r,$d(r,t))),o=new Be(i,s,e,a.isOrdered()),n=new z(r.name(),o,r.nullable(),Ho(r))),n||null}function Ho(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 Yd(r){return new Ot(r.isSigned(),r.bitWidth())}function Xd(r,t){let e=r.typeType();switch(e){case Ft.NONE:return new le;case Ft.Null:return new le;case Ft.Binary:return new Fr;case Ft.Utf8:return new xr;case Ft.Bool:return new Tr;case Ft.List:return new Ge((t||[])[0]);case Ft.Struct_:return new bt(t||[])}switch(e){case Ft.Int:{let n=r.type(new zt);return new Ot(n.isSigned(),n.bitWidth())}case Ft.FloatingPoint:{let n=r.type(new ge);return new me(n.precision())}case Ft.Decimal:{let n=r.type(new Wt);return new Br(n.scale(),n.precision(),n.bitWidth())}case Ft.Date:{let n=r.type(new _e);return new Dr(n.unit())}case Ft.Time:{let n=r.type(new te);return new Xe(n.unit(),n.bitWidth())}case Ft.Timestamp:{let n=r.type(new ee);return new Er(n.unit(),n.timezone())}case Ft.Interval:{let n=r.type(new we);return new Or(n.unit())}case Ft.Union:{let n=r.type(new jt);return new Ke(n.mode(),n.typeIdsArray()||[],t||[])}case Ft.FixedSizeBinary:{let n=r.type(new ye);return new Rr(n.byteWidth())}case Ft.FixedSizeList:{let n=r.type(new be);return new Je(n.listSize(),(t||[])[0])}case Ft.Map:{let n=r.type(new ve);return new qe((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Ft[e]}" (${e})`)}function ry(r,t){let e=t.fields.map(s=>z.encode(r,s));Bt.startFieldsVector(r,e.length);let n=Bt.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?Bt.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString(`${s}`),u=r.createString(`${o}`);return gt.startKeyValue(r),gt.addKey(r,a),gt.addValue(r,u),gt.endKeyValue(r)})):-1;return Bt.startSchema(r),Bt.addFields(r,n),Bt.addEndianness(r,cy?Zr.Little:Zr.Big),i!==-1&&Bt.addCustomMetadata(r,i),Bt.endSchema(r)}function ny(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;T.isDictionary(s)?(o=s.dictionary.typeId,i=Po.visit(s,r),n=Po.visit(s.dictionary,r)):n=Po.visit(s,r);let a=(s.children||[]).map(m=>z.encode(r,m)),u=Lt.createChildrenVector(r,a),c=t.metadata&&t.metadata.size>0?Lt.createCustomMetadataVector(r,[...t.metadata].map(([m,y])=>{let b=r.createString(`${m}`),I=r.createString(`${y}`);return gt.startKeyValue(r),gt.addKey(r,b),gt.addValue(r,I),gt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),Lt.startField(r),Lt.addType(r,n),Lt.addTypeType(r,o),Lt.addChildren(r,u),Lt.addNullable(r,!!t.nullable),e!==-1&&Lt.addName(r,e),i!==-1&&Lt.addDictionary(r,i),c!==-1&&Lt.addCustomMetadata(r,c),Lt.endField(r)}function iy(r,t){let e=t.nodes||[],n=t.buffers||[];ne.startNodesVector(r,e.length);for(let o of e.slice().reverse())rr.encode(r,o);let i=r.endVector();ne.startBuffersVector(r,n.length);for(let o of n.slice().reverse())Fe.encode(r,o);let s=r.endVector();return ne.startRecordBatch(r),ne.addLength(r,new xn(t.length,0)),ne.addNodes(r,i),ne.addBuffers(r,s),ne.endRecordBatch(r)}function sy(r,t){let e=Zt.encode(r,t.data);return He.startDictionaryBatch(r),He.addId(r,new xn(t.id,0)),He.addIsDelta(r,t.isDelta),He.addData(r,e),He.endDictionaryBatch(r)}function oy(r,t){return qn.createFieldNode(r,new xn(t.length,0),new xn(t.nullCount,0))}function ay(r,t){return Jn.createBuffer(r,new xn(t.offset,0),new xn(t.length,0))}var cy=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var ac=r=>`Expected ${rt[r]} Message in stream, but was null or length 0.`,cc=r=>`Header pointer of flatbuffer-encoded ${rt[r]} Message is null or length 0.`,Gd=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Kd=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,Qn=class{constructor(t){this.source=t instanceof br?t:new br(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?wt:t.value===-1&&(t=this.readMetadataLength()).done?wt:(t=this.readMetadata(t.value)).done?wt: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(ac(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=k(this.source.read(t));if(e.byteLength<t)throw new Error(Kd(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=rt.Schema,n=this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(cc(e));return i}readMetadataLength(){let t=this.source.read(zo),e=t&&new ue(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 wt;if(e.byteLength<t)throw new Error(Gd(t,e.byteLength));return{done:!1,value:Nt.decode(e)}}},rs=class{constructor(t,e){this.source=t instanceof Se?t:Ts(t)?new tn(t,e):new Se(t)}[Symbol.asyncIterator](){return this}next(){return A(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?wt:t.value===-1&&(t=yield this.readMetadataLength()).done?wt:(t=yield this.readMetadata(t.value)).done?wt:t})}throw(t){return A(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return A(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return A(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(ac(t));return e.value})}readMessageBody(t){return A(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=k(yield this.source.read(t));if(e.byteLength<t)throw new Error(Kd(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return A(this,void 0,void 0,function*(){let e=rt.Schema,n=yield this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(cc(e));return i})}readMetadataLength(){return A(this,void 0,void 0,function*(){let t=yield this.source.read(zo),e=t&&new ue(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(t){return A(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return wt;if(e.byteLength<t)throw new Error(Gd(t,e.byteLength));return{done:!1,value:Nt.decode(e)}})}},ns=class extends Qn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Ri?t:new Ri(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Nt.fromJSON(t.schema,rt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:Nt.fromJSON(e,rt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:Nt.fromJSON(e,rt.RecordBatch)}}return this._body=[],wt}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(ac(t));return e.value}readSchema(){let t=rt.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(cc(t));return n}},zo=4,oc="ARROW1",ti=new Uint8Array(oc.length);for(let r=0;r<oc.length;r+=1)ti[r]=oc.codePointAt(r);function Wo(r,t=0){for(let e=-1,n=ti.length;++e<n;)if(ti[e]!==r[t+e])return!1;return!0}var ei=ti.length,lc=ei+zo,Jd=ei*2+zo;var Mt=class extends gn{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 ze(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 Kt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Kt.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 Mt?t:Fs(t)?uy(t):Ts(t)?hy(t):ze(t)?(()=>A(this,void 0,void 0,function*(){return yield Mt.from(yield t)}))():Bs(t)||bi(t)||Es(t)||Le(t)?fy(new Se(t)):dy(new br(t))}static readAll(t){return t instanceof Mt?t.isSync()?qd(t):Zd(t):Fs(t)||ArrayBuffer.isView(t)||We(t)||xs(t)?qd(t):Zd(t)}},wr=class extends Mt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return pe(this,arguments,function*(){yield $(yield*On(ke(this[Symbol.iterator]())))})}},en=class extends Mt{constructor(t){super(t),this._impl=t}readAll(){var t,e;return A(this,void 0,void 0,function*(){let n=new Array;try{for(var i=ke(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]()}},rn=class extends wr{constructor(t){super(t),this._impl=t}},is=class extends en{constructor(t){super(t),this._impl=t}},jo=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=P({type:new bt(this.schema.fields),length:t.length,children:n});return new mt(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 u=o.dictionaries.get(n),c=this._loadVectors(t.data,e,[u]);return(a&&i?a.concat(new N(c)):new N(c)).memoize()}return a.memoize()}_loadVectors(t,e,n){return new ki(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}},ri=class extends jo{constructor(t,e){super(e),this._reader=Fs(t)?new ns(this._handle=t):new Qn(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Qd(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):wt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):wt}next(){if(this.closed)return wt;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Fn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},ni=class extends jo{constructor(t,e){super(e),this._reader=new rs(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return A(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 A(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Qd(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return A(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):wt})}return(t){return A(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):wt})}next(){return A(this,void 0,void 0,function*(){if(this.closed)return wt;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Fn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return A(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},$o=class extends ri{constructor(t,e){super(t instanceof Mi?t:new Mi(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(rt.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(rt.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-lc,n=t.readInt32(e),i=t.readAt(e-n,n);return Lr.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}},uc=class extends ni{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 tn?t:new tn(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 A(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 A(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(rt.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 A(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(rt.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 A(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-lc,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return Lr.decode(i)})}_readNextMessageAndValidate(t){return A(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})}},dc=class extends ri{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new _o(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}};function Qd(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*qd(r){let t=Mt.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Zd(r){return pe(this,arguments,function*(){let e=yield $(Mt.from(r));try{if(!(yield $(e.open({autoDestroy:!1}))).closed)do yield yield $(e);while(!(yield $(e.reset().open())).closed)}finally{yield $(e.cancel())}})}function uy(r){return new wr(new dc(r))}function dy(r){let t=r.peek(ei+7&-8);return t&&t.byteLength>=4?Wo(t)?new rn(new $o(r.read())):new wr(new ri(r)):new wr(new ri(function*(){}()))}function fy(r){return A(this,void 0,void 0,function*(){let t=yield r.peek(ei+7&-8);return t&&t.byteLength>=4?Wo(t)?new rn(new $o(yield r.read())):new en(new ni(r)):new en(new ni(function(){return pe(this,arguments,function*(){})}()))})}function hy(r){return A(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new tn(r,t);return t>=Jd&&Wo(yield e.readAt(0,ei+7&-8))?new is(new uc(e)):new en(new ni(e))})}var Dt=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 mt?s.data.children:s.data),n=new Dt;return n.visitMany(e(t)),n}visit(t){if(t instanceof N)return this.visitMany(t.data),this;let{type:e}=t;if(!T.isDictionary(e)){let{length:n,nullCount:i}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");T.isNull(e)||nr.call(this,i<=0?new Uint8Array(0):Vn(t.offset,n,t.nullBitmap)),this.nodes.push(new rr(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 nr(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Fe(this._byteLength,t)),this._byteLength+=t,this}function py(r){let{type:t,length:e,typeIds:n,valueOffsets:i}=r;if(nr.call(this,n),t.mode===Tt.Sparse)return fc.call(this,r);if(t.mode===Tt.Dense){if(r.offset<=0)return nr.call(this,i),fc.call(this,r);{let s=n.reduce((m,y)=>Math.max(m,y),n[0]),o=new Int32Array(s+1),a=new Int32Array(s+1).fill(-1),u=new Int32Array(e),c=gi(-i[0],e,i);for(let m,y,b=-1;++b<e;)(y=a[m=n[b]])===-1&&(y=a[m]=c[m]),u[b]=c[b]-y,++o[m];nr.call(this,u);for(let m,y=-1,b=t.children.length;++y<b;)if(m=r.children[y]){let I=t.typeIds[y],Z=Math.min(e,o[I]);this.visit(m.slice(a[I],Z))}}}return this}function my(r){let t;return r.nullCount>=r.length?nr.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?nr.call(this,Vn(r.offset,r.length,t)):nr.call(this,mn(r.values))}function nn(r){return nr.call(this,r.values.subarray(0,r.length*r.stride))}function tf(r){let{length:t,values:e,valueOffsets:n}=r,i=n[0],s=n[t],o=Math.min(s-i,e.byteLength-i);return nr.call(this,gi(-n[0],t,n)),nr.call(this,e.subarray(i,i+o)),this}function hc(r){let{length:t,valueOffsets:e}=r;return e&&nr.call(this,gi(e[0],t,e)),this.visit(r.children[0])}function fc(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}Dt.prototype.visitBool=my;Dt.prototype.visitInt=nn;Dt.prototype.visitFloat=nn;Dt.prototype.visitUtf8=tf;Dt.prototype.visitBinary=tf;Dt.prototype.visitFixedSizeBinary=nn;Dt.prototype.visitDate=nn;Dt.prototype.visitTimestamp=nn;Dt.prototype.visitTime=nn;Dt.prototype.visitDecimal=nn;Dt.prototype.visitList=hc;Dt.prototype.visitStruct=fc;Dt.prototype.visitUnion=py;Dt.prototype.visitInterval=nn;Dt.prototype.visitFixedSizeList=hc;Dt.prototype.visitMap=hc;var Tn=class extends gn{constructor(t){super(),this._position=0,this._started=!1,this._sink=new yr,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,ae(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 ze(t)?t.then(e=>this.writeAll(e)):Le(t)?mc(this,t):pc(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 yr?this._sink=t:(this._sink=new yr,t&&Au(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Fu(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||!An(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 Et&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof mt&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!An(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof mt?t instanceof Fn||this._writeRecordBatch(t):t instanceof Et?this.writeAll(t.batches):We(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=Nt.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,u=a-s-o;return t.headerType===rt.RecordBatch?this._recordBatchBlocks.push(new tr(a,t.bodyLength,this._position)):t.headerType===rt.DictionaryBatch&&this._dictionaryBlocks.push(new tr(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(u)}_write(t){if(this._started){let e=k(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(Nt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ti)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=Dt.assemble(t),o=new Zt(t.numRows,n,i),a=Nt.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}=Dt.assemble(new N([t])),u=new Zt(t.length,s,o),c=new xe(u,e,n),m=Nt.from(c,i);return this._writeMessage(m)._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}},Hr=class extends Tn{static writeAll(t,e){let n=new Hr(e);return ze(t)?t.then(i=>n.writeAll(i)):Le(t)?mc(n,t):pc(n,t)}},zr=class extends Tn{static writeAll(t){let e=new zr;return ze(t)?t.then(n=>e.writeAll(n)):Le(t)?mc(e,t):pc(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=Lr.encode(new Lr(t,Vt.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function pc(r,t){let e=t;t instanceof Et&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function mc(r,t){var e,n,i,s;return A(this,void 0,void 0,function*(){try{for(e=ke(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 ef(r,t){if(Le(r))return yy(r,t);if(We(r))return _y(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function _y(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 u,c=null,m=o.desiredSize||null;for(;!(c=a.next(n?m:null)).done;)if(ArrayBuffer.isView(c.value)&&(u=k(c.value))&&(m!=null&&n&&(m=m-u.byteLength+1),c.value=u),o.enqueue(c.value),m!=null&&--m<=0)return;o.close()}}function yy(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 A(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return A(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return A(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 A(this,void 0,void 0,function*(){let u,c=null,m=o.desiredSize||null;for(;!(c=yield a.next(n?m:null)).done;)if(ArrayBuffer.isView(c.value)&&(u=k(c.value))&&(m!=null&&n&&(m=m-u.byteLength+1),c.value=u),o.enqueue(c.value),m!=null&&--m<=0)return;o.close()})}}function sf(r){return new _c(r)}var _c=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=Su(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=vn(s),this._getSize=i!=="bytes"?rf:nf;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:u=>{this._maybeFlush(this._builder,this._controller=u)},start:u=>{this._maybeFlush(this._builder,this._controller=u)}},{highWaterMark:o,size:i!=="bytes"?rf:nf}),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:u=>this._writeValueAndReturnChunkSize(u)})}_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)}},rf=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},nf=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function Yo(r,t){let e=new yr,n=null,i=new ReadableStream({cancel(){return A(this,void 0,void 0,function*(){yield e.close()})},start(a){return A(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return A(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 A(this,void 0,void 0,function*(){return yield(yield Mt.from(e)).open(t)})}function o(a,u){return A(this,void 0,void 0,function*(){let c=a.desiredSize,m=null;for(;!(m=yield u.next()).done;)if(a.enqueue(m.value),c!=null&&--c<=0)return;a.close()})}}function Xo(r,t){let e=new this(r),n=new Se(e),i=new ReadableStream({cancel(){return A(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return A(this,void 0,void 0,function*(){yield s(o)})},start(o){return A(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 A(this,void 0,void 0,function*(){let a=null,u=o.desiredSize;for(;a=yield n.read(u||null);)if(o.enqueue(a),u!=null&&(u-=a.byteLength)<=0)return;o.close()})}}function Go(r,t="stream"){return(t==="stream"?Hr:zr).writeAll(r).toUint8Array(!0)}var vy=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Da),Qa),$a),Ea),Fa),ja),{compareSchemas:An,compareFields:Od,compareTypes:Rd});Kt.toDOMStream=ef;At.throughDOM=sf;Mt.throughDOM=Yo;rn.throughDOM=Yo;wr.throughDOM=Yo;Tn.throughDOM=Xo;zr.throughDOM=Xo;Hr.throughDOM=Xo;function ii(r){switch(r.typeId){case h.Binary:return{sqlType:"binary"};case h.Bool:return{sqlType:"bool"};case h.Date:return{sqlType:"date"};case h.DateDay:return{sqlType:"date32[d]"};case h.DateMillisecond:return{sqlType:"date64[ms]"};case h.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case h.Float:return{sqlType:"float"};case h.Float16:return{sqlType:"float16"};case h.Float32:return{sqlType:"float32"};case h.Float64:return{sqlType:"float64"};case h.Int:return{sqlType:"int32"};case h.Int16:return{sqlType:"int16"};case h.Int32:return{sqlType:"int32"};case h.Int64:return{sqlType:"int64"};case h.Uint16:return{sqlType:"uint16"};case h.Uint32:return{sqlType:"uint32"};case h.Uint64:return{sqlType:"uint64"};case h.Uint8:return{sqlType:"uint8"};case h.IntervalDayTime:return{sqlType:"interval[dt]"};case h.IntervalYearMonth:return{sqlType:"interval[m]"};case h.List:return{sqlType:"list",valueType:ii(r.valueType)};case h.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case h.Null:return{sqlType:"null"};case h.Utf8:return{sqlType:"utf8"};case h.Struct:return{sqlType:"struct",fields:r.children.map(e=>Ko(e.name,e.type))};case h.Map:{let t=r;return{sqlType:"map",keyType:ii(t.keyType),valueType:ii(t.valueType)}}case h.Time:return{sqlType:"time[s]"};case h.TimeMicrosecond:return{sqlType:"time[us]"};case h.TimeMillisecond:return{sqlType:"time[ms]"};case h.TimeNanosecond:return{sqlType:"time[ns]"};case h.TimeSecond:return{sqlType:"time[s]"};case h.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case h.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case h.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case h.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case h.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error(`unsupported arrow type: ${r.toString()}`)}function Ko(r,t){let e=ii(t);return e.name=r,e}var Jo=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],t.data[2],t.data[3]),this.sendOK(t);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(t.data[0],t.data[1]),this.sendOK(t);break;case"REGISTER_FILE_HANDLE":this._bindings.registerFileHandle(t.data[0],t.data[1],t.data[2],t.data[3]),this.sendOK(t);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(t.data[0],t.data[1]),this.sendOK(t);break;case"COPY_FILE_TO_BUFFER":{let e=this._bindings.copyFileToBuffer(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_BUFFER",data:e},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(t.data[0],t.data[1]),this.sendOK(t);break;case"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 bc={};var Sy=(()=>{var r=bc.url;return function(t){t=t||{};function e(){return St.buffer!=de&&Ir(St.buffer),Dc}function n(){return St.buffer!=de&&Ir(St.buffer),Ec}function i(){return St.buffer!=de&&Ir(St.buffer),Oc}function s(){return St.buffer!=de&&Ir(St.buffer),Rc}function o(){return St.buffer!=de&&Ir(St.buffer),Mc}function a(){return St.buffer!=de&&Ir(St.buffer),Uc}function u(){return St.buffer!=de&&Ir(St.buffer),kc}var c=typeof t<"u"?t:{},m,y;c.ready=new Promise(function(l,d){m=l,y=d});var b=Object.assign({},c),I=[],Z="./this.program",J=(l,d)=>{throw d},_t=typeof window=="object",ft=typeof importScripts=="function",yt=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",F=c.ENVIRONMENT_IS_PTHREAD||!1,Yt="";function Dn(l){return c.locateFile?c.locateFile(l,Yt):Yt+l}var si,oi,Wr,et;function ie(l){if(l instanceof di)return;ct("exiting due to exception: "+l)}if(yt){ft?Yt=yc().dirname(Yt)+"/":Yt=__dirname+"/";var Xt,Qt;typeof ba=="function"&&(Xt=af(),Qt=yc()),si=(d,f)=>(d=Qt.normalize(d),Xt.readFileSync(d,f?void 0:"utf8")),Wr=d=>{var f=si(d,!0);return f.buffer||(f=new Uint8Array(f)),f},oi=(d,f,p)=>{d=Qt.normalize(d),Xt.readFile(d,function(_,S){_?p(_):f(S.buffer)})},process.argv.length>1&&(Z=process.argv[1].replace(/\\/g,"/")),I=process.argv.slice(2),process.on("uncaughtException",function(d){if(!(d instanceof di))throw d}),process.on("unhandledRejection",function(d){throw d}),J=(d,f)=>{if(ss())throw process.exitCode=d,f;ie(f),process.exit(d)},c.inspect=function(){return"[Emscripten Module object]"};let l;try{l=cf()}catch(d){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),d}global.Worker=l.Worker}else(_t||ft)&&(ft?Yt=self.location.href:typeof document<"u"&&document.currentScript&&(Yt=document.currentScript.src),r&&(Yt=r),Yt.indexOf("blob:")!==0?Yt=Yt.substr(0,Yt.replace(/[?#].*/,"").lastIndexOf("/")+1):Yt="",yt||(si=l=>{var d=new XMLHttpRequest;return d.open("GET",l,!1),d.send(null),d.responseText},ft&&(Wr=l=>{var d=new XMLHttpRequest;return d.open("GET",l,!1),d.responseType="arraybuffer",d.send(null),new Uint8Array(d.response)}),oi=(l,d,f)=>{var p=new XMLHttpRequest;p.open("GET",l,!0),p.responseType="arraybuffer",p.onload=()=>{if(p.status==200||p.status==0&&p.response){d(p.response);return}f()},p.onerror=f,p.send(null)}),et=l=>document.title=l);yt&&typeof performance>"u"&&(global.performance=lf().performance);var Gt=console.log.bind(console),Pt=console.warn.bind(console);yt&&(Gt=l=>Xt.writeSync(1,l+`
|
|
11
11
|
`),Pt=l=>Xt.writeSync(2,l+`
|
|
12
|
-
`));var ht=c.print||Gt,ct=c.printErr||Pt;Object.assign(c,b),b=null,c.arguments&&(I=c.arguments),c.thisProgram&&(Z=c.thisProgram),c.quit&&(J=c.quit);var ai=Atomics.load,Oy=Atomics.store,Ry=Atomics.compareExchange,ci;c.wasmBinary&&(ci=c.wasmBinary);var Ac=c.noExitRuntime||!0;typeof WebAssembly!="object"&&He("no native wasm support detected");var St,Fc,ia=!1,li;function sa(l,d){l||He(d)}var xc=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Tc(l,d,f){d>>>=0;for(var p=d+f,_=d;l[_]&&!(_>=p);)++_;if(_-d>16&&l.buffer&&xc)return xc.decode(l.buffer instanceof SharedArrayBuffer?l.slice(d,_):l.subarray(d,_));for(var S="";d<_;){var w=l[d++];if(!(w&128)){S+=String.fromCharCode(w);continue}var v=l[d++]&63;if((w&224)==192){S+=String.fromCharCode((w&31)<<6|v);continue}var x=l[d++]&63;if((w&240)==224?w=(w&15)<<12|v<<6|x:w=(w&7)<<18|v<<12|x<<6|l[d++]&63,w<65536)S+=String.fromCharCode(w);else{var Q=w-65536;S+=String.fromCharCode(55296|Q>>10,56320|Q&1023)}}return S}function Sr(l,d){return l>>>=0,l?Tc(n(),l,d):""}function Bc(l,d,f,p){if(f>>>=0,!(p>0))return 0;for(var _=f,S=f+p-1,w=0;w<l.length;++w){var v=l.charCodeAt(w);if(v>=55296&&v<=57343){var x=l.charCodeAt(++w);v=65536+((v&1023)<<10)|x&1023}if(v<=127){if(f>=S)break;d[f++>>>0]=v}else if(v<=2047){if(f+1>=S)break;d[f++>>>0]=192|v>>6,d[f++>>>0]=128|v&63}else if(v<=65535){if(f+2>=S)break;d[f++>>>0]=224|v>>12,d[f++>>>0]=128|v>>6&63,d[f++>>>0]=128|v&63}else{if(f+3>=S)break;d[f++>>>0]=240|v>>18,d[f++>>>0]=128|v>>12&63,d[f++>>>0]=128|v>>6&63,d[f++>>>0]=128|v&63}}return d[f>>>0]=0,f-_}function oa(l,d,f){return Bc(l,n(),d,f)}function gf(l){for(var d=0,f=0;f<l.length;++f){var p=l.charCodeAt(f);p<=127?d++:p<=2047?d+=2:p>=55296&&p<=57343?(d+=4,++f):d+=3}return d}var de,Dc,Ec,Oc,Rc,Mc,Uc,wf,kc;F&&(de=c.buffer);function Ir(l){de=l,c.HEAP8=Dc=new Int8Array(l),c.HEAP16=Oc=new Int16Array(l),c.HEAP32=Mc=new Int32Array(l),c.HEAPU8=Ec=new Uint8Array(l),c.HEAPU16=Rc=new Uint16Array(l),c.HEAPU32=Uc=new Uint32Array(l),c.HEAPF32=wf=new Float32Array(l),c.HEAPF64=kc=new Float64Array(l)}var Lc=c.INITIAL_MEMORY||16777216;if(F)St=c.wasmMemory,de=c.buffer;else if(c.wasmMemory)St=c.wasmMemory;else if(St=new WebAssembly.Memory({initial:Lc/65536,maximum:65536,shared:!0}),!(St.buffer instanceof SharedArrayBuffer))throw ct("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),yt&&ct("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");St&&(de=St.buffer),Lc=de.byteLength,Ir(de);var Nc,Cc=[],Pc=[],vf=[],Vc=[],Sf=!1;function ss(){return Ac}function If(){if(c.preRun)for(typeof c.preRun=="function"&&(c.preRun=[c.preRun]);c.preRun.length;)xf(c.preRun.shift());os(Cc)}function Hc(){Sf=!0,!F&&os(Pc)}function Af(){F||os(vf)}function Ff(){if(!F){if(c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;)Bf(c.postRun.shift());os(Vc)}}function xf(l){Cc.unshift(l)}function Tf(l){Pc.unshift(l)}function Bf(l){Vc.unshift(l)}var cn=0,aa=null,ui=null;function Df(l){cn++,c.monitorRunDependencies&&c.monitorRunDependencies(cn)}function Ef(l){if(cn--,c.monitorRunDependencies&&c.monitorRunDependencies(cn),cn==0&&(aa!==null&&(clearInterval(aa),aa=null),ui)){var d=ui;ui=null,d()}}function He(l){F?postMessage({cmd:"onAbort",arg:l}):c.onAbort&&c.onAbort(l),l="Aborted("+l+")",ct(l),ia=!0,li=1,l+=". Build with -sASSERTIONS for more info.",$l()}var Of="data:application/octet-stream;base64,";function zc(l){return l.startsWith(Of)}var Re;c.locateFile?(Re="./duckdb-coi.wasm",zc(Re)||(Re=Dn(Re))):Re=new URL("./duckdb-coi.wasm",bc.url).toString();function Wc(l){try{if(l==Re&&ci)return new Uint8Array(ci);if(Wr)return Wr(l);throw"both async and sync fetching of the wasm failed"}catch(d){He(d)}}function Rf(){return!ci&&(_t||ft)&&typeof fetch=="function"?fetch(Re,{credentials:"same-origin"}).then(function(l){if(!l.ok)throw"failed to load wasm binary file at '"+Re+"'";return l.arrayBuffer()}).catch(function(){return Wc(Re)}):Promise.resolve().then(function(){return Wc(Re)})}function Mf(){var l={a:Vh};function d(w,v){var x=w.exports;if(c.asm=x,Vf(c.asm.hb),Nc=c.asm.wa,Tf(c.asm.ua),Fc=v,!F){var Q=C.unusedWorkers.length;C.unusedWorkers.forEach(function(nt){C.loadWasmModuleToWorker(nt,function(){--Q||Ef("wasm-instantiate")})})}}F||Df("wasm-instantiate");function f(w){d(w.instance,w.module)}function p(w){return Rf().then(function(v){return WebAssembly.instantiate(v,l)}).then(function(v){return v}).then(w,function(v){ct("failed to asynchronously prepare wasm: "+v),He(v)})}function _(){return!ci&&typeof WebAssembly.instantiateStreaming=="function"&&!zc(Re)&&!yt&&typeof fetch=="function"?fetch(Re,{credentials:"same-origin"}).then(function(w){var v=WebAssembly.instantiateStreaming(w,l);return v.then(f,function(x){return ct("wasm streaming compile failed: "+x),ct("falling back to ArrayBuffer instantiation"),p(f)})}):p(f)}if(c.instantiateWasm)try{var S=c.instantiateWasm(l,d);return S}catch(w){ct("Module.instantiateWasm callback failed with error: "+w),y(w)}return _().catch(y),{}}var Uf={};function di(l){this.name="ExitStatus",this.message="Program terminated with exit("+l+")",this.status=l}function kf(l){var d=C.pthreads[l];delete C.pthreads[l],d.terminate(),ma(l),C.runningWorkers.splice(C.runningWorkers.indexOf(d),1),d.pthread_ptr=0}function Lf(l){var d=C.pthreads[l];d.postMessage({cmd:"cancel"})}function jc(l){var d=C.pthreads[l];sa(d),C.returnWorkerToPool(d)}function $c(l,d){return n().fill(0,l,l+d),l}function Yc(l){var d=C.getNewWorker();if(!d)return 6;C.runningWorkers.push(d),C.pthreads[l.pthread_ptr]=d,d.pthread_ptr=l.pthread_ptr;var f={cmd:"run",start_routine:l.startRoutine,arg:l.arg,pthread_ptr:l.pthread_ptr};return d.runPthread=()=>{f.time=performance.now(),d.postMessage(f,l.transferList)},d.loaded&&(d.runPthread(),delete d.runPthread),0}var ln={varargs:void 0,get:function(){ln.varargs+=4;var l=o()[ln.varargs-4>>>2];return l},getStr:function(l){var d=Sr(l);return d}};function Xc(l){if(F)return tt(1,1,l);li=l,ss()||(C.terminateAllThreads(),c.onExit&&c.onExit(l),ia=!0),J(l,new di(l))}function Gc(l,d){if(li=l,!d&&F)throw qc(l),"unwind";Xc(l)}var Kc=Gc;function Jc(l){if(l instanceof di||l=="unwind")return li;J(1,l)}var C={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init:function(){F?C.initWorker():C.initMainThread()},initMainThread:function(){for(var l=4;l--;)C.allocateUnusedWorker()},initWorker:function(){Ac=!1},setExitStatus:function(l){li=l},terminateAllThreads:function(){for(var l of Object.values(C.pthreads))C.returnWorkerToPool(l);for(var l of C.unusedWorkers)l.terminate();C.unusedWorkers=[]},returnWorkerToPool:function(l){var d=l.pthread_ptr;delete C.pthreads[d],C.unusedWorkers.push(l),C.runningWorkers.splice(C.runningWorkers.indexOf(l),1),l.pthread_ptr=0,ma(d)},receiveObjectTransfer:function(l){},threadInitTLS:function(){C.tlsInitFunctions.forEach(l=>l())},loadWasmModuleToWorker:function(l,d){l.onmessage=f=>{var p=f.data,_=p.cmd;if(l.pthread_ptr&&(C.currentProxiedOperationCallerThread=l.pthread_ptr),p.targetThread&&p.targetThread!=hs()){var S=C.pthreads[p.targetThread];S?S.postMessage(p,p.transferList):ct('Internal error! Worker sent a message "'+_+'" to target pthread '+p.targetThread+", but that thread no longer exists!"),C.currentProxiedOperationCallerThread=void 0;return}_==="processProxyingQueue"?da(p.queue):_==="spawnThread"?Yc(p):_==="cleanupThread"?jc(p.thread):_==="killThread"?kf(p.thread):_==="cancelThread"?Lf(p.thread):_==="loaded"?(l.loaded=!0,d&&d(l),l.runPthread&&(l.runPthread(),delete l.runPthread)):_==="print"?ht("Thread "+p.threadId+": "+p.text):_==="printErr"?ct("Thread "+p.threadId+": "+p.text):_==="alert"?alert("Thread "+p.threadId+": "+p.text):p.target==="setimmediate"?l.postMessage(p):_==="onAbort"?c.onAbort&&c.onAbort(p.arg):_&&ct("worker sent an unknown command "+_),C.currentProxiedOperationCallerThread=void 0},l.onerror=f=>{var p="worker sent an error!";throw ct(p+" "+f.filename+":"+f.lineno+": "+f.message),f},yt&&(l.on("message",function(f){l.onmessage({data:f})}),l.on("error",function(f){l.onerror(f)}),l.on("detachedExit",function(){})),l.postMessage({cmd:"load",urlOrBlob:c.mainScriptUrlOrBlob,wasmMemory:St,wasmModule:Fc})},allocateUnusedWorker:function(){if(!c.locateFile){C.unusedWorkers.push(new Worker(new URL("duckdb_wasm.worker.js",bc.url)));return}var l=Dn("duckdb_wasm.worker.js");C.unusedWorkers.push(new Worker(l))},getNewWorker:function(){return C.unusedWorkers.length==0&&(C.allocateUnusedWorker(),C.loadWasmModuleToWorker(C.unusedWorkers[0])),C.unusedWorkers.pop()}};c.PThread=C;function os(l){for(;l.length>0;)l.shift()(c)}function Nf(){var l=hs(),d=o()[l+44>>>2],f=o()[l+48>>>2],p=d-f;Yl(d,p),_s(d)}c.establishStackSpace=Nf;function qc(l){if(F)return tt(2,0,l);try{Kc(l)}catch(d){Jc(d)}}var as=[];function Cf(l){var d=as[l];return d||(l>=as.length&&(as.length=l+1),as[l]=d=Nc.get(l)),d}function Pf(l,d){var f=Cf(l)(d);ss()?C.setExitStatus(f):jl(f)}c.invokeEntryPoint=Pf;function Vf(l){C.tlsInitFunctions.push(l)}function Hf(l,d,f,p){He("Assertion failed: "+Sr(l)+", at: "+[d?Sr(d):"unknown filename",f,p?Sr(p):"unknown function"])}function zf(l){Hl(l,!ft,1,!_t),C.threadInitTLS()}function Wf(l){F?postMessage({cmd:"cleanupThread",thread:l}):jc(l)}function Zc(l,d,f,p){return F?tt(3,1,l,d,f,p):Qc(l,d,f,p)}function Qc(l,d,f,p){if(typeof SharedArrayBuffer>"u")return ct("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var _=[],S=0;if(F&&(_.length===0||S))return Zc(l,d,f,p);if(S)return S;var w={startRoutine:f,pthread_ptr:l,arg:p,transferList:_};return F?(w.cmd="spawnThread",postMessage(w,_),0):Yc(w)}function tl(l,d,f,p,_){if(F)return tt(4,1,l,d,f,p,_);for(var S=0,w=d?o()[d>>>2]:0,v=d?o()[d+4>>>2]:0,x=f?o()[f>>>2]:0,Q=f?o()[f+4>>>2]:0,nt=p?o()[p>>>2]:0,fe=p?o()[p+4>>>2]:0,lt=0,ir=0,xt=0,se=0,he=0,Ar=0,g=(d?o()[d>>>2]:0)|(f?o()[f>>>2]:0)|(p?o()[p>>>2]:0),E=(d?o()[d+4>>>2]:0)|(f?o()[f+4>>>2]:0)|(p?o()[p+4>>>2]:0),pt=function(Op,Rp,Mp,Kl){return Op<32?Rp&Kl:Mp&Kl},ut=0;ut<l;ut++){var oe=1<<ut%32;if(!!pt(ut,g,E,oe)){var mi=ln.getStreamFromFD(ut),gs=ln.DEFAULT_POLLMASK;mi.stream_ops.poll&&(gs=mi.stream_ops.poll(mi)),gs&1&&pt(ut,w,v,oe)&&(ut<32?lt=lt|oe:ir=ir|oe,S++),gs&4&&pt(ut,x,Q,oe)&&(ut<32?xt=xt|oe:se=se|oe,S++),gs&2&&pt(ut,nt,fe,oe)&&(ut<32?he=he|oe:Ar=Ar|oe,S++)}}return d&&(o()[d>>>2]=lt,o()[d+4>>>2]=ir),f&&(o()[f>>>2]=xt,o()[f+4>>>2]=se),p&&(o()[p>>>2]=he,o()[p+4>>>2]=Ar),S}function jf(){ct("missing function: $SOCKFS"),He(-1)}function el(){ct("missing function: $FS"),He(-1)}function fi(l){var d=jf.getSocket(l);if(!d)throw new el.ErrnoError(8);return d}function ca(l){return(l&255)+"."+(l>>8&255)+"."+(l>>16&255)+"."+(l>>24&255)}function rl(l){var d="",f=0,p=0,_=0,S=0,w=0,v=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],Q=!0,nt="";for(v=0;v<5;v++)if(x[v]!==0){Q=!1;break}if(Q){if(nt=ca(x[6]|x[7]<<16),x[5]===-1)return d="::ffff:",d+=nt,d;if(x[5]===0)return d="::",nt==="0.0.0.0"&&(nt=""),nt==="0.0.0.1"&&(nt="1"),d+=nt,d}for(f=0;f<8;f++)x[f]===0&&(f-_>1&&(w=0),_=f,w++),w>p&&(p=w,S=f-p+1);for(f=0;f<8;f++){if(p>1&&x[f]===0&&f>=S&&f<S+p){f===S&&(d+=":",S===0&&(d+=":"));continue}d+=Number(pa(x[f]&65535)).toString(16),d+=f<7?":":""}return d}function nl(l,d){var f=i()[l>>>1],p=pa(s()[l+2>>>1]),_;switch(f){case 2:if(d!==16)return{errno:28};_=o()[l+4>>>2],_=ca(_);break;case 10:if(d!==28)return{errno:28};_=[o()[l+8>>>2],o()[l+12>>>2],o()[l+16>>>2],o()[l+20>>>2]],_=rl(_);break;default:return{errno:5}}return{family:f,addr:_,port:p}}function cs(l){for(var d=l.split("."),f=0;f<4;f++){var p=Number(d[f]);if(isNaN(p))return null;d[f]=p}return(d[0]|d[1]<<8|d[2]<<16|d[3]<<24)>>>0}function ls(l){return parseInt(l)}function la(l){var d,f,p,_,S=/^((?=.*::)(?!.*::.+::)(::)?([\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,w=[];if(!S.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"),":"),d=l.split(":"),d[d.length-4]=ls(d[d.length-4])+ls(d[d.length-3])*256,d[d.length-3]=ls(d[d.length-2])+ls(d[d.length-1])*256,d=d.slice(0,d.length-2)):d=l.split(":"),p=0,_=0,f=0;f<d.length;f++)if(typeof d[f]=="string")if(d[f]==="Z"){for(_=0;_<8-d.length+1;_++)w[f+_]=0;p=_-1}else w[f+p]=ms(parseInt(d[f],16));else w[f+p]=d[f];return[w[1]<<16|w[0],w[3]<<16|w[2],w[5]<<16|w[4],w[7]<<16|w[6]]}var Me={address_map:{id:1,addrs:{},names:{}},lookup_name:function(l){var d=cs(l);if(d!==null||(d=la(l),d!==null))return l;var f;if(Me.address_map.addrs[l])f=Me.address_map.addrs[l];else{var p=Me.address_map.id++;sa(p<65535,"exceeded max address mappings of 65535"),f="172.29."+(p&255)+"."+(p&65280),Me.address_map.names[f]=l,Me.address_map.addrs[l]=f}return f},lookup_addr:function(l){return Me.address_map.names[l]?Me.address_map.names[l]:null}};function il(l,d,f){if(f&&l===0)return null;var p=nl(l,d);if(p.errno)throw new el.ErrnoError(p.errno);return p.addr=Me.lookup_addr(p.addr)||p.addr,p}function sl(l,d,f){if(F)return tt(5,1,l,d,f);var p=fi(l),_=il(d,f);return p.sock_ops.bind(p,_.addr,_.port),0}function ol(l,d,f){if(F)return tt(6,1,l,d,f);var p=fi(l),_=il(d,f);return p.sock_ops.connect(p,_.addr,_.port),0}function al(l,d,f,p){if(F)return tt(7,1,l,d,f,p)}function cl(l,d,f){return F?tt(8,1,l,d,f):(ln.varargs=f,0)}function ll(l,d){if(F)return tt(9,1,l,d)}function ul(l,d,f){if(F)return tt(10,1,l,d,f)}function dl(l,d,f){if(F)return tt(11,1,l,d,f)}function ua(l,d,f,p,_){switch(d){case 2:f=cs(f),$c(l,16),_&&(o()[_>>>2]=16),i()[l>>>1]=d,o()[l+4>>>2]=f,i()[l+2>>>1]=ms(p);break;case 10:f=la(f),$c(l,28),_&&(o()[_>>>2]=28),o()[l>>>2]=d,o()[l+8>>>2]=f[0],o()[l+12>>>2]=f[1],o()[l+16>>>2]=f[2],o()[l+20>>>2]=f[3],i()[l+2>>>1]=ms(p);break;default:return 5}return 0}function fl(l,d,f){if(F)return tt(12,1,l,d,f);var p=fi(l);if(!p.daddr)return-53;var _=ua(d,p.family,Me.lookup_name(p.daddr),p.dport,f);return 0}function hl(l,d,f,p,_){if(F)return tt(13,1,l,d,f,p,_);var S=fi(l);return d===1&&f===4?(o()[p>>>2]=S.error,o()[_>>>2]=4,S.error=null,0):-50}function pl(l,d,f){return F?tt(14,1,l,d,f):(ln.varargs=f,0)}function ml(l,d){if(F)return tt(15,1,l,d)}function _l(l,d,f){if(F)return tt(16,1,l,d,f)}function yl(l,d,f,p){if(F)return tt(17,1,l,d,f,p)}function bl(l,d,f,p){if(F)return tt(18,1,l,d,f,p);ln.varargs=p}function gl(l,d,f,p,_,S){if(F)return tt(19,1,l,d,f,p,_,S);var w=fi(l),v=w.sock_ops.recvmsg(w,f);if(!v)return 0;if(_)var x=ua(_,w.family,Me.lookup_name(v.addr),v.port,S);return n().set(v.buffer,d>>>0),v.buffer.byteLength}function wl(l,d,f,p){if(F)return tt(20,1,l,d,f,p)}function vl(l){if(F)return tt(21,1,l)}function Sl(l,d,f,p,_,S){if(F)return tt(22,1,l,d,f,p,_,S)}function Il(l,d,f){if(F)return tt(23,1,l,d,f)}function Al(l,d){if(F)return tt(24,1,l,d)}function Fl(l,d,f){if(F)return tt(25,1,l,d,f)}function $f(l){}var xl="To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking";function Yf(l,d){He(xl)}function Xf(l,d){He(xl)}function Gf(){return 2097152}var Kf=!0;function Jf(){return Kf}function da(l){Atomics.store(o(),l>>2,1),hs()&&Wl(l),Atomics.compareExchange(o(),l>>2,1,0)}c.executeNotifiedProxyingQueue=da;function qf(l,d,f,p){if(l==d)setTimeout(()=>da(p));else if(F)postMessage({targetThread:l,cmd:"processProxyingQueue",queue:p});else{var _=C.pthreads[l];if(!_)return;_.postMessage({cmd:"processProxyingQueue",queue:p})}return 1}function Zf(l,d,f){return-1}function Qf(){He("")}function th(l,d){return globalThis.DUCKDB_RUNTIME.createDirectory(c,l,d)}function eh(l,d){return globalThis.DUCKDB_RUNTIME.checkDirectory(c,l,d)}function rh(l,d){return globalThis.DUCKDB_RUNTIME.listDirectoryEntries(c,l,d)}function nh(l,d){return globalThis.DUCKDB_RUNTIME.removeDirectory(c,l,d)}function ih(l){return globalThis.DUCKDB_RUNTIME.closeFile(c,l)}function sh(l,d){return globalThis.DUCKDB_RUNTIME.checkFile(c,l,d)}function oh(l){return globalThis.DUCKDB_RUNTIME.getLastFileModificationTime(c,l)}function ah(l,d,f,p){return globalThis.DUCKDB_RUNTIME.moveFile(c,l,d,f,p)}function ch(l,d){return globalThis.DUCKDB_RUNTIME.openFile(c,l,d)}function lh(l,d,f,p){return globalThis.DUCKDB_RUNTIME.readFile(c,l,d,f,p)}function uh(l,d){return globalThis.DUCKDB_RUNTIME.truncateFile(c,l,d)}function dh(l,d,f,p){return globalThis.DUCKDB_RUNTIME.writeFile(c,l,d,f,p)}function fh(l){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(l)}function hh(l,d){return globalThis.DUCKDB_RUNTIME.glob(c,l,d)}function ph(l){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(c,l)}function mh(l,d,f,p,_,S){return globalThis.DUCKDB_RUNTIME.callScalarUDF(c,l,d,f,p,_,S)}function hi(l){hi.shown||(hi.shown={}),hi.shown[l]||(hi.shown[l]=1,yt&&(l="warning: "+l),ct(l))}function _h(){yt||ft||hi("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")}function yh(){return Date.now()}function Tl(){return 4294901760}function bh(){return Tl()}var us;yt?us=()=>{var l=process.hrtime();return l[0]*1e3+l[1]/1e6}:F?us=()=>performance.now()-c.__performance_now_clock_drift:us=()=>performance.now();function gh(l,d,f){n().copyWithin(l>>>0,d>>>0,d+f>>>0)}function wh(){return yt?lf().cpus().length:navigator.hardwareConcurrency}function vh(l){var d=ya(),f=l();return _s(d),f}function tt(l,d){var f=arguments.length-2,p=arguments;return vh(()=>{for(var _=f,S=ys(_*8),w=S>>3,v=0;v<f;v++){var x=p[2+v];u()[w+v>>>0]=x}return zl(l,_,S,d)})}var fa=[];function Sh(l,d,f){fa.length=d;for(var p=f>>3,_=0;_<d;_++)fa[_]=u()[p+_>>>0];var S=l<0,w=S?Uf[-l-1]:Ph[l];return w.apply(null,fa)}function Ih(l){try{return St.grow(l-de.byteLength+65535>>>16),Ir(St.buffer),1}catch(d){}}function Ah(l){var d=n().length;if(l=l>>>0,l<=d)return!1;var f=Tl();if(l>f)return!1;let p=(x,Q)=>x+(Q-x%Q)%Q;for(var _=1;_<=4;_*=2){var S=d*(1+.2/_);S=Math.min(S,l+100663296);var w=Math.min(f,p(Math.max(l,S),65536)),v=Ih(w);if(v)return!0}return!1}function Fh(){throw"unwind"}var ha={};function xh(){return Z||"./this.program"}function pi(){if(!pi.strings){var l=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",d={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:l,_:xh()};for(var f in ha)ha[f]===void 0?delete d[f]:d[f]=ha[f];var p=[];for(var f in d)p.push(f+"="+d[f]);pi.strings=p}return pi.strings}function Th(l,d,f){for(var p=0;p<l.length;++p)e()[d++>>>0]=l.charCodeAt(p);f||(e()[d>>>0]=0)}function Bl(l,d){if(F)return tt(26,1,l,d);var f=0;return pi().forEach(function(p,_){var S=d+f;a()[l+_*4>>>2]=S,Th(p,S),f+=p.length+1}),0}function Dl(l,d){if(F)return tt(27,1,l,d);var f=pi();a()[l>>>2]=f.length;var p=0;return f.forEach(function(_){p+=_.length+1}),a()[d>>>2]=p,0}function El(l){return F?tt(28,1,l):52}function Ol(l,d,f,p,_,S){return F?tt(29,1,l,d,f,p,_,S):52}function Rl(l,d,f,p,_,S){return F?tt(30,1,l,d,f,p,_,S):52}function Ml(l,d,f,p){return F?tt(31,1,l,d,f,p):52}function Ul(l,d,f,p,_){return F?tt(32,1,l,d,f,p,_):70}function kl(l){return F?tt(33,1,l):52}var Bh=[null,[],[]];function Dh(l,d){var f=Bh[l];d===0||d===10?((l===1?ht:ct)(Tc(f,0)),f.length=0):f.push(d)}function Ll(l,d,f,p){if(F)return tt(34,1,l,d,f,p);for(var _=0,S=0;S<f;S++){var w=a()[d>>>2],v=a()[d+4>>>2];d+=8;for(var x=0;x<v;x++)Dh(l,n()[w+x>>>0]);_+=v}return a()[p>>>2]=_,0}function Nl(l,d,f,p){if(F)return tt(35,1,l,d,f,p);var _=0,S=0,w=0,v=0,x=0,Q=0,nt;function fe(lt,ir,xt,se,he,Ar){var g,E,pt,ut;return E=lt===10?28:16,he=lt===10?rl(he):ca(he),g=_a(E),ut=ua(g,lt,he,Ar),sa(!ut),pt=_a(32),o()[pt+4>>>2]=lt,o()[pt+8>>>2]=ir,o()[pt+12>>>2]=xt,o()[pt+24>>>2]=se,a()[pt+20>>>2]=g,lt===10?o()[pt+16>>>2]=28:o()[pt+16>>>2]=16,o()[pt+28>>>2]=0,pt}if(f&&(w=o()[f>>>2],v=o()[f+4>>>2],x=o()[f+8>>>2],Q=o()[f+12>>>2]),x&&!Q&&(Q=x===2?17:6),!x&&Q&&(x=Q===17?2:1),Q===0&&(Q=6),x===0&&(x=1),!l&&!d)return-2;if(w&-1088||f!==0&&o()[f>>>2]&2&&!l)return-1;if(w&32)return-2;if(x!==0&&x!==1&&x!==2)return-7;if(v!==0&&v!==2&&v!==10)return-6;if(d&&(d=Sr(d),S=parseInt(d,10),isNaN(S)))return w&1024?-2:-8;if(!l)return v===0&&(v=2),(w&1)===0&&(v===2?_=ps(2130706433):_=[0,0,0,1]),nt=fe(v,x,Q,null,_,S),a()[p>>>2]=nt,0;if(l=Sr(l),_=cs(l),_!==null)if(v===0||v===2)v=2;else if(v===10&&w&8)_=[0,0,ps(65535),_],v=10;else return-2;else if(_=la(l),_!==null)if(v===0||v===10)v=10;else return-2;return _!=null?(nt=fe(v,x,Q,l,_,S),a()[p>>>2]=nt,0):w&4?-2:(l=Me.lookup_name(l),_=cs(l),v===0?v=2:v===10&&(_=[0,0,ps(65535),_]),nt=fe(v,x,Q,null,_,S),a()[p>>>2]=nt,0)}function Eh(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var l=new Uint8Array(1);return()=>(crypto.getRandomValues(l),l[0])}else if(yt)try{var d=ba("crypto");return()=>d.randomBytes(1)[0]}catch(f){}return()=>He("randomDevice")}function ds(l,d){ds.randomDevice||(ds.randomDevice=Eh());for(var f=0;f<d;f++)e()[l+f>>>0]=ds.randomDevice();return 0}function Oh(l,d,f,p,_,S,w){var v=nl(l,d);if(v.errno)return-6;var x=v.port,Q=v.addr,nt=!1;if(f&&p){var fe;if(w&1||!(fe=Me.lookup_addr(Q))){if(w&8)return-2}else Q=fe;var lt=oa(Q,f,p);lt+1>=p&&(nt=!0)}if(_&&S){x=""+x;var lt=oa(x,_,S);lt+1>=S&&(nt=!0)}return nt?-12:0}function fs(l){return l%4===0&&(l%100!==0||l%400===0)}function Rh(l,d){for(var f=0,p=0;p<=d;f+=l[p++]);return f}var Cl=[31,29,31,30,31,30,31,31,30,31,30,31],Pl=[31,28,31,30,31,30,31,31,30,31,30,31];function Mh(l,d){for(var f=new Date(l.getTime());d>0;){var p=fs(f.getFullYear()),_=f.getMonth(),S=(p?Cl:Pl)[_];if(d>S-f.getDate())d-=S-f.getDate()+1,f.setDate(1),_<11?f.setMonth(_+1):(f.setMonth(0),f.setFullYear(f.getFullYear()+1));else return f.setDate(f.getDate()+d),f}return f}function Uh(l,d,f){var p=f>0?f:gf(l)+1,_=new Array(p),S=Bc(l,_,0,_.length);return d&&(_.length=S),_}function Vl(l,d){e().set(l,d>>>0)}function kh(l,d,f,p){var _=o()[p+40>>>2],S={tm_sec:o()[p>>>2],tm_min:o()[p+4>>>2],tm_hour:o()[p+8>>>2],tm_mday:o()[p+12>>>2],tm_mon:o()[p+16>>>2],tm_year:o()[p+20>>>2],tm_wday:o()[p+24>>>2],tm_yday:o()[p+28>>>2],tm_isdst:o()[p+32>>>2],tm_gmtoff:o()[p+36>>>2],tm_zone:_?Sr(_):""},w=Sr(f),v={"%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 v)w=w.replace(new RegExp(x,"g"),v[x]);var Q=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],nt=["January","February","March","April","May","June","July","August","September","October","November","December"];function fe(g,E,pt){for(var ut=typeof g=="number"?g.toString():g||"";ut.length<E;)ut=pt[0]+ut;return ut}function lt(g,E){return fe(g,E,"0")}function ir(g,E){function pt(oe){return oe<0?-1:oe>0?1:0}var ut;return(ut=pt(g.getFullYear()-E.getFullYear()))===0&&(ut=pt(g.getMonth()-E.getMonth()))===0&&(ut=pt(g.getDate()-E.getDate())),ut}function xt(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 se(g){var E=Mh(new Date(g.tm_year+1900,0,1),g.tm_yday),pt=new Date(E.getFullYear(),0,4),ut=new Date(E.getFullYear()+1,0,4),oe=xt(pt),mi=xt(ut);return ir(oe,E)<=0?ir(mi,E)<=0?E.getFullYear()+1:E.getFullYear():E.getFullYear()-1}var he={"%a":function(g){return Q[g.tm_wday].substring(0,3)},"%A":function(g){return Q[g.tm_wday]},"%b":function(g){return nt[g.tm_mon].substring(0,3)},"%B":function(g){return nt[g.tm_mon]},"%C":function(g){var E=g.tm_year+1900;return lt(E/100|0,2)},"%d":function(g){return lt(g.tm_mday,2)},"%e":function(g){return fe(g.tm_mday,2," ")},"%g":function(g){return se(g).toString().substring(2)},"%G":function(g){return se(g)},"%H":function(g){return lt(g.tm_hour,2)},"%I":function(g){var E=g.tm_hour;return E==0?E=12:E>12&&(E-=12),lt(E,2)},"%j":function(g){return lt(g.tm_mday+Rh(fs(g.tm_year+1900)?Cl:Pl,g.tm_mon-1),3)},"%m":function(g){return lt(g.tm_mon+1,2)},"%M":function(g){return lt(g.tm_min,2)},"%n":function(){return`
|
|
13
|
-
`},"%p":function(g){return g.tm_hour>=0&&g.tm_hour<12?"AM":"PM"},"%S":function(g){return lt(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 lt(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 ut=(g.tm_wday+371-g.tm_yday)%7;ut!=4&&(ut!=3||!fs(g.tm_year))&&(E=1)}}else{E=52;var pt=(g.tm_wday+7-g.tm_yday-1)%7;(pt==4||pt==5&&fs(g.tm_year%400-1))&&E++}return lt(E,2)},"%w":function(g){return g.tm_wday},"%W":function(g){var E=g.tm_yday+7-(g.tm_wday+6)%7;return lt(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,pt=E>=0;return E=Math.abs(E)/60,E=E/60*100+E%60,(pt?"+":"-")+String("0000"+E).slice(-4)},"%Z":function(g){return g.tm_zone},"%%":function(){return"%"}};w=w.replace(/%%/g,"\0\0");for(var x in he)w.includes(x)&&(w=w.replace(new RegExp(x,"g"),he[x](S)));w=w.replace(/\0\0/g,"%");var Ar=Uh(w,!1);return Ar.length>d?0:(Vl(Ar,l),Ar.length-1)}function Lh(l,d,f,p,_){return kh(l,d,f,p)}function Nh(l){var d=c["_"+l];return d}function Ch(l,d,f,p,_){var S={string:xt=>{var se=0;if(xt!=null&&xt!==0){var he=(xt.length<<2)+1;se=ys(he),oa(xt,se,he)}return se},array:xt=>{var se=ys(xt.length);return Vl(xt,se),se}};function w(xt){return d==="string"?Sr(xt):d==="boolean"?Boolean(xt):xt}var v=Nh(l),x=[],Q=0;if(p)for(var nt=0;nt<p.length;nt++){var fe=S[f[nt]];fe?(Q===0&&(Q=ya()),x[nt]=fe(p[nt])):x[nt]=p[nt]}var lt=v.apply(null,x);function ir(xt){return Q!==0&&_s(Q),w(xt)}return lt=ir(lt),lt}C.init();var Ph=[null,Xc,qc,Zc,tl,sl,ol,al,cl,ll,ul,dl,fl,hl,pl,ml,_l,yl,bl,gl,wl,vl,Sl,Il,Al,Fl,Bl,Dl,El,Ol,Rl,Ml,Ul,kl,Ll,Nl],Vh={b:Hf,v:zf,s:Wf,ba:Qc,U:tl,Y:sl,X:ol,Q:al,c:cl,ja:ll,A:ul,fa:dl,S:fl,T:hl,la:pl,ga:ml,ka:_l,ha:yl,r:bl,V:gl,O:wl,p:vl,W:Sl,m:Il,ia:Al,q:Fl,_:$f,o:Yf,$:Xf,ca:Gf,sa:Jf,Z:qf,J:Zf,f:Qf,H:th,I:eh,F:rh,G:nh,k:ih,D:sh,w:oh,E:ah,L:ch,g:lh,K:uh,h:dh,M:fh,C:hh,j:ph,N:mh,l:_h,ta:yh,ma:bh,d:us,ea:gh,na:wh,z:Sh,ra:Ah,u:Fh,pa:Bl,qa:Dl,aa:Kc,e:El,y:Ol,x:Rl,t:Ml,B:Ul,P:kl,i:Ll,n:Nl,da:ds,R:Oh,a:St||c.wasmMemory,oa:Lh},My=Mf(),Hh=c.___wasm_call_ctors=function(){return(Hh=c.___wasm_call_ctors=c.asm.ua).apply(null,arguments)},zh=c._main=function(){return(zh=c._main=c.asm.va).apply(null,arguments)},Wh=c._duckdb_web_fs_glob_add_path=function(){return(Wh=c._duckdb_web_fs_glob_add_path=c.asm.xa).apply(null,arguments)},jh=c._duckdb_web_clear_response=function(){return(jh=c._duckdb_web_clear_response=c.asm.ya).apply(null,arguments)},$h=c._duckdb_web_fail_with=function(){return($h=c._duckdb_web_fail_with=c.asm.za).apply(null,arguments)},Yh=c._duckdb_web_reset=function(){return(Yh=c._duckdb_web_reset=c.asm.Aa).apply(null,arguments)},Xh=c._duckdb_web_connect=function(){return(Xh=c._duckdb_web_connect=c.asm.Ba).apply(null,arguments)},Gh=c._duckdb_web_disconnect=function(){return(Gh=c._duckdb_web_disconnect=c.asm.Ca).apply(null,arguments)},Kh=c._duckdb_web_flush_files=function(){return(Kh=c._duckdb_web_flush_files=c.asm.Da).apply(null,arguments)},Jh=c._duckdb_web_flush_file=function(){return(Jh=c._duckdb_web_flush_file=c.asm.Ea).apply(null,arguments)},qh=c._duckdb_web_open=function(){return(qh=c._duckdb_web_open=c.asm.Fa).apply(null,arguments)},Zh=c._duckdb_web_get_global_file_info=function(){return(Zh=c._duckdb_web_get_global_file_info=c.asm.Ga).apply(null,arguments)},Qh=c._duckdb_web_collect_file_stats=function(){return(Qh=c._duckdb_web_collect_file_stats=c.asm.Ha).apply(null,arguments)},tp=c._duckdb_web_export_file_stats=function(){return(tp=c._duckdb_web_export_file_stats=c.asm.Ia).apply(null,arguments)},ep=c._duckdb_web_fs_drop_file=function(){return(ep=c._duckdb_web_fs_drop_file=c.asm.Ja).apply(null,arguments)},rp=c._duckdb_web_fs_drop_files=function(){return(rp=c._duckdb_web_fs_drop_files=c.asm.Ka).apply(null,arguments)},np=c._duckdb_web_fs_glob_file_infos=function(){return(np=c._duckdb_web_fs_glob_file_infos=c.asm.La).apply(null,arguments)},ip=c._duckdb_web_fs_get_file_info_by_id=function(){return(ip=c._duckdb_web_fs_get_file_info_by_id=c.asm.Ma).apply(null,arguments)},sp=c._duckdb_web_fs_get_file_info_by_name=function(){return(sp=c._duckdb_web_fs_get_file_info_by_name=c.asm.Na).apply(null,arguments)},op=c._duckdb_web_fs_register_file_url=function(){return(op=c._duckdb_web_fs_register_file_url=c.asm.Oa).apply(null,arguments)},ap=c._duckdb_web_fs_register_file_buffer=function(){return(ap=c._duckdb_web_fs_register_file_buffer=c.asm.Pa).apply(null,arguments)},cp=c._duckdb_web_copy_file_to_buffer=function(){return(cp=c._duckdb_web_copy_file_to_buffer=c.asm.Qa).apply(null,arguments)},lp=c._duckdb_web_copy_file_to_path=function(){return(lp=c._duckdb_web_copy_file_to_path=c.asm.Ra).apply(null,arguments)},up=c._duckdb_web_get_version=function(){return(up=c._duckdb_web_get_version=c.asm.Sa).apply(null,arguments)},dp=c._duckdb_web_get_feature_flags=function(){return(dp=c._duckdb_web_get_feature_flags=c.asm.Ta).apply(null,arguments)},fp=c._duckdb_web_tokenize=function(){return(fp=c._duckdb_web_tokenize=c.asm.Ua).apply(null,arguments)},hp=c._duckdb_web_udf_scalar_create=function(){return(hp=c._duckdb_web_udf_scalar_create=c.asm.Va).apply(null,arguments)},pp=c._duckdb_web_prepared_create=function(){return(pp=c._duckdb_web_prepared_create=c.asm.Wa).apply(null,arguments)},mp=c._duckdb_web_prepared_close=function(){return(mp=c._duckdb_web_prepared_close=c.asm.Xa).apply(null,arguments)},_p=c._duckdb_web_prepared_run=function(){return(_p=c._duckdb_web_prepared_run=c.asm.Ya).apply(null,arguments)},yp=c._duckdb_web_prepared_send=function(){return(yp=c._duckdb_web_prepared_send=c.asm.Za).apply(null,arguments)},bp=c._duckdb_web_query_run=function(){return(bp=c._duckdb_web_query_run=c.asm._a).apply(null,arguments)},gp=c._duckdb_web_pending_query_start=function(){return(gp=c._duckdb_web_pending_query_start=c.asm.$a).apply(null,arguments)},wp=c._duckdb_web_pending_query_poll=function(){return(wp=c._duckdb_web_pending_query_poll=c.asm.ab).apply(null,arguments)},vp=c._duckdb_web_pending_query_cancel=function(){return(vp=c._duckdb_web_pending_query_cancel=c.asm.bb).apply(null,arguments)},Sp=c._duckdb_web_query_fetch_results=function(){return(Sp=c._duckdb_web_query_fetch_results=c.asm.cb).apply(null,arguments)},Ip=c._duckdb_web_get_tablenames=function(){return(Ip=c._duckdb_web_get_tablenames=c.asm.db).apply(null,arguments)},Ap=c._duckdb_web_insert_arrow_from_ipc_stream=function(){return(Ap=c._duckdb_web_insert_arrow_from_ipc_stream=c.asm.eb).apply(null,arguments)},Fp=c._duckdb_web_insert_csv_from_path=function(){return(Fp=c._duckdb_web_insert_csv_from_path=c.asm.fb).apply(null,arguments)},xp=c._duckdb_web_insert_json_from_path=function(){return(xp=c._duckdb_web_insert_json_from_path=c.asm.gb).apply(null,arguments)},Tp=c.__emscripten_tls_init=function(){return(Tp=c.__emscripten_tls_init=c.asm.hb).apply(null,arguments)},hs=c._pthread_self=function(){return(hs=c._pthread_self=c.asm.ib).apply(null,arguments)},Hl=c.__emscripten_thread_init=function(){return(Hl=c.__emscripten_thread_init=c.asm.jb).apply(null,arguments)},Bp=c.__emscripten_thread_crashed=function(){return(Bp=c.__emscripten_thread_crashed=c.asm.kb).apply(null,arguments)},ps=c._htonl=function(){return(ps=c._htonl=c.asm.lb).apply(null,arguments)},ms=c._htons=function(){return(ms=c._htons=c.asm.mb).apply(null,arguments)},zl=c._emscripten_run_in_main_runtime_thread_js=function(){return(zl=c._emscripten_run_in_main_runtime_thread_js=c.asm.nb).apply(null,arguments)},pa=c._ntohs=function(){return(pa=c._ntohs=c.asm.ob).apply(null,arguments)},Wl=c.__emscripten_proxy_execute_task_queue=function(){return(Wl=c.__emscripten_proxy_execute_task_queue=c.asm.pb).apply(null,arguments)},ma=c.__emscripten_thread_free_data=function(){return(ma=c.__emscripten_thread_free_data=c.asm.qb).apply(null,arguments)},jl=c.__emscripten_thread_exit=function(){return(jl=c.__emscripten_thread_exit=c.asm.rb).apply(null,arguments)},_a=c._malloc=function(){return(_a=c._malloc=c.asm.sb).apply(null,arguments)},Dp=c._free=function(){return(Dp=c._free=c.asm.tb).apply(null,arguments)},$l=c.___trap=function(){return($l=c.___trap=c.asm.ub).apply(null,arguments)},Yl=c._emscripten_stack_set_limits=function(){return(Yl=c._emscripten_stack_set_limits=c.asm.vb).apply(null,arguments)},ya=c.stackSave=function(){return(ya=c.stackSave=c.asm.wb).apply(null,arguments)},_s=c.stackRestore=function(){return(_s=c.stackRestore=c.asm.xb).apply(null,arguments)},ys=c.stackAlloc=function(){return(ys=c.stackAlloc=c.asm.yb).apply(null,arguments)};c.keepRuntimeAlive=ss,c.wasmMemory=St,c.ccall=Ch,c.ExitStatus=di,c.PThread=C;var bs;ui=function l(){bs||Xl(),bs||(ui=l)};function Ep(l){var d=c._main,f=0,p=0;try{var _=d(f,p);return Gc(_,!0),_}catch(S){return Jc(S)}}function Xl(l){if(l=l||I,cn>0)return;if(F){m(c),Hc(),postMessage({cmd:"loaded"});return}if(If(),cn>0)return;function d(){bs||(bs=!0,c.calledRun=!0,!ia&&(Hc(),Af(),m(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),Gl&&Ep(l),Ff()))}c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1),d()},1)):d()}if(c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();var Gl=!0;return c.noInitialRun&&(Gl=!1),Xl(),t.ready}})(),uf=vy;var qo=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=Mt.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new Et(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 Zo(this._bindings,this._conn,e),i=Mt.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 gc(this._bindings,this._conn,e)}createScalarFunction(t,e,n){this._bindings.createScalarFunction(this._conn,t,e,n)}insertArrowTable(t,e){let n=Go(t,"stream");this.insertArrowFromIPCStream(n,e)}insertArrowFromIPCStream(t,e){this._bindings.insertArrowFromIPCStream(this._conn,t,e)}insertCSVFromPath(t,e){this._bindings.insertCSVFromPath(this._conn,t,e)}insertJSONFromPath(t,e){this._bindings.insertJSONFromPath(this._conn,t,e)}},Zo=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}},gc=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=Mt.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new Et(n)}send(...t){let e=this.bindings.sendPrepared(this.connectionId,this.statementId,t),n=new Zo(this.bindings,this.connectionId,e),i=Mt.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};var hf=new TextEncoder,df=new TextDecoder("utf-8");function wc(r,t,e){let n=hf.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 vc(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 ff(r,t,e){let n=r.HEAPU8.subarray(t,t+e);return new Uint8Array(n.buffer,n.byteOffset,e)}function Qo(r,t,e){let n=r.HEAPU8.subarray(t,t+e*8);return new Float64Array(n.buffer,n.byteOffset,e)}function pf(r,t,e,n,i,s,o,a){try{let u=r._udfFunctions.get(n);if(!u){wc(t,e,"Unknown UDF with id: "+n);return}let c=df.decode(t.HEAPU8.subarray(i,i+s)),m=JSON.parse(c),y=Qo(t,o,a/8),b=et=>{var Xt;let ie=null;switch(et.validityBuffer!==void 0&&(ie=ff(t,y[et.validityBuffer],m.rows)),et.physicalType){case"VARCHAR":{if(et.dataBuffer===null||et.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(et.lengthBuffer===null||et.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let Qt=vc(t,y[et.dataBuffer],et.physicalType,m.rows),Gt=[],Pt=Qo(t,y[et.lengthBuffer],m.rows);for(let ht=0;ht<m.rows;++ht){if(ie!=null&&!ie[ht]){Gt.push(null);continue}let ct=t.HEAPU8.subarray(Qt[ht],Qt[ht]+Pt[ht]),ai=df.decode(ct);Gt.push(ai)}return ht=>Gt[ht]}case"STRUCT":{let Qt={},Gt=[];for(let Pt=0;Pt<(((Xt=et.children)==null?void 0:Xt.length)||0);++Pt){let ht=et.children[Pt],ct=b(ht);Gt.push(ai=>{Qt[ht.name]=ct(ai)})}return ie!=null?Pt=>{if(!ie[Pt])return null;for(let ht of Gt)ht(Pt);return Qt}:Pt=>{for(let ht of Gt)ht(Pt);return Qt}}default:{if(et.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+et.physicalType);let Qt=vc(t,y[et.dataBuffer],et.physicalType,m.rows);return ie!=null?Gt=>ie[Gt]?Qt[Gt]:null:Gt=>Qt[Gt]}}},I=[];for(let et=0;et<m.args.length;++et)I.push(b(m.args[et]));let Z=m.rows*Sc(m.ret.physicalType),J=t._malloc(Z),_t=vc(t,J,m.ret.physicalType,m.rows),ft=t._malloc(m.rows),yt=ff(t,ft,m.rows);if(_t.length==0||yt.length==0){wc(t,e,"Can't create physical arrays for result");return}let F=_t;m.ret.physicalType=="VARCHAR"&&(F=new Array(m.rows));let Yt=[];for(let et=0;et<m.args.length;++et)Yt.push(null);for(let et=0;et<m.rows;++et){for(let Xt=0;Xt<m.args.length;++Xt)Yt[Xt]=I[Xt](et);let ie=u.func(...Yt);F[et]=ie,yt[et]=ie==null?0:1}let Dn=0;switch(m.ret.physicalType){case"VARCHAR":{let et=new Array(0);Dn=t._malloc(m.rows*Sc("DOUBLE"));let ie=Qo(t,Dn,m.rows),Xt=0;for(let ht=0;ht<m.rows;++ht){let ct=hf.encode(F[ht]||"");et.push(ct),ie[ht]=ct.length,Xt+=ct.length}let Qt=t._malloc(Xt),Gt=t.HEAPU8.subarray(Qt,Qt+Xt),Pt=0;for(let ht=0;ht<m.rows;++ht){_t[ht]=Pt;let ct=et[ht];Gt.subarray(Pt,Pt+ct.length).set(ct),Pt+=ct.length}}}let si=3*8,oi=t._malloc(si),Wr=Qo(t,oi,3);Wr[0]=J,Wr[1]=ft,Wr[2]=Dn,t.HEAPF64[(e>>3)+0]=0,t.HEAPF64[(e>>3)+1]=oi,t.HEAPF64[(e>>3)+2]=0}catch(u){wc(t,e,u.toString())}}function Iy(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}var Ay=Iy();function vr(r,t){console.error(`FAIL WITH: ${t}`),r.ccall("duckdb_web_fail_with",null,["string"],[t])}function Bn(r,t,e){let n=r.HEAPU8.subarray(t,t+e),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function W(r,t,e){return Ay(r.HEAPU8.subarray(t,t+e))}function ot(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],u=r.HEAPF64[(s>>3)+2];return r.stackRestore(i),[o,a,u]}function vt(r){r.ccall("duckdb_web_clear_response",null,[],[])}var ta=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 Fy=new TextEncoder;var ea=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]=ot(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(e!==0)throw new Error(W(this.mod,n,i));vt(this.mod)}reset(){let[t,e,n]=ot(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));vt(this.mod)}getVersion(){let[t,e,n]=ot(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));let i=W(this.mod,e,n);return vt(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let[e,n,i]=ot(this.mod,"duckdb_web_tokenize",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=W(this.mod,n,i);return vt(this.mod),JSON.parse(s)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new qo(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]=ot(this.mod,"duckdb_web_query_run",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));let o=Bn(this.mod,i,s);return vt(this.mod),o}startPendingQuery(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_pending_query_start",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));if(i==0)return null;let o=Bn(this.mod,i,s);return vt(this.mod),o}pollPendingQuery(t){let[e,n,i]=ot(this.mod,"duckdb_web_pending_query_poll",["number"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));if(n==0)return null;let s=Bn(this.mod,n,i);return vt(this.mod),s}cancelPendingQuery(t){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[t])}fetchQueryResults(t){let[e,n,i]=ot(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=Bn(this.mod,n,i);return vt(this.mod),s}getTableNames(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_get_tablenames",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));let o=W(this.mod,i,s);return vt(this.mod),JSON.parse(o)}createScalarFunction(t,e,n,i){let s={functionId:this._nextUDFId,name:e,returnType:ii(n)},o={functionId:s.functionId,connectionId:t,name:e,returnType:n,func:i};this._nextUDFId+=1;let[a,u,c]=ot(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(s)]);if(a!==0)throw new Error(W(this.mod,u,c));if(vt(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(o.functionId,o),this.pthread)for(let m of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])m.postMessage({cmd:"registerUDFFunction",udf:o})}createPrepared(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_prepared_create",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));return vt(this.mod),i}closePrepared(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_prepared_close",["number","number"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));vt(this.mod)}runPrepared(t,e,n){let[i,s,o]=ot(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(W(this.mod,s,o));let a=Bn(this.mod,s,o);return vt(this.mod),a}sendPrepared(t,e,n){let[i,s,o]=ot(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(W(this.mod,s,o));let a=Bn(this.mod,s,o);return vt(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,u,c]=ot(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,i,e.length,o]);if(a!==0)throw new Error(W(this.mod,u,c))}insertCSVFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let c in n.columns)n.columnsFlat.push(Ko(c,n.columns[c]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,u]=ot(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(W(this.mod,a,u))}insertJSONFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let c in n.columns)n.columnsFlat.push(Ko(c,n.columns[c]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,u]=ot(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(W(this.mod,a,u))}globFiles(t){let[e,n,i]=ot(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=W(this.mod,n,i);vt(this.mod);let o=JSON.parse(s);return o==null?[]:o}registerFileURL(t,e,n,i=!1){e===void 0&&(e=t);let[s,o,a]=ot(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[t,e,n,i]);if(s!==0)throw new Error(W(this.mod,o,a));vt(this.mod)}registerFileText(t,e){let n=Fy.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]=ot(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,n,e.length]);if(s!==0)throw new Error(W(this.mod,o,a));vt(this.mod)}registerFileHandle(t,e,n,i){let[s,o,a]=ot(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[t,t,n,i]);if(s!==0)throw new Error(W(this.mod,o,a));if(vt(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,e),this.pthread){for(let u of this.pthread.runningWorkers)u.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:e});for(let u of this.pthread.unusedWorkers)u.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[e,n,i]=ot(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));vt(this.mod)}dropFiles(){let[t,e,n]=ot(this.mod,"duckdb_web_fs_drop_files",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));vt(this.mod)}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));vt(this.mod)}copyFileToBuffer(t){let[e,n,i]=ot(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=this.mod.HEAPU8.subarray(n,n+i),o=new Uint8Array(s.length);return o.set(s),vt(this.mod),o}collectFileStatistics(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s))}exportFileStatistics(t){let[e,n,i]=ot(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));return new ta(this.mod.HEAPU8.subarray(n,n+i))}};var ra=class extends ea{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 J;let a=new Request(this.mainModuleURL),u=await fetch(a),c=u.headers.get("content-length"),m=c&&parseInt(c,10)||0,y=new Date,b={startedAt:y,updatedAt:y,bytesTotal:m||0,bytesLoaded:0},I={transform(_t,ft){b.bytesLoaded+=_t.byteLength;let yt=new Date;if(yt.getTime()-b.updatedAt.getTime()<20){b.updatedAt=yt,ft.enqueue(_t);return}for(let F of i)F(b);ft.enqueue(_t)}},Z=new TransformStream(I);return new Response((J=u.body)==null?void 0:J.pipeThrough(Z),u)})();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,u={startedAt:a,updatedAt:a,bytesTotal:0,bytesLoaded:0};s.open("GET",o),s.responseType="arraybuffer",s.onerror=c=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+c}),new Error(c.toString())},s.onprogress=c=>{u.bytesTotal=c.total,u.bytesLoaded=c.loaded;let m=new Date;if(m.getTime()-u.updatedAt.getTime()<20){u.updatedAt=m;return}for(let y of i)y(u)},s.onload=()=>{WebAssembly.instantiate(s.response,e).then(c=>{n(c.instance,c.module)}).catch(c=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+c}),new Error(c)})},s.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let o=new Request(this.mainModuleURL),u=await(await fetch(o)).arrayBuffer();WebAssembly.instantiate(u,e).then(c=>{n(c.instance,c.module)})})();return[]}};var na=class extends ra{constructor(t,e,n,i=null){super(t,e,n,i)}instantiateImpl(t){return uf({...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};var sn=ql(mf()),_f=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 xy(r,t,e){var i,s,o,a;let n=yf(t);return{url:n.path,query:"",host:_f(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 Ty(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 Z;let e=(Z=t==null?void 0:t.contentHash)!=null?Z:"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+`
|
|
14
|
-
`+
|
|
12
|
+
`));var ht=c.print||Gt,ct=c.printErr||Pt;Object.assign(c,b),b=null,c.arguments&&(I=c.arguments),c.thisProgram&&(Z=c.thisProgram),c.quit&&(J=c.quit);var ai=Atomics.load,Ry=Atomics.store,My=Atomics.compareExchange,ci;c.wasmBinary&&(ci=c.wasmBinary);var Ac=c.noExitRuntime||!0;typeof WebAssembly!="object"&&Re("no native wasm support detected");var St,Fc,ia=!1,li;function sa(l,d){l||Re(d)}var xc=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function Tc(l,d,f){d>>>=0;for(var p=d+f,_=d;l[_]&&!(_>=p);)++_;if(_-d>16&&l.buffer&&xc)return xc.decode(l.buffer instanceof SharedArrayBuffer?l.slice(d,_):l.subarray(d,_));for(var S="";d<_;){var w=l[d++];if(!(w&128)){S+=String.fromCharCode(w);continue}var v=l[d++]&63;if((w&224)==192){S+=String.fromCharCode((w&31)<<6|v);continue}var x=l[d++]&63;if((w&240)==224?w=(w&15)<<12|v<<6|x:w=(w&7)<<18|v<<12|x<<6|l[d++]&63,w<65536)S+=String.fromCharCode(w);else{var tt=w-65536;S+=String.fromCharCode(55296|tt>>10,56320|tt&1023)}}return S}function Sr(l,d){return l>>>=0,l?Tc(n(),l,d):""}function Bc(l,d,f,p){if(f>>>=0,!(p>0))return 0;for(var _=f,S=f+p-1,w=0;w<l.length;++w){var v=l.charCodeAt(w);if(v>=55296&&v<=57343){var x=l.charCodeAt(++w);v=65536+((v&1023)<<10)|x&1023}if(v<=127){if(f>=S)break;d[f++>>>0]=v}else if(v<=2047){if(f+1>=S)break;d[f++>>>0]=192|v>>6,d[f++>>>0]=128|v&63}else if(v<=65535){if(f+2>=S)break;d[f++>>>0]=224|v>>12,d[f++>>>0]=128|v>>6&63,d[f++>>>0]=128|v&63}else{if(f+3>=S)break;d[f++>>>0]=240|v>>18,d[f++>>>0]=128|v>>12&63,d[f++>>>0]=128|v>>6&63,d[f++>>>0]=128|v&63}}return d[f>>>0]=0,f-_}function oa(l,d,f){return Bc(l,n(),d,f)}function wf(l){for(var d=0,f=0;f<l.length;++f){var p=l.charCodeAt(f);p<=127?d++:p<=2047?d+=2:p>=55296&&p<=57343?(d+=4,++f):d+=3}return d}var de,Dc,Ec,Oc,Rc,Mc,Uc,vf,kc;F&&(de=c.buffer);function Ir(l){de=l,c.HEAP8=Dc=new Int8Array(l),c.HEAP16=Oc=new Int16Array(l),c.HEAP32=Mc=new Int32Array(l),c.HEAPU8=Ec=new Uint8Array(l),c.HEAPU16=Rc=new Uint16Array(l),c.HEAPU32=Uc=new Uint32Array(l),c.HEAPF32=vf=new Float32Array(l),c.HEAPF64=kc=new Float64Array(l)}var Lc=c.INITIAL_MEMORY||16777216;if(F)St=c.wasmMemory,de=c.buffer;else if(c.wasmMemory)St=c.wasmMemory;else if(St=new WebAssembly.Memory({initial:Lc/65536,maximum:65536,shared:!0}),!(St.buffer instanceof SharedArrayBuffer))throw ct("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),yt&&ct("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)"),Error("bad memory");St&&(de=St.buffer),Lc=de.byteLength,Ir(de);var Nc,Cc=[],Pc=[],Sf=[],Vc=[],If=!1;function ss(){return Ac}function Af(){if(c.preRun)for(typeof c.preRun=="function"&&(c.preRun=[c.preRun]);c.preRun.length;)Tf(c.preRun.shift());os(Cc)}function Hc(){If=!0,!F&&os(Pc)}function Ff(){F||os(Sf)}function xf(){if(!F){if(c.postRun)for(typeof c.postRun=="function"&&(c.postRun=[c.postRun]);c.postRun.length;)Df(c.postRun.shift());os(Vc)}}function Tf(l){Cc.unshift(l)}function Bf(l){Pc.unshift(l)}function Df(l){Vc.unshift(l)}var cn=0,aa=null,ui=null;function Ef(l){cn++,c.monitorRunDependencies&&c.monitorRunDependencies(cn)}function Of(l){if(cn--,c.monitorRunDependencies&&c.monitorRunDependencies(cn),cn==0&&(aa!==null&&(clearInterval(aa),aa=null),ui)){var d=ui;ui=null,d()}}function Re(l){F?postMessage({cmd:"onAbort",arg:l}):c.onAbort&&c.onAbort(l),l="Aborted("+l+")",ct(l),ia=!0,li=1,l+=". Build with -sASSERTIONS for more info.",Yl()}var Rf="data:application/octet-stream;base64,";function zc(l){return l.startsWith(Rf)}var Me;c.locateFile?(Me="./duckdb-coi.wasm",zc(Me)||(Me=Dn(Me))):Me=new URL("./duckdb-coi.wasm",bc.url).toString();function Wc(l){try{if(l==Me&&ci)return new Uint8Array(ci);if(Wr)return Wr(l);throw"both async and sync fetching of the wasm failed"}catch(d){Re(d)}}function Mf(){return!ci&&(_t||ft)&&typeof fetch=="function"?fetch(Me,{credentials:"same-origin"}).then(function(l){if(!l.ok)throw"failed to load wasm binary file at '"+Me+"'";return l.arrayBuffer()}).catch(function(){return Wc(Me)}):Promise.resolve().then(function(){return Wc(Me)})}function Uf(){var l={a:Hh};function d(w,v){var x=w.exports;if(c.asm=x,Hf(c.asm.ib),Nc=c.asm.xa,Bf(c.asm.va),Fc=v,!F){var tt=C.unusedWorkers.length;C.unusedWorkers.forEach(function(nt){C.loadWasmModuleToWorker(nt,function(){--tt||Of("wasm-instantiate")})})}}F||Ef("wasm-instantiate");function f(w){d(w.instance,w.module)}function p(w){return Mf().then(function(v){return WebAssembly.instantiate(v,l)}).then(function(v){return v}).then(w,function(v){ct("failed to asynchronously prepare wasm: "+v),Re(v)})}function _(){return!ci&&typeof WebAssembly.instantiateStreaming=="function"&&!zc(Me)&&!yt&&typeof fetch=="function"?fetch(Me,{credentials:"same-origin"}).then(function(w){var v=WebAssembly.instantiateStreaming(w,l);return v.then(f,function(x){return ct("wasm streaming compile failed: "+x),ct("falling back to ArrayBuffer instantiation"),p(f)})}):p(f)}if(c.instantiateWasm)try{var S=c.instantiateWasm(l,d);return S}catch(w){ct("Module.instantiateWasm callback failed with error: "+w),y(w)}return _().catch(y),{}}var kf={};function di(l){this.name="ExitStatus",this.message="Program terminated with exit("+l+")",this.status=l}function Lf(l){var d=C.pthreads[l];delete C.pthreads[l],d.terminate(),ma(l),C.runningWorkers.splice(C.runningWorkers.indexOf(d),1),d.pthread_ptr=0}function Nf(l){var d=C.pthreads[l];d.postMessage({cmd:"cancel"})}function jc(l){var d=C.pthreads[l];sa(d),C.returnWorkerToPool(d)}function $c(l,d){return n().fill(0,l,l+d),l}function Yc(l){var d=C.getNewWorker();if(!d)return 6;C.runningWorkers.push(d),C.pthreads[l.pthread_ptr]=d,d.pthread_ptr=l.pthread_ptr;var f={cmd:"run",start_routine:l.startRoutine,arg:l.arg,pthread_ptr:l.pthread_ptr};return d.runPthread=()=>{f.time=performance.now(),d.postMessage(f,l.transferList)},d.loaded&&(d.runPthread(),delete d.runPthread),0}var ln={varargs:void 0,get:function(){ln.varargs+=4;var l=o()[ln.varargs-4>>>2];return l},getStr:function(l){var d=Sr(l);return d}};function Xc(l){if(F)return Q(1,1,l);li=l,ss()||(C.terminateAllThreads(),c.onExit&&c.onExit(l),ia=!0),J(l,new di(l))}function Gc(l,d){if(li=l,!d&&F)throw qc(l),"unwind";Xc(l)}var Kc=Gc;function Jc(l){if(l instanceof di||l=="unwind")return li;J(1,l)}var C={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init:function(){F?C.initWorker():C.initMainThread()},initMainThread:function(){for(var l=4;l--;)C.allocateUnusedWorker()},initWorker:function(){Ac=!1},setExitStatus:function(l){li=l},terminateAllThreads:function(){for(var l of Object.values(C.pthreads))C.returnWorkerToPool(l);for(var l of C.unusedWorkers)l.terminate();C.unusedWorkers=[]},returnWorkerToPool:function(l){var d=l.pthread_ptr;delete C.pthreads[d],C.unusedWorkers.push(l),C.runningWorkers.splice(C.runningWorkers.indexOf(l),1),l.pthread_ptr=0,ma(d)},receiveObjectTransfer:function(l){},threadInitTLS:function(){C.tlsInitFunctions.forEach(l=>l())},loadWasmModuleToWorker:function(l,d){l.onmessage=f=>{var p=f.data,_=p.cmd;if(l.pthread_ptr&&(C.currentProxiedOperationCallerThread=l.pthread_ptr),p.targetThread&&p.targetThread!=hs()){var S=C.pthreads[p.targetThread];S?S.postMessage(p,p.transferList):ct('Internal error! Worker sent a message "'+_+'" to target pthread '+p.targetThread+", but that thread no longer exists!"),C.currentProxiedOperationCallerThread=void 0;return}_==="processProxyingQueue"?da(p.queue):_==="spawnThread"?Yc(p):_==="cleanupThread"?jc(p.thread):_==="killThread"?Lf(p.thread):_==="cancelThread"?Nf(p.thread):_==="loaded"?(l.loaded=!0,d&&d(l),l.runPthread&&(l.runPthread(),delete l.runPthread)):_==="print"?ht("Thread "+p.threadId+": "+p.text):_==="printErr"?ct("Thread "+p.threadId+": "+p.text):_==="alert"?alert("Thread "+p.threadId+": "+p.text):p.target==="setimmediate"?l.postMessage(p):_==="onAbort"?c.onAbort&&c.onAbort(p.arg):_&&ct("worker sent an unknown command "+_),C.currentProxiedOperationCallerThread=void 0},l.onerror=f=>{var p="worker sent an error!";throw ct(p+" "+f.filename+":"+f.lineno+": "+f.message),f},yt&&(l.on("message",function(f){l.onmessage({data:f})}),l.on("error",function(f){l.onerror(f)}),l.on("detachedExit",function(){})),l.postMessage({cmd:"load",urlOrBlob:c.mainScriptUrlOrBlob,wasmMemory:St,wasmModule:Fc})},allocateUnusedWorker:function(){if(!c.locateFile){C.unusedWorkers.push(new Worker(new URL("duckdb_wasm.worker.js",bc.url)));return}var l=Dn("duckdb_wasm.worker.js");C.unusedWorkers.push(new Worker(l))},getNewWorker:function(){return C.unusedWorkers.length==0&&(C.allocateUnusedWorker(),C.loadWasmModuleToWorker(C.unusedWorkers[0])),C.unusedWorkers.pop()}};c.PThread=C;function os(l){for(;l.length>0;)l.shift()(c)}function Cf(){var l=hs(),d=o()[l+44>>>2],f=o()[l+48>>>2],p=d-f;Xl(d,p),_s(d)}c.establishStackSpace=Cf;function qc(l){if(F)return Q(2,0,l);try{Kc(l)}catch(d){Jc(d)}}var as=[];function Pf(l){var d=as[l];return d||(l>=as.length&&(as.length=l+1),as[l]=d=Nc.get(l)),d}function Vf(l,d){var f=Pf(l)(d);ss()?C.setExitStatus(f):$l(f)}c.invokeEntryPoint=Vf;function Hf(l){C.tlsInitFunctions.push(l)}function zf(l,d,f,p){Re("Assertion failed: "+Sr(l)+", at: "+[d?Sr(d):"unknown filename",f,p?Sr(p):"unknown function"])}function Wf(l){zl(l,!ft,1,!_t),C.threadInitTLS()}function jf(l){F?postMessage({cmd:"cleanupThread",thread:l}):jc(l)}function Zc(l,d,f,p){return F?Q(3,1,l,d,f,p):Qc(l,d,f,p)}function Qc(l,d,f,p){if(typeof SharedArrayBuffer>"u")return ct("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var _=[],S=0;if(F&&(_.length===0||S))return Zc(l,d,f,p);if(S)return S;var w={startRoutine:f,pthread_ptr:l,arg:p,transferList:_};return F?(w.cmd="spawnThread",postMessage(w,_),0):Yc(w)}function tl(l,d,f,p,_){if(F)return Q(4,1,l,d,f,p,_);for(var S=0,w=d?o()[d>>>2]:0,v=d?o()[d+4>>>2]:0,x=f?o()[f>>>2]:0,tt=f?o()[f+4>>>2]:0,nt=p?o()[p>>>2]:0,fe=p?o()[p+4>>>2]:0,lt=0,ir=0,xt=0,se=0,he=0,Ar=0,g=(d?o()[d>>>2]:0)|(f?o()[f>>>2]:0)|(p?o()[p>>>2]:0),E=(d?o()[d+4>>>2]:0)|(f?o()[f+4>>>2]:0)|(p?o()[p+4>>>2]:0),pt=function(Rp,Mp,Up,Jl){return Rp<32?Mp&Jl:Up&Jl},ut=0;ut<l;ut++){var oe=1<<ut%32;if(!!pt(ut,g,E,oe)){var mi=ln.getStreamFromFD(ut),gs=ln.DEFAULT_POLLMASK;mi.stream_ops.poll&&(gs=mi.stream_ops.poll(mi)),gs&1&&pt(ut,w,v,oe)&&(ut<32?lt=lt|oe:ir=ir|oe,S++),gs&4&&pt(ut,x,tt,oe)&&(ut<32?xt=xt|oe:se=se|oe,S++),gs&2&&pt(ut,nt,fe,oe)&&(ut<32?he=he|oe:Ar=Ar|oe,S++)}}return d&&(o()[d>>>2]=lt,o()[d+4>>>2]=ir),f&&(o()[f>>>2]=xt,o()[f+4>>>2]=se),p&&(o()[p>>>2]=he,o()[p+4>>>2]=Ar),S}function $f(){ct("missing function: $SOCKFS"),Re(-1)}function el(){ct("missing function: $FS"),Re(-1)}function fi(l){var d=$f.getSocket(l);if(!d)throw new el.ErrnoError(8);return d}function ca(l){return(l&255)+"."+(l>>8&255)+"."+(l>>16&255)+"."+(l>>24&255)}function rl(l){var d="",f=0,p=0,_=0,S=0,w=0,v=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,nt="";for(v=0;v<5;v++)if(x[v]!==0){tt=!1;break}if(tt){if(nt=ca(x[6]|x[7]<<16),x[5]===-1)return d="::ffff:",d+=nt,d;if(x[5]===0)return d="::",nt==="0.0.0.0"&&(nt=""),nt==="0.0.0.1"&&(nt="1"),d+=nt,d}for(f=0;f<8;f++)x[f]===0&&(f-_>1&&(w=0),_=f,w++),w>p&&(p=w,S=f-p+1);for(f=0;f<8;f++){if(p>1&&x[f]===0&&f>=S&&f<S+p){f===S&&(d+=":",S===0&&(d+=":"));continue}d+=Number(pa(x[f]&65535)).toString(16),d+=f<7?":":""}return d}function nl(l,d){var f=i()[l>>>1],p=pa(s()[l+2>>>1]),_;switch(f){case 2:if(d!==16)return{errno:28};_=o()[l+4>>>2],_=ca(_);break;case 10:if(d!==28)return{errno:28};_=[o()[l+8>>>2],o()[l+12>>>2],o()[l+16>>>2],o()[l+20>>>2]],_=rl(_);break;default:return{errno:5}}return{family:f,addr:_,port:p}}function cs(l){for(var d=l.split("."),f=0;f<4;f++){var p=Number(d[f]);if(isNaN(p))return null;d[f]=p}return(d[0]|d[1]<<8|d[2]<<16|d[3]<<24)>>>0}function ls(l){return parseInt(l)}function la(l){var d,f,p,_,S=/^((?=.*::)(?!.*::.+::)(::)?([\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,w=[];if(!S.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"),":"),d=l.split(":"),d[d.length-4]=ls(d[d.length-4])+ls(d[d.length-3])*256,d[d.length-3]=ls(d[d.length-2])+ls(d[d.length-1])*256,d=d.slice(0,d.length-2)):d=l.split(":"),p=0,_=0,f=0;f<d.length;f++)if(typeof d[f]=="string")if(d[f]==="Z"){for(_=0;_<8-d.length+1;_++)w[f+_]=0;p=_-1}else w[f+p]=ms(parseInt(d[f],16));else w[f+p]=d[f];return[w[1]<<16|w[0],w[3]<<16|w[2],w[5]<<16|w[4],w[7]<<16|w[6]]}var Ue={address_map:{id:1,addrs:{},names:{}},lookup_name:function(l){var d=cs(l);if(d!==null||(d=la(l),d!==null))return l;var f;if(Ue.address_map.addrs[l])f=Ue.address_map.addrs[l];else{var p=Ue.address_map.id++;sa(p<65535,"exceeded max address mappings of 65535"),f="172.29."+(p&255)+"."+(p&65280),Ue.address_map.names[f]=l,Ue.address_map.addrs[l]=f}return f},lookup_addr:function(l){return Ue.address_map.names[l]?Ue.address_map.names[l]:null}};function il(l,d,f){if(f&&l===0)return null;var p=nl(l,d);if(p.errno)throw new el.ErrnoError(p.errno);return p.addr=Ue.lookup_addr(p.addr)||p.addr,p}function sl(l,d,f){if(F)return Q(5,1,l,d,f);var p=fi(l),_=il(d,f);return p.sock_ops.bind(p,_.addr,_.port),0}function ol(l,d,f){if(F)return Q(6,1,l,d,f);var p=fi(l),_=il(d,f);return p.sock_ops.connect(p,_.addr,_.port),0}function al(l,d,f,p){if(F)return Q(7,1,l,d,f,p)}function cl(l,d,f){return F?Q(8,1,l,d,f):(ln.varargs=f,0)}function ll(l,d){if(F)return Q(9,1,l,d)}function ul(l,d,f){if(F)return Q(10,1,l,d,f)}function dl(l,d,f){if(F)return Q(11,1,l,d,f)}function ua(l,d,f,p,_){switch(d){case 2:f=cs(f),$c(l,16),_&&(o()[_>>>2]=16),i()[l>>>1]=d,o()[l+4>>>2]=f,i()[l+2>>>1]=ms(p);break;case 10:f=la(f),$c(l,28),_&&(o()[_>>>2]=28),o()[l>>>2]=d,o()[l+8>>>2]=f[0],o()[l+12>>>2]=f[1],o()[l+16>>>2]=f[2],o()[l+20>>>2]=f[3],i()[l+2>>>1]=ms(p);break;default:return 5}return 0}function fl(l,d,f){if(F)return Q(12,1,l,d,f);var p=fi(l);if(!p.daddr)return-53;var _=ua(d,p.family,Ue.lookup_name(p.daddr),p.dport,f);return 0}function hl(l,d,f,p,_){if(F)return Q(13,1,l,d,f,p,_);var S=fi(l);return d===1&&f===4?(o()[p>>>2]=S.error,o()[_>>>2]=4,S.error=null,0):-50}function pl(l,d,f){return F?Q(14,1,l,d,f):(ln.varargs=f,0)}function ml(l,d){if(F)return Q(15,1,l,d)}function _l(l,d,f){if(F)return Q(16,1,l,d,f)}function yl(l,d,f,p){if(F)return Q(17,1,l,d,f,p)}function bl(l,d,f,p){if(F)return Q(18,1,l,d,f,p);ln.varargs=p}function gl(l,d,f,p,_,S){if(F)return Q(19,1,l,d,f,p,_,S);var w=fi(l),v=w.sock_ops.recvmsg(w,f);if(!v)return 0;if(_)var x=ua(_,w.family,Ue.lookup_name(v.addr),v.port,S);return n().set(v.buffer,d>>>0),v.buffer.byteLength}function wl(l,d,f,p){if(F)return Q(20,1,l,d,f,p)}function vl(l){if(F)return Q(21,1,l)}function Sl(l,d,f,p,_,S){if(F)return Q(22,1,l,d,f,p,_,S)}function Il(l,d,f){if(F)return Q(23,1,l,d,f)}function Al(l,d){if(F)return Q(24,1,l,d)}function Fl(l,d,f){if(F)return Q(25,1,l,d,f)}function Yf(l){}var xl="To use dlopen, you need enable dynamic linking, see https://github.com/emscripten-core/emscripten/wiki/Linking";function Xf(l,d){Re(xl)}function Gf(l,d){Re(xl)}function Kf(){return 2097152}var Jf=!0;function qf(){return Jf}function da(l){Atomics.store(o(),l>>2,1),hs()&&jl(l),Atomics.compareExchange(o(),l>>2,1,0)}c.executeNotifiedProxyingQueue=da;function Zf(l,d,f,p){if(l==d)setTimeout(()=>da(p));else if(F)postMessage({targetThread:l,cmd:"processProxyingQueue",queue:p});else{var _=C.pthreads[l];if(!_)return;_.postMessage({cmd:"processProxyingQueue",queue:p})}return 1}function Qf(l,d,f){return-1}function th(){Re("")}function eh(l,d){return globalThis.DUCKDB_RUNTIME.createDirectory(c,l,d)}function rh(l,d){return globalThis.DUCKDB_RUNTIME.checkDirectory(c,l,d)}function nh(l,d){return globalThis.DUCKDB_RUNTIME.listDirectoryEntries(c,l,d)}function ih(l,d){return globalThis.DUCKDB_RUNTIME.removeDirectory(c,l,d)}function sh(l){return globalThis.DUCKDB_RUNTIME.closeFile(c,l)}function oh(l,d){return globalThis.DUCKDB_RUNTIME.checkFile(c,l,d)}function ah(l){return globalThis.DUCKDB_RUNTIME.getLastFileModificationTime(c,l)}function ch(l,d,f,p){return globalThis.DUCKDB_RUNTIME.moveFile(c,l,d,f,p)}function lh(l,d){return globalThis.DUCKDB_RUNTIME.openFile(c,l,d)}function uh(l,d,f,p){return globalThis.DUCKDB_RUNTIME.readFile(c,l,d,f,p)}function dh(l,d){return globalThis.DUCKDB_RUNTIME.truncateFile(c,l,d)}function fh(l,d,f,p){return globalThis.DUCKDB_RUNTIME.writeFile(c,l,d,f,p)}function hh(l){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(l)}function ph(l,d){return globalThis.DUCKDB_RUNTIME.glob(c,l,d)}function mh(l){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(c,l)}function _h(l,d,f,p,_,S){return globalThis.DUCKDB_RUNTIME.callScalarUDF(c,l,d,f,p,_,S)}function hi(l){hi.shown||(hi.shown={}),hi.shown[l]||(hi.shown[l]=1,yt&&(l="warning: "+l),ct(l))}function yh(){yt||ft||hi("Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread")}function bh(){return Date.now()}function Tl(){return 4294901760}function gh(){return Tl()}var us;yt?us=()=>{var l=process.hrtime();return l[0]*1e3+l[1]/1e6}:F?us=()=>performance.now()-c.__performance_now_clock_drift:us=()=>performance.now();function wh(l,d,f){n().copyWithin(l>>>0,d>>>0,d+f>>>0)}function vh(){return yt?uf().cpus().length:navigator.hardwareConcurrency}function Sh(l){var d=ya(),f=l();return _s(d),f}function Q(l,d){var f=arguments.length-2,p=arguments;return Sh(()=>{for(var _=f,S=ys(_*8),w=S>>3,v=0;v<f;v++){var x=p[2+v];u()[w+v>>>0]=x}return Wl(l,_,S,d)})}var fa=[];function Ih(l,d,f){fa.length=d;for(var p=f>>3,_=0;_<d;_++)fa[_]=u()[p+_>>>0];var S=l<0,w=S?kf[-l-1]:Vh[l];return w.apply(null,fa)}function Ah(l){try{return St.grow(l-de.byteLength+65535>>>16),Ir(St.buffer),1}catch(d){}}function Fh(l){var d=n().length;if(l=l>>>0,l<=d)return!1;var f=Tl();if(l>f)return!1;let p=(x,tt)=>x+(tt-x%tt)%tt;for(var _=1;_<=4;_*=2){var S=d*(1+.2/_);S=Math.min(S,l+100663296);var w=Math.min(f,p(Math.max(l,S),65536)),v=Ah(w);if(v)return!0}return!1}function xh(){throw"unwind"}var ha={};function Th(){return Z||"./this.program"}function pi(){if(!pi.strings){var l=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",d={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:l,_:Th()};for(var f in ha)ha[f]===void 0?delete d[f]:d[f]=ha[f];var p=[];for(var f in d)p.push(f+"="+d[f]);pi.strings=p}return pi.strings}function Bh(l,d,f){for(var p=0;p<l.length;++p)e()[d++>>>0]=l.charCodeAt(p);f||(e()[d>>>0]=0)}function Bl(l,d){if(F)return Q(26,1,l,d);var f=0;return pi().forEach(function(p,_){var S=d+f;a()[l+_*4>>>2]=S,Bh(p,S),f+=p.length+1}),0}function Dl(l,d){if(F)return Q(27,1,l,d);var f=pi();a()[l>>>2]=f.length;var p=0;return f.forEach(function(_){p+=_.length+1}),a()[d>>>2]=p,0}function El(l){return F?Q(28,1,l):52}function Ol(l,d){if(F)return Q(29,1,l,d);var f=l==1||l==2?2:Re();return e()[d>>>0]=f,0}function Rl(l,d,f,p,_,S){return F?Q(30,1,l,d,f,p,_,S):52}function Ml(l,d,f,p,_,S){return F?Q(31,1,l,d,f,p,_,S):52}function Ul(l,d,f,p){return F?Q(32,1,l,d,f,p):52}function kl(l,d,f,p,_){return F?Q(33,1,l,d,f,p,_):70}function Ll(l){return F?Q(34,1,l):52}var Dh=[null,[],[]];function Eh(l,d){var f=Dh[l];d===0||d===10?((l===1?ht:ct)(Tc(f,0)),f.length=0):f.push(d)}function Nl(l,d,f,p){if(F)return Q(35,1,l,d,f,p);for(var _=0,S=0;S<f;S++){var w=a()[d>>>2],v=a()[d+4>>>2];d+=8;for(var x=0;x<v;x++)Eh(l,n()[w+x>>>0]);_+=v}return a()[p>>>2]=_,0}function Cl(l,d,f,p){if(F)return Q(36,1,l,d,f,p);var _=0,S=0,w=0,v=0,x=0,tt=0,nt;function fe(lt,ir,xt,se,he,Ar){var g,E,pt,ut;return E=lt===10?28:16,he=lt===10?rl(he):ca(he),g=_a(E),ut=ua(g,lt,he,Ar),sa(!ut),pt=_a(32),o()[pt+4>>>2]=lt,o()[pt+8>>>2]=ir,o()[pt+12>>>2]=xt,o()[pt+24>>>2]=se,a()[pt+20>>>2]=g,lt===10?o()[pt+16>>>2]=28:o()[pt+16>>>2]=16,o()[pt+28>>>2]=0,pt}if(f&&(w=o()[f>>>2],v=o()[f+4>>>2],x=o()[f+8>>>2],tt=o()[f+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&&!d)return-2;if(w&-1088||f!==0&&o()[f>>>2]&2&&!l)return-1;if(w&32)return-2;if(x!==0&&x!==1&&x!==2)return-7;if(v!==0&&v!==2&&v!==10)return-6;if(d&&(d=Sr(d),S=parseInt(d,10),isNaN(S)))return w&1024?-2:-8;if(!l)return v===0&&(v=2),(w&1)===0&&(v===2?_=ps(2130706433):_=[0,0,0,1]),nt=fe(v,x,tt,null,_,S),a()[p>>>2]=nt,0;if(l=Sr(l),_=cs(l),_!==null)if(v===0||v===2)v=2;else if(v===10&&w&8)_=[0,0,ps(65535),_],v=10;else return-2;else if(_=la(l),_!==null)if(v===0||v===10)v=10;else return-2;return _!=null?(nt=fe(v,x,tt,l,_,S),a()[p>>>2]=nt,0):w&4?-2:(l=Ue.lookup_name(l),_=cs(l),v===0?v=2:v===10&&(_=[0,0,ps(65535),_]),nt=fe(v,x,tt,null,_,S),a()[p>>>2]=nt,0)}function Oh(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var l=new Uint8Array(1);return()=>(crypto.getRandomValues(l),l[0])}else if(yt)try{var d=ba("crypto");return()=>d.randomBytes(1)[0]}catch(f){}return()=>Re("randomDevice")}function ds(l,d){ds.randomDevice||(ds.randomDevice=Oh());for(var f=0;f<d;f++)e()[l+f>>>0]=ds.randomDevice();return 0}function Rh(l,d,f,p,_,S,w){var v=nl(l,d);if(v.errno)return-6;var x=v.port,tt=v.addr,nt=!1;if(f&&p){var fe;if(w&1||!(fe=Ue.lookup_addr(tt))){if(w&8)return-2}else tt=fe;var lt=oa(tt,f,p);lt+1>=p&&(nt=!0)}if(_&&S){x=""+x;var lt=oa(x,_,S);lt+1>=S&&(nt=!0)}return nt?-12:0}function fs(l){return l%4===0&&(l%100!==0||l%400===0)}function Mh(l,d){for(var f=0,p=0;p<=d;f+=l[p++]);return f}var Pl=[31,29,31,30,31,30,31,31,30,31,30,31],Vl=[31,28,31,30,31,30,31,31,30,31,30,31];function Uh(l,d){for(var f=new Date(l.getTime());d>0;){var p=fs(f.getFullYear()),_=f.getMonth(),S=(p?Pl:Vl)[_];if(d>S-f.getDate())d-=S-f.getDate()+1,f.setDate(1),_<11?f.setMonth(_+1):(f.setMonth(0),f.setFullYear(f.getFullYear()+1));else return f.setDate(f.getDate()+d),f}return f}function kh(l,d,f){var p=f>0?f:wf(l)+1,_=new Array(p),S=Bc(l,_,0,_.length);return d&&(_.length=S),_}function Hl(l,d){e().set(l,d>>>0)}function Lh(l,d,f,p){var _=o()[p+40>>>2],S={tm_sec:o()[p>>>2],tm_min:o()[p+4>>>2],tm_hour:o()[p+8>>>2],tm_mday:o()[p+12>>>2],tm_mon:o()[p+16>>>2],tm_year:o()[p+20>>>2],tm_wday:o()[p+24>>>2],tm_yday:o()[p+28>>>2],tm_isdst:o()[p+32>>>2],tm_gmtoff:o()[p+36>>>2],tm_zone:_?Sr(_):""},w=Sr(f),v={"%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 v)w=w.replace(new RegExp(x,"g"),v[x]);var tt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],nt=["January","February","March","April","May","June","July","August","September","October","November","December"];function fe(g,E,pt){for(var ut=typeof g=="number"?g.toString():g||"";ut.length<E;)ut=pt[0]+ut;return ut}function lt(g,E){return fe(g,E,"0")}function ir(g,E){function pt(oe){return oe<0?-1:oe>0?1:0}var ut;return(ut=pt(g.getFullYear()-E.getFullYear()))===0&&(ut=pt(g.getMonth()-E.getMonth()))===0&&(ut=pt(g.getDate()-E.getDate())),ut}function xt(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 se(g){var E=Uh(new Date(g.tm_year+1900,0,1),g.tm_yday),pt=new Date(E.getFullYear(),0,4),ut=new Date(E.getFullYear()+1,0,4),oe=xt(pt),mi=xt(ut);return ir(oe,E)<=0?ir(mi,E)<=0?E.getFullYear()+1:E.getFullYear():E.getFullYear()-1}var he={"%a":function(g){return tt[g.tm_wday].substring(0,3)},"%A":function(g){return tt[g.tm_wday]},"%b":function(g){return nt[g.tm_mon].substring(0,3)},"%B":function(g){return nt[g.tm_mon]},"%C":function(g){var E=g.tm_year+1900;return lt(E/100|0,2)},"%d":function(g){return lt(g.tm_mday,2)},"%e":function(g){return fe(g.tm_mday,2," ")},"%g":function(g){return se(g).toString().substring(2)},"%G":function(g){return se(g)},"%H":function(g){return lt(g.tm_hour,2)},"%I":function(g){var E=g.tm_hour;return E==0?E=12:E>12&&(E-=12),lt(E,2)},"%j":function(g){return lt(g.tm_mday+Mh(fs(g.tm_year+1900)?Pl:Vl,g.tm_mon-1),3)},"%m":function(g){return lt(g.tm_mon+1,2)},"%M":function(g){return lt(g.tm_min,2)},"%n":function(){return`
|
|
13
|
+
`},"%p":function(g){return g.tm_hour>=0&&g.tm_hour<12?"AM":"PM"},"%S":function(g){return lt(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 lt(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 ut=(g.tm_wday+371-g.tm_yday)%7;ut!=4&&(ut!=3||!fs(g.tm_year))&&(E=1)}}else{E=52;var pt=(g.tm_wday+7-g.tm_yday-1)%7;(pt==4||pt==5&&fs(g.tm_year%400-1))&&E++}return lt(E,2)},"%w":function(g){return g.tm_wday},"%W":function(g){var E=g.tm_yday+7-(g.tm_wday+6)%7;return lt(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,pt=E>=0;return E=Math.abs(E)/60,E=E/60*100+E%60,(pt?"+":"-")+String("0000"+E).slice(-4)},"%Z":function(g){return g.tm_zone},"%%":function(){return"%"}};w=w.replace(/%%/g,"\0\0");for(var x in he)w.includes(x)&&(w=w.replace(new RegExp(x,"g"),he[x](S)));w=w.replace(/\0\0/g,"%");var Ar=kh(w,!1);return Ar.length>d?0:(Hl(Ar,l),Ar.length-1)}function Nh(l,d,f,p,_){return Lh(l,d,f,p)}function Ch(l){var d=c["_"+l];return d}function Ph(l,d,f,p,_){var S={string:xt=>{var se=0;if(xt!=null&&xt!==0){var he=(xt.length<<2)+1;se=ys(he),oa(xt,se,he)}return se},array:xt=>{var se=ys(xt.length);return Hl(xt,se),se}};function w(xt){return d==="string"?Sr(xt):d==="boolean"?Boolean(xt):xt}var v=Ch(l),x=[],tt=0;if(p)for(var nt=0;nt<p.length;nt++){var fe=S[f[nt]];fe?(tt===0&&(tt=ya()),x[nt]=fe(p[nt])):x[nt]=p[nt]}var lt=v.apply(null,x);function ir(xt){return tt!==0&&_s(tt),w(xt)}return lt=ir(lt),lt}C.init();var Vh=[null,Xc,qc,Zc,tl,sl,ol,al,cl,ll,ul,dl,fl,hl,pl,ml,_l,yl,bl,gl,wl,vl,Sl,Il,Al,Fl,Bl,Dl,El,Ol,Rl,Ml,Ul,kl,Ll,Nl,Cl],Hh={b:zf,w:Wf,t:jf,ca:Qc,V:tl,Z:sl,Y:ol,R:al,c:cl,ka:ll,A:ul,fa:dl,T:fl,U:hl,r:pl,ha:ml,la:_l,ia:yl,s:bl,W:gl,P:wl,p:vl,X:Sl,m:Il,ja:Al,q:Fl,$:Yf,o:Xf,aa:Gf,da:Kf,ta:qf,_:Zf,L:Qf,f:th,I:eh,J:rh,G:nh,H:ih,k:sh,E:oh,x:ah,F:ch,M:lh,g:uh,K:dh,h:fh,N:hh,D:ph,j:mh,O:_h,l:yh,ua:bh,ma:gh,d:us,ga:wh,na:vh,B:Ih,sa:Fh,v:xh,pa:Bl,qa:Dl,ba:Kc,e:El,ra:Ol,z:Rl,y:Ml,u:Ul,C:kl,Q:Ll,i:Nl,n:Cl,ea:ds,S:Rh,a:St||c.wasmMemory,oa:Nh},Uy=Uf(),zh=c.___wasm_call_ctors=function(){return(zh=c.___wasm_call_ctors=c.asm.va).apply(null,arguments)},Wh=c._main=function(){return(Wh=c._main=c.asm.wa).apply(null,arguments)},jh=c._duckdb_web_fs_glob_add_path=function(){return(jh=c._duckdb_web_fs_glob_add_path=c.asm.ya).apply(null,arguments)},$h=c._duckdb_web_clear_response=function(){return($h=c._duckdb_web_clear_response=c.asm.za).apply(null,arguments)},Yh=c._duckdb_web_fail_with=function(){return(Yh=c._duckdb_web_fail_with=c.asm.Aa).apply(null,arguments)},Xh=c._duckdb_web_reset=function(){return(Xh=c._duckdb_web_reset=c.asm.Ba).apply(null,arguments)},Gh=c._duckdb_web_connect=function(){return(Gh=c._duckdb_web_connect=c.asm.Ca).apply(null,arguments)},Kh=c._duckdb_web_disconnect=function(){return(Kh=c._duckdb_web_disconnect=c.asm.Da).apply(null,arguments)},Jh=c._duckdb_web_flush_files=function(){return(Jh=c._duckdb_web_flush_files=c.asm.Ea).apply(null,arguments)},qh=c._duckdb_web_flush_file=function(){return(qh=c._duckdb_web_flush_file=c.asm.Fa).apply(null,arguments)},Zh=c._duckdb_web_open=function(){return(Zh=c._duckdb_web_open=c.asm.Ga).apply(null,arguments)},Qh=c._duckdb_web_get_global_file_info=function(){return(Qh=c._duckdb_web_get_global_file_info=c.asm.Ha).apply(null,arguments)},tp=c._duckdb_web_collect_file_stats=function(){return(tp=c._duckdb_web_collect_file_stats=c.asm.Ia).apply(null,arguments)},ep=c._duckdb_web_export_file_stats=function(){return(ep=c._duckdb_web_export_file_stats=c.asm.Ja).apply(null,arguments)},rp=c._duckdb_web_fs_drop_file=function(){return(rp=c._duckdb_web_fs_drop_file=c.asm.Ka).apply(null,arguments)},np=c._duckdb_web_fs_drop_files=function(){return(np=c._duckdb_web_fs_drop_files=c.asm.La).apply(null,arguments)},ip=c._duckdb_web_fs_glob_file_infos=function(){return(ip=c._duckdb_web_fs_glob_file_infos=c.asm.Ma).apply(null,arguments)},sp=c._duckdb_web_fs_get_file_info_by_id=function(){return(sp=c._duckdb_web_fs_get_file_info_by_id=c.asm.Na).apply(null,arguments)},op=c._duckdb_web_fs_get_file_info_by_name=function(){return(op=c._duckdb_web_fs_get_file_info_by_name=c.asm.Oa).apply(null,arguments)},ap=c._duckdb_web_fs_register_file_url=function(){return(ap=c._duckdb_web_fs_register_file_url=c.asm.Pa).apply(null,arguments)},cp=c._duckdb_web_fs_register_file_buffer=function(){return(cp=c._duckdb_web_fs_register_file_buffer=c.asm.Qa).apply(null,arguments)},lp=c._duckdb_web_copy_file_to_buffer=function(){return(lp=c._duckdb_web_copy_file_to_buffer=c.asm.Ra).apply(null,arguments)},up=c._duckdb_web_copy_file_to_path=function(){return(up=c._duckdb_web_copy_file_to_path=c.asm.Sa).apply(null,arguments)},dp=c._duckdb_web_get_version=function(){return(dp=c._duckdb_web_get_version=c.asm.Ta).apply(null,arguments)},fp=c._duckdb_web_get_feature_flags=function(){return(fp=c._duckdb_web_get_feature_flags=c.asm.Ua).apply(null,arguments)},hp=c._duckdb_web_tokenize=function(){return(hp=c._duckdb_web_tokenize=c.asm.Va).apply(null,arguments)},pp=c._duckdb_web_udf_scalar_create=function(){return(pp=c._duckdb_web_udf_scalar_create=c.asm.Wa).apply(null,arguments)},mp=c._duckdb_web_prepared_create=function(){return(mp=c._duckdb_web_prepared_create=c.asm.Xa).apply(null,arguments)},_p=c._duckdb_web_prepared_close=function(){return(_p=c._duckdb_web_prepared_close=c.asm.Ya).apply(null,arguments)},yp=c._duckdb_web_prepared_run=function(){return(yp=c._duckdb_web_prepared_run=c.asm.Za).apply(null,arguments)},bp=c._duckdb_web_prepared_send=function(){return(bp=c._duckdb_web_prepared_send=c.asm._a).apply(null,arguments)},gp=c._duckdb_web_query_run=function(){return(gp=c._duckdb_web_query_run=c.asm.$a).apply(null,arguments)},wp=c._duckdb_web_pending_query_start=function(){return(wp=c._duckdb_web_pending_query_start=c.asm.ab).apply(null,arguments)},vp=c._duckdb_web_pending_query_poll=function(){return(vp=c._duckdb_web_pending_query_poll=c.asm.bb).apply(null,arguments)},Sp=c._duckdb_web_pending_query_cancel=function(){return(Sp=c._duckdb_web_pending_query_cancel=c.asm.cb).apply(null,arguments)},Ip=c._duckdb_web_query_fetch_results=function(){return(Ip=c._duckdb_web_query_fetch_results=c.asm.db).apply(null,arguments)},Ap=c._duckdb_web_get_tablenames=function(){return(Ap=c._duckdb_web_get_tablenames=c.asm.eb).apply(null,arguments)},Fp=c._duckdb_web_insert_arrow_from_ipc_stream=function(){return(Fp=c._duckdb_web_insert_arrow_from_ipc_stream=c.asm.fb).apply(null,arguments)},xp=c._duckdb_web_insert_csv_from_path=function(){return(xp=c._duckdb_web_insert_csv_from_path=c.asm.gb).apply(null,arguments)},Tp=c._duckdb_web_insert_json_from_path=function(){return(Tp=c._duckdb_web_insert_json_from_path=c.asm.hb).apply(null,arguments)},Bp=c.__emscripten_tls_init=function(){return(Bp=c.__emscripten_tls_init=c.asm.ib).apply(null,arguments)},hs=c._pthread_self=function(){return(hs=c._pthread_self=c.asm.jb).apply(null,arguments)},zl=c.__emscripten_thread_init=function(){return(zl=c.__emscripten_thread_init=c.asm.kb).apply(null,arguments)},Dp=c.__emscripten_thread_crashed=function(){return(Dp=c.__emscripten_thread_crashed=c.asm.lb).apply(null,arguments)},ps=c._htonl=function(){return(ps=c._htonl=c.asm.mb).apply(null,arguments)},ms=c._htons=function(){return(ms=c._htons=c.asm.nb).apply(null,arguments)},Wl=c._emscripten_run_in_main_runtime_thread_js=function(){return(Wl=c._emscripten_run_in_main_runtime_thread_js=c.asm.ob).apply(null,arguments)},pa=c._ntohs=function(){return(pa=c._ntohs=c.asm.pb).apply(null,arguments)},jl=c.__emscripten_proxy_execute_task_queue=function(){return(jl=c.__emscripten_proxy_execute_task_queue=c.asm.qb).apply(null,arguments)},ma=c.__emscripten_thread_free_data=function(){return(ma=c.__emscripten_thread_free_data=c.asm.rb).apply(null,arguments)},$l=c.__emscripten_thread_exit=function(){return($l=c.__emscripten_thread_exit=c.asm.sb).apply(null,arguments)},_a=c._malloc=function(){return(_a=c._malloc=c.asm.tb).apply(null,arguments)},Ep=c._free=function(){return(Ep=c._free=c.asm.ub).apply(null,arguments)},Yl=c.___trap=function(){return(Yl=c.___trap=c.asm.vb).apply(null,arguments)},Xl=c._emscripten_stack_set_limits=function(){return(Xl=c._emscripten_stack_set_limits=c.asm.wb).apply(null,arguments)},ya=c.stackSave=function(){return(ya=c.stackSave=c.asm.xb).apply(null,arguments)},_s=c.stackRestore=function(){return(_s=c.stackRestore=c.asm.yb).apply(null,arguments)},ys=c.stackAlloc=function(){return(ys=c.stackAlloc=c.asm.zb).apply(null,arguments)};c.keepRuntimeAlive=ss,c.wasmMemory=St,c.ccall=Ph,c.ExitStatus=di,c.PThread=C;var bs;ui=function l(){bs||Gl(),bs||(ui=l)};function Op(l){var d=c._main,f=0,p=0;try{var _=d(f,p);return Gc(_,!0),_}catch(S){return Jc(S)}}function Gl(l){if(l=l||I,cn>0)return;if(F){m(c),Hc(),postMessage({cmd:"loaded"});return}if(Af(),cn>0)return;function d(){bs||(bs=!0,c.calledRun=!0,!ia&&(Hc(),Ff(),m(c),c.onRuntimeInitialized&&c.onRuntimeInitialized(),Kl&&Op(l),xf()))}c.setStatus?(c.setStatus("Running..."),setTimeout(function(){setTimeout(function(){c.setStatus("")},1),d()},1)):d()}if(c.preInit)for(typeof c.preInit=="function"&&(c.preInit=[c.preInit]);c.preInit.length>0;)c.preInit.pop()();var Kl=!0;return c.noInitialRun&&(Kl=!1),Gl(),t.ready}})(),df=Sy;var qo=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=Mt.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new Et(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 Zo(this._bindings,this._conn,e),i=Mt.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 gc(this._bindings,this._conn,e)}createScalarFunction(t,e,n){this._bindings.createScalarFunction(this._conn,t,e,n)}insertArrowTable(t,e){let n=Go(t,"stream");this.insertArrowFromIPCStream(n,e)}insertArrowFromIPCStream(t,e){this._bindings.insertArrowFromIPCStream(this._conn,t,e)}insertCSVFromPath(t,e){this._bindings.insertCSVFromPath(this._conn,t,e)}insertJSONFromPath(t,e){this._bindings.insertJSONFromPath(this._conn,t,e)}},Zo=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}},gc=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=Mt.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new Et(n)}send(...t){let e=this.bindings.sendPrepared(this.connectionId,this.statementId,t),n=new Zo(this.bindings,this.connectionId,e),i=Mt.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};var pf=new TextEncoder,ff=new TextDecoder("utf-8");function wc(r,t,e){let n=pf.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 vc(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 hf(r,t,e){let n=r.HEAPU8.subarray(t,t+e);return new Uint8Array(n.buffer,n.byteOffset,e)}function Qo(r,t,e){let n=r.HEAPU8.subarray(t,t+e*8);return new Float64Array(n.buffer,n.byteOffset,e)}function mf(r,t,e,n,i,s,o,a){try{let u=r._udfFunctions.get(n);if(!u){wc(t,e,"Unknown UDF with id: "+n);return}let c=ff.decode(t.HEAPU8.subarray(i,i+s)),m=JSON.parse(c),y=Qo(t,o,a/8),b=et=>{var Xt;let ie=null;switch(et.validityBuffer!==void 0&&(ie=hf(t,y[et.validityBuffer],m.rows)),et.physicalType){case"VARCHAR":{if(et.dataBuffer===null||et.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(et.lengthBuffer===null||et.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let Qt=vc(t,y[et.dataBuffer],et.physicalType,m.rows),Gt=[],Pt=Qo(t,y[et.lengthBuffer],m.rows);for(let ht=0;ht<m.rows;++ht){if(ie!=null&&!ie[ht]){Gt.push(null);continue}let ct=t.HEAPU8.subarray(Qt[ht],Qt[ht]+Pt[ht]),ai=ff.decode(ct);Gt.push(ai)}return ht=>Gt[ht]}case"STRUCT":{let Qt={},Gt=[];for(let Pt=0;Pt<(((Xt=et.children)==null?void 0:Xt.length)||0);++Pt){let ht=et.children[Pt],ct=b(ht);Gt.push(ai=>{Qt[ht.name]=ct(ai)})}return ie!=null?Pt=>{if(!ie[Pt])return null;for(let ht of Gt)ht(Pt);return Qt}:Pt=>{for(let ht of Gt)ht(Pt);return Qt}}default:{if(et.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+et.physicalType);let Qt=vc(t,y[et.dataBuffer],et.physicalType,m.rows);return ie!=null?Gt=>ie[Gt]?Qt[Gt]:null:Gt=>Qt[Gt]}}},I=[];for(let et=0;et<m.args.length;++et)I.push(b(m.args[et]));let Z=m.rows*Sc(m.ret.physicalType),J=t._malloc(Z),_t=vc(t,J,m.ret.physicalType,m.rows),ft=t._malloc(m.rows),yt=hf(t,ft,m.rows);if(_t.length==0||yt.length==0){wc(t,e,"Can't create physical arrays for result");return}let F=_t;m.ret.physicalType=="VARCHAR"&&(F=new Array(m.rows));let Yt=[];for(let et=0;et<m.args.length;++et)Yt.push(null);for(let et=0;et<m.rows;++et){for(let Xt=0;Xt<m.args.length;++Xt)Yt[Xt]=I[Xt](et);let ie=u.func(...Yt);F[et]=ie,yt[et]=ie==null?0:1}let Dn=0;switch(m.ret.physicalType){case"VARCHAR":{let et=new Array(0);Dn=t._malloc(m.rows*Sc("DOUBLE"));let ie=Qo(t,Dn,m.rows),Xt=0;for(let ht=0;ht<m.rows;++ht){let ct=pf.encode(F[ht]||"");et.push(ct),ie[ht]=ct.length,Xt+=ct.length}let Qt=t._malloc(Xt),Gt=t.HEAPU8.subarray(Qt,Qt+Xt),Pt=0;for(let ht=0;ht<m.rows;++ht){_t[ht]=Pt;let ct=et[ht];Gt.subarray(Pt,Pt+ct.length).set(ct),Pt+=ct.length}}}let si=3*8,oi=t._malloc(si),Wr=Qo(t,oi,3);Wr[0]=J,Wr[1]=ft,Wr[2]=Dn,t.HEAPF64[(e>>3)+0]=0,t.HEAPF64[(e>>3)+1]=oi,t.HEAPF64[(e>>3)+2]=0}catch(u){wc(t,e,u.toString())}}function Ay(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}var Fy=Ay();function vr(r,t){console.error(`FAIL WITH: ${t}`),r.ccall("duckdb_web_fail_with",null,["string"],[t])}function Bn(r,t,e){let n=r.HEAPU8.subarray(t,t+e),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function W(r,t,e){return Fy(r.HEAPU8.subarray(t,t+e))}function ot(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],u=r.HEAPF64[(s>>3)+2];return r.stackRestore(i),[o,a,u]}function vt(r){r.ccall("duckdb_web_clear_response",null,[],[])}var ta=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 xy=new TextEncoder;var ea=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]=ot(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(e!==0)throw new Error(W(this.mod,n,i));vt(this.mod)}reset(){let[t,e,n]=ot(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));vt(this.mod)}getVersion(){let[t,e,n]=ot(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));let i=W(this.mod,e,n);return vt(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let[e,n,i]=ot(this.mod,"duckdb_web_tokenize",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=W(this.mod,n,i);return vt(this.mod),JSON.parse(s)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new qo(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]=ot(this.mod,"duckdb_web_query_run",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));let o=Bn(this.mod,i,s);return vt(this.mod),o}startPendingQuery(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_pending_query_start",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));if(i==0)return null;let o=Bn(this.mod,i,s);return vt(this.mod),o}pollPendingQuery(t){let[e,n,i]=ot(this.mod,"duckdb_web_pending_query_poll",["number"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));if(n==0)return null;let s=Bn(this.mod,n,i);return vt(this.mod),s}cancelPendingQuery(t){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[t])}fetchQueryResults(t){let[e,n,i]=ot(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=Bn(this.mod,n,i);return vt(this.mod),s}getTableNames(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_get_tablenames",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));let o=W(this.mod,i,s);return vt(this.mod),JSON.parse(o)}createScalarFunction(t,e,n,i){let s={functionId:this._nextUDFId,name:e,returnType:ii(n)},o={functionId:s.functionId,connectionId:t,name:e,returnType:n,func:i};this._nextUDFId+=1;let[a,u,c]=ot(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(s)]);if(a!==0)throw new Error(W(this.mod,u,c));if(vt(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(o.functionId,o),this.pthread)for(let m of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])m.postMessage({cmd:"registerUDFFunction",udf:o})}createPrepared(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_prepared_create",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));return vt(this.mod),i}closePrepared(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_prepared_close",["number","number"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));vt(this.mod)}runPrepared(t,e,n){let[i,s,o]=ot(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(W(this.mod,s,o));let a=Bn(this.mod,s,o);return vt(this.mod),a}sendPrepared(t,e,n){let[i,s,o]=ot(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(W(this.mod,s,o));let a=Bn(this.mod,s,o);return vt(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,u,c]=ot(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,i,e.length,o]);if(a!==0)throw new Error(W(this.mod,u,c))}insertCSVFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let c in n.columns)n.columnsFlat.push(Ko(c,n.columns[c]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,u]=ot(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(W(this.mod,a,u))}insertJSONFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let c in n.columns)n.columnsFlat.push(Ko(c,n.columns[c]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,u]=ot(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(W(this.mod,a,u))}globFiles(t){let[e,n,i]=ot(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=W(this.mod,n,i);vt(this.mod);let o=JSON.parse(s);return o==null?[]:o}registerFileURL(t,e,n,i=!1){e===void 0&&(e=t);let[s,o,a]=ot(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[t,e,n,i]);if(s!==0)throw new Error(W(this.mod,o,a));vt(this.mod)}registerFileText(t,e){let n=xy.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]=ot(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,n,e.length]);if(s!==0)throw new Error(W(this.mod,o,a));vt(this.mod)}registerFileHandle(t,e,n,i){let[s,o,a]=ot(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[t,t,n,i]);if(s!==0)throw new Error(W(this.mod,o,a));if(vt(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,e),this.pthread){for(let u of this.pthread.runningWorkers)u.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:e});for(let u of this.pthread.unusedWorkers)u.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[e,n,i]=ot(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));vt(this.mod)}dropFiles(){let[t,e,n]=ot(this.mod,"duckdb_web_fs_drop_files",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));vt(this.mod)}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));vt(this.mod)}copyFileToBuffer(t){let[e,n,i]=ot(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=this.mod.HEAPU8.subarray(n,n+i),o=new Uint8Array(s.length);return o.set(s),vt(this.mod),o}collectFileStatistics(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s))}exportFileStatistics(t){let[e,n,i]=ot(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));return new ta(this.mod.HEAPU8.subarray(n,n+i))}};var ra=class extends ea{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 J;let a=new Request(this.mainModuleURL),u=await fetch(a),c=u.headers.get("content-length"),m=c&&parseInt(c,10)||0,y=new Date,b={startedAt:y,updatedAt:y,bytesTotal:m||0,bytesLoaded:0},I={transform(_t,ft){b.bytesLoaded+=_t.byteLength;let yt=new Date;if(yt.getTime()-b.updatedAt.getTime()<20){b.updatedAt=yt,ft.enqueue(_t);return}for(let F of i)F(b);ft.enqueue(_t)}},Z=new TransformStream(I);return new Response((J=u.body)==null?void 0:J.pipeThrough(Z),u)})();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,u={startedAt:a,updatedAt:a,bytesTotal:0,bytesLoaded:0};s.open("GET",o),s.responseType="arraybuffer",s.onerror=c=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+c}),new Error(c.toString())},s.onprogress=c=>{u.bytesTotal=c.total,u.bytesLoaded=c.loaded;let m=new Date;if(m.getTime()-u.updatedAt.getTime()<20){u.updatedAt=m;return}for(let y of i)y(u)},s.onload=()=>{WebAssembly.instantiate(s.response,e).then(c=>{n(c.instance,c.module)}).catch(c=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+c}),new Error(c)})},s.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let o=new Request(this.mainModuleURL),u=await(await fetch(o)).arrayBuffer();WebAssembly.instantiate(u,e).then(c=>{n(c.instance,c.module)})})();return[]}};var na=class extends ra{constructor(t,e,n,i=null){super(t,e,n,i)}instantiateImpl(t){return df({...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};var sn=Zl(_f()),yf=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 Ty(r,t,e){var i,s,o,a;let n=bf(t);return{url:n.path,query:"",host:yf(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 By(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 Dy(r,t=null){var Z;let e=(Z=t==null?void 0:t.contentHash)!=null?Z:"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+`
|
|
14
|
+
`+By(r.url)+`
|
|
15
15
|
`+r.query;t!=null&&t.contentType&&(s+=`
|
|
16
16
|
content-type:`+(t==null?void 0:t.contentType)),s+=`
|
|
17
17
|
host:`+r.host+`
|
|
@@ -23,7 +23,7 @@ x-amz-security-token:`+r.sessionToken),s+=`
|
|
|
23
23
|
`+e;let o=(0,sn.sha256)(s),a=`AWS4-HMAC-SHA256
|
|
24
24
|
`+r.datetimeNow+`
|
|
25
25
|
`+r.dateNow+"/"+r.region+"/"+r.service+`/aws4_request
|
|
26
|
-
`+o,u="AWS4"+r.secretAccessKey,c=sn.sha256.hmac.arrayBuffer(u,r.dateNow),m=sn.sha256.hmac.arrayBuffer(c,r.region),y=sn.sha256.hmac.arrayBuffer(m,r.service),b=sn.sha256.hmac.arrayBuffer(y,"aws4_request"),I=sn.sha256.hmac(b,a);return n.set("Authorization","AWS4-HMAC-SHA256 Credential="+r.accessKeyId+"/"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request, SignedHeaders="+i+", Signature="+I),n}var
|
|
26
|
+
`+o,u="AWS4"+r.secretAccessKey,c=sn.sha256.hmac.arrayBuffer(u,r.dateNow),m=sn.sha256.hmac.arrayBuffer(c,r.region),y=sn.sha256.hmac.arrayBuffer(m,r.service),b=sn.sha256.hmac.arrayBuffer(y,"aws4_request"),I=sn.sha256.hmac(b,a);return n.set("Authorization","AWS4-HMAC-SHA256 Credential="+r.accessKeyId+"/"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request, SignedHeaders="+i+", Signature="+I),n}var Ey=function(r,t,e,n=null,i=null){let s=Ty(r,t,e),o={contentType:n,contentHash:i?sn.sha256.hex(i):null};return Dy(s,o)};function on(r,t,e,n,i=null,s=null){((t==null?void 0:t.accessKeyId)||(t==null?void 0:t.sessionToken))&&(Ey(t,e,n,i,s).forEach((a,u)=>{r.setRequestHeader(u,a)}),i&&r.setRequestHeader("content-type",i))}function bf(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 an(r,t){var n;let e=bf(t);return(n=r==null?void 0:r.endpoint)!=null&&n.startsWith("http")?`${r==null?void 0:r.endpoint}/${e.bucket}`+e.path:"https://"+yf(r,t,e.bucket)+e.path}var at={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,getFileInfo(r,t){try{let e=at._fileInfoCache.get(t),[n,i,s]=ot(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=W(r,i,s);vt(r);let a=JSON.parse(o);if(a==null)return null;let u={...a,blob:null};return at._fileInfoCache.set(t,u),u}catch(e){return null}},getGlobalFileInfo(r){var t;try{let[e,n,i]=ot(r,"duckdb_web_get_global_file_info",["number"],[((t=at._globalFileInfo)==null?void 0:t.cacheEpoch)||0]);if(e!==0)return null;if(i===0)return at._globalFileInfo;let s=W(r,n,i);vt(r);let o=JSON.parse(s);return o==null?null:(at._globalFileInfo={...o,blob:null},at._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}},getDefaultDataProtocol(r){return 2},openFile:(r,t,e)=>{var n;try{at._fileInfoCache.delete(t);let i=at.getFileInfo(r,t);switch(i==null?void 0:i.dataProtocol){case 4:case 5:{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==5?(o.open("HEAD",an(i.s3Config,i.dataUrl),!1),on(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),u=new Uint8Array;r.HEAPU8.set(u,a);let c=r._malloc(2*8);return r.HEAPF64[(c>>3)+0]=1,r.HEAPF64[(c>>3)+1]=a,c}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==5?(o.open("HEAD",an(i.s3Config,i.dataUrl),!1),on(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 u=r._malloc(16);return r.HEAPF64[(u>>3)+0]=+a,r.HEAPF64[(u>>3)+1]=0,u}}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==5?(o.open("GET",an(i.s3Config,i.dataUrl),!1),on(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),u=new Uint8Array(o.response,0,o.response.byteLength);r.HEAPU8.set(u,a);let c=r._malloc(2*8);return r.HEAPF64[(c>>3)+0]=o.response.byteLength,r.HEAPF64[(c>>3)+1]=a,c}}if(s!=null)throw new Error(`Reading file ${i.fileName} failed with error: ${s}`);return 0}case 2:{let s=(n=at._files)==null?void 0:n.get(i.fileName);if(s){let u=r._malloc(16);return r.HEAPF64[(u>>3)+0]=s.size,r.HEAPF64[(u>>3)+1]=0,u}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()),vr(r,i.toString())}return 0},glob:(r,t,e)=>{try{let n=W(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=at.getGlobalFileInfo(r);i.open("HEAD",an(s==null?void 0:s.s3Config,n),!1),on(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){vr(r,`HEAD request failed: ${n}`);return}r.ccall("duckdb_web_fs_glob_add_path",null,["string"],[n])}}catch(n){return vr(r,n.toString()),0}},checkFile:(r,t,e)=>{try{let n=W(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=at.getGlobalFileInfo(r);i.open("HEAD",an(s==null?void 0:s.s3Config,n),!1),on(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)=>{var n;let e=at.getFileInfo(r,t);switch(at._fileInfoCache.delete(t),e==null?void 0:e.dataProtocol){case 0:case 4:case 5:break;case 1:case 2:return;case 3:{let i=(n=at._files)==null?void 0:n.get(e.fileName);if(!i)throw new Error(`No OPFS access handle registered with name: ${e.fileName}`);return i.flush()}}},truncateFile:(r,t,e)=>{var i;let n=at.getFileInfo(r,t);switch(n==null?void 0:n.dataProtocol){case 4:vr(r,"Cannot truncate a http file");return;case 5:vr(r,"Cannot truncate an s3 file");return;case 0:case 1:case 2:vr(r,"truncateFile not implemented");return;case 3:{let s=(i=at._files)==null?void 0:i.get(n.fileName);if(!s)throw new Error(`No OPFS access handle registered with name: ${n.fileName}`);return s.truncate(e)}}return 0},readFile(r,t,e,n,i){var s,o;try{let a=at.getFileInfo(r,t);switch(a==null?void 0:a.dataProtocol){case 4:case 5:{if(!a.dataUrl)throw new Error(`Missing data URL for file ${t}`);try{let u=new XMLHttpRequest;if(a.dataProtocol==5?(u.open("GET",an(a==null?void 0:a.s3Config,a.dataUrl),!1),on(u,a==null?void 0:a.s3Config,a.dataUrl,"GET")):u.open("GET",a.dataUrl,!1),u.responseType="arraybuffer",u.setRequestHeader("Range",`bytes=${i}-${i+n-1}`),u.send(null),u.status==206||u.status==200&&n==u.response.byteLength&&i==0){let c=new Uint8Array(u.response,0,Math.min(u.response.byteLength,n));return r.HEAPU8.set(c,e),c.byteLength}else throw u.status==200?new Error(`Range request for ${a.dataUrl} did not return a partial response: ${u.status} "${u.statusText}"`):new Error(`Range request for ${a.dataUrl} did returned non-success status: ${u.status} "${u.statusText}"`)}catch(u){throw new Error(`Range request for ${a.dataUrl} failed with error: ${u}"`)}}case 2:{let u=(s=at._files)==null?void 0:s.get(a.fileName);if(!u)throw new Error(`No HTML5 file registered with name: ${a.fileName}`);let c=u.slice(i,i+n),m=new Uint8Array(new FileReaderSync().readAsArrayBuffer(c));return r.HEAPU8.set(m,e),m.byteLength}case 3:{let u=(o=at._files)==null?void 0:o.get(a.fileName);if(!u)throw new Error(`No OPFS access handle registered with name: ${a.fileName}`);let c=r.HEAPU8.subarray(e,e+n);return u.read(c,{at:i})}}return 0}catch(a){return vr(r,a.toString()),0}},writeFile:(r,t,e,n,i)=>{var o;let s=at.getFileInfo(r,t);switch(s==null?void 0:s.dataProtocol){case 4:return vr(r,"Cannot write to HTTP file"),0;case 5:{let a=r.HEAPU8.subarray(e,e+n),u=new XMLHttpRequest;return u.open("PUT",an(s==null?void 0:s.s3Config,s.dataUrl),!1),on(u,s==null?void 0:s.s3Config,s.dataUrl,"PUT","",a),u.send(a),n}case 2:return vr(r,"cannot write using the html5 file reader api"),0;case 3:{let a=(o=at._files)==null?void 0:o.get(s.fileName);if(!a)throw new Error(`No OPFS access handle registered with name: ${s.fileName}`);let u=r.HEAPU8.subarray(e,e+n);return a.write(u,{at:i})}}return 0},getLastFileModificationTime:(r,t)=>{var n;let e=at.getFileInfo(r,t);switch(e==null?void 0:e.dataProtocol){case 2:{if(!((n=at._files)==null?void 0:n.get(e.fileName)))throw Error(`No handle available for file: ${e.fileName}`);return 0}case 4:case 5:return new Date().getTime()}return 0},checkDirectory:(r,t,e)=>{let n=W(r,t,e);return console.log(`checkDirectory: ${n}`),!1},createDirectory:(r,t,e)=>{let n=W(r,t,e);console.log(`createDirectory: ${n}`)},removeDirectory:(r,t,e)=>{let n=W(r,t,e);console.log(`removeDirectory: ${n}`)},listDirectoryEntries:(r,t,e)=>{let n=W(r,t,e);return console.log(`listDirectoryEntries: ${n}`),!1},moveFile:(r,t,e,n,i)=>{var u,c;let s=W(r,t,e),o=W(r,n,i),a=(u=at._files)==null?void 0:u.get(s);a!==void 0&&(at._files.delete(a),at._files.set(o,a));for(let[m,y]of((c=at._fileInfoCache)==null?void 0:c.entries())||[])if(y.dataUrl==s){at._fileInfoCache.delete(m);break}return!0},removeFile:(r,t,e)=>{},callScalarUDF:(r,t,e,n,i,s,o)=>{mf(at,r,t,e,n,i,s,o)}};var Ic=class extends Jo{postMessage(t,e){globalThis.postMessage(t,e)}async instantiate(t,e,n){return await new na(this,at,t,e).instantiate(n)}};function gf(){let r=new Ic;globalThis.onmessage=async t=>{await r.onMessage(t.data)}}gf();return Vp(Oy);})();
|
|
27
27
|
/**
|
|
28
28
|
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
29
29
|
*
|