File size: 166,593 Bytes
78c921d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.
(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
    typeof define === 'function' && define.amd ? define(['exports'], factory) :
    (factory(global.Arrow = global.Arrow || {}));
}(this, (function (exports) {var h;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}var ba="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
function ca(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var da=ca(this);function ea(a,b){if(b)a:{var c=da;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&ba(c,a,{configurable:!0,writable:!0,value:b})}}
ea("Symbol",function(a){function b(f){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(f||"")+"_"+e++,f)}function c(f,g){this.Gb=f;ba(this,"description",{configurable:!0,writable:!0,value:g})}if(a)return a;c.prototype.toString=function(){return this.Gb};var d="jscomp_symbol_"+(1E9*Math.random()>>>0)+"_",e=0;return b});
ea("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=da[b[c]];"function"===typeof d&&"function"!=typeof d.prototype[a]&&ba(d.prototype,a,{configurable:!0,writable:!0,value:function(){return fa(aa(this))}})}return a});ea("Symbol.asyncIterator",function(a){return a?a:Symbol("Symbol.asyncIterator")});
function fa(a){a={next:a};a[Symbol.iterator]=function(){return this};return a}function ha(a){function b(d){return a.next(d)}function c(d){return a.throw(d)}return new Promise(function(d,e){function f(g){g.done?d(g.value):Promise.resolve(g.value).then(b,c).then(f,e)}f(a.next())})}function l(a){return ha(a())}
function ia(a){var b=a[Symbol.asyncIterator];if(void 0!==b)a=b.call(a);else{b=ja;var c="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];a=c?c.call(a):{next:aa(a)};a=new b(a)}return a}
function ja(a){this[Symbol.asyncIterator]=function(){return this};this[Symbol.iterator]=function(){return a};this.next=function(b){return Promise.resolve(a.next(b))};void 0!==a["throw"]&&(this["throw"]=function(b){return Promise.resolve(a["throw"](b))});void 0!==a["return"]&&(this["return"]=function(b){return Promise.resolve(a["return"](b))})}function n(a,b){this.action=a;this.value=b}function ka(a,b,c,d){this.method=a;this.ea=b;this.resolve=c;this.reject=d}
function la(a){this.frame=a;this.next=null}function ma(){this.La=this.U=null}ma.prototype.first=function(){if(this.U)return this.U.frame;throw Error("no frames in executionQueue");};function na(a){a.U&&(a.U=a.U.next,a.U||(a.La=null))}ma.prototype.enqueue=function(a){a=new la(a);this.La?this.La.next=a:this.U=a;this.La=a};
function oa(a){this.Ab=a;this.P=null;this.K=new ma;this[Symbol.asyncIterator]=function(){return this};var b=this;this.Tb=function(c){var d=b.K.first();!0===c.done?(b.P=null,d.method="next",d.ea=c.value):(d.resolve({value:c.value,done:!1}),na(b.K));pa(b)};this.Sb=function(c){qa(b,c)};this.Ya=function(c){sa(b,c)}}function ta(a,b,c){return new Promise(function(d,e){var f=null===a.K.U;a.K.enqueue(new ka(b,c,d,e));f&&pa(a)})}oa.prototype.next=function(a){return ta(this,"next",a)};
oa.prototype.return=function(a){return ta(this,"return",new n(0,a))};oa.prototype.throw=function(a){return ta(this,"throw",a)};function pa(a){if(null!==a.K.U)try{if(a.P){if(!a.P)throw Error("no delegate to perform execution");var b=a.K.first();if(b.method in a.P)try{a.P[b.method](b.ea).then(a.Tb,a.Sb).catch(a.Ya)}catch(c){qa(a,c)}else a.P=null,pa(a)}else ua(a)}catch(c){sa(a,c)}}
function ua(a){var b=a.K.first();try{var c=a.Ab[b.method](b.ea);if(c.value instanceof n)switch(c.value.action){case 0:Promise.resolve(c.value.value).then(function(d){b.resolve({value:d,done:c.done});na(a.K);pa(a)},function(d){b.reject(d);na(a.K);pa(a)}).catch(a.Ya);break;case 1:a.P=ia(c.value.value);b.method="next";b.ea=void 0;pa(a);break;case 2:Promise.resolve(c.value.value).then(function(d){b.method="next";b.ea=d;pa(a)},function(d){b.method="throw";b.ea=d;pa(a)}).catch(a.Ya);break;default:throw Error("Unrecognized AsyncGeneratorWrapper$ActionEnum");
}else b.resolve(c),na(a.K),pa(a)}catch(d){b.reject(d),na(a.K),pa(a)}}function qa(a,b){var c=a.K.first();a.P=null;c.method="throw";c.ea=b;pa(a)}function sa(a,b){null!==a.K.U&&(a.K.first().reject(b),na(a.K));a.P&&"return"in a.P&&(a.P["return"](void 0),a.P=null);a.Ab["return"](void 0);pa(a)}const va=new TextDecoder("utf-8"),wa=a=>va.decode(a),xa=new TextEncoder;const [,ya]=(()=>{function a(){throw b();}const b=()=>{throw Error("BigInt is not available in this environment");};a.asIntN=()=>{throw b();};a.asUintN=()=>{throw b();};return"undefined"!==typeof BigInt?[BigInt,!0]:[a,!1]})(),[za]=(()=>{const a=()=>{throw Error("BigInt64Array is not available in this environment");};class b{static get BYTES_PER_ELEMENT(){return 8}static of(){throw a();}static from(){throw a();}constructor(){throw a();}}return"undefined"!==typeof BigInt64Array?[BigInt64Array,!0]:[b,
!1]})(),[Aa]=(()=>{const a=()=>{throw Error("BigUint64Array is not available in this environment");};class b{static get BYTES_PER_ELEMENT(){return 8}static of(){throw a();}static from(){throw a();}constructor(){throw a();}}return"undefined"!==typeof BigUint64Array?[BigUint64Array,!0]:[b,!1]})(),q=a=>"function"===typeof a,t=a=>null!=a&&Object(a)===a,Ba=a=>"_getDOMStream"in a&&"_getNodeStream"in a,Ca=a=>t(a)&&q(a.cancel)&&q(a.getReader)&&!Ba(a),Da=a=>t(a)&&q(a.read)&&q(a.pipe)&&"boolean"===typeof a.readable&&
!Ba(a);const Ea="undefined"!==typeof SharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;function Fa(a){const b=a[0]?[a[0]]:[];let c,d,e,f;for(let g,k,m=0,p=0,r=a.length;++m<r;)g=b[p],k=a[m],!g||!k||g.buffer!==k.buffer||k.byteOffset<g.byteOffset?k&&(b[++p]=k):({byteOffset:c,byteLength:e}=g,{byteOffset:d,byteLength:f}=k,c+e<d||d+f<c?k&&(b[++p]=k):b[p]=new Uint8Array(g.buffer,c,d-c+f));return b}
function Ga(a,b,c=0,d=b.byteLength){const e=a.byteLength,f=new Uint8Array(a.buffer,a.byteOffset,e);b=new Uint8Array(b.buffer,b.byteOffset,Math.min(d,e));f.set(b,c);return a}
function Ha(a,b){a=Fa(a);const c=a.reduce((m,p)=>m+p.byteLength,0);let d,e,f=0,g=-1;const k=Math.min(b||Number.POSITIVE_INFINITY,c);for(const m=a.length;++g<m;){b=a[g];d=b.subarray(0,Math.min(b.length,k-f));if(k<=f+d.length){d.length<b.length?a[g]=b.subarray(d.length):d.length===b.length&&g++;e?Ga(e,d,f):e=d;break}Ga(e||(e=new Uint8Array(k)),d,f);f+=d.length}return[e||new Uint8Array(0),a.slice(g),c-(e?e.byteLength:0)]}
function u(a,b){b=t(b)&&"done"in b&&"value"in b?b.value:b;if(b instanceof a)return a===Uint8Array?new a(b.buffer,b.byteOffset,b.byteLength):b;if(!b)return new a(0);"string"===typeof b&&(b=xa.encode(b));return b instanceof ArrayBuffer||b instanceof Ea?new a(b):t(b)&&q(b.clear)&&q(b.bytes)&&q(b.position)&&q(b.setPosition)&&q(b.capacity)&&q(b.getBufferIdentifier)&&q(b.createLong)?u(a,b.S()):ArrayBuffer.isView(b)?0>=b.byteLength?new a(0):new a(b.buffer,b.byteOffset,b.byteLength/a.BYTES_PER_ELEMENT):a.from(b)}
const Ia=a=>{a.next();return a};function*Ja(a,b){function*c(d){yield d}b="string"===typeof b?c(b):ArrayBuffer.isView(b)?c(b):b instanceof ArrayBuffer?c(b):b instanceof Ea?c(b):t(b)&&q(b[Symbol.iterator])?b:c(b);yield*Ia(function*(d){let e=null;do e=d.next(yield u(a,e));while(!e.done)}(b[Symbol.iterator]()));return new a}
function Ka(a,b){return new oa(function*(){function c(f){return new oa(function*(){yield new n(1,Ia(function*(g){let k=null;do{let m;k=g.next(yield null==(m=k)?void 0:m.value)}while(!k.done)}(f[Symbol.iterator]())))}())}function d(f){return new oa(function*(){yield new n(0,yield new n(2,f))}())}if(t(b)&&q(b.then))return new n(0,yield new n(1,Ka(a,yield new n(2,b))));const e="string"===typeof b?d(b):ArrayBuffer.isView(b)?d(b):b instanceof ArrayBuffer?d(b):b instanceof Ea?d(b):t(b)&&q(b[Symbol.iterator])?
c(b):t(b)&&q(b[Symbol.asyncIterator])?b:d(b);yield new n(1,Ia(function(f){return new oa(function*(){let g=null;do g=yield new n(2,f.next(yield new n(0,u(a,g))));while(!g.done)}())}(e[Symbol.asyncIterator]())));return new n(0,new a)}())}function La(a,b,c){if(0!==a){c=c.slice(0,b+1);for(let d=-1;++d<=b;)c[d]+=a}return c}function Ma(a,b){let c=0;const d=a.length;if(d!==b.length)return!1;if(0<d){do if(a[c]!==b[c])return!1;while(++c<d)}return!0}var v={};v.compareArrayLike=Ma;v.joinUint8Arrays=Ha;
v.memcpy=Ga;v.rebaseValueOffsets=La;v.toArrayBufferView=u;v.toArrayBufferViewAsyncIterator=Ka;v.toArrayBufferViewIterator=Ja;v.toBigInt64Array=a=>u(za,a);v.toBigUint64Array=a=>u(Aa,a);v.toFloat32Array=a=>u(Float32Array,a);v.toFloat32ArrayAsyncIterator=a=>Ka(Float32Array,a);v.toFloat32ArrayIterator=a=>Ja(Float32Array,a);v.toFloat64Array=a=>u(Float64Array,a);v.toFloat64ArrayAsyncIterator=a=>Ka(Float64Array,a);v.toFloat64ArrayIterator=a=>Ja(Float64Array,a);v.toInt16Array=a=>u(Int16Array,a);
v.toInt16ArrayAsyncIterator=a=>Ka(Int16Array,a);v.toInt16ArrayIterator=a=>Ja(Int16Array,a);v.toInt32Array=a=>u(Int32Array,a);v.toInt32ArrayAsyncIterator=a=>Ka(Int32Array,a);v.toInt32ArrayIterator=a=>Ja(Int32Array,a);v.toInt8Array=a=>u(Int8Array,a);v.toInt8ArrayAsyncIterator=a=>Ka(Int8Array,a);v.toInt8ArrayIterator=a=>Ja(Int8Array,a);v.toUint16Array=a=>u(Uint16Array,a);v.toUint16ArrayAsyncIterator=a=>Ka(Uint16Array,a);v.toUint16ArrayIterator=a=>Ja(Uint16Array,a);v.toUint32Array=a=>u(Uint32Array,a);
v.toUint32ArrayAsyncIterator=a=>Ka(Uint32Array,a);v.toUint32ArrayIterator=a=>Ja(Uint32Array,a);v.toUint8Array=a=>u(Uint8Array,a);v.toUint8ArrayAsyncIterator=a=>Ka(Uint8Array,a);v.toUint8ArrayIterator=a=>Ja(Uint8Array,a);v.toUint8ClampedArray=a=>u(Uint8ClampedArray,a);v.toUint8ClampedArrayAsyncIterator=a=>Ka(Uint8ClampedArray,a);v.toUint8ClampedArrayIterator=a=>Ja(Uint8ClampedArray,a);function Na(){throw Error('"toDOMStream" not available in this environment');}function Oa(){throw Error('"toNodeStream" not available in this environment');}const Pa=a=>{a.next();return a};
function*Qa(a){let b,c=!1,d=[],e,f,g,k=0;({$:f,size:g}=yield null);a=Ja(Uint8Array,a)[Symbol.iterator]();try{do if({done:b,value:e}=Number.isNaN(g-k)?a.next():a.next(g-k),!b&&0<e.byteLength&&(d.push(e),k+=e.byteLength),b||g<=k){do{if("peek"===f)var m=Ha(d,g)[0];else[e,d,k]=Ha(d,g),m=e;({$:f,size:g}=yield m)}while(g<k)}while(!b)}catch(p){(c=!0,"function"===typeof a.throw)&&a.throw(p)}finally{!1===c&&"function"===typeof a.return&&a.return(null)}return null}
function Ra(a){return new oa(function*(){let b,c=!1,d=[],e,f,g,k=0;({$:f,size:g}=yield new n(0,null));const m=Ka(Uint8Array,a)[Symbol.asyncIterator]();try{do if({done:b,value:e}=Number.isNaN(g-k)?yield new n(2,m.next()):yield new n(2,m.next(g-k)),!b&&0<e.byteLength&&(d.push(e),k+=e.byteLength),b||g<=k){do{if("peek"===f)var p=Ha(d,g)[0];else[e,d,k]=Ha(d,g),p=e;({$:f,size:g}=yield new n(0,p))}while(g<k)}while(!b)}catch(r){(c=!0,"function"===typeof m.throw)&&(yield new n(2,m.throw(r)))}finally{!1===
c&&"function"===typeof m.return&&(yield new n(2,m.return(new Uint8Array(0))))}return new n(0,null)}())}
function Sa(a){return new oa(function*(){let b=!1,c=!1,d=[],e,f,g,k=0;({$:f,size:g}=yield new n(0,null));const m=new Ta(a);try{do if({done:b,value:e}=Number.isNaN(g-k)?yield new n(2,m.read()):yield new n(2,m.read(g-k)),!b&&0<e.byteLength&&(d.push(u(Uint8Array,e)),k+=e.byteLength),b||g<=k){do{if("peek"===f)var p=Ha(d,g)[0];else[e,d,k]=Ha(d,g),p=e;({$:f,size:g}=yield new n(0,p))}while(g<k)}while(!b)}catch(r){c=!0,yield new n(2,m.cancel(r))}finally{!1===c?yield new n(2,m.cancel()):a.locked&&m.releaseLock()}return new n(0,
null)}())}
class Ta{constructor(a){this.source=a;this.V=null;this.V=this.source.getReader();this.V.closed.catch(()=>{})}get closed(){return this.V?this.V.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.V&&this.V.releaseLock();this.V=null}cancel(a){const b=this;return l(function*(){const c=b.V,d=b.source;c&&(yield c.cancel(a).catch(()=>{}));d&&d.locked&&b.releaseLock()})}read(a){const b=this;return l(function*(){if(0===a)return{done:null==b.V,value:new Uint8Array(0)};const c=yield b.V.read();!c.done&&
(c.value=u(Uint8Array,c));return c})}}const Ua=(a,b)=>{const c=e=>d([b,e]);let d;return[b,c,new Promise(e=>(d=e)&&a.once(b,c))]};
function Va(a){return new oa(function*(){function b(ra,Eb){r=p=null;return new Promise((Xi,Yi)=>{for(const [Fb,Zi]of ra)a.off(Fb,Zi);try{const Fb=a.destroy;Fb&&Fb.call(a,Eb);Eb=void 0}catch(Fb){Eb=Fb||Eb}finally{null!=Eb?Yi(Eb):Xi()}})}const c=[];let d="error",e=!1,f=null,g,k,m=0,p=[],r;({$:g,size:k}=yield new n(0,null));if(a.isTTY)return yield new n(0,new Uint8Array(0)),new n(0,null);try{c[0]=Ua(a,"end");c[1]=Ua(a,"error");do{c[2]=Ua(a,"readable");[d,f]=yield new n(2,Promise.race(c.map(ra=>ra[2])));
if("error"===d)break;(e="end"===d)||(Number.isFinite(k-m)?(r=u(Uint8Array,a.read(k-m)),r.byteLength<k-m&&(r=u(Uint8Array,a.read()))):r=u(Uint8Array,a.read()),0<r.byteLength&&(p.push(r),m+=r.byteLength));if(e||k<=m){do{if("peek"===g)var T=Ha(p,k)[0];else[r,p,m]=Ha(p,k),T=r;({$:g,size:k}=yield new n(0,T))}while(k<m)}}while(!e)}finally{yield new n(2,b(c,"error"===d?f:null))}return new n(0,null)}())};var Wa,Xa=Wa||(Wa={});Xa[Xa.V1=0]="V1";Xa[Xa.V2=1]="V2";Xa[Xa.V3=2]="V3";Xa[Xa.V4=3]="V4";Xa[Xa.V5=4]="V5";var w,Ya=w||(w={});Ya[Ya.Sparse=0]="Sparse";Ya[Ya.Dense=1]="Dense";var x,Za=x||(x={});Za[Za.HALF=0]="HALF";Za[Za.SINGLE=1]="SINGLE";Za[Za.DOUBLE=2]="DOUBLE";var $a,ab=$a||($a={});ab[ab.DAY=0]="DAY";ab[ab.MILLISECOND=1]="MILLISECOND";var y,bb=y||(y={});bb[bb.SECOND=0]="SECOND";bb[bb.MILLISECOND=1]="MILLISECOND";bb[bb.MICROSECOND=2]="MICROSECOND";bb[bb.NANOSECOND=3]="NANOSECOND";
var cb,db=cb||(cb={});db[db.YEAR_MONTH=0]="YEAR_MONTH";db[db.DAY_TIME=1]="DAY_TIME";db[db.MONTH_DAY_NANO=2]="MONTH_DAY_NANO";var z,eb=z||(z={});eb[eb.NONE=0]="NONE";eb[eb.Schema=1]="Schema";eb[eb.DictionaryBatch=2]="DictionaryBatch";eb[eb.RecordBatch=3]="RecordBatch";eb[eb.Tensor=4]="Tensor";eb[eb.SparseTensor=5]="SparseTensor";var A,B=A||(A={});B[B.NONE=0]="NONE";B[B.Null=1]="Null";B[B.Int=2]="Int";B[B.Float=3]="Float";B[B.Binary=4]="Binary";B[B.Utf8=5]="Utf8";B[B.Bool=6]="Bool";B[B.Decimal=7]="Decimal";
B[B.Date=8]="Date";B[B.Time=9]="Time";B[B.Timestamp=10]="Timestamp";B[B.Interval=11]="Interval";B[B.List=12]="List";B[B.Struct=13]="Struct";B[B.Union=14]="Union";B[B.FixedSizeBinary=15]="FixedSizeBinary";B[B.FixedSizeList=16]="FixedSizeList";B[B.Map=17]="Map";B[B.Dictionary=-1]="Dictionary";B[B.Int8=-2]="Int8";B[B.Int16=-3]="Int16";B[B.Int32=-4]="Int32";B[B.Int64=-5]="Int64";B[B.Uint8=-6]="Uint8";B[B.Uint16=-7]="Uint16";B[B.Uint32=-8]="Uint32";B[B.Uint64=-9]="Uint64";B[B.Float16=-10]="Float16";
B[B.Float32=-11]="Float32";B[B.Float64=-12]="Float64";B[B.DateDay=-13]="DateDay";B[B.DateMillisecond=-14]="DateMillisecond";B[B.TimestampSecond=-15]="TimestampSecond";B[B.TimestampMillisecond=-16]="TimestampMillisecond";B[B.TimestampMicrosecond=-17]="TimestampMicrosecond";B[B.TimestampNanosecond=-18]="TimestampNanosecond";B[B.TimeSecond=-19]="TimeSecond";B[B.TimeMillisecond=-20]="TimeMillisecond";B[B.TimeMicrosecond=-21]="TimeMicrosecond";B[B.TimeNanosecond=-22]="TimeNanosecond";
B[B.DenseUnion=-23]="DenseUnion";B[B.SparseUnion=-24]="SparseUnion";B[B.IntervalDayTime=-25]="IntervalDayTime";B[B.IntervalYearMonth=-26]="IntervalYearMonth";var fb,gb=fb||(fb={});gb[gb.OFFSET=0]="OFFSET";gb[gb.DATA=1]="DATA";gb[gb.VALIDITY=2]="VALIDITY";gb[gb.TYPE=3]="TYPE";function hb(a){if(null===a)return"null";if(void 0===a)return"undefined";switch(typeof a){case "number":return`${a}`;case "bigint":return`${a}`;case "string":return`"${a}"`}return"function"===typeof a[Symbol.toPrimitive]?a[Symbol.toPrimitive]("string"):ArrayBuffer.isView(a)?a instanceof za||a instanceof Aa?`[${[...a].map(b=>hb(b))}]`:`[${a}]`:ArrayBuffer.isView(a)?`[${a}]`:JSON.stringify(a,(b,c)=>"bigint"===typeof c?`${c}`:c)};const ib=Symbol.for("isArrowBigNum");function jb(a,...b){return 0===b.length?Object.setPrototypeOf(u(this.TypedArray,a),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(a,...b),this.constructor.prototype)}jb.prototype[ib]=!0;jb.prototype.toJSON=function(){return`"${kb(this)}"`};jb.prototype.valueOf=function(){return lb(this)};jb.prototype.toString=function(){return kb(this)};jb.prototype[Symbol.toPrimitive]=function(a="default"){switch(a){case "number":return lb(this);case "default":return mb(this)}return kb(this)};
function nb(...a){return jb.apply(this,a)}function ob(...a){return jb.apply(this,a)}function pb(...a){return jb.apply(this,a)}Object.setPrototypeOf(nb.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(ob.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(pb.prototype,Object.create(Uint32Array.prototype));Object.assign(nb.prototype,jb.prototype,{constructor:nb,signed:!0,TypedArray:Int32Array,BigIntArray:za});
Object.assign(ob.prototype,jb.prototype,{constructor:ob,signed:!1,TypedArray:Uint32Array,BigIntArray:Aa});Object.assign(pb.prototype,jb.prototype,{constructor:pb,signed:!0,TypedArray:Uint32Array,BigIntArray:Aa});
function lb(a){const {buffer:b,byteOffset:c,length:d,signed:e}=a;a=new Aa(b,c,d);const f=e&&a[a.length-1]&BigInt(1)<<BigInt(63);let g=f?BigInt(1):BigInt(0),k=BigInt(0);if(f){for(const m of a)g+=~m*(BigInt(1)<<BigInt(32)*k++);g*=BigInt(-1)}else for(const m of a)g+=m*(BigInt(1)<<BigInt(32)*k++);return g}let kb,mb;ya?(mb=a=>8===a.byteLength?(new a.BigIntArray(a.buffer,a.byteOffset,1))[0]:qb(a),kb=a=>8===a.byteLength?`${(new a.BigIntArray(a.buffer,a.byteOffset,1))[0]}`:qb(a)):mb=kb=qb;
function qb(a){let b="";const c=new Uint32Array(2);a=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2);const d=new Uint32Array((a=(new Uint16Array(a)).reverse()).buffer);let e;const f=a.length-1;do{for(c[0]=a[e=0];e<f;)a[e++]=c[1]=c[0]/10,c[0]=(c[0]-10*c[1]<<16)+a[e];a[e]=c[1]=c[0]/10;c[0]-=10*c[1];b=`${c[0]}${b}`}while(d[0]||d[1]||d[2]||d[3]);let g;return null!=(g=b)?g:"0"}
class rb{static new(a,b){switch(b){case !0:return new nb(a);case !1:return new ob(a)}switch(a.constructor){case Int8Array:case Int16Array:case Int32Array:case za:return new nb(a)}return 16===a.byteLength?new pb(a):new ob(a)}static cc(a){return new nb(a)}constructor(a,b){return rb.new(a,b)}}var sb={};sb.BN=rb;sb.bignumToBigInt=mb;sb.bignumToString=kb;sb.isArrowBigNumSymbol=ib;class C{static isNull(a){return(null==a?void 0:a.typeId)===A.Null}static isInt(a){return(null==a?void 0:a.typeId)===A.Int}static isFloat(a){return(null==a?void 0:a.typeId)===A.Float}static isBinary(a){return(null==a?void 0:a.typeId)===A.Binary}static isUtf8(a){return(null==a?void 0:a.typeId)===A.Utf8}static isBool(a){return(null==a?void 0:a.typeId)===A.Bool}static isDecimal(a){return(null==a?void 0:a.typeId)===A.Decimal}static isDate(a){return(null==a?void 0:a.typeId)===A.Date}static isTime(a){return(null==
a?void 0:a.typeId)===A.Time}static isTimestamp(a){return(null==a?void 0:a.typeId)===A.Timestamp}static isInterval(a){return(null==a?void 0:a.typeId)===A.Interval}static isList(a){return(null==a?void 0:a.typeId)===A.List}static isStruct(a){return(null==a?void 0:a.typeId)===A.Struct}static isUnion(a){return(null==a?void 0:a.typeId)===A.Union}static isFixedSizeBinary(a){return(null==a?void 0:a.typeId)===A.FixedSizeBinary}static isFixedSizeList(a){return(null==a?void 0:a.typeId)===A.FixedSizeList}static isMap(a){return(null==
a?void 0:a.typeId)===A.Map}static isDictionary(a){return(null==a?void 0:a.typeId)===A.Dictionary}static isDenseUnion(a){return C.isUnion(a)&&a.mode===w.Dense}static isSparseUnion(a){return C.isUnion(a)&&a.mode===w.Sparse}get typeId(){return A.NONE}}var tb=Symbol.toStringTag,ub,vb=C.prototype;vb.children=null;vb.ArrayType=Array;ub=vb[Symbol.toStringTag]="DataType";C[tb]=ub;class wb extends C{toString(){return"Null"}get typeId(){return A.Null}}
wb[Symbol.toStringTag]=wb.prototype[Symbol.toStringTag]="Null";
class xb extends C{constructor(a,b){super();this.isSigned=a;this.bitWidth=b}get typeId(){return A.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?za:Aa}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`);}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}var yb=Symbol.toStringTag,zb,Ab=xb.prototype;
Ab.isSigned=null;Ab.bitWidth=null;zb=Ab[Symbol.toStringTag]="Int";xb[yb]=zb;class Bb extends xb{constructor(){super(!0,8)}get ArrayType(){return Int8Array}}class Cb extends xb{constructor(){super(!0,16)}get ArrayType(){return Int16Array}}class Db extends xb{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}class Gb extends xb{constructor(){super(!0,64)}get ArrayType(){return za}}class Hb extends xb{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}}
class Ib extends xb{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}}class Jb extends xb{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}}class Kb extends xb{constructor(){super(!1,64)}get ArrayType(){return Aa}}Object.defineProperty(Bb.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Cb.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Db.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Gb.prototype,"ArrayType",{value:za});
Object.defineProperty(Hb.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Ib.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Jb.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Kb.prototype,"ArrayType",{value:Aa});
class Lb extends C{constructor(a){super();this.precision=a}get typeId(){return A.Float}get ArrayType(){switch(this.precision){case x.HALF:return Uint16Array;case x.SINGLE:return Float32Array;case x.DOUBLE:return Float64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`);}toString(){return`Float${this.precision<<5||16}`}}var Mb=Symbol.toStringTag,Nb,Ob=Lb.prototype;Ob.precision=null;Nb=Ob[Symbol.toStringTag]="Float";Lb[Mb]=Nb;class Pb extends Lb{constructor(){super(x.HALF)}}
class Qb extends Lb{constructor(){super(x.SINGLE)}}class Rb extends Lb{constructor(){super(x.DOUBLE)}}Object.defineProperty(Pb.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Qb.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Rb.prototype,"ArrayType",{value:Float64Array});class Sb extends C{constructor(){super()}get typeId(){return A.Binary}toString(){return"Binary"}}var Tb=Symbol.toStringTag,Ub,Vb=Sb.prototype;Vb.ArrayType=Uint8Array;Ub=Vb[Symbol.toStringTag]="Binary";
Sb[Tb]=Ub;class Wb extends C{constructor(){super()}get typeId(){return A.Utf8}toString(){return"Utf8"}}var Xb=Symbol.toStringTag,Yb,Zb=Wb.prototype;Zb.ArrayType=Uint8Array;Yb=Zb[Symbol.toStringTag]="Utf8";Wb[Xb]=Yb;class $b extends C{constructor(){super()}get typeId(){return A.Bool}toString(){return"Bool"}}var ac=Symbol.toStringTag,bc,cc=$b.prototype;cc.ArrayType=Uint8Array;bc=cc[Symbol.toStringTag]="Bool";$b[ac]=bc;
class dc extends C{constructor(a,b,c=128){super();this.scale=a;this.precision=b;this.bitWidth=c}get typeId(){return A.Decimal}toString(){return`Decimal[${this.precision}e${0<this.scale?"+":""}${this.scale}]`}}var ec=Symbol.toStringTag,fc,gc=dc.prototype;gc.scale=null;gc.precision=null;gc.ArrayType=Uint32Array;fc=gc[Symbol.toStringTag]="Decimal";dc[ec]=fc;class hc extends C{constructor(a){super();this.unit=a}get typeId(){return A.Date}toString(){return`Date${32*(this.unit+1)}<${$a[this.unit]}>`}}
var ic=Symbol.toStringTag,jc,kc=hc.prototype;kc.unit=null;kc.ArrayType=Int32Array;jc=kc[Symbol.toStringTag]="Date";hc[ic]=jc;class lc extends hc{constructor(){super($a.DAY)}}class mc extends hc{constructor(){super($a.MILLISECOND)}}
class nc extends C{constructor(a,b){super();this.unit=a;this.bitWidth=b}get typeId(){return A.Time}toString(){return`Time${this.bitWidth}<${y[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return za}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`);}}var oc=Symbol.toStringTag,pc,qc=nc.prototype;qc.unit=null;qc.bitWidth=null;pc=qc[Symbol.toStringTag]="Time";nc[oc]=pc;class rc extends nc{constructor(){super(y.SECOND,32)}}
class sc extends nc{constructor(){super(y.MILLISECOND,32)}}class tc extends nc{constructor(){super(y.MICROSECOND,64)}}class uc extends nc{constructor(){super(y.NANOSECOND,64)}}class vc extends C{constructor(a,b){super();this.unit=a;this.timezone=b}get typeId(){return A.Timestamp}toString(){return`Timestamp<${y[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}var wc=Symbol.toStringTag,xc,yc=vc.prototype;yc.unit=null;yc.timezone=null;yc.ArrayType=Int32Array;xc=yc[Symbol.toStringTag]="Timestamp";
vc[wc]=xc;class zc extends vc{constructor(a){super(y.SECOND,a)}}class Ac extends vc{constructor(a){super(y.MILLISECOND,a)}}class Bc extends vc{constructor(a){super(y.MICROSECOND,a)}}class Cc extends vc{constructor(a){super(y.NANOSECOND,a)}}class Dc extends C{constructor(a){super();this.unit=a}get typeId(){return A.Interval}toString(){return`Interval<${cb[this.unit]}>`}}var Ec=Symbol.toStringTag,Fc,Gc=Dc.prototype;Gc.unit=null;Gc.ArrayType=Int32Array;Fc=Gc[Symbol.toStringTag]="Interval";Dc[Ec]=Fc;
class Hc extends Dc{constructor(){super(cb.DAY_TIME)}}class Ic extends Dc{constructor(){super(cb.YEAR_MONTH)}}class Jc extends C{constructor(a){super();this.children=[a]}get typeId(){return A.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}var Kc=Symbol.toStringTag,Lc,Mc=Jc.prototype;Mc.children=null;Lc=Mc[Symbol.toStringTag]="List";Jc[Kc]=Lc;
class D extends C{constructor(a){super();this.children=a}get typeId(){return A.Struct}toString(){return`Struct<{${this.children.map(a=>`${a.name}:${a.type}`).join(", ")}}>`}}var Nc=Symbol.toStringTag,Oc,Pc=D.prototype;Pc.children=null;Oc=Pc[Symbol.toStringTag]="Struct";D[Nc]=Oc;
class Qc extends C{constructor(a,b,c){super();this.mode=a;this.children=c;this.typeIds=b=Int32Array.from(b);this.typeIdToChildIndex=b.reduce((d,e,f)=>(d[e]=f)&&d||d,Object.create(null))}get typeId(){return A.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(a=>`${a.type}`).join(" | ")}>`}}var Rc=Symbol.toStringTag,Sc,Tc=Qc.prototype;Tc.mode=null;Tc.typeIds=null;Tc.children=null;Tc.typeIdToChildIndex=null;Tc.ArrayType=Int8Array;Sc=Tc[Symbol.toStringTag]="Union";Qc[Rc]=Sc;
class Uc extends Qc{constructor(a,b){super(w.Dense,a,b)}}class Vc extends Qc{constructor(a,b){super(w.Sparse,a,b)}}class Wc extends C{constructor(a){super();this.byteWidth=a}get typeId(){return A.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}var Xc=Symbol.toStringTag,Yc,Zc=Wc.prototype;Zc.byteWidth=null;Zc.ArrayType=Uint8Array;Yc=Zc[Symbol.toStringTag]="FixedSizeBinary";Wc[Xc]=Yc;
class $c extends C{constructor(a,b){super();this.listSize=a;this.children=[b]}get typeId(){return A.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}var ad=Symbol.toStringTag,bd,cd=$c.prototype;cd.children=null;cd.listSize=null;bd=cd[Symbol.toStringTag]="FixedSizeList";$c[ad]=bd;
class dd extends C{constructor(a,b=!1){super();this.children=[a];this.keysSorted=b}get typeId(){return A.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(a=>`${a.name}:${a.type}`).join(", ")}}>`}}var ed=Symbol.toStringTag,fd,gd=dd.prototype;gd.children=null;gd.keysSorted=null;fd=gd[Symbol.toStringTag]="Map_";dd[ed]=fd;
const hd=(a=>()=>++a)(-1);class id extends C{constructor(a,b,c,d){super();this.indices=b;this.dictionary=a;this.isOrdered=d||!1;this.id=null==c?hd():"number"===typeof c?c:c.low}get typeId(){return A.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}var jd=Symbol.toStringTag,kd,ld=id.prototype;ld.id=null;ld.indices=null;ld.isOrdered=null;
ld.dictionary=null;kd=ld[Symbol.toStringTag]="Dictionary";id[jd]=kd;function md(a){switch(a.typeId){case A.Decimal:return a.bitWidth/32;case A.Timestamp:return 2;case A.Date:return 1+a.unit;case A.Interval:return 1+a.unit;case A.FixedSizeList:return a.listSize;case A.FixedSizeBinary:return a.byteWidth;default:return 1}};class nd{visitMany(a,...b){return a.map((c,d)=>this.visit(c,...b.map(e=>e[d])))}visit(...a){return this.getVisitFn(a[0],!1).apply(this,a)}getVisitFn(a,b=!0){return od(this,a,b)}getVisitFnByTypeId(a,b=!0){return pd(this,a,b)}visitNull(){return null}visitBool(){return null}visitInt(){return null}visitFloat(){return null}visitUtf8(){return null}visitBinary(){return null}visitFixedSizeBinary(){return null}visitDate(){return null}visitTimestamp(){return null}visitTime(){return null}visitDecimal(){return null}visitList(){return null}visitStruct(){return null}visitUnion(){return null}visitDictionary(){return null}visitInterval(){return null}visitFixedSizeList(){return null}visitMap(){return null}}
function od(a,b,c=!0){return"number"===typeof b?pd(a,b,c):"string"===typeof b&&b in A?pd(a,A[b],c):b&&b instanceof C?pd(a,qd(b),c):(null==b?0:b.type)&&b.type instanceof C?pd(a,qd(b.type),c):pd(a,A.NONE,c)}
function pd(a,b,c=!0){let d=null;switch(b){case A.Null:d=a.visitNull;break;case A.Bool:d=a.visitBool;break;case A.Int:d=a.visitInt;break;case A.Int8:d=a.visitInt8||a.visitInt;break;case A.Int16:d=a.visitInt16||a.visitInt;break;case A.Int32:d=a.visitInt32||a.visitInt;break;case A.Int64:d=a.visitInt64||a.visitInt;break;case A.Uint8:d=a.visitUint8||a.visitInt;break;case A.Uint16:d=a.visitUint16||a.visitInt;break;case A.Uint32:d=a.visitUint32||a.visitInt;break;case A.Uint64:d=a.visitUint64||a.visitInt;
break;case A.Float:d=a.visitFloat;break;case A.Float16:d=a.visitFloat16||a.visitFloat;break;case A.Float32:d=a.visitFloat32||a.visitFloat;break;case A.Float64:d=a.visitFloat64||a.visitFloat;break;case A.Utf8:d=a.visitUtf8;break;case A.Binary:d=a.visitBinary;break;case A.FixedSizeBinary:d=a.visitFixedSizeBinary;break;case A.Date:d=a.visitDate;break;case A.DateDay:d=a.visitDateDay||a.visitDate;break;case A.DateMillisecond:d=a.visitDateMillisecond||a.visitDate;break;case A.Timestamp:d=a.visitTimestamp;
break;case A.TimestampSecond:d=a.visitTimestampSecond||a.visitTimestamp;break;case A.TimestampMillisecond:d=a.visitTimestampMillisecond||a.visitTimestamp;break;case A.TimestampMicrosecond:d=a.visitTimestampMicrosecond||a.visitTimestamp;break;case A.TimestampNanosecond:d=a.visitTimestampNanosecond||a.visitTimestamp;break;case A.Time:d=a.visitTime;break;case A.TimeSecond:d=a.visitTimeSecond||a.visitTime;break;case A.TimeMillisecond:d=a.visitTimeMillisecond||a.visitTime;break;case A.TimeMicrosecond:d=
a.visitTimeMicrosecond||a.visitTime;break;case A.TimeNanosecond:d=a.visitTimeNanosecond||a.visitTime;break;case A.Decimal:d=a.visitDecimal;break;case A.List:d=a.visitList;break;case A.Struct:d=a.visitStruct;break;case A.Union:d=a.visitUnion;break;case A.DenseUnion:d=a.visitDenseUnion||a.visitUnion;break;case A.SparseUnion:d=a.visitSparseUnion||a.visitUnion;break;case A.Dictionary:d=a.visitDictionary;break;case A.Interval:d=a.visitInterval;break;case A.IntervalDayTime:d=a.visitIntervalDayTime||a.visitInterval;
break;case A.IntervalYearMonth:d=a.visitIntervalYearMonth||a.visitInterval;break;case A.FixedSizeList:d=a.visitFixedSizeList;break;case A.Map:d=a.visitMap}if("function"===typeof d)return d;if(!c)return()=>null;throw Error(`Unrecognized type '${A[b]}'`);}
function qd(a){switch(a.typeId){case A.Null:return A.Null;case A.Int:const b=a.isSigned;switch(a.bitWidth){case 8:return b?A.Int8:A.Uint8;case 16:return b?A.Int16:A.Uint16;case 32:return b?A.Int32:A.Uint32;case 64:return b?A.Int64:A.Uint64}return A.Int;case A.Float:switch(a.precision){case x.HALF:return A.Float16;case x.SINGLE:return A.Float32;case x.DOUBLE:return A.Float64}return A.Float;case A.Binary:return A.Binary;case A.Utf8:return A.Utf8;case A.Bool:return A.Bool;case A.Decimal:return A.Decimal;
case A.Time:switch(a.unit){case y.SECOND:return A.TimeSecond;case y.MILLISECOND:return A.TimeMillisecond;case y.MICROSECOND:return A.TimeMicrosecond;case y.NANOSECOND:return A.TimeNanosecond}return A.Time;case A.Timestamp:switch(a.unit){case y.SECOND:return A.TimestampSecond;case y.MILLISECOND:return A.TimestampMillisecond;case y.MICROSECOND:return A.TimestampMicrosecond;case y.NANOSECOND:return A.TimestampNanosecond}return A.Timestamp;case A.Date:switch(a.unit){case $a.DAY:return A.DateDay;case $a.MILLISECOND:return A.DateMillisecond}return A.Date;
case A.Interval:switch(a.unit){case cb.DAY_TIME:return A.IntervalDayTime;case cb.YEAR_MONTH:return A.IntervalYearMonth}return A.Interval;case A.Map:return A.Map;case A.List:return A.List;case A.Struct:return A.Struct;case A.Union:switch(a.mode){case w.Dense:return A.DenseUnion;case w.Sparse:return A.SparseUnion}return A.Union;case A.FixedSizeBinary:return A.FixedSizeBinary;case A.FixedSizeList:return A.FixedSizeList;case A.Dictionary:return A.Dictionary}throw Error(`Unrecognized type '${A[a.typeId]}'`);
}h=nd.prototype;h.visitInt8=null;h.visitInt16=null;h.visitInt32=null;h.visitInt64=null;h.visitUint8=null;h.visitUint16=null;h.visitUint32=null;h.visitUint64=null;h.visitFloat16=null;h.visitFloat32=null;h.visitFloat64=null;h.visitDateDay=null;h.visitDateMillisecond=null;h.visitTimestampSecond=null;h.visitTimestampMillisecond=null;h.visitTimestampMicrosecond=null;h.visitTimestampNanosecond=null;h.visitTimeSecond=null;h.visitTimeMillisecond=null;h.visitTimeMicrosecond=null;h.visitTimeNanosecond=null;
h.visitDenseUnion=null;h.visitSparseUnion=null;h.visitIntervalDayTime=null;h.visitIntervalYearMonth=null;const rd=new Float64Array(1),sd=new Uint32Array(rd.buffer);function td(a){const b=(a&31744)>>10,c=(a&1023)/1024;a=Math.pow(-1,(a&32768)>>15);switch(b){case 31:return a*(c?Number.NaN:1/0);case 0:return a*(c?6.103515625E-5*c:0)}return a*Math.pow(2,b-15)*(1+c)}
function ud(a){if(a!==a)return 32256;rd[0]=a;a=(sd[1]&2147483648)>>16&65535;let b=sd[1]&2146435072,c=0;1089470464<=b?0<sd[0]?b=31744:(b=(b&2080374784)>>16,c=(sd[1]&1048575)>>10):1056964608>=b?(c=1048576+(sd[1]&1048575),c=1048576+(c<<(b>>20)-998)>>21,b=0):(b=b-1056964608>>10,c=(sd[1]&1048575)+512>>10);return a|b|c&65535}var vd={};vd.float64ToUint16=ud;vd.uint16ToFloat64=td;class wd extends nd{}function E(a){return(b,c,d)=>{if(b.setValid(c,null!=d))return a(b,c,d)}}
const xd=(a,b,c)=>{a[b]=Math.trunc(c%4294967296);a[b+1]=Math.trunc(c/4294967296)},yd=(a,b,c,d)=>{if(c+1<b.length){const {[c]:e,[c+1]:f}=b;a.set(d.subarray(0,f-e),e)}},zd=({values:a},b,c)=>{a[b]=c},Ad=({values:a},b,c)=>{a[b]=c},Bd=({values:a},b,c)=>{a[b]=ud(c)},Cd=({values:a},b,c)=>{a[b]=Math.trunc(c.valueOf()/864E5)},Dd=({values:a},b,c)=>{xd(a,2*b,c.valueOf())},Ed=({stride:a,values:b},c,d)=>{b.set(d.subarray(0,a),a*c)},Fd=(a,b,c)=>{a.type.unit===$a.DAY?Cd(a,b,c):Dd(a,b,c)},Gd=({values:a},b,c)=>xd(a,
2*b,c/1E3),Hd=({values:a},b,c)=>xd(a,2*b,c),Id=({values:a},b,c)=>{b*=2;a[b]=Math.trunc(1E3*c%4294967296);a[b+1]=Math.trunc(1E3*c/4294967296)},Jd=({values:a},b,c)=>{b*=2;a[b]=Math.trunc(1E6*c%4294967296);a[b+1]=Math.trunc(1E6*c/4294967296)},Kd=(a,b,c)=>{switch(a.type.unit){case y.SECOND:return Gd(a,b,c);case y.MILLISECOND:return Hd(a,b,c);case y.MICROSECOND:return Id(a,b,c);case y.NANOSECOND:return Jd(a,b,c)}},Ld=({values:a},b,c)=>{a[b]=c},Md=({values:a},b,c)=>{a[b]=c},Nd=({values:a},b,c)=>{a[b]=c},
Od=({values:a},b,c)=>{a[b]=c},Pd=(a,b,c)=>{switch(a.type.unit){case y.SECOND:return Ld(a,b,c);case y.MILLISECOND:return Md(a,b,c);case y.MICROSECOND:return Nd(a,b,c);case y.NANOSECOND:return Od(a,b,c)}},Qd=({values:a,stride:b},c,d)=>{a.set(d.subarray(0,b),b*c)},Rd=(a,b)=>(c,d,e,f)=>d&&c(d,a,b[f]),Sd=(a,b)=>(c,d,e,f)=>d&&c(d,a,b.get(f)),Td=(a,b)=>(c,d,e)=>d&&c(d,a,b.get(e.name)),Ud=(a,b)=>(c,d,e)=>d&&c(d,a,b[e.name]),Wd=(a,b,c)=>{Vd.visit(a.children[a.type.typeIdToChildIndex[a.typeIds[b]]],a.valueOffsets[b],
c)},Xd=(a,b,c)=>{Vd.visit(a.children[a.type.typeIdToChildIndex[a.typeIds[b]]],b,c)},$d=(a,b,c)=>{a.type.unit===cb.DAY_TIME?Yd(a,b,c):Zd(a,b,c)},Yd=({values:a},b,c)=>{a.set(c.subarray(0,2),2*b)},Zd=({values:a},b,c)=>{a[b]=12*c[0]+c[1]%12};h=wd.prototype;h.visitBool=E(({offset:a,values:b},c,d)=>{a+=c;d?b[a>>3]|=1<<a%8:b[a>>3]&=~(1<<a%8)});h.visitInt=E(zd);h.visitInt8=E(zd);h.visitInt16=E(zd);h.visitInt32=E(zd);h.visitInt64=E(zd);h.visitUint8=E(zd);h.visitUint16=E(zd);h.visitUint32=E(zd);
h.visitUint64=E(zd);h.visitFloat=E((a,b,c)=>{switch(a.type.precision){case x.HALF:return Bd(a,b,c);case x.SINGLE:case x.DOUBLE:return Ad(a,b,c)}});h.visitFloat16=E(Bd);h.visitFloat32=E(Ad);h.visitFloat64=E(Ad);h.visitUtf8=E(({values:a,valueOffsets:b},c,d)=>{yd(a,b,c,xa.encode(d))});h.visitBinary=E(({values:a,valueOffsets:b},c,d)=>yd(a,b,c,d));h.visitFixedSizeBinary=E(Ed);h.visitDate=E(Fd);h.visitDateDay=E(Cd);h.visitDateMillisecond=E(Dd);h.visitTimestamp=E(Kd);h.visitTimestampSecond=E(Gd);
h.visitTimestampMillisecond=E(Hd);h.visitTimestampMicrosecond=E(Id);h.visitTimestampNanosecond=E(Jd);h.visitTime=E(Pd);h.visitTimeSecond=E(Ld);h.visitTimeMillisecond=E(Md);h.visitTimeMicrosecond=E(Nd);h.visitTimeNanosecond=E(Od);h.visitDecimal=E(Qd);h.visitList=E((a,b,c)=>{const d=a.children[0];a=a.valueOffsets;const e=Vd.getVisitFn(d);if(Array.isArray(c))for(let f=-1,g=a[b],k=a[b+1];g<k;)e(d,g++,c[++f]);else for(let f=-1,g=a[b],k=a[b+1];g<k;)e(d,g++,c.get(++f))});
h.visitStruct=E((a,b,c)=>{const d=a.type.children.map(f=>Vd.getVisitFn(f.type)),e=c instanceof Map?Td(b,c):c instanceof F?Sd(b,c):Array.isArray(c)?Rd(b,c):Ud(b,c);a.type.children.forEach((f,g)=>e(d[g],a.children[g],f,g))});h.visitUnion=E((a,b,c)=>{a.type.mode===w.Dense?Wd(a,b,c):Xd(a,b,c)});h.visitDenseUnion=E(Wd);h.visitSparseUnion=E(Xd);h.visitDictionary=E((a,b,c)=>{let d;null==(d=a.dictionary)||d.set(a.values[b],c)});h.visitInterval=E($d);h.visitIntervalDayTime=E(Yd);h.visitIntervalYearMonth=E(Zd);
h.visitFixedSizeList=E((a,b,c)=>{const d=a.stride;a=a.children[0];const e=Vd.getVisitFn(a);if(Array.isArray(c))for(let f=-1,g=b*d;++f<d;)e(a,g+f,c[f]);else for(let f=-1,g=b*d;++f<d;)e(a,g+f,c.get(f))});h.visitMap=E((a,b,c)=>{const d=a.children[0],e=a.valueOffsets;a=Vd.getVisitFn(d);let {[b]:f,[b+1]:g}=e;b=c instanceof Map?c.entries():Object.entries(c);for(const k of b)if(a(d,f,k),++f>=g)break});const Vd=new wd;const ae=Symbol.for("parent"),be=Symbol.for("rowIndex");
class ce{constructor(a,b){this[ae]=a;this[be]=b;return new Proxy(this,new de)}toArray(){return Object.values(this.toJSON())}toJSON(){const a=this[be],b=this[ae],c=b.type.children,d={};for(let e=-1,f=c.length;++e<f;)d[c[e].name]=ee.visit(b.children[e],a);return d}toString(){return`{${[...this].map(([a,b])=>`${hb(a)}: ${hb(b)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new fe(this[ae],this[be])}}
class fe{constructor(a,b){this.yb=0;this.children=a.children;this.rowIndex=b;this.xb=a.type.children;this.numChildren=this.xb.length}[Symbol.iterator](){return this}next(){const a=this.yb;return a<this.numChildren?(this.yb=a+1,{done:!1,value:[this.xb[a].name,ee.visit(this.children[a],this.rowIndex)]}):{done:!0,value:null}}}
Object.defineProperties(ce.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ae]:{writable:!0,enumerable:!1,configurable:!1,value:null},[be]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});
class de{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(a){return a[ae].type.children.map(b=>b.name)}has(a,b){return-1!==a[ae].type.children.findIndex(c=>c.name===b)}getOwnPropertyDescriptor(a,b){if(-1!==a[ae].type.children.findIndex(c=>c.name===b))return{writable:!0,enumerable:!0,configurable:!0}}get(a,b){if(Reflect.has(a,b))return a[b];var c=a[ae].type.children.findIndex(d=>d.name===b);if(-1!==c)return c=ee.visit(a[ae].children[c],a[be]),Reflect.set(a,b,c),
c}set(a,b,c){const d=a[ae].type.children.findIndex(e=>e.name===b);return-1!==d?(Vd.visit(a[ae].children[d],a[be],c),Reflect.set(a,b,c)):Reflect.has(a,b)||"symbol"===typeof b?Reflect.set(a,b,c):!1}};class ge extends nd{}function G(a){return(b,c)=>b.getValid(c)?a(b,c):null}
const he=(a,b)=>4294967296*a[b+1]+(a[b]>>>0),ie=({values:a},b)=>new Date(864E5*a[b]),je=({values:a},b)=>new Date(he(a,2*b)),ke=({stride:a,values:b},c)=>b[a*c],le=({values:a},b)=>a[b],me=({values:a},b)=>1E3*he(a,2*b),ne=({values:a},b)=>he(a,2*b),oe=({values:a},b)=>{b*=2;return a[b+1]/1E3*4294967296+(a[b]>>>0)/1E3},pe=({values:a},b)=>{b*=2;return a[b+1]/1E6*4294967296+(a[b]>>>0)/1E6},qe=({values:a},b)=>a[b],re=({values:a},b)=>a[b],se=({values:a},b)=>a[b],te=({values:a},b)=>a[b],ue=(a,b)=>ee.visit(a.children[a.type.typeIdToChildIndex[a.typeIds[b]]],
a.valueOffsets[b]),ve=(a,b)=>ee.visit(a.children[a.type.typeIdToChildIndex[a.typeIds[b]]],b),we=({values:a},b)=>a.subarray(2*b,2*(b+1)),xe=({values:a},b)=>{a=a[b];b=new Int32Array(2);b[0]=Math.trunc(a/12);b[1]=Math.trunc(a%12);return b};h=ge.prototype;h.visitNull=G(()=>null);h.visitBool=G(({offset:a,values:b},c)=>{a+=c;return 0!==(b[a>>3]&1<<a%8)});h.visitInt=G(({values:a},b)=>a[b]);h.visitInt8=G(ke);h.visitInt16=G(ke);h.visitInt32=G(ke);h.visitInt64=G(le);h.visitUint8=G(ke);h.visitUint16=G(ke);
h.visitUint32=G(ke);h.visitUint64=G(le);h.visitFloat=G(({type:a,values:b},c)=>a.precision!==x.HALF?b[c]:td(b[c]));h.visitFloat16=G(({stride:a,values:b},c)=>td(b[a*c]));h.visitFloat32=G(ke);h.visitFloat64=G(ke);h.visitUtf8=G(({values:a,valueOffsets:b},c)=>{a=c+1>=b.length?null:a.subarray(b[c],b[c+1]);return null!==a?va.decode(a):null});h.visitBinary=G(({values:a,valueOffsets:b},c)=>c+1>=b.length?null:a.subarray(b[c],b[c+1]));h.visitFixedSizeBinary=G(({stride:a,values:b},c)=>b.subarray(a*c,a*(c+1)));
h.visitDate=G((a,b)=>a.type.unit===$a.DAY?ie(a,b):je(a,b));h.visitDateDay=G(ie);h.visitDateMillisecond=G(je);h.visitTimestamp=G((a,b)=>{switch(a.type.unit){case y.SECOND:return me(a,b);case y.MILLISECOND:return ne(a,b);case y.MICROSECOND:return oe(a,b);case y.NANOSECOND:return pe(a,b)}});h.visitTimestampSecond=G(me);h.visitTimestampMillisecond=G(ne);h.visitTimestampMicrosecond=G(oe);h.visitTimestampNanosecond=G(pe);
h.visitTime=G((a,b)=>{switch(a.type.unit){case y.SECOND:return qe(a,b);case y.MILLISECOND:return re(a,b);case y.MICROSECOND:return se(a,b);case y.NANOSECOND:return te(a,b)}});h.visitTimeSecond=G(qe);h.visitTimeMillisecond=G(re);h.visitTimeMicrosecond=G(se);h.visitTimeNanosecond=G(te);h.visitDecimal=G(({values:a,stride:b},c)=>new pb(a.subarray(b*c,b*(c+1))));h.visitList=G((a,b)=>{const c=a.stride,d=a.children,{[b*c]:e,[b*c+1]:f}=a.valueOffsets;a=d[0].slice(e,f-e);return new F([a])});
h.visitStruct=G((a,b)=>new ce(a,b));h.visitUnion=G((a,b)=>a.type.mode===w.Dense?ue(a,b):ve(a,b));h.visitDenseUnion=G(ue);h.visitSparseUnion=G(ve);h.visitDictionary=G((a,b)=>{let c;return null==(c=a.dictionary)?void 0:c.get(a.values[b])});h.visitInterval=G((a,b)=>a.type.unit===cb.DAY_TIME?we(a,b):xe(a,b));h.visitIntervalDayTime=G(we);h.visitIntervalYearMonth=G(xe);h.visitFixedSizeList=G((a,b)=>{const c=a.stride;a=a.children[0].slice(b*c,c);return new F([a])});
h.visitMap=G((a,b)=>{const c=a.children,{[b]:d,[b+1]:e}=a.valueOffsets;return new ye(c[0].slice(d,e-d))});const ee=new ge;const ze=Symbol.for("keys"),Ae=Symbol.for("vals");
class ye{constructor(a){this[ze]=(new F([a.children[0]])).memoize();this[Ae]=a.children[1];return new Proxy(this,new Be)}[Symbol.iterator](){return new Ce(this[ze],this[Ae])}get size(){return this[ze].length}toArray(){return Object.values(this.toJSON())}toJSON(){const a=this[ze],b=this[Ae],c={};for(let d=-1,e=a.length;++d<e;)c[a.get(d)]=ee.visit(b,d);return c}toString(){return`{${[...this].map(([a,b])=>`${hb(a)}: ${hb(b)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}
class Ce{constructor(a,b){this.keys=a;this.Yb=b;this.Cb=0;this.Xb=a.length}[Symbol.iterator](){return this}next(){const a=this.Cb;if(a===this.Xb)return{done:!0,value:null};this.Cb++;return{done:!1,value:[this.keys.get(a),ee.visit(this.Yb,a)]}}}
class Be{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(a){return a[ze].toArray().map(String)}has(a,b){return a[ze].includes(b)}getOwnPropertyDescriptor(a,b){if(-1!==a[ze].indexOf(b))return{writable:!0,enumerable:!0,configurable:!0}}get(a,b){if(Reflect.has(a,b))return a[b];var c=a[ze].indexOf(b);if(-1!==c)return c=ee.visit(Reflect.get(a,Ae),c),Reflect.set(a,b,c),c}set(a,b,c){const d=a[ze].indexOf(b);return-1!==d?(Vd.visit(Reflect.get(a,Ae),d,c),Reflect.set(a,
b,c)):Reflect.has(a,b)?Reflect.set(a,b,c):!1}}Object.defineProperties(ye.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ze]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ae]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let De;function Ee(a,b,c,d){const {length:e=0}=a;b="number"!==typeof b?0:b;c="number"!==typeof c?e:c;0>b&&(b=(b%e+e)%e);0>c&&(c=(c%e+e)%e);c<b&&(De=b,b=c,c=De);c>e&&(c=e);return d?d(a,b,c):[b,c]}const Fe=a=>a!==a;function Ge(a){if("object"!==typeof a||null===a)return a!==a?Fe:b=>b===a;if(a instanceof Date){const b=a.valueOf();return c=>c instanceof Date?c.valueOf()===b:!1}return ArrayBuffer.isView(a)?b=>b?Ma(a,b):!1:a instanceof Map?He(a):Array.isArray(a)?Ie(a):a instanceof F?Je(a):Ke(a)}
function Ie(a){const b=[];for(let c=-1,d=a.length;++c<d;)b[c]=Ge(a[c]);return Le(b)}function He(a){let b=-1;const c=[];for(const d of a.values())c[++b]=Ge(d);return Le(c)}function Je(a){const b=[];for(let c=-1,d=a.length;++c<d;)b[c]=Ge(a.get(c));return Le(b)}function Ke(a){const b=Object.keys(a),c=[];for(let d=-1,e=b.length;++d<e;)c[d]=Ge(a[b[d]]);return Le(c,b)}
function Le(a,b){return c=>{if(!c||"object"!==typeof c)return!1;switch(c.constructor){case Array:a:{var d=a.length;if(c.length!==d)c=!1;else{for(var e=-1;++e<d;)if(!a[e](c[e])){c=!1;break a}c=!0}}return c;case Map:return Me(a,c,c.keys());case ye:case ce:case Object:case void 0:return Me(a,c,b||Object.keys(c))}if(c instanceof F)a:if(d=a.length,c.length!==d)c=!1;else{for(e=-1;++e<d;)if(!a[e](c.get(e))){c=!1;break a}c=!0}else c=!1;return c}}
function Me(a,b,c){c=c[Symbol.iterator]();const d=b instanceof Map?b.keys():Object.keys(b)[Symbol.iterator]();b=b instanceof Map?b.values():Object.values(b)[Symbol.iterator]();let e=0;const f=a.length;let g=b.next(),k=c.next(),m=d.next();for(;e<f&&!k.done&&!m.done&&!g.done&&k.value===m.value&&a[e](g.value);++e,k=c.next(),m=d.next(),g=b.next());if(e===f&&k.done&&m.done&&g.done)return!0;c.return&&c.return();d.return&&d.return();b.return&&b.return();return!1}
var Ne={clampIndex:function(a,b,c){const d=a.length;b=-1<b?b:d+b%d;return c?c(a,b):b}};Ne.clampRange=Ee;Ne.createElementComparator=Ge;function Oe(a,b,c,d){return 0!==(c&1<<d)}function Pe(a,b,c,d){return(c&1<<d)>>d}function Qe(a,b,c){const d=c.byteLength+7&-8;if(0<a||c.byteLength<d){const e=new Uint8Array(d);e.set(0===a%8?c.subarray(a>>3):Re(new Se(c,a,b,null,Oe)).subarray(0,d));return e}return c}function Re(a){const b=[];let c=0,d=0,e=0;for(const f of a)f&&(e|=1<<d),8===++d&&(b[c++]=e,e=d=0);if(0===c||0<d)b[c++]=e;a=new Uint8Array(b.length+7&-8);a.set(b);return a}
class Se{constructor(a,b,c,d,e){this.S=a;this.length=c;this.context=d;this.get=e;this.Xa=b%8;this.wb=b>>3;this.vb=a[this.wb++];this.index=0}next(){return this.index<this.length?(8===this.Xa&&(this.Xa=0,this.vb=this.S[this.wb++]),{value:this.get(this.context,this.index++,this.vb,this.Xa++)}):{done:!0,value:null}}[Symbol.iterator](){return this}}
function Te(a,b,c){if(0>=c-b)return 0;if(8>c-b){var d=0;for(var e of new Se(a,b,c-b,a,Pe))d+=e;return d}d=c>>3<<3;e=b+(0===b%8?0:8-b%8);return Te(a,b,e)+Te(a,d,c)+Ue(a,e>>3,d-e>>3)}function Ue(a,b,c){let d=0;b=Math.trunc(b);const e=new DataView(a.buffer,a.byteOffset,a.byteLength);for(a=void 0===c?a.byteLength:b+c;4<=a-b;)d+=Ve(e.getUint32(b)),b+=4;for(;2<=a-b;)d+=Ve(e.getUint16(b)),b+=2;for(;1<=a-b;)d+=Ve(e.getUint8(b)),b+=1;return d}
function Ve(a){a=Math.trunc(a);a-=a>>>1&1431655765;a=(a&858993459)+(a>>>2&858993459);return 16843009*(a+(a>>>4)&252645135)>>>24}var We={};We.BitIterator=Se;We.getBit=Pe;We.getBool=Oe;We.packBools=Re;We.popcnt_array=Ue;We.popcnt_bit_range=Te;We.popcnt_uint32=Ve;We.setBool=function(a,b,c){return c?!!(a[b>>3]|=1<<b%8)||!0:!(a[b>>3]&=~(1<<b%8))&&!1};We.truncateBitmap=Qe;function Xe(a,b){if(a.typeId===A.Null)return a.clone(a.type,0,b,0);const c=a.length,d=a.nullCount,e=(new Uint8Array((b+63&-64)>>3)).fill(255,0,c>>3);e[c>>3]=(1<<c-(c&-8))-1;0<d&&e.set(Qe(a.offset,c,a.nullBitmap),0);const f=a.buffers;f[fb.VALIDITY]=e;return a.clone(a.type,0,b,d+(b-c),f)}function Ye(a,b,c){return a.map(d=>d.slice(b,c))}
class H{constructor(a,b,c,d,e,f=[],g){this.type=a;this.children=f;this.dictionary=g;this.offset=Math.floor(Math.max(b||0,0));this.length=Math.floor(Math.max(c||0,0));this.F=Math.floor(Math.max(d||0,-1));let k;e instanceof H?(this.stride=e.stride,this.values=e.values,this.typeIds=e.typeIds,this.nullBitmap=e.nullBitmap,this.valueOffsets=e.valueOffsets):(this.stride=md(a),e&&((k=e[0])&&(this.valueOffsets=k),(k=e[1])&&(this.values=k),(k=e[2])&&(this.nullBitmap=k),(k=e[3])&&(this.typeIds=k)));this.nullable=
0!==this.F&&this.nullBitmap&&0<this.nullBitmap.byteLength}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get byteLength(){let a=0;const b=this.valueOffsets,c=this.values,d=this.nullBitmap,e=this.typeIds;b&&(a+=b.byteLength);c&&(a+=c.byteLength);d&&(a+=d.byteLength);e&&(a+=e.byteLength);return this.children.reduce((f,g)=>f+g.byteLength,a)}get nullCount(){let a=this.F,b;-1>=a&&(b=this.nullBitmap)&&
(this.F=a=this.length-Te(b,this.offset,this.offset+this.length));return a}getValid(a){return this.nullable&&0<this.nullCount?(a=this.offset+a,0!==(this.nullBitmap[a>>3]&1<<a%8)):!0}setValid(a,b){if(!this.nullable)return b;if(!this.nullBitmap||this.nullBitmap.byteLength<=a>>3){var {nullBitmap:c}=Xe(this,this.length);Object.assign(this,{nullBitmap:c,F:0})}c=this.nullBitmap;var d=this.offset;const e=d+a>>3;a=(d+a)%8;d=c[e]>>a&1;b?0===d&&(c[e]|=1<<a,this.F=this.nullCount+1):1===d&&(c[e]&=~(1<<a),this.F=
this.nullCount-1);return b}clone(a=this.type,b=this.offset,c=this.length,d=this.F,e=this,f=this.children){return new H(a,b,c,d,e,f,this.dictionary)}slice(a,b){const c=this.stride,d=this.typeId,e=this.children,f=+(0===this.F)-1,g=16===d?c:1;let k;const m=this.buffers;(k=m[fb.TYPE])&&(m[fb.TYPE]=k.subarray(a,a+b));(k=m[fb.OFFSET])&&(m[fb.OFFSET]=k.subarray(a,a+b+1))||(k=m[fb.DATA])&&(m[fb.DATA]=6===d?k:k.subarray(c*a,c*(a+b)));return this.clone(this.type,this.offset+a,b,f,m,0===e.length||this.valueOffsets?
e:Ye(e,g*a,g*b))}}H.prototype.children=Object.freeze([]);
class Ze extends nd{visit(a){return this.getVisitFn(a.type).call(this,a)}visitNull(a){const {type:b,offset:c=0,length:d=0}=a;return new H(b,c,d,0)}visitBool(a){const {type:b,offset:c=0}=a,d=u(Uint8Array,a.nullBitmap),e=u(b.ArrayType,a.data),{length:f=e.length>>3,nullCount:g=a.nullBitmap?-1:0}=a;return new H(b,c,f,g,[void 0,e,d])}visitInt(a){const {type:b,offset:c=0}=a,d=u(Uint8Array,a.nullBitmap),e=u(b.ArrayType,a.data),{length:f=e.length,nullCount:g=a.nullBitmap?-1:0}=a;return new H(b,c,f,g,[void 0,
e,d])}visitFloat(a){const {type:b,offset:c=0}=a,d=u(Uint8Array,a.nullBitmap),e=u(b.ArrayType,a.data),{length:f=e.length,nullCount:g=a.nullBitmap?-1:0}=a;return new H(b,c,f,g,[void 0,e,d])}visitUtf8(a){const {type:b,offset:c=0}=a,d=u(Uint8Array,a.data),e=u(Uint8Array,a.nullBitmap),f=u(Int32Array,a.valueOffsets),{length:g=f.length-1,nullCount:k=a.nullBitmap?-1:0}=a;return new H(b,c,g,k,[f,d,e])}visitBinary(a){const {type:b,offset:c=0}=a,d=u(Uint8Array,a.data),e=u(Uint8Array,a.nullBitmap),f=u(Int32Array,
a.valueOffsets),{length:g=f.length-1,nullCount:k=a.nullBitmap?-1:0}=a;return new H(b,c,g,k,[f,d,e])}visitFixedSizeBinary(a){const {type:b,offset:c=0}=a,d=u(Uint8Array,a.nullBitmap),e=u(b.ArrayType,a.data),{length:f=e.length/md(b),nullCount:g=a.nullBitmap?-1:0}=a;return new H(b,c,f,g,[void 0,e,d])}visitDate(a){const {type:b,offset:c=0}=a,d=u(Uint8Array,a.nullBitmap),e=u(b.ArrayType,a.data),{length:f=e.length/md(b),nullCount:g=a.nullBitmap?-1:0}=a;return new H(b,c,f,g,[void 0,e,d])}visitTimestamp(a){const {type:b,
offset:c=0}=a,d=u(Uint8Array,a.nullBitmap),e=u(b.ArrayType,a.data),{length:f=e.length/md(b),nullCount:g=a.nullBitmap?-1:0}=a;return new H(b,c,f,g,[void 0,e,d])}visitTime(a){const {type:b,offset:c=0}=a,d=u(Uint8Array,a.nullBitmap),e=u(b.ArrayType,a.data),{length:f=e.length/md(b),nullCount:g=a.nullBitmap?-1:0}=a;return new H(b,c,f,g,[void 0,e,d])}visitDecimal(a){const {type:b,offset:c=0}=a,d=u(Uint8Array,a.nullBitmap),e=u(b.ArrayType,a.data),{length:f=e.length/md(b),nullCount:g=a.nullBitmap?-1:0}=a;
return new H(b,c,f,g,[void 0,e,d])}visitList(a){const {type:b,offset:c=0,child:d}=a,e=u(Uint8Array,a.nullBitmap),f=u(Int32Array,a.valueOffsets),{length:g=f.length-1,nullCount:k=a.nullBitmap?-1:0}=a;return new H(b,c,g,k,[f,void 0,e],[d])}visitStruct(a){const {type:b,offset:c=0,children:d=[]}=a,e=u(Uint8Array,a.nullBitmap),{length:f=d.reduce((k,{length:m})=>Math.max(k,m),0),nullCount:g=a.nullBitmap?-1:0}=a;return new H(b,c,f,g,[void 0,void 0,e],d)}visitUnion(a){const {type:b,offset:c=0,children:d=[]}=
a,e=u(Uint8Array,a.nullBitmap),f=u(b.ArrayType,a.typeIds),{length:g=f.length,nullCount:k=a.nullBitmap?-1:0}=a;if(C.isSparseUnion(b))return new H(b,c,g,k,[void 0,void 0,e,f],d);a=u(Int32Array,a.valueOffsets);return new H(b,c,g,k,[a,void 0,e,f],d)}visitDictionary(a){const {type:b,offset:c=0}=a,d=u(Uint8Array,a.nullBitmap),e=u(b.indices.ArrayType,a.data),{dictionary:f=new F([(new Ze).visit({type:b.dictionary})])}=a,{length:g=e.length,nullCount:k=a.nullBitmap?-1:0}=a;return new H(b,c,g,k,[void 0,e,d],
[],f)}visitInterval(a){const {type:b,offset:c=0}=a,d=u(Uint8Array,a.nullBitmap),e=u(b.ArrayType,a.data),{length:f=e.length/md(b),nullCount:g=a.nullBitmap?-1:0}=a;return new H(b,c,f,g,[void 0,e,d])}visitFixedSizeList(a){const {type:b,offset:c=0,child:d=(new Ze).visit({type:b.valueType})}=a,e=u(Uint8Array,a.nullBitmap),{length:f=d.length/md(b),nullCount:g=a.nullBitmap?-1:0}=a;return new H(b,c,f,g,[void 0,void 0,e],[d])}visitMap(a){const {type:b,offset:c=0,child:d=(new Ze).visit({type:b.childType})}=
a,e=u(Uint8Array,a.nullBitmap),f=u(Int32Array,a.valueOffsets),{length:g=f.length-1,nullCount:k=a.nullBitmap?-1:0}=a;return new H(b,c,g,k,[f,void 0,e],[d])}}function I(a){return(new Ze).visit(a)};class $e{constructor(a=0,b){this.Db=a;this.Bb=b;this.$a=0;this.zb=this.Bb(0)}next(){for(;this.$a<this.Db;){const a=this.zb.next();if(!a.done)return a;++this.$a<this.Db&&(this.zb=this.Bb(this.$a))}return{done:!0,value:null}}[Symbol.iterator](){return this}}function af(a){return a.reduce((b,c)=>b+c.nullCount,0)}function bf(a){return a.reduce((b,c,d)=>{b[d+1]=b[d]+c.length;return b},new Uint32Array(a.length+1))}
function cf(a,b,c,d){const e=[];for(let f=-1,g=a.length;++f<g;){const k=a[f],m=b[f],p=k.length;if(m>=d)break;if(c>=m+p)continue;if(m>=c&&m+p<=d){e.push(k);continue}const r=Math.max(0,c-m);e.push(k.slice(r,Math.min(d-m,p)-r))}0===e.length&&e.push(a[0].slice(0,0));return e}function df(a,b,c,d){let e=0,f,g=b.length-1;do{if(e>=g-1)return c<b[g]?d(a,e,c-b[e]):null;f=e+Math.trunc(.5*(g-e));c<b[f]?g=f:e=f}while(e<g)}function ef(a,b){return a.getValid(b)}
function ff(a){function b(c,d,e){return a(c[d],e)}return function(c){return df(this.data,this.m,c,b)}}function gf(a){function b(d,e,f){return a(d[e],f,c)}let c;return function(d,e){const f=this.data;c=e;d=df(f,this.m,d,b);c=void 0;return d}}function hf(a){function b(d,e,f){var g=f;f=0;for(let k=e-1,m=d.length;++k<m;){e=d[k];if(~(g=a(e,c,g)))return f+g;g=0;f+=e.length}return-1}let c;return function(d,e){c=d;d=this.data;e="number"!==typeof e?b(d,0,0):df(d,this.m,e,b);c=void 0;return e}};class jf extends nd{}function J(a,b,c){if(void 0===b)return-1;if(null===b){a:{const e=a.nullBitmap;if(e&&!(0>=a.nullCount)){b=0;for(var d of new Se(e,a.offset+(c||0),a.length,e,Oe)){if(!d){a=b;break a}++b}}a=-1}return a}d=ee.getVisitFn(a);b=Ge(b);for(let e=(c||0)-1,f=a.length;++e<f;)if(b(d(a,e)))return e;return-1}function kf(a,b,c){const d=ee.getVisitFn(a);b=Ge(b);for(let e=(c||0)-1,f=a.length;++e<f;)if(b(d(a,e)))return e;return-1}h=jf.prototype;
h.visitNull=function(a,b){return null===b&&0<a.length?0:-1};h.visitBool=J;h.visitInt=J;h.visitInt8=J;h.visitInt16=J;h.visitInt32=J;h.visitInt64=J;h.visitUint8=J;h.visitUint16=J;h.visitUint32=J;h.visitUint64=J;h.visitFloat=J;h.visitFloat16=J;h.visitFloat32=J;h.visitFloat64=J;h.visitUtf8=J;h.visitBinary=J;h.visitFixedSizeBinary=J;h.visitDate=J;h.visitDateDay=J;h.visitDateMillisecond=J;h.visitTimestamp=J;h.visitTimestampSecond=J;h.visitTimestampMillisecond=J;h.visitTimestampMicrosecond=J;
h.visitTimestampNanosecond=J;h.visitTime=J;h.visitTimeSecond=J;h.visitTimeMillisecond=J;h.visitTimeMicrosecond=J;h.visitTimeNanosecond=J;h.visitDecimal=J;h.visitList=J;h.visitStruct=J;h.visitUnion=J;h.visitDenseUnion=kf;h.visitSparseUnion=kf;h.visitDictionary=J;h.visitInterval=J;h.visitIntervalDayTime=J;h.visitIntervalYearMonth=J;h.visitFixedSizeList=J;h.visitMap=J;const lf=new jf;class mf extends nd{}function K(a){const b=a.type;if(0===a.nullCount&&1===a.stride&&(b.typeId===A.Timestamp||b instanceof xb&&64!==b.bitWidth||b instanceof nc&&64!==b.bitWidth||b instanceof Lb&&b.precision!==x.HALF))return new $e(a.data.length,d=>{d=a.data[d];return d.values.subarray(0,d.length)[Symbol.iterator]()});let c=0;return new $e(a.data.length,d=>{d=a.data[d].length;const e=a.slice(c,c+d);c+=d;return new nf(e)})}
class nf{constructor(a){this.Eb=a;this.index=0}next(){return this.index<this.Eb.length?{value:this.Eb.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}}h=mf.prototype;h.visitNull=K;h.visitBool=K;h.visitInt=K;h.visitInt8=K;h.visitInt16=K;h.visitInt32=K;h.visitInt64=K;h.visitUint8=K;h.visitUint16=K;h.visitUint32=K;h.visitUint64=K;h.visitFloat=K;h.visitFloat16=K;h.visitFloat32=K;h.visitFloat64=K;h.visitUtf8=K;h.visitBinary=K;h.visitFixedSizeBinary=K;h.visitDate=K;
h.visitDateDay=K;h.visitDateMillisecond=K;h.visitTimestamp=K;h.visitTimestampSecond=K;h.visitTimestampMillisecond=K;h.visitTimestampMicrosecond=K;h.visitTimestampNanosecond=K;h.visitTime=K;h.visitTimeSecond=K;h.visitTimeMillisecond=K;h.visitTimeMicrosecond=K;h.visitTimeNanosecond=K;h.visitDecimal=K;h.visitList=K;h.visitStruct=K;h.visitUnion=K;h.visitDenseUnion=K;h.visitSparseUnion=K;h.visitDictionary=K;h.visitInterval=K;h.visitIntervalDayTime=K;h.visitIntervalYearMonth=K;h.visitFixedSizeList=K;
h.visitMap=K;const of=new mf;const pf=(a,b)=>a+b;
class qf extends nd{visitNull(){return 0}visitInt(a){return a.type.bitWidth/8}visitFloat(a){return a.type.ArrayType.BYTES_PER_ELEMENT}visitBool(){return.125}visitDecimal(a){return a.type.bitWidth/8}visitDate(a){return 4*(a.type.unit+1)}visitTime(a){return a.type.bitWidth/8}visitTimestamp(a){return a.type.unit===y.SECOND?4:8}visitInterval(a){return 4*(a.type.unit+1)}visitStruct(a,b){return a.children.reduce((c,d)=>c+rf.visit(d,b),0)}visitFixedSizeBinary(a){return a.type.byteWidth}visitMap(a,b){return 8+
a.children.reduce((c,d)=>c+rf.visit(d,b),0)}visitDictionary(a,b){let c;return a.type.indices.bitWidth/8+((null==(c=a.dictionary)?void 0:c.getByteLength(a.values[b]))||0)}}const sf=({type:a,children:b,typeIds:c,valueOffsets:d},e)=>8+rf.visit(b[a.typeIdToChildIndex[c[e]]],d[e]),tf=({children:a},b)=>4+rf.visitMany(a,a.map(()=>b)).reduce(pf,0);h=qf.prototype;h.visitUtf8=({valueOffsets:a},b)=>8+(a[b+1]-a[b]);h.visitBinary=({valueOffsets:a},b)=>8+(a[b+1]-a[b]);
h.visitList=({valueOffsets:a,stride:b,children:c},d)=>{var e=c[0];({[d*b]:c}=a);({[d*b+1]:a}=a);b=rf.getVisitFn(e.type);e=e.slice(c,a-c);d=8;for(let f=-1,g=a-c;++f<g;)d+=b(e,f);return d};h.visitFixedSizeList=({stride:a,children:b},c)=>{b=b[0];a=b.slice(c*a,a);c=rf.getVisitFn(b.type);b=0;for(let d=-1,e=a.length;++d<e;)b+=c(a,d);return b};h.visitUnion=(a,b)=>a.type.mode===w.Dense?sf(a,b):tf(a,b);h.visitDenseUnion=sf;h.visitSparseUnion=tf;const rf=new qf;const uf={},vf={};
class F{constructor(a){a=a[0]instanceof F?a.flatMap(f=>f.data):a;if(0===a.length||a.some(f=>!(f instanceof H)))throw new TypeError("Vector constructor expects an Array of Data instances.");let b;const c=null==(b=a[0])?void 0:b.type;switch(a.length){case 0:this.m=[0];break;case 1:const {get:f,set:g,indexOf:k,byteLength:m}=uf[c.typeId],p=a[0];this.isValid=r=>p.getValid(r);this.get=r=>f(p,r);this.set=(r,T)=>g(p,r,T);this.indexOf=r=>k(p,r);this.getByteLength=r=>m(p,r);this.m=[0,p.length];break;default:Object.setPrototypeOf(this,
vf[c.typeId]),this.m=bf(a)}this.data=a;this.type=c;this.stride=md(c);let d,e;this.numChildren=null!=(e=null==(d=c.children)?void 0:d.length)?e:0;this.length=this.m[this.m.length-1]}get byteLength(){-1===this.ba&&(this.ba=this.data.reduce((a,b)=>a+b.byteLength,0));return this.ba}get nullCount(){-1===this.F&&(this.F=af(this.data));return this.F}get ArrayType(){return this.type.ArrayType}get [Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${A[this.type.typeId]}Vector`}isValid(){return!1}get(){return null}set(){}indexOf(){return-1}includes(a,
b){return 0<this.indexOf(a,b)}getByteLength(){return 0}[Symbol.iterator](){return of.visit(this)}concat(...a){return new F(this.data.concat(a.flatMap(b=>b.data).flat(Number.POSITIVE_INFINITY)))}slice(a,b){return new F(Ee(this,a,b,({data:c,m:d},e,f)=>cf(c,d,e,f)))}toJSON(){return[...this]}toArray(){const a=this.data,b=this.length,c=this.stride,d=this.ArrayType;switch(this.type.typeId){case A.Int:case A.Float:case A.Decimal:case A.Time:case A.Timestamp:switch(a.length){case 0:return new d;case 1:return a[0].values.subarray(0,
b*c);default:return a.reduce((e,{values:f,length:g})=>{e.ub.set(f.subarray(0,g*c),e.offset);e.offset+=g*c;return e},{ub:new d(b*c),offset:0}).ub}}return[...this]}toString(){return`[${[...this].join()}]`}getChild(a){let b;return this.getChildAt(null==(b=this.type.children)?void 0:b.findIndex(c=>c.name===a))}getChildAt(a){return-1<a&&a<this.numChildren?new F(this.data.map(({children:b})=>b[a])):null}get isMemoized(){return C.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(C.isDictionary(this.type)){const a=
new wf(this.data[0].dictionary),b=this.data.map(c=>{c=c.clone();c.dictionary=a;return c});return new F(b)}return new wf(this)}unmemoize(){if(C.isDictionary(this.type)&&this.isMemoized){const a=this.data[0].dictionary.unmemoize(),b=this.data.map(c=>{c=c.clone();c.dictionary=a;return c});return new F(b)}return this}}
F[Symbol.toStringTag]=(a=>{a.type=C.prototype;a.data=[];a.length=0;a.stride=1;a.numChildren=0;a.F=-1;a.ba=-1;a.m=new Uint32Array([0]);a[Symbol.isConcatSpreadable]=!0;var b=Object.keys(A).map(c=>A[c]).filter(c=>"number"===typeof c&&c!==A.NONE);for(const c of b){b=ee.getVisitFnByTypeId(c);const d=Vd.getVisitFnByTypeId(c),e=lf.getVisitFnByTypeId(c),f=rf.getVisitFnByTypeId(c);uf[c]={get:b,set:d,indexOf:e,byteLength:f};vf[c]=Object.create(a,{isValid:{value:ff(ef)},get:{value:ff(ee.getVisitFnByTypeId(c))},
set:{value:gf(Vd.getVisitFnByTypeId(c))},indexOf:{value:hf(lf.getVisitFnByTypeId(c))},getByteLength:{value:ff(rf.getVisitFnByTypeId(c))}})}return"Vector"})(F.prototype);
class wf extends F{constructor(a){super(a.data);const b=this.get,c=this.set,d=this.slice,e=Array(this.length);Object.defineProperty(this,"get",{value(f){var g=e[f];if(void 0!==g)return g;g=b.call(this,f);return e[f]=g}});Object.defineProperty(this,"set",{value(f,g){c.call(this,f,g);e[f]=g}});Object.defineProperty(this,"slice",{value:(f,g)=>new wf(d.call(this,f,g))});Object.defineProperty(this,"isMemoized",{value:!0});Object.defineProperty(this,"unmemoize",{value:()=>new F(this.data)});Object.defineProperty(this,
"memoize",{value:()=>this})}}
function xf(a){if(a){if(a instanceof H)return new F([a]);if(a instanceof F)return new F(a.data);if(a.type instanceof C)return new F([I(a)]);if(Array.isArray(a))return new F(a.flatMap(b=>b instanceof H?[b]:b instanceof F?b.data:xf(b).data));if(ArrayBuffer.isView(a)){a instanceof DataView&&(a=new Uint8Array(a.buffer));const b={offset:0,length:a.length,nullCount:0,data:a};if(a instanceof Int8Array)return new F([I(Object.assign({},b,{type:new Bb}))]);if(a instanceof Int16Array)return new F([I(Object.assign({},b,
{type:new Cb}))]);if(a instanceof Int32Array)return new F([I(Object.assign({},b,{type:new Db}))]);if(a instanceof za)return new F([I(Object.assign({},b,{type:new Gb}))]);if(a instanceof Uint8Array||a instanceof Uint8ClampedArray)return new F([I(Object.assign({},b,{type:new Hb}))]);if(a instanceof Uint16Array)return new F([I(Object.assign({},b,{type:new Ib}))]);if(a instanceof Uint32Array)return new F([I(Object.assign({},b,{type:new Jb}))]);if(a instanceof Aa)return new F([I(Object.assign({},b,{type:new Kb}))]);
if(a instanceof Float32Array)return new F([I(Object.assign({},b,{type:new Qb}))]);if(a instanceof Float64Array)return new F([I(Object.assign({},b,{type:new Rb}))])}}throw Error("Unrecognized input");};function yf(a){if(!a||0>=a.length)return function(){return!0};let b="";const c=a.filter(d=>d===d);0<c.length&&(b=`
    switch (x) {${c.map(d=>`
        case ${"bigint"!==typeof d?hb(d):ya?`${hb(d)}n`:`"${hb(d)}"`}:`).join("")}
            return false;
    }`);a.length!==c.length&&(b=`if (x !== x) return false;\n${b}`);return new Function("x",`${b}\nreturn true;`)};const zf=(a,b)=>(Math.ceil(a)*b+63&-64||64)/b,Af=(a,b=0)=>a.length>=b?a.subarray(0,b):Ga(new a.constructor(b),a,0);function Bf(a,b){a.buffer=Ga(new a.ArrayType(b),a.buffer)}function Cf(a,b){if(0<b){a.length+=b;b=a.length*a.stride;const c=a.buffer.length;b>=c&&Bf(a,0===c?zf(1*b,a.BYTES_PER_ELEMENT):zf(2*b,a.BYTES_PER_ELEMENT))}return a}
class Df{constructor(a,b=1){this.buffer=a;this.stride=b;this.BYTES_PER_ELEMENT=a.BYTES_PER_ELEMENT;this.ArrayType=a.constructor;Bf(this,this.length=Math.ceil(a.length/b))}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(){return this}append(a){return this.set(this.length,a)}flush(a=this.length){a=zf(a*this.stride,this.BYTES_PER_ELEMENT);a=Af(this.buffer,
a);this.clear();return a}clear(){this.length=0;Bf(this,0);return this}}Df.prototype.offset=0;class Ef extends Df{get(a){return this.buffer[a]}set(a,b){Cf(this,a-this.length+1);this.buffer[a*this.stride]=b;return this}}
class Ff extends Ef{constructor(){super(new Uint8Array(0),.125);this.Ka=0}get Wb(){return this.length-this.Ka}get(a){return this.buffer[a>>3]>>a%8&1}set(a,b){const {buffer:c}=Cf(this,a-this.length+1),d=a>>3;a%=8;const e=c[d]>>a&1;b?0===e&&(c[d]|=1<<a,++this.Ka):1===e&&(c[d]&=~(1<<a),--this.Ka);return this}clear(){this.Ka=0;return super.clear()}}
class Gf extends Ef{constructor(){super(new Int32Array(1),1)}append(a){return this.set(this.length-1,a)}set(a,b){const c=this.length-1,d=Cf(this,a-c+1).buffer;c<a++&&d.fill(d[c],c,a);d[a]=d[a-1]+b;return this}flush(a=this.length-1){a>this.length&&this.set(a-1,0);return super.flush(a+1)}};class Hf{constructor({type:a,nullValues:b}){this.length=0;this.finished=!1;this.type=a;this.children=[];this.nullValues=b;this.stride=md(a);this.J=new Ff;b&&0<b.length&&(this.ob=yf(b))}static throughNode(){throw Error('"throughNode" not available in this environment');}static throughDOM(){throw Error('"throughDOM" not available in this environment');}toVector(){return new F([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this.J.Wb}get numChildren(){return this.children.length}get byteLength(){let a=
0;const b=this.m,c=this.v,d=this.J,e=this.Z,f=this.children;b&&(a+=b.byteLength);c&&(a+=c.byteLength);d&&(a+=d.byteLength);e&&(a+=e.byteLength);return f.reduce((g,k)=>g+k.byteLength,a)}get reservedLength(){return this.J.reservedLength}get reservedByteLength(){let a=0;this.m&&(a+=this.m.reservedByteLength);this.v&&(a+=this.v.reservedByteLength);this.J&&(a+=this.J.reservedByteLength);this.Z&&(a+=this.Z.reservedByteLength);return this.children.reduce((b,c)=>b+c.reservedByteLength,a)}get valueOffsets(){return this.m?
this.m.buffer:null}get values(){return this.v?this.v.buffer:null}get nullBitmap(){return this.J?this.J.buffer:null}get typeIds(){return this.Z?this.Z.buffer:null}append(a){return this.set(this.length,a)}isValid(a){return this.ob(a)}set(a,b){this.setValid(a,this.isValid(b))&&this.setValue(a,b);return this}setValue(a,b){this.D(this,a,b)}setValid(a,b){this.length=this.J.set(a,+b).length;return b}addChild(){throw Error(`Cannot append children to non-nested type "${this.type}"`);}getChildAt(a){return this.children[a]||
null}flush(){let a,b,c,d;const e=this.type,f=this.length,g=this.nullCount;var k=this.m;const m=this.v,p=this.J;let r;(b=null==(r=this.Z)?void 0:r.flush(f))?d=null==k?void 0:k.flush(f):a=(d=null==k?void 0:k.flush(f))?null==m?void 0:m.flush(k.get(k.length-1)):null==m?void 0:m.flush(f);0<g&&(c=null==p?void 0:p.flush(f));k=this.children.map(T=>T.flush());this.clear();return I({type:e,length:f,nullCount:g,children:k,child:k[0],data:a,typeIds:b,nullBitmap:c,valueOffsets:d})}finish(){this.finished=!0;for(const a of this.children)a.finish();
return this}clear(){this.length=0;let a;null==(a=this.J)||a.clear();let b;null==(b=this.v)||b.clear();let c;null==(c=this.m)||c.clear();let d;null==(d=this.Z)||d.clear();for(const e of this.children)e.clear();return this}}h=Hf.prototype;h.length=1;h.stride=1;h.children=null;h.finished=!1;h.nullValues=null;h.ob=()=>!0;class If extends Hf{constructor(a){super(a);this.v=new Ef(new this.ArrayType(0),this.stride)}setValue(a,b){const c=this.v;Cf(c,a-c.length+1);return super.setValue(a,b)}}
function Jf(a){const b=a.C,c=a.M;a.M=0;a.C=void 0;b&&0<b.size&&a.ha(b,c)}class Kf extends Hf{constructor(a){super(a);this.M=0;this.m=new Gf}setValue(a,b){const c=this.C||(this.C=new Map),d=c.get(a);d&&(this.M-=d.length);this.M+=b instanceof ye?b[ze].length:b.length;c.set(a,b)}setValid(a,b){return super.setValid(a,b)?!0:((this.C||(this.C=new Map)).set(a,void 0),!1)}clear(){this.M=0;this.C=void 0;return super.clear()}flush(){Jf(this);return super.flush()}finish(){Jf(this);return super.finish()}};class Lf{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}offset(){return Mf(this.g,this.h)}ab(){return this.g.s(this.h+8)}bodyLength(){return Mf(this.g,this.h+16)}};const Nf=new Int32Array(2);new Float32Array(Nf.buffer);new Float64Array(Nf.buffer);new Uint16Array((new Uint8Array([1,0])).buffer);class Of{constructor(a,b){this.low=a|0;this.high=b|0}equals(a){return this.low==a.low&&this.high==a.high}}var Pf=new Of(0,0);var Qf,Rf=Qf||(Qf={});Rf[Rf.UTF8_BYTES=1]="UTF8_BYTES";Rf[Rf.UTF16_STRING=2]="UTF16_STRING";function Mf(a,b){return new Of(a.s(b),a.s(b+4))}function Sf(a,b){return a.j[b]}function Tf(a,b){return(a.j[b]|a.j[b+1]<<8)<<16>>16}function L(a,b,c){b-=a.s(b);return c<Tf(a,b)?Tf(a,b+c):0}function Uf(a,b,c){b.h=c+a.s(c);b.g=a;return b}
function Vf(a,b,c){b+=a.s(b);const d=a.s(b);let e="",f=0;b+=4;if(c===Qf.UTF8_BYTES)return a.j.subarray(b,b+d);for(;f<d;){c=Sf(a,b+f++);if(!(192>c)){const g=Sf(a,b+f++);if(224>c)c=(c&31)<<6|g&63;else{const k=Sf(a,b+f++);if(240>c)c=(c&15)<<12|(g&63)<<6|k&63;else{const m=Sf(a,b+f++);c=(c&7)<<18|(g&63)<<12|(k&63)<<6|m&63}}}65536>c?e+=String.fromCharCode(c):(c-=65536,e+=String.fromCharCode((c>>10)+55296,(c&1023)+56320))}return e}function Wf(a,b){return b+a.s(b)}function Xf(a,b){return b+a.s(b)+4}
function Yf(a,b){return a.s(b+a.s(b))}class Zf{constructor(a){this.j=a;this.eb=0}clear(){this.eb=0}S(){return this.j}position(){return this.eb}setPosition(a){this.eb=a}s(a){return this.j[a]|this.j[a+1]<<8|this.j[a+2]<<16|this.j[a+3]<<24}na(a,b){this.j[a]=b}jb(a,b){this.j[a]=b;this.j[a+1]=b>>8}X(a,b){this.j[a]=b;this.j[a+1]=b>>8;this.j[a+2]=b>>16;this.j[a+3]=b>>24}aa(a,b){this.X(a,b.low);this.X(a+4,b.high)}T(a,b){return 0==a&&0==b?Pf:new Of(a,b)}};function $f(a,b,c){b>a.xa&&(a.xa=b);const d=~(a.g.j.length-a.A+c)+1&b-1;for(;a.A<d+b+c;){const g=a.g.j.length;var e=a,f=a.g;const k=f.j.length;if(k&3221225472)throw Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const m=k<<1,p=new Zf(new Uint8Array(m));p.setPosition(m-k);p.S().set(f.S(),m-k);e.g=p;a.A+=a.g.j.length-g}ag(a,d)}function ag(a,b){for(let c=0;c<b;c++)a.g.na(--a.A,0)}function bg(a){return a.g.S().subarray(a.g.position(),a.g.position()+a.offset())}
function cg(a,b){$f(a,2,0);a.jb(b)}function dg(a,b){$f(a,4,0);a.X(b)}function eg(a,b,c,d){if(a.ia||c!=d)$f(a,1,0),a.na(c),a.slot(b)}function fg(a,b,c){if(a.ia||b!=c)cg(a,b),a.slot(0)}function gg(a,b,c,d){if(a.ia||c!=d)dg(a,c),a.slot(b)}function hg(a,b,c,d){if(a.ia||!c.equals(d))$f(a,8,0),a.aa(c),a.slot(b)}function ig(a,b){$f(a,4,0);a.X(a.offset()-b+4)}function M(a,b,c){if(a.ia||0!=c)ig(a,c),a.slot(b)}function jg(a){if(a.wa)throw Error("FlatBuffers: object serialization must not be nested.");}
function N(a,b){jg(a);null==a.W&&(a.W=[]);a.ib=b;for(let c=0;c<b;c++)a.W[c]=0;a.wa=!0;a.cb=a.offset()}
function O(a){if(null==a.W||!a.wa)throw Error("FlatBuffers: endObject called without startObject");dg(a,0);const b=a.offset();let c=a.ib-1;for(;0<=c&&0==a.W[c];c--);for(var d=c+1;0<=c;c--)cg(a,0!=a.W[c]?b-a.W[c]:0);cg(a,b-a.cb);d=2*(d+2);cg(a,d);let e=0;const f=a.A;c=0;a:for(;c<a.ya.length;c++){const g=a.g.j.length-a.ya[c];if(d==Tf(a.g,g)){for(let k=2;k<d;k+=2)if(Tf(a.g,f+k)!=Tf(a.g,g+k))continue a;e=a.ya[c];break}}e?(a.A=a.g.j.length-b,a.g.X(a.A,e-b)):(a.ya.push(a.offset()),a.g.X(a.g.j.length-b,
a.offset()-b));a.wa=!1;return b}function kg(a,b,c,d){jg(a);a.hb=c;$f(a,4,b*c);$f(a,d,b*c)}function lg(a){a.X(a.hb);return a.offset()}
function mg(a,b){if(!b)return 0;let c;if(b instanceof Uint8Array)c=b;else{c=[];let e=0;for(;e<b.length;){var d=void 0;d=b.charCodeAt(e++);if(!(55296>d||56320<=d)){const f=b.charCodeAt(e++);d=(d<<10)+f+-56613888}128>d?c.push(d):(2048>d?c.push(d>>6&31|192):(65536>d?c.push(d>>12&15|224):c.push(d>>18&7|240,d>>12&63|128),c.push(d>>6&63|128)),c.push(d&63|128))}}$f(a,1,0);a.na(0);kg(a,1,c.length,1);a.g.setPosition(a.A-=c.length);for(let e=0,f=a.A,g=a.g.S();e<c.length;e++)g[f++]=c[e];return lg(a)}
class ng{constructor(){this.xa=1;this.W=null;this.ib=0;this.wa=!1;this.cb=0;this.ya=[];this.hb=0;this.ia=!1;this.g=new Zf(new Uint8Array(1024));this.A=1024}clear(){this.g.clear();this.A=this.g.j.length;this.xa=1;this.W=null;this.ib=0;this.wa=!1;this.cb=0;this.ya=[];this.hb=0;this.ia=!1}na(a){this.g.na(--this.A,a)}jb(a){this.g.jb(this.A-=2,a)}X(a){this.g.X(this.A-=4,a)}aa(a){this.g.aa(this.A-=8,a)}slot(a){null!==this.W&&(this.W[a]=this.offset())}offset(){return this.g.j.length-this.A}finish(a,b,c){c=
c?4:0;if(b){$f(this,this.xa,8+c);if(4!=b.length)throw Error("FlatBuffers: file identifier must be length 4");for(let d=3;0<=d;d--)this.na(b.charCodeAt(d))}$f(this,this.xa,4+c);ig(this,a);c&&dg(this,this.g.j.length-this.A);this.g.setPosition(this.A)}T(a,b){return 0==a&&0==b?Pf:new Of(a,b)}};class og{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}key(a){const b=L(this.g,this.h,4);return b?Vf(this.g,this.h+b,a):null}value(a){const b=L(this.g,this.h,6);return b?Vf(this.g,this.h+b,a):null}};var pg,qg=pg||(pg={});qg[qg.V1=0]="V1";qg[qg.V2=1]="V2";qg[qg.V3=2]="V3";qg[qg.V4=3]="V4";qg[qg.V5=4]="V5";var rg,sg=rg||(rg={});sg[sg.Little=0]="Little";sg[sg.Big=1]="Big";var tg,ug=tg||(tg={});ug[ug.DenseArray=0]="DenseArray";class vg{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}bitWidth(){const a=L(this.g,this.h,4);return a?this.g.s(this.h+a):0}isSigned(){const a=L(this.g,this.h,6);return a?!!(this.g.j[this.h+a]<<24>>24):!1}};function wg(a){const b=L(a.g,a.h,6);return b?(new vg).i(Wf(a.g,a.h+b),a.g):null}class xg{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}id(){const a=L(this.g,this.h,4);return a?Mf(this.g,this.h+a):this.g.T(0,0)}isOrdered(){const a=L(this.g,this.h,8);return a?!!(this.g.j[this.h+a]<<24>>24):!1}};var yg,zg=yg||(yg={});zg[zg.DAY=0]="DAY";zg[zg.MILLISECOND=1]="MILLISECOND";class Ag{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}unit(){const a=L(this.g,this.h,4);return a?Tf(this.g,this.h+a):yg.MILLISECOND}};class Bg{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}precision(){const a=L(this.g,this.h,4);return a?this.g.s(this.h+a):0}scale(){const a=L(this.g,this.h,6);return a?this.g.s(this.h+a):0}bitWidth(){const a=L(this.g,this.h,8);return a?this.g.s(this.h+a):128}};var Cg,Dg=Cg||(Cg={});Dg[Dg.SECOND=0]="SECOND";Dg[Dg.MILLISECOND=1]="MILLISECOND";Dg[Dg.MICROSECOND=2]="MICROSECOND";Dg[Dg.NANOSECOND=3]="NANOSECOND";class Eg{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}byteWidth(){const a=L(this.g,this.h,4);return a?this.g.s(this.h+a):0}};class Fg{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}listSize(){const a=L(this.g,this.h,4);return a?this.g.s(this.h+a):0}};var Gg,Hg=Gg||(Gg={});Hg[Hg.HALF=0]="HALF";Hg[Hg.SINGLE=1]="SINGLE";Hg[Hg.DOUBLE=2]="DOUBLE";class Ig{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}precision(){const a=L(this.g,this.h,4);return a?Tf(this.g,this.h+a):Gg.HALF}};var Jg,Kg=Jg||(Jg={});Kg[Kg.YEAR_MONTH=0]="YEAR_MONTH";Kg[Kg.DAY_TIME=1]="DAY_TIME";Kg[Kg.MONTH_DAY_NANO=2]="MONTH_DAY_NANO";class Lg{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}unit(){const a=L(this.g,this.h,4);return a?Tf(this.g,this.h+a):Jg.YEAR_MONTH}};class Mg{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}keysSorted(){const a=L(this.g,this.h,4);return a?!!(this.g.j[this.h+a]<<24>>24):!1}};class Ng{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}unit(){const a=L(this.g,this.h,4);return a?Tf(this.g,this.h+a):Cg.MILLISECOND}bitWidth(){const a=L(this.g,this.h,6);return a?this.g.s(this.h+a):32}};class Og{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}unit(){const a=L(this.g,this.h,4);return a?Tf(this.g,this.h+a):Cg.SECOND}timezone(a){const b=L(this.g,this.h,6);return b?Vf(this.g,this.h+b,a):null}};var Pg,Qg=Pg||(Pg={});Qg[Qg.Sparse=0]="Sparse";Qg[Qg.Dense=1]="Dense";class Rg{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}mode(){const a=L(this.g,this.h,4);return a?Tf(this.g,this.h+a):Pg.Sparse}typeIds(a){const b=L(this.g,this.h,6);return b?this.g.s(Xf(this.g,this.h+b)+4*a):0}};var P,Q=P||(P={});Q[Q.NONE=0]="NONE";Q[Q.Null=1]="Null";Q[Q.Int=2]="Int";Q[Q.FloatingPoint=3]="FloatingPoint";Q[Q.Binary=4]="Binary";Q[Q.Utf8=5]="Utf8";Q[Q.Bool=6]="Bool";Q[Q.Decimal=7]="Decimal";Q[Q.Date=8]="Date";Q[Q.Time=9]="Time";Q[Q.Timestamp=10]="Timestamp";Q[Q.Interval=11]="Interval";Q[Q.List=12]="List";Q[Q.Struct_=13]="Struct_";Q[Q.Union=14]="Union";Q[Q.FixedSizeBinary=15]="FixedSizeBinary";Q[Q.FixedSizeList=16]="FixedSizeList";Q[Q.Map=17]="Map";Q[Q.Duration=18]="Duration";
Q[Q.LargeBinary=19]="LargeBinary";Q[Q.LargeUtf8=20]="LargeUtf8";Q[Q.LargeList=21]="LargeList";function Sg(a,b){kg(a,4,b.length,4);for(let c=b.length-1;0<=c;c--)ig(a,b[c]);return lg(a)}function Tg(a,b){kg(a,4,b.length,4);for(let c=b.length-1;0<=c;c--)ig(a,b[c]);return lg(a)}function Ug(a){const b=L(a.g,a.h,14);return b?Yf(a.g,a.h+b):0}
class Vg{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}name(a){const b=L(this.g,this.h,4);return b?Vf(this.g,this.h+b,a):null}nullable(){const a=L(this.g,this.h,6);return a?!!(this.g.j[this.h+a]<<24>>24):!1}type(a){const b=L(this.g,this.h,10);return b?Uf(this.g,a,this.h+b):null}dictionary(a){const b=L(this.g,this.h,12);return b?(a||new xg).i(Wf(this.g,this.h+b),this.g):null}children(a,b){const c=L(this.g,this.h,14);return c?(b||new Vg).i(Wf(this.g,Xf(this.g,this.h+c)+4*a),
this.g):null}Ga(a){const b=L(this.g,this.h,16);return b?(new og).i(Wf(this.g,Xf(this.g,this.h+b)+4*a),this.g):null}Ha(){const a=L(this.g,this.h,16);return a?Yf(this.g,this.h+a):0}};function Wg(a,b){kg(a,4,b.length,4);for(let c=b.length-1;0<=c;c--)ig(a,b[c]);return lg(a)}function Xg(a,b){kg(a,4,b.length,4);for(let c=b.length-1;0<=c;c--)ig(a,b[c]);return lg(a)}function Yg(a){const b=L(a.g,a.h,6);return b?Yf(a.g,a.h+b):0}
class Zg{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}fields(a,b){const c=L(this.g,this.h,6);return c?(b||new Vg).i(Wf(this.g,Xf(this.g,this.h+c)+4*a),this.g):null}Ga(a){const b=L(this.g,this.h,8);return b?(new og).i(Wf(this.g,Xf(this.g,this.h+b)+4*a),this.g):null}Ha(){const a=L(this.g,this.h,8);return a?Yf(this.g,this.h+a):0}features(a){const b=L(this.g,this.h,10);return b?Mf(this.g,Xf(this.g,this.h+b)+8*a):this.g.T(0,0)}};class $g{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}version(){const a=L(this.g,this.h,4);return a?Tf(this.g,this.h+a):pg.V1}schema(a){const b=L(this.g,this.h,6);return b?(a||new Zg).i(Wf(this.g,this.h+b),this.g):null}dictionaries(a,b){const c=L(this.g,this.h,8);return c?(b||new Lf).i(Xf(this.g,this.h+c)+24*a,this.g):null}gb(a){const b=L(this.g,this.h,10);return b?(new Lf).i(Xf(this.g,this.h+b)+24*a,this.g):null}Ga(a){const b=L(this.g,this.h,12);return b?(new og).i(Wf(this.g,
Xf(this.g,this.h+b)+4*a),this.g):null}Ha(){const a=L(this.g,this.h,12);return a?Yf(this.g,this.h+a):0}};class R{constructor(a=[],b,c){this.fields=a||[];this.metadata=b||new Map;c||(c=ah(a));this.dictionaries=c}get [Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(a=>a.name)}toString(){return`Schema<{ ${this.fields.map((a,b)=>`${b}: ${a}`).join(", ")} }>`}select(a){const b=new Set(a);a=this.fields.filter(c=>b.has(c.name));return new R(a,this.metadata)}selectAt(a){a=a.map(b=>this.fields[b]).filter(Boolean);return new R(a,this.metadata)}assign(...a){var b=a[0]instanceof R?a[0]:Array.isArray(a[0])?
new R(a[0]):new R(a);const c=[...this.fields];a=bh(bh(new Map,this.metadata),b.metadata);b=b.fields.filter(e=>{const f=c.findIndex(g=>g.name===e.name);return~f?(c[f]=e.clone({metadata:bh(bh(new Map,c[f].metadata),e.metadata)}))&&!1:!0});const d=ah(b,new Map);return new R([...c,...b],a,new Map([...this.dictionaries,...d]))}}R.prototype.fields=null;R.prototype.metadata=null;R.prototype.dictionaries=null;
class S{constructor(a,b,c=!1,d){this.name=a;this.type=b;this.nullable=c;this.metadata=d||new Map}static new(...a){let [b,c,d,e]=a;a[0]&&"object"===typeof a[0]&&({name:b}=a[0],void 0===c&&(c=a[0].type),void 0===d&&(d=a[0].nullable),void 0===e&&(e=a[0].metadata));return new S(`${b}`,c,d,e)}get typeId(){return this.type.typeId}get [Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...a){let [b,c,d,e]=a;a[0]&&"object"===typeof a[0]?{name:b=this.name,type:c=this.type,
nullable:d=this.nullable,metadata:e=this.metadata}=a[0]:[b=this.name,c=this.type,d=this.nullable,e=this.metadata]=a;return S.new(b,c,d,e)}}S.prototype.type=null;S.prototype.name=null;S.prototype.nullable=null;S.prototype.metadata=null;function bh(a,b){return new Map([...(a||new Map),...(b||new Map)])}
function ah(a,b=new Map){for(let c=-1,d=a.length;++c<d;){const e=a[c].type;if(C.isDictionary(e))if(!b.has(e.id))b.set(e.id,e.dictionary);else if(b.get(e.id)!==e.dictionary)throw Error("Cannot create Schema containing two different dictionaries with the same Id");e.children&&0<e.children.length&&ah(e.children,b)}return b};function*ch(a){for(let b,c=-1,d=a.numDictionaries;++c<d;)if(b=a.Ia(c))yield b}
class dh{constructor(a,b=Wa.V4,c,d){this.schema=a;this.version=b;c&&(this.ca=c);d&&(this.mb=d)}static decode(a){a=new Zf(u(Uint8Array,a));a=(new $g).i(a.s(a.position())+a.position(),a);const b=R.decode(a.schema());return new eh(b,a)}static encode(a){const b=new ng;var c=R.encode(b,a.schema);kg(b,24,a.numRecordBatches,8);for(var d of[...a.gb()].slice().reverse())fh.encode(b,d);d=lg(b);kg(b,24,a.numDictionaries,8);for(const e of[...ch(a)].slice().reverse())fh.encode(b,e);a=lg(b);N(b,5);M(b,1,c);fg(b,
Wa.V4,pg.V1);M(b,3,d);M(b,2,a);c=O(b);b.finish(c);return bg(b)}get numRecordBatches(){return this.ca.length}get numDictionaries(){return this.mb.length}*gb(){for(let a,b=-1,c=this.numRecordBatches;++b<c;)if(a=this.ja(b))yield a}ja(a){return 0<=a&&a<this.numRecordBatches&&this.ca[a]||null}Ia(a){return 0<=a&&a<this.numDictionaries&&this.mb[a]||null}}
class eh extends dh{constructor(a,b){super(a,b.version());this.l=b}get numRecordBatches(){var a=this.l;const b=L(a.g,a.h,10);return b?Yf(a.g,a.h+b):0}get numDictionaries(){var a=this.l;const b=L(a.g,a.h,8);return b?Yf(a.g,a.h+b):0}ja(a){return 0<=a&&a<this.numRecordBatches&&(a=this.l.gb(a))?fh.decode(a):null}Ia(a){return 0<=a&&a<this.numDictionaries&&(a=this.l.dictionaries(a))?fh.decode(a):null}}
class fh{constructor(a,b,c){this.ab=a;this.offset="number"===typeof c?c:c.low;this.bodyLength="number"===typeof b?b:b.low}static decode(a){return new fh(a.ab(),a.bodyLength(),a.offset())}static encode(a,b){var c=new Of(b.offset,0),d=b.ab;b=new Of(b.bodyLength,0);$f(a,8,24);a.aa(b);ag(a,4);a.X(d);a.aa(c);return a.offset()}};const U=Object.freeze({done:!0,value:void 0});class gh{constructor(a){this.ra=a}get schema(){return this.ra.schema}get batches(){return this.ra.batches||[]}get dictionaries(){return this.ra.dictionaries||[]}}function hh(a){return a.kb||(a.kb=a.toDOMStream())}function ih(a,b,c){return ih(a.qb||(a.qb=a.toNodeStream()),b,c)}class jh{tee(){return hh(this).tee()}pipeTo(a,b){return hh(this).pipeTo(a,b)}pipeThrough(a,b){return hh(this).pipeThrough(a,b)}}
class kh extends jh{constructor(){super();this.v=[];this.ma=[];this.Na=new Promise(a=>this.L=a)}get closed(){return this.Na}cancel(a){const b=this;return l(function*(){yield b.return(a)})}write(a){if(!this.L)throw Error("AsyncQueue is closed");0>=this.ma.length?this.v.push(a):this.ma.shift().resolve({done:!1,value:a})}abort(a){this.L&&(0>=this.ma.length?this.Pa={error:a}:this.ma.shift().reject({done:!0,value:a}))}close(){if(this.L){const a=this.ma;for(;0<a.length;)a.shift().resolve(U);this.L();this.L=
void 0}}[Symbol.asyncIterator](){return this}toDOMStream(a){return Na(this.L||this.Pa?this:this.v,a)}toNodeStream(){return Oa()}throw(a){const b=this;return l(function*(){yield b.abort(a);return U})}return(){const a=this;return l(function*(){yield a.close();return U})}read(a){const b=this;return l(function*(){return(yield b.next(a,"read")).value})}peek(a){const b=this;return l(function*(){return(yield b.next(a,"peek")).value})}next(){return 0<this.v.length?Promise.resolve({done:!1,value:this.v.shift()}):
this.Pa?Promise.reject({done:!0,value:this.Pa.error}):this.L?new Promise((a,b)=>{this.ma.push({resolve:a,reject:b})}):Promise.resolve(U)}};class lh extends kh{write(a){if(0<(a=u(Uint8Array,a)).byteLength)return super.write(a)}toString(a=!1){return a?va.decode(this.toUint8Array(!0)):this.toUint8Array(!1).then(wa)}toUint8Array(a=!1){return a?Ha(this.v)[0]:(()=>{const b=this;return l(function*(){const c=[];let d=0;for(const f=ia(b);;){var e=yield f.next();if(e.done)break;e=e.value;c.push(e);d+=e.byteLength}return Ha(c,d)[0]})})()}}
class mh{constructor(a){a&&(this.source=new nh(Pa(Qa(a))))}[Symbol.iterator](){return this}next(a){return this.source.next(a)}throw(a){return this.source.throw(a)}return(a){return this.source.return(a)}peek(a){return this.source.peek(a)}read(a){return this.source.read(a)}}
class oh{constructor(a){a instanceof oh?this.source=a.source:a instanceof lh?this.source=new ph(Pa(Ra(a))):Da(a)?this.source=new ph(Pa(Va(a))):Ca(a)?this.source=new ph(Pa(Sa(a))):t(a)&&Ca(a.body)?this.source=new ph(Pa(Sa(a.body))):t(a)&&q(a[Symbol.iterator])?this.source=new ph(Pa(Qa(a))):t(a)&&q(a.then)?this.source=new ph(Pa(Ra(a))):t(a)&&q(a[Symbol.asyncIterator])&&(this.source=new ph(Pa(Ra(a))))}[Symbol.asyncIterator](){return this}next(a){return this.source.next(a)}throw(a){return this.source.throw(a)}return(a){return this.source.return(a)}get closed(){return this.source.closed}cancel(a){return this.source.cancel(a)}peek(a){return this.source.peek(a)}read(a){return this.source.read(a)}}
class nh{constructor(a){this.source=a}cancel(a){this.return(a)}peek(a){return this.next(a,"peek").value}read(a){return this.next(a,"read").value}next(a,b="read"){return this.source.next({$:b,size:a})}throw(a){return Object.create(this.source.throw&&this.source.throw(a)||U)}return(a){return Object.create(this.source.return&&this.source.return(a)||U)}}
class ph{constructor(a){this.source=a;this.Na=new Promise(b=>this.L=b)}cancel(a){const b=this;return l(function*(){yield b.return(a)})}get closed(){return this.Na}read(a){const b=this;return l(function*(){return(yield b.next(a,"read")).value})}peek(a){const b=this;return l(function*(){return(yield b.next(a,"peek")).value})}next(a,b="read"){const c=this;return l(function*(){return yield c.source.next({$:b,size:a})})}throw(a){const b=this;return l(function*(){const c=b.source.throw&&(yield b.source.throw(a))||
U;b.L&&b.L();b.L=void 0;return Object.create(c)})}return(a){const b=this;return l(function*(){const c=b.source.return&&(yield b.source.return(a))||U;b.L&&b.L();b.L=void 0;return Object.create(c)})}};class qh extends mh{constructor(a){super();this.position=0;this.buffer=u(Uint8Array,a);this.size=this.buffer.byteLength}s(a){const {buffer:b,byteOffset:c}=this.ka(a,4);return(new DataView(b,c)).getInt32(0,!0)}seek(a){this.position=Math.min(a,this.size);return a<this.size}read(a){const b=this.buffer,c=this.size,d=this.position;return b&&d<c?("number"!==typeof a&&(a=Number.POSITIVE_INFINITY),this.position=Math.min(c,d+Math.min(c-d,a)),b.subarray(d,this.position)):null}ka(a,b){const c=this.buffer,d=
Math.min(this.size,a+b);return c?c.subarray(a,d):new Uint8Array(b)}close(){this.buffer&&(this.buffer=null)}throw(a){this.close();return{done:!0,value:a}}return(a){this.close();return{done:!0,value:a}}}
class rh extends oh{constructor(a,b){super();this.position=0;this.I=a;"number"===typeof b?this.size=b:this.C=(()=>{const c=this;return l(function*(){c.size=(yield a.stat()).size;delete c.C})})()}s(a){const b=this;return l(function*(){const {buffer:c,byteOffset:d}=yield b.ka(a,4);return(new DataView(c,d)).getInt32(0,!0)})}seek(a){const b=this;return l(function*(){b.C&&(yield b.C);b.position=Math.min(a,b.size);return a<b.size})}read(a){const b=this;return l(function*(){b.C&&(yield b.C);const c=b.I;
var d=b.size,e=b.position;if(c&&e<d){"number"!==typeof a&&(a=Number.POSITIVE_INFINITY);let f=0,g=0;d=Math.min(d,e+Math.min(d-e,a));const k=new Uint8Array(Math.max(0,(b.position=d)-e));for(;(e+=g)<d&&(f+=g)<k.byteLength;)({ac:g}=yield c.read(k,f,k.byteLength-f,e));return k}return null})}ka(a,b){const c=this;return l(function*(){c.C&&(yield c.C);const d=c.I;var e=c.size;return d&&a+b<e?(e=new Uint8Array(Math.min(e,a+b)-a),(yield d.read(e,0,b,a)).buffer):new Uint8Array(b)})}close(){const a=this;return l(function*(){const b=
a.I;a.I=null;b&&(yield b.close())})}throw(a){const b=this;return l(function*(){yield b.close();return{done:!0,value:a}})}return(a){const b=this;return l(function*(){yield b.close();return{done:!0,value:a}})}};function sh(a){0>a&&(a=4294967295+a+1);return`0x${a.toString(16)}`}const th=[1,10,100,1E3,1E4,1E5,1E6,1E7,1E8];
function uh(a,b){const c=new Uint32Array([a.buffer[1]>>>16,a.buffer[1]&65535,a.buffer[0]>>>16,a.buffer[0]&65535]);b=new Uint32Array([b.buffer[1]>>>16,b.buffer[1]&65535,b.buffer[0]>>>16,b.buffer[0]&65535]);let d=c[3]*b[3];a.buffer[0]=d&65535;let e=d>>>16;d=c[2]*b[3];e+=d;d=c[3]*b[2]>>>0;e+=d;a.buffer[0]+=e<<16;a.buffer[1]=e>>>0<d?65536:0;a.buffer[1]+=e>>>16;a.buffer[1]+=c[1]*b[3]+c[2]*b[2]+c[3]*b[1];a.buffer[1]+=c[0]*b[3]+c[1]*b[2]+c[2]*b[1]+c[3]*b[0]<<16}
function vh(a,b){const c=a.buffer[0]+b.buffer[0]>>>0;a.buffer[1]+=b.buffer[1];c<a.buffer[0]>>>0&&++a.buffer[1];a.buffer[0]=c}class wh{constructor(a){this.buffer=a}high(){return this.buffer[1]}low(){return this.buffer[0]}lessThan(a){return this.buffer[1]<a.buffer[1]||this.buffer[1]===a.buffer[1]&&this.buffer[0]<a.buffer[0]}equals(a){return this.buffer[1]===a.buffer[1]&&this.buffer[0]==a.buffer[0]}greaterThan(a){return a.lessThan(this)}hex(){return`${sh(this.buffer[1])} ${sh(this.buffer[0])}`}}
class V extends wh{times(a){uh(this,a);return this}plus(a){vh(this,a);return this}static from(a,b=new Uint32Array(2)){return V.fromString("string"===typeof a?a:a.toString(),b)}static fromNumber(a,b=new Uint32Array(2)){return V.fromString(a.toString(),b)}static fromString(a,b=new Uint32Array(2)){const c=a.length;b=new V(b);for(let d=0;d<c;){const e=8<c-d?8:c-d,f=new V(new Uint32Array([Number.parseInt(a.slice(d,d+e),10),0])),g=new V(new Uint32Array([th[e],0]));b.times(g);b.plus(f);d+=e}return b}static convertArray(a){const b=
new Uint32Array(2*a.length);for(let c=-1,d=a.length;++c<d;)V.from(a[c],new Uint32Array(b.buffer,b.byteOffset+8*c,2));return b}static multiply(a,b){return(new V(new Uint32Array(a.buffer))).times(b)}static add(a,b){return(new V(new Uint32Array(a.buffer))).plus(b)}}
class xh extends wh{negate(){this.buffer[0]=~this.buffer[0]+1;this.buffer[1]=~this.buffer[1];0==this.buffer[0]&&++this.buffer[1];return this}times(a){uh(this,a);return this}plus(a){vh(this,a);return this}lessThan(a){const b=this.buffer[1]<<0,c=a.buffer[1]<<0;return b<c||b===c&&this.buffer[0]<a.buffer[0]}static from(a,b=new Uint32Array(2)){return xh.fromString("string"===typeof a?a:a.toString(),b)}static fromNumber(a,b=new Uint32Array(2)){return xh.fromString(a.toString(),b)}static fromString(a,b=
new Uint32Array(2)){const c=a.startsWith("-"),d=a.length;b=new xh(b);for(let e=c?1:0;e<d;){const f=8<d-e?8:d-e,g=new xh(new Uint32Array([Number.parseInt(a.slice(e,e+f),10),0])),k=new xh(new Uint32Array([th[f],0]));b.times(k);b.plus(g);e+=f}return c?b.negate():b}static convertArray(a){const b=new Uint32Array(2*a.length);for(let c=-1,d=a.length;++c<d;)xh.from(a[c],new Uint32Array(b.buffer,b.byteOffset+8*c,2));return b}static multiply(a,b){return(new xh(new Uint32Array(a.buffer))).times(b)}static add(a,
b){return(new xh(new Uint32Array(a.buffer))).plus(b)}}
class yh{constructor(a){this.buffer=a}high(){return new xh(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new xh(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){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];0==this.buffer[0]&&++this.buffer[1];0==this.buffer[1]&&++this.buffer[2];0==this.buffer[2]&&++this.buffer[3];return this}times(a){const b=new V(new Uint32Array([this.buffer[3],
0])),c=new V(new Uint32Array([this.buffer[2],0])),d=new V(new Uint32Array([this.buffer[1],0])),e=new V(new Uint32Array([this.buffer[0],0])),f=new V(new Uint32Array([a.buffer[3],0])),g=new V(new Uint32Array([a.buffer[2],0])),k=new V(new Uint32Array([a.buffer[1],0]));a=new V(new Uint32Array([a.buffer[0],0]));let m=V.multiply(e,a);this.buffer[0]=m.low();const p=new V(new Uint32Array([m.high(),0]));m=V.multiply(d,a);p.plus(m);m=V.multiply(e,k);p.plus(m);this.buffer[1]=p.low();this.buffer[3]=p.lessThan(m)?
1:0;this.buffer[2]=p.high();(new V(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))).plus(V.multiply(c,a)).plus(V.multiply(d,k)).plus(V.multiply(e,g));this.buffer[3]+=V.multiply(b,a).plus(V.multiply(c,k)).plus(V.multiply(d,g)).plus(V.multiply(e,f)).low();return this}plus(a){const b=new Uint32Array(4);b[3]=this.buffer[3]+a.buffer[3]>>>0;b[2]=this.buffer[2]+a.buffer[2]>>>0;b[1]=this.buffer[1]+a.buffer[1]>>>0;b[0]=this.buffer[0]+a.buffer[0]>>>0;b[0]<this.buffer[0]>>>0&&++b[1];b[1]<this.buffer[1]>>>
0&&++b[2];b[2]<this.buffer[2]>>>0&&++b[3];this.buffer[3]=b[3];this.buffer[2]=b[2];this.buffer[1]=b[1];this.buffer[0]=b[0];return this}hex(){return`${sh(this.buffer[3])} ${sh(this.buffer[2])} ${sh(this.buffer[1])} ${sh(this.buffer[0])}`}static multiply(a,b){return(new yh(new Uint32Array(a.buffer))).times(b)}static add(a,b){return(new yh(new Uint32Array(a.buffer))).plus(b)}static from(a,b=new Uint32Array(4)){return yh.fromString("string"===typeof a?a:a.toString(),b)}static fromNumber(a,b=new Uint32Array(4)){return yh.fromString(a.toString(),
b)}static fromString(a,b=new Uint32Array(4)){const c=a.startsWith("-"),d=a.length;b=new yh(b);for(let e=c?1:0;e<d;){const f=8<d-e?8:d-e,g=new yh(new Uint32Array([Number.parseInt(a.slice(e,e+f),10),0,0,0])),k=new yh(new Uint32Array([th[f],0,0,0]));b.times(k);b.plus(g);e+=f}return c?b.negate():b}static convertArray(a){const b=new Uint32Array(4*a.length);for(let c=-1,d=a.length;++c<d;)yh.from(a[c],new Uint32Array(b.buffer,b.byteOffset+16*c,4));return b}}var zh={};zh.BaseInt64=wh;zh.Int128=yh;
zh.Int64=xh;zh.Uint64=V;function W(a){return a.N[++a.Vb]}function Ah(a){return a.buffers[++a.Ub]}
class Bh extends nd{constructor(a,b,c,d){super();this.Ub=this.Vb=-1;this.S=a;this.N=b;this.buffers=c;this.dictionaries=d}visit(a){return super.visit(a instanceof S?a.type:a)}visitNull(a,{length:b}=W(this)){return I({type:a,length:b})}visitBool(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),data:this.H(a)})}visitInt(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),data:this.H(a)})}visitFloat(a,{length:b,nullCount:c}=
W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),data:this.H(a)})}visitUtf8(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),valueOffsets:this.la(a),data:this.H(a)})}visitBinary(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),valueOffsets:this.la(a),data:this.H(a)})}visitFixedSizeBinary(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),data:this.H(a)})}visitDate(a,
{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),data:this.H(a)})}visitTimestamp(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),data:this.H(a)})}visitTime(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),data:this.H(a)})}visitDecimal(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),data:this.H(a)})}visitList(a,{length:b,
nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),valueOffsets:this.la(a),child:this.visit(a.children[0])})}visitStruct(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),children:this.visitMany(a.children)})}visitUnion(a){return a.mode===w.Sparse?this.visitSparseUnion(a):this.visitDenseUnion(a)}visitDenseUnion(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),typeIds:this.fb(a),
valueOffsets:this.la(a),children:this.visitMany(a.children)})}visitSparseUnion(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),typeIds:this.fb(a),children:this.visitMany(a.children)})}visitDictionary(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),data:this.H(a.indices),dictionary:this.dictionaries.get(a.id)})}visitInterval(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,
c),data:this.H(a)})}visitFixedSizeList(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),child:this.visit(a.children[0])})}visitMap(a,{length:b,nullCount:c}=W(this)){return I({type:a,length:b,nullCount:c,nullBitmap:this.B(a,c),valueOffsets:this.la(a),child:this.visit(a.children[0])})}B(a,b){var c=Ah(this);return 0<b&&this.H(a,c)||new Uint8Array(0)}la(a){return this.H(a)}fb(a){return this.H(a)}H(a,{length:b,offset:c}=Ah(this)){return this.S.subarray(c,c+
b)}}
class Ch extends Bh{constructor(a,b,c,d){super(new Uint8Array(0),b,c,d);this.sources=a}B(a,b){({offset:a}=Ah(this));return 0>=b?new Uint8Array(0):Re(this.sources[a])}la(){var {offset:a}=Ah(this);return u(Uint8Array,u(Int32Array,this.sources[a]))}fb(a){var {offset:b}=Ah(this);return u(Uint8Array,u(a.ArrayType,this.sources[b]))}H(a,{offset:b}=Ah(this)){const c=this.sources;return C.isTimestamp(a)||(C.isInt(a)||C.isTime(a))&&64===a.bitWidth||C.isDate(a)&&a.unit===$a.MILLISECOND?u(Uint8Array,xh.convertArray(c[b])):C.isDecimal(a)?
u(Uint8Array,yh.convertArray(c[b])):C.isBinary(a)||C.isFixedSizeBinary(a)?Dh(c[b]):C.isBool(a)?Re(c[b]):C.isUtf8(a)?xa.encode(c[b].join("")):u(Uint8Array,u(a.ArrayType,c[b].map(d=>+d)))}}function Dh(a){a=a.join("");const b=new Uint8Array(a.length/2);for(let c=0;c<a.length;c+=2)b[c>>1]=Number.parseInt(a.slice(c,c+2),16);return b};class Eh extends Kf{constructor(a){super(a);this.v=new Df(new Uint8Array(0))}get byteLength(){let a=this.M+4*this.length;this.m&&(a+=this.m.byteLength);this.v&&(a+=this.v.byteLength);this.J&&(a+=this.J.byteLength);return a}setValue(a,b){return super.setValue(a,u(Uint8Array,b))}ha(a,b){const c=this.m;b=Cf(this.v,b).buffer;let d=0;for(const [e,f]of a)void 0===f?c.set(e,0):(a=f.length,b.set(f,d),c.set(e,a),d+=a)}};class Fh extends Hf{constructor(a){super(a);this.v=new Ff}setValue(a,b){this.v.set(a,+b)}};class Gh extends If{}Gh.prototype.D=Fd;class Hh extends Gh{}Hh.prototype.D=Cd;class Ih extends Gh{}Ih.prototype.D=Dd;class Jh extends If{}Jh.prototype.D=Qd;class Kh extends Hf{constructor({type:a,nullValues:b,dictionaryHashFunction:c}){super({type:new id(a.dictionary,a.indices,a.id,a.isOrdered)});this.J=null;this.Ba=0;this.pb=Object.create(null);this.indices=Lh({type:this.type.indices,nullValues:b});this.dictionary=Lh({type:this.type.dictionary,nullValues:null});"function"===typeof c&&(this.valueToKey=c)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+
this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(a){return this.indices.isValid(a)}setValid(a,b){const c=this.indices;b=c.setValid(a,b);this.length=c.length;return b}setValue(a,b){const c=this.pb,d=this.valueToKey(b);let e=c[d];void 0===e&&(c[d]=e=this.Ba+this.dictionary.append(b).length-1);return this.indices.setValue(a,e)}flush(){var a=
this.type;const b=this.Lb,c=this.dictionary.toVector();a=this.indices.flush().clone(a);a.dictionary=b?b.concat(c):c;this.finished||(this.Ba+=c.length);this.Lb=a.dictionary;this.clear();return a}finish(){this.indices.finish();this.dictionary.finish();this.Ba=0;this.pb=Object.create(null);return super.finish()}clear(){this.indices.clear();this.dictionary.clear();return super.clear()}valueToKey(a){return"string"===typeof a?a:`${a}`}};class Mh extends If{}Mh.prototype.D=Ed;class Nh extends Hf{setValue(a,b){const [c]=this.children;a*=this.stride;for(let d=-1,e=b.length;++d<e;)c.set(a+d,b[d])}addChild(a,b="0"){if(0<this.numChildren)throw Error("FixedSizeListBuilder can only have one child.");const c=this.children.push(a);this.type=new $c(this.type.listSize,new S(b,a.type,!0));return c}};class Oh extends If{setValue(a,b){this.v.set(a,b)}}class Ph extends Oh{setValue(a,b){super.setValue(a,ud(b))}}class Qh extends Oh{}class Rh extends Oh{};class Sh extends If{}Sh.prototype.D=$d;class Th extends Sh{}Th.prototype.D=Yd;class Uh extends Sh{}Uh.prototype.D=Zd;class Vh extends If{setValue(a,b){this.v.set(a,b)}}class Wh extends Vh{}class Xh extends Vh{}class Yh extends Vh{}class Zh extends Vh{}class $h extends Vh{}class ai extends Vh{}class bi extends Vh{}class ci extends Vh{};class di extends Kf{constructor(a){super(a);this.m=new Gf}addChild(a,b="0"){if(0<this.numChildren)throw Error("ListBuilder can only have one child.");this.children[this.numChildren]=a;this.type=new Jc(new S(b,a.type,!0));return this.numChildren-1}ha(a){const b=this.m,[c]=this.children;for(const [d,e]of a)if("undefined"===typeof e)b.set(d,0);else{a=e.length;const f=b.set(d,a).buffer[d];for(let g=-1;++g<a;)c.set(f+g,e[g])}}};class ei extends Kf{set(a,b){return super.set(a,b)}setValue(a,b){b=b instanceof Map?b:new Map(Object.entries(b));const c=this.C||(this.C=new Map),d=c.get(a);d&&(this.M-=d.size);this.M+=b.size;c.set(a,b)}addChild(a,b=`${this.numChildren}`){if(0<this.numChildren)throw Error("ListBuilder can only have one child.");this.children[this.numChildren]=a;this.type=new dd(new S(b,a.type,!0),this.type.keysSorted);return this.numChildren-1}ha(a){const b=this.m,[c]=this.children;for(const [d,e]of a)if(void 0===
e)b.set(d,0);else{let {[d]:f,[d+1]:g}=b.set(d,e.size).buffer;for(const k of e.entries())if(c.set(f,k),++f>=g)break}}};class fi extends Hf{setValue(){}setValid(a,b){this.length=Math.max(a+1,this.length);return b}};class gi extends Hf{setValue(a,b){const c=this.children,d=this.type;switch(Array.isArray(b)||b.constructor){case !0:return d.children.forEach((e,f)=>c[f].set(a,b[f]));case Map:return d.children.forEach((e,f)=>c[f].set(a,b.get(e.name)));default:return d.children.forEach((e,f)=>c[f].set(a,b[e.name]))}}setValid(a,b){super.setValid(a,b)||this.children.forEach(c=>c.setValid(a,b));return b}addChild(a,b=`${this.numChildren}`){const c=this.children.push(a);this.type=new D([...this.type.children,new S(b,a.type,
!0)]);return c}};class hi extends If{}hi.prototype.D=Kd;class ii extends hi{}ii.prototype.D=Gd;class ji extends hi{}ji.prototype.D=Hd;class ki extends hi{}ki.prototype.D=Id;class li extends hi{}li.prototype.D=Jd;class mi extends If{}mi.prototype.D=Pd;class ni extends mi{}ni.prototype.D=Ld;class oi extends mi{}oi.prototype.D=Md;class pi extends mi{}pi.prototype.D=Nd;class qi extends mi{}qi.prototype.D=Od;class ri extends Hf{constructor(a){super(a);this.Z=new Ef(new Int8Array(0),1);"function"===typeof a.valueToChildTypeId&&(this.rb=a.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(a,b){return this.set(this.length,a,b)}set(a,b,c){void 0===c&&(c=this.rb(this,b,a));this.setValid(a,this.isValid(b))&&this.setValue(a,b,c);return this}setValue(a,b,c){this.Z.set(a,c);let d;null==(d=this.children[this.type.typeIdToChildIndex[c]])||d.set(a,b)}addChild(a,b=`${this.children.length}`){const c=
this.children.push(a),{type:{children:d,mode:e,typeIds:f}}=this;a=[...d,new S(b,a.type)];this.type=new Qc(e,[...f,c],a);return c}rb(){throw Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.");}}class si extends ri{}
class ti extends ri{constructor(a){super(a);this.m=new Ef(new Int32Array(0))}setValue(a,b,c){c=this.Z.set(a,c).buffer[a];c=this.getChildAt(this.type.typeIdToChildIndex[c]);a=this.m.set(a,c.length).buffer[a];null==c||c.set(a,b)}};class ui extends Kf{constructor(a){super(a);this.v=new Df(new Uint8Array(0))}get byteLength(){let a=this.M+4*this.length;this.m&&(a+=this.m.byteLength);this.v&&(a+=this.v.byteLength);this.J&&(a+=this.J.byteLength);return a}setValue(a,b){return super.setValue(a,xa.encode(b))}ha(){}}ui.prototype.ha=Eh.prototype.ha;class vi extends nd{visitNull(){return fi}visitBool(){return Fh}visitInt(){return Vh}visitInt8(){return Wh}visitInt16(){return Xh}visitInt32(){return Yh}visitInt64(){return Zh}visitUint8(){return $h}visitUint16(){return ai}visitUint32(){return bi}visitUint64(){return ci}visitFloat(){return Oh}visitFloat16(){return Ph}visitFloat32(){return Qh}visitFloat64(){return Rh}visitUtf8(){return ui}visitBinary(){return Eh}visitFixedSizeBinary(){return Mh}visitDate(){return Gh}visitDateDay(){return Hh}visitDateMillisecond(){return Ih}visitTimestamp(){return hi}visitTimestampSecond(){return ii}visitTimestampMillisecond(){return ji}visitTimestampMicrosecond(){return ki}visitTimestampNanosecond(){return li}visitTime(){return mi}visitTimeSecond(){return ni}visitTimeMillisecond(){return oi}visitTimeMicrosecond(){return pi}visitTimeNanosecond(){return qi}visitDecimal(){return Jh}visitList(){return di}visitStruct(){return gi}visitUnion(){return ri}visitDenseUnion(){return ti}visitSparseUnion(){return si}visitDictionary(){return Kh}visitInterval(){return Sh}visitIntervalDayTime(){return Th}visitIntervalYearMonth(){return Uh}visitFixedSizeList(){return Nh}visitMap(){return ei}}
const wi=new vi;function xi(a,b,c){return b===c||Array.isArray(b)&&Array.isArray(c)&&b.length===c.length&&b.every((d,e)=>a.compareFields(d,c[e]))}class yi extends nd{compareSchemas(a,b){return a===b||b instanceof a.constructor&&xi(this,a.fields,b.fields)}compareFields(a,b){return a===b||b instanceof a.constructor&&a.name===b.name&&a.nullable===b.nullable&&this.visit(a.type,b.type)}}function zi(a,b){return b instanceof a.constructor}function Ai(a,b){return a===b||zi(a,b)}
function Bi(a,b){return a===b||zi(a,b)&&a.bitWidth===b.bitWidth&&a.isSigned===b.isSigned}function Ci(a,b){return a===b||zi(a,b)&&a.precision===b.precision}function Di(a,b){return a===b||zi(a,b)&&a.unit===b.unit}function Ei(a,b){return a===b||zi(a,b)&&a.unit===b.unit&&a.timezone===b.timezone}function Fi(a,b){return a===b||zi(a,b)&&a.unit===b.unit&&a.bitWidth===b.bitWidth}
function Gi(a,b){return a===b||zi(a,b)&&a.mode===b.mode&&a.typeIds.every((c,d)=>c===b.typeIds[d])&&xi(Hi,a.children,b.children)}function Ii(a,b){return a===b||zi(a,b)&&a.unit===b.unit}h=yi.prototype;h.visitNull=Ai;h.visitBool=Ai;h.visitInt=Bi;h.visitInt8=Bi;h.visitInt16=Bi;h.visitInt32=Bi;h.visitInt64=Bi;h.visitUint8=Bi;h.visitUint16=Bi;h.visitUint32=Bi;h.visitUint64=Bi;h.visitFloat=Ci;h.visitFloat16=Ci;h.visitFloat32=Ci;h.visitFloat64=Ci;h.visitUtf8=Ai;h.visitBinary=Ai;
h.visitFixedSizeBinary=function(a,b){return a===b||zi(a,b)&&a.byteWidth===b.byteWidth};h.visitDate=Di;h.visitDateDay=Di;h.visitDateMillisecond=Di;h.visitTimestamp=Ei;h.visitTimestampSecond=Ei;h.visitTimestampMillisecond=Ei;h.visitTimestampMicrosecond=Ei;h.visitTimestampNanosecond=Ei;h.visitTime=Fi;h.visitTimeSecond=Fi;h.visitTimeMillisecond=Fi;h.visitTimeMicrosecond=Fi;h.visitTimeNanosecond=Fi;h.visitDecimal=Ai;
h.visitList=function(a,b){return a===b||zi(a,b)&&a.children.length===b.children.length&&xi(Hi,a.children,b.children)};h.visitStruct=function(a,b){return a===b||zi(a,b)&&a.children.length===b.children.length&&xi(Hi,a.children,b.children)};h.visitUnion=Gi;h.visitDenseUnion=Gi;h.visitSparseUnion=Gi;h.visitDictionary=function(a,b){return a===b||zi(a,b)&&a.id===b.id&&a.isOrdered===b.isOrdered&&Hi.visit(a.indices,b.indices)&&Hi.visit(a.dictionary,b.dictionary)};h.visitInterval=Ii;
h.visitIntervalDayTime=Ii;h.visitIntervalYearMonth=Ii;h.visitFixedSizeList=function(a,b){return a===b||zi(a,b)&&a.listSize===b.listSize&&a.children.length===b.children.length&&xi(Hi,a.children,b.children)};h.visitMap=function(a,b){return a===b||zi(a,b)&&a.keysSorted===b.keysSorted&&a.children.length===b.children.length&&xi(Hi,a.children,b.children)};const Hi=new yi;function Ji(a,b){return Hi.compareSchemas(a,b)}function Ki(a,b){return Hi.visit(a,b)};function Lh(a){var b=a.type;const c=new (wi.getVisitFn(b)())(a);if(b.children&&0<b.children.length){const d=a.children||[],e={nullValues:a.nullValues};a=Array.isArray(d)?(f,g)=>d[g]||e:({name:f})=>d[f]||e;for(const [f,g]of b.children.entries()){b=g.type;const k=a(g,f);c.children.push(Lh(Object.assign({},k,{type:b})))}}return c}
function Li(a,b){if(a instanceof H||a instanceof F||a.type instanceof C||ArrayBuffer.isView(a))return xf(a);b={type:null!=b?b:Mi(a),nullValues:[null]};a=[...Ni(b)(a)];a=1===a.length?a[0]:a.reduce((c,d)=>c.concat(d));return C.isDictionary(a.type)?a.memoize():a}
function Mi(a){if(0===a.length)return new wb;var b=0;let c=0,d=0,e=0,f=0,g=0,k=0,m=0;for(const p of a)if(null==p)++b;else{switch(typeof p){case "bigint":++g;continue;case "boolean":++k;continue;case "number":++e;continue;case "string":++f;continue;case "object":Array.isArray(p)?++c:"[object Date]"===Object.prototype.toString.call(p)?++m:++d;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected");}if(e+b===a.length)return new Rb;if(f+b===a.length)return new id(new Wb,
new Db);if(g+b===a.length)return new Gb;if(k+b===a.length)return new $b;if(m+b===a.length)return new mc;if(c+b===a.length){const p=Mi(a[a.findIndex(r=>null!=r)]);if(a.every(r=>null==r||Ki(p,Mi(r))))return new Jc(new S("",p,!0))}else if(d+b===a.length){b=new Map;for(const p of a)for(const r of Object.keys(p))b.has(r)||null==p[r]||b.set(r,new S(r,Mi([p[r]]),!0));return new D([...b.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected");}
function Ni(a){const {queueingStrategy:b="count"}=a,{highWaterMark:c="bytes"!==b?Number.POSITIVE_INFINITY:Math.pow(2,14)}=a,d="bytes"!==b?"length":"byteLength";return function*(e){let f=0;const g=Lh(a);for(const k of e)g.append(k)[d]>=c&&++f&&(yield g.toVector());if(0<g.finish().length||0===f)yield g.toVector()}};function Oi(a,b){return Pi(a,b.map(c=>c.data.concat()))}function Pi(a,b){const c=[...a.fields],d=[],e={bb:b.reduce((T,ra)=>Math.max(T,ra.length),0)};let f=0,g=0,k=-1;const m=b.length;let p,r=[];for(;0<e.bb--;){g=Number.POSITIVE_INFINITY;for(k=-1;++k<m;)r[k]=p=b[k].shift(),g=Math.min(g,p?p.length:g);Number.isFinite(g)&&(r=Qi(c,g,r,b,e),0<g&&(d[f++]=I({type:new D(c),length:g,nullCount:0,children:r.slice()})))}return[a=a.assign(c),d.map(T=>new X(a,T))]}
function Qi(a,b,c,d,e){const f=(b+63&-64)>>3;for(let k=-1,m=d.length;++k<m;){const p=c[k];let r;var g=null==(r=p)?void 0:r.length;if(g>=b)g===b?c[k]=p:(c[k]=p.slice(0,b),e.bb=Math.max(e.bb,d[k].unshift(p.slice(b,g-b))));else{g=a[k];a[k]=g.clone({nullable:!0});let T,ra;c[k]=null!=(ra=null==(T=p)?void 0:Xe(T,b))?ra:I({type:g.type,length:b,nullCount:b,nullBitmap:new Uint8Array(f)})}}return c};class Ri{constructor(...a){if(0===a.length)return this.batches=[],this.schema=new R([]),this.m=[0],this;let b,c;a[0]instanceof R&&(b=a.shift());a[a.length-1]instanceof Uint32Array&&(c=a.pop());const d=m=>{if(m){if(m instanceof X)return[m];if(m instanceof Ri)return m.batches;if(m instanceof H){if(m.type instanceof D)return[new X(new R(m.type.children),m)]}else{if(Array.isArray(m))return m.flatMap(r=>d(r));if("function"===typeof m[Symbol.iterator])return[...m].flatMap(r=>d(r));if("object"===typeof m){var p=
Object.keys(m);const r=p.map(T=>new F([m[T]]));p=new R(p.map((T,ra)=>new S(String(T),r[ra].type)));[,p]=Oi(p,r);return 0===p.length?[new X(m)]:p}}}return[]};a=a.flatMap(m=>d(m));let e,f,g;b=null!=(g=null!=(f=b)?f:null==(e=a[0])?void 0:e.schema)?g:new R([]);if(!(b instanceof R))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const m of a){if(!(m instanceof X))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Ji(b,m.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.");
}this.schema=b;this.batches=a;let k;this.m=null!=(k=c)?k:bf(this.data)}get data(){return this.batches.map(({data:a})=>a)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((a,b)=>a+b.length,0)}get nullCount(){-1===this.F&&(this.F=af(this.data));return this.F}isValid(){return!1}get(){return null}set(){}indexOf(){return-1}getByteLength(){return 0}[Symbol.iterator](){return 0<this.batches.length?of.visit(new F(this.data)):[][Symbol.iterator]()}toArray(){return[...this]}toString(){return`[\n  ${this.toArray().join(",\n  ")}\n]`}concat(...a){const b=
this.schema;a=this.data.concat(a.flatMap(({data:c})=>c));return new Ri(b,a.map(c=>new X(b,c)))}slice(a,b){const c=this.schema;[a,b]=Ee({length:this.numRows},a,b);a=cf(this.data,this.m,a,b);return new Ri(c,a.map(d=>new X(c,d)))}getChild(a){return this.getChildAt(this.schema.fields.findIndex(b=>b.name===a))}getChildAt(a){if(-1<a&&a<this.schema.fields.length){const c=this.data.map(d=>d.children[a]);if(0===c.length){var {type:b}=this.schema.fields[a];b=I({type:b,length:0,nullCount:0});c.push(Xe(b,this.numRows))}return new F(c)}return null}setChild(a,
b){let c;return this.setChildAt(null==(c=this.schema.fields)?void 0:c.findIndex(d=>d.name===a),b)}setChildAt(a,b){let c=this.schema;var d=[...this.batches];if(-1<a&&a<this.numCols){b||(b=new F([I({type:new wb,length:this.numRows})]));d=c.fields.slice();const e=d[a].clone({type:b.type}),f=this.schema.fields.map((g,k)=>this.getChildAt(k));[d[a],f[a]]=[e,b];[c,d]=Oi(c,f)}return new Ri(c,d)}select(a){const b=this.schema.fields.reduce((c,d,e)=>c.set(d.name,e),new Map);return this.selectAt(a.map(c=>b.get(c)).filter(c=>
-1<c))}selectAt(a){const b=this.schema.selectAt(a),c=this.batches.map(d=>d.selectAt(a));return new Ri(b,c)}assign(a){const b=this.schema.fields,[c,d]=a.schema.fields.reduce((g,k,m)=>{const [p,r]=g,T=b.findIndex(ra=>ra.name===k.name);~T?r[T]=m:p.push(m);return g},[[],[]]),e=this.schema.assign(a.schema),f=[...b.map((g,k)=>[k,d[k]]).map(([g,k])=>void 0===k?this.getChildAt(g):a.getChildAt(k)),...c.map(g=>a.getChildAt(g))].filter(Boolean);return new Ri(...Oi(e,f))}}var Si=Symbol.toStringTag,Ti=Ri.prototype;
Ti.schema=null;Ti.batches=[];Ti.m=new Uint32Array([0]);Ti.F=-1;Ti[Symbol.isConcatSpreadable]=!0;Ti.isValid=ff(ef);Ti.get=ff(ee.getVisitFn(A.Struct));Ti.set=gf(Vd.getVisitFn(A.Struct));Ti.indexOf=hf(lf.getVisitFn(A.Struct));Ti.getByteLength=ff(rf.getVisitFn(A.Struct));Ri[Si]="Table";class X{constructor(...a){switch(a.length){case 2:[this.schema]=a;if(!(this.schema instanceof R))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[,this.data=I({nullCount:0,type:new D(this.schema.fields),children:this.schema.fields.map(g=>I({type:g.type,nullCount:0}))})]=a;if(!(this.data instanceof H))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Ui(this.schema,this.data.children);break;case 1:const [b]=a,{fields:c,
children:d,length:e}=Object.keys(b).reduce((g,k,m)=>{g.children[m]=b[k];g.length=Math.max(g.length,b[k].length);g.fields[m]=S.new({name:k,type:b[k].type,nullable:!0});return g},{length:0,fields:[],children:[]});a=new R(c);const f=I({type:new D(c),length:e,children:d,nullCount:0});[this.schema,this.data]=Ui(a,f.children,e);break;default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.");}}get dictionaries(){return this.fa||(this.fa=
Vi(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(a){return this.data.getValid(a)}get(a){return ee.visit(this.data,a)}set(a,b){return Vd.visit(this.data,a,b)}indexOf(a,b){return lf.visit(this.data,a,b)}getByteLength(a){return rf.visit(this.data,a)}[Symbol.iterator](){return of.visit(new F([this.data]))}toArray(){return[...this]}concat(...a){return new Ri(this.schema,[this,
...a])}slice(a,b){[a]=(new F([this.data])).slice(a,b).data;return new X(this.schema,a)}getChild(a){let b;return this.getChildAt(null==(b=this.schema.fields)?void 0:b.findIndex(c=>c.name===a))}getChildAt(a){return-1<a&&a<this.schema.fields.length?new F([this.data.children[a]]):null}setChild(a,b){let c;return this.setChildAt(null==(c=this.schema.fields)?void 0:c.findIndex(d=>d.name===a),b)}setChildAt(a,b){var c=this.schema,d=this.data;if(-1<a&&a<this.numCols){b||(b=new F([I({type:new wb,length:this.numRows})]));
const e=c.fields.slice();d=d.children.slice();c=e[a].clone({type:b.type});[e[a],d[a]]=[c,b.data[0]];c=new R(e,new Map(this.schema.metadata));d=I({type:new D(e),children:d})}return new X(c,d)}select(a){const b=this.schema.select(a),c=new D(b.fields),d=[];for(const e of a)a=this.schema.fields.findIndex(f=>f.name===e),~a&&(d[a]=this.data.children[a]);return new X(b,I({type:c,length:this.numRows,children:d}))}selectAt(a){const b=this.schema.selectAt(a);a=a.map(c=>this.data.children[c]).filter(Boolean);
a=I({type:new D(b.fields),length:this.numRows,children:a});return new X(b,a)}}var Wi=Symbol.toStringTag,$i=X.prototype;$i.F=-1;$i[Symbol.isConcatSpreadable]=!0;X[Wi]="RecordBatch";
function Ui(a,b,c=b.reduce((d,e)=>Math.max(d,e.length),0)){const d=[...a.fields],e=[...b],f=(c+63&-64)>>3;for(const [g,k]of a.fields.entries()){const m=b[g];if(!m||m.length!==c){d[g]=k.clone({nullable:!0});let p,r;e[g]=null!=(r=null==(p=m)?void 0:Xe(p,c))?r:I({type:k.type,length:c,nullCount:c,nullBitmap:new Uint8Array(f)})}}return[a.assign(d),I({type:new D(d),length:c,children:e})]}
function Vi(a,b,c=new Map){for(let d=-1,e=a.length;++d<e;){const f=a[d].type,g=b[d];if(C.isDictionary(f))if(!c.has(f.id))g.dictionary&&c.set(f.id,g.dictionary);else if(c.get(f.id)!==g.dictionary)throw Error("Cannot create Schema containing two different dictionaries with the same Id");f.children&&0<f.children.length&&Vi(f.children,g.children,c)}return c}class aj extends X{constructor(a){var b=a.fields.map(c=>I({type:c.type}));b=I({type:new D(a.fields),nullCount:0,children:b});super(a,b)}};var bj,cj=bj||(bj={});cj[cj.BUFFER=0]="BUFFER";var dj,ej=dj||(dj={});ej[ej.LZ4_FRAME=0]="LZ4_FRAME";ej[ej.ZSTD=1]="ZSTD";class fj{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}method(){const a=L(this.g,this.h,6);return a?this.g.j[this.h+a]<<24>>24:bj.Zb}};class gj{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}offset(){return Mf(this.g,this.h)}length(){return Mf(this.g,this.h+8)}};class hj{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}length(){return Mf(this.g,this.h)}nullCount(){return Mf(this.g,this.h+8)}};function ij(a){const b=L(a.g,a.h,6);return b?Yf(a.g,a.h+b):0}function jj(a){const b=L(a.g,a.h,8);return b?Yf(a.g,a.h+b):0}class kj{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}length(){const a=L(this.g,this.h,4);return a?Mf(this.g,this.h+a):this.g.T(0,0)}N(a,b){const c=L(this.g,this.h,6);return c?(b||new hj).i(Xf(this.g,this.h+c)+16*a,this.g):null}buffers(a,b){const c=L(this.g,this.h,8);return c?(b||new gj).i(Xf(this.g,this.h+c)+16*a,this.g):null}};class lj{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}id(){const a=L(this.g,this.h,4);return a?Mf(this.g,this.h+a):this.g.T(0,0)}data(a){const b=L(this.g,this.h,6);return b?(a||new kj).i(Wf(this.g,this.h+b),this.g):null}Ja(){const a=L(this.g,this.h,8);return a?!!(this.g.j[this.h+a]<<24>>24):!1}};var mj,nj=mj||(mj={});nj[nj.Row=0]="Row";nj[nj.Column=1]="Column";var oj,pj=oj||(oj={});pj[pj.NONE=0]="NONE";pj[pj.SparseTensorIndexCOO=1]="SparseTensorIndexCOO";pj[pj.SparseMatrixIndexCSX=2]="SparseMatrixIndexCSX";pj[pj.SparseTensorIndexCSF=3]="SparseTensorIndexCSF";var qj,rj=qj||(qj={});rj[rj.NONE=0]="NONE";rj[rj.Schema=1]="Schema";rj[rj.DictionaryBatch=2]="DictionaryBatch";rj[rj.RecordBatch=3]="RecordBatch";rj[rj.Tensor=4]="Tensor";rj[rj.SparseTensor=5]="SparseTensor";class sj{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}version(){const a=L(this.g,this.h,4);return a?Tf(this.g,this.h+a):pg.V1}headerType(){const a=L(this.g,this.h,6);return a?this.g.j[this.h+a]:qj.NONE}header(a){const b=L(this.g,this.h,8);return b?Uf(this.g,a,this.h+b):null}bodyLength(){const a=L(this.g,this.h,10);return a?Mf(this.g,this.h+a):this.g.T(0,0)}Ga(a){const b=L(this.g,this.h,12);return b?(new og).i(Wf(this.g,Xf(this.g,this.h+b)+4*a),this.g):null}Ha(){const a=
L(this.g,this.h,12);return a?Yf(this.g,this.h+a):0}};class tj extends nd{visit(a,b){return null==a||null==b?void 0:super.visit(a,b)}visitNull(a,b){N(b,0);return O(b)}visitInt(a,b){N(b,2);gg(b,0,a.bitWidth,0);eg(b,1,+a.isSigned,0);return O(b)}visitFloat(a,b){N(b,1);fg(b,a.precision,Gg.HALF);return O(b)}visitBinary(a,b){N(b,0);return O(b)}visitBool(a,b){N(b,0);return O(b)}visitUtf8(a,b){N(b,0);return O(b)}visitDecimal(a,b){N(b,3);gg(b,1,a.scale,0);gg(b,0,a.precision,0);gg(b,2,a.bitWidth,128);return O(b)}visitDate(a,b){N(b,1);fg(b,a.unit,yg.MILLISECOND);
return O(b)}visitTime(a,b){N(b,2);fg(b,a.unit,Cg.MILLISECOND);gg(b,1,a.bitWidth,32);return O(b)}visitTimestamp(a,b){const c=a.timezone&&mg(b,a.timezone)||void 0;N(b,2);fg(b,a.unit,Cg.SECOND);void 0!==c&&M(b,1,c);return O(b)}visitInterval(a,b){N(b,1);fg(b,a.unit,Jg.YEAR_MONTH);return O(b)}visitList(a,b){N(b,0);return O(b)}visitStruct(a,b){N(b,0);return O(b)}visitUnion(a,b){kg(b,4,a.typeIds.length,4);var c=a.typeIds;kg(b,4,c.length,4);for(let d=c.length-1;0<=d;d--)dg(b,c[d]);c=lg(b);N(b,2);fg(b,a.mode,
Pg.Sparse);M(b,1,c);return O(b)}visitDictionary(a,b){const c=this.visit(a.indices,b);N(b,4);hg(b,0,new Of(a.id,0),b.T(0,0));eg(b,2,+a.isOrdered,0);void 0!==c&&M(b,1,c);return O(b)}visitFixedSizeBinary(a,b){N(b,1);gg(b,0,a.byteWidth,0);return O(b)}visitFixedSizeList(a,b){N(b,1);gg(b,0,a.listSize,0);return O(b)}visitMap(a,b){N(b,1);eg(b,0,+a.keysSorted,0);return O(b)}}const uj=new tj;function vj(a){return new wj(a.count,xj(a.columns),yj(a.columns))}function zj(a,b){return(a.fields||[]).filter(Boolean).map(c=>S.fromJSON(c,b))}function Aj(a,b){return(a.children||[]).filter(Boolean).map(c=>S.fromJSON(c,b))}function xj(a){return(a||[]).reduce((b,c)=>[...b,new Bj(c.count,Cj(c.VALIDITY)),...xj(c.children)],[])}
function yj(a,b=[]){for(let c=-1,d=(a||[]).length;++c<d;){const e=a[c];e.VALIDITY&&b.push(new Dj(b.length,e.VALIDITY.length));e.TYPE&&b.push(new Dj(b.length,e.TYPE.length));e.OFFSET&&b.push(new Dj(b.length,e.OFFSET.length));e.DATA&&b.push(new Dj(b.length,e.DATA.length));b=yj(e.children,b)}return b}function Cj(a){return(a||[]).reduce((b,c)=>b+ +(0===c),0)}function Ej(a){return new xb(a.isSigned,a.bitWidth)}
function Fj(a,b){const c=a.type.name;switch(c){case "NONE":return new wb;case "null":return new wb;case "binary":return new Sb;case "utf8":return new Wb;case "bool":return new $b;case "list":return new Jc((b||[])[0]);case "struct":return new D(b||[]);case "struct_":return new D(b||[])}switch(c){case "int":return b=a.type,new xb(b.isSigned,b.bitWidth);case "floatingpoint":return new Lb(x[a.type.precision]);case "decimal":return b=a.type,new dc(b.scale,b.precision,b.bitWidth);case "date":return new hc($a[a.type.unit]);
case "time":return b=a.type,new nc(y[b.unit],b.bitWidth);case "timestamp":return b=a.type,new vc(y[b.unit],b.timezone);case "interval":return new Dc(cb[a.type.unit]);case "union":return a=a.type,new Qc(w[a.mode],a.typeIds||[],b||[]);case "fixedsizebinary":return new Wc(a.type.byteWidth);case "fixedsizelist":return new $c(a.type.listSize,(b||[])[0]);case "map":return new dd((b||[])[0],a.type.keysSorted)}throw Error(`Unrecognized type: "${c}"`);};class Gj{constructor(a,b,c,d){this.Rb=b;this.Nb=c;this.body=new Uint8Array(0);d&&(this.Oa=()=>d);this.Ib="number"===typeof a?a:a.low}static fromJSON(a,b){const c=new Gj(0,Wa.V4,b);c.Oa=Hj(a,b);return c}static decode(a){a=new Zf(u(Uint8Array,a));a=(new sj).i(a.s(a.position())+a.position(),a);var b=a.bodyLength();const c=a.version(),d=a.headerType();b=new Gj(b,c,d);b.Oa=Ij(a,d);return b}static encode(a){const b=new ng;let c=-1;a.isSchema()?c=R.encode(b,a.header()):a.isRecordBatch()?c=wj.encode(b,a.header()):
a.isDictionaryBatch()&&(c=Jj.encode(b,a.header()));N(b,5);fg(b,Wa.V4,pg.V1);M(b,2,c);eg(b,1,a.headerType,qj.NONE);hg(b,3,new Of(a.bodyLength,0),b.T(0,0));a=O(b);b.finish(a);return bg(b)}static from(a,b=0){if(a instanceof R)return new Gj(0,Wa.V4,z.Schema,a);if(a instanceof wj)return new Gj(b,Wa.V4,z.RecordBatch,a);if(a instanceof Jj)return new Gj(b,Wa.V4,z.DictionaryBatch,a);throw Error(`Unrecognized Message header: ${a}`);}get type(){return this.headerType}get version(){return this.Rb}get headerType(){return this.Nb}get bodyLength(){return this.Ib}header(){return this.Oa()}isSchema(){return this.headerType===
z.Schema}isRecordBatch(){return this.headerType===z.RecordBatch}isDictionaryBatch(){return this.headerType===z.DictionaryBatch}}class wj{constructor(a,b,c){this.Ra=b;this.Ma=c;this.Qb="number"===typeof a?a:a.low}get N(){return this.Ra}get length(){return this.Qb}get buffers(){return this.Ma}}
class Jj{constructor(a,b,c=!1){this.Kb=a;this.Pb=c;this.Ob="number"===typeof b?b:b.low}get id(){return this.Ob}get data(){return this.Kb}get Ja(){return this.Pb}get length(){return this.data.length}get N(){return this.data.N}get buffers(){return this.data.buffers}}class Dj{constructor(a,b){this.offset="number"===typeof a?a:a.low;this.length="number"===typeof b?b:b.low}}class Bj{constructor(a,b){this.length="number"===typeof a?a:a.low;this.nullCount="number"===typeof b?b:b.low}}
function Hj(a,b){return()=>{switch(b){case z.Schema:return R.fromJSON(a);case z.RecordBatch:return wj.fromJSON(a);case z.DictionaryBatch:return Jj.fromJSON(a)}throw Error(`Unrecognized Message type: { name: ${z[b]}, type: ${b} }`);}}
function Ij(a,b){return()=>{switch(b){case z.Schema:return R.decode(a.header(new Zg));case z.RecordBatch:return wj.decode(a.header(new kj),a.version());case z.DictionaryBatch:return Jj.decode(a.header(new lj),a.version())}throw Error(`Unrecognized Message type: { name: ${z[b]}, type: ${b} }`);}}S.encode=Kj;S.decode=Lj;
S.fromJSON=function(a,b){var c;let d,e;b&&(e=a.dictionary)?(b.has(c=e.id)?(d=(d=e.indexType)?Ej(d):new Db,c=new id(b.get(c),d,c,e.isOrdered)):(d=(d=e.indexType)?Ej(d):new Db,b.set(c,b=Fj(a,Aj(a,b))),c=new id(b,d,c,e.isOrdered)),a=new S(a.name,c,a.nullable,new Map(Object.entries(a.customMetadata||{})))):(b=Fj(a,Aj(a,b)),a=new S(a.name,b,a.nullable,new Map(Object.entries(a.customMetadata||{}))));return a||null};R.encode=Mj;R.decode=Nj;
R.fromJSON=function(a,b=new Map){return new R(zj(a,b),new Map(Object.entries(a.customMetadata||{})),b)};wj.encode=Oj;wj.decode=Pj;wj.fromJSON=vj;Jj.encode=Qj;Jj.decode=Rj;Jj.fromJSON=function(a){return new Jj(vj(a.data),a.id,a.isDelta)};Bj.encode=Sj;Bj.decode=Tj;Dj.encode=Uj;Dj.decode=Vj;function Nj(a,b=new Map){const c=[];for(let d,e=-1,f=-1,g=Yg(a);++e<g;)if(d=a.fields(e))c[++f]=S.decode(d,b);return new R(c,Wj(a),b)}
function Pj(a,b=Wa.V4){var c=L(a.g,a.h,10);if(null!==(c?(new fj).i(Wf(a.g,a.h+c),a.g):null))throw Error("Record batch compression not implemented");c=a.length();const d=[];for(let f,g=-1,k=-1,m=ij(a);++g<m;)if(f=a.N(g))d[++k]=Bj.decode(f);const e=[];for(let f,g=-1,k=-1,m=jj(a);++g<m;)if(f=a.buffers(g))b<Wa.V4&&(f.h+=8*(g+1)),e[++k]=Dj.decode(f);return new wj(c,d,e)}function Rj(a,b=Wa.V4){return new Jj(wj.decode(a.data(),b),a.id(),a.Ja())}function Vj(a){return new Dj(a.offset(),a.length())}
function Tj(a){return new Bj(a.length(),a.nullCount())}function Xj(a,b){const c=[];for(let d,e=-1,f=-1,g=Ug(a);++e<g;)if(d=a.children(e))c[++f]=S.decode(d,b);return c}function Lj(a,b){var c;let d,e;b&&(e=a.dictionary())?(b.has(c=e.id().low)?(d=(d=wg(e))?Yj(d):new Db,c=new id(b.get(c),d,c,e.isOrdered())):(d=(d=wg(e))?Yj(d):new Db,b.set(c,b=Zj(a,Xj(a,b))),c=new id(b,d,c,e.isOrdered())),a=new S(a.name(),c,a.nullable(),Wj(a))):(b=Zj(a,Xj(a,b)),a=new S(a.name(),b,a.nullable(),Wj(a)));return a||null}
function Wj(a){const b=new Map;if(a)for(let c,d,e=-1,f=Math.trunc(a.Ha());++e<f;)(c=a.Ga(e))&&null!=(d=c.key())&&b.set(d,c.value());return b}function Yj(a){return new xb(a.isSigned(),a.bitWidth())}
function Zj(a,b){var c=(c=L(a.g,a.h,8))?a.g.j[a.h+c]:P.NONE;switch(c){case P.NONE:return new wb;case P.Null:return new wb;case P.Binary:return new Sb;case P.Utf8:return new Wb;case P.Bool:return new $b;case P.List:return new Jc((b||[])[0]);case P.Struct_:return new D(b||[])}switch(c){case P.Int:return b=a.type(new vg),new xb(b.isSigned(),b.bitWidth());case P.FloatingPoint:return b=a.type(new Ig),new Lb(b.precision());case P.Decimal:return b=a.type(new Bg),new dc(b.scale(),b.precision(),b.bitWidth());
case P.Date:return b=a.type(new Ag),new hc(b.unit());case P.Time:return b=a.type(new Ng),new nc(b.unit(),b.bitWidth());case P.Timestamp:return b=a.type(new Og),new vc(b.unit(),b.timezone());case P.Interval:return b=a.type(new Lg),new Dc(b.unit());case P.Union:c=a.type(new Rg);a=c.mode();const d=L(c.g,c.h,6);c=d?new Int32Array(c.g.S().buffer,c.g.S().byteOffset+Xf(c.g,c.h+d),Yf(c.g,c.h+d)):null;return new Qc(a,c||[],b||[]);case P.FixedSizeBinary:return b=a.type(new Eg),new Wc(b.byteWidth());case P.FixedSizeList:return a=
a.type(new Fg),new $c(a.listSize(),(b||[])[0]);case P.Map:return a=a.type(new Mg),new dd((b||[])[0],a.keysSorted())}throw Error(`Unrecognized type: "${P[c]}" (${c})`);}function Mj(a,b){var c=b.fields.map(d=>S.encode(a,d));kg(a,4,c.length,4);c=Wg(a,c);b=b.metadata&&0<b.metadata.size?Xg(a,[...b.metadata].map(([d,e])=>{d=mg(a,`${d}`);e=mg(a,`${e}`);N(a,2);M(a,0,d);M(a,1,e);return O(a)})):-1;N(a,4);M(a,1,c);fg(a,ak?rg.Hb:rg.$b,rg.Hb);-1!==b&&M(a,2,b);return O(a)}
function Kj(a,b){let c=-1,d=-1,e=-1;var f=b.type;let g=b.typeId;C.isDictionary(f)?(g=f.dictionary.typeId,e=uj.visit(f,a),d=uj.visit(f.dictionary,a)):d=uj.visit(f,a);f=(f.children||[]).map(m=>S.encode(a,m));f=Sg(a,f);const k=b.metadata&&0<b.metadata.size?Tg(a,[...b.metadata].map(([m,p])=>{m=mg(a,`${m}`);p=mg(a,`${p}`);N(a,2);M(a,0,m);M(a,1,p);return O(a)})):-1;b.name&&(c=mg(a,b.name));N(a,7);M(a,3,d);eg(a,2,g,P.NONE);M(a,5,f);eg(a,1,+!!b.nullable,0);-1!==c&&M(a,0,c);-1!==e&&M(a,4,e);-1!==k&&M(a,6,
k);return O(a)}function Oj(a,b){var c=b.N||[],d=b.buffers||[];kg(a,16,c.length,8);for(const e of c.slice().reverse())Bj.encode(a,e);c=lg(a);kg(a,16,d.length,8);for(const e of d.slice().reverse())Dj.encode(a,e);d=lg(a);N(a,4);hg(a,0,new Of(b.length,0),a.T(0,0));M(a,1,c);M(a,2,d);return O(a)}function Qj(a,b){const c=wj.encode(a,b.data);N(a,3);hg(a,0,new Of(b.id,0),a.T(0,0));eg(a,2,+b.Ja,0);M(a,1,c);return O(a)}
function Sj(a,b){var c=new Of(b.length,0);b=new Of(b.nullCount,0);$f(a,8,16);a.aa(b);a.aa(c);return a.offset()}function Uj(a,b){var c=new Of(b.offset,0);b=new Of(b.length,0);$f(a,8,16);a.aa(b);a.aa(c);return a.offset()}const bk=new ArrayBuffer(2);(new DataView(bk)).setInt16(0,256,!0);const ak=256===(new Int16Array(bk))[0];const ck=a=>`Expected ${z[a]} Message in stream, but was null or length 0.`,dk=a=>`Header pointer of flatbuffer-encoded ${z[a]} Message is null or length 0.`,ek=(a,b)=>`Expected to read ${a} metadata bytes, but only read ${b}.`,fk=(a,b)=>`Expected to read ${a} bytes for message body, but only read ${b}.`;
class gk{constructor(a){this.source=a instanceof mh?a:new mh(a)}[Symbol.iterator](){return this}next(){let a;return(a=this.readMetadataLength()).done||-1===a.value&&(a=this.readMetadataLength()).done||(a=this.readMetadata(a.value)).done?U:a}throw(a){return this.source.throw(a)}return(a){return this.source.return(a)}readMessage(a){let b;if((b=this.next()).done)return null;if(null!=a&&b.value.headerType!==a)throw Error(ck(a));return b.value}readMessageBody(a){if(0>=a)return new Uint8Array(0);const b=
u(Uint8Array,this.source.read(a));if(b.byteLength<a)throw Error(fk(a,b.byteLength));return 0===b.byteOffset%8&&b.byteOffset+b.byteLength<=b.buffer.byteLength?b:b.slice()}readSchema(a=!1){const b=z.Schema;let c;const d=null==(c=this.readMessage(b))?void 0:c.header();if(a&&!d)throw Error(dk(b));return d}readMetadataLength(){var a=this.source.read(4);let b;a=(null==(b=a&&new Zf(a))?void 0:b.s(0))||0;return{done:0===a,value:a}}readMetadata(a){const b=this.source.read(a);if(!b)return U;if(b.byteLength<
a)throw Error(ek(a,b.byteLength));return{done:!1,value:Gj.decode(b)}}}
class hk{constructor(a,b){this.source=a instanceof oh?a:t(a)&&q(a.stat)&&"number"===typeof a.fd?new rh(a,b):new oh(a)}[Symbol.asyncIterator](){return this}next(){const a=this;return l(function*(){let b;return(b=yield a.readMetadataLength()).done||-1===b.value&&(b=yield a.readMetadataLength()).done||(b=yield a.readMetadata(b.value)).done?U:b})}throw(a){const b=this;return l(function*(){return yield b.source.throw(a)})}return(a){const b=this;return l(function*(){return yield b.source.return(a)})}readMessage(a){const b=
this;return l(function*(){let c;if((c=yield b.next()).done)return null;if(null!=a&&c.value.headerType!==a)throw Error(ck(a));return c.value})}readMessageBody(a){const b=this;return l(function*(){if(0>=a)return new Uint8Array(0);const c=u(Uint8Array,yield b.source.read(a));if(c.byteLength<a)throw Error(fk(a,c.byteLength));return 0===c.byteOffset%8&&c.byteOffset+c.byteLength<=c.buffer.byteLength?c:c.slice()})}readSchema(a=!1){const b=this;return l(function*(){const c=z.Schema;let d;const e=null==(d=
yield b.readMessage(c))?void 0:d.header();if(a&&!e)throw Error(dk(c));return e})}readMetadataLength(){const a=this;return l(function*(){var b=yield a.source.read(4);let c;b=(null==(c=b&&new Zf(b))?void 0:c.s(0))||0;return{done:0===b,value:b}})}readMetadata(a){const b=this;return l(function*(){const c=yield b.source.read(a);if(!c)return U;if(c.byteLength<a)throw Error(ek(a,c.byteLength));return{done:!1,value:Gj.decode(c)}})}}
class ik extends gk{constructor(a){super(new Uint8Array(0));this.R=!1;this.Aa=[];this.Y=this.lb=0;this.ra=a instanceof gh?a:new gh(a)}next(){var a=this.ra;if(!this.R)return this.R=!0,{done:!1,value:Gj.fromJSON(a.schema,z.Schema)};if(this.Y<a.dictionaries.length)return a=a.dictionaries[this.Y++],this.Aa=a.data.columns,{done:!1,value:Gj.fromJSON(a,z.DictionaryBatch)};if(this.lb<a.batches.length)return a=a.batches[this.lb++],this.Aa=a.columns,{done:!1,value:Gj.fromJSON(a,z.RecordBatch)};this.Aa=[];return U}readMessageBody(){function a(b){return(b||
[]).reduce((c,d)=>[...c,...(d.VALIDITY&&[d.VALIDITY]||[]),...(d.TYPE&&[d.TYPE]||[]),...(d.OFFSET&&[d.OFFSET]||[]),...(d.DATA&&[d.DATA]||[]),...a(d.children)],[])}return a(this.Aa)}readMessage(a){let b;if((b=this.next()).done)return null;if(null!=a&&b.value.headerType!==a)throw Error(ck(a));return b.value}readSchema(){const a=z.Schema,b=this.readMessage(a),c=null==b?void 0:b.header();if(!b||!c)throw Error(dk(a));return c}}const jk=new Uint8Array(6);for(let a=0;6>a;a+=1)jk[a]="ARROW1".codePointAt(a);
function kk(a){for(let b=-1,c=jk.length;++b<c;)if(jk[b]!==a[0+b])return!1;return!0}const lk=jk.length,mk=lk+4,nk=2*lk+4;class ok extends jh{constructor(a){super();this.o=a}get closed(){return this.o.closed}get schema(){return this.o.schema}get autoDestroy(){return this.o.autoDestroy}get dictionaries(){return this.o.dictionaries}get numDictionaries(){return this.o.numDictionaries}get numRecordBatches(){return this.o.numRecordBatches}get footer(){return this.o.isFile()?this.o.footer:null}isSync(){return this.o.isSync()}isAsync(){return this.o.isAsync()}isFile(){return this.o.isFile()}isStream(){return this.o.isStream()}next(){return this.o.next()}throw(a){return this.o.throw(a)}return(a){return this.o.return(a)}cancel(){return this.o.cancel()}reset(a){this.o.reset(a);
this.qb=this.kb=void 0;return this}open(a){a=this.o.open(a);return t(a)&&q(a.then)?a.then(()=>this):this}readRecordBatch(a){return this.o.isFile()?this.o.readRecordBatch(a):null}[Symbol.iterator](){return this.o[Symbol.iterator]()}[Symbol.asyncIterator](){return this.o[Symbol.asyncIterator]()}toDOMStream(){return Na(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Oa(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}static throughNode(){throw Error('"throughNode" not available in this environment');
}static throughDOM(){throw Error('"throughDOM" not available in this environment');}static from(a){return a instanceof ok?a:t(a)&&t(a.schema)?new pk(new qk(a)):t(a)&&q(a.stat)&&"number"===typeof a.fd?rk(a):t(a)&&q(a.then)?(()=>l(function*(){return yield ok.from(yield a)}))():t(a)&&Ca(a.body)||Ca(a)||Da(a)||t(a)&&q(a[Symbol.asyncIterator])?sk(new oh(a)):tk(new mh(a))}static readAll(a){return a instanceof ok?a.isSync()?uk(a):vk(a):t(a)&&t(a.schema)||ArrayBuffer.isView(a)||t(a)&&q(a[Symbol.iterator])||
t(a)&&"done"in a&&"value"in a?uk(a):vk(a)}}class pk extends ok{constructor(a){super(a);this.o=a}readAll(){return[...this]}[Symbol.iterator](){return this.o[Symbol.iterator]()}[Symbol.asyncIterator](){const a=this;return new oa(function*(){yield new n(1,a[Symbol.iterator]())}())}}
class wk extends ok{constructor(a){super(a);this.o=a}readAll(){const a=this;return l(function*(){const b=[];for(const c=ia(a);;){const d=yield c.next();if(d.done)break;b.push(d.value)}return b})}[Symbol.iterator](){throw Error("AsyncRecordBatchStreamReader is not Iterable");}[Symbol.asyncIterator](){return this.o[Symbol.asyncIterator]()}}class xk extends pk{constructor(a){super(a);this.o=a}}class yk extends wk{constructor(a){super(a);this.o=a}}
function zk(a,b,c){c=a.Qa(b,c,a.schema.fields);b=I({type:new D(a.schema.fields),length:b.length,children:c});return new X(a.schema,b)}function Ak(a,b,c){var d=b.id;const e=b.Ja,f=a.schema,g=a.dictionaries.get(d);return e||!g?(d=f.dictionaries.get(d),a=a.Qa(b.data,c,[d]),(g&&e?g.concat(new F(a)):new F(a)).memoize()):g.memoize()}
class Bk{constructor(a=new Map){this.closed=!1;this.autoDestroy=!0;this.O=this.Y=0;this.dictionaries=a}get numDictionaries(){return this.Y}get numRecordBatches(){return this.O}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(a){this.O=this.Y=0;this.schema=a;this.dictionaries=new Map;return this}Qa(a,b,c){return(new Bh(b,a.N,a.buffers,this.dictionaries)).visitMany(c)}}
class Ck extends Bk{constructor(a){super();this.u=t(a)&&t(a.schema)?new ik(this.I=a):new gk(this.I=a)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset().u.return(),this.dictionaries=this.u=null)}open(a){this.closed||(this.autoDestroy=Dk(this,a),this.schema||(this.schema=this.u.readSchema())||this.cancel());return this}throw(a){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset().u.throw(a):U}return(a){return!this.closed&&
this.autoDestroy&&(this.closed=!0)?this.reset().u.return(a):U}next(){if(this.closed)return U;for(var a,b=this.u;a=this.ta();)if(a.isSchema())this.reset(a.header());else{if(a.isRecordBatch()){this.O++;var c=a.header();b=b.readMessageBody(a.bodyLength);return{done:!1,value:zk(this,c,b)}}a.isDictionaryBatch()&&(this.Y++,c=a.header(),a=b.readMessageBody(a.bodyLength),a=Ak(this,c,a),this.dictionaries.set(c.id,a))}return this.schema&&0===this.O?(this.O++,{done:!1,value:new aj(this.schema)}):this.return()}ta(){return this.u.readMessage(void 0)}}
class Ek extends Bk{constructor(a,b){super(b);this.u=new hk(this.I=a)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){const a=this;return l(function*(){!a.closed&&(a.closed=!0)&&(yield a.reset().u.return(),a.u=null,a.dictionaries=null)})}open(a){const b=this;return l(function*(){b.closed||(b.autoDestroy=Dk(b,a),b.schema||(b.schema=yield b.u.readSchema())||(yield b.cancel()));return b})}throw(a){const b=this;return l(function*(){return!b.closed&&b.autoDestroy&&
(b.closed=!0)?yield b.reset().u.throw(a):U})}return(a){const b=this;return l(function*(){return!b.closed&&b.autoDestroy&&(b.closed=!0)?yield b.reset().u.return(a):U})}next(){const a=this;return l(function*(){if(a.closed)return U;for(var b,c=a.u;b=yield a.ta();)if(b.isSchema())yield a.reset(b.header());else{if(b.isRecordBatch()){a.O++;var d=b.header();c=yield c.readMessageBody(b.bodyLength);return{done:!1,value:zk(a,d,c)}}b.isDictionaryBatch()&&(a.Y++,d=b.header(),b=yield c.readMessageBody(b.bodyLength),
b=Ak(a,d,b),a.dictionaries.set(d.id,b))}return a.schema&&0===a.O?(a.O++,{done:!1,value:new aj(a.schema)}):yield a.return()})}ta(){const a=this;return l(function*(){return yield a.u.readMessage(void 0)})}}
class Fk extends Ck{constructor(a){super(a instanceof qh?a:new qh(a))}get footer(){return this.l}get numDictionaries(){return this.l?this.l.numDictionaries:0}get numRecordBatches(){return this.l?this.l.numRecordBatches:0}isSync(){return!0}isFile(){return!0}open(a){if(!this.closed&&!this.l){this.schema=(this.l=this.Ua()).schema;for(const b of ch(this.l))b&&this.Ta(this.Y++)}return super.open(a)}readRecordBatch(a){if(this.closed)return null;this.l||this.open();var b;const c=null==(b=this.l)?void 0:
b.ja(a);return c&&this.I.seek(c.offset)&&(b=this.u.readMessage(z.RecordBatch),null==b?0:b.isRecordBatch())?(a=b.header(),b=this.u.readMessageBody(b.bodyLength),zk(this,a,b)):null}Ta(a){var b;const c=null==(b=this.l)?void 0:b.Ia(a);c&&this.I.seek(c.offset)&&(b=this.u.readMessage(z.DictionaryBatch),null==b?0:b.isDictionaryBatch())&&(a=b.header(),b=this.u.readMessageBody(b.bodyLength),b=Ak(this,a,b),this.dictionaries.set(a.id,b))}Ua(){var a=this.I;const b=a.size-mk,c=a.s(b);a=a.ka(b-c,c);return dh.decode(a)}ta(){this.l||
this.open();if(this.l&&this.O<this.numRecordBatches){let a;const b=null==(a=this.l)?void 0:a.ja(this.O);if(b&&this.I.seek(b.offset))return this.u.readMessage(void 0)}return null}}
class Gk extends Ek{constructor(a){var b=[];const c="number"!==typeof b[0]?b.shift():void 0;b=b[0]instanceof Map?b.shift():void 0;super(a instanceof rh?a:new rh(a,c),b)}get footer(){return this.l}get numDictionaries(){return this.l?this.l.numDictionaries:0}get numRecordBatches(){return this.l?this.l.numRecordBatches:0}isFile(){return!0}isAsync(){return!0}open(a){const b=this,c=()=>super.open;return l(function*(){if(!b.closed&&!b.l){b.schema=(b.l=yield b.Ua()).schema;for(const d of ch(b.l))d&&(yield b.Ta(b.Y++))}return yield c().call(b,
a)})}readRecordBatch(a){const b=this;return l(function*(){if(b.closed)return null;b.l||(yield b.open());var c,d=null==(c=b.l)?void 0:c.ja(a);return d&&(yield b.I.seek(d.offset))&&(d=yield b.u.readMessage(z.RecordBatch),null==d?0:d.isRecordBatch())?(c=d.header(),d=yield b.u.readMessageBody(d.bodyLength),zk(b,c,d)):null})}Ta(a){const b=this;return l(function*(){var c,d=null==(c=b.l)?void 0:c.Ia(a);d&&(yield b.I.seek(d.offset))&&(d=yield b.u.readMessage(z.DictionaryBatch),null==d?0:d.isDictionaryBatch())&&
(c=d.header(),d=yield b.u.readMessageBody(d.bodyLength),d=Ak(b,c,d),b.dictionaries.set(c.id,d))})}Ua(){const a=this;return l(function*(){var b=a.I;b.C&&(yield b.C);const c=b.size-mk,d=yield b.s(c);b=yield b.ka(c-d,d);return dh.decode(b)})}ta(){const a=this;return l(function*(){a.l||(yield a.open());if(a.l&&a.O<a.numRecordBatches){const b=a.l.ja(a.O);if(b&&(yield a.I.seek(b.offset)))return yield a.u.readMessage(void 0)}return null})}}
class qk extends Ck{Qa(a,b,c){return(new Ch(b,a.N,a.buffers,this.dictionaries)).visitMany(c)}}function Dk(a,b){return b&&"boolean"===typeof b.autoDestroy?b.autoDestroy:a.autoDestroy}function*uk(a){a=ok.from(a);try{if(!a.open({autoDestroy:!1}).closed){do yield a;while(!a.reset().open().closed)}}finally{a.cancel()}}
function vk(a){return new oa(function*(){const b=yield new n(2,ok.from(a));try{if(!(yield new n(2,b.open({autoDestroy:!1}))).closed){do yield new n(0,b);while(!(yield new n(2,b.reset().open())).closed)}}finally{yield new n(2,b.cancel())}}())}function tk(a){const b=a.peek(lk+7&-8);return b&&4<=b.byteLength?kk(b)?new xk(new Fk(a.read())):new pk(new Ck(a)):new pk(new Ck(function*(){}()))}
function sk(a){return l(function*(){const b=yield a.peek(lk+7&-8);return b&&4<=b.byteLength?kk(b)?new xk(new Fk(yield a.read())):new wk(new Ek(a)):new wk(new Ek(function(){return new oa(function*(){}())}()))})}function rk(a){return l(function*(){const {size:b}=yield a.stat(),c=new rh(a,b);return b>=nk&&kk(yield c.ka(0,lk+7&-8))?new yk(new Gk(c)):new wk(new Ek(c))})};class Hk extends nd{constructor(){super();this.ba=0;this.Ra=[];this.Ma=[];this.Jb=[]}static va(...a){const b=d=>d.flatMap(e=>Array.isArray(e)?b(e):e instanceof X?e.data.children:e.data),c=new Hk;c.visitMany(b(a));return c}visit(a){if(a instanceof F)return this.visitMany(a.data),this;const b=a.type;if(!C.isDictionary(b)){const c=a.length,d=a.nullCount;if(2147483647<c)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");C.isNull(b)||Ik.call(this,0>=d?new Uint8Array(0):Qe(a.offset,
c,a.nullBitmap));this.N.push(new Bj(c,d))}return super.visit(a)}visitNull(){return this}visitDictionary(a){return this.visit(a.clone(a.type.indices))}get N(){return this.Ra}get buffers(){return this.Ma}get byteLength(){return this.ba}get Za(){return this.Jb}}function Ik(a){const b=a.byteLength+7&-8;this.buffers.push(a);this.Za.push(new Dj(this.ba,b));this.ba+=b;return this}function Jk(a){return Ik.call(this,a.values.subarray(0,a.length*a.stride))}
function Kk(a){const b=a.length,c=a.values;a=a.valueOffsets;const d=a[0],e=Math.min(a[b]-d,c.byteLength-d);Ik.call(this,La(-a[0],b,a));Ik.call(this,c.subarray(d,d+e));return this}function Lk(a){const b=a.length,c=a.valueOffsets;c&&Ik.call(this,La(c[0],b,c));return this.visit(a.children[0])}function Mk(a){return this.visitMany(a.type.children.map((b,c)=>a.children[c]).filter(Boolean))[0]}h=Hk.prototype;
h.visitBool=function(a){let b;return a.nullCount>=a.length?Ik.call(this,new Uint8Array(0)):(b=a.values)instanceof Uint8Array?Ik.call(this,Qe(a.offset,a.length,b)):Ik.call(this,Re(a.values))};h.visitInt=Jk;h.visitFloat=Jk;h.visitUtf8=Kk;h.visitBinary=Kk;h.visitFixedSizeBinary=Jk;h.visitDate=Jk;h.visitTimestamp=Jk;h.visitTime=Jk;h.visitDecimal=Jk;h.visitList=Lk;h.visitStruct=Mk;
h.visitUnion=function(a){const b=a.type,c=a.length;var d=a.typeIds,e=a.valueOffsets;Ik.call(this,d);if(b.mode===w.Sparse)return Mk.call(this,a);if(b.mode===w.Dense){if(0>=a.offset)return Ik.call(this,e),Mk.call(this,a);var f=d.reduce((m,p)=>Math.max(m,p),d[0]);const g=new Int32Array(f+1);f=(new Int32Array(f+1)).fill(-1);const k=new Int32Array(c);e=La(-e[0],c,e);for(let m,p,r=-1;++r<c;)-1===(p=f[m=d[r]])&&(p=f[m]=e[m]),k[r]=e[r]-p,++g[m];Ik.call(this,k);for(let m,p=-1,r=b.children.length;++p<r;)if(m=
a.children[p])d=b.typeIds[p],this.visit(m.slice(f[d],Math.min(c,g[d])))}return this};h.visitInterval=Jk;h.visitFixedSizeList=Lk;h.visitMap=Lk;class Nk extends nd{visit(a){return null==a?void 0:super.visit(a)}visitNull({typeId:a}){return{name:P[a].toLowerCase()}}visitInt({typeId:a,bitWidth:b,isSigned:c}){return{name:P[a].toLowerCase(),bitWidth:b,isSigned:c}}visitFloat({typeId:a,precision:b}){return{name:P[a].toLowerCase(),precision:x[b]}}visitBinary({typeId:a}){return{name:P[a].toLowerCase()}}visitBool({typeId:a}){return{name:P[a].toLowerCase()}}visitUtf8({typeId:a}){return{name:P[a].toLowerCase()}}visitDecimal({typeId:a,scale:b,precision:c,
bitWidth:d}){return{name:P[a].toLowerCase(),scale:b,precision:c,bitWidth:d}}visitDate({typeId:a,unit:b}){return{name:P[a].toLowerCase(),unit:$a[b]}}visitTime({typeId:a,unit:b,bitWidth:c}){return{name:P[a].toLowerCase(),unit:y[b],bitWidth:c}}visitTimestamp({typeId:a,timezone:b,unit:c}){return{name:P[a].toLowerCase(),unit:y[c],timezone:b}}visitInterval({typeId:a,unit:b}){return{name:P[a].toLowerCase(),unit:cb[b]}}visitList({typeId:a}){return{name:P[a].toLowerCase()}}visitStruct({typeId:a}){return{name:P[a].toLowerCase()}}visitUnion({typeId:a,
mode:b,typeIds:c}){return{name:P[a].toLowerCase(),mode:w[b],typeIds:[...c]}}visitDictionary(a){return this.visit(a.dictionary)}visitFixedSizeBinary({typeId:a,byteWidth:b}){return{name:P[a].toLowerCase(),byteWidth:b}}visitFixedSizeList({typeId:a,listSize:b}){return{name:P[a].toLowerCase(),listSize:b}}visitMap({typeId:a,keysSorted:b}){return{name:P[a].toLowerCase(),keysSorted:b}}};class Ok extends nd{static va(...a){const b=new Ok;return a.map(({schema:c,data:d})=>b.visitMany(c.fields,d.children))}visit({name:a},b){const c=b.length,d=b.offset,e=b.nullCount,f=b.nullBitmap,g=C.isDictionary(b.type)?b.type.indices:b.type,k=Object.assign([],b.buffers,{[fb.VALIDITY]:void 0});return Object.assign({},{name:a,count:c,VALIDITY:C.isNull(g)?void 0:0>=e?Array.from({length:c},()=>1):[...(new Se(f,d,c,null,Pe))]},super.visit(b.clone(g,d,c,0,k)))}visitNull(){return{}}visitBool({values:a,offset:b,
length:c}){return{DATA:[...(new Se(a,b,c,null,Oe))]}}visitInt(a){return{DATA:64>a.type.bitWidth?[...a.values]:[...Pk(a.values,2)]}}visitFloat(a){return{DATA:[...a.values]}}visitUtf8(a){return{DATA:[...(new F([a]))],OFFSET:[...a.valueOffsets]}}visitBinary(a){return{DATA:[...Qk(new F([a]))],OFFSET:[...a.valueOffsets]}}visitFixedSizeBinary(a){return{DATA:[...Qk(new F([a]))]}}visitDate(a){return{DATA:a.type.unit===$a.DAY?[...a.values]:[...Pk(a.values,2)]}}visitTimestamp(a){return{DATA:[...Pk(a.values,
2)]}}visitTime(a){return{DATA:a.type.unit<y.MICROSECOND?[...a.values]:[...Pk(a.values,2)]}}visitDecimal(a){return{DATA:[...Pk(a.values,4)]}}visitList(a){return{OFFSET:[...a.valueOffsets],children:this.visitMany(a.type.children,a.children)}}visitStruct(a){return{children:this.visitMany(a.type.children,a.children)}}visitUnion(a){return{TYPE:[...a.typeIds],OFFSET:a.type.mode===w.Dense?[...a.valueOffsets]:void 0,children:this.visitMany(a.type.children,a.children)}}visitInterval(a){return{DATA:[...a.values]}}visitFixedSizeList(a){return{children:this.visitMany(a.type.children,
a.children)}}visitMap(a){return{OFFSET:[...a.valueOffsets],children:this.visitMany(a.type.children,a.children)}}}function*Qk(a){for(const b of a)yield b.reduce((c,d)=>`${c}${("0"+(d&255).toString(16)).slice(-2)}`,"").toUpperCase()}function*Pk(a,b){a=new Uint32Array(a.buffer);for(let c=-1,d=a.length/b;++c<d;)yield`${rb.new(a.subarray((c+0)*b,(c+1)*b),!1)}`};function Y(a,b){a.ua&&(b=u(Uint8Array,b))&&0<b.byteLength&&(a.G.write(b),a.sa+=b.byteLength);return a}function Rk(a,b){return 0<b?Y(a,new Uint8Array(b)):a}function Sk(a,b){let c,d,e;for(let f=-1,g=b.length;++f<g;)(c=b[f])&&0<(d=c.byteLength)&&(Y(a,c),0<(e=(d+7&-8)-d)&&Rk(a,e))}
class Tk extends jh{constructor(a){super();this.sa=0;this.ua=!1;this.G=new lh;this.R=null;this.qa=[];this.Ca=[];this.ga=new Map;t(a)||(a={autoDestroy:!0,Fb:!1});this.za="boolean"===typeof a.autoDestroy?a.autoDestroy:!0;this.Va="boolean"===typeof a.Fb?a.Fb:!1}static throughNode(){throw Error('"throughNode" not available in this environment');}static throughDOM(){throw Error('"throughDOM" not available in this environment');}toString(a=!1){return this.G.toString(a)}toUint8Array(a=!1){return this.G.toUint8Array(a)}writeAll(a){return t(a)&&
q(a.then)?a.then(b=>this.writeAll(b)):t(a)&&q(a[Symbol.asyncIterator])?Uk(this,a):Vk(this,a)}get closed(){return this.G.closed}[Symbol.asyncIterator](){return this.G[Symbol.asyncIterator]()}toDOMStream(a){return this.G.toDOMStream(a)}toNodeStream(a){return this.G.toNodeStream(a)}close(){return this.reset().G.close()}abort(a){return this.reset().G.abort(a)}finish(){this.za?this.close():this.reset(this.G,this.R);return this}reset(a=this.G,b=null){a===this.G||a instanceof lh?this.G=a:(this.G=new lh,
a&&t(a)&&q(a.abort)&&q(a.getWriter)&&!Ba(a)?this.toDOMStream({type:"bytes"}).pipeTo(a):a&&t(a)&&q(a.end)&&q(a.write)&&"boolean"===typeof a.writable&&!Ba(a)&&ih(this.toNodeStream({bc:!1}),a));this.ua&&this.R&&this.Ea(this.R);this.ua=!1;this.qa=[];this.Ca=[];this.ga=new Map;b&&Ji(b,this.R)||(null==b?(this.sa=0,this.R=null):(this.ua=!0,this.R=b,this.Wa(b)));return this}write(a){let b=null;if(this.G){if(null==a||a instanceof Ri&&!(b=a.schema)||a instanceof X&&!(b=a.schema))return this.finish()&&void 0}else throw Error("RecordBatchWriter is closed");
if(b&&!Ji(b,this.R)){if(this.ua&&this.za)return this.close();this.reset(this.G,b)}a instanceof X?a instanceof aj||this.tb(a):a instanceof Ri?this.writeAll(a.batches):t(a)&&q(a[Symbol.iterator])&&this.writeAll(a)}Fa(a){const b=Gj.encode(a),c=b.byteLength,d=this.Va?4:8,e=c+d+7&-8,f=e-c-d;a.headerType===z.RecordBatch?this.Ca.push(new fh(e,a.bodyLength,this.sa)):a.headerType===z.DictionaryBatch&&this.qa.push(new fh(e,a.bodyLength,this.sa));this.Va||Y(this,Int32Array.of(-1));Y(this,Int32Array.of(e-d));
0<c&&Y(this,b);return Rk(this,f)}Wa(a){this.Fa(Gj.from(a))}Ea(){return this.Va?Y(this,Int32Array.of(0)):Y(this,Int32Array.of(-1,0))}tb(a){const {byteLength:b,N:c,Za:d,buffers:e}=Hk.va(a),f=Gj.from(new wj(a.numRows,c,d),b);Sk(this.Da(a).Fa(f),e)}sb(a,b,c=!1){this.ga.set(b,a.length+(this.ga.get(b)||0));const {byteLength:d,N:e,Za:f,buffers:g}=Hk.va(new F([a]));a=Gj.from(new Jj(new wj(a.length,e,f),b,c),d);Sk(this.Fa(a),g)}Da(a){for(let [b,c]of a.dictionaries){a=this.ga.get(b)||0;let d;if(0===a||0<(c=
null==(d=c)?void 0:d.slice(a)).length)for(const e of c.data)this.sb(e,b,0<a),a+=e.length}return this}}class Wk extends Tk{static writeAll(a,b){const c=new Wk(b);return t(a)&&q(a.then)?a.then(d=>c.writeAll(d)):t(a)&&q(a[Symbol.asyncIterator])?Uk(c,a):Vk(c,a)}}
class Xk extends Tk{static writeAll(a){const b=new Xk;return t(a)&&q(a.then)?a.then(c=>b.writeAll(c)):t(a)&&q(a[Symbol.asyncIterator])?Uk(b,a):Vk(b,a)}constructor(){super();this.za=!0}Wa(){Rk(Y(this,jk),2)}Ea(a){const b=dh.encode(new dh(a,Wa.V4,this.Ca,this.qa));return Y(Y(Y(super.Ea(a),b),Int32Array.of(b.byteLength)),jk)}}
class Yk extends Tk{constructor(){super();this.za=!0;this.ca=[];this.fa=[]}static writeAll(a){return(new Yk).writeAll(a)}Fa(){return this}Ea(){return this}Wa(a){Y(this,`{\n  "schema": ${JSON.stringify({fields:a.fields.map(b=>Zk(b))},null,2)}`)}Da(a){0<a.dictionaries.size&&this.fa.push(a);return this}sb(a,b,c=!1){this.ga.set(b,a.length+(this.ga.get(b)||0));Y(this,0===this.qa.length?"    ":",\n    ");Y(this,`${$k(a,b,c)}`);this.qa.push(new fh(0,0,0))}tb(a){this.Da(a);this.ca.push(a)}close(){if(0<this.fa.length){Y(this,
',\n  "dictionaries": [\n');for(var a of this.fa)super.Da(a);Y(this,"\n  ]")}if(0<this.ca.length){for(let b=-1,c=this.ca.length;++b<c;){Y(this,0===b?',\n  "batches": [\n    ':",\n    ");a=this.ca[b];const [d]=Ok.va(a);a=JSON.stringify({count:a.numRows,columns:d},null,2);Y(this,`${a}`);this.Ca.push(new fh(0,0,0))}Y(this,"\n  ]")}this.R&&Y(this,"\n}");this.fa=[];this.ca=[];return super.close()}}
function Vk(a,b){let c=b;b instanceof Ri&&(c=b.batches,a.reset(void 0,b.schema));for(const d of c)a.write(d);return a.finish()}function Uk(a,b){return l(function*(){for(const c=ia(b);;){const d=yield c.next();if(d.done)break;a.write(d.value)}return a.finish()})}function Zk({name:a,type:b,nullable:c}){const d=new Nk;return{name:a,nullable:c,type:d.visit(b),children:(b.children||[]).map(e=>Zk(e)),dictionary:C.isDictionary(b)?{id:b.id,isOrdered:b.isOrdered,indexType:d.visit(b.indices)}:void 0}}
function $k(a,b,c=!1){const [d]=Ok.va(new X({[b]:a}));return JSON.stringify({id:b,isDelta:c,data:{count:a.length,columns:d}},null,2)};function al(a,b){function c(g,k){let m,p,r=g.desiredSize||null;for(;!(p=k.next(e?r:null)).done;)if(ArrayBuffer.isView(p.value)&&(m=u(Uint8Array,p.value))&&(null!=r&&e&&(r=r-m.byteLength+1),p.value=m),g.enqueue(p.value),null!=r&&0>=--r)return;g.close()}let d=null;const e="bytes"===(null==b?void 0:b.type)||!1,f=(null==b?void 0:b.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign({},b,{start(g){c(g,d||(d=a[Symbol.iterator]()))},pull(g){d?c(g,d):g.close()},cancel(){let g;(null==(g=
d)?0:g.return)&&d.return();d=null}}),Object.assign({},{highWaterMark:e?f:void 0},b))}
function bl(a,b){function c(g,k){return l(function*(){let m,p,r=g.desiredSize||null;for(;!(p=yield k.next(e?r:null)).done;)if(ArrayBuffer.isView(p.value)&&(m=u(Uint8Array,p.value))&&(null!=r&&e&&(r=r-m.byteLength+1),p.value=m),g.enqueue(p.value),null!=r&&0>=--r)return;g.close()})}let d=null;const e="bytes"===(null==b?void 0:b.type)||!1,f=(null==b?void 0:b.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign({},b,{start(g){return l(function*(){yield c(g,d||(d=a[Symbol.asyncIterator]()))})},
pull(g){return l(function*(){d?yield c(g,d):g.close()})},cancel(){return l(function*(){let g;(null==(g=d)?0:g.return)&&(yield d.return());d=null})}}),Object.assign({},{highWaterMark:e?f:void 0},b))};function cl(a,b,c){null!=c&&(a.oa>=c.desiredSize&&++a.Sa&&dl(a,c,b.toVector()),b.finished&&((0<b.length||0===a.Sa)&&++a.Sa&&dl(a,c,b.toVector()),!a.nb&&(a.nb=!0)&&dl(a,c,null)))}function dl(a,b,c){a.oa=0;a.pa=null;null==c?b.close():b.enqueue(c)}
class el{constructor(a){this.Sa=0;this.nb=!1;this.oa=0;var b=Object.assign({},a),c=a.readableStrategy,d=a.writableStrategy;a=a.queueingStrategy;a=void 0===a?"count":a;b=(delete b.readableStrategy,delete b.writableStrategy,delete b.queueingStrategy,b);this.pa=null;this.da=Lh(b);this.Mb="bytes"!==a?fl:gl;({highWaterMark:c="bytes"===a?Math.pow(2,14):1E3}=Object.assign({},c));({highWaterMark:d="bytes"===a?Math.pow(2,14):1E3}=Object.assign({},d));this.readable=new ReadableStream({cancel:()=>{this.da.clear()},
pull:e=>{cl(this,this.da,this.pa=e)},start:e=>{cl(this,this.da,this.pa=e)}},{highWaterMark:c,size:"bytes"!==a?fl:gl});this.writable=new WritableStream({abort:()=>{this.da.clear()},write:()=>{cl(this,this.da,this.pa)},close:()=>{cl(this,this.da.finish(),this.pa)}},{highWaterMark:d,size:e=>{const f=this.oa;this.oa=this.Mb(this.da.append(e));return this.oa-f}})}}const fl=a=>{let b;return null!=(b=null==a?void 0:a.length)?b:0},gl=a=>{let b;return null!=(b=null==a?void 0:a.byteLength)?b:0};function hl(a,b){function c(){return l(function*(){return yield(yield ok.from(e)).open(b)})}function d(k,m){return l(function*(){let p=k.desiredSize,r;for(;!(r=yield m.next()).done;)if(k.enqueue(r.value),null!=p&&0>=--p)return;k.close()})}const e=new lh;let f=null;const g=new ReadableStream({cancel(){return l(function*(){yield e.close()})},start(k){return l(function*(){yield d(k,f||(f=yield c()))})},pull(k){return l(function*(){f?yield d(k,f):k.close()})}});return{writable:new WritableStream(e,Object.assign({},
{highWaterMark:Math.pow(2,14)},a)),readable:g}};function il(a,b){function c(f){return l(function*(){let g,k=f.desiredSize;for(;g=yield e.read(k||null);)if(f.enqueue(g),null!=k&&0>=(k-=g.byteLength))return;f.close()})}const d=new this(a),e=new oh(d);b=new ReadableStream({cancel(){return l(function*(){yield e.cancel()})},pull(f){return l(function*(){yield c(f)})},start(f){return l(function*(){yield c(f)})}},Object.assign({},{highWaterMark:Math.pow(2,14)},b));return{writable:new WritableStream(d,a),readable:b}};function jl(a){a=ok.from(a);return t(a)&&q(a.then)?a.then(b=>jl(b)):a.isAsync()?a.readAll().then(b=>new Ri(b)):new Ri(a.readAll())};const kl=Object.assign({},sb,zh,We,vd,v,Ne,{compareSchemas:Ji,compareFields:function(a,b){return Hi.compareFields(a,b)},compareTypes:Ki});Na=function(a,b){if(t(a)&&q(a[Symbol.asyncIterator]))return bl(a,b);if(t(a)&&q(a[Symbol.iterator]))return al(a,b);throw Error("toDOMStream() must be called with an Iterable or AsyncIterable");};Hf.throughDOM=function(a){return new el(a)};ok.throughDOM=hl;xk.throughDOM=hl;pk.throughDOM=hl;Tk.throughDOM=il;Xk.throughDOM=il;Wk.throughDOM=il;var Z={};Z.AsyncByteQueue=lh;Z.AsyncByteStream=oh;Z.AsyncMessageReader=hk;Z.AsyncRecordBatchFileReader=yk;Z.AsyncRecordBatchStreamReader=wk;Z.Binary=Sb;
Z.BinaryBuilder=Eh;Z.Bool=$b;Z.BoolBuilder=Fh;Z.BufferType=fb;Z.Builder=Hf;Z.ByteStream=mh;Z.Data=H;Z.DataType=C;Z.DateBuilder=Gh;Z.DateDay=lc;Z.DateDayBuilder=Hh;Z.DateMillisecond=mc;Z.DateMillisecondBuilder=Ih;Z.DateUnit=$a;Z.Date_=hc;Z.Decimal=dc;Z.DecimalBuilder=Jh;Z.DenseUnion=Uc;Z.DenseUnionBuilder=ti;Z.Dictionary=id;Z.DictionaryBuilder=Kh;Z.Field=S;Z.FixedSizeBinary=Wc;Z.FixedSizeBinaryBuilder=Mh;Z.FixedSizeList=$c;Z.FixedSizeListBuilder=Nh;Z.Float=Lb;Z.Float16=Pb;Z.Float16Builder=Ph;
Z.Float32=Qb;Z.Float32Builder=Qh;Z.Float64=Rb;Z.Float64Builder=Rh;Z.FloatBuilder=Oh;Z.Int=xb;Z.Int16=Cb;Z.Int16Builder=Xh;Z.Int32=Db;Z.Int32Builder=Yh;Z.Int64=Gb;Z.Int64Builder=Zh;Z.Int8=Bb;Z.Int8Builder=Wh;Z.IntBuilder=Vh;Z.Interval=Dc;Z.IntervalBuilder=Sh;Z.IntervalDayTime=Hc;Z.IntervalDayTimeBuilder=Th;Z.IntervalUnit=cb;Z.IntervalYearMonth=Ic;Z.IntervalYearMonthBuilder=Uh;Z.JSONMessageReader=ik;Z.List=Jc;Z.ListBuilder=di;Z.MapBuilder=ei;Z.MapRow=ye;Z.Map_=dd;Z.Message=Gj;Z.MessageHeader=qj;
Z.MessageReader=gk;Z.MetadataVersion=Wa;Z.Null=wb;Z.NullBuilder=fi;Z.Precision=x;Z.RecordBatch=X;Z.RecordBatchFileReader=xk;Z.RecordBatchFileWriter=Xk;Z.RecordBatchJSONWriter=Yk;Z.RecordBatchReader=ok;Z.RecordBatchStreamReader=pk;Z.RecordBatchStreamWriter=Wk;Z.RecordBatchWriter=Tk;Z.Schema=R;Z.SparseUnion=Vc;Z.SparseUnionBuilder=si;Z.Struct=D;Z.StructBuilder=gi;Z.StructRow=ce;Z.Table=Ri;Z.Time=nc;Z.TimeBuilder=mi;Z.TimeMicrosecond=tc;Z.TimeMicrosecondBuilder=pi;Z.TimeMillisecond=sc;
Z.TimeMillisecondBuilder=oi;Z.TimeNanosecond=uc;Z.TimeNanosecondBuilder=qi;Z.TimeSecond=rc;Z.TimeSecondBuilder=ni;Z.TimeUnit=y;Z.Timestamp=vc;Z.TimestampBuilder=hi;Z.TimestampMicrosecond=Bc;Z.TimestampMicrosecondBuilder=ki;Z.TimestampMillisecond=Ac;Z.TimestampMillisecondBuilder=ji;Z.TimestampNanosecond=Cc;Z.TimestampNanosecondBuilder=li;Z.TimestampSecond=zc;Z.TimestampSecondBuilder=ii;Z.Type=A;Z.Uint16=Ib;Z.Uint16Builder=ai;Z.Uint32=Jb;Z.Uint32Builder=bi;Z.Uint64=Kb;Z.Uint64Builder=ci;Z.Uint8=Hb;
Z.Uint8Builder=$h;Z.Union=Qc;Z.UnionBuilder=ri;Z.UnionMode=w;Z.Utf8=Wb;Z.Utf8Builder=ui;Z.Vector=F;Z.Visitor=nd;
Z.builderThroughAsyncIterable=function(a){const {queueingStrategy:b="count"}=a,{highWaterMark:c="bytes"!==b?Number.POSITIVE_INFINITY:Math.pow(2,14)}=a,d="bytes"!==b?"length":"byteLength";return function(e){return new oa(function*(){let f=0;const g=Lh(a);for(const k=ia(e);;){const m=yield new n(2,k.next());if(m.done)break;g.append(m.value)[d]>=c&&++f&&(yield new n(0,g.toVector()))}if(0<g.finish().length||0===f)yield new n(0,g.toVector())}())}};Z.builderThroughIterable=Ni;Z.makeBuilder=Lh;
Z.makeData=I;Z.makeTable=function(a){const b={};a=Object.entries(a);for(const [c,d]of a)b[c]=xf(d);return new Ri(b)};Z.makeVector=xf;Z.tableFromArrays=function(a){const b={};a=Object.entries(a);for(const [c,d]of a)b[c]=Li(d);return new Ri(b)};Z.tableFromIPC=jl;Z.tableFromJSON=function(a){a=Li(a);a=new X(new R(a.type.children),a.data[0]);return new Ri(a)};Z.tableToIPC=function(a,b="stream"){return("stream"===b?Wk:Xk).writeAll(a).toUint8Array(!0)};Z.util=kl;Z.vectorFromArray=Li;Object.assign(arguments[0],Z);}.bind(this))));

//# sourceMappingURL=Arrow.es2015.min.js.map