@ioai/lerobot-studio 1.0.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.
@@ -0,0 +1,63 @@
1
+ //#region src/platform/utils/MediaCache.ts
2
+ var e = class {
3
+ cache;
4
+ maxSize;
5
+ ownsUrls;
6
+ constructor(e = 50, t = !1) {
7
+ this.cache = /* @__PURE__ */ new Map(), this.maxSize = e, this.ownsUrls = t;
8
+ }
9
+ get(e) {
10
+ let t = this.cache.get(e);
11
+ return t !== void 0 && (this.cache.delete(e), this.cache.set(e, t)), t;
12
+ }
13
+ set(e, t) {
14
+ if (this.cache.has(e) && this.cache.delete(e), this.cache.size >= this.maxSize) {
15
+ let e = this.cache.keys().next().value;
16
+ if (e !== void 0) {
17
+ let t = this.cache.get(e);
18
+ this.ownsUrls && typeof t == "string" && t.startsWith("blob:") && URL.revokeObjectURL(t), this.cache.delete(e);
19
+ }
20
+ }
21
+ this.cache.set(e, t);
22
+ }
23
+ has(e) {
24
+ return this.cache.has(e);
25
+ }
26
+ delete(e) {
27
+ let t = this.cache.get(e);
28
+ if (t !== void 0 && (this.cache.delete(e), this.ownsUrls && typeof t == "string" && t.startsWith("blob:"))) try {
29
+ URL.revokeObjectURL(t);
30
+ } catch {}
31
+ }
32
+ clear() {
33
+ this.ownsUrls && this.cache.forEach((e) => {
34
+ typeof e == "string" && e.startsWith("blob:") && URL.revokeObjectURL(e);
35
+ }), this.cache.clear();
36
+ }
37
+ size() {
38
+ return this.cache.size;
39
+ }
40
+ }, t = class {
41
+ cache;
42
+ loadingPromises;
43
+ constructor(t = 10) {
44
+ this.cache = new e(t, !1), this.loadingPromises = /* @__PURE__ */ new Map();
45
+ }
46
+ getUrl(e, t) {
47
+ return this.cache.get(e) || (this.cache.set(e, t), t);
48
+ }
49
+ has(e) {
50
+ return this.cache.has(e);
51
+ }
52
+ get(e) {
53
+ return this.cache.get(e);
54
+ }
55
+ invalidate(e) {
56
+ this.cache.delete(e), this.loadingPromises.delete(e);
57
+ }
58
+ clear() {
59
+ this.cache.clear(), this.loadingPromises.clear();
60
+ }
61
+ };
62
+ //#endregion
63
+ export { t as n, e as t };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ const e=Symbol(`Comlink.proxy`),t=Symbol(`Comlink.endpoint`),n=Symbol(`Comlink.releaseProxy`),r=Symbol(`Comlink.finalizer`),i=Symbol(`Comlink.thrown`),a=e=>typeof e==`object`&&!!e||typeof e==`function`,o=new Map([[`proxy`,{canHandle:t=>a(t)&&t[e],serialize(e){let{port1:t,port2:n}=new MessageChannel;return c(e,t),[n,[n]]},deserialize(e){return e.start(),ee(e)}}],[`throw`,{canHandle:e=>a(e)&&i in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function s(e,t){for(let n of e)if(t===n||n===`*`||n instanceof RegExp&&n.test(t))return!0;return!1}function c(e,t=globalThis,n=[`*`]){t.addEventListener(`message`,function a(o){if(!o||!o.data)return;if(!s(n,o.origin)){console.warn(`Invalid origin '${o.origin}' for comlink proxy`);return}let{id:l,type:ee,path:te}=Object.assign({path:[]},o.data),ne=(o.data.argumentList||[]).map(me),re;try{let t=te.slice(0,-1).reduce((e,t)=>e[t],e),n=te.reduce((e,t)=>e[t],e);switch(ee){case`GET`:re=n;break;case`SET`:t[te.slice(-1)[0]]=me(o.data.value),re=!0;break;case`APPLY`:re=n.apply(t,ne);break;case`CONSTRUCT`:re=fe(new n(...ne));break;case`ENDPOINT`:{let{port1:t,port2:n}=new MessageChannel;c(e,n),re=de(t,[t])}break;case`RELEASE`:re=void 0;break;default:return}}catch(e){re={value:e,[i]:0}}Promise.resolve(re).catch(e=>({value:e,[i]:0})).then(n=>{let[i,o]=pe(n);t.postMessage(Object.assign(Object.assign({},i),{id:l}),o),ee===`RELEASE`&&(t.removeEventListener(`message`,a),u(t),r in e&&typeof e[r]==`function`&&e[r]())}).catch(e=>{let[n,r]=pe({value:TypeError(`Unserializable return value`),[i]:0});t.postMessage(Object.assign(Object.assign({},n),{id:l}),r)})}),t.start&&t.start()}function l(e){return e.constructor.name===`MessagePort`}function u(e){l(e)&&e.close()}function ee(e,t){let n=new Map;return e.addEventListener(`message`,function(e){let{data:t}=e;if(!t||!t.id)return;let r=n.get(t.id);if(r)try{r(t)}finally{n.delete(t.id)}}),se(e,n,[],t)}function te(e){if(e)throw Error(`Proxy has been released and is not useable`)}function ne(e){return he(e,new Map,{type:`RELEASE`}).then(()=>{u(e)})}const re=new WeakMap,ie=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(re.get(e)||0)-1;re.set(e,t),t===0&&ne(e)});function ae(e,t){let n=(re.get(t)||0)+1;re.set(t,n),ie&&ie.register(e,t,e)}function oe(e){ie&&ie.unregister(e)}function se(e,r,i=[],a=function(){}){let o=!1,s=new Proxy(a,{get(t,a){if(te(o),a===n)return()=>{oe(s),ne(e),r.clear(),o=!0};if(a===`then`){if(i.length===0)return{then:()=>s};let t=he(e,r,{type:`GET`,path:i.map(e=>e.toString())}).then(me);return t.then.bind(t)}return se(e,r,[...i,a])},set(t,n,a){te(o);let[s,c]=pe(a);return he(e,r,{type:`SET`,path:[...i,n].map(e=>e.toString()),value:s},c).then(me)},apply(n,a,s){te(o);let c=i[i.length-1];if(c===t)return he(e,r,{type:`ENDPOINT`}).then(me);if(c===`bind`)return se(e,r,i.slice(0,-1));let[l,u]=le(s);return he(e,r,{type:`APPLY`,path:i.map(e=>e.toString()),argumentList:l},u).then(me)},construct(t,n){te(o);let[a,s]=le(n);return he(e,r,{type:`CONSTRUCT`,path:i.map(e=>e.toString()),argumentList:a},s).then(me)}});return ae(s,e),s}function ce(e){return Array.prototype.concat.apply([],e)}function le(e){let t=e.map(pe);return[t.map(e=>e[0]),ce(t.map(e=>e[1]))]}const ue=new WeakMap;function de(e,t){return ue.set(e,t),e}function fe(t){return Object.assign(t,{[e]:!0})}function pe(e){for(let[t,n]of o)if(n.canHandle(e)){let[r,i]=n.serialize(e);return[{type:`HANDLER`,name:t,value:r},i]}return[{type:`RAW`,value:e},ue.get(e)||[]]}function me(e){switch(e.type){case`HANDLER`:return o.get(e.name).deserialize(e.value);case`RAW`:return e.value}}function he(e,t,n,r){return new Promise(i=>{let a=ge();t.set(a,i),e.start&&e.start(),e.postMessage(Object.assign({id:a},n),r)})}function ge(){return[,,,,].fill(0).map(()=>Math.floor(Math.random()*(2**53-1)).toString(16)).join(`-`)}function d(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function _e(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function f(e){return this instanceof f?(this.v=e,this):new f(e)}function ve(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,ee)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){te(a[0][3],e)}}function l(e){e.value instanceof f?Promise.resolve(e.value.v).then(u,ee):te(a[0][2],e)}function u(e){c(`next`,e)}function ee(e){c(`throw`,e)}function te(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function ye(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:f(e[r](t)),done:!1}:i?i(t):t}:i}}function be(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof _e==`function`?_e(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}const xe=new TextDecoder(`utf-8`),Se=xe.decode.bind(xe),Ce=new TextEncoder,we=e=>Ce.encode(e),Te=e=>typeof e==`number`,Ee=e=>typeof e==`boolean`,p=e=>typeof e==`function`,De=e=>e!=null&&Object(e)===e,Oe=e=>De(e)&&p(e.then),ke=e=>De(e)&&p(e[Symbol.iterator]),Ae=e=>De(e)&&p(e[Symbol.asyncIterator]),je=e=>De(e)&&De(e.schema),Me=e=>De(e)&&`done`in e&&`value`in e,Ne=e=>De(e)&&p(e.stat)&&Te(e.fd),Pe=e=>De(e)&&Ie(e.body),Fe=e=>`_getDOMStream`in e&&`_getNodeStream`in e,Ie=e=>De(e)&&p(e.cancel)&&p(e.getReader)&&!Fe(e),Le=e=>De(e)&&p(e.read)&&p(e.pipe)&&Ee(e.readable)&&!Fe(e),Re=e=>De(e)&&p(e.clear)&&p(e.bytes)&&p(e.position)&&p(e.setPosition)&&p(e.capacity)&&p(e.getBufferIdentifier)&&p(e.createLong),ze=typeof SharedArrayBuffer<`u`?SharedArrayBuffer:ArrayBuffer;function Be(e){let t=e[0]?[e[0]]:[],n,r,i,a;for(let o,s,c=0,l=0,u=e.length;++c<u;){if(o=t[l],s=e[c],!o||!s||o.buffer!==s.buffer||s.byteOffset<o.byteOffset){s&&(t[++l]=s);continue}if({byteOffset:n,byteLength:i}=o,{byteOffset:r,byteLength:a}=s,n+i<r||r+a<n){s&&(t[++l]=s);continue}t[l]=new Uint8Array(o.buffer,n,r-n+a)}return t}function Ve(e,t,n=0,r=t.byteLength){let i=e.byteLength,a=new Uint8Array(e.buffer,e.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return a.set(o,n),e}function He(e,t){let n=Be(e),r=n.reduce((e,t)=>e+t.byteLength,0),i,a,o,s=0,c=-1,l=Math.min(t||1/0,r);for(let e=n.length;++c<e;){if(i=n[c],a=i.subarray(0,Math.min(i.length,l-s)),l<=s+a.length){a.length<i.length?n[c]=i.subarray(a.length):a.length===i.length&&c++,o?Ve(o,a,s):o=a;break}Ve(o||=new Uint8Array(l),a,s),s+=a.length}return[o||new Uint8Array,n.slice(c),r-(o?o.byteLength:0)]}function m(e,t){let n=Me(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n==`string`&&(n=we(n)),n instanceof ArrayBuffer||n instanceof ze?new e(n):Re(n)?m(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}const Ue=e=>m(Int32Array,e),We=e=>m(BigInt64Array,e),h=e=>m(Uint8Array,e),Ge=e=>(e.next(),e);function*Ke(e,t){let n=function*(e){yield e},r=typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ze?n(t):ke(t)?t:n(t);return yield*Ge((function*(t){let n=null;do n=t.next(yield m(e,n));while(!n.done)})(r[Symbol.iterator]())),new e}const qe=e=>Ke(Uint8Array,e);function Je(e,t){return ve(this,arguments,function*(){if(Oe(t))return yield f(yield f(yield*ye(be(Je(e,yield f(t))))));let n=function(e){return ve(this,arguments,function*(){yield yield f(yield f(e))})},r=typeof t==`string`||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ze?n(t):ke(t)?function(e){return ve(this,arguments,function*(){yield f(yield*ye(be(Ge((function*(e){let t=null;do t=e.next(yield t?.value);while(!t.done)})(e[Symbol.iterator]())))))})}(t):Ae(t)?t:n(t);return yield f(yield*ye(be(Ge((function(t){return ve(this,arguments,function*(){let n=null;do n=yield f(t.next(yield yield f(m(e,n))));while(!n.done)})})(r[Symbol.asyncIterator]()))))),yield f(new e)})}const Ye=e=>Je(Uint8Array,e);function Xe(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var Ze={fromIterable(e){return Qe($e(e))},fromAsyncIterable(e){return Qe(et(e))},fromDOMStream(e){return Qe(tt(e))},fromNodeStream(e){return Qe(it(e))},toDOMStream(e,t){throw Error(`"toDOMStream" not available in this environment`)},toNodeStream(e,t){throw Error(`"toNodeStream" not available in this environment`)}};const Qe=e=>(e.next(),e);function*$e(e){let t,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?He(r,o)[0]:([i,r,s]=He(r,o),i)}({cmd:a,size:o}=(yield null)||{cmd:`read`,size:0});let l=qe(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-s)?l.next():l.next(o-s),!t&&i.byteLength>0&&(r.push(i),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield c());while(o<s);while(!t)}catch(e){n=!0,typeof l.throw==`function`&&l.throw(e)}finally{n===!1&&typeof l.return==`function`&&l.return(null)}return null}function et(e){return ve(this,arguments,function*(){let t,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?He(r,o)[0]:([i,r,s]=He(r,o),i)}({cmd:a,size:o}=(yield yield f(null))||{cmd:`read`,size:0});let l=Ye(e)[Symbol.asyncIterator]();try{do if({done:t,value:i}=Number.isNaN(o-s)?yield f(l.next()):yield f(l.next(o-s)),!t&&i.byteLength>0&&(r.push(i),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield yield f(c()));while(o<s);while(!t)}catch(e){n=!0,typeof l.throw==`function`&&(yield f(l.throw(e)))}finally{n===!1&&typeof l.return==`function`&&(yield f(l.return(new Uint8Array)))}return yield f(null)})}function tt(e){return ve(this,arguments,function*(){let t=!1,n=!1,r=[],i,a,o,s=0;function c(){return a===`peek`?He(r,o)[0]:([i,r,s]=He(r,o),i)}({cmd:a,size:o}=(yield yield f(null))||{cmd:`read`,size:0});let l=new nt(e);try{do if({done:t,value:i}=Number.isNaN(o-s)?yield f(l.read()):yield f(l.read(o-s)),!t&&i.byteLength>0&&(r.push(h(i)),s+=i.byteLength),t||o<=s)do({cmd:a,size:o}=yield yield f(c()));while(o<s);while(!t)}catch(e){n=!0,yield f(l.cancel(e))}finally{n===!1?yield f(l.cancel()):e.locked&&l.releaseLock()}return yield f(null)})}var nt=class{constructor(e){this.source=e,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(e){return d(this,void 0,void 0,function*(){let{reader:t,source:n}=this;t&&(yield t.cancel(e).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(e){return d(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array};let t=yield this.reader.read();return!t.done&&(t.value=h(t)),t})}};const rt=(e,t)=>{let n=e=>r([t,e]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function it(e){return ve(this,arguments,function*(){let t=[],n=`error`,r=!1,i=null,a,o,s=0,c=[],l;function u(){return a===`peek`?He(c,o)[0]:([l,c,s]=He(c,o),l)}if({cmd:a,size:o}=(yield yield f(null))||{cmd:`read`,size:0},e.isTTY)return yield yield f(new Uint8Array),yield f(null);try{t[0]=rt(e,`end`),t[1]=rt(e,`error`);do{if(t[2]=rt(e,`readable`),[n,i]=yield f(Promise.race(t.map(e=>e[2]))),n===`error`)break;if((r=n===`end`)||(Number.isFinite(o-s)?(l=h(e.read(o-s)),l.byteLength<o-s&&(l=h(e.read()))):l=h(e.read()),l.byteLength>0&&(c.push(l),s+=l.byteLength)),r||o<=s)do({cmd:a,size:o}=yield yield f(u()));while(o<s)}while(!r)}finally{yield f(ee(t,n===`error`?i:null))}return yield f(null);function ee(t,n){return l=c=null,new Promise((r,i)=>{for(let[n,r]of t)e.off(n,r);try{let t=e.destroy;t&&t.call(e,n),n=void 0}catch(e){n=e||n}finally{n==null?r():i(n)}})}})}var g;(function(e){e[e.V1=0]=`V1`,e[e.V2=1]=`V2`,e[e.V3=2]=`V3`,e[e.V4=3]=`V4`,e[e.V5=4]=`V5`})(g||={});var at;(function(e){e[e.Sparse=0]=`Sparse`,e[e.Dense=1]=`Dense`})(at||={});var _;(function(e){e[e.HALF=0]=`HALF`,e[e.SINGLE=1]=`SINGLE`,e[e.DOUBLE=2]=`DOUBLE`})(_||={});var ot;(function(e){e[e.DAY=0]=`DAY`,e[e.MILLISECOND=1]=`MILLISECOND`})(ot||={});var v;(function(e){e[e.SECOND=0]=`SECOND`,e[e.MILLISECOND=1]=`MILLISECOND`,e[e.MICROSECOND=2]=`MICROSECOND`,e[e.NANOSECOND=3]=`NANOSECOND`})(v||={});var y;(function(e){e[e.YEAR_MONTH=0]=`YEAR_MONTH`,e[e.DAY_TIME=1]=`DAY_TIME`,e[e.MONTH_DAY_NANO=2]=`MONTH_DAY_NANO`})(y||={});const st=new Int32Array(2),ct=new Float32Array(st.buffer),lt=new Float64Array(st.buffer),ut=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var dt;(function(e){e[e.UTF8_BYTES=1]=`UTF8_BYTES`,e[e.UTF16_STRING=2]=`UTF16_STRING`})(dt||={});var ft=class e{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readUint64(e){return BigInt.asUintN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<<BigInt(32)))}readFloat32(e){return st[0]=this.readInt32(e),ct[0]}readFloat64(e){return st[+!ut]=this.readInt32(e),st[+!!ut]=this.readInt32(e+4),lt[0]}writeInt8(e,t){this.bytes_[e]=t}writeUint8(e,t){this.bytes_[e]=t}writeInt16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeUint16(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8}writeInt32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeUint32(e,t){this.bytes_[e]=t,this.bytes_[e+1]=t>>8,this.bytes_[e+2]=t>>16,this.bytes_[e+3]=t>>24}writeInt64(e,t){this.writeInt32(e,Number(BigInt.asIntN(32,t))),this.writeInt32(e+4,Number(BigInt.asIntN(32,t>>BigInt(32))))}writeUint64(e,t){this.writeUint32(e,Number(BigInt.asUintN(32,t))),this.writeUint32(e+4,Number(BigInt.asUintN(32,t>>BigInt(32))))}writeFloat32(e,t){ct[0]=t,this.writeInt32(e,st[0])}writeFloat64(e,t){lt[0]=t,this.writeInt32(e,st[+!ut]),this.writeInt32(e+4,st[+!!ut])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw Error(`FlatBuffers: ByteBuffer is too short to contain an identifier.`);let e=``;for(let t=0;t<4;t++)e+=String.fromCharCode(this.readInt8(this.position_+4+t));return e}__offset(e,t){let n=e-this.readInt32(e);return t<this.readInt16(n)?this.readInt16(n+t):0}__union(e,t){return e.bb_pos=t+this.readInt32(t),e.bb=this,e}__string(e,t){e+=this.readInt32(e);let n=this.readInt32(e);e+=4;let r=this.bytes_.subarray(e,e+n);return t===dt.UTF8_BYTES?r:this.text_decoder_.decode(r)}__union_with_string(e,t){return typeof e==`string`?this.__string(t):this.__union(e,t)}__indirect(e){return e+this.readInt32(e)}__vector(e){return e+this.readInt32(e)+4}__vector_len(e){return this.readInt32(e+this.readInt32(e))}__has_identifier(e){if(e.length!=4)throw Error(`FlatBuffers: file identifier must be length 4`);for(let t=0;t<4;t++)if(e.charCodeAt(t)!=this.readInt8(this.position()+4+t))return!1;return!0}createScalarList(e,t){let n=[];for(let r=0;r<t;++r){let t=e(r);t!==null&&n.push(t)}return n}createObjList(e,t){let n=[];for(let r=0;r<t;++r){let t=e(r);t!==null&&n.push(t.unpack())}return n}},pt=class e{constructor(e){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let t;t=e||1024,this.bb=ft.allocate(t),this.space=t}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(e){this.force_defaults=e}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let t=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-t}this.pad(r)}pad(e){for(let t=0;t<e;t++)this.bb.writeInt8(--this.space,0)}writeInt8(e){this.bb.writeInt8(--this.space,e)}writeInt16(e){this.bb.writeInt16(this.space-=2,e)}writeInt32(e){this.bb.writeInt32(this.space-=4,e)}writeInt64(e){this.bb.writeInt64(this.space-=8,e)}writeFloat32(e){this.bb.writeFloat32(this.space-=4,e)}writeFloat64(e){this.bb.writeFloat64(this.space-=8,e)}addInt8(e){this.prep(1,0),this.writeInt8(e)}addInt16(e){this.prep(2,0),this.writeInt16(e)}addInt32(e){this.prep(4,0),this.writeInt32(e)}addInt64(e){this.prep(8,0),this.writeInt64(e)}addFloat32(e){this.prep(4,0),this.writeFloat32(e)}addFloat64(e){this.prep(8,0),this.writeFloat64(e)}addFieldInt8(e,t,n){(this.force_defaults||t!=n)&&(this.addInt8(t),this.slot(e))}addFieldInt16(e,t,n){(this.force_defaults||t!=n)&&(this.addInt16(t),this.slot(e))}addFieldInt32(e,t,n){(this.force_defaults||t!=n)&&(this.addInt32(t),this.slot(e))}addFieldInt64(e,t,n){(this.force_defaults||t!==n)&&(this.addInt64(t),this.slot(e))}addFieldFloat32(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat32(t),this.slot(e))}addFieldFloat64(e,t,n){(this.force_defaults||t!=n)&&(this.addFloat64(t),this.slot(e))}addFieldOffset(e,t,n){(this.force_defaults||t!=n)&&(this.addOffset(t),this.slot(e))}addFieldStruct(e,t,n){t!=n&&(this.nested(t),this.slot(e))}nested(e){if(e!=this.offset())throw TypeError(`FlatBuffers: struct must be serialized inline.`)}notNested(){if(this.isNested)throw TypeError(`FlatBuffers: object serialization must not be nested.`)}slot(e){this.vtable!==null&&(this.vtable[e]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(e){let t=e.capacity();if(t&3221225472)throw Error(`FlatBuffers: cannot grow buffer beyond 2 gigabytes.`);let n=t<<1,r=ft.allocate(n);return r.setPosition(n-t),r.bytes().set(e.bytes(),n-t),r}addOffset(e){this.prep(4,0),this.writeInt32(this.offset()-e+4)}startObject(e){this.notNested(),this.vtable??=[],this.vtable_in_use=e;for(let t=0;t<e;t++)this.vtable[t]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw Error(`FlatBuffers: endObject called without startObject`);this.addInt32(0);let e=this.offset(),t=this.vtable_in_use-1;for(;t>=0&&this.vtable[t]==0;t--);let n=t+1;for(;t>=0;t--)this.addInt16(this.vtable[t]==0?0:e-this.vtable[t]);this.addInt16(e-this.object_start);let r=(n+2)*2;this.addInt16(r);let i=0,a=this.space;outer_loop:for(t=0;t<this.vtables.length;t++){let e=this.bb.capacity()-this.vtables[t];if(r==this.bb.readInt16(e)){for(let t=2;t<r;t+=2)if(this.bb.readInt16(a+t)!=this.bb.readInt16(e+t))continue outer_loop;i=this.vtables[t];break}}return i?(this.space=this.bb.capacity()-e,this.bb.writeInt32(this.space,i-e)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-e,this.offset()-e)),this.isNested=!1,e}finish(e,t,n){let r=n?4:0;if(t){let e=t;if(this.prep(this.minalign,8+r),e.length!=4)throw TypeError(`FlatBuffers: file identifier must be length 4`);for(let t=3;t>=0;t--)this.writeInt8(e.charCodeAt(t))}this.prep(this.minalign,4+r),this.addOffset(e),r&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,t){this.finish(e,t,!0)}requiredField(e,t){let n=this.bb.capacity()-e,r=n-this.bb.readInt32(n);if(!(t<this.bb.readInt16(r)&&this.bb.readInt16(r+t)!=0))throw TypeError(`FlatBuffers: field `+t+` must be set`)}startVector(e,t,n){this.notNested(),this.vector_num_elems=t,this.prep(4,e*t),this.prep(n,e*t)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(e){if(!e)return 0;if(this.string_maps||=new Map,this.string_maps.has(e))return this.string_maps.get(e);let t=this.createString(e);return this.string_maps.set(e,t),t}createString(e){if(e==null)return 0;let t;return t=e instanceof Uint8Array?e:this.text_encoder.encode(e),this.addInt8(0),this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector()}createByteVector(e){return e==null?0:(this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector())}createObjectOffset(e){return e===null?0:typeof e==`string`?this.createString(e):e.pack(this)}createObjectOffsetList(e){let t=[];for(let n=0;n<e.length;++n){let r=e[n];if(r!==null)t.push(this.createObjectOffset(r));else throw TypeError(`FlatBuffers: Argument for createObjectOffsetList cannot contain null.`)}return t}createStructOffsetList(e,t){return t(this,e.length),this.createObjectOffsetList(e.slice().reverse()),this.endVector()}},mt;(function(e){e[e.BUFFER=0]=`BUFFER`})(mt||={});var ht;(function(e){e[e.LZ4_FRAME=0]=`LZ4_FRAME`,e[e.ZSTD=1]=`ZSTD`})(ht||={});var gt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBodyCompression(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt8(this.bb_pos+e):ht.LZ4_FRAME}method(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt8(this.bb_pos+e):mt.BUFFER}static startBodyCompression(e){e.startObject(2)}static addCodec(e,t){e.addFieldInt8(0,t,ht.LZ4_FRAME)}static addMethod(e,t){e.addFieldInt8(1,t,mt.BUFFER)}static endBodyCompression(e){return e.endObject()}static createBodyCompression(t,n,r){return e.startBodyCompression(t),e.addCodec(t,n),e.addMethod(t,r),e.endBodyCompression(t)}},_t=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},vt=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},yt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}nodes(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new vt).__init(this.bb.__vector(this.bb_pos+n)+e*16,this.bb):null}nodesLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}buffers(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new _t).__init(this.bb.__vector(this.bb_pos+n)+e*16,this.bb):null}buffersLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}compression(e){let t=this.bb.__offset(this.bb_pos,10);return t?(e||new gt).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}variadicBufferCounts(e){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}variadicBufferCountsLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startRecordBatch(e){e.startObject(5)}static addLength(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addNodes(e,t){e.addFieldOffset(1,t,0)}static startNodesVector(e,t){e.startVector(16,t,8)}static addBuffers(e,t){e.addFieldOffset(2,t,0)}static startBuffersVector(e,t){e.startVector(16,t,8)}static addCompression(e,t){e.addFieldOffset(3,t,0)}static addVariadicBufferCounts(e,t){e.addFieldOffset(4,t,0)}static createVariadicBufferCountsVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startVariadicBufferCountsVector(e,t){e.startVector(8,t,8)}static endRecordBatch(e){return e.endObject()}},bt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}data(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new yt).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isDelta(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startDictionaryBatch(e){e.startObject(3)}static addId(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addData(e,t){e.addFieldOffset(1,t,0)}static addIsDelta(e,t){e.addFieldInt8(2,+t,0)}static endDictionaryBatch(e){return e.endObject()}},xt;(function(e){e[e.Little=0]=`Little`,e[e.Big=1]=`Big`})(xt||={});var St;(function(e){e[e.DenseArray=0]=`DenseArray`})(St||={});var Ct=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInt(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}isSigned(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startInt(e){e.startObject(2)}static addBitWidth(e,t){e.addFieldInt32(0,t,0)}static addIsSigned(e,t){e.addFieldInt8(1,+t,0)}static endInt(e){return e.endObject()}static createInt(t,n,r){return e.startInt(t),e.addBitWidth(t,n),e.addIsSigned(t,r),e.endInt(t)}},wt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDictionaryEncoding(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}indexType(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Ct).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}isOrdered(){let e=this.bb.__offset(this.bb_pos,8);return e?!!this.bb.readInt8(this.bb_pos+e):!1}dictionaryKind(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt16(this.bb_pos+e):St.DenseArray}static startDictionaryEncoding(e){e.startObject(4)}static addId(e,t){e.addFieldInt64(0,t,BigInt(`0`))}static addIndexType(e,t){e.addFieldOffset(1,t,0)}static addIsOrdered(e,t){e.addFieldInt8(2,+t,0)}static addDictionaryKind(e,t){e.addFieldInt16(3,t,St.DenseArray)}static endDictionaryEncoding(e){return e.endObject()}},b=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}value(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startKeyValue(e){e.startObject(2)}static addKey(e,t){e.addFieldOffset(0,t,0)}static addValue(e,t){e.addFieldOffset(1,t,0)}static endKeyValue(e){return e.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}},Tt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(e){e.startObject(0)}static endBinary(e){return e.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}},Et=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBinaryView(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinaryView(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinaryView(e){e.startObject(0)}static endBinaryView(e){return e.endObject()}static createBinaryView(t){return e.startBinaryView(t),e.endBinaryView(t)}},Dt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(e){e.startObject(0)}static endBool(e){return e.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}},Ot=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ot.MILLISECOND}static startDate(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,ot.MILLISECOND)}static endDate(e){return e.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}},kt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDecimal(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}scale(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):0}bitWidth(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readInt32(this.bb_pos+e):128}static startDecimal(e){e.startObject(3)}static addPrecision(e,t){e.addFieldInt32(0,t,0)}static addScale(e,t){e.addFieldInt32(1,t,0)}static addBitWidth(e,t){e.addFieldInt32(2,t,128)}static endDecimal(e){return e.endObject()}static createDecimal(t,n,r,i){return e.startDecimal(t),e.addPrecision(t,n),e.addScale(t,r),e.addBitWidth(t,i),e.endDecimal(t)}},At=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsDuration(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):v.MILLISECOND}static startDuration(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,v.MILLISECOND)}static endDuration(e){return e.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}},jt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeBinary(e){e.startObject(1)}static addByteWidth(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeBinary(e){return e.endObject()}static createFixedSizeBinary(t,n){return e.startFixedSizeBinary(t),e.addByteWidth(t,n),e.endFixedSizeBinary(t)}},Mt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFixedSizeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt32(this.bb_pos+e):0}static startFixedSizeList(e){e.startObject(1)}static addListSize(e,t){e.addFieldInt32(0,t,0)}static endFixedSizeList(e){return e.endObject()}static createFixedSizeList(t,n){return e.startFixedSizeList(t),e.addListSize(t,n),e.endFixedSizeList(t)}},Nt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFloatingPoint(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):_.HALF}static startFloatingPoint(e){e.startObject(1)}static addPrecision(e,t){e.addFieldInt16(0,t,_.HALF)}static endFloatingPoint(e){return e.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}},Pt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):y.YEAR_MONTH}static startInterval(e){e.startObject(1)}static addUnit(e,t){e.addFieldInt16(0,t,y.YEAR_MONTH)}static endInterval(e){return e.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}},Ft=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(e){e.startObject(0)}static endLargeBinary(e){return e.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}},It=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeList(e){e.startObject(0)}static endLargeList(e){return e.endObject()}static createLargeList(t){return e.startLargeList(t),e.endLargeList(t)}},Lt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsLargeUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(e){e.startObject(0)}static endLargeUtf8(e){return e.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}},Rt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(e){e.startObject(0)}static endList(e){return e.endObject()}static createList(t){return e.startList(t),e.endList(t)}},zt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let e=this.bb.__offset(this.bb_pos,4);return e?!!this.bb.readInt8(this.bb_pos+e):!1}static startMap(e){e.startObject(1)}static addKeysSorted(e,t){e.addFieldInt8(0,+t,0)}static endMap(e){return e.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}},Bt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(e){e.startObject(0)}static endNull(e){return e.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}},Vt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(e){e.startObject(0)}static endStruct_(e){return e.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}},Ht=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTime(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):v.MILLISECOND}bitWidth(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb_pos+e):32}static startTime(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,v.MILLISECOND)}static addBitWidth(e,t){e.addFieldInt32(1,t,32)}static endTime(e){return e.endObject()}static createTime(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}},Ut=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsTimestamp(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):v.SECOND}timezone(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__string(this.bb_pos+t,e):null}static startTimestamp(e){e.startObject(2)}static addUnit(e,t){e.addFieldInt16(0,t,v.SECOND)}static addTimezone(e,t){e.addFieldOffset(1,t,0)}static endTimestamp(e){return e.endObject()}static createTimestamp(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}},Wt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUnion(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):at.Sparse}typeIds(e){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb.__vector(this.bb_pos+t)+e*4):0}typeIdsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}typeIdsArray(){let e=this.bb.__offset(this.bb_pos,6);return e?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+e),this.bb.__vector_len(this.bb_pos+e)):null}static startUnion(e){e.startObject(2)}static addMode(e,t){e.addFieldInt16(0,t,at.Sparse)}static addTypeIds(e,t){e.addFieldOffset(1,t,0)}static createTypeIdsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addInt32(t[n]);return e.endVector()}static startTypeIdsVector(e,t){e.startVector(4,t,4)}static endUnion(e){return e.endObject()}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}},Gt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}},Kt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsUtf8View(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8View(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8View(e){e.startObject(0)}static endUtf8View(e){return e.endObject()}static createUtf8View(t){return e.startUtf8View(t),e.endUtf8View(t)}},x;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.FloatingPoint=3]=`FloatingPoint`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct_=13]=`Struct_`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.LargeList=21]=`LargeList`,e[e.RunEndEncoded=22]=`RunEndEncoded`,e[e.BinaryView=23]=`BinaryView`,e[e.Utf8View=24]=`Utf8View`,e[e.ListView=25]=`ListView`,e[e.LargeListView=26]=`LargeListView`})(x||={});var qt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(e){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.__string(this.bb_pos+t,e):null}nullable(){let e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):x.NONE}type(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__union(e,this.bb_pos+t):null}dictionary(e){let t=this.bb.__offset(this.bb_pos,12);return t?(e||new wt).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,16);return n?(t||new b).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,t){e.addFieldOffset(0,t,0)}static addNullable(e,t){e.addFieldInt8(1,+t,0)}static addTypeType(e,t){e.addFieldInt8(2,t,x.NONE)}static addType(e,t){e.addFieldOffset(3,t,0)}static addDictionary(e,t){e.addFieldOffset(4,t,0)}static addChildren(e,t){e.addFieldOffset(5,t,0)}static createChildrenVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startChildrenVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(6,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endField(e){return e.endObject()}},Jt=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):xt.Little}fields(e,t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new qt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}fieldsLength(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new b).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb.__vector(this.bb_pos+t)+e*8):BigInt(0)}featuresLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,t){e.addFieldInt16(0,t,xt.Little)}static addFields(e,t){e.addFieldOffset(1,t,0)}static createFieldsVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startFieldsVector(e,t){e.startVector(4,t,4)}static addCustomMetadata(e,t){e.addFieldOffset(2,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static addFeatures(e,t){e.addFieldOffset(3,t,0)}static createFeaturesVector(e,t){e.startVector(8,t.length,8);for(let n=t.length-1;n>=0;n--)e.addInt64(t[n]);return e.endVector()}static startFeaturesVector(e,t){e.startVector(8,t,8)}static endSchema(e){return e.endObject()}static createSchema(t,n,r,i,a){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,a),e.endSchema(t)}},S;(function(e){e[e.NONE=0]=`NONE`,e[e.Schema=1]=`Schema`,e[e.DictionaryBatch=2]=`DictionaryBatch`,e[e.RecordBatch=3]=`RecordBatch`,e[e.Tensor=4]=`Tensor`,e[e.SparseTensor=5]=`SparseTensor`})(S||={});var C;(function(e){e[e.NONE=0]=`NONE`,e[e.Null=1]=`Null`,e[e.Int=2]=`Int`,e[e.Float=3]=`Float`,e[e.Binary=4]=`Binary`,e[e.Utf8=5]=`Utf8`,e[e.Bool=6]=`Bool`,e[e.Decimal=7]=`Decimal`,e[e.Date=8]=`Date`,e[e.Time=9]=`Time`,e[e.Timestamp=10]=`Timestamp`,e[e.Interval=11]=`Interval`,e[e.List=12]=`List`,e[e.Struct=13]=`Struct`,e[e.Union=14]=`Union`,e[e.FixedSizeBinary=15]=`FixedSizeBinary`,e[e.FixedSizeList=16]=`FixedSizeList`,e[e.Map=17]=`Map`,e[e.Duration=18]=`Duration`,e[e.LargeBinary=19]=`LargeBinary`,e[e.LargeUtf8=20]=`LargeUtf8`,e[e.LargeList=21]=`LargeList`,e[e.BinaryView=23]=`BinaryView`,e[e.Utf8View=24]=`Utf8View`,e[e.Dictionary=-1]=`Dictionary`,e[e.Int8=-2]=`Int8`,e[e.Int16=-3]=`Int16`,e[e.Int32=-4]=`Int32`,e[e.Int64=-5]=`Int64`,e[e.Uint8=-6]=`Uint8`,e[e.Uint16=-7]=`Uint16`,e[e.Uint32=-8]=`Uint32`,e[e.Uint64=-9]=`Uint64`,e[e.Float16=-10]=`Float16`,e[e.Float32=-11]=`Float32`,e[e.Float64=-12]=`Float64`,e[e.DateDay=-13]=`DateDay`,e[e.DateMillisecond=-14]=`DateMillisecond`,e[e.TimestampSecond=-15]=`TimestampSecond`,e[e.TimestampMillisecond=-16]=`TimestampMillisecond`,e[e.TimestampMicrosecond=-17]=`TimestampMicrosecond`,e[e.TimestampNanosecond=-18]=`TimestampNanosecond`,e[e.TimeSecond=-19]=`TimeSecond`,e[e.TimeMillisecond=-20]=`TimeMillisecond`,e[e.TimeMicrosecond=-21]=`TimeMicrosecond`,e[e.TimeNanosecond=-22]=`TimeNanosecond`,e[e.DenseUnion=-23]=`DenseUnion`,e[e.SparseUnion=-24]=`SparseUnion`,e[e.IntervalDayTime=-25]=`IntervalDayTime`,e[e.IntervalYearMonth=-26]=`IntervalYearMonth`,e[e.DurationSecond=-27]=`DurationSecond`,e[e.DurationMillisecond=-28]=`DurationMillisecond`,e[e.DurationMicrosecond=-29]=`DurationMicrosecond`,e[e.DurationNanosecond=-30]=`DurationNanosecond`,e[e.IntervalMonthDayNano=-31]=`IntervalMonthDayNano`})(C||={});var Yt;(function(e){e[e.OFFSET=0]=`OFFSET`,e[e.DATA=1]=`DATA`,e[e.VALIDITY=2]=`VALIDITY`,e[e.TYPE=3]=`TYPE`})(Yt||={});function Xt(e){if(e===null)return`null`;if(e===void 0)return`undefined`;switch(typeof e){case`number`:return`${e}`;case`bigint`:return`${e}`;case`string`:return`"${e}"`}return typeof e[Symbol.toPrimitive]==`function`?e[Symbol.toPrimitive](`string`):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(e=>Xt(e))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(e,t)=>typeof t==`bigint`?`${t}`:t)}function w(e){if(typeof e==`bigint`&&(e<-(2**53-1)||e>2**53-1))throw TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function Zt(e,t){return w(e/t)+w(e%t)/w(t)}const Qt=Symbol.for(`isArrowBigNum`);function $t(e,...t){return t.length===0?Object.setPrototypeOf(m(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}$t.prototype[Qt]=!0,$t.prototype.toJSON=function(){return`"${on(this)}"`},$t.prototype.valueOf=function(e){return an(this,e)},$t.prototype.toString=function(){return on(this)},$t.prototype[Symbol.toPrimitive]=function(e=`default`){switch(e){case`number`:return an(this);case`string`:return on(this);case`default`:return sn(this)}return on(this)};function en(...e){return $t.apply(this,e)}function tn(...e){return $t.apply(this,e)}function nn(...e){return $t.apply(this,e)}Object.setPrototypeOf(en.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(tn.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(nn.prototype,Object.create(Uint32Array.prototype)),Object.assign(en.prototype,$t.prototype,{constructor:en,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(tn.prototype,$t.prototype,{constructor:tn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(nn.prototype,$t.prototype,{constructor:nn,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const rn=BigInt(4294967296)*BigInt(4294967296)-BigInt(1);function an(e,t){let{buffer:n,byteOffset:r,byteLength:i,signed:a}=e,o=new BigUint64Array(n,r,i/8),s=a&&o.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(s){for(let e of o)c|=(e^rn)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let e of o)c|=e*(BigInt(1)<<BigInt(64*l++));if(typeof t==`number`&&t>0){let e=BigInt(`1`.padEnd(t+1,`0`)),n=c/e,r=s?-(c%e):c%e,i=w(n),a=`${r}`.padStart(t,`0`);return+`${s&&i===0?`-`:``}${i}.${a}`}return w(c)}function on(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return cn(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return cn(e);t=t.slice();let n=1;for(let e=0;e<t.length;e++){let r=t[e],i=~r+n;t[e]=i,n&=+(r===0)}return`-${cn(t)}`}function sn(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:on(e)}function cn(e){let t=``,n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),a=-1,o=r.length-1;do{for(n[0]=r[a=0];a<o;)r[a++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[a];r[a]=n[1]=n[0]/10,n[0]-=n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??`0`}var ln=class e{static new(e,t){switch(t){case!0:return new en(e);case!1:return new tn(e)}switch(e.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new en(e)}return e.byteLength===16?new nn(e):new tn(e)}static signed(e){return new en(e)}static unsigned(e){return new tn(e)}static decimal(e){return new nn(e)}constructor(t,n){return e.new(t,n)}},un,dn,fn,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn;const Fn=Symbol.for(`apache-arrow/DataType`);var T=class e{static isDataType(e){return e?.[Fn]===!0}static isNull(e){return e?.typeId===C.Null}static isInt(e){return e?.typeId===C.Int}static isFloat(e){return e?.typeId===C.Float}static isBinary(e){return e?.typeId===C.Binary}static isBinaryView(e){return e?.typeId===C.BinaryView}static isLargeBinary(e){return e?.typeId===C.LargeBinary}static isUtf8(e){return e?.typeId===C.Utf8}static isUtf8View(e){return e?.typeId===C.Utf8View}static isLargeUtf8(e){return e?.typeId===C.LargeUtf8}static isBool(e){return e?.typeId===C.Bool}static isDecimal(e){return e?.typeId===C.Decimal}static isDate(e){return e?.typeId===C.Date}static isTime(e){return e?.typeId===C.Time}static isTimestamp(e){return e?.typeId===C.Timestamp}static isInterval(e){return e?.typeId===C.Interval}static isDuration(e){return e?.typeId===C.Duration}static isList(e){return e?.typeId===C.List}static isLargeList(e){return e?.typeId===C.LargeList}static isStruct(e){return e?.typeId===C.Struct}static isUnion(e){return e?.typeId===C.Union}static isFixedSizeBinary(e){return e?.typeId===C.FixedSizeBinary}static isFixedSizeList(e){return e?.typeId===C.FixedSizeList}static isMap(e){return e?.typeId===C.Map}static isDictionary(e){return e?.typeId===C.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===at.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===at.Sparse}constructor(e){this.typeId=e}};un=Symbol.toStringTag,T[un]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Fn]=!0,e[Symbol.toStringTag]=`DataType`))(T.prototype);var In=class extends T{constructor(){super(C.Null)}toString(){return`Null`}};dn=Symbol.toStringTag,In[dn]=(e=>e[Symbol.toStringTag]=`Null`)(In.prototype);var E=class extends T{constructor(e,t){super(C.Int),this.isSigned=e,this.bitWidth=t}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 Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?`I`:`Ui`}nt${this.bitWidth}`}};fn=Symbol.toStringTag,E[fn]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]=`Int`))(E.prototype);var Ln=class extends E{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Rn=class extends E{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},zn=class extends E{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Bn=class extends E{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Vn=class extends E{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Hn=class extends E{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Un=class extends E{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Wn=class extends E{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Ln.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(Rn.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(zn.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(Bn.prototype,"ArrayType",{value:BigInt64Array}),Object.defineProperty(Vn.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(Hn.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(Un.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(Wn.prototype,"ArrayType",{value:BigUint64Array});var Gn=class extends T{constructor(e){super(C.Float),this.precision=e}get ArrayType(){switch(this.precision){case _.HALF:return Uint16Array;case _.SINGLE:return Float32Array;case _.DOUBLE:return Float64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};pn=Symbol.toStringTag,Gn[pn]=(e=>(e.precision=null,e[Symbol.toStringTag]=`Float`))(Gn.prototype);var Kn=class extends Gn{constructor(){super(_.HALF)}},qn=class extends Gn{constructor(){super(_.SINGLE)}},Jn=class extends Gn{constructor(){super(_.DOUBLE)}};Object.defineProperty(Kn.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(qn.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(Jn.prototype,"ArrayType",{value:Float64Array});var Yn=class extends T{constructor(){super(C.Binary)}toString(){return`Binary`}};mn=Symbol.toStringTag,Yn[mn]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Binary`))(Yn.prototype);var D=class extends T{constructor(){super(C.BinaryView)}toString(){return`BinaryView`}};hn=Symbol.toStringTag,D.ELEMENT_WIDTH=16,D.INLINE_CAPACITY=12,D.LENGTH_OFFSET=0,D.INLINE_OFFSET=4,D.BUFFER_INDEX_OFFSET=8,D.BUFFER_OFFSET_OFFSET=12,D[hn]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`BinaryView`))(D.prototype);var Xn=class extends T{constructor(){super(C.LargeBinary)}toString(){return`LargeBinary`}};gn=Symbol.toStringTag,Xn[gn]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeBinary`))(Xn.prototype);var Zn=class extends T{constructor(){super(C.Utf8)}toString(){return`Utf8`}};_n=Symbol.toStringTag,Zn[_n]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8`))(Zn.prototype);var Qn=class extends T{constructor(){super(C.Utf8View)}toString(){return`Utf8View`}};vn=Symbol.toStringTag,Qn.ELEMENT_WIDTH=D.ELEMENT_WIDTH,Qn.INLINE_CAPACITY=D.INLINE_CAPACITY,Qn[vn]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Utf8View`))(Qn.prototype);var $n=class extends T{constructor(){super(C.LargeUtf8)}toString(){return`LargeUtf8`}};yn=Symbol.toStringTag,$n[yn]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeUtf8`))($n.prototype);var er=class extends T{constructor(){super(C.Bool)}toString(){return`Bool`}};bn=Symbol.toStringTag,er[bn]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`Bool`))(er.prototype);var tr=class extends T{constructor(e,t,n=128){super(C.Decimal),this.scale=e,this.precision=t,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?`+`:``}${this.scale}]`}};xn=Symbol.toStringTag,tr[xn]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]=`Decimal`))(tr.prototype);var nr=class extends T{constructor(e){super(C.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${ot[this.unit]}>`}get ArrayType(){return this.unit===ot.DAY?Int32Array:BigInt64Array}};Sn=Symbol.toStringTag,nr[Sn]=(e=>(e.unit=null,e[Symbol.toStringTag]=`Date`))(nr.prototype);var rr=class extends T{constructor(e,t){super(C.Time),this.unit=e,this.bitWidth=t}toString(){return`Time${this.bitWidth}<${v[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Cn=Symbol.toStringTag,rr[Cn]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]=`Time`))(rr.prototype);var ir=class extends T{constructor(e,t){super(C.Timestamp),this.unit=e,this.timezone=t}toString(){return`Timestamp<${v[this.unit]}${this.timezone?`, ${this.timezone}`:``}>`}};wn=Symbol.toStringTag,ir[wn]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Timestamp`))(ir.prototype);var ar=class extends T{constructor(e){super(C.Interval),this.unit=e}toString(){return`Interval<${y[this.unit]}>`}};Tn=Symbol.toStringTag,ar[Tn]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]=`Interval`))(ar.prototype);var or=class extends T{constructor(e){super(C.Duration),this.unit=e}toString(){return`Duration<${v[this.unit]}>`}};En=Symbol.toStringTag,or[En]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]=`Duration`))(or.prototype);var sr=class extends T{constructor(e){super(C.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};Dn=Symbol.toStringTag,sr[Dn]=(e=>(e.children=null,e[Symbol.toStringTag]=`List`))(sr.prototype);var cr=class extends T{constructor(e){super(C.LargeList),this.children=[e]}toString(){return`LargeList<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};On=Symbol.toStringTag,cr[On]=(e=>(e.children=null,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]=`LargeList`))(cr.prototype);var O=class extends T{constructor(e){super(C.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};kn=Symbol.toStringTag,O[kn]=(e=>(e.children=null,e[Symbol.toStringTag]=`Struct`))(O.prototype);var lr=class extends T{constructor(e,t,n){super(C.Union),this.mode=e,this.children=n,this.typeIds=t=Int32Array.from(t),this.typeIdToChildIndex=t.reduce((e,t,n)=>(e[t]=n)&&e||e,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(` | `)}>`}};An=Symbol.toStringTag,lr[An]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]=`Union`))(lr.prototype);var ur=class extends T{constructor(e){super(C.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};jn=Symbol.toStringTag,ur[jn]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]=`FixedSizeBinary`))(ur.prototype);var dr=class extends T{constructor(e,t){super(C.FixedSizeList),this.listSize=e,this.children=[t]}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}>`}};Mn=Symbol.toStringTag,dr[Mn]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]=`FixedSizeList`))(dr.prototype);var fr=class extends T{constructor(e,t=!1){if(super(C.Map),this.children=[e],this.keysSorted=t,e&&(e.name=`entries`,e?.type?.children)){let t=(e?.type)?.children[0];t&&(t.name=`key`);let n=(e?.type)?.children[1];n&&(n.name=`value`)}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(`, `)}}>`}};Nn=Symbol.toStringTag,fr[Nn]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]=`Map_`))(fr.prototype);const pr=(e=>()=>++e)(-1);var mr=class extends T{constructor(e,t,n,r){super(C.Dictionary),this.indices=t,this.dictionary=e,this.isOrdered=r||!1,this.id=n==null?pr():w(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Pn=Symbol.toStringTag,mr[Pn]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]=`Dictionary`))(mr.prototype);function hr(e){let t=e;switch(e.typeId){case C.Decimal:return e.bitWidth/32;case C.Interval:return t.unit===y.MONTH_DAY_NANO?4:1+t.unit;case C.BinaryView:case C.Utf8View:return 16;case C.FixedSizeList:return t.listSize;case C.FixedSizeBinary:return t.byteWidth;default:return 1}}var k=class{visitMany(e,...t){return e.map((e,n)=>this.visit(e,...t.map(e=>e[n])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,t=!0){return gr(this,e,t)}getVisitFnByTypeId(e,t=!0){return _r(this,e,t)}visitNull(e,...t){return null}visitBool(e,...t){return null}visitInt(e,...t){return null}visitFloat(e,...t){return null}visitUtf8(e,...t){return null}visitLargeUtf8(e,...t){return null}visitUtf8View(e,...t){return null}visitBinary(e,...t){return null}visitLargeBinary(e,...t){return null}visitBinaryView(e,...t){return null}visitFixedSizeBinary(e,...t){return null}visitDate(e,...t){return null}visitTimestamp(e,...t){return null}visitTime(e,...t){return null}visitDecimal(e,...t){return null}visitList(e,...t){return null}visitLargeList(e,...t){return null}visitStruct(e,...t){return null}visitUnion(e,...t){return null}visitDictionary(e,...t){return null}visitInterval(e,...t){return null}visitDuration(e,...t){return null}visitFixedSizeList(e,...t){return null}visitMap(e,...t){return null}};function gr(e,t,n=!0){return typeof t==`number`?_r(e,t,n):typeof t==`string`&&t in C?_r(e,C[t],n):t&&t instanceof T?_r(e,vr(t),n):t?.type&&t.type instanceof T?_r(e,vr(t.type),n):_r(e,C.NONE,n)}function _r(e,t,n=!0){let r=null;switch(t){case C.Null:r=e.visitNull;break;case C.Bool:r=e.visitBool;break;case C.Int:r=e.visitInt;break;case C.Int8:r=e.visitInt8||e.visitInt;break;case C.Int16:r=e.visitInt16||e.visitInt;break;case C.Int32:r=e.visitInt32||e.visitInt;break;case C.Int64:r=e.visitInt64||e.visitInt;break;case C.Uint8:r=e.visitUint8||e.visitInt;break;case C.Uint16:r=e.visitUint16||e.visitInt;break;case C.Uint32:r=e.visitUint32||e.visitInt;break;case C.Uint64:r=e.visitUint64||e.visitInt;break;case C.Float:r=e.visitFloat;break;case C.Float16:r=e.visitFloat16||e.visitFloat;break;case C.Float32:r=e.visitFloat32||e.visitFloat;break;case C.Float64:r=e.visitFloat64||e.visitFloat;break;case C.Utf8:r=e.visitUtf8;break;case C.LargeUtf8:r=e.visitLargeUtf8;break;case C.Utf8View:r=e.visitUtf8View||e.visitUtf8;break;case C.Binary:r=e.visitBinary;break;case C.LargeBinary:r=e.visitLargeBinary;break;case C.BinaryView:r=e.visitBinaryView||e.visitBinary;break;case C.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case C.Date:r=e.visitDate;break;case C.DateDay:r=e.visitDateDay||e.visitDate;break;case C.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case C.Timestamp:r=e.visitTimestamp;break;case C.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case C.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case C.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case C.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case C.Time:r=e.visitTime;break;case C.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case C.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case C.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case C.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case C.Decimal:r=e.visitDecimal;break;case C.List:r=e.visitList;break;case C.LargeList:r=e.visitLargeList;break;case C.Struct:r=e.visitStruct;break;case C.Union:r=e.visitUnion;break;case C.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case C.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case C.Dictionary:r=e.visitDictionary;break;case C.Interval:r=e.visitInterval;break;case C.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case C.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case C.IntervalMonthDayNano:r=e.visitIntervalMonthDayNano||e.visitInterval;break;case C.Duration:r=e.visitDuration;break;case C.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case C.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case C.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case C.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case C.FixedSizeList:r=e.visitFixedSizeList;break;case C.Map:r=e.visitMap}if(typeof r==`function`)return r;if(!n)return()=>null;throw Error(`Unrecognized type '${C[t]}'`)}function vr(e){switch(e.typeId){case C.Null:return C.Null;case C.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?C.Int8:C.Uint8;case 16:return n?C.Int16:C.Uint16;case 32:return n?C.Int32:C.Uint32;case 64:return n?C.Int64:C.Uint64}return C.Int}case C.Float:switch(e.precision){case _.HALF:return C.Float16;case _.SINGLE:return C.Float32;case _.DOUBLE:return C.Float64}return C.Float;case C.Binary:return C.Binary;case C.LargeBinary:return C.LargeBinary;case C.BinaryView:return C.BinaryView;case C.Utf8:return C.Utf8;case C.LargeUtf8:return C.LargeUtf8;case C.Utf8View:return C.Utf8View;case C.Bool:return C.Bool;case C.Decimal:return C.Decimal;case C.Time:switch(e.unit){case v.SECOND:return C.TimeSecond;case v.MILLISECOND:return C.TimeMillisecond;case v.MICROSECOND:return C.TimeMicrosecond;case v.NANOSECOND:return C.TimeNanosecond}return C.Time;case C.Timestamp:switch(e.unit){case v.SECOND:return C.TimestampSecond;case v.MILLISECOND:return C.TimestampMillisecond;case v.MICROSECOND:return C.TimestampMicrosecond;case v.NANOSECOND:return C.TimestampNanosecond}return C.Timestamp;case C.Date:switch(e.unit){case ot.DAY:return C.DateDay;case ot.MILLISECOND:return C.DateMillisecond}return C.Date;case C.Interval:switch(e.unit){case y.DAY_TIME:return C.IntervalDayTime;case y.YEAR_MONTH:return C.IntervalYearMonth;case y.MONTH_DAY_NANO:return C.IntervalMonthDayNano}return C.Interval;case C.Duration:switch(e.unit){case v.SECOND:return C.DurationSecond;case v.MILLISECOND:return C.DurationMillisecond;case v.MICROSECOND:return C.DurationMicrosecond;case v.NANOSECOND:return C.DurationNanosecond}return C.Duration;case C.Map:return C.Map;case C.List:return C.List;case C.LargeList:return C.LargeList;case C.Struct:return C.Struct;case C.Union:switch(e.mode){case at.Dense:return C.DenseUnion;case at.Sparse:return C.SparseUnion}return C.Union;case C.FixedSizeBinary:return C.FixedSizeBinary;case C.FixedSizeList:return C.FixedSizeList;case C.Dictionary:return C.Dictionary}throw Error(`Unrecognized type '${C[e.typeId]}'`)}k.prototype.visitInt8=null,k.prototype.visitInt16=null,k.prototype.visitInt32=null,k.prototype.visitInt64=null,k.prototype.visitUint8=null,k.prototype.visitUint16=null,k.prototype.visitUint32=null,k.prototype.visitUint64=null,k.prototype.visitFloat16=null,k.prototype.visitFloat32=null,k.prototype.visitFloat64=null,k.prototype.visitDateDay=null,k.prototype.visitDateMillisecond=null,k.prototype.visitTimestampSecond=null,k.prototype.visitTimestampMillisecond=null,k.prototype.visitTimestampMicrosecond=null,k.prototype.visitTimestampNanosecond=null,k.prototype.visitTimeSecond=null,k.prototype.visitTimeMillisecond=null,k.prototype.visitTimeMicrosecond=null,k.prototype.visitTimeNanosecond=null,k.prototype.visitDenseUnion=null,k.prototype.visitSparseUnion=null,k.prototype.visitIntervalDayTime=null,k.prototype.visitIntervalYearMonth=null,k.prototype.visitIntervalMonthDayNano=null,k.prototype.visitDuration=null,k.prototype.visitDurationSecond=null,k.prototype.visitDurationMillisecond=null,k.prototype.visitDurationMicrosecond=null,k.prototype.visitDurationNanosecond=null;const yr=new Float64Array(1),br=new Uint32Array(yr.buffer);function xr(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=(-1)**((e&32768)>>15);switch(t){case 31:return r*(n?NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*2**(t-15)*(1+n)}function Sr(e){if(e!==e)return 32256;yr[0]=e;let t=(br[1]&2147483648)>>16&65535,n=br[1]&2146435072,r=0;return n>=1089470464?br[0]>0?n=31744:(n=(n&2080374784)>>16,r=(br[1]&1048575)>>10):n<=1056964608?(r=1048576+(br[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(br[1]&1048575)+512>>10),t|n|r&65535}var A=class extends k{};function j(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const Cr=(e,t,n)=>{e[t]=Math.floor(n/864e5)},wr=(e,t,n,r)=>{if(n+1<t.length){let i=w(t[n]),a=w(t[n+1]);e.set(r.subarray(0,a-i),i)}},Tr=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Er=({values:e},t,n)=>{e[t]=n},Dr=({values:e},t,n)=>{e[t]=n},Or=({values:e},t,n)=>{e[t]=Sr(n)},kr=(e,t,n)=>{switch(e.type.precision){case _.HALF:return Or(e,t,n);case _.SINGLE:case _.DOUBLE:return Dr(e,t,n)}},Ar=({values:e},t,n)=>{Cr(e,t,n.valueOf())},jr=({values:e},t,n)=>{e[t]=BigInt(n)},Mr=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},Nr=({values:e,valueOffsets:t},n,r)=>wr(e,t,n,r),Pr=e=>{let t=e.variadicBuffers;return(!Array.isArray(t)||Object.isFrozen(t))&&(t=Array.from(t),e.variadicBuffers=t),t},Fr=(e,t,n)=>{let r=e.values;if(!r)throw Error(`BinaryView data is missing view buffer`);let i=D.ELEMENT_WIDTH,a=t*i,o=a+i;if(a<0||o>r.length)throw RangeError(`BinaryView index ${t} out of bounds`);r.fill(0,a,o);let s=new DataView(r.buffer,r.byteOffset+a,i),c=n.length;if(s.setInt32(D.LENGTH_OFFSET,c,!0),c<=D.INLINE_CAPACITY){r.set(n,a+D.INLINE_OFFSET);return}let l=(n[0]??0)|(n[1]??0)<<8|(n[2]??0)<<16|(n[3]??0)<<24;s.setUint32(D.INLINE_OFFSET,l>>>0,!0);let u=Pr(e),ee=n.slice(),te=u.push(ee)-1;s.setInt32(D.BUFFER_INDEX_OFFSET,te,!0),s.setInt32(D.BUFFER_OFFSET_OFFSET,0,!0)},Ir=(e,t,n)=>{let r=n instanceof Uint8Array?n:new Uint8Array(n);Fr(e,t,r)},Lr=({values:e,valueOffsets:t},n,r)=>wr(e,t,n,we(r)),Rr=(e,t,n)=>{let r=we(n);Fr(e,t,r)},zr=(e,t,n)=>{e.type.unit===ot.DAY?Ar(e,t,n):jr(e,t,n)},Br=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},Vr=({values:e},t,n)=>{e[t]=BigInt(n)},Hr=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},Ur=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},Wr=(e,t,n)=>{switch(e.type.unit){case v.SECOND:return Br(e,t,n);case v.MILLISECOND:return Vr(e,t,n);case v.MICROSECOND:return Hr(e,t,n);case v.NANOSECOND:return Ur(e,t,n)}},Gr=({values:e},t,n)=>{e[t]=n},Kr=({values:e},t,n)=>{e[t]=n},qr=({values:e},t,n)=>{e[t]=n},Jr=({values:e},t,n)=>{e[t]=n},Yr=(e,t,n)=>{switch(e.type.unit){case v.SECOND:return Gr(e,t,n);case v.MILLISECOND:return Kr(e,t,n);case v.MICROSECOND:return qr(e,t,n);case v.NANOSECOND:return Jr(e,t,n)}},Xr=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},Zr=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,a=vi.getVisitFn(r),o=w(i[t]),s=w(i[t+1]);if(Array.isArray(n))for(let e=-1,t=o;t<s;)a(r,t++,n[++e]);else for(let e=-1,t=o;t<s;)a(r,t++,n.get(++e))},Qr=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,a=vi.getVisitFn(r),{[t]:o,[t+1]:s}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let e of c)if(a(r,o,e),++o>=s)break},$r=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[a]),ei=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(a)),ti=(e,t)=>(n,r,i,a)=>r&&n(r,e,t.get(i.name)),ni=(e,t)=>(n,r,i,a)=>r&&n(r,e,t[i.name]),ri=(e,t,n)=>{let r=e.type.children.map(e=>vi.getVisitFn(e.type)),i=n instanceof Map?ti(t,n):n instanceof V?ei(t,n):Array.isArray(n)?$r(t,n):ni(t,n);e.type.children.forEach((t,n)=>i(r[n],e.children[n],t,n))},ii=(e,t,n)=>{e.type.mode===at.Dense?ai(e,t,n):oi(e,t,n)},ai=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];vi.visit(i,e.valueOffsets[t],n)},oi=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];vi.visit(i,t,n)},si=(e,t,n)=>{var r;(r=e.dictionary)==null||r.set(e.values[t],n)},ci=(e,t,n)=>{switch(e.type.unit){case y.YEAR_MONTH:return ui(e,t,n);case y.DAY_TIME:return li(e,t,n);case y.MONTH_DAY_NANO:return di(e,t,n)}},li=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},ui=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},di=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},fi=({values:e},t,n)=>{e[t]=n},pi=({values:e},t,n)=>{e[t]=n},mi=({values:e},t,n)=>{e[t]=n},hi=({values:e},t,n)=>{e[t]=n},gi=(e,t,n)=>{switch(e.type.unit){case v.SECOND:return fi(e,t,n);case v.MILLISECOND:return pi(e,t,n);case v.MICROSECOND:return mi(e,t,n);case v.NANOSECOND:return hi(e,t,n)}},_i=(e,t,n)=>{let{stride:r}=e,i=e.children[0],a=vi.getVisitFn(i);if(Array.isArray(n))for(let e=-1,o=t*r;++e<r;)a(i,o+e,n[e]);else for(let e=-1,o=t*r;++e<r;)a(i,o+e,n.get(e))};A.prototype.visitBool=j(Tr),A.prototype.visitInt=j(Er),A.prototype.visitInt8=j(Er),A.prototype.visitInt16=j(Er),A.prototype.visitInt32=j(Er),A.prototype.visitInt64=j(Er),A.prototype.visitUint8=j(Er),A.prototype.visitUint16=j(Er),A.prototype.visitUint32=j(Er),A.prototype.visitUint64=j(Er),A.prototype.visitFloat=j(kr),A.prototype.visitFloat16=j(Or),A.prototype.visitFloat32=j(Dr),A.prototype.visitFloat64=j(Dr),A.prototype.visitUtf8=j(Lr),A.prototype.visitLargeUtf8=j(Lr),A.prototype.visitUtf8View=j(Rr),A.prototype.visitBinary=j(Nr),A.prototype.visitLargeBinary=j(Nr),A.prototype.visitBinaryView=j(Ir),A.prototype.visitFixedSizeBinary=j(Mr),A.prototype.visitDate=j(zr),A.prototype.visitDateDay=j(Ar),A.prototype.visitDateMillisecond=j(jr),A.prototype.visitTimestamp=j(Wr),A.prototype.visitTimestampSecond=j(Br),A.prototype.visitTimestampMillisecond=j(Vr),A.prototype.visitTimestampMicrosecond=j(Hr),A.prototype.visitTimestampNanosecond=j(Ur),A.prototype.visitTime=j(Yr),A.prototype.visitTimeSecond=j(Gr),A.prototype.visitTimeMillisecond=j(Kr),A.prototype.visitTimeMicrosecond=j(qr),A.prototype.visitTimeNanosecond=j(Jr),A.prototype.visitDecimal=j(Xr),A.prototype.visitList=j(Zr),A.prototype.visitLargeList=j(Zr),A.prototype.visitStruct=j(ri),A.prototype.visitUnion=j(ii),A.prototype.visitDenseUnion=j(ai),A.prototype.visitSparseUnion=j(oi),A.prototype.visitDictionary=j(si),A.prototype.visitInterval=j(ci),A.prototype.visitIntervalDayTime=j(li),A.prototype.visitIntervalYearMonth=j(ui),A.prototype.visitIntervalMonthDayNano=j(di),A.prototype.visitDuration=j(gi),A.prototype.visitDurationSecond=j(fi),A.prototype.visitDurationMillisecond=j(pi),A.prototype.visitDurationMicrosecond=j(mi),A.prototype.visitDurationNanosecond=j(hi),A.prototype.visitFixedSizeList=j(_i),A.prototype.visitMap=j(Qr);const vi=new A,yi=Symbol.for(`parent`),bi=Symbol.for(`rowIndex`);var xi=class{constructor(e,t){return this[yi]=e,this[bi]=t,new Proxy(this,Ci)}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[bi],t=this[yi],n=t.type.children,r={};for(let i=-1,a=n.length;++i<a;)r[n[i].name]=P.visit(t.children[i],e);return r}toString(){return`{${[...this].map(([e,t])=>`${Xt(e)}: ${Xt(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}[Symbol.iterator](){return new Si(this[yi],this[bi])}},Si=class{constructor(e,t){this.childIndex=0,this.children=e.children,this.rowIndex=t,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let e=this.childIndex;return e<this.numChildren?(this.childIndex=e+1,{done:!1,value:[this.childFields[e].name,P.visit(this.children[e],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(xi.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[yi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[bi]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});const Ci=new class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[yi].type.children.map(e=>e.name)}has(e,t){return e[yi].type.children.some(e=>e.name===t)}getOwnPropertyDescriptor(e,t){if(e[yi].type.children.some(e=>e.name===t))return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[yi].type.children.findIndex(e=>e.name===t);if(n!==-1){let r=P.visit(e[yi].children[n],e[bi]);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[yi].type.children.findIndex(e=>e.name===t);return r===-1?Reflect.has(e,t)||typeof t==`symbol`?Reflect.set(e,t,n):!1:(vi.visit(e[yi].children[r],e[bi],n),Reflect.set(e,t,n))}};var M=class extends k{};function N(e){return(t,n)=>t.getValid(n)?e(t,n):null}const wi=(e,t)=>864e5*e[t],Ti=(e,t)=>null,Ei=(e,t,n)=>{if(n+1>=t.length)return null;let r=w(t[n]),i=w(t[n+1]);return e.subarray(r,i)},Di=({offset:e,values:t},n)=>{let r=e+n;return!!(t[r>>3]&1<<r%8)},Oi=({values:e},t)=>wi(e,t),ki=({values:e},t)=>w(e[t]),Ai=({stride:e,values:t},n)=>t[e*n],ji=({stride:e,values:t},n)=>xr(t[e*n]),Mi=({values:e},t)=>e[t],Ni=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),Pi=({values:e,valueOffsets:t},n)=>Ei(e,t,n),Fi=(e,t)=>{let n=e.values;if(!n)throw Error(`BinaryView data is missing view buffer`);let r=t*16,i=r+16;if(r<0||i>n.length)throw Error(`BinaryView data buffer is too short: expected 16 bytes, got ${Math.max(0,n.length-r)}`);let a=n.subarray(r,i);if(a.length<16)throw Error(`BinaryView data buffer is too short: expected 16 bytes, got ${a.length}`);let o=new DataView(n.buffer,a.byteOffset,16),s=o.getInt32(0,!0);if(s<=0)return new Uint8Array;if(s<=12)return a.subarray(4,4+s);let c=o.getInt32(8,!0),l=o.getInt32(12,!0),u=e.variadicBuffers?.[c];if(!u)throw Error(`BinaryView variadic buffer ${c} is missing`);return u.subarray(l,l+s)},Ii=(e,t)=>Fi(e,t),Li=({values:e,valueOffsets:t},n)=>{let r=Ei(e,t,n);return r===null?null:Se(r)},Ri=(e,t)=>{let n=Fi(e,t);return Se(n)},zi=({values:e},t)=>e[t],Bi=({type:e,values:t},n)=>e.precision===_.HALF?xr(t[n]):t[n],Vi=(e,t)=>e.type.unit===ot.DAY?Oi(e,t):ki(e,t),Hi=({values:e},t)=>1e3*w(e[t]),Ui=({values:e},t)=>w(e[t]),Wi=({values:e},t)=>Zt(e[t],BigInt(1e3)),Gi=({values:e},t)=>Zt(e[t],BigInt(1e6)),Ki=(e,t)=>{switch(e.type.unit){case v.SECOND:return Hi(e,t);case v.MILLISECOND:return Ui(e,t);case v.MICROSECOND:return Wi(e,t);case v.NANOSECOND:return Gi(e,t)}},qi=({values:e},t)=>e[t],Ji=({values:e},t)=>e[t],Yi=({values:e},t)=>e[t],Xi=({values:e},t)=>e[t],Zi=(e,t)=>{switch(e.type.unit){case v.SECOND:return qi(e,t);case v.MILLISECOND:return Ji(e,t);case v.MICROSECOND:return Yi(e,t);case v.NANOSECOND:return Xi(e,t)}},Qi=({values:e,stride:t},n)=>ln.decimal(e.subarray(t*n,t*(n+1))),$i=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,a=w(n[t*r]),o=w(n[t*r+1]);return new V([i[0].slice(a,o-a)])},ea=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:a}=n,o=r[0];return new ba(o.slice(i,a-i))},ta=(e,t)=>new xi(e,t),na=(e,t)=>e.type.mode===at.Dense?ra(e,t):ia(e,t),ra=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return P.visit(r,e.valueOffsets[t])},ia=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return P.visit(r,t)},aa=(e,t)=>e.dictionary?.get(e.values[t]),oa=(e,t)=>e.type.unit===y.MONTH_DAY_NANO?la(e,t):e.type.unit===y.DAY_TIME?sa(e,t):ca(e,t),sa=({values:e},t)=>e.subarray(2*t,2*(t+1)),ca=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},la=({values:e},t)=>e.subarray(4*t,4*(t+1)),ua=({values:e},t)=>e[t],da=({values:e},t)=>e[t],fa=({values:e},t)=>e[t],pa=({values:e},t)=>e[t],ma=(e,t)=>{switch(e.type.unit){case v.SECOND:return ua(e,t);case v.MILLISECOND:return da(e,t);case v.MICROSECOND:return fa(e,t);case v.NANOSECOND:return pa(e,t)}},ha=(e,t)=>{let{stride:n,children:r}=e;return new V([r[0].slice(t*n,n)])};M.prototype.visitNull=N(Ti),M.prototype.visitBool=N(Di),M.prototype.visitInt=N(zi),M.prototype.visitInt8=N(Ai),M.prototype.visitInt16=N(Ai),M.prototype.visitInt32=N(Ai),M.prototype.visitInt64=N(Mi),M.prototype.visitUint8=N(Ai),M.prototype.visitUint16=N(Ai),M.prototype.visitUint32=N(Ai),M.prototype.visitUint64=N(Mi),M.prototype.visitFloat=N(Bi),M.prototype.visitFloat16=N(ji),M.prototype.visitFloat32=N(Ai),M.prototype.visitFloat64=N(Ai),M.prototype.visitUtf8=N(Li),M.prototype.visitLargeUtf8=N(Li),M.prototype.visitUtf8View=N(Ri),M.prototype.visitBinary=N(Pi),M.prototype.visitLargeBinary=N(Pi),M.prototype.visitBinaryView=N(Ii),M.prototype.visitFixedSizeBinary=N(Ni),M.prototype.visitDate=N(Vi),M.prototype.visitDateDay=N(Oi),M.prototype.visitDateMillisecond=N(ki),M.prototype.visitTimestamp=N(Ki),M.prototype.visitTimestampSecond=N(Hi),M.prototype.visitTimestampMillisecond=N(Ui),M.prototype.visitTimestampMicrosecond=N(Wi),M.prototype.visitTimestampNanosecond=N(Gi),M.prototype.visitTime=N(Zi),M.prototype.visitTimeSecond=N(qi),M.prototype.visitTimeMillisecond=N(Ji),M.prototype.visitTimeMicrosecond=N(Yi),M.prototype.visitTimeNanosecond=N(Xi),M.prototype.visitDecimal=N(Qi),M.prototype.visitList=N($i),M.prototype.visitLargeList=N($i),M.prototype.visitStruct=N(ta),M.prototype.visitUnion=N(na),M.prototype.visitDenseUnion=N(ra),M.prototype.visitSparseUnion=N(ia),M.prototype.visitDictionary=N(aa),M.prototype.visitInterval=N(oa),M.prototype.visitIntervalDayTime=N(sa),M.prototype.visitIntervalYearMonth=N(ca),M.prototype.visitIntervalMonthDayNano=N(la),M.prototype.visitDuration=N(ma),M.prototype.visitDurationSecond=N(ua),M.prototype.visitDurationMillisecond=N(da),M.prototype.visitDurationMicrosecond=N(fa),M.prototype.visitDurationNanosecond=N(pa),M.prototype.visitFixedSizeList=N(ha),M.prototype.visitMap=N(ea);const P=new M,ga=Symbol.for(`keys`),_a=Symbol.for(`vals`),va=Symbol.for(`kKeysAsStrings`),ya=Symbol.for(`_kKeysAsStrings`);var ba=class{constructor(e){return this[ga]=new V([e.children[0]]).memoize(),this[_a]=e.children[1],new Proxy(this,new Sa)}get[va](){return this[ya]||(this[ya]=Array.from(this[ga].toArray(),String))}[Symbol.iterator](){return new xa(this[ga],this[_a])}get size(){return this[ga].length}toArray(){return Object.values(this.toJSON())}toJSON(){let e=this[ga],t=this[_a],n={};for(let r=-1,i=e.length;++r<i;)n[e.get(r)]=P.visit(t,r);return n}toString(){return`{${[...this].map(([e,t])=>`${Xt(e)}: ${Xt(t)}`).join(`, `)}}`}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.toString()}},xa=class{constructor(e,t){this.keys=e,this.vals=t,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){let e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),P.visit(this.vals,e)]})}},Sa=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[va]}has(e,t){return e[va].includes(t)}getOwnPropertyDescriptor(e,t){if(e[va].indexOf(t)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,t){if(Reflect.has(e,t))return e[t];let n=e[va].indexOf(t);if(n!==-1){let r=P.visit(Reflect.get(e,_a),n);return Reflect.set(e,t,r),r}}set(e,t,n){let r=e[va].indexOf(t);return r===-1?Reflect.has(e,t)?Reflect.set(e,t,n):!1:(vi.visit(Reflect.get(e,_a),r,n),Reflect.set(e,t,n))}};Object.defineProperties(ba.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:`Row`},[ga]:{writable:!0,enumerable:!1,configurable:!1,value:null},[_a]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ya]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Ca;function wa(e,t,n,r){let{length:i=0}=e,a=typeof t==`number`?t:0,o=typeof n==`number`?n:i;return a<0&&(a=(a%i+i)%i),o<0&&(o=(o%i+i)%i),o<a&&(Ca=a,a=o,o=Ca),o>i&&(o=i),r?r(e,a,o):[a,o]}const Ta=(e,t)=>e<0?t+e:e,Ea=e=>e!==e;function Da(e){if(typeof e!=`object`||!e)return Ea(e)?Ea:t=>t===e;if(e instanceof Date){let t=e.valueOf();return e=>e instanceof Date&&e.valueOf()===t}return ArrayBuffer.isView(e)?t=>t?Xe(e,t):!1:e instanceof Map?ka(e):Array.isArray(e)?Oa(e):e instanceof V?Aa(e):ja(e,!0)}function Oa(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Da(e[n]);return Ma(t)}function ka(e){let t=-1,n=[];for(let r of e.values())n[++t]=Da(r);return Ma(n)}function Aa(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=Da(e.get(n));return Ma(t)}function ja(e,t=!1){let n=Object.keys(e);if(!t&&n.length===0)return()=>!1;let r=[];for(let t=-1,i=n.length;++t<i;)r[t]=Da(e[n[t]]);return Ma(r,n)}function Ma(e,t){return n=>{if(!n||typeof n!=`object`)return!1;switch(n.constructor){case Array:return Na(e,n);case Map:return Fa(e,n,n.keys());case ba:case xi:case Object:case void 0:return Fa(e,n,t||Object.keys(n))}return n instanceof V&&Pa(e,n)}}function Na(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function Pa(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function Fa(e,t,n){let r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),a=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,s=e.length,c=a.next(),l=r.next(),u=i.next();for(;o<s&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[o](c.value));++o,l=r.next(),u=i.next(),c=a.next());return o===s&&l.done&&u.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),a.return&&a.return(),!1)}function Ia(e,t,n,r){return!!(n&1<<r)}function La(e,t,n,r){return(n&1<<r)>>r}function Ra(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8==0?n.subarray(e>>3):za(new Ba(n,e,t,null,Ia)).subarray(0,r)),i}return n}function za(e){let t=[],n=0,r=0,i=0;for(let a of e)a&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let a=new Uint8Array(t.length+7&-8);return a.set(t),a}var Ba=class{constructor(e,t,n,r,i){this.bytes=e,this.length=n,this.context=r,this.get=i,this.bit=t%8,this.byteIndex=t>>3,this.byte=e[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 Va(e,t,n){if(n-t<=0)return 0;if(n-t<8){let r=0;for(let i of new Ba(e,t,n-t,e,La))r+=i;return r}let r=n>>3<<3,i=t+(t%8==0?0:8-t%8);return Va(e,t,i)+Va(e,r,n)+Ha(e,i>>3,r-i>>3)}function Ha(e,t,n){let r=0,i=Math.trunc(t),a=new DataView(e.buffer,e.byteOffset,e.byteLength),o=n===void 0?e.byteLength:i+n;for(;o-i>=4;)r+=Ua(a.getUint32(i)),i+=4;for(;o-i>=2;)r+=Ua(a.getUint16(i)),i+=2;for(;o-i>=1;)r+=Ua(a.getUint8(i)),i+=1;return r}function Ua(e){let t=Math.trunc(e);return t-=t>>>1&1431655765,t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const Wa=Symbol.for(`apache-arrow/Data`);var F=class e{static isData(e){return e?.[Wa]===!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 nullable(){if(this._nullCount!==0){let{type:e}=this;return T.isSparseUnion(e)||T.isDenseUnion(e)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0,{valueOffsets:t,values:n,nullBitmap:r,typeIds:i}=this;return t&&(e+=t.byteLength),n&&(e+=n.byteLength),r&&(e+=r.byteLength),i&&(e+=i.byteLength),e+=this.variadicBuffers.reduce((e,t)=>e+(t?.byteLength??0),0),this.children.reduce((e,t)=>e+t.byteLength,e)}get nullCount(){if(T.isUnion(this.type))return this.children.reduce((e,t)=>e+t.nullCount,0);let e=this._nullCount,t;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=t.length===0?0:this.length-Va(t,this.offset,this.offset+this.length)),e}constructor(t,n,r,i,a,o=[],s,c=[]){this.type=t,this.children=o,this.dictionary=s,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;a instanceof e?(this.stride=a.stride,this.values=a.values,this.typeIds=a.typeIds,this.nullBitmap=a.nullBitmap,this.valueOffsets=a.valueOffsets,this.variadicBuffers=a.variadicBuffers):(this.stride=hr(t),a&&((l=a[0])&&(this.valueOffsets=l),(l=a[1])&&(this.values=l),(l=a[2])&&(this.nullBitmap=l),(l=a[3])&&(this.typeIds=l)),this.variadicBuffers=c),this.variadicBuffers??=[]}getValid(e){let{type:t}=this;if(T.isUnion(t)){let n=t,r=this.typeIds[e],i=n.typeIdToChildIndex[r],a=this.children[i],o=this.valueOffsets,s=n.mode===at.Dense&&o?Number(o[e]):e;return a.getValid(s)}if(this.nullable&&this.nullCount>0){let t=this.offset+e;return!!(this.nullBitmap[t>>3]&1<<t%8)}return!0}setValid(e,t){let n,{type:r}=this;if(T.isUnion(r)){let i=r,a=this.typeIds[e],o=i.typeIdToChildIndex[a],s=this.children[o],c=this.valueOffsets,l=i.mode===at.Dense&&c?Number(c[e]):e;n=s.getValid(l),s.setValid(l,t)}else{let{nullBitmap:r}=this,{offset:i,length:a}=this,o=i+e,s=1<<o%8,c=o>>3;(!r||r.byteLength<=c)&&(r=new Uint8Array((i+a+63&-64)>>3).fill(255),this.nullCount>0?(r.set(Ra(i,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));let l=r[c];n=(l&s)!==0,r[c]=t?l|s:l&~s}return n!==!!t&&(this._nullCount=this.nullCount+(t?-1:1)),t}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,a=this,o=this.children,s=this.variadicBuffers){return new e(t,n,r,i,a,o,this.dictionary,s)}slice(e,t){let{stride:n,typeId:r,children:i}=this,a=(this._nullCount===0)-1,o=r===16?n:1,s=this._sliceBuffers(e,t,n,r);return this.clone(this.type,this.offset+e,t,a,s,i.length===0||this.valueOffsets?i:this._sliceChildren(i,o*e,o*t),this.variadicBuffers)}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===C.Null)return this.clone(this.type,0,e,0,this.buffers,this.children,this.variadicBuffers);let{length:t,nullCount:n}=this,r=new Uint8Array((e+63&-64)>>3).fill(255,0,t>>3);r[t>>3]=(1<<t-(t&-8))-1,n>0&&r.set(Ra(this.offset,t,this.nullBitmap),0);let i=this.buffers;return i[Yt.VALIDITY]=r,this.clone(this.type,0,e,n+(e-t),i,this.children,this.variadicBuffers)}_sliceBuffers(e,t,n,r){let i,{buffers:a}=this;if((i=a[Yt.TYPE])&&(a[Yt.TYPE]=i.subarray(e,e+t)),T.isBinaryView(this.type)||T.isUtf8View(this.type)){let n=D.ELEMENT_WIDTH;(i=a[Yt.DATA])&&(a[Yt.DATA]=i.subarray(e*n,(e+t)*n))}else(i=a[Yt.OFFSET])&&(a[Yt.OFFSET]=i.subarray(e,e+t+1))||(i=a[Yt.DATA])&&(a[Yt.DATA]=r===6?i:i.subarray(n*e,n*(e+t)));return a}_sliceChildren(e,t,n){return e.map(e=>e.slice(t,n))}};F.prototype.children=Object.freeze([]),F.prototype[Wa]=!0,Object.defineProperty(F,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===F&&F.isData(e)}});const Ga=new class e extends k{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){let{type:t,offset:n=0,length:r=0}=e;return new F(t,n,r,r)}visitBool(e){let{type:t,offset:n=0}=e,r=h(e.nullBitmap),i=m(t.ArrayType,e.data),{length:a=i.length>>3,nullCount:o=e.nullBitmap?-1:0}=e;return new F(t,n,a,o,[void 0,i,r])}visitInt(e){let{type:t,offset:n=0}=e,r=h(e.nullBitmap),i=m(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new F(t,n,a,o,[void 0,i,r])}visitFloat(e){let{type:t,offset:n=0}=e,r=h(e.nullBitmap),i=m(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new F(t,n,a,o,[void 0,i,r])}visitUtf8(e){let{type:t,offset:n=0}=e,r=h(e.data),i=h(e.nullBitmap),a=Ue(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new F(t,n,o,s,[a,r,i])}visitUtf8View(e){let{type:t,offset:n=0}=e,r=m(t.ArrayType,e.views),i=h(e.nullBitmap),a=(e.variadicBuffers||[]).map(e=>h(e));return new F(t,n,e.length??Math.trunc(r.length/Qn.ELEMENT_WIDTH),e.nullBitmap?-1:0,[void 0,r,i],[],void 0,a)}visitLargeUtf8(e){let{type:t,offset:n=0}=e,r=h(e.data),i=h(e.nullBitmap),a=We(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new F(t,n,o,s,[a,r,i])}visitBinary(e){let{type:t,offset:n=0}=e,r=h(e.data),i=h(e.nullBitmap),a=Ue(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new F(t,n,o,s,[a,r,i])}visitBinaryView(e){let{type:t,offset:n=0}=e,r=m(t.ArrayType,e.views),i=h(e.nullBitmap),a=(e.variadicBuffers||[]).map(e=>h(e));return new F(t,n,e.length??Math.trunc(r.length/D.ELEMENT_WIDTH),e.nullBitmap?-1:0,[void 0,r,i],[],void 0,a)}visitLargeBinary(e){let{type:t,offset:n=0}=e,r=h(e.data),i=h(e.nullBitmap),a=We(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new F(t,n,o,s,[a,r,i])}visitFixedSizeBinary(e){let{type:t,offset:n=0}=e,r=h(e.nullBitmap),i=m(t.ArrayType,e.data),{length:a=i.length/hr(t),nullCount:o=e.nullBitmap?-1:0}=e;return new F(t,n,a,o,[void 0,i,r])}visitDate(e){let{type:t,offset:n=0}=e,r=h(e.nullBitmap),i=m(t.ArrayType,e.data),{length:a=i.length/hr(t),nullCount:o=e.nullBitmap?-1:0}=e;return new F(t,n,a,o,[void 0,i,r])}visitTimestamp(e){let{type:t,offset:n=0}=e,r=h(e.nullBitmap),i=m(t.ArrayType,e.data),{length:a=i.length/hr(t),nullCount:o=e.nullBitmap?-1:0}=e;return new F(t,n,a,o,[void 0,i,r])}visitTime(e){let{type:t,offset:n=0}=e,r=h(e.nullBitmap),i=m(t.ArrayType,e.data),{length:a=i.length/hr(t),nullCount:o=e.nullBitmap?-1:0}=e;return new F(t,n,a,o,[void 0,i,r])}visitDecimal(e){let{type:t,offset:n=0}=e,r=h(e.nullBitmap),i=m(t.ArrayType,e.data),{length:a=i.length/hr(t),nullCount:o=e.nullBitmap?-1:0}=e;return new F(t,n,a,o,[void 0,i,r])}visitList(e){let{type:t,offset:n=0,child:r}=e,i=h(e.nullBitmap),a=Ue(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new F(t,n,o,s,[a,void 0,i],[r])}visitLargeList(e){let{type:t,offset:n=0,child:r}=e,i=h(e.nullBitmap),a=We(e.valueOffsets),{length:o=a.length-1,nullCount:s=e.nullBitmap?-1:0}=e;return new F(t,n,o,s,[a,void 0,i],[r])}visitStruct(e){let{type:t,offset:n=0,children:r=[]}=e,i=h(e.nullBitmap),{length:a=r.reduce((e,{length:t})=>Math.max(e,t),0),nullCount:o=e.nullBitmap?-1:0}=e;return new F(t,n,a,o,[void 0,void 0,i],r)}visitUnion(e){let{type:t,offset:n=0,children:r=[]}=e,i=m(t.ArrayType,e.typeIds),{length:a=i.length,nullCount:o=-1}=e;return T.isSparseUnion(t)?new F(t,n,a,o,[void 0,void 0,void 0,i],r):new F(t,n,a,o,[Ue(e.valueOffsets),void 0,void 0,i],r)}visitDictionary(t){let{type:n,offset:r=0}=t,i=h(t.nullBitmap),a=m(n.indices.ArrayType,t.data),{dictionary:o=new V([new e().visit({type:n.dictionary})])}=t,{length:s=a.length,nullCount:c=t.nullBitmap?-1:0}=t;return new F(n,r,s,c,[void 0,a,i],[],o)}visitInterval(e){let{type:t,offset:n=0}=e,r=h(e.nullBitmap),i=m(t.ArrayType,e.data),{length:a=i.length/hr(t),nullCount:o=e.nullBitmap?-1:0}=e;return new F(t,n,a,o,[void 0,i,r])}visitDuration(e){let{type:t,offset:n=0}=e,r=h(e.nullBitmap),i=m(t.ArrayType,e.data),{length:a=i.length,nullCount:o=e.nullBitmap?-1:0}=e;return new F(t,n,a,o,[void 0,i,r])}visitFixedSizeList(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.valueType})}=t,a=h(t.nullBitmap),{length:o=i.length/hr(n),nullCount:s=t.nullBitmap?-1:0}=t;return new F(n,r,o,s,[void 0,void 0,a],[i])}visitMap(t){let{type:n,offset:r=0,child:i=new e().visit({type:n.childType})}=t,a=h(t.nullBitmap),o=Ue(t.valueOffsets),{length:s=o.length-1,nullCount:c=t.nullBitmap?-1:0}=t;return new F(n,r,s,c,[o,void 0,a],[i])}};function I(e){return Ga.visit(e)}var Ka=class{constructor(e=0,t){this.numChunks=e,this.getChunkIterator=t,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let e=this.chunkIterator.next();if(!e.done)return e;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function qa(e){return e.some(e=>e.nullable)}function Ja(e){return e.reduce((e,t)=>e+t.nullCount,0)}function Ya(e){return e.reduce((e,t,n)=>(e[n+1]=e[n]+t.length,e),new Uint32Array(e.length+1))}function Xa(e,t,n,r){let i=[];for(let a=-1,o=e.length;++a<o;){let o=e[a],s=t[a],{length:c}=o;if(s>=r)break;if(n>=s+c)continue;if(s>=n&&s+c<=r){i.push(o);continue}let l=Math.max(0,n-s),u=Math.min(r-s,c);i.push(o.slice(l,u-l))}return i.length===0&&i.push(e[0].slice(0,0)),i}function Za(e,t,n,r){let i=0,a=0,o=t.length-1;do{if(i>=o-1)return n<t[o]?r(e,i,n-t[i]):null;a=i+Math.trunc((o-i)*.5),n<t[a]?o=a:i=a}while(i<o)}function Qa(e,t){return e.getValid(t)}function $a(e){function t(t,n,r){return e(t[n],r)}return function(e){let n=this.data;return Za(n,this._offsets,e,t)}}function eo(e){let t;function n(n,r,i){return e(n[r],i,t)}return function(e,r){let i=this.data;t=r;let a=Za(i,this._offsets,e,n);return t=void 0,a}}function to(e){let t;function n(n,r,i){let a=i,o=0,s=0;for(let i=r-1,c=n.length;++i<c;){let r=n[i];if(~(o=e(r,t,a)))return s+o;a=0,s+=r.length}return-1}return function(e,r){t=e;let i=this.data,a=typeof r==`number`?Za(i,this._offsets,r,n):n(i,0,0);return t=void 0,a}}var L=class extends k{};function no(e,t){return t===null&&e.length>0?0:-1}function ro(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new Ba(n,e.offset+(t||0),e.length,n,Ia)){if(!i)return r;++r}return-1}function R(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case C.Union:break;case C.Dictionary:break;default:return ro(e,n)}let r=P.getVisitFn(e),i=Da(t);for(let t=(n||0)-1,a=e.length;++t<a;)if(i(r(e,t)))return t;return-1}function io(e,t,n){let r=P.getVisitFn(e),i=Da(t);for(let t=(n||0)-1,a=e.length;++t<a;)if(i(r(e,t)))return t;return-1}L.prototype.visitNull=no,L.prototype.visitBool=R,L.prototype.visitInt=R,L.prototype.visitInt8=R,L.prototype.visitInt16=R,L.prototype.visitInt32=R,L.prototype.visitInt64=R,L.prototype.visitUint8=R,L.prototype.visitUint16=R,L.prototype.visitUint32=R,L.prototype.visitUint64=R,L.prototype.visitFloat=R,L.prototype.visitFloat16=R,L.prototype.visitFloat32=R,L.prototype.visitFloat64=R,L.prototype.visitUtf8=R,L.prototype.visitLargeUtf8=R,L.prototype.visitUtf8View=R,L.prototype.visitBinary=R,L.prototype.visitLargeBinary=R,L.prototype.visitBinaryView=R,L.prototype.visitFixedSizeBinary=R,L.prototype.visitDate=R,L.prototype.visitDateDay=R,L.prototype.visitDateMillisecond=R,L.prototype.visitTimestamp=R,L.prototype.visitTimestampSecond=R,L.prototype.visitTimestampMillisecond=R,L.prototype.visitTimestampMicrosecond=R,L.prototype.visitTimestampNanosecond=R,L.prototype.visitTime=R,L.prototype.visitTimeSecond=R,L.prototype.visitTimeMillisecond=R,L.prototype.visitTimeMicrosecond=R,L.prototype.visitTimeNanosecond=R,L.prototype.visitDecimal=R,L.prototype.visitList=R,L.prototype.visitLargeList=R,L.prototype.visitStruct=R,L.prototype.visitUnion=R,L.prototype.visitDenseUnion=io,L.prototype.visitSparseUnion=io,L.prototype.visitDictionary=R,L.prototype.visitInterval=R,L.prototype.visitIntervalDayTime=R,L.prototype.visitIntervalYearMonth=R,L.prototype.visitIntervalMonthDayNano=R,L.prototype.visitDuration=R,L.prototype.visitDurationSecond=R,L.prototype.visitDurationMillisecond=R,L.prototype.visitDurationMicrosecond=R,L.prototype.visitDurationNanosecond=R,L.prototype.visitFixedSizeList=R,L.prototype.visitMap=R;const ao=new L;var z=class extends k{};function B(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(T.isInt(t)&&t.bitWidth!==64||T.isTime(t)&&t.bitWidth!==64||T.isFloat(t)&&t.precision!==_.HALF))return new Ka(e.data.length,t=>{let n=e.data[t];return n.values.subarray(0,n.length)[Symbol.iterator]()});let n=0;return new Ka(e.data.length,t=>{let r=e.data[t].length,i=e.slice(n,n+r);return n+=r,new oo(i)})}var oo=class{constructor(e){this.vector=e,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};z.prototype.visitNull=B,z.prototype.visitBool=B,z.prototype.visitInt=B,z.prototype.visitInt8=B,z.prototype.visitInt16=B,z.prototype.visitInt32=B,z.prototype.visitInt64=B,z.prototype.visitUint8=B,z.prototype.visitUint16=B,z.prototype.visitUint32=B,z.prototype.visitUint64=B,z.prototype.visitFloat=B,z.prototype.visitFloat16=B,z.prototype.visitFloat32=B,z.prototype.visitFloat64=B,z.prototype.visitUtf8=B,z.prototype.visitLargeUtf8=B,z.prototype.visitUtf8View=B,z.prototype.visitBinary=B,z.prototype.visitLargeBinary=B,z.prototype.visitBinaryView=B,z.prototype.visitFixedSizeBinary=B,z.prototype.visitDate=B,z.prototype.visitDateDay=B,z.prototype.visitDateMillisecond=B,z.prototype.visitTimestamp=B,z.prototype.visitTimestampSecond=B,z.prototype.visitTimestampMillisecond=B,z.prototype.visitTimestampMicrosecond=B,z.prototype.visitTimestampNanosecond=B,z.prototype.visitTime=B,z.prototype.visitTimeSecond=B,z.prototype.visitTimeMillisecond=B,z.prototype.visitTimeMicrosecond=B,z.prototype.visitTimeNanosecond=B,z.prototype.visitDecimal=B,z.prototype.visitList=B,z.prototype.visitLargeList=B,z.prototype.visitStruct=B,z.prototype.visitUnion=B,z.prototype.visitDenseUnion=B,z.prototype.visitSparseUnion=B,z.prototype.visitDictionary=B,z.prototype.visitInterval=B,z.prototype.visitIntervalDayTime=B,z.prototype.visitIntervalYearMonth=B,z.prototype.visitIntervalMonthDayNano=B,z.prototype.visitDuration=B,z.prototype.visitDurationSecond=B,z.prototype.visitDurationMillisecond=B,z.prototype.visitDurationMicrosecond=B,z.prototype.visitDurationNanosecond=B,z.prototype.visitFixedSizeList=B,z.prototype.visitMap=B;const so=new z;var co;const lo=Symbol.for(`apache-arrow/Vector`),uo={},fo={};var V=class e{static isVector(e){return e?.[lo]===!0}constructor(t){let n=t[0]instanceof e?t.flatMap(e=>e.data):t;if(n.length===0||n.some(e=>!(e instanceof F)))throw TypeError(`Vector constructor expects an Array of Data instances.`);let r=n[0]?.type;switch(n.length){case 0:this._offsets=[0];break;case 1:{let{get:e,set:t,indexOf:i}=uo[r.typeId],a=n[0];this.isValid=e=>Qa(a,e),this.get=t=>e(a,t),this.set=(e,n)=>t(a,e,n),this.indexOf=e=>i(a,e),this._offsets=[0,a.length];break}default:Object.setPrototypeOf(this,fo[r.typeId]),this._offsets=Ya(n)}this.data=n,this.type=r,this.stride=hr(r),this.numChildren=r.children?.length??0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,t)=>e+t.byteLength,0)}get nullable(){return qa(this.data)}get nullCount(){return Ja(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${C[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(Ta(e,this.length))}set(e,t){}indexOf(e,t){return-1}includes(e,t){return this.indexOf(e,t)>-1}[Symbol.iterator](){return so.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(e=>e.data).flat(1/0)))}slice(t,n){return new e(wa(this,t,n,({data:e,_offsets:t},n,r)=>Xa(e,t,n,r)))}toJSON(){return[...this]}toArray(){let{type:e,data:t,length:n,stride:r,ArrayType:i}=this;switch(e.typeId){case C.Int:case C.Float:case C.Decimal:case C.Time:case C.Timestamp:switch(t.length){case 0:return new i;case 1:return t[0].values.subarray(0,n*r);default:return t.reduce((e,{values:t,length:n})=>(e.array.set(t.subarray(0,n*r),e.offset),e.offset+=n*r,e),{array:new i(n*r),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(`,`)}]`}getChild(e){return this.getChildAt(this.type.children?.findIndex(t=>t.name===e))}getChildAt(t){return t>-1&&t<this.numChildren?new e(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 po(this.data[0].dictionary),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return new po(this)}unmemoize(){if(T.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(e=>{let n=e.clone();return n.dictionary=t,n});return new e(n)}return this}};co=Symbol.toStringTag,V[co]=(e=>{e.type=T.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0,e[lo]=!0;let t=Object.keys(C).map(e=>C[e]).filter(e=>typeof e==`number`&&e!==C.NONE);for(let n of t){let t=P.getVisitFnByTypeId(n),r=vi.getVisitFnByTypeId(n),i=ao.getVisitFnByTypeId(n);uo[n]={get:t,set:r,indexOf:i},fo[n]=Object.create(e,{isValid:{value:$a(Qa)},get:{value:$a(P.getVisitFnByTypeId(n))},set:{value:eo(vi.getVisitFnByTypeId(n))},indexOf:{value:to(ao.getVisitFnByTypeId(n))}})}return`Vector`})(V.prototype),Object.defineProperty(V,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===V&&V.isVector(e)}});var po=class e extends V{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,a=Array(this.length);Object.defineProperty(this,"get",{value(e){let t=a[e];if(t!==void 0)return t;let r=n.call(this,e);return a[e]=r,r}}),Object.defineProperty(this,"set",{value(e,t){r.call(this,e,t),a[e]=t}}),Object.defineProperty(this,"slice",{value:(t,n)=>new e(i.call(this,t,n))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new V(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}},mo=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,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(e,t,n,r){return e.prep(8,24),e.writeInt64(BigInt(r??0)),e.pad(4),e.writeInt32(n),e.writeInt64(BigInt(t??0)),e.offset()}},ho=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):g.V1}schema(e){let t=this.bb.__offset(this.bb_pos,6);return t?(e||new Jt).__init(this.bb.__indirect(this.bb_pos+t),this.bb):null}dictionaries(e,t){let n=this.bb.__offset(this.bb_pos,8);return n?(t||new mo).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}dictionariesLength(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new mo).__init(this.bb.__vector(this.bb_pos+n)+e*24,this.bb):null}recordBatchesLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new b).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,g.V1)}static addSchema(e,t){e.addFieldOffset(1,t,0)}static addDictionaries(e,t){e.addFieldOffset(2,t,0)}static startDictionariesVector(e,t){e.startVector(24,t,8)}static addRecordBatches(e,t){e.addFieldOffset(3,t,0)}static startRecordBatchesVector(e,t){e.startVector(24,t,8)}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,t){e.finish(t)}static finishSizePrefixedFooterBuffer(e,t){e.finish(t,void 0,!0)}};const go=Symbol.for(`apache-arrow/Schema`),_o=Symbol.for(`apache-arrow/Field`);var H=class e{static isSchema(e){return e?.[go]===!0}constructor(e=[],t,n,r=g.V5){this.fields=e||[],this.metadata=t||new Map,n||=yo(this.fields),this.dictionaries=n,this.metadataVersion=r}get[Symbol.toStringTag](){return`Schema`}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,t)=>`${t}: ${e}`).join(`, `)} }>`}select(t){let n=new Set(t),r=this.fields.filter(e=>n.has(e.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(e=>this.fields[e]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=vo(vo(new Map,this.metadata),n.metadata),a=n.fields.filter(e=>{let t=r.findIndex(t=>t.name===e.name);return!~t||(r[t]=e.clone({metadata:vo(vo(new Map,r[t].metadata),e.metadata)}))&&!1}),o=yo(a,new Map);return new e([...r,...a],i,new Map([...this.dictionaries,...o]))}};H.prototype.fields=null,H.prototype.metadata=null,H.prototype.dictionaries=null,H.prototype[go]=!0,Object.defineProperty(H,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===H&&H.isSchema(e)}});var U=class e{static isField(e){return e?.[_o]===!0}static new(...t){let[n,r,i,a]=t;return t[0]&&typeof t[0]==`object`&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),a===void 0&&(a=t[0].metadata)),new e(`${n}`,r,i,a)}constructor(e,t,n=!1,r){this.name=e,this.type=t,this.nullable=n,this.metadata=r||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return`Field`}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,a]=t;return!t[0]||typeof t[0]!=`object`?[n=this.name,r=this.type,i=this.nullable,a=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:a=this.metadata}=t[0],e.new(n,r,i,a)}};U.prototype.type=null,U.prototype.name=null,U.prototype.nullable=null,U.prototype.metadata=null,U.prototype[_o]=!0,Object.defineProperty(U,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===U&&U.isField(e)}});function vo(e,t){return new Map([...e||new Map,...t||new Map])}function yo(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let r=e[n].type;if(T.isDictionary(r)){if(!t.has(r.id))t.set(r.id,r.dictionary);else if(t.get(r.id)!==r.dictionary)throw Error(`Cannot create Schema containing two different dictionaries with the same Id`)}r.children&&r.children.length>0&&yo(r.children,t)}return t}var bo=pt,xo=ft,So=class{static decode(e){e=new xo(h(e));let t=ho.getRootAsFooter(e);return new Co(H.decode(t.schema(),new Map,t.version()),t)}static encode(e){let t=new bo,n=H.encode(t,e.schema);ho.startRecordBatchesVector(t,e.numRecordBatches);for(let n of[...e.recordBatches()].slice().reverse())wo.encode(t,n);let r=t.endVector();ho.startDictionariesVector(t,e.numDictionaries);for(let n of[...e.dictionaryBatches()].slice().reverse())wo.encode(t,n);let i=t.endVector();return ho.startFooter(t),ho.addSchema(t,n),ho.addVersion(t,g.V5),ho.addRecordBatches(t,r),ho.addDictionaries(t,i),ho.finishFooterBuffer(t,ho.endFooter(t)),t.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,t=g.V5,n,r){this.schema=e,this.version=t,n&&(this._recordBatches=n),r&&(this._dictionaryBatches=r)}*recordBatches(){for(let e,t=-1,n=this.numRecordBatches;++t<n;)(e=this.getRecordBatch(t))&&(yield e)}*dictionaryBatches(){for(let e,t=-1,n=this.numDictionaries;++t<n;)(e=this.getDictionaryBatch(t))&&(yield e)}getRecordBatch(e){return e>=0&&e<this.numRecordBatches&&this._recordBatches[e]||null}getDictionaryBatch(e){return e>=0&&e<this.numDictionaries&&this._dictionaryBatches[e]||null}},Co=class extends So{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(e,t){super(e,t.version()),this._footer=t}getRecordBatch(e){if(e>=0&&e<this.numRecordBatches){let t=this._footer.recordBatches(e);if(t)return wo.decode(t)}return null}getDictionaryBatch(e){if(e>=0&&e<this.numDictionaries){let t=this._footer.dictionaries(e);if(t)return wo.decode(t)}return null}},wo=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(e,t){let{metaDataLength:n}=t,r=BigInt(t.offset),i=BigInt(t.bodyLength);return mo.createBlock(e,r,n,i)}constructor(e,t,n){this.metaDataLength=e,this.offset=w(n),this.bodyLength=w(t)}},To=class e{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):g.V1}headerType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):S.NONE}header(e){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__union(e,this.bb_pos+t):null}bodyLength(){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt(`0`)}customMetadata(e,t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new b).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+e*4),this.bb):null}customMetadataLength(){let e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,t){e.addFieldInt16(0,t,g.V1)}static addHeaderType(e,t){e.addFieldInt8(1,t,S.NONE)}static addHeader(e,t){e.addFieldOffset(2,t,0)}static addBodyLength(e,t){e.addFieldInt64(3,t,BigInt(`0`))}static addCustomMetadata(e,t){e.addFieldOffset(4,t,0)}static createCustomMetadataVector(e,t){e.startVector(4,t.length,4);for(let n=t.length-1;n>=0;n--)e.addOffset(t[n]);return e.endVector()}static startCustomMetadataVector(e,t){e.startVector(4,t,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,t){e.finish(t)}static finishSizePrefixedMessageBuffer(e,t){e.finish(t,void 0,!0)}static createMessage(t,n,r,i,a,o){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,a),e.addCustomMetadata(t,o),e.endMessage(t)}};const Eo=new class extends k{visit(e,t){return e==null||t==null?void 0:super.visit(e,t)}visitNull(e,t){return Bt.startNull(t),Bt.endNull(t)}visitInt(e,t){return Ct.startInt(t),Ct.addBitWidth(t,e.bitWidth),Ct.addIsSigned(t,e.isSigned),Ct.endInt(t)}visitFloat(e,t){return Nt.startFloatingPoint(t),Nt.addPrecision(t,e.precision),Nt.endFloatingPoint(t)}visitBinary(e,t){return Tt.startBinary(t),Tt.endBinary(t)}visitBinaryView(e,t){return Et.startBinaryView(t),Et.endBinaryView(t)}visitLargeBinary(e,t){return Ft.startLargeBinary(t),Ft.endLargeBinary(t)}visitBool(e,t){return Dt.startBool(t),Dt.endBool(t)}visitUtf8(e,t){return Gt.startUtf8(t),Gt.endUtf8(t)}visitUtf8View(e,t){return Kt.startUtf8View(t),Kt.endUtf8View(t)}visitLargeUtf8(e,t){return Lt.startLargeUtf8(t),Lt.endLargeUtf8(t)}visitDecimal(e,t){return kt.startDecimal(t),kt.addScale(t,e.scale),kt.addPrecision(t,e.precision),kt.addBitWidth(t,e.bitWidth),kt.endDecimal(t)}visitDate(e,t){return Ot.startDate(t),Ot.addUnit(t,e.unit),Ot.endDate(t)}visitTime(e,t){return Ht.startTime(t),Ht.addUnit(t,e.unit),Ht.addBitWidth(t,e.bitWidth),Ht.endTime(t)}visitTimestamp(e,t){let n=e.timezone&&t.createString(e.timezone)||void 0;return Ut.startTimestamp(t),Ut.addUnit(t,e.unit),n!==void 0&&Ut.addTimezone(t,n),Ut.endTimestamp(t)}visitInterval(e,t){return Pt.startInterval(t),Pt.addUnit(t,e.unit),Pt.endInterval(t)}visitDuration(e,t){return At.startDuration(t),At.addUnit(t,e.unit),At.endDuration(t)}visitList(e,t){return Rt.startList(t),Rt.endList(t)}visitLargeList(e,t){return It.startLargeList(t),It.endLargeList(t)}visitStruct(e,t){return Vt.startStruct_(t),Vt.endStruct_(t)}visitUnion(e,t){Wt.startTypeIdsVector(t,e.typeIds.length);let n=Wt.createTypeIdsVector(t,e.typeIds);return Wt.startUnion(t),Wt.addMode(t,e.mode),Wt.addTypeIds(t,n),Wt.endUnion(t)}visitDictionary(e,t){let n=this.visit(e.indices,t);return wt.startDictionaryEncoding(t),wt.addId(t,BigInt(e.id)),wt.addIsOrdered(t,e.isOrdered),n!==void 0&&wt.addIndexType(t,n),wt.endDictionaryEncoding(t)}visitFixedSizeBinary(e,t){return jt.startFixedSizeBinary(t),jt.addByteWidth(t,e.byteWidth),jt.endFixedSizeBinary(t)}visitFixedSizeList(e,t){return Mt.startFixedSizeList(t),Mt.addListSize(t,e.listSize),Mt.endFixedSizeList(t)}visitMap(e,t){return zt.startMap(t),zt.addKeysSorted(t,e.keysSorted),zt.endMap(t)}};function Do(e,t=new Map){return new H(Ao(e,t),Lo(e.metadata),t)}function Oo(e){return new Uo(e.count,Mo(e.columns),No(e.columns),null,Fo(e.columns))}function ko(e){return new Wo(Oo(e.data),e.id,e.isDelta)}function Ao(e,t){return(e.fields||[]).filter(Boolean).map(e=>U.fromJSON(e,t))}function jo(e,t){return(e.children||[]).filter(Boolean).map(e=>U.fromJSON(e,t))}function Mo(e){return(e||[]).reduce((e,t)=>[...e,new Ko(t.count,Po(t.VALIDITY)),...Mo(t.children)],[])}function No(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let r=e[n];if(r.VALIDITY&&t.push(new Go(t.length,r.VALIDITY.length)),r.TYPE_ID&&t.push(new Go(t.length,r.TYPE_ID.length)),r.OFFSET&&t.push(new Go(t.length,r.OFFSET.length)),r.DATA&&t.push(new Go(t.length,r.DATA.length)),r.VIEWS&&t.push(new Go(t.length,r.VIEWS.length)),r.VARIADIC_DATA_BUFFERS)for(let e of r.VARIADIC_DATA_BUFFERS)t.push(new Go(t.length,e.length));t=No(r.children,t)}return t}function Po(e){return(e||[]).reduce((e,t)=>e+ +(t===0),0)}function Fo(e){return(e||[]).reduce((e,t)=>[...e,...t.VARIADIC_DATA_BUFFERS?[t.VARIADIC_DATA_BUFFERS.length]:[],...Fo(t.children)],[])}function Io(e,t){let n,r,i,a,o,s;return!t||!(a=e.dictionary)?(o=zo(e,jo(e,t)),i=new U(e.name,o,e.nullable,Lo(e.metadata))):t.has(n=a.id)?(r=(r=a.indexType)?Ro(r):new zn,s=new mr(t.get(n),r,n,a.isOrdered),i=new U(e.name,s,e.nullable,Lo(e.metadata))):(r=(r=a.indexType)?Ro(r):new zn,t.set(n,o=zo(e,jo(e,t))),s=new mr(o,r,n,a.isOrdered),i=new U(e.name,s,e.nullable,Lo(e.metadata))),i||null}function Lo(e=[]){return new Map(e.map(({key:e,value:t})=>[e,t]))}function Ro(e){return new E(e.isSigned,e.bitWidth)}function zo(e,t){let n=e.type.name;switch(n){case`NONE`:return new In;case`null`:return new In;case`binary`:return new Yn;case`largebinary`:return new Xn;case`binaryview`:return new D;case`utf8`:return new Zn;case`largeutf8`:return new $n;case`utf8view`:return new Qn;case`bool`:return new er;case`list`:return new sr((t||[])[0]);case`largelist`:return new cr((t||[])[0]);case`struct`:return new O(t||[]);case`struct_`:return new O(t||[])}switch(n){case`int`:{let t=e.type;return new E(t.isSigned,t.bitWidth)}case`floatingpoint`:{let t=e.type;return new Gn(_[t.precision])}case`decimal`:{let t=e.type;return new tr(t.scale,t.precision,t.bitWidth)}case`date`:{let t=e.type;return new nr(ot[t.unit])}case`time`:{let t=e.type;return new rr(v[t.unit],t.bitWidth)}case`timestamp`:{let t=e.type;return new ir(v[t.unit],t.timezone)}case`interval`:{let t=e.type;return new ar(y[t.unit])}case`duration`:{let t=e.type;return new or(v[t.unit])}case`union`:{let n=e.type,[r,...i]=(n.mode+``).toLowerCase(),a=r.toUpperCase()+i.join(``);return new lr(at[a],n.typeIds||[],t||[])}case`fixedsizebinary`:{let t=e.type;return new ur(t.byteWidth)}case`fixedsizelist`:{let n=e.type;return new dr(n.listSize,(t||[])[0])}case`map`:{let n=e.type;return new fr((t||[])[0],n.keysSorted)}}throw Error(`Unrecognized type: "${n}"`)}var Bo=pt,Vo=ft,Ho=class e{static fromJSON(t,n){let r=new e(0,g.V5,n);return r._createHeader=Jo(t,n),r}static decode(t){t=new Vo(h(t));let n=To.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),a=n.headerType(),o=cs(n),s=new e(r,i,a,void 0,o);return s._createHeader=Yo(n,a),s}static encode(e){let t=new Bo,n=-1;e.isSchema()?n=H.encode(t,e.header()):e.isRecordBatch()?n=Uo.encode(t,e.header()):e.isDictionaryBatch()&&(n=Wo.encode(t,e.header()));let r=e.metadata&&e.metadata.size>0?To.createCustomMetadataVector(t,[...e.metadata].map(([e,n])=>{let r=t.createString(`${e}`),i=t.createString(`${n}`);return b.startKeyValue(t),b.addKey(t,r),b.addValue(t,i),b.endKeyValue(t)})):-1;return To.startMessage(t),To.addVersion(t,g.V5),To.addHeader(t,n),To.addHeaderType(t,e.headerType),To.addBodyLength(t,BigInt(e.bodyLength)),r!==-1&&To.addCustomMetadata(t,r),To.finishMessageBuffer(t,To.endMessage(t)),t.asUint8Array()}static from(t,n=0){if(t instanceof H)return new e(0,g.V5,S.Schema,t);if(t instanceof Uo)return new e(n,g.V5,S.RecordBatch,t,t.metadata);if(t instanceof Wo)return new e(n,g.V5,S.DictionaryBatch,t);throw Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get compression(){return this._compression}get bodyLength(){return this._bodyLength}get metadata(){return this._metadata}header(){return this._createHeader()}isSchema(){return this.headerType===S.Schema}isRecordBatch(){return this.headerType===S.RecordBatch}isDictionaryBatch(){return this.headerType===S.DictionaryBatch}constructor(e,t,n,r,i){this._version=t,this._headerType=n,this.body=new Uint8Array,this._compression=r?.compression,r&&(this._createHeader=()=>r),this._bodyLength=w(e),this._metadata=i||new Map}},Uo=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}get variadicBufferCounts(){return this._variadicBufferCounts}get metadata(){return this._metadata}constructor(e,t,n,r,i=[],a){this._nodes=t,this._buffers=n,this._length=w(e),this._compression=r,this._variadicBufferCounts=i,this._metadata=a||new Map}},Wo=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(e,t,n=!1){this._data=e,this._isDelta=n,this._id=w(t)}},Go=class{constructor(e,t){this.offset=w(e),this.length=w(t)}},Ko=class{constructor(e,t){this.length=w(e),this.nullCount=w(t)}},qo=class{constructor(e,t=mt.BUFFER){this.type=e,this.method=t}};function Jo(e,t){return(()=>{switch(t){case S.Schema:return H.fromJSON(e);case S.RecordBatch:return Uo.fromJSON(e);case S.DictionaryBatch:return Wo.fromJSON(e)}throw Error(`Unrecognized Message type: { name: ${S[t]}, type: ${t} }`)})}function Yo(e,t){return(()=>{switch(t){case S.Schema:return H.decode(e.header(new Jt),new Map,e.version());case S.RecordBatch:return Uo.decode(e.header(new yt),e.version());case S.DictionaryBatch:return Wo.decode(e.header(new bt),e.version())}throw Error(`Unrecognized Message type: { name: ${S[t]}, type: ${t} }`)})}U.encode=ps,U.decode=os,U.fromJSON=Io,H.encode=fs,H.decode=Xo,H.fromJSON=Do,Uo.encode=ms,Uo.decode=Zo,Uo.fromJSON=Oo,Wo.encode=gs,Wo.decode=Qo,Wo.fromJSON=ko,Ko.encode=_s,Ko.decode=es,Go.encode=vs,Go.decode=$o,qo.encode=hs,qo.decode=ds;function Xo(e,t=new Map,n=g.V5){return new H(is(e,t),ss(e),t,n)}function Zo(e,t=g.V5){return new Uo(e.length(),ts(e),ns(e,t),ds(e.compression()),rs(e))}function Qo(e,t=g.V5){return new Wo(Uo.decode(e.data(),t),e.id(),e.isDelta())}function $o(e){return new Go(e.offset(),e.length())}function es(e){return new Ko(e.length(),e.nullCount())}function ts(e){let t=[];for(let n,r=-1,i=-1,a=e.nodesLength();++r<a;)(n=e.nodes(r))&&(t[++i]=Ko.decode(n));return t}function ns(e,t){let n=[];for(let r,i=-1,a=-1,o=e.buffersLength();++i<o;)(r=e.buffers(i))&&(t<g.V4&&(r.bb_pos+=8*(i+1)),n[++a]=Go.decode(r));return n}function rs(e){let t=[],n=Math.trunc(e.variadicBufferCountsLength());for(let r=0;r<n;++r)t.push(w(e.variadicBufferCounts(r)));return t}function is(e,t){let n=[];for(let r,i=-1,a=-1,o=e.fieldsLength();++i<o;)(r=e.fields(i))&&(n[++a]=U.decode(r,t));return n}function as(e,t){let n=[];for(let r,i=-1,a=-1,o=e.childrenLength();++i<o;)(r=e.children(i))&&(n[++a]=U.decode(r,t));return n}function os(e,t){let n,r,i,a,o,s;return!t||!(s=e.dictionary())?(i=us(e,as(e,t)),r=new U(e.name(),i,e.nullable(),ss(e))):t.has(n=w(s.id()))?(a=(a=s.indexType())?ls(a):new zn,o=new mr(t.get(n),a,n,s.isOrdered()),r=new U(e.name(),o,e.nullable(),ss(e))):(a=(a=s.indexType())?ls(a):new zn,t.set(n,i=us(e,as(e,t))),o=new mr(i,a,n,s.isOrdered()),r=new U(e.name(),o,e.nullable(),ss(e))),r||null}function ss(e){let t=new Map;if(e)for(let n,r,i=-1,a=Math.trunc(e.customMetadataLength());++i<a;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function cs(e){let t=new Map;for(let n,r,i=-1,a=Math.trunc(e.customMetadataLength());++i<a;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function ls(e){return new E(e.isSigned(),e.bitWidth())}function us(e,t){let n=e.typeType();switch(n){case x.NONE:return new In;case x.Null:return new In;case x.Binary:return new Yn;case x.LargeBinary:return new Xn;case x.BinaryView:return new D;case x.Utf8:return new Zn;case x.LargeUtf8:return new $n;case x.Utf8View:return new Qn;case x.Bool:return new er;case x.List:return new sr((t||[])[0]);case x.LargeList:return new cr((t||[])[0]);case x.Struct_:return new O(t||[])}switch(n){case x.Int:{let t=e.type(new Ct);return new E(t.isSigned(),t.bitWidth())}case x.FloatingPoint:return new Gn(e.type(new Nt).precision());case x.Decimal:{let t=e.type(new kt);return new tr(t.scale(),t.precision(),t.bitWidth())}case x.Date:return new nr(e.type(new Ot).unit());case x.Time:{let t=e.type(new Ht);return new rr(t.unit(),t.bitWidth())}case x.Timestamp:{let t=e.type(new Ut);return new ir(t.unit(),t.timezone())}case x.Interval:return new ar(e.type(new Pt).unit());case x.Duration:return new or(e.type(new At).unit());case x.Union:{let n=e.type(new Wt);return new lr(n.mode(),n.typeIdsArray()||[],t||[])}case x.FixedSizeBinary:return new ur(e.type(new jt).byteWidth());case x.FixedSizeList:return new dr(e.type(new Mt).listSize(),(t||[])[0]);case x.Map:{let n=e.type(new zt);return new fr((t||[])[0],n.keysSorted())}}throw Error(`Unrecognized type: "${x[n]}" (${n})`)}function ds(e){return e?new qo(e.codec(),e.method()):null}function fs(e,t){let n=t.fields.map(t=>U.encode(e,t));Jt.startFieldsVector(e,n.length);let r=Jt.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?Jt.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return b.startKeyValue(e),b.addKey(e,r),b.addValue(e,i),b.endKeyValue(e)})):-1;return Jt.startSchema(e),Jt.addFields(e,r),Jt.addEndianness(e,ys?xt.Little:xt.Big),i!==-1&&Jt.addCustomMetadata(e,i),Jt.endSchema(e)}function ps(e,t){let n=-1,r=-1,i=-1,a=t.type,o=t.typeId;T.isDictionary(a)?(o=a.dictionary.typeId,i=Eo.visit(a,e),r=Eo.visit(a.dictionary,e)):r=Eo.visit(a,e);let s=(a.children||[]).map(t=>U.encode(e,t)),c=qt.createChildrenVector(e,s),l=t.metadata&&t.metadata.size>0?qt.createCustomMetadataVector(e,[...t.metadata].map(([t,n])=>{let r=e.createString(`${t}`),i=e.createString(`${n}`);return b.startKeyValue(e),b.addKey(e,r),b.addValue(e,i),b.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),qt.startField(e),qt.addType(e,r),qt.addTypeType(e,o),qt.addChildren(e,c),qt.addNullable(e,!!t.nullable),n!==-1&&qt.addName(e,n),i!==-1&&qt.addDictionary(e,i),l!==-1&&qt.addCustomMetadata(e,l),qt.endField(e)}function ms(e,t){let n=t.nodes||[],r=t.buffers||[],i=t.variadicBufferCounts||[];yt.startNodesVector(e,n.length);for(let t of n.slice().reverse())Ko.encode(e,t);let a=e.endVector();yt.startBuffersVector(e,r.length);for(let t of r.slice().reverse())Go.encode(e,t);let o=e.endVector(),s=null;t.compression!==null&&(s=hs(e,t.compression));let c=-1;return i.length>0&&(c=yt.createVariadicBufferCountsVector(e,i.map(BigInt))),yt.startRecordBatch(e),yt.addLength(e,BigInt(t.length)),yt.addNodes(e,a),yt.addBuffers(e,o),t.compression!==null&&s&&yt.addCompression(e,s),c!==-1&&yt.addVariadicBufferCounts(e,c),yt.endRecordBatch(e)}function hs(e,t){return gt.startBodyCompression(e),gt.addCodec(e,t.type),gt.addMethod(e,t.method),gt.endBodyCompression(e)}function gs(e,t){let n=Uo.encode(e,t.data);return bt.startDictionaryBatch(e),bt.addId(e,BigInt(t.id)),bt.addIsDelta(e,t.isDelta),bt.addData(e,n),bt.endDictionaryBatch(e)}function _s(e,t){return vt.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function vs(e,t){return _t.createBuffer(e,BigInt(t.offset),BigInt(t.length))}const ys=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})(),W=Object.freeze({done:!0,value:void 0});var bs=class{constructor(e){this._json=e}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},xs=class{tee(){return this._getDOMStream().tee()}pipe(e,t){return this._getNodeStream().pipe(e,t)}pipeTo(e,t){return this._getDOMStream().pipeTo(e,t)}pipeThrough(e,t){return this._getDOMStream().pipeThrough(e,t)}_getDOMStream(){return this._DOMStream||=this.toDOMStream()}_getNodeStream(){return this._nodeStream||=this.toNodeStream()}},Ss=class extends xs{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return d(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){let{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(W);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return Ze.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return Ze.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return d(this,void 0,void 0,function*(){return yield this.abort(e),W})}return(e){return d(this,void 0,void 0,function*(){return yield this.close(),W})}read(e){return d(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return d(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(...e){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,t)=>{this.resolvers.push({resolve:e,reject:t})}):Promise.resolve(W)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw Error(`AsyncQueue is closed`)}},Cs=class extends Ss{write(e){if((e=h(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?Se(this.toUint8Array(!0)):this.toUint8Array(!1).then(Se)}toUint8Array(e=!1){return e?He(this._values)[0]:d(this,void 0,void 0,function*(){var e,t,n,r;let i=[],a=0;try{for(var o=!0,s=be(this),c;c=yield s.next(),e=c.done,!e;o=!0){r=c.value,o=!1;let e=r;i.push(e),a+=e.byteLength}}catch(e){t={error:e}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(t)throw t.error}}return He(i,a)[0]})}},ws=class{constructor(e){e&&(this.source=new Es(Ze.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},Ts=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Cs?this.source=new Ds(Ze.fromAsyncIterable(t)):Le(t)?this.source=new Ds(Ze.fromNodeStream(t)):Ie(t)?this.source=new Ds(Ze.fromDOMStream(t)):Pe(t)?this.source=new Ds(Ze.fromDOMStream(t.body)):ke(t)?this.source=new Ds(Ze.fromIterable(t)):(Oe(t)||Ae(t))&&(this.source=new Ds(Ze.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}},Es=class{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,`peek`).value}read(e){return this.next(e,`read`).value}next(e,t=`read`){return this.source.next({cmd:t,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||W)}return(e){return Object.create(this.source.return&&this.source.return(e)||W)}},Ds=class{constructor(e){this.source=e,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(e){return d(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return d(this,void 0,void 0,function*(){return(yield this.next(e,`read`)).value})}peek(e){return d(this,void 0,void 0,function*(){return(yield this.next(e,`peek`)).value})}next(e){return d(this,arguments,void 0,function*(e,t=`read`){return yield this.source.next({cmd:t,size:e})})}throw(e){return d(this,void 0,void 0,function*(){let t=this.source.throw&&(yield this.source.throw(e))||W;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}return(e){return d(this,void 0,void 0,function*(){let t=this.source.return&&(yield this.source.return(e))||W;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(t)})}},Os=class extends ws{constructor(e,t){super(),this.position=0,this.buffer=h(e),this.size=t===void 0?this.buffer.byteLength:t}readInt32(e){let{buffer:t,byteOffset:n}=this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e<this.size}read(e){let{buffer:t,size:n,position:r}=this;return t&&r<n?(typeof e!=`number`&&(e=1/0),this.position=Math.min(n,r+Math.min(n-r,e)),t.subarray(r,this.position)):null}readAt(e,t){let n=this.buffer,r=Math.min(this.size,e+t);return n?n.subarray(e,r):new Uint8Array(t)}close(){this.buffer&&=null}throw(e){return this.close(),{done:!0,value:e}}return(e){return this.close(),{done:!0,value:e}}},ks=class extends Ts{constructor(e,t){super(),this.position=0,this._handle=e,typeof t==`number`?this.size=t:this._pending=d(this,void 0,void 0,function*(){this.size=(yield e.stat()).size,delete this._pending})}readInt32(e){return d(this,void 0,void 0,function*(){let{buffer:t,byteOffset:n}=yield this.readAt(e,4);return new DataView(t,n).getInt32(0,!0)})}seek(e){return d(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(e,this.size),e<this.size})}read(e){return d(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:t,size:n,position:r}=this;if(t&&r<n){typeof e!=`number`&&(e=1/0);let i=r,a=0,o=0,s=Math.min(n,i+Math.min(n-i,e)),c=new Uint8Array(Math.max(0,(this.position=s)-i));for(;(i+=o)<s&&(a+=o)<c.byteLength;)({bytesRead:o}=yield t.read(c,a,c.byteLength-a,i));return c}return null})}readAt(e,t){return d(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r}=this;if(n&&e+t<r){let i=Math.min(r,e+t),a=new Uint8Array(i-e);return(yield n.read(a,0,t,e)).buffer}return new Uint8Array(t)})}close(){return d(this,void 0,void 0,function*(){let e=this._handle;this._handle=null,e&&(yield e.close())})}throw(e){return d(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}return(e){return d(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:e}})}};function As(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}const js=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];var Ms=class{constructor(e){this.buffer=e}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(e){let t=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]),r=t[3]*n[3];this.buffer[0]=r&65535;let i=r>>>16;return r=t[2]*n[3],i+=r,r=t[3]*n[2]>>>0,i+=r,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<r?65536:0,this.buffer[1]+=i>>>16,this.buffer[1]+=t[1]*n[3]+t[2]*n[2]+t[3]*n[1],this.buffer[1]+=t[0]*n[3]+t[1]*n[2]+t[2]*n[1]+t[3]*n[0]<<16,this}_plus(e){let t=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],t<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=t}lessThan(e){return this.buffer[1]<e.buffer[1]||this.buffer[1]===e.buffer[1]&&this.buffer[0]<e.buffer[0]}equals(e){return this.buffer[1]===e.buffer[1]&&this.buffer[0]==e.buffer[0]}greaterThan(e){return e.lessThan(this)}hex(){return`${As(this.buffer[1])} ${As(this.buffer[0])}`}},G=class e extends Ms{times(e){return this._times(e),this}plus(e){return this._plus(e),this}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.length,i=new e(n);for(let n=0;n<r;){let a=8<r-n?8:r-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+a),10),0])),s=new e(new Uint32Array([js[a],0]));i.times(s),i.plus(o),n+=a}return i}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Ns=class e extends Ms{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(e){return this._times(e),this}plus(e){return this._plus(e),this}lessThan(e){let t=this.buffer[1]<<0,n=e.buffer[1]<<0;return t<n||t===n&&this.buffer[0]<e.buffer[0]}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=+!!r;n<i;){let r=8<i-n?8:i-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+r),10),0])),s=new e(new Uint32Array([js[r],0]));a.times(s),a.plus(o),n+=r}return r?a.negate():a}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},Ps=class e{constructor(e){this.buffer=e}high(){return new Ns(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ns(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(e){let t=new G(new Uint32Array([this.buffer[3],0])),n=new G(new Uint32Array([this.buffer[2],0])),r=new G(new Uint32Array([this.buffer[1],0])),i=new G(new Uint32Array([this.buffer[0],0])),a=new G(new Uint32Array([e.buffer[3],0])),o=new G(new Uint32Array([e.buffer[2],0])),s=new G(new Uint32Array([e.buffer[1],0])),c=new G(new Uint32Array([e.buffer[0],0])),l=G.multiply(i,c);this.buffer[0]=l.low();let u=new G(new Uint32Array([l.high(),0]));return l=G.multiply(r,c),u.plus(l),l=G.multiply(i,s),u.plus(l),this.buffer[1]=u.low(),this.buffer[3]=+!!u.lessThan(l),this.buffer[2]=u.high(),new G(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(G.multiply(n,c)).plus(G.multiply(r,s)).plus(G.multiply(i,o)),this.buffer[3]+=G.multiply(t,c).plus(G.multiply(n,s)).plus(G.multiply(r,o)).plus(G.multiply(i,a)).low(),this}plus(e){let t=new Uint32Array(4);return t[3]=this.buffer[3]+e.buffer[3]>>>0,t[2]=this.buffer[2]+e.buffer[2]>>>0,t[1]=this.buffer[1]+e.buffer[1]>>>0,t[0]=this.buffer[0]+e.buffer[0]>>>0,t[0]<this.buffer[0]>>>0&&++t[1],t[1]<this.buffer[1]>>>0&&++t[2],t[2]<this.buffer[2]>>>0&&++t[3],this.buffer[3]=t[3],this.buffer[2]=t[2],this.buffer[1]=t[1],this.buffer[0]=t[0],this}hex(){return`${As(this.buffer[3])} ${As(this.buffer[2])} ${As(this.buffer[1])} ${As(this.buffer[0])}`}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t==`string`?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith(`-`),i=t.length,a=new e(n);for(let n=+!!r;n<i;){let r=8<i-n?8:i-n,o=new e(new Uint32Array([Number.parseInt(t.slice(n,n+r),10),0,0,0])),s=new e(new Uint32Array([js[r],0,0,0]));a.times(s),a.plus(o),n+=r}return r?a.negate():a}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+16*r,4));return n}};function Fs(e){let t=e.length,n=new Int32Array(t*2);for(let r=0,i=0;r<t;r++){let t=e[r];n[i++]=t.days??0,n[i++]=t.milliseconds??0}return n}function Is(e){let t=e.length,n=new Int32Array(t*4);for(let r=0,i=0;r<t;r++){let t=e[r];n[i++]=t.months??0,n[i++]=t.days??0;let a=t.nanoseconds;if(a){let e=BigInt(a);n[i++]=Number(e&BigInt(4294967295))>>>0,n[i++]=Number(e>>BigInt(32))>>>0}else i+=2}return n}var Ls=class extends k{constructor(e,t,n,r,i=g.V5,a=[]){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.variadicBufferIndex=-1,this.bytes=e,this.nodes=t,this.buffers=n,this.dictionaries=r,this.metadataVersion=i,this.variadicBufferCounts=a}visit(e){return super.visit(e instanceof U?e.type:e)}visitNull(e,{length:t}=this.nextFieldNode()){return I({type:e,length:t})}visitBool(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitInt(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFloat(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeUtf8(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitUtf8View(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),views:this.readData(e),variadicBuffers:this.readVariadicBuffers(this.nextVariadicBufferCount())})}visitBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitLargeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),data:this.readData(e)})}visitBinaryView(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),views:this.readData(e),variadicBuffers:this.readVariadicBuffers(this.nextVariadicBufferCount())})}visitFixedSizeBinary(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDate(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTimestamp(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitTime(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDecimal(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitList(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitLargeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}visitStruct(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),children:this.visitMany(e.children)})}visitUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<g.V5&&this.readNullBitmap(e,n),e.mode===at.Sparse?this.visitSparseUnion(e,{length:t,nullCount:n}):this.visitDenseUnion(e,{length:t,nullCount:n})}visitDenseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),valueOffsets:this.readOffsets(e),children:this.visitMany(e.children)})}visitSparseUnion(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,typeIds:this.readTypeIds(e),children:this.visitMany(e.children)})}visitDictionary(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e.indices),dictionary:this.readDictionary(e)})}visitInterval(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitDuration(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),data:this.readData(e)})}visitFixedSizeList(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),child:this.visit(e.children[0])})}visitMap(e,{length:t,nullCount:n}=this.nextFieldNode()){return I({type:e,length:t,nullCount:n,nullBitmap:this.readNullBitmap(e,n),valueOffsets:this.readOffsets(e),child:this.visit(e.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(e,t,n=this.nextBufferRange()){return t>0&&this.readData(e,n)||new Uint8Array}readOffsets(e,t){return this.readData(e,t)}readTypeIds(e,t){return this.readData(e,t)}readData(e,{length:t,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+t)}readVariadicBuffers(e){return Array.from({length:e},()=>this.readData(null))}nextVariadicBufferCount(){return this.variadicBufferCounts[++this.variadicBufferIndex]??0}readDictionary(e){return this.dictionaries.get(e.id)}},Rs=class extends Ls{constructor(e,t,n,r,i,a=[]){super(new Uint8Array,t,n,r,i,a),this.sources=e}readNullBitmap(e,t,{offset:n}=this.nextBufferRange()){return t<=0?new Uint8Array:za(this.sources[n])}readOffsets(e,{offset:t}=this.nextBufferRange()){return m(Uint8Array,m(e.OffsetArrayType,this.sources[t]))}readTypeIds(e,{offset:t}=this.nextBufferRange()){return m(Uint8Array,m(e.ArrayType,this.sources[t]))}readData(e,{offset:t}=this.nextBufferRange()){let{sources:n}=this;if(T.isTimestamp(e)||(T.isInt(e)||T.isTime(e))&&e.bitWidth===64||T.isDuration(e)||T.isDate(e)&&e.unit===ot.MILLISECOND)return m(Uint8Array,Ns.convertArray(n[t]));if(T.isDecimal(e))return m(Uint8Array,Ps.convertArray(n[t]));if(T.isBinary(e)||T.isLargeBinary(e)||T.isFixedSizeBinary(e))return Bs(n[t]);if(T.isBinaryView(e))return Hs(n[t]);if(T.isUtf8View(e))return Us(n[t]);if(T.isBool(e))return za(n[t]);if(T.isUtf8(e)||T.isLargeUtf8(e))return we(n[t].join(``));if(T.isInterval(e))switch(e.unit){case y.DAY_TIME:return Fs(n[t]);case y.MONTH_DAY_NANO:return Is(n[t])}return m(Uint8Array,m(e.ArrayType,n[t].map(e=>+e)))}readVariadicBuffers(e){let t=[];for(let n=0;n<e;n++){let{offset:e}=this.nextBufferRange(),n=this.sources[e];t.push(zs(n))}return t}};function zs(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n>>1]=Number.parseInt(e.slice(n,n+2),16);return t}function Bs(e){return zs(e.join(``))}function Vs(e,t){let n=new Uint8Array(e.length*16),r=new DataView(n.buffer);for(let[i,a]of e.entries()){let e=i*16,o=a.SIZE;if(r.setInt32(e,o,!0),a.INLINED!==void 0){let r=t(a.INLINED);for(let t=0;t<r.length&&t<12;t++)n[e+4+t]=r[t]}else{let t=a.PREFIX_HEX;for(let r=0;r<8&&r<t.length;r+=2)n[e+4+(r>>1)]=Number.parseInt(t.slice(r,r+2),16);r.setInt32(e+8,a.BUFFER_INDEX,!0),r.setInt32(e+12,a.OFFSET,!0)}}return n}function Hs(e){return Vs(e,e=>{let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n>>1]=Number.parseInt(e.slice(n,n+2),16);return t})}function Us(e){return Vs(e,e=>new TextEncoder().encode(e))}var Ws=class extends Ls{constructor(e,t,n,r,i,a=[]){super(new Uint8Array,t,n,r,i,a),this.bodyChunks=e}readData(e,t=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}},K=class extends k{compareSchemas(e,t){return e===t||t instanceof e.constructor&&this.compareManyFields(e.fields,t.fields)}compareManyFields(e,t){return e===t||Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>this.compareFields(e,t[n]))}compareFields(e,t){return e===t||t instanceof e.constructor&&e.name===t.name&&e.nullable===t.nullable&&this.visit(e.type,t.type)}};function q(e,t){return t instanceof e.constructor}function Gs(e,t){return e===t||q(e,t)}function Ks(e,t){return e===t||q(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function qs(e,t){return e===t||q(e,t)&&e.precision===t.precision}function Js(e,t){return e===t||q(e,t)&&e.byteWidth===t.byteWidth}function Ys(e,t){return e===t||q(e,t)&&e.unit===t.unit}function Xs(e,t){return e===t||q(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Zs(e,t){return e===t||q(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Qs(e,t){return e===t||q(e,t)&&e.children.length===t.children.length&&oc.compareManyFields(e.children,t.children)}function $s(e,t){return e===t||q(e,t)&&e.children.length===t.children.length&&oc.compareManyFields(e.children,t.children)}function ec(e,t){return e===t||q(e,t)&&e.mode===t.mode&&e.typeIds.every((e,n)=>e===t.typeIds[n])&&oc.compareManyFields(e.children,t.children)}function tc(e,t){return e===t||q(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&oc.visit(e.indices,t.indices)&&oc.visit(e.dictionary,t.dictionary)}function nc(e,t){return e===t||q(e,t)&&e.unit===t.unit}function rc(e,t){return e===t||q(e,t)&&e.unit===t.unit}function ic(e,t){return e===t||q(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&oc.compareManyFields(e.children,t.children)}function ac(e,t){return e===t||q(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&oc.compareManyFields(e.children,t.children)}K.prototype.visitNull=Gs,K.prototype.visitBool=Gs,K.prototype.visitInt=Ks,K.prototype.visitInt8=Ks,K.prototype.visitInt16=Ks,K.prototype.visitInt32=Ks,K.prototype.visitInt64=Ks,K.prototype.visitUint8=Ks,K.prototype.visitUint16=Ks,K.prototype.visitUint32=Ks,K.prototype.visitUint64=Ks,K.prototype.visitFloat=qs,K.prototype.visitFloat16=qs,K.prototype.visitFloat32=qs,K.prototype.visitFloat64=qs,K.prototype.visitUtf8=Gs,K.prototype.visitLargeUtf8=Gs,K.prototype.visitUtf8View=Gs,K.prototype.visitBinary=Gs,K.prototype.visitLargeBinary=Gs,K.prototype.visitBinaryView=Gs,K.prototype.visitFixedSizeBinary=Js,K.prototype.visitDate=Ys,K.prototype.visitDateDay=Ys,K.prototype.visitDateMillisecond=Ys,K.prototype.visitTimestamp=Xs,K.prototype.visitTimestampSecond=Xs,K.prototype.visitTimestampMillisecond=Xs,K.prototype.visitTimestampMicrosecond=Xs,K.prototype.visitTimestampNanosecond=Xs,K.prototype.visitTime=Zs,K.prototype.visitTimeSecond=Zs,K.prototype.visitTimeMillisecond=Zs,K.prototype.visitTimeMicrosecond=Zs,K.prototype.visitTimeNanosecond=Zs,K.prototype.visitDecimal=Gs,K.prototype.visitList=Qs,K.prototype.visitLargeList=Qs,K.prototype.visitStruct=$s,K.prototype.visitUnion=ec,K.prototype.visitDenseUnion=ec,K.prototype.visitSparseUnion=ec,K.prototype.visitDictionary=tc,K.prototype.visitInterval=nc,K.prototype.visitIntervalDayTime=nc,K.prototype.visitIntervalYearMonth=nc,K.prototype.visitIntervalMonthDayNano=nc,K.prototype.visitDuration=rc,K.prototype.visitDurationSecond=rc,K.prototype.visitDurationMillisecond=rc,K.prototype.visitDurationMicrosecond=rc,K.prototype.visitDurationNanosecond=rc,K.prototype.visitFixedSizeList=ic,K.prototype.visitMap=ac;const oc=new K;function sc(e,t){return oc.compareSchemas(e,t)}function cc(e,t){return lc(e,t.map(e=>e.data.concat()))}function lc(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((e,t)=>Math.max(e,t.length),0)},a=0,o=0,s=-1,c=t.length,l,u=[];for(;i.numBatches-->0;){for(o=1/0,s=-1;++s<c;)u[s]=l=t[s].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=uc(n,o,u,t,i),o>0&&(r[a++]=I({type:new O(n),length:o,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(t=>new J(e,t))]}function uc(e,t,n,r,i){let a=(t+63&-64)>>3;for(let o=-1,s=r.length;++o<s;){let s=n[o],c=s?.length;if(c>=t)c===t?n[o]=s:(n[o]=s.slice(0,t),i.numBatches=Math.max(i.numBatches,r[o].unshift(s.slice(t,c-t))));else{let r=e[o];e[o]=r.clone({nullable:!0}),n[o]=s?._changeLengthAndBackfillNullBitmap(t)??I({type:r.type,length:t,nullCount:t,nullBitmap:new Uint8Array(a)})}}return n}var dc;const fc=Symbol.for(`apache-arrow/Table`);var pc=class e{static isTable(e){return e?.[fc]===!0}constructor(...t){if(t.length===0)return this.batches=[],this.schema=new H([]),this._offsets=[0],this;let n,r;t[0]instanceof H&&(n=t.shift()),t.at(-1)instanceof Uint32Array&&(r=t.pop());let i=t=>{if(t){if(t instanceof J)return[t];if(t instanceof e)return t.batches;if(t instanceof F){if(t.type instanceof O)return[new J(new H(t.type.children),t)]}else if(Array.isArray(t))return t.flatMap(e=>i(e));else if(typeof t[Symbol.iterator]==`function`)return[...t].flatMap(e=>i(e));else if(typeof t==`object`){let e=Object.keys(t),r=e.map(e=>new V([t[e]])),[,i]=cc(n??new H(e.map((e,t)=>new U(String(e),r[t].type,r[t].nullable))),r);return i.length===0?[new J(t)]:i}}return[]},a=t.flatMap(e=>i(e));if(n=n??a[0]?.schema??new H([]),!(n instanceof H))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);for(let e of a){if(!(e instanceof J))throw TypeError(`Table constructor expects a [Schema, RecordBatch[]] pair.`);if(!sc(n,e.schema))throw TypeError(`Table and inner RecordBatch schemas must be equivalent.`)}this.schema=n,this.batches=a,this._offsets=r??Ya(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,t)=>e+t.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Ja(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(Ta(e,this.numRows))}set(e,t){}indexOf(e,t){return-1}[Symbol.iterator](){return this.batches.length>0?so.visit(new V(this.data)):[][Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n ${this.toArray().join(`,
7
+ `)}\n]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:e})=>e));return new e(n,r.map(e=>new J(n,e)))}slice(t,n){let r=this.schema;[t,n]=wa({length:this.numRows},t,n);let i=Xa(this.data,this._offsets,t,n);return new e(r,i.map(e=>new J(r,e)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(t=>t.name===e))}getChildAt(e){if(e>-1&&e<this.schema.fields.length){let t=this.data.map(t=>t.children[e]);if(t.length===0){let{type:n}=this.schema.fields[e],r=I({type:n,length:0,nullCount:0});t.push(r._changeLengthAndBackfillNullBitmap(this.numRows))}return new V(t)}return null}setChild(e,t){return this.setChildAt(this.schema.fields?.findIndex(t=>t.name===e),t)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||=new V([I({type:new In,length:this.numRows})]);let e=r.fields.slice(),a=e[t].clone({type:n.type}),o=this.schema.fields.map((e,t)=>this.getChildAt(t));[e[t],o[t]]=[a,n],[r,i]=cc(r,o)}return new e(r,i)}select(e){let t=this.schema.fields.reduce((e,t,n)=>e.set(t.name,n),new Map);return this.selectAt(e.map(e=>t.get(e)).filter(e=>e>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(e=>e.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((e,t,r)=>{let[i,a]=e,o=n.findIndex(e=>e.name===t.name);return~o?a[o]=r:i.push(r),e},[[],[]]),a=this.schema.assign(t.schema),o=[...n.map((e,t)=>[t,i[t]]).map(([e,n])=>n===void 0?this.getChildAt(e):t.getChildAt(n)),...r.map(e=>t.getChildAt(e))].filter(Boolean);return new e(...cc(a,o))}};dc=Symbol.toStringTag,pc[dc]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[fc]=!0,e.isValid=$a(Qa),e.get=$a(P.getVisitFn(C.Struct)),e.set=eo(vi.getVisitFn(C.Struct)),e.indexOf=to(ao.getVisitFn(C.Struct)),`Table`))(pc.prototype),Object.defineProperty(pc,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===pc&&pc.isTable(e)}});var mc;const hc=Symbol.for(`apache-arrow/RecordBatch`);var J=class e{static isRecordBatch(e){return e?.[hc]===!0}constructor(...e){switch(e.length){case 3:case 2:if([this.schema]=e,!(this.schema instanceof H)||([,this.data=I({nullCount:0,type:new O(this.schema.fields),children:this.schema.fields.map(e=>I({type:e.type,nullCount:0}))}),this._metadata=new Map]=e,!(this.data instanceof F)))throw TypeError(`RecordBatch constructor expects a [Schema, Data] pair.`);[this.schema,this.data]=gc(this.schema,this.data.children,this.data.length);break;case 1:{let[t]=e,{fields:n,children:r,length:i}=Object.keys(t).reduce((e,n,r)=>(e.children[r]=t[n],e.length=Math.max(e.length,t[n].length),e.fields[r]=U.new({name:n,type:t[n].type,nullable:!0}),e),{length:0,fields:[],children:[]}),a=new H(n),o=I({type:new O(n),length:i,children:r,nullCount:0});[this.schema,this.data]=gc(a,o.children,i),this._metadata=new Map;break}default:throw TypeError(`RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.`)}}get metadata(){return this._metadata}get dictionaries(){return this._dictionaries||=_c(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(e){return this.data.getValid(e)}get(e){return P.visit(this.data,e)}at(e){return this.get(Ta(e,this.numRows))}set(e,t){return vi.visit(this.data,e,t)}indexOf(e,t){return ao.visit(this.data,e,t)}[Symbol.iterator](){return so.visit(new V([this.data]))}toArray(){return[...this]}concat(...e){return new pc(this.schema,[this,...e])}slice(t,n){let[r]=new V([this.data]).slice(t,n).data;return new e(this.schema,r,this._metadata)}getChild(e){return this.getChildAt(this.schema.fields?.findIndex(t=>t.name===e))}getChildAt(e){return e>-1&&e<this.schema.fields.length?new V([this.data.children[e]]):null}setChild(e,t){return this.setChildAt(this.schema.fields?.findIndex(t=>t.name===e),t)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||=new V([I({type:new In,length:this.numRows})]);let e=r.fields.slice(),a=i.children.slice(),o=e[t].clone({type:n.type});[e[t],a[t]]=[o,n.data[0]],r=new H(e,new Map(this.schema.metadata)),i=I({type:new O(e),length:i.length,children:a})}return new e(r,i,this._metadata)}select(t){let n=this.schema.select(t),r=new O(n.fields),i=[];for(let e of t){let t=this.schema.fields.findIndex(t=>t.name===e);~t&&(i[t]=this.data.children[t])}return new e(n,I({type:r,length:this.numRows,children:i}),this._metadata)}selectAt(t){let n=this.schema.selectAt(t),r=t.map(e=>this.data.children[e]).filter(Boolean),i=I({type:new O(n.fields),length:this.numRows,children:r});return new e(n,i,this._metadata)}};mc=Symbol.toStringTag,J[mc]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[hc]=!0,`RecordBatch`))(J.prototype),Object.defineProperty(J,Symbol.hasInstance,{value:function(e){return Function.prototype[Symbol.hasInstance].call(this,e)||this===J&&J.isRecordBatch(e)}});function gc(e,t,n=t.reduce((e,t)=>Math.max(e,t.length),0)){let r=[...e.fields],i=[...t],a=(n+63&-64)>>3;for(let[o,s]of e.fields.entries()){let e=t[o];(!e||e.length!==n)&&(r[o]=s.clone({nullable:!0}),i[o]=e?._changeLengthAndBackfillNullBitmap(n)??I({type:s.type,length:n,nullCount:n,nullBitmap:new Uint8Array(a)}))}return[e.assign(r),I({type:new O(r),length:n,children:i})]}function _c(e,t,n=new Map){if((e?.length??0)>0&&e?.length===t?.length)for(let r=-1,i=e.length;++r<i;){let{type:i}=e[r],a=t[r];for(let e of[a,...a?.dictionary?.data||[]])_c(i.children,e?.children,n);if(T.isDictionary(i)){let{id:e}=i;if(!n.has(e))a?.dictionary&&n.set(e,a.dictionary);else if(n.get(e)!==a.dictionary)throw Error(`Cannot create Schema containing two different dictionaries with the same Id`)}}return n}var vc=class extends J{constructor(e,t){let n=e.fields.map(e=>I({type:e.type})),r=I({type:new O(e.fields),length:0,nullCount:0,children:n});super(e,r,t||new Map)}};const yc=e=>`Expected ${S[e]} Message in stream, but was null or length 0.`,bc=e=>`Header pointer of flatbuffer-encoded ${S[e]} Message is null or length 0.`,xc=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,Sc=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`;var Cc=class{constructor(e){this.source=e instanceof ws?e:new ws(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?W:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(yc(e));return t.value}readMessageBody(e){if(e<=0)return new Uint8Array;let t=h(this.source.read(e));if(t.byteLength<e)throw Error(Sc(e,t.byteLength));return t.byteOffset%8==0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()}readSchema(e=!1){let t=S.Schema,n=this.readMessage(t)?.header();if(e&&!n)throw Error(bc(t));return n}readMetadataLength(){let e=this.source.read(4),t=(e&&new ft(e))?.readInt32(0)||0;return{done:t===0,value:t}}readMetadata(e){let t=this.source.read(e);if(!t)return W;if(t.byteLength<e)throw Error(xc(e,t.byteLength));return{done:!1,value:Ho.decode(t)}}},wc=class{constructor(e,t){this.source=e instanceof Ts?e:Ne(e)?new ks(e,t):new Ts(e)}[Symbol.asyncIterator](){return this}next(){return d(this,void 0,void 0,function*(){let e;return(e=yield this.readMetadataLength()).done||e.value===-1&&(e=yield this.readMetadataLength()).done||(e=yield this.readMetadata(e.value)).done?W:e})}throw(e){return d(this,void 0,void 0,function*(){return yield this.source.throw(e)})}return(e){return d(this,void 0,void 0,function*(){return yield this.source.return(e)})}readMessage(e){return d(this,void 0,void 0,function*(){let t;if((t=yield this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(yc(e));return t.value})}readMessageBody(e){return d(this,void 0,void 0,function*(){if(e<=0)return new Uint8Array;let t=h(yield this.source.read(e));if(t.byteLength<e)throw Error(Sc(e,t.byteLength));return t.byteOffset%8==0&&t.byteOffset+t.byteLength<=t.buffer.byteLength?t:t.slice()})}readSchema(){return d(this,arguments,void 0,function*(e=!1){let t=S.Schema,n=(yield this.readMessage(t))?.header();if(e&&!n)throw Error(bc(t));return n})}readMetadataLength(){return d(this,void 0,void 0,function*(){let e=yield this.source.read(4),t=(e&&new ft(e))?.readInt32(0)||0;return{done:t===0,value:t}})}readMetadata(e){return d(this,void 0,void 0,function*(){let t=yield this.source.read(e);if(!t)return W;if(t.byteLength<e)throw Error(xc(e,t.byteLength));return{done:!1,value:Ho.decode(t)}})}},Tc=class extends Cc{constructor(e){super(new Uint8Array),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=e instanceof bs?e:new bs(e)}next(){let{_json:e}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Ho.fromJSON(e.schema,S.Schema)};if(this._dictionaryIndex<e.dictionaries.length){let t=e.dictionaries[this._dictionaryIndex++];return this._body=t.data.columns,{done:!1,value:Ho.fromJSON(t,S.DictionaryBatch)}}if(this._batchIndex<e.batches.length){let t=e.batches[this._batchIndex++];return this._body=t.columns,{done:!1,value:Ho.fromJSON(t,S.RecordBatch)}}return this._body=[],W}readMessageBody(e){return t(this._body);function t(e){return(e||[]).reduce((e,n)=>[...e,...n.VALIDITY&&[n.VALIDITY]||[],...n.TYPE_ID&&[n.TYPE_ID]||[],...n.OFFSET&&[n.OFFSET]||[],...n.DATA&&[n.DATA]||[],...n.VIEWS&&[n.VIEWS]||[],...n.VARIADIC_DATA_BUFFERS||[],...t(n.children)],[])}}readMessage(e){let t;if((t=this.next()).done)return null;if(e!=null&&t.value.headerType!==e)throw Error(yc(e));return t.value}readSchema(){let e=S.Schema,t=this.readMessage(e),n=t?.header();if(!t||!n)throw Error(bc(e));return n}};const Ec=new Uint8Array(6);for(let e=0;e<6;e+=1)Ec[e]=`ARROW1`.codePointAt(e);function Dc(e,t=0){for(let n=-1,r=Ec.length;++n<r;)if(Ec[n]!==e[t+n])return!1;return!0}const Oc=Ec.length,kc=Oc+4,Ac=Oc*2+4;var jc=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(e){let t=new Uint8Array([1,2,3,4,5,6,7,8]),n=e.encode(t);return this._isValidCompressed(n)}_isValidCompressed(e){return this._hasMinimumLength(e)&&this._hasValidMagicNumber(e)&&this._hasValidVersion(e)}_hasMinimumLength(e){return e.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(e){return this.LZ4_FRAME_MAGIC.every((t,n)=>e[n]===t)}_hasValidVersion(e){return(e[4]&192)>>6==1}},Mc=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(e){let t=new Uint8Array([1,2,3,4,5,6,7,8]),n=e.encode(t);return this._isValidCompressed(n)}_isValidCompressed(e){return this._hasMinimumLength(e)&&this._hasValidMagicNumber(e)}_hasMinimumLength(e){return e.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(e){return this.ZSTD_MAGIC.every((t,n)=>e[n]===t)}};const Nc={[ht.LZ4_FRAME]:new jc,[ht.ZSTD]:new Mc},Pc=new class{constructor(){this.registry={}}set(e,t){if(t?.encode&&typeof t.encode==`function`&&!Nc[e].isValidCodecEncode(t))throw Error(`Encoder for ${ht[e]} is not valid.`);this.registry[e]=t}get(e){return this.registry?.[e]||null}};var Fc=class e extends xs{constructor(e){super(),this._impl=e}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(e){return this._impl.throw(e)}return(e){return this._impl.return(e)}cancel(){return this._impl.cancel()}reset(e){return this._impl.reset(e),this._DOMStream=void 0,this._nodeStream=void 0,this}open(e){let t=this._impl.open(e);return Oe(t)?t.then(()=>this):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Ze.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Ze.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw Error(`"throughNode" not available in this environment`)}static throughDOM(e,t){throw Error(`"throughDOM" not available in this environment`)}static from(t){return t instanceof e?t:je(t)?Yc(t):Ne(t)?Qc(t):Oe(t)?d(this,void 0,void 0,function*(){return yield e.from(yield t)}):Pe(t)||Ie(t)||Le(t)||Ae(t)?Zc(new Ts(t)):Xc(new ws(t))}static readAll(t){return t instanceof e?t.isSync()?qc(t):Jc(t):je(t)||ArrayBuffer.isView(t)||ke(t)||Me(t)?qc(t):Jc(t)}},Ic=class extends Fc{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return ve(this,arguments,function*(){yield f(yield*ye(be(this[Symbol.iterator]())))})}},Lc=class extends Fc{constructor(e){super(e),this._impl=e}readAll(){return d(this,void 0,void 0,function*(){var e,t,n,r;let i=[];try{for(var a=!0,o=be(this),s;s=yield o.next(),e=s.done,!e;a=!0){r=s.value,a=!1;let e=r;i.push(e)}}catch(e){t={error:e}}finally{try{!a&&!e&&(n=o.return)&&(yield n.call(o))}finally{if(t)throw t.error}}return i})}[Symbol.iterator](){throw Error(`AsyncRecordBatchStreamReader is not Iterable`)}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Rc=class extends Ic{constructor(e){super(e),this._impl=e}},zc=class extends Lc{constructor(e){super(e),this._impl=e}},Bc=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,t,n){let r;if(e.compression!=null){let n=Pc.get(e.compression.type);if(n?.decode&&typeof n.decode==`function`){let{decommpressedBody:i,buffers:a}=this._decompressBuffers(e,t,n);r=this._loadCompressedVectors(e,i,this.schema.fields),e=new Uo(e.length,e.nodes,a,null)}else throw Error(`Record batch is compressed but codec not found`)}else r=this._loadVectors(e,t,this.schema.fields);let i=I({type:new O(this.schema.fields),length:e.length,children:r});return new J(this.schema,i,n)}_loadDictionaryBatch(e,t){let{id:n,isDelta:r}=e,{dictionaries:i,schema:a}=this,o=i.get(n),s=a.dictionaries.get(n),c;if(e.data.compression!=null){let i=Pc.get(e.data.compression.type);if(i?.decode&&typeof i.decode==`function`){let{decommpressedBody:a,buffers:o}=this._decompressBuffers(e.data,t,i);c=this._loadCompressedVectors(e.data,a,[s]),e=new Wo(new Uo(e.data.length,e.data.nodes,o,null,e.data.variadicBufferCounts),n,r)}else throw Error(`Dictionary batch is compressed but codec not found`)}else c=this._loadVectors(e.data,t,[s]);return(o&&r?o.concat(new V(c)):new V(c)).memoize()}_loadVectors(e,t,n){return new Ls(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}_loadCompressedVectors(e,t,n){return new Ws(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}_decompressBuffers(e,t,n){let r=[],i=[],a=0;for(let{offset:o,length:s}of e.buffers){if(s===0){r.push(new Uint8Array),i.push(new Go(a,0));continue}let e=new ft(t.subarray(o,o+s)),c=w(e.readInt64(0)),l=e.bytes().subarray(8),u=c===-1?l:n.decode(l);r.push(u);let ee=(a+7&-8)-a;a+=ee,i.push(new Go(a,u.length)),a+=u.length}return{decommpressedBody:r,buffers:i}}},Vc=class extends Bc{constructor(e,t){super(t),this._reader=je(e)?new Tc(this._handle=e):new Cc(this._handle=e)}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(e){return this.closed||(this.autoDestroy=Kc(this,e),(this.schema||=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):W}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):W}next(){if(this.closed)return W;let e,{_reader:t}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r,e.metadata)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new vc(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}},Hc=class extends Bc{constructor(e,t){super(t),this._reader=new wc(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return d(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return d(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Kc(this,e),(this.schema||=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return d(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):W})}return(e){return d(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):W})}next(){return d(this,void 0,void 0,function*(){if(this.closed)return W;let e,{_reader:t}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(n,r,e.metadata)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;let n=e.header(),r=yield t.readMessageBody(e.bodyLength),i=this._loadDictionaryBatch(n,r);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new vc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return d(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}},Uc=class extends Vc{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,t){super(e instanceof Os?e:new Os(e),t)}isSync(){return!0}isFile(){return!0}open(e){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(e)}readRecordBatch(e){if(this.closed)return null;this._footer||this.open();let t=this._footer?.getRecordBatch(e);if(t&&this._handle.seek(t.offset)){let e=this._reader.readMessage(S.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength);return this._loadRecordBatch(t,n,e.metadata)}}return null}_readDictionaryBatch(e){let t=this._footer?.getDictionaryBatch(e);if(t&&this._handle.seek(t.offset)){let e=this._reader.readMessage(S.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}}_readFooter(){let{_handle:e}=this,t=e.size-kc,n=e.readInt32(t),r=e.readAt(t-n,n);return So.decode(r)}_readNextMessageAndValidate(e){if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let t=this._footer?.getRecordBatch(this._recordBatchIndex);if(t&&this._handle.seek(t.offset))return this._reader.readMessage(e)}return null}},Wc=class extends Hc{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,...t){let n=typeof t[0]==`number`?void 0:t.shift(),r=t[0]instanceof Map?t.shift():void 0;super(e instanceof ks?e:new ks(e,n),r)}isFile(){return!0}isAsync(){return!0}open(e){let t=Object.create(null,{open:{get:()=>super.open}});return d(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield t.open.call(this,e)})}readRecordBatch(e){return d(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let t=this._footer?.getRecordBatch(e);if(t&&(yield this._handle.seek(t.offset))){let e=yield this._reader.readMessage(S.RecordBatch);if(e?.isRecordBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength);return this._loadRecordBatch(t,n,e.metadata)}}return null})}_readDictionaryBatch(e){return d(this,void 0,void 0,function*(){let t=this._footer?.getDictionaryBatch(e);if(t&&(yield this._handle.seek(t.offset))){let e=yield this._reader.readMessage(S.DictionaryBatch);if(e?.isDictionaryBatch()){let t=e.header(),n=yield this._reader.readMessageBody(e.bodyLength),r=this._loadDictionaryBatch(t,n);this.dictionaries.set(t.id,r)}}})}_readFooter(){return d(this,void 0,void 0,function*(){let{_handle:e}=this;e._pending&&(yield e._pending);let t=e.size-kc,n=yield e.readInt32(t),r=yield e.readAt(t-n,n);return So.decode(r)})}_readNextMessageAndValidate(e){return d(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let t=this._footer.getRecordBatch(this._recordBatchIndex);if(t&&(yield this._handle.seek(t.offset)))return yield this._reader.readMessage(e)}return null})}},Gc=class extends Vc{constructor(e,t){super(e,t)}_loadVectors(e,t,n){return new Rs(t,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion,e.variadicBufferCounts).visitMany(n)}};function Kc(e,t){return t&&typeof t.autoDestroy==`boolean`?t.autoDestroy:e.autoDestroy}function*qc(e){let t=Fc.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Jc(e){return ve(this,arguments,function*(){let t=yield f(Fc.from(e));try{if(!(yield f(t.open({autoDestroy:!1}))).closed)do yield yield f(t);while(!(yield f(t.reset().open())).closed)}finally{yield f(t.cancel())}})}function Yc(e){return new Ic(new Gc(e))}function Xc(e){let t=e.peek(Oc+7&-8);return t&&t.byteLength>=4?Dc(t)?new Rc(new Uc(e.read())):new Ic(new Vc(e)):new Ic(new Vc(function*(){}()))}function Zc(e){return d(this,void 0,void 0,function*(){let t=yield e.peek(Oc+7&-8);return t&&t.byteLength>=4?Dc(t)?new Rc(new Uc(yield e.read())):new Lc(new Hc(e)):new Lc(new Hc(function(){return ve(this,arguments,function*(){})}()))})}function Qc(e){return d(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new ks(e,t);return t>=Ac&&Dc(yield n.readAt(0,Oc+7&-8))?new zc(new Wc(n)):new Lc(new Hc(n))})}function $c(e){let t=Fc.from(e);return Oe(t)?t.then(e=>$c(e)):t.isAsync()?t.readAll().then(e=>new pc(e)):new pc(t.readAll())}let Y,el=null;function tl(){return(el===null||el.byteLength===0)&&(el=new Uint8Array(Y.memory.buffer)),el}let nl=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});nl.decode();let rl=0;function il(e,t){return rl+=t,rl>=2146435072&&(nl=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),nl.decode(),rl=t),nl.decode(tl().subarray(e,e+t))}function al(e,t){return e>>>=0,il(e,t)}let X=0;const ol=new TextEncoder;`encodeInto`in ol||(ol.encodeInto=function(e,t){let n=ol.encode(e);return t.set(n),{read:e.length,written:n.length}});function sl(e,t,n){if(n===void 0){let n=ol.encode(e),r=t(n.length,1)>>>0;return tl().subarray(r,r+n.length).set(n),X=n.length,r}let r=e.length,i=t(r,1)>>>0,a=tl(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=tl().subarray(i+o,i+r),a=ol.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return X=o,i}let cl=null;function ll(){return(cl===null||cl.buffer.detached===!0||cl.buffer.detached===void 0&&cl.buffer!==Y.memory.buffer)&&(cl=new DataView(Y.memory.buffer)),cl}function ul(e){let t=Y.__externref_table_alloc();return Y.__wbindgen_export_4.set(t,e),t}function Z(e,t){try{return e.apply(this,t)}catch(e){let t=ul(e);Y.__wbindgen_exn_store(t)}}function Q(e){return e==null}function dl(e,t){return e>>>=0,tl().subarray(e/1,e/1+t)}function fl(e){let t=typeof e;if(t==`number`||t==`boolean`||e==null)return`${e}`;if(t==`string`)return`"${e}"`;if(t==`symbol`){let t=e.description;return t==null?`Symbol`:`Symbol(${t})`}if(t==`function`){let t=e.name;return typeof t==`string`&&t.length>0?`Function(${t})`:`Function`}if(Array.isArray(e)){let t=e.length,n=`[`;t>0&&(n+=fl(e[0]));for(let r=1;r<t;r++)n+=`, `+fl(e[r]);return n+=`]`,n}let n=/\[object ([^\]]+)\]/.exec(toString.call(e)),r;if(n&&n.length>1)r=n[1];else return toString.call(e);if(r==`Object`)try{return`Object(`+JSON.stringify(e)+`)`}catch{return`Object`}return e instanceof Error?`${e.name}: ${e.message}\n${e.stack}`:r}const pl=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>{Y.__wbindgen_export_5.get(e.dtor)(e.a,e.b)});function ml(e,t,n,r){let i={a:e,b:t,cnt:1,dtor:n},a=(...e)=>{i.cnt++;let t=i.a;i.a=0;try{return r(t,i.b,...e)}finally{--i.cnt===0?(Y.__wbindgen_export_5.get(i.dtor)(t,i.b),pl.unregister(i)):i.a=t}};return a.original=i,pl.register(a,i,i),a}function $(e){let t=Y.__wbindgen_export_4.get(e);return Y.__externref_table_dealloc(e),t}function hl(e,t){e>>>=0;let n=ll(),r=[];for(let i=e;i<e+4*t;i+=4)r.push(Y.__wbindgen_export_4.get(n.getUint32(i,!0)));return Y.__externref_drop_slice(e,t),r}function gl(e,t){if(!(e instanceof t))throw Error(`expected instance of ${t.name}`)}function _l(e,t){let n=t(e.length*1,1)>>>0;return tl().set(e,n/1),X=e.length,n}function vl(e,t){let n=_l(e,Y.__wbindgen_malloc),r=X,i=Y.readParquet(n,r,Q(t)?0:ul(t));if(i[2])throw $(i[1]);return nu.__wrap(i[0])}let yl=null;function bl(){return(yl===null||yl.byteLength===0)&&(yl=new Uint32Array(Y.memory.buffer)),yl}function xl(e,t){return e>>>=0,bl().subarray(e/4,e/4+t)}function Sl(e,t,n){Y.closure3806_externref_shim(e,t,n)}function Cl(e,t){Y.wasm_bindgen__convert__closures_____invoke__h7767827484ad8911(e,t)}function wl(e,t,n,r){Y.closure3830_externref_shim(e,t,n,r)}Object.freeze({UNCOMPRESSED:0,0:`UNCOMPRESSED`,SNAPPY:1,1:`SNAPPY`,GZIP:2,2:`GZIP`,BROTLI:3,3:`BROTLI`,LZ4:4,4:`LZ4`,ZSTD:5,5:`ZSTD`,LZ4_RAW:6,6:`LZ4_RAW`,LZO:7,7:`LZO`}),Object.freeze({None:0,0:`None`,Chunk:1,1:`Chunk`,Page:2,2:`Page`}),Object.freeze({PLAIN:0,0:`PLAIN`,PLAIN_DICTIONARY:1,1:`PLAIN_DICTIONARY`,RLE:2,2:`RLE`,BIT_PACKED:3,3:`BIT_PACKED`,DELTA_BINARY_PACKED:4,4:`DELTA_BINARY_PACKED`,DELTA_LENGTH_BYTE_ARRAY:5,5:`DELTA_LENGTH_BYTE_ARRAY`,DELTA_BYTE_ARRAY:6,6:`DELTA_BYTE_ARRAY`,RLE_DICTIONARY:7,7:`RLE_DICTIONARY`,BYTE_STREAM_SPLIT:8,8:`BYTE_STREAM_SPLIT`}),Object.freeze({V1:0,0:`V1`,V2:1,1:`V2`});const Tl=[`bytes`],El=[`default`,`no-store`,`reload`,`no-cache`,`force-cache`,`only-if-cached`],Dl=[`omit`,`same-origin`,`include`],Ol=[`same-origin`,`no-cors`,`cors`,`navigate`],kl=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_columnchunkmetadata_free(e>>>0,1));var Al=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,kl.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,kl.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_columnchunkmetadata_free(e,0)}numValues(){return Y.columnchunkmetadata_numValues(this.__wbg_ptr)}columnPath(){let e=Y.columnchunkmetadata_columnPath(this.__wbg_ptr);var t=hl(e[0],e[1]).slice();return Y.__wbindgen_free(e[0],e[1]*4,4),t}compression(){return Y.columnchunkmetadata_compression(this.__wbg_ptr)}fileOffset(){return Y.columnchunkmetadata_fileOffset(this.__wbg_ptr)}compressedSize(){return Y.columnchunkmetadata_compressedSize(this.__wbg_ptr)}uncompressedSize(){return Y.columnchunkmetadata_uncompressedSize(this.__wbg_ptr)}encodings(){let e=Y.columnchunkmetadata_encodings(this.__wbg_ptr);var t=hl(e[0],e[1]).slice();return Y.__wbindgen_free(e[0],e[1]*4,4),t}filePath(){let e=Y.columnchunkmetadata_filePath(this.__wbg_ptr),t;return e[0]!==0&&(t=al(e[0],e[1]).slice(),Y.__wbindgen_free(e[0],e[1]*1,1)),t}};Symbol.dispose&&(Al.prototype[Symbol.dispose]=Al.prototype.free);const jl=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_ffidata_free(e>>>0,1));var Ml=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,jl.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,jl.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_ffidata_free(e,0)}arrayAddr(){return Y.ffidata_arrayAddr(this.__wbg_ptr)>>>0}schemaAddr(){return Y.ffidata_schemaAddr(this.__wbg_ptr)>>>0}};Symbol.dispose&&(Ml.prototype[Symbol.dispose]=Ml.prototype.free);const Nl=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_ffischema_free(e>>>0,1));var Pl=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Nl.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Nl.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_ffischema_free(e,0)}addr(){return Y.ffischema_addr(this.__wbg_ptr)>>>0}};Symbol.dispose&&(Pl.prototype[Symbol.dispose]=Pl.prototype.free);const Fl=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_ffistream_free(e>>>0,1));var Il=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Fl.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Fl.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_ffistream_free(e,0)}arrayAddr(e){return Y.ffistream_arrayAddr(this.__wbg_ptr,e)>>>0}numArrays(){return Y.ffistream_numArrays(this.__wbg_ptr)>>>0}arrayAddrs(){let e=Y.ffistream_arrayAddrs(this.__wbg_ptr);var t=xl(e[0],e[1]).slice();return Y.__wbindgen_free(e[0],e[1]*4,4),t}schemaAddr(){return Y.ffistream_schemaAddr(this.__wbg_ptr)>>>0}drop(){let e=this.__destroy_into_raw();Y.ffistream_drop(e)}};Symbol.dispose&&(Il.prototype[Symbol.dispose]=Il.prototype.free);const Ll=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_filemetadata_free(e>>>0,1));var Rl=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ll.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ll.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_filemetadata_free(e,0)}createdBy(){let e=Y.filemetadata_createdBy(this.__wbg_ptr),t;return e[0]!==0&&(t=al(e[0],e[1]).slice(),Y.__wbindgen_free(e[0],e[1]*1,1)),t}keyValueMetadata(){let e=Y.filemetadata_keyValueMetadata(this.__wbg_ptr);if(e[2])throw $(e[1]);return $(e[0])}version(){return Y.filemetadata_version(this.__wbg_ptr)}numRows(){return Y.filemetadata_numRows(this.__wbg_ptr)}};Symbol.dispose&&(Rl.prototype[Symbol.dispose]=Rl.prototype.free);const zl=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_intounderlyingbytesource_free(e>>>0,1));var Bl=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,zl.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_intounderlyingbytesource_free(e,0)}get autoAllocateChunkSize(){return Y.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr)>>>0}pull(e){return Y.intounderlyingbytesource_pull(this.__wbg_ptr,e)}start(e){Y.intounderlyingbytesource_start(this.__wbg_ptr,e)}get type(){let e=Y.intounderlyingbytesource_type(this.__wbg_ptr);return Tl[e]}cancel(){let e=this.__destroy_into_raw();Y.intounderlyingbytesource_cancel(e)}};Symbol.dispose&&(Bl.prototype[Symbol.dispose]=Bl.prototype.free);const Vl=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_intounderlyingsink_free(e>>>0,1));var Hl=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Vl.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_intounderlyingsink_free(e,0)}abort(e){let t=this.__destroy_into_raw();return Y.intounderlyingsink_abort(t,e)}close(){let e=this.__destroy_into_raw();return Y.intounderlyingsink_close(e)}write(e){return Y.intounderlyingsink_write(this.__wbg_ptr,e)}};Symbol.dispose&&(Hl.prototype[Symbol.dispose]=Hl.prototype.free);const Ul=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_intounderlyingsource_free(e>>>0,1));var Wl=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Ul.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Ul.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_intounderlyingsource_free(e,0)}pull(e){return Y.intounderlyingsource_pull(this.__wbg_ptr,e)}cancel(){let e=this.__destroy_into_raw();Y.intounderlyingsource_cancel(e)}};Symbol.dispose&&(Wl.prototype[Symbol.dispose]=Wl.prototype.free);const Gl=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_parquetfile_free(e>>>0,1));var Kl=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Gl.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Gl.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_parquetfile_free(e,0)}read(e){return Y.parquetfile_read(this.__wbg_ptr,Q(e)?0:ul(e))}schema(){let e=Y.parquetfile_schema(this.__wbg_ptr);if(e[2])throw $(e[1]);return eu.__wrap(e[0])}stream(e){return Y.parquetfile_stream(this.__wbg_ptr,Q(e)?0:ul(e))}static fromUrl(e){let t=sl(e,Y.__wbindgen_malloc,Y.__wbindgen_realloc),n=X;return Y.parquetfile_fromUrl(t,n)}metadata(){let e=Y.parquetfile_metadata(this.__wbg_ptr);if(e[2])throw $(e[1]);return Jl.__wrap(e[0])}static fromFile(e){return Y.parquetfile_fromFile(e)}};Symbol.dispose&&(Kl.prototype[Symbol.dispose]=Kl.prototype.free);const ql=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_parquetmetadata_free(e>>>0,1));var Jl=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,ql.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ql.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_parquetmetadata_free(e,0)}rowGroups(){let e=Y.parquetmetadata_rowGroups(this.__wbg_ptr);var t=hl(e[0],e[1]).slice();return Y.__wbindgen_free(e[0],e[1]*4,4),t}fileMetadata(){let e=Y.parquetmetadata_fileMetadata(this.__wbg_ptr);return Rl.__wrap(e)}numRowGroups(){return Y.parquetmetadata_numRowGroups(this.__wbg_ptr)>>>0}rowGroup(e){let t=Y.parquetmetadata_rowGroup(this.__wbg_ptr,e);return Ql.__wrap(t)}};Symbol.dispose&&(Jl.prototype[Symbol.dispose]=Jl.prototype.free);const Yl=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_recordbatch_free(e>>>0,1));var Xl=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Yl.register(n,n.__wbg_ptr,n),n}static __unwrap(t){return t instanceof e?t.__destroy_into_raw():0}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Yl.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_recordbatch_free(e,0)}get numColumns(){return Y.recordbatch_numColumns(this.__wbg_ptr)>>>0}withSchema(t){gl(t,eu);var n=t.__destroy_into_raw();let r=Y.recordbatch_withSchema(this.__wbg_ptr,n);if(r[2])throw $(r[1]);return e.__wrap(r[0])}intoIPCStream(){let e=this.__destroy_into_raw(),t=Y.recordbatch_intoIPCStream(e);if(t[3])throw $(t[2]);var n=dl(t[0],t[1]).slice();return Y.__wbindgen_free(t[0],t[1]*1,1),n}getArrayMemorySize(){return Y.recordbatch_getArrayMemorySize(this.__wbg_ptr)>>>0}slice(t,n){let r=Y.recordbatch_slice(this.__wbg_ptr,t,n);return e.__wrap(r)}get schema(){let e=Y.recordbatch_schema(this.__wbg_ptr);return eu.__wrap(e)}toFFI(){let e=Y.recordbatch_toFFI(this.__wbg_ptr);if(e[2])throw $(e[1]);return Ml.__wrap(e[0])}intoFFI(){let e=this.__destroy_into_raw(),t=Y.recordbatch_intoFFI(e);if(t[2])throw $(t[1]);return Ml.__wrap(t[0])}get numRows(){return Y.recordbatch_numRows(this.__wbg_ptr)>>>0}};Symbol.dispose&&(Xl.prototype[Symbol.dispose]=Xl.prototype.free);const Zl=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_rowgroupmetadata_free(e>>>0,1));var Ql=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,Zl.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,Zl.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_rowgroupmetadata_free(e,0)}numColumns(){return Y.rowgroupmetadata_numColumns(this.__wbg_ptr)>>>0}compressedSize(){return Y.rowgroupmetadata_compressedSize(this.__wbg_ptr)}totalByteSize(){return Y.rowgroupmetadata_totalByteSize(this.__wbg_ptr)}column(e){let t=Y.rowgroupmetadata_column(this.__wbg_ptr,e);return Al.__wrap(t)}columns(){let e=Y.rowgroupmetadata_columns(this.__wbg_ptr);var t=hl(e[0],e[1]).slice();return Y.__wbindgen_free(e[0],e[1]*4,4),t}numRows(){return Y.rowgroupmetadata_numRows(this.__wbg_ptr)}};Symbol.dispose&&(Ql.prototype[Symbol.dispose]=Ql.prototype.free);const $l=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_schema_free(e>>>0,1));var eu=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,$l.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,$l.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_schema_free(e,0)}withMetadata(t){let n=Y.schema_withMetadata(this.__wbg_ptr,t);if(n[2])throw $(n[1]);return e.__wrap(n[0])}intoIPCStream(){let e=this.__destroy_into_raw(),t=Y.schema_intoIPCStream(e);if(t[3])throw $(t[2]);var n=dl(t[0],t[1]).slice();return Y.__wbindgen_free(t[0],t[1]*1,1),n}toFFI(){let e=Y.schema_toFFI(this.__wbg_ptr);if(e[2])throw $(e[1]);return Pl.__wrap(e[0])}indexOf(e){let t=sl(e,Y.__wbindgen_malloc,Y.__wbindgen_realloc),n=X,r=Y.schema_indexOf(this.__wbg_ptr,t,n);if(r[2])throw $(r[1]);return r[0]>>>0}intoFFI(){let e=this.__destroy_into_raw(),t=Y.schema_intoFFI(e);if(t[2])throw $(t[1]);return Pl.__wrap(t[0])}metadata(){let e=Y.schema_metadata(this.__wbg_ptr);if(e[2])throw $(e[1]);return $(e[0])}};Symbol.dispose&&(eu.prototype[Symbol.dispose]=eu.prototype.free);const tu=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_table_free(e>>>0,1));var nu=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,tu.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,tu.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_table_free(e,0)}get numBatches(){return Y.table_numBatches(this.__wbg_ptr)>>>0}recordBatch(e){let t=Y.table_recordBatch(this.__wbg_ptr,e);return t===0?void 0:Xl.__wrap(t)}recordBatches(){let e=Y.table_recordBatches(this.__wbg_ptr);var t=hl(e[0],e[1]).slice();return Y.__wbindgen_free(e[0],e[1]*4,4),t}static fromIPCStream(t){let n=_l(t,Y.__wbindgen_malloc),r=X,i=Y.table_fromIPCStream(n,r);if(i[2])throw $(i[1]);return e.__wrap(i[0])}intoIPCStream(){let e=this.__destroy_into_raw(),t=Y.table_intoIPCStream(e);if(t[3])throw $(t[2]);var n=dl(t[0],t[1]).slice();return Y.__wbindgen_free(t[0],t[1]*1,1),n}getArrayMemorySize(){return Y.table_getArrayMemorySize(this.__wbg_ptr)>>>0}get schema(){let e=Y.table_schema(this.__wbg_ptr);return eu.__wrap(e)}toFFI(){let e=Y.table_toFFI(this.__wbg_ptr);if(e[2])throw $(e[1]);return Il.__wrap(e[0])}intoFFI(){let e=this.__destroy_into_raw(),t=Y.table_intoFFI(e);if(t[2])throw $(t[1]);return Il.__wrap(t[0])}};Symbol.dispose&&(nu.prototype[Symbol.dispose]=nu.prototype.free);const ru=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_writerproperties_free(e>>>0,1));var iu=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,ru.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,ru.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_writerproperties_free(e,0)}};Symbol.dispose&&(iu.prototype[Symbol.dispose]=iu.prototype.free);const au=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>Y.__wbg_writerpropertiesbuilder_free(e>>>0,1));var ou=class e{static __wrap(t){t>>>=0;let n=Object.create(e.prototype);return n.__wbg_ptr=t,au.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,au.unregister(this),e}free(){let e=this.__destroy_into_raw();Y.__wbg_writerpropertiesbuilder_free(e,0)}setEncoding(t){let n=this.__destroy_into_raw(),r=Y.writerpropertiesbuilder_setEncoding(n,t);return e.__wrap(r)}setCreatedBy(t){let n=this.__destroy_into_raw(),r=sl(t,Y.__wbindgen_malloc,Y.__wbindgen_realloc),i=X,a=Y.writerpropertiesbuilder_setCreatedBy(n,r,i);return e.__wrap(a)}setCompression(t){let n=this.__destroy_into_raw(),r=Y.writerpropertiesbuilder_setCompression(n,t);return e.__wrap(r)}setWriterVersion(t){let n=this.__destroy_into_raw(),r=Y.writerpropertiesbuilder_setWriterVersion(n,t);return e.__wrap(r)}setColumnEncoding(t,n){let r=this.__destroy_into_raw(),i=sl(t,Y.__wbindgen_malloc,Y.__wbindgen_realloc),a=X,o=Y.writerpropertiesbuilder_setColumnEncoding(r,i,a,n);return e.__wrap(o)}setWriteBatchSize(t){let n=this.__destroy_into_raw(),r=Y.writerpropertiesbuilder_setWriteBatchSize(n,t);return e.__wrap(r)}setColumnCompression(t,n){let r=this.__destroy_into_raw(),i=sl(t,Y.__wbindgen_malloc,Y.__wbindgen_realloc),a=X,o=Y.writerpropertiesbuilder_setColumnCompression(r,i,a,n);return e.__wrap(o)}setDictionaryEnabled(t){let n=this.__destroy_into_raw(),r=Y.writerpropertiesbuilder_setDictionaryEnabled(n,t);return e.__wrap(r)}setKeyValueMetadata(t){let n=this.__destroy_into_raw(),r=Y.writerpropertiesbuilder_setKeyValueMetadata(n,t);if(r[2])throw $(r[1]);return e.__wrap(r[0])}setMaxRowGroupSize(t){let n=this.__destroy_into_raw(),r=Y.writerpropertiesbuilder_setMaxRowGroupSize(n,t);return e.__wrap(r)}setStatisticsEnabled(t){let n=this.__destroy_into_raw(),r=Y.writerpropertiesbuilder_setStatisticsEnabled(n,t);return e.__wrap(r)}setDataPageSizeLimit(t){let n=this.__destroy_into_raw(),r=Y.writerpropertiesbuilder_setDataPageSizeLimit(n,t);return e.__wrap(r)}setColumnDictionaryEnabled(t,n){let r=this.__destroy_into_raw(),i=sl(t,Y.__wbindgen_malloc,Y.__wbindgen_realloc),a=X,o=Y.writerpropertiesbuilder_setColumnDictionaryEnabled(r,i,a,n);return e.__wrap(o)}setColumnStatisticsEnabled(t,n){let r=this.__destroy_into_raw(),i=sl(t,Y.__wbindgen_malloc,Y.__wbindgen_realloc),a=X,o=Y.writerpropertiesbuilder_setColumnStatisticsEnabled(r,i,a,n);return e.__wrap(o)}setDictionaryPageSizeLimit(t){let n=this.__destroy_into_raw(),r=Y.writerpropertiesbuilder_setDictionaryPageSizeLimit(n,t);return e.__wrap(r)}constructor(){let e=Y.writerpropertiesbuilder_new();return this.__wbg_ptr=e>>>0,au.register(this,this.__wbg_ptr,this),this}build(){let e=this.__destroy_into_raw(),t=Y.writerpropertiesbuilder_build(e);return iu.__wrap(t)}};Symbol.dispose&&(ou.prototype[Symbol.dispose]=ou.prototype.free);const su=new Set([`basic`,`cors`,`default`]);async function cu(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&su.has(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t);else throw t}let n=await e.arrayBuffer();return await WebAssembly.instantiate(n,t)}{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}}function lu(){let e={};return e.wbg={},e.wbg.__wbg_Error_e17e777aac105295=function(e,t){return Error(al(e,t))},e.wbg.__wbg_Number_998bea33bd87c3e0=function(e){return Number(e)},e.wbg.__wbg_String_8f0eb39a4a4c2f66=function(e,t){let n=sl(String(t),Y.__wbindgen_malloc,Y.__wbindgen_realloc),r=X;ll().setInt32(e+4,r,!0),ll().setInt32(e+0,n,!0)},e.wbg.__wbg_abort_67e1b49bf6614565=function(e){e.abort()},e.wbg.__wbg_abort_d830bf2e9aa6ec5b=function(e,t){e.abort(t)},e.wbg.__wbg_append_72a3c0addd2bce38=function(){return Z(function(e,t,n,r,i){e.append(al(t,n),al(r,i))},arguments)},e.wbg.__wbg_arrayBuffer_2c907ed8e8ef4e35=function(e){return e.arrayBuffer()},e.wbg.__wbg_arrayBuffer_9c99b8e2809e8cbb=function(){return Z(function(e){return e.arrayBuffer()},arguments)},e.wbg.__wbg_buffer_8d40b1d762fb3c66=function(e){return e.buffer},e.wbg.__wbg_byobRequest_2c036bceca1e6037=function(e){let t=e.byobRequest;return Q(t)?0:ul(t)},e.wbg.__wbg_byteLength_331a6b5545834024=function(e){return e.byteLength},e.wbg.__wbg_byteOffset_49a5b5608000358b=function(e){return e.byteOffset},e.wbg.__wbg_call_13410aac570ffff7=function(){return Z(function(e,t){return e.call(t)},arguments)},e.wbg.__wbg_call_a5400b25a865cfd8=function(){return Z(function(e,t,n){return e.call(t,n)},arguments)},e.wbg.__wbg_cancel_8bb5b8f4906b658a=function(e){return e.cancel()},e.wbg.__wbg_catch_c80ecae90cb8ed4e=function(e,t){return e.catch(t)},e.wbg.__wbg_clearTimeout_6222fede17abcb1a=function(e){return clearTimeout(e)},e.wbg.__wbg_close_a1918cff3cac355b=function(e){return e.close()},e.wbg.__wbg_close_cccada6053ee3a65=function(){return Z(function(e){e.close()},arguments)},e.wbg.__wbg_close_d71a78219dc23e91=function(){return Z(function(e){e.close()},arguments)},e.wbg.__wbg_columnchunkmetadata_new=function(e){return Al.__wrap(e)},e.wbg.__wbg_done_75ed0ee6dd243d9d=function(e){return e.done},e.wbg.__wbg_enqueue_452bc2343d1c2ff9=function(){return Z(function(e,t){e.enqueue(t)},arguments)},e.wbg.__wbg_entries_2be2f15bd5554996=function(e){return Object.entries(e)},e.wbg.__wbg_fetch_87aed7f306ec6d63=function(e,t){return e.fetch(t)},e.wbg.__wbg_fetch_f156d10be9a5c88a=function(e){return fetch(e)},e.wbg.__wbg_getReader_48e00749fe3f6089=function(){return Z(function(e){return e.getReader()},arguments)},e.wbg.__wbg_getWriter_03d7689e275ac6a4=function(){return Z(function(e){return e.getWriter()},arguments)},e.wbg.__wbg_get_0da715ceaecea5c8=function(e,t){return e[t>>>0]},e.wbg.__wbg_get_458e874b43b18b25=function(){return Z(function(e,t){return Reflect.get(e,t)},arguments)},e.wbg.__wbg_getdone_f026246f6bbe58d3=function(e){let t=e.done;return Q(t)?16777215:+!!t},e.wbg.__wbg_getvalue_31e5a08f61e5aa42=function(e){return e.value},e.wbg.__wbg_getwithrefkey_1dc361bd10053bfe=function(e,t){return e[t]},e.wbg.__wbg_has_b89e451f638123e3=function(){return Z(function(e,t){return Reflect.has(e,t)},arguments)},e.wbg.__wbg_headers_29fec3c72865cd75=function(e){return e.headers},e.wbg.__wbg_instanceof_ArrayBuffer_67f3012529f6a2dd=function(e){let t;try{t=e instanceof ArrayBuffer}catch{t=!1}return t},e.wbg.__wbg_instanceof_Response_50fde2cd696850bf=function(e){let t;try{t=e instanceof Response}catch{t=!1}return t},e.wbg.__wbg_instanceof_Uint8Array_9a8378d955933db7=function(e){let t;try{t=e instanceof Uint8Array}catch{t=!1}return t},e.wbg.__wbg_isArray_030cce220591fb41=function(e){return Array.isArray(e)},e.wbg.__wbg_isSafeInteger_1c0d1af5542e102a=function(e){return Number.isSafeInteger(e)},e.wbg.__wbg_iterator_f370b34483c71a1c=function(){return Symbol.iterator},e.wbg.__wbg_length_186546c51cd61acd=function(e){return e.length},e.wbg.__wbg_length_6bb7e81f9d7713e4=function(e){return e.length},e.wbg.__wbg_new_19c25a3f2fa63a02=function(){return{}},e.wbg.__wbg_new_2e3c58a15f39f5f9=function(e,t){try{var n={a:e,b:t};return new Promise((e,t)=>{let r=n.a;n.a=0;try{return wl(r,n.b,e,t)}finally{n.a=r}})}finally{n.a=n.b=0}},e.wbg.__wbg_new_2ff1f68f3676ea53=function(){return new Map},e.wbg.__wbg_new_638ebfaedbf32a5e=function(e){return new Uint8Array(e)},e.wbg.__wbg_new_66b9434b4e59b63e=function(){return Z(function(){return new AbortController},arguments)},e.wbg.__wbg_new_99a6a948d5b3f607=function(){return Z(function(){return new TransformStream},arguments)},e.wbg.__wbg_new_da9dc54c5db29dfa=function(e,t){return Error(al(e,t))},e.wbg.__wbg_new_f6e53210afea8e45=function(){return Z(function(){return new Headers},arguments)},e.wbg.__wbg_newfromslice_074c56947bd43469=function(e,t){return new Uint8Array(dl(e,t))},e.wbg.__wbg_newnoargs_254190557c45b4ec=function(e,t){return Function(al(e,t))},e.wbg.__wbg_newwithbyteoffset_6bd4b2a4ca518883=function(e,t){return new Uint8Array(e,t>>>0)},e.wbg.__wbg_newwithbyteoffsetandlength_e8f53910b4d42b45=function(e,t,n){return new Uint8Array(e,t>>>0,n>>>0)},e.wbg.__wbg_newwithintounderlyingsource_b47f6a6a596a7f24=function(e,t){return new ReadableStream(Wl.__wrap(e),t)},e.wbg.__wbg_newwithstrandinit_b5d168a29a3fd85f=function(){return Z(function(e,t,n){return new Request(al(e,t),n)},arguments)},e.wbg.__wbg_next_5b3530e612fde77d=function(e){return e.next},e.wbg.__wbg_next_692e82279131b03c=function(){return Z(function(e){return e.next()},arguments)},e.wbg.__wbg_parquetfile_new=function(e){return Kl.__wrap(e)},e.wbg.__wbg_prototypesetcall_3d4a26c1ed734349=function(e,t,n){Uint8Array.prototype.set.call(dl(e,t),n)},e.wbg.__wbg_queueMicrotask_25d0739ac89e8c88=function(e){queueMicrotask(e)},e.wbg.__wbg_queueMicrotask_4488407636f5bf24=function(e){return e.queueMicrotask},e.wbg.__wbg_read_bc925c758aa4d897=function(e){return e.read()},e.wbg.__wbg_readable_e82cff27b968ed1c=function(e){return e.readable},e.wbg.__wbg_ready_4186da3cb500ae7d=function(e){return e.ready},e.wbg.__wbg_recordbatch_new=function(e){return Xl.__wrap(e)},e.wbg.__wbg_recordbatch_unwrap=function(e){return Xl.__unwrap(e)},e.wbg.__wbg_releaseLock_62151472ae632176=function(e){e.releaseLock()},e.wbg.__wbg_releaseLock_ff29b586502a8221=function(e){e.releaseLock()},e.wbg.__wbg_resolve_4055c623acdd6a1b=function(e){return Promise.resolve(e)},e.wbg.__wbg_respond_6c2c4e20ef85138e=function(){return Z(function(e,t){e.respond(t>>>0)},arguments)},e.wbg.__wbg_rowgroupmetadata_new=function(e){return Ql.__wrap(e)},e.wbg.__wbg_setTimeout_2b339866a2aa3789=function(e,t){return setTimeout(e,t)},e.wbg.__wbg_set_1353b2a5e96bc48c=function(e,t,n){e.set(dl(t,n))},e.wbg.__wbg_set_3f1d0b984ed272ed=function(e,t,n){e[t]=n},e.wbg.__wbg_set_b7f1cf4fae26fe2a=function(e,t,n){return e.set(t,n)},e.wbg.__wbg_setbody_c8460bdf44147df8=function(e,t){e.body=t},e.wbg.__wbg_setcache_90ca4ad8a8ad40d3=function(e,t){e.cache=El[t]},e.wbg.__wbg_setcredentials_9cd60d632c9d5dfc=function(e,t){e.credentials=Dl[t]},e.wbg.__wbg_setheaders_0052283e2f3503d1=function(e,t){e.headers=t},e.wbg.__wbg_sethighwatermark_3d5961f834647d41=function(e,t){e.highWaterMark=t},e.wbg.__wbg_setmethod_9b504d5b855b329c=function(e,t,n){e.method=al(t,n)},e.wbg.__wbg_setmode_a23e1a2ad8b512f8=function(e,t){e.mode=Ol[t]},e.wbg.__wbg_setsignal_8c45ad1247a74809=function(e,t){e.signal=t},e.wbg.__wbg_signal_da4d466ce86118b5=function(e){return e.signal},e.wbg.__wbg_size_8f84e7768fba0589=function(e){return e.size},e.wbg.__wbg_slice_36c55c8c1a260c46=function(){return Z(function(e,t,n){return e.slice(t,n)},arguments)},e.wbg.__wbg_static_accessor_GLOBAL_8921f820c2ce3f12=function(){let e=typeof global>`u`?null:global;return Q(e)?0:ul(e)},e.wbg.__wbg_static_accessor_GLOBAL_THIS_f0a4409105898184=function(){let e=typeof globalThis>`u`?null:globalThis;return Q(e)?0:ul(e)},e.wbg.__wbg_static_accessor_SELF_995b214ae681ff99=function(){let e=typeof self>`u`?null:self;return Q(e)?0:ul(e)},e.wbg.__wbg_static_accessor_WINDOW_cde3890479c675ea=function(){let e=typeof window>`u`?null:window;return Q(e)?0:ul(e)},e.wbg.__wbg_status_3fea3036088621d6=function(e){return e.status},e.wbg.__wbg_stringify_b98c93d0a190446a=function(){return Z(function(e){return JSON.stringify(e)},arguments)},e.wbg.__wbg_table_new=function(e){return nu.__wrap(e)},e.wbg.__wbg_then_b33a773d723afa3e=function(e,t,n){return e.then(t,n)},e.wbg.__wbg_then_e22500defe16819f=function(e,t){return e.then(t)},e.wbg.__wbg_toString_78df35411a4fd40c=function(e){return e.toString()},e.wbg.__wbg_url_e5720dfacf77b05e=function(e,t){let n=t.url,r=sl(n,Y.__wbindgen_malloc,Y.__wbindgen_realloc),i=X;ll().setInt32(e+4,i,!0),ll().setInt32(e+0,r,!0)},e.wbg.__wbg_value_dd9372230531eade=function(e){return e.value},e.wbg.__wbg_view_91cc97d57ab30530=function(e){let t=e.view;return Q(t)?0:ul(t)},e.wbg.__wbg_wbindgenbigintgetasi64_ac743ece6ab9bba1=function(e,t){let n=t,r=typeof n==`bigint`?n:void 0;ll().setBigInt64(e+8,Q(r)?BigInt(0):r,!0),ll().setInt32(e+0,!Q(r),!0)},e.wbg.__wbg_wbindgenbooleanget_3fe6f642c7d97746=function(e){let t=e,n=typeof t==`boolean`?t:void 0;return Q(n)?16777215:+!!n},e.wbg.__wbg_wbindgencbdrop_eb10308566512b88=function(e){let t=e.original;return t.cnt--==1&&(t.a=0,!0)},e.wbg.__wbg_wbindgendebugstring_99ef257a3ddda34d=function(e,t){let n=sl(fl(t),Y.__wbindgen_malloc,Y.__wbindgen_realloc),r=X;ll().setInt32(e+4,r,!0),ll().setInt32(e+0,n,!0)},e.wbg.__wbg_wbindgenfunctiontable_aa1084b2969a9cbe=function(){return Y.__wbindgen_export_5},e.wbg.__wbg_wbindgenin_d7a1ee10933d2d55=function(e,t){return e in t},e.wbg.__wbg_wbindgenisbigint_ecb90cc08a5a9154=function(e){return typeof e==`bigint`},e.wbg.__wbg_wbindgenisfunction_8cee7dce3725ae74=function(e){return typeof e==`function`},e.wbg.__wbg_wbindgenisobject_307a53c6bd97fbf8=function(e){let t=e;return typeof t==`object`&&!!t},e.wbg.__wbg_wbindgenisstring_d4fa939789f003b0=function(e){return typeof e==`string`},e.wbg.__wbg_wbindgenisundefined_c4b71d073b92f3c5=function(e){return e===void 0},e.wbg.__wbg_wbindgenjsvaleq_e6f2ad59ccae1b58=function(e,t){return e===t},e.wbg.__wbg_wbindgenjsvallooseeq_9bec8c9be826bed1=function(e,t){return e==t},e.wbg.__wbg_wbindgenmemory_d84da70f7c42d172=function(){return Y.memory},e.wbg.__wbg_wbindgennumberget_f74b4c7525ac05cb=function(e,t){let n=t,r=typeof n==`number`?n:void 0;ll().setFloat64(e+8,Q(r)?0:r,!0),ll().setInt32(e+0,!Q(r),!0)},e.wbg.__wbg_wbindgenstringget_0f16a6ddddef376f=function(e,t){let n=t,r=typeof n==`string`?n:void 0;var i=Q(r)?0:sl(r,Y.__wbindgen_malloc,Y.__wbindgen_realloc),a=X;ll().setInt32(e+4,a,!0),ll().setInt32(e+0,i,!0)},e.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6=function(e,t){throw Error(al(e,t))},e.wbg.__wbg_writable_e5202c9fd57615db=function(e){return e.writable},e.wbg.__wbg_write_2e39e04a4c8c9e9d=function(e,t){return e.write(t)},e.wbg.__wbindgen_cast_2241b6af4c4b2941=function(e,t){return al(e,t)},e.wbg.__wbindgen_cast_3fa4d3e7d32dad96=function(e,t){return ml(e,t,339,Cl)},e.wbg.__wbindgen_cast_4625c577ab2ec9ee=function(e){return BigInt.asUintN(64,e)},e.wbg.__wbindgen_cast_5c484bf9528b29d7=function(e,t){return ml(e,t,3805,Sl)},e.wbg.__wbindgen_cast_d6cd19b81560fd6e=function(e){return e},e.wbg.__wbindgen_init_externref_table=function(){let e=Y.__wbindgen_export_4,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)},e}function uu(e,t){return Y=e.exports,du.__wbindgen_wasm_module=t,cl=null,yl=null,el=null,Y.__wbindgen_start(),Y}async function du(e){if(Y!==void 0)return Y;if(e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`)),e===void 0)throw Error(`This build requires an explicit parquet-wasm module_or_path.`);let t=lu();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await cu(await e,t);return uu(n,r)}let fu=!1,pu=null,mu=null,hu=null;const gu=new Promise((e,t)=>{mu=e,hu=t});let _u=null;self.onmessage=e=>{e.data.type===`init-wasm`?mu?.(e.data.wasmBuffer):e.data.type===`init-wasm-error`&&hu?.(Error(`Main thread failed to load WASM: ${e.data.message}`))};function vu(e){let t=0,n=Math.min(e.length,1e3);for(let r=0;r<n;r++)t=(t<<5)-t+e[r],t&=t;return t^e.length}function yu(e){return e&&e.length>0?[...e].sort().join(`,`):`all`}function bu(e){if(!e||typeof e!=`object`)return!1;let t=e;return!!(t.constructor?.name?.includes(`Array`)||typeof t.toArray==`function`)}function xu(e){return typeof e.toArray==`function`?e.toArray():Array.from(e)}function Su(e,t,n){if(!e)return 1;for(let r=t;r<n;r++){let t=e.get(r);if(t!=null){if(typeof t==`number`||typeof t==`bigint`)return 1;if(bu(t)){let e=xu(t);return Math.max(1,e.length)}return 1}}return 1}function Cu(e){return typeof e==`number`?Number.isFinite(e)?e:0:typeof e==`bigint`?Number(e):0}function wu(e){if(e==null)return e;if(typeof e==`bigint`)return Number(e);if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(typeof e==`object`){let t=e;if(`bytes`in t&&t.bytes!==null&&t.bytes!==void 0){let e=t.bytes;if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer||Array.isArray(e))return new Uint8Array(e);if(typeof e==`object`){let t=Object.entries(e).map(([e,t])=>[Number(e),t]).filter(([e])=>Number.isFinite(e)).sort((e,t)=>e[0]-t[0]);return new Uint8Array(t.map(([,e])=>e))}}if(`toUint8Array`in t&&typeof t.toUint8Array==`function`)return t.toUint8Array();if(`data`in t&&t.data instanceof Uint8Array)return t.data;if(bu(e))return xu(e).map(e=>wu(e))}return e}function Tu(e,t){let n=vl(e,t&&t.length>0?{columns:t}:{});if(!n)throw Error(`Failed to read parquet: wasmTable is null`);let r=n.intoIPCStream(),i=new Uint8Array(r),a=$c(i);return{bufferHash:vu(e),columnsKey:yu(t),table:a,arrowData:i}}function Eu(e,t){let n=vu(e),r=yu(t);return _u?.bufferHash===n&&_u.columnsKey===r||(_u=Tu(e,t)),_u}async function Du(){if(!fu)return pu||(pu=(async()=>{try{await du({module_or_path:await gu}),fu=!0}catch(e){throw console.error(`Worker: Failed to initialize WASM`,e),pu=null,e}})(),pu)}c({async readParquet(e,t){await Du();let n=new Uint8Array(e);if(n.length===0)throw Error(`Empty buffer passed to worker`);let r=Eu(n,t),i=new Uint8Array(r.arrowData);return de(i,[i.buffer])},async readNumericColumns(e,t,n,r){await Du();let i=Eu(new Uint8Array(e),t),a=Math.max(0,n),o=r<=0?i.table.numRows:Math.min(r,i.table.numRows),s=Math.max(a,o),c=s-a,l={},u=[];return t.forEach(e=>{let t=i.table.getChild(e),n=Su(t,a,s),r=new Float64Array(c*n);for(let e=a;e<s;e++){let i=(e-a)*n,o=t?.get(e);if(bu(o)){let e=xu(o);for(let t=0;t<n;t++)r[i+t]=Cu(e[t])}else r[i]=Cu(o)}l[e]={values:r.buffer,rows:c,width:n},u.push(r.buffer)}),de(l,u)},async readFeatureData(e,t,n,r){await Du();let i=Eu(new Uint8Array(e),t),a=Math.max(0,n),o=r<=0?i.table.numRows:Math.min(r,i.table.numRows),s=Math.max(a,o),c={};return t.forEach(e=>{let t=i.table.getChild(e),n=[];for(let e=a;e<s;e++)n.push(wu(t?.get(e)));c[e]=n}),c},async clearCache(){_u=null}});