File size: 220,702 Bytes
be5030f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
var app=function(){"use strict";function t(){}function e(t,e){for(const r in e)t[r]=e[r];return t}function r(t){return t()}function i(){return Object.create(null)}function n(t){t.forEach(r)}function s(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let o,c;function u(t,e){return o||(o=document.createElement("a")),o.href=e,t===o.href}function l(t,e,r){const i=function(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;if(e&&e.host)return e;return t.ownerDocument}(t);if(!i.getElementById(e)){const t=f("style");t.id=e,t.textContent=r,function(t,e){!function(t,e){t.appendChild(e)}(t.head||t,e)}(i,t)}}function h(t,e,r){t.insertBefore(e,r||null)}function d(t){t.parentNode.removeChild(t)}function f(t){return document.createElement(t)}function p(){return t="",document.createTextNode(t);var t}function y(t,e,r,i){return t.addEventListener(e,r,i),()=>t.removeEventListener(e,r,i)}function b(t,e,r){null==r?t.removeAttribute(e):t.getAttribute(e)!==r&&t.setAttribute(e,r)}function g(t,e,r,i){t.style.setProperty(e,r,i?"important":"")}function _(t){c=t}function m(){if(!c)throw new Error("Function called outside component initialization");return c}function v(t){m().$$.on_mount.push(t)}const w=[],I=[],S=[],T=[],B=Promise.resolve();let A=!1;function D(t){S.push(t)}let x=!1;const L=new Set;function O(){if(!x){x=!0;do{for(let t=0;t<w.length;t+=1){const e=w[t];_(e),F(e.$$)}for(_(null),w.length=0;I.length;)I.pop()();for(let t=0;t<S.length;t+=1){const e=S[t];L.has(e)||(L.add(e),e())}S.length=0}while(w.length);for(;T.length;)T.pop()();A=!1,x=!1,L.clear()}}function F(t){if(null!==t.fragment){t.update(),n(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(D)}}const M=new Set;let E;function U(){E={r:0,c:[],p:E}}function N(){E.r||n(E.c),E=E.p}function V(t,e){t&&t.i&&(M.delete(t),t.i(e))}function C(t,e,r,i){if(t&&t.o){if(M.has(t))return;M.add(t),E.c.push(()=>{M.delete(t),i&&(r&&t.d(1),i())}),t.o(e)}}function k(t){t&&t.c()}function R(t,e,i,a){const{fragment:o,on_mount:c,on_destroy:u,after_update:l}=t.$$;o&&o.m(e,i),a||D(()=>{const e=c.map(r).filter(s);u?u.push(...e):n(e),t.$$.on_mount=[]}),l.forEach(D)}function z(t,e){const r=t.$$;null!==r.fragment&&(n(r.on_destroy),r.fragment&&r.fragment.d(e),r.on_destroy=r.fragment=null,r.ctx=[])}function j(t,e){-1===t.$$.dirty[0]&&(w.push(t),A||(A=!0,B.then(O)),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function P(e,r,s,a,o,u,l,h=[-1]){const f=c;_(e);const p=e.$$={fragment:null,ctx:null,props:u,update:t,not_equal:o,bound:i(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(r.context||(f?f.$$.context:[])),callbacks:i(),dirty:h,skip_bound:!1,root:r.target||f.$$.root};l&&l(p.root);let y=!1;if(p.ctx=s?s(e,r.props||{},(t,r,...i)=>{const n=i.length?i[0]:r;return p.ctx&&o(p.ctx[t],p.ctx[t]=n)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](n),y&&j(e,t)),r}):[],p.update(),y=!0,n(p.before_update),p.fragment=!!a&&a(p.ctx),r.target){if(r.hydrate){const t=function(t){return Array.from(t.childNodes)}(r.target);p.fragment&&p.fragment.l(t),t.forEach(d)}else p.fragment&&p.fragment.c();r.intro&&V(e.$$.fragment),R(e,r.target,r.anchor,r.customElement),O()}_(f)}class ${$destroy(){z(this,1),this.$destroy=t}$on(t,e){const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(e),()=>{const t=r.indexOf(e);-1!==t&&r.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Y=new WeakMap,W=new WeakMap;function H(t){const e=Y.get(t);return console.assert(null!=e,"'this' is expected an Event object, but got",t),e}function K(t){null==t.passiveListener?t.event.cancelable&&(t.canceled=!0,"function"==typeof t.event.preventDefault&&t.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",t.passiveListener)}function G(t,e){Y.set(this,{eventTarget:t,event:e,eventPhase:2,currentTarget:t,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:e.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const r=Object.keys(e);for(let t=0;t<r.length;++t){const e=r[t];e in this||Object.defineProperty(this,e,q(e))}}function q(t){return{get(){return H(this).event[t]},set(e){H(this).event[t]=e},configurable:!0,enumerable:!0}}function J(t){return{value(){const e=H(this).event;return e[t].apply(e,arguments)},configurable:!0,enumerable:!0}}function Z(t){if(null==t||t===Object.prototype)return G;let e=W.get(t);return null==e&&(e=function(t,e){const r=Object.keys(e);if(0===r.length)return t;function i(e,r){t.call(this,e,r)}i.prototype=Object.create(t.prototype,{constructor:{value:i,configurable:!0,writable:!0}});for(let n=0;n<r.length;++n){const s=r[n];if(!(s in t.prototype)){const t="function"==typeof Object.getOwnPropertyDescriptor(e,s).value;Object.defineProperty(i.prototype,s,t?J(s):q(s))}}return i}(Z(Object.getPrototypeOf(t)),t),W.set(t,e)),e}function Q(t){return H(t).immediateStopped}function X(t,e){H(t).passiveListener=e}G.prototype={get type(){return H(this).event.type},get target(){return H(this).eventTarget},get currentTarget(){return H(this).currentTarget},composedPath(){const t=H(this).currentTarget;return null==t?[]:[t]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return H(this).eventPhase},stopPropagation(){const t=H(this);t.stopped=!0,"function"==typeof t.event.stopPropagation&&t.event.stopPropagation()},stopImmediatePropagation(){const t=H(this);t.stopped=!0,t.immediateStopped=!0,"function"==typeof t.event.stopImmediatePropagation&&t.event.stopImmediatePropagation()},get bubbles(){return Boolean(H(this).event.bubbles)},get cancelable(){return Boolean(H(this).event.cancelable)},preventDefault(){K(H(this))},get defaultPrevented(){return H(this).canceled},get composed(){return Boolean(H(this).event.composed)},get timeStamp(){return H(this).timeStamp},get srcElement(){return H(this).eventTarget},get cancelBubble(){return H(this).stopped},set cancelBubble(t){if(!t)return;const e=H(this);e.stopped=!0,"boolean"==typeof e.event.cancelBubble&&(e.event.cancelBubble=!0)},get returnValue(){return!H(this).canceled},set returnValue(t){t||K(H(this))},initEvent(){}},Object.defineProperty(G.prototype,"constructor",{value:G,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(G.prototype,window.Event.prototype),W.set(window.Event.prototype,G));const tt=new WeakMap;function et(t){return null!==t&&"object"==typeof t}function rt(t){const e=tt.get(t);if(null==e)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return e}function it(t,e){Object.defineProperty(t,"on"+e,function(t){return{get(){let e=rt(this).get(t);for(;null!=e;){if(3===e.listenerType)return e.listener;e=e.next}return null},set(e){"function"==typeof e||et(e)||(e=null);const r=rt(this);let i=null,n=r.get(t);for(;null!=n;)3===n.listenerType?null!==i?i.next=n.next:null!==n.next?r.set(t,n.next):r.delete(t):i=n,n=n.next;if(null!==e){const n={listener:e,listenerType:3,passive:!1,once:!1,next:null};null===i?r.set(t,n):i.next=n}},configurable:!0,enumerable:!0}}(e))}function nt(t){function e(){st.call(this)}e.prototype=Object.create(st.prototype,{constructor:{value:e,configurable:!0,writable:!0}});for(let r=0;r<t.length;++r)it(e.prototype,t[r]);return e}function st(){if(!(this instanceof st)){if(1===arguments.length&&Array.isArray(arguments[0]))return nt(arguments[0]);if(arguments.length>0){const t=new Array(arguments.length);for(let e=0;e<arguments.length;++e)t[e]=arguments[e];return nt(t)}throw new TypeError("Cannot call a class as a function")}tt.set(this,new Map)}st.prototype={addEventListener(t,e,r){if(null==e)return;if("function"!=typeof e&&!et(e))throw new TypeError("'listener' should be a function or an object.");const i=rt(this),n=et(r),s=(n?Boolean(r.capture):Boolean(r))?1:2,a={listener:e,listenerType:s,passive:n&&Boolean(r.passive),once:n&&Boolean(r.once),next:null};let o=i.get(t);if(void 0===o)return void i.set(t,a);let c=null;for(;null!=o;){if(o.listener===e&&o.listenerType===s)return;c=o,o=o.next}c.next=a},removeEventListener(t,e,r){if(null==e)return;const i=rt(this),n=(et(r)?Boolean(r.capture):Boolean(r))?1:2;let s=null,a=i.get(t);for(;null!=a;){if(a.listener===e&&a.listenerType===n)return void(null!==s?s.next=a.next:null!==a.next?i.set(t,a.next):i.delete(t));s=a,a=a.next}},dispatchEvent(t){if(null==t||"string"!=typeof t.type)throw new TypeError('"event.type" should be a string.');const e=rt(this),r=t.type;let i=e.get(r);if(null==i)return!0;const n=function(t,e){return new(Z(Object.getPrototypeOf(e)))(t,e)}(this,t);let s=null;for(;null!=i;){if(i.once?null!==s?s.next=i.next:null!==i.next?e.set(r,i.next):e.delete(r):s=i,X(n,i.passive?i.listener:null),"function"==typeof i.listener)try{i.listener.call(this,n)}catch(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t)}else 3!==i.listenerType&&"function"==typeof i.listener.handleEvent&&i.listener.handleEvent(n);if(Q(n))break;i=i.next}return X(n,null),function(t,e){H(t).eventPhase=e}(n,0),function(t,e){H(t).currentTarget=e}(n,null),!n.defaultPrevented}},Object.defineProperty(st.prototype,"constructor",{value:st,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(st.prototype,window.EventTarget.prototype);var at={};function ot(t,e,r){return e<=t&&t<=r}function ct(t){if(void 0===t)return{};if(t===Object(t))return t;throw TypeError("Could not convert argument to dictionary")}at.SIZEOF_SHORT=2,at.SIZEOF_INT=4,at.FILE_IDENTIFIER_LENGTH=4,at.Encoding={UTF8_BYTES:1,UTF16_STRING:2},at.int32=new Int32Array(2),at.float32=new Float32Array(at.int32.buffer),at.float64=new Float64Array(at.int32.buffer),at.isLittleEndian=1===new Uint16Array(new Uint8Array([1,0]).buffer)[0],at.Long=function(t,e){this.low=0|t,this.high=0|e},at.Long.create=function(t,e){return 0==t&&0==e?at.Long.ZERO:new at.Long(t,e)},at.Long.prototype.toFloat64=function(){return(this.low>>>0)+4294967296*this.high},at.Long.prototype.equals=function(t){return this.low==t.low&&this.high==t.high},at.Long.ZERO=new at.Long(0,0),at.Builder=function(t){if(t)e=t;else var e=1024;this.bb=at.ByteBuffer.allocate(e),this.space=e,this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},at.Builder.prototype.clear=function(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1},at.Builder.prototype.forceDefaults=function(t){this.force_defaults=t},at.Builder.prototype.dataBuffer=function(){return this.bb},at.Builder.prototype.asUint8Array=function(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())},at.Builder.prototype.prep=function(t,e){t>this.minalign&&(this.minalign=t);for(var r=1+~(this.bb.capacity()-this.space+e)&t-1;this.space<r+t+e;){var i=this.bb.capacity();this.bb=at.Builder.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)},at.Builder.prototype.pad=function(t){for(var e=0;e<t;e++)this.bb.writeInt8(--this.space,0)},at.Builder.prototype.writeInt8=function(t){this.bb.writeInt8(this.space-=1,t)},at.Builder.prototype.writeInt16=function(t){this.bb.writeInt16(this.space-=2,t)},at.Builder.prototype.writeInt32=function(t){this.bb.writeInt32(this.space-=4,t)},at.Builder.prototype.writeInt64=function(t){this.bb.writeInt64(this.space-=8,t)},at.Builder.prototype.writeFloat32=function(t){this.bb.writeFloat32(this.space-=4,t)},at.Builder.prototype.writeFloat64=function(t){this.bb.writeFloat64(this.space-=8,t)},at.Builder.prototype.addInt8=function(t){this.prep(1,0),this.writeInt8(t)},at.Builder.prototype.addInt16=function(t){this.prep(2,0),this.writeInt16(t)},at.Builder.prototype.addInt32=function(t){this.prep(4,0),this.writeInt32(t)},at.Builder.prototype.addInt64=function(t){this.prep(8,0),this.writeInt64(t)},at.Builder.prototype.addFloat32=function(t){this.prep(4,0),this.writeFloat32(t)},at.Builder.prototype.addFloat64=function(t){this.prep(8,0),this.writeFloat64(t)},at.Builder.prototype.addFieldInt8=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt8(e),this.slot(t))},at.Builder.prototype.addFieldInt16=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt16(e),this.slot(t))},at.Builder.prototype.addFieldInt32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt32(e),this.slot(t))},at.Builder.prototype.addFieldInt64=function(t,e,r){!this.force_defaults&&e.equals(r)||(this.addInt64(e),this.slot(t))},at.Builder.prototype.addFieldFloat32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat32(e),this.slot(t))},at.Builder.prototype.addFieldFloat64=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat64(e),this.slot(t))},at.Builder.prototype.addFieldOffset=function(t,e,r){(this.force_defaults||e!=r)&&(this.addOffset(e),this.slot(t))},at.Builder.prototype.addFieldStruct=function(t,e,r){e!=r&&(this.nested(e),this.slot(t))},at.Builder.prototype.nested=function(t){if(t!=this.offset())throw new Error("FlatBuffers: struct must be serialized inline.")},at.Builder.prototype.notNested=function(){if(this.isNested)throw new Error("FlatBuffers: object serialization must not be nested.")},at.Builder.prototype.slot=function(t){this.vtable[t]=this.offset()},at.Builder.prototype.offset=function(){return this.bb.capacity()-this.space},at.Builder.growByteBuffer=function(t){var e=t.capacity();if(3221225472&e)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");var r=e<<1,i=at.ByteBuffer.allocate(r);return i.setPosition(r-e),i.bytes().set(t.bytes(),r-e),i},at.Builder.prototype.addOffset=function(t){this.prep(at.SIZEOF_INT,0),this.writeInt32(this.offset()-t+at.SIZEOF_INT)},at.Builder.prototype.startObject=function(t){this.notNested(),null==this.vtable&&(this.vtable=[]),this.vtable_in_use=t;for(var e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()},at.Builder.prototype.endObject=function(){if(null==this.vtable||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);for(var t=this.offset(),e=this.vtable_in_use-1;e>=0&&0==this.vtable[e];e--);for(var r=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var i=(r+2)*at.SIZEOF_SHORT;this.addInt16(i);var n=0,s=this.space;t:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(a)){for(var o=at.SIZEOF_SHORT;o<i;o+=at.SIZEOF_SHORT)if(this.bb.readInt16(s+o)!=this.bb.readInt16(a+o))continue t;n=this.vtables[e];break}}return n?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,n-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t},at.Builder.prototype.finish=function(t,e){if(e){var r=e;if(this.prep(this.minalign,at.SIZEOF_INT+at.FILE_IDENTIFIER_LENGTH),r.length!=at.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+at.FILE_IDENTIFIER_LENGTH);for(var i=at.FILE_IDENTIFIER_LENGTH-1;i>=0;i--)this.writeInt8(r.charCodeAt(i))}this.prep(this.minalign,at.SIZEOF_INT),this.addOffset(t),this.bb.setPosition(this.space)},at.Builder.prototype.requiredField=function(t,e){var r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(0!=this.bb.readInt16(i+e)))throw new Error("FlatBuffers: field "+e+" must be set")},at.Builder.prototype.startVector=function(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(at.SIZEOF_INT,t*e),this.prep(r,t*e)},at.Builder.prototype.endVector=function(){return this.writeInt32(this.vector_num_elems),this.offset()},at.Builder.prototype.createString=function(t){if(t instanceof Uint8Array)var e=t;else{e=[];for(var r=0;r<t.length;){var i,n=t.charCodeAt(r++);if(n<55296||n>=56320)i=n;else i=(n<<10)+t.charCodeAt(r++)+-56613888;i<128?e.push(i):(i<2048?e.push(i>>6&31|192):(i<65536?e.push(i>>12&15|224):e.push(i>>18&7|240,i>>12&63|128),e.push(i>>6&63|128)),e.push(63&i|128))}}this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);r=0;for(var s=this.space,a=this.bb.bytes();r<e.length;r++)a[s++]=e[r];return this.endVector()},at.Builder.prototype.createLong=function(t,e){return at.Long.create(t,e)},at.ByteBuffer=function(t){this.bytes_=t,this.position_=0},at.ByteBuffer.allocate=function(t){return new at.ByteBuffer(new Uint8Array(t))},at.ByteBuffer.prototype.clear=function(){this.position_=0},at.ByteBuffer.prototype.bytes=function(){return this.bytes_},at.ByteBuffer.prototype.position=function(){return this.position_},at.ByteBuffer.prototype.setPosition=function(t){this.position_=t},at.ByteBuffer.prototype.capacity=function(){return this.bytes_.length},at.ByteBuffer.prototype.readInt8=function(t){return this.readUint8(t)<<24>>24},at.ByteBuffer.prototype.readUint8=function(t){return this.bytes_[t]},at.ByteBuffer.prototype.readInt16=function(t){return this.readUint16(t)<<16>>16},at.ByteBuffer.prototype.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},at.ByteBuffer.prototype.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},at.ByteBuffer.prototype.readUint32=function(t){return this.readInt32(t)>>>0},at.ByteBuffer.prototype.readInt64=function(t){return new at.Long(this.readInt32(t),this.readInt32(t+4))},at.ByteBuffer.prototype.readUint64=function(t){return new at.Long(this.readUint32(t),this.readUint32(t+4))},at.ByteBuffer.prototype.readFloat32=function(t){return at.int32[0]=this.readInt32(t),at.float32[0]},at.ByteBuffer.prototype.readFloat64=function(t){return at.int32[at.isLittleEndian?0:1]=this.readInt32(t),at.int32[at.isLittleEndian?1:0]=this.readInt32(t+4),at.float64[0]},at.ByteBuffer.prototype.writeInt8=function(t,e){this.bytes_[t]=e},at.ByteBuffer.prototype.writeUint8=function(t,e){this.bytes_[t]=e},at.ByteBuffer.prototype.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},at.ByteBuffer.prototype.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},at.ByteBuffer.prototype.writeInt32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},at.ByteBuffer.prototype.writeUint32=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24},at.ByteBuffer.prototype.writeInt64=function(t,e){this.writeInt32(t,e.low),this.writeInt32(t+4,e.high)},at.ByteBuffer.prototype.writeUint64=function(t,e){this.writeUint32(t,e.low),this.writeUint32(t+4,e.high)},at.ByteBuffer.prototype.writeFloat32=function(t,e){at.float32[0]=e,this.writeInt32(t,at.int32[0])},at.ByteBuffer.prototype.writeFloat64=function(t,e){at.float64[0]=e,this.writeInt32(t,at.int32[at.isLittleEndian?0:1]),this.writeInt32(t+4,at.int32[at.isLittleEndian?1:0])},at.ByteBuffer.prototype.getBufferIdentifier=function(){if(this.bytes_.length<this.position_+at.SIZEOF_INT+at.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");for(var t="",e=0;e<at.FILE_IDENTIFIER_LENGTH;e++)t+=String.fromCharCode(this.readInt8(this.position_+at.SIZEOF_INT+e));return t},at.ByteBuffer.prototype.__offset=function(t,e){var r=t-this.readInt32(t);return e<this.readInt16(r)?this.readInt16(r+e):0},at.ByteBuffer.prototype.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},at.ByteBuffer.prototype.__string=function(t,e){t+=this.readInt32(t);var r=this.readInt32(t),i="",n=0;if(t+=at.SIZEOF_INT,e===at.Encoding.UTF8_BYTES)return this.bytes_.subarray(t,t+r);for(;n<r;){var s,a=this.readUint8(t+n++);if(a<192)s=a;else{var o=this.readUint8(t+n++);if(a<224)s=(31&a)<<6|63&o;else{var c=this.readUint8(t+n++);if(a<240)s=(15&a)<<12|(63&o)<<6|63&c;else s=(7&a)<<18|(63&o)<<12|(63&c)<<6|63&this.readUint8(t+n++)}}s<65536?i+=String.fromCharCode(s):(s-=65536,i+=String.fromCharCode(55296+(s>>10),56320+(1023&s)))}return i},at.ByteBuffer.prototype.__indirect=function(t){return t+this.readInt32(t)},at.ByteBuffer.prototype.__vector=function(t){return t+this.readInt32(t)+at.SIZEOF_INT},at.ByteBuffer.prototype.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},at.ByteBuffer.prototype.__has_identifier=function(t){if(t.length!=at.FILE_IDENTIFIER_LENGTH)throw new Error("FlatBuffers: file identifier must be length "+at.FILE_IDENTIFIER_LENGTH);for(var e=0;e<at.FILE_IDENTIFIER_LENGTH;e++)if(t.charCodeAt(e)!=this.readInt8(this.position_+at.SIZEOF_INT+e))return!1;return!0},at.ByteBuffer.prototype.createLong=function(t,e){return at.Long.create(t,e)};function ut(t){this.tokens=[].slice.call(t)}ut.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(t)},push:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.push(e.shift());else this.tokens.push(t)}};function lt(t,e){if(t)throw TypeError("Decoder error");return e||65533}function ht(t,e){if(!(this instanceof ht))return new ht(t,e);if("utf-8"!==(t=void 0!==t?String(t).toLowerCase():"utf-8"))throw new Error("Encoding not supported. Only utf-8 is supported");e=ct(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(e.fatal),this._ignoreBOM=Boolean(e.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function dt(t,e){if(!(this instanceof dt))return new dt(t,e);if("utf-8"!==(t=void 0!==t?String(t).toLowerCase():"utf-8"))throw new Error("Encoding not supported. Only utf-8 is supported");e=ct(e),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(e.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function ft(t){var e=t.fatal,r=0,i=0,n=0,s=128,a=191;this.handler=function(t,o){if(-1===o&&0!==n)return n=0,lt(e);if(-1===o)return-1;if(0===n){if(ot(o,0,127))return o;if(ot(o,194,223))n=1,r=o-192;else if(ot(o,224,239))224===o&&(s=160),237===o&&(a=159),n=2,r=o-224;else{if(!ot(o,240,244))return lt(e);240===o&&(s=144),244===o&&(a=143),n=3,r=o-240}return r<<=6*n,null}if(!ot(o,s,a))return r=n=i=0,s=128,a=191,t.prepend(o),lt(e);if(s=128,a=191,r+=o-128<<6*(n-(i+=1)),i!==n)return null;var c=r;return r=n=i=0,c}}function pt(t){t.fatal,this.handler=function(t,e){if(-1===e)return-1;if(ot(e,0,127))return e;var r,i;ot(e,128,2047)?(r=1,i=192):ot(e,2048,65535)?(r=2,i=224):ot(e,65536,1114111)&&(r=3,i=240);for(var n=[(e>>6*r)+i];r>0;){var s=e>>6*(r-1);n.push(128|63&s),r-=1}return n}}ht.prototype={decode:function(t,e){var r;r="object"==typeof t&&t instanceof ArrayBuffer?new Uint8Array(t):"object"==typeof t&&"buffer"in t&&t.buffer instanceof ArrayBuffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(0),e=ct(e),this._streaming||(this._decoder=new ft({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(e.stream);for(var i,n=new ut(r),s=[];!n.endOfStream()&&-1!==(i=this._decoder.handler(n,n.read()));)null!==i&&(Array.isArray(i)?s.push.apply(s,i):s.push(i));if(!this._streaming){do{if(-1===(i=this._decoder.handler(n,n.read())))break;null!==i&&(Array.isArray(i)?s.push.apply(s,i):s.push(i))}while(!n.endOfStream());this._decoder=null}return s.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===s[0]?(this._BOMseen=!0,s.shift()):this._BOMseen=!0)),function(t){for(var e="",r=0;r<t.length;++r){var i=t[r];i<=65535?e+=String.fromCharCode(i):(i-=65536,e+=String.fromCharCode(55296+(i>>10),56320+(1023&i)))}return e}(s)}},dt.prototype={encode:function(t,e){t=t?String(t):"",e=ct(e),this._streaming||(this._encoder=new pt(this._options)),this._streaming=Boolean(e.stream);for(var r,i=[],n=new ut(function(t){for(var e=String(t),r=e.length,i=0,n=[];i<r;){var s=e.charCodeAt(i);if(s<55296||s>57343)n.push(s);else if(56320<=s&&s<=57343)n.push(65533);else if(55296<=s&&s<=56319)if(i===r-1)n.push(65533);else{var a=t.charCodeAt(i+1);if(56320<=a&&a<=57343){var o=1023&s,c=1023&a;n.push(65536+(o<<10)+c),i+=1}else n.push(65533)}i+=1}return n}(t));!n.endOfStream()&&-1!==(r=this._encoder.handler(n,n.read()));)Array.isArray(r)?i.push.apply(i,r):i.push(r);if(!this._streaming){for(;-1!==(r=this._encoder.handler(n,n.read()));)Array.isArray(r)?i.push.apply(i,r):i.push(r);this._encoder=null}return new Uint8Array(i)}};const yt="function"==typeof Buffer?Buffer:null,bt="function"==typeof TextDecoder&&"function"==typeof TextEncoder,gt=(t=>{if(bt||!yt){const e=new t("utf-8");return t=>e.decode(t)}return t=>{const{buffer:e,byteOffset:r,length:i}=Gt(t);return yt.from(e,r,i).toString()}})("undefined"!=typeof TextDecoder?TextDecoder:ht),_t=(t=>{if(bt||!yt){const e=new t;return t=>e.encode(t)}return(t="")=>Gt(yt.from(t,"utf8"))})("undefined"!=typeof TextEncoder?TextEncoder:dt),mt=Object.freeze({done:!0,value:void 0});class vt{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class wt{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class It extends wt{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}async cancel(t){await this.return(t)}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(mt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return ie.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return ie.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}async throw(t){return await this.abort(t),mt}async return(t){return await this.close(),mt}async read(t){return(await this.next(t,"read")).value}async peek(t){return(await this.next(t,"peek")).value}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((t,e)=>{this.resolvers.push({resolve:t,reject:e})}):Promise.resolve(mt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error(this+" is closed")}}const[St,Tt]=(()=>{const t=()=>{throw new Error("BigInt is not available in this environment")};function e(){throw t()}return e.asIntN=()=>{throw t()},e.asUintN=()=>{throw t()},"undefined"!=typeof BigInt?[BigInt,!0]:[e,!1]})(),[Bt,At]=(()=>{const t=()=>{throw new Error("BigInt64Array is not available in this environment")};return"undefined"!=typeof BigInt64Array?[BigInt64Array,!0]:[class{static get BYTES_PER_ELEMENT(){return 8}static of(){throw t()}static from(){throw t()}constructor(){throw t()}},!1]})(),[Dt,xt]=(()=>{const t=()=>{throw new Error("BigUint64Array is not available in this environment")};return"undefined"!=typeof BigUint64Array?[BigUint64Array,!0]:[class{static get BYTES_PER_ELEMENT(){return 8}static of(){throw t()}static from(){throw t()}constructor(){throw t()}},!1]})(),Lt=t=>"boolean"==typeof t,Ot=t=>"function"==typeof t,Ft=t=>null!=t&&Object(t)===t,Mt=t=>Ft(t)&&Ot(t.then),Et=t=>Ft(t)&&Ot(t[Symbol.iterator]),Ut=t=>Ft(t)&&Ot(t[Symbol.asyncIterator]),Nt=t=>Ft(t)&&Ft(t.schema),Vt=t=>Ft(t)&&"done"in t&&"value"in t,Ct=t=>Ft(t)&&Ot(t.stat)&&(t=>"number"==typeof t)(t.fd),kt=t=>Ft(t)&&Rt(t.body),Rt=t=>Ft(t)&&Ot(t.cancel)&&Ot(t.getReader)&&!(t instanceof wt),zt=t=>Ft(t)&&Ot(t.read)&&Ot(t.pipe)&&Lt(t.readable)&&!(t instanceof wt);var jt=at.ByteBuffer;const Pt="undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;function $t(t,e,r=0,i=e.byteLength){const n=t.byteLength,s=new Uint8Array(t.buffer,t.byteOffset,n),a=new Uint8Array(e.buffer,e.byteOffset,Math.min(i,n));return s.set(a,r),t}function Yt(t,e){let r,i,n,s=function(t){let e,r,i,n,s=t[0]?[t[0]]:[];for(let a,o,c=0,u=0,l=t.length;++c<l;)a=s[u],o=t[c],!a||!o||a.buffer!==o.buffer||o.byteOffset<a.byteOffset?o&&(s[++u]=o):(({byteOffset:e,byteLength:i}=a),({byteOffset:r,byteLength:n}=o),e+i<r||r+n<e?o&&(s[++u]=o):s[u]=new Uint8Array(a.buffer,e,r-e+n));return s}(t),a=s.reduce((t,e)=>t+e.byteLength,0),o=0,c=-1,u=Math.min(e||1/0,a);for(let t=s.length;++c<t;){if(r=s[c],i=r.subarray(0,Math.min(r.length,u-o)),u<=o+i.length){i.length<r.length?s[c]=r.subarray(i.length):i.length===r.length&&c++,n?$t(n,i,o):n=i;break}$t(n||(n=new Uint8Array(u)),i,o),o+=i.length}return[n||new Uint8Array(0),s.slice(c),a-(n?n.byteLength:0)]}function Wt(t,e){let r=Vt(e)?e.value:e;return r instanceof t?t===Uint8Array?new t(r.buffer,r.byteOffset,r.byteLength):r:r?("string"==typeof r&&(r=_t(r)),r instanceof ArrayBuffer||r instanceof Pt?new t(r):r instanceof jt?Wt(t,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new t(0):new t(r.buffer,r.byteOffset,r.byteLength/t.BYTES_PER_ELEMENT):t.from(r)):new t(0)}const Ht=t=>Wt(Int32Array,t),Kt=t=>Wt(Bt,t),Gt=t=>Wt(Uint8Array,t),qt=t=>Wt(Dt,t),Jt=t=>(t.next(),t);function*Zt(t,e){const r=function*(t){yield t},i="string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Pt?r(e):Et(e)?e:r(e);yield*Jt(function*(e){let r=null;do{r=e.next(yield Wt(t,r))}while(!r.done)}(i[Symbol.iterator]()))}const Qt=t=>Zt(Uint8Array,t);async function*Xt(t,e){if(Mt(e))return yield*Xt(t,await e);const r=async function*(t){yield await t},i="string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof Pt?r(e):Et(e)?async function*(t){yield*Jt(function*(t){let e=null;do{e=t.next(yield e&&e.value)}while(!e.done)}(t[Symbol.iterator]()))}(e):Ut(e)?e:r(e);yield*Jt(async function*(e){let r=null;do{r=await e.next(yield Wt(t,r))}while(!r.done)}(i[Symbol.asyncIterator]()))}const te=t=>Xt(Uint8Array,t);function ee(t,e,r){if(0!==t){r=r.slice(0,e+1);for(let i=-1;++i<=e;)r[i]+=t}return r}function re(t,e){let r=0,i=t.length;if(i!==e.length)return!1;if(i>0)do{if(t[r]!==e[r])return!1}while(++r<i);return!0}var ie={fromIterable:t=>ne(function*(t){let e,r,i,n,s=!1,a=[],o=0;({cmd:i,size:n}=yield null);let c=Qt(t)[Symbol.iterator]();try{do{if(({done:e,value:r}=isNaN(n-o)?c.next(void 0):c.next(n-o)),!e&&r.byteLength>0&&(a.push(r),o+=r.byteLength),e||n<=o)do{({cmd:i,size:n}=yield"peek"===i?Yt(a,n)[0]:([r,a,o]=Yt(a,n),r))}while(n<o)}while(!e)}catch(t){(s=!0)&&"function"==typeof c.throw&&c.throw(t)}finally{!1===s&&"function"==typeof c.return&&c.return()}}(t)),fromAsyncIterable:t=>ne(async function*(t){let e,r,i,n,s=!1,a=[],o=0;({cmd:i,size:n}=yield null);let c=te(t)[Symbol.asyncIterator]();try{do{if(({done:e,value:r}=isNaN(n-o)?await c.next(void 0):await c.next(n-o)),!e&&r.byteLength>0&&(a.push(r),o+=r.byteLength),e||n<=o)do{({cmd:i,size:n}=yield"peek"===i?Yt(a,n)[0]:([r,a,o]=Yt(a,n),r))}while(n<o)}while(!e)}catch(t){(s=!0)&&"function"==typeof c.throw&&await c.throw(t)}finally{!1===s&&"function"==typeof c.return&&await c.return()}}(t)),fromDOMStream:t=>ne(async function*(t){let e,r,i,n=!1,s=!1,a=[],o=0;({cmd:r,size:i}=yield null);let c=new se(t);try{do{if(({done:n,value:e}=isNaN(i-o)?await c.read(void 0):await c.read(i-o)),!n&&e.byteLength>0&&(a.push(Gt(e)),o+=e.byteLength),n||i<=o)do{({cmd:r,size:i}=yield"peek"===r?Yt(a,i)[0]:([e,a,o]=Yt(a,i),e))}while(i<o)}while(!n)}catch(t){(s=!0)&&await c.cancel(t)}finally{!1===s?await c.cancel():t.locked&&c.releaseLock()}}(t)),fromNodeStream:t=>ne(async function*(t){let e,r,i,n=[],s="error",a=!1,o=null,c=0,u=[];if(({cmd:e,size:r}=yield null),t.isTTY)return yield new Uint8Array(0);try{n[0]=ae(t,"end"),n[1]=ae(t,"error");do{if(n[2]=ae(t,"readable"),[s,o]=await Promise.race(n.map(t=>t[2])),"error"===s)break;if((a="end"===s)||(isFinite(r-c)?(i=Gt(t.read(r-c)),i.byteLength<r-c&&(i=Gt(t.read(void 0)))):i=Gt(t.read(void 0)),i.byteLength>0&&(u.push(i),c+=i.byteLength)),a||r<=c)do{({cmd:e,size:r}=yield"peek"===e?Yt(u,r)[0]:([i,u,c]=Yt(u,r),i))}while(r<c)}while(!a)}finally{await function(e,r){return i=u=null,new Promise(async(i,n)=>{for(const[r,i]of e)t.off(r,i);try{const e=t.destroy;e&&e.call(t,r),r=void 0}catch(t){r=t||r}finally{null!=r?n(r):i()}})}(n,"error"===s?o:null)}}(t)),toDOMStream(t,e){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(t,e){throw new Error('"toNodeStream" not available in this environment')}};const ne=t=>(t.next(),t);class se{constructor(t){this.source=t,this.byobReader=null,this.defaultReader=null;try{this.supportsBYOB=!!(this.reader=this.getBYOBReader())}catch(t){this.supportsBYOB=!(this.reader=this.getDefaultReader())}}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=this.byobReader=this.defaultReader=null}async cancel(t){const{reader:e,source:r}=this;e&&await e.cancel(t).catch(()=>{}),r&&r.locked&&this.releaseLock()}async read(t){if(0===t)return{done:null==this.reader,value:new Uint8Array(0)};const e=this.supportsBYOB&&"number"==typeof t?await this.readFromBYOBReader(t):await this.getDefaultReader().read();return!e.done&&(e.value=Gt(e)),e}getDefaultReader(){return this.byobReader&&this.releaseLock(),this.defaultReader||(this.defaultReader=this.source.getReader(),this.defaultReader.closed.catch(()=>{})),this.reader=this.defaultReader}getBYOBReader(){return this.defaultReader&&this.releaseLock(),this.byobReader||(this.byobReader=this.source.getReader({mode:"byob"}),this.byobReader.closed.catch(()=>{})),this.reader=this.byobReader}async readFromBYOBReader(t){return await async function t(e,r,i,n){if(i>=n)return{done:!1,value:new Uint8Array(r,0,n)};const{done:s,value:a}=await e.read(new Uint8Array(r,i,n-i));if((i+=a.byteLength)<n&&!s)return await t(e,a.buffer,i,n);return{done:s,value:new Uint8Array(a.buffer,0,i)}}(this.getBYOBReader(),new ArrayBuffer(t),0,t)}}const ae=(t,e)=>{let r,i=t=>r([e,t]);return[e,i,new Promise(n=>(r=n)&&t.once(e,i))]};class oe{}var ce,ue;!function(t){var e,r,i;e=t.apache||(t.apache={}),r=e.arrow||(e.arrow={}),function(t){t[t.V1=0]="V1",t[t.V2=1]="V2",t[t.V3=2]="V3",t[t.V4=3]="V4"}((i=r.flatbuf||(r.flatbuf={})).MetadataVersion||(i.MetadataVersion={}))}(ce||(ce={})),function(t){var e,r,i;e=t.apache||(t.apache={}),r=e.arrow||(e.arrow={}),function(t){t[t.Sparse=0]="Sparse",t[t.Dense=1]="Dense"}((i=r.flatbuf||(r.flatbuf={})).UnionMode||(i.UnionMode={}))}(ce||(ce={})),function(t){var e,r,i;e=t.apache||(t.apache={}),r=e.arrow||(e.arrow={}),function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"}((i=r.flatbuf||(r.flatbuf={})).Precision||(i.Precision={}))}(ce||(ce={})),function(t){var e,r,i;e=t.apache||(t.apache={}),r=e.arrow||(e.arrow={}),function(t){t[t.DAY=0]="DAY",t[t.MILLISECOND=1]="MILLISECOND"}((i=r.flatbuf||(r.flatbuf={})).DateUnit||(i.DateUnit={}))}(ce||(ce={})),function(t){var e,r,i;e=t.apache||(t.apache={}),r=e.arrow||(e.arrow={}),function(t){t[t.SECOND=0]="SECOND",t[t.MILLISECOND=1]="MILLISECOND",t[t.MICROSECOND=2]="MICROSECOND",t[t.NANOSECOND=3]="NANOSECOND"}((i=r.flatbuf||(r.flatbuf={})).TimeUnit||(i.TimeUnit={}))}(ce||(ce={})),function(t){var e,r,i;e=t.apache||(t.apache={}),r=e.arrow||(e.arrow={}),function(t){t[t.YEAR_MONTH=0]="YEAR_MONTH",t[t.DAY_TIME=1]="DAY_TIME"}((i=r.flatbuf||(r.flatbuf={})).IntervalUnit||(i.IntervalUnit={}))}(ce||(ce={})),function(t){var e,r,i;e=t.apache||(t.apache={}),r=e.arrow||(e.arrow={}),function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.FloatingPoint=3]="FloatingPoint",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct_=13]="Struct_",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.LargeList=21]="LargeList"}((i=r.flatbuf||(r.flatbuf={})).Type||(i.Type={}))}(ce||(ce={})),function(t){var e,r,i,n;e=t.apache||(t.apache={}),r=e.arrow||(e.arrow={}),i=r.flatbuf||(r.flatbuf={}),(n=i.Endianness||(i.Endianness={}))[n.Little=0]="Little",n[n.Big=1]="Big"}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}}t.Null=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}}t.Struct_=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}}t.List=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeList(t){t.startObject(0)}static endLargeList(t){return t.endObject()}static createLargeList(t){return e.startLargeList(t),e.endLargeList(t)}}t.LargeList=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}}t.FixedSizeList=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}}t.Map=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}mode(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.UnionMode.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+4*t):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(e,r){e.addFieldInt16(0,r,t.apache.arrow.flatbuf.UnionMode.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addInt32(e[r]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,i){return r.startUnion(t),r.addMode(t,e),r.addTypeIds(t,i),r.endUnion(t)}}e.Union=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,r,i){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,i),e.endInt(t)}}t.Int=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.Precision.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(e,r){e.addFieldInt16(0,r,t.apache.arrow.flatbuf.Precision.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return r.startFloatingPoint(t),r.addPrecision(t,e),r.endFloatingPoint(t)}}e.FloatingPoint=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}}t.Utf8=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}}t.Binary=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}}t.LargeUtf8=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}}t.LargeBinary=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}}t.FixedSizeBinary=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}}t.Bool=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}static startDecimal(t){t.startObject(2)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,i),e.endDecimal(t)}}t.Decimal=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.DateUnit.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(e,r){e.addFieldInt16(0,r,t.apache.arrow.flatbuf.DateUnit.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return r.startDate(t),r.addUnit(t,e),r.endDate(t)}}e.Date=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.TimeUnit.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(e,r){e.addFieldInt16(0,r,t.apache.arrow.flatbuf.TimeUnit.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,i){return r.startTime(t),r.addUnit(t,e),r.addBitWidth(t,i),r.endTime(t)}}e.Time=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.TimeUnit.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(e,r){e.addFieldInt16(0,r,t.apache.arrow.flatbuf.TimeUnit.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,i){return r.startTimestamp(t),r.addUnit(t,e),r.addTimezone(t,i),r.endTimestamp(t)}}e.Timestamp=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(e,r){e.addFieldInt16(0,r,t.apache.arrow.flatbuf.IntervalUnit.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return r.startInterval(t),r.addUnit(t,e),r.endInterval(t)}}e.Interval=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.TimeUnit.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(e,r){e.addFieldInt16(0,r,t.apache.arrow.flatbuf.TimeUnit.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return r.startDuration(t),r.addUnit(t,e),r.endDuration(t)}}e.Duration=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(t){class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,i){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,i),e.endKeyValue(t)}}t.KeyValue=e}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}indexType(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new t.apache.arrow.flatbuf.Int).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startDictionaryEncoding(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryEncoding(t){return t.endObject()}static createDictionaryEncoding(t,e,i,n){return r.startDictionaryEncoding(t),r.addId(t,e),r.addIndexType(t,i),r.addIsOrdered(t,n),r.endDictionaryEncoding(t)}}e.DictionaryEncoding=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}typeType(){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):t.apache.arrow.flatbuf.Type.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(e){let r=this.bb.__offset(this.bb_pos,12);return r?(e||new t.apache.arrow.flatbuf.DictionaryEncoding).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(e,r){let i=this.bb.__offset(this.bb_pos,14);return i?(r||new t.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*e),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(e,r){let i=this.bb.__offset(this.bb_pos,16);return i?(r||new t.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*e),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(e,r){e.addFieldInt8(2,r,t.apache.arrow.flatbuf.Type.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}static createField(t,e,i,n,s,a,o,c){return r.startField(t),r.addName(t,e),r.addNullable(t,i),r.addTypeType(t,n),r.addType(t,s),r.addDictionary(t,a),r.addChildren(t,o),r.addCustomMetadata(t,c),r.endField(t)}}e.Field=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={})).Buffer=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static createBuffer(t,e,r){return t.prep(8,16),t.writeInt64(r),t.writeInt64(e),t.offset()}}}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):t.apache.arrow.flatbuf.Endianness.Little}fields(e,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new t.apache.arrow.flatbuf.Field).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*e),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(e,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new t.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+i)+4*e),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(3)}static addEndianness(e,r){e.addFieldInt16(0,r,t.apache.arrow.flatbuf.Endianness.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static createSchema(t,e,i,n){return r.startSchema(t),r.addEndianness(t,e),r.addFields(t,i),r.addCustomMetadata(t,n),r.endSchema(t)}}e.Schema=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ce||(ce={})),function(t){var e,r;e=t.apache||(t.apache={}),((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={})).Schema=ce.apache.arrow.flatbuf.Schema}(ue||(ue={})),function(t){var e,r,i;e=t.apache||(t.apache={}),r=e.arrow||(e.arrow={}),function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"}((i=r.flatbuf||(r.flatbuf={})).MessageHeader||(i.MessageHeader={}))}(ue||(ue={})),function(t){var e,r;e=t.apache||(t.apache={}),((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={})).FieldNode=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static createFieldNode(t,e,r){return t.prep(8,16),t.writeInt64(r),t.writeInt64(e),t.offset()}}}(ue||(ue={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}nodes(e,r){let i=this.bb.__offset(this.bb_pos,6);return i?(r||new t.apache.arrow.flatbuf.FieldNode).__init(this.bb.__vector(this.bb_pos+i)+16*e,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let r=this.bb.__offset(this.bb_pos,8);return r?(e||new ce.apache.arrow.flatbuf.Buffer).__init(this.bb.__vector(this.bb_pos+r)+16*t,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}static startRecordBatch(t){t.startObject(3)}static addLength(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static endRecordBatch(t){return t.endObject()}static createRecordBatch(t,e,i,n){return r.startRecordBatch(t),r.addLength(t,e),r.addNodes(t,i),r.addBuffers(t,n),r.endRecordBatch(t)}}e.RecordBatch=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ue||(ue={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}data(e){let r=this.bb.__offset(this.bb_pos,6);return r?(e||new t.apache.arrow.flatbuf.RecordBatch).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return!!t&&!!this.bb.readInt8(this.bb_pos+t)}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,t.createLong(0,0))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}static createDictionaryBatch(t,e,i,n){return r.startDictionaryBatch(t),r.addId(t,e),r.addData(t,i),r.addIsDelta(t,n),r.endDictionaryBatch(t)}}e.DictionaryBatch=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ue||(ue={})),function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ce.apache.arrow.flatbuf.MetadataVersion.V1}headerType(){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):t.apache.arrow.flatbuf.MessageHeader.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):this.bb.createLong(0,0)}customMetadata(t,e){let r=this.bb.__offset(this.bb_pos,12);return r?(e||new ce.apache.arrow.flatbuf.KeyValue).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+4*t),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,ce.apache.arrow.flatbuf.MetadataVersion.V1)}static addHeaderType(e,r){e.addFieldInt8(1,r,t.apache.arrow.flatbuf.MessageHeader.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,t.createLong(0,0))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static createMessage(t,e,i,n,s,a){return r.startMessage(t),r.addVersion(t,e),r.addHeaderType(t,i),r.addHeader(t,n),r.addBodyLength(t,s),r.addCustomMetadata(t,a),r.endMessage(t)}}e.Message=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(ue||(ue={})),ce.apache.arrow.flatbuf.Type;var le,he,de=ce.apache.arrow.flatbuf.DateUnit,fe=ce.apache.arrow.flatbuf.TimeUnit,pe=ce.apache.arrow.flatbuf.Precision,ye=ce.apache.arrow.flatbuf.UnionMode,be=ce.apache.arrow.flatbuf.IntervalUnit,ge=ue.apache.arrow.flatbuf.MessageHeader,_e=ce.apache.arrow.flatbuf.MetadataVersion;function me(t,e,r,i){return 0!=(r&1<<i)}function ve(t,e,r,i){return(r&1<<i)>>i}function we(t,e,r){return r?!!(t[e>>3]|=1<<e%8)||!0:!(t[e>>3]&=~(1<<e%8))&&!1}function Ie(t,e,r){const i=r.byteLength+7&-8;if(t>0||r.byteLength<i){const n=new Uint8Array(i);return n.set(t%8==0?r.subarray(t>>3):Se(Te(r,t,e,null,me)).subarray(0,i)),n}return r}function Se(t){let e=[],r=0,i=0,n=0;for(const s of t)s&&(n|=1<<i),8==++i&&(e[r++]=n,n=i=0);(0===r||i>0)&&(e[r++]=n);let s=new Uint8Array(e.length+7&-8);return s.set(e),s}function*Te(t,e,r,i,n){let s=e%8,a=e>>3,o=0,c=r;for(;c>0;s=0){let e=t[a++];do{yield n(i,o++,e,s)}while(--c>0&&++s<8)}}function Be(t,e,r){if(r-e<=0)return 0;if(r-e<8){let i=0;for(const n of Te(t,e,r-e,t,ve))i+=n;return i}const i=r>>3<<3,n=e+(e%8==0?0:8-e%8);return Be(t,e,n)+Be(t,i,r)+Ae(t,n>>3,i-n>>3)}function Ae(t,e,r){let i=0,n=0|e;const s=new DataView(t.buffer,t.byteOffset,t.byteLength),a=void 0===r?t.byteLength:n+r;for(;a-n>=4;)i+=De(s.getUint32(n)),n+=4;for(;a-n>=2;)i+=De(s.getUint16(n)),n+=2;for(;a-n>=1;)i+=De(s.getUint8(n)),n+=1;return i}function De(t){let e=0|t;return e-=e>>>1&1431655765,e=(858993459&e)+(e>>>2&858993459),16843009*(e+(e>>>4)&252645135)>>>24}!function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth"}(le||(le={})),function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"}(he||(he={}));class xe{visitMany(t,...e){return t.map((t,r)=>this.visit(t,...e.map(t=>t[r])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return function(t,e,r=!0){let i=null,n=le.NONE;e instanceof Sr||e instanceof oe?n=Le(e.type):e instanceof je?n=Le(e):"number"!=typeof(n=e)&&(n=le[e]);switch(n){case le.Null:i=t.visitNull;break;case le.Bool:i=t.visitBool;break;case le.Int:i=t.visitInt;break;case le.Int8:i=t.visitInt8||t.visitInt;break;case le.Int16:i=t.visitInt16||t.visitInt;break;case le.Int32:i=t.visitInt32||t.visitInt;break;case le.Int64:i=t.visitInt64||t.visitInt;break;case le.Uint8:i=t.visitUint8||t.visitInt;break;case le.Uint16:i=t.visitUint16||t.visitInt;break;case le.Uint32:i=t.visitUint32||t.visitInt;break;case le.Uint64:i=t.visitUint64||t.visitInt;break;case le.Float:i=t.visitFloat;break;case le.Float16:i=t.visitFloat16||t.visitFloat;break;case le.Float32:i=t.visitFloat32||t.visitFloat;break;case le.Float64:i=t.visitFloat64||t.visitFloat;break;case le.Utf8:i=t.visitUtf8;break;case le.Binary:i=t.visitBinary;break;case le.FixedSizeBinary:i=t.visitFixedSizeBinary;break;case le.Date:i=t.visitDate;break;case le.DateDay:i=t.visitDateDay||t.visitDate;break;case le.DateMillisecond:i=t.visitDateMillisecond||t.visitDate;break;case le.Timestamp:i=t.visitTimestamp;break;case le.TimestampSecond:i=t.visitTimestampSecond||t.visitTimestamp;break;case le.TimestampMillisecond:i=t.visitTimestampMillisecond||t.visitTimestamp;break;case le.TimestampMicrosecond:i=t.visitTimestampMicrosecond||t.visitTimestamp;break;case le.TimestampNanosecond:i=t.visitTimestampNanosecond||t.visitTimestamp;break;case le.Time:i=t.visitTime;break;case le.TimeSecond:i=t.visitTimeSecond||t.visitTime;break;case le.TimeMillisecond:i=t.visitTimeMillisecond||t.visitTime;break;case le.TimeMicrosecond:i=t.visitTimeMicrosecond||t.visitTime;break;case le.TimeNanosecond:i=t.visitTimeNanosecond||t.visitTime;break;case le.Decimal:i=t.visitDecimal;break;case le.List:i=t.visitList;break;case le.Struct:i=t.visitStruct;break;case le.Union:i=t.visitUnion;break;case le.DenseUnion:i=t.visitDenseUnion||t.visitUnion;break;case le.SparseUnion:i=t.visitSparseUnion||t.visitUnion;break;case le.Dictionary:i=t.visitDictionary;break;case le.Interval:i=t.visitInterval;break;case le.IntervalDayTime:i=t.visitIntervalDayTime||t.visitInterval;break;case le.IntervalYearMonth:i=t.visitIntervalYearMonth||t.visitInterval;break;case le.FixedSizeList:i=t.visitFixedSizeList;break;case le.Map:i=t.visitMap}if("function"==typeof i)return i;if(!r)return()=>null;throw new Error(`Unrecognized type '${le[n]}'`)}(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}}function Le(t){switch(t.typeId){case le.Null:return le.Null;case le.Int:const{bitWidth:e,isSigned:r}=t;switch(e){case 8:return r?le.Int8:le.Uint8;case 16:return r?le.Int16:le.Uint16;case 32:return r?le.Int32:le.Uint32;case 64:return r?le.Int64:le.Uint64}return le.Int;case le.Float:switch(t.precision){case pe.HALF:return le.Float16;case pe.SINGLE:return le.Float32;case pe.DOUBLE:return le.Float64}return le.Float;case le.Binary:return le.Binary;case le.Utf8:return le.Utf8;case le.Bool:return le.Bool;case le.Decimal:return le.Decimal;case le.Time:switch(t.unit){case fe.SECOND:return le.TimeSecond;case fe.MILLISECOND:return le.TimeMillisecond;case fe.MICROSECOND:return le.TimeMicrosecond;case fe.NANOSECOND:return le.TimeNanosecond}return le.Time;case le.Timestamp:switch(t.unit){case fe.SECOND:return le.TimestampSecond;case fe.MILLISECOND:return le.TimestampMillisecond;case fe.MICROSECOND:return le.TimestampMicrosecond;case fe.NANOSECOND:return le.TimestampNanosecond}return le.Timestamp;case le.Date:switch(t.unit){case de.DAY:return le.DateDay;case de.MILLISECOND:return le.DateMillisecond}return le.Date;case le.Interval:switch(t.unit){case be.DAY_TIME:return le.IntervalDayTime;case be.YEAR_MONTH:return le.IntervalYearMonth}return le.Interval;case le.Map:return le.Map;case le.List:return le.List;case le.Struct:return le.Struct;case le.Union:switch(t.mode){case ye.Dense:return le.DenseUnion;case ye.Sparse:return le.SparseUnion}return le.Union;case le.FixedSizeBinary:return le.FixedSizeBinary;case le.FixedSizeList:return le.FixedSizeList;case le.Dictionary:return le.Dictionary}throw new Error(`Unrecognized type '${le[t.typeId]}'`)}xe.prototype.visitInt8=null,xe.prototype.visitInt16=null,xe.prototype.visitInt32=null,xe.prototype.visitInt64=null,xe.prototype.visitUint8=null,xe.prototype.visitUint16=null,xe.prototype.visitUint32=null,xe.prototype.visitUint64=null,xe.prototype.visitFloat16=null,xe.prototype.visitFloat32=null,xe.prototype.visitFloat64=null,xe.prototype.visitDateDay=null,xe.prototype.visitDateMillisecond=null,xe.prototype.visitTimestampSecond=null,xe.prototype.visitTimestampMillisecond=null,xe.prototype.visitTimestampMicrosecond=null,xe.prototype.visitTimestampNanosecond=null,xe.prototype.visitTimeSecond=null,xe.prototype.visitTimeMillisecond=null,xe.prototype.visitTimeMicrosecond=null,xe.prototype.visitTimeNanosecond=null,xe.prototype.visitDenseUnion=null,xe.prototype.visitSparseUnion=null,xe.prototype.visitIntervalDayTime=null,xe.prototype.visitIntervalYearMonth=null;class Oe extends xe{compareSchemas(t,e){return t===e||e instanceof t.constructor&&ze.compareFields(t.fields,e.fields)}compareFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((t,r)=>ze.compareField(t,e[r]))}compareField(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&ze.visit(t.type,e.type)}}function Fe(t,e){return e instanceof t.constructor}function Me(t,e){return t===e||Fe(t,e)}function Ee(t,e){return t===e||Fe(t,e)&&t.bitWidth===e.bitWidth&&t.isSigned===e.isSigned}function Ue(t,e){return t===e||Fe(t,e)&&t.precision===e.precision}function Ne(t,e){return t===e||Fe(t,e)&&t.unit===e.unit}function Ve(t,e){return t===e||Fe(t,e)&&t.unit===e.unit&&t.timezone===e.timezone}function Ce(t,e){return t===e||Fe(t,e)&&t.unit===e.unit&&t.bitWidth===e.bitWidth}function ke(t,e){return t===e||Fe(t,e)&&t.mode===e.mode&&t.typeIds.every((t,r)=>t===e.typeIds[r])&&ze.compareFields(t.children,e.children)}function Re(t,e){return t===e||Fe(t,e)&&t.unit===e.unit}Oe.prototype.visitNull=Me,Oe.prototype.visitBool=Me,Oe.prototype.visitInt=Ee,Oe.prototype.visitInt8=Ee,Oe.prototype.visitInt16=Ee,Oe.prototype.visitInt32=Ee,Oe.prototype.visitInt64=Ee,Oe.prototype.visitUint8=Ee,Oe.prototype.visitUint16=Ee,Oe.prototype.visitUint32=Ee,Oe.prototype.visitUint64=Ee,Oe.prototype.visitFloat=Ue,Oe.prototype.visitFloat16=Ue,Oe.prototype.visitFloat32=Ue,Oe.prototype.visitFloat64=Ue,Oe.prototype.visitUtf8=Me,Oe.prototype.visitBinary=Me,Oe.prototype.visitFixedSizeBinary=function(t,e){return t===e||Fe(t,e)&&t.byteWidth===e.byteWidth},Oe.prototype.visitDate=Ne,Oe.prototype.visitDateDay=Ne,Oe.prototype.visitDateMillisecond=Ne,Oe.prototype.visitTimestamp=Ve,Oe.prototype.visitTimestampSecond=Ve,Oe.prototype.visitTimestampMillisecond=Ve,Oe.prototype.visitTimestampMicrosecond=Ve,Oe.prototype.visitTimestampNanosecond=Ve,Oe.prototype.visitTime=Ce,Oe.prototype.visitTimeSecond=Ce,Oe.prototype.visitTimeMillisecond=Ce,Oe.prototype.visitTimeMicrosecond=Ce,Oe.prototype.visitTimeNanosecond=Ce,Oe.prototype.visitDecimal=Me,Oe.prototype.visitList=function(t,e){return t===e||Fe(t,e)&&t.children.length===e.children.length&&ze.compareFields(t.children,e.children)},Oe.prototype.visitStruct=function(t,e){return t===e||Fe(t,e)&&t.children.length===e.children.length&&ze.compareFields(t.children,e.children)},Oe.prototype.visitUnion=ke,Oe.prototype.visitDenseUnion=ke,Oe.prototype.visitSparseUnion=ke,Oe.prototype.visitDictionary=function(t,e){return t===e||Fe(t,e)&&t.id===e.id&&t.isOrdered===e.isOrdered&&ze.visit(t.indices,e.indices)&&ze.visit(t.dictionary,e.dictionary)},Oe.prototype.visitInterval=Re,Oe.prototype.visitIntervalDayTime=Re,Oe.prototype.visitIntervalYearMonth=Re,Oe.prototype.visitFixedSizeList=function(t,e){return t===e||Fe(t,e)&&t.listSize===e.listSize&&t.children.length===e.children.length&&ze.compareFields(t.children,e.children)},Oe.prototype.visitMap=function(t,e){return t===e||Fe(t,e)&&t.keysSorted===e.keysSorted&&t.children.length===e.children.length&&ze.compareFields(t.children,e.children)};const ze=new Oe;class je{static isNull(t){return t&&t.typeId===le.Null}static isInt(t){return t&&t.typeId===le.Int}static isFloat(t){return t&&t.typeId===le.Float}static isBinary(t){return t&&t.typeId===le.Binary}static isUtf8(t){return t&&t.typeId===le.Utf8}static isBool(t){return t&&t.typeId===le.Bool}static isDecimal(t){return t&&t.typeId===le.Decimal}static isDate(t){return t&&t.typeId===le.Date}static isTime(t){return t&&t.typeId===le.Time}static isTimestamp(t){return t&&t.typeId===le.Timestamp}static isInterval(t){return t&&t.typeId===le.Interval}static isList(t){return t&&t.typeId===le.List}static isStruct(t){return t&&t.typeId===le.Struct}static isUnion(t){return t&&t.typeId===le.Union}static isFixedSizeBinary(t){return t&&t.typeId===le.FixedSizeBinary}static isFixedSizeList(t){return t&&t.typeId===le.FixedSizeList}static isMap(t){return t&&t.typeId===le.Map}static isDictionary(t){return t&&t.typeId===le.Dictionary}get typeId(){return le.NONE}compareTo(t){return ze.visit(this,t)}}var Pe;je[Symbol.toStringTag]=((Pe=je.prototype).children=null,Pe.ArrayType=Array,Pe[Symbol.toStringTag]="DataType");class $e extends je{toString(){return"Null"}get typeId(){return le.Null}}$e[Symbol.toStringTag]=(t=>t[Symbol.toStringTag]="Null")($e.prototype);class Ye extends je{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return le.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:case 64:return this.isSigned?Int32Array:Uint32Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}Ye[Symbol.toStringTag]=(t=>(t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"))(Ye.prototype);class We extends Ye{constructor(){super(!0,8)}}class He extends Ye{constructor(){super(!0,16)}}class Ke extends Ye{constructor(){super(!0,32)}}class Ge extends Ye{constructor(){super(!0,64)}}class qe extends Ye{constructor(){super(!1,8)}}class Je extends Ye{constructor(){super(!1,16)}}class Ze extends Ye{constructor(){super(!1,32)}}class Qe extends Ye{constructor(){super(!1,64)}}Object.defineProperty(We.prototype,"ArrayType",{value:Int8Array}),Object.defineProperty(He.prototype,"ArrayType",{value:Int16Array}),Object.defineProperty(Ke.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(Ge.prototype,"ArrayType",{value:Int32Array}),Object.defineProperty(qe.prototype,"ArrayType",{value:Uint8Array}),Object.defineProperty(Je.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(Ze.prototype,"ArrayType",{value:Uint32Array}),Object.defineProperty(Qe.prototype,"ArrayType",{value:Uint32Array});class Xe extends je{constructor(t){super(),this.precision=t}get typeId(){return le.Float}get ArrayType(){switch(this.precision){case pe.HALF:return Uint16Array;case pe.SINGLE:return Float32Array;case pe.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return"Float"+(this.precision<<5||16)}}Xe[Symbol.toStringTag]=(t=>(t.precision=null,t[Symbol.toStringTag]="Float"))(Xe.prototype);class tr extends Xe{constructor(){super(pe.HALF)}}class er extends Xe{constructor(){super(pe.SINGLE)}}class rr extends Xe{constructor(){super(pe.DOUBLE)}}Object.defineProperty(tr.prototype,"ArrayType",{value:Uint16Array}),Object.defineProperty(er.prototype,"ArrayType",{value:Float32Array}),Object.defineProperty(rr.prototype,"ArrayType",{value:Float64Array});class ir extends je{constructor(){super()}get typeId(){return le.Binary}toString(){return"Binary"}}ir[Symbol.toStringTag]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"))(ir.prototype);class nr extends je{constructor(){super()}get typeId(){return le.Utf8}toString(){return"Utf8"}}nr[Symbol.toStringTag]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"))(nr.prototype);class sr extends je{constructor(){super()}get typeId(){return le.Bool}toString(){return"Bool"}}sr[Symbol.toStringTag]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"))(sr.prototype);class ar extends je{constructor(t,e){super(),this.scale=t,this.precision=e}get typeId(){return le.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}ar[Symbol.toStringTag]=(t=>(t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"))(ar.prototype);class or extends je{constructor(t){super(),this.unit=t}get typeId(){return le.Date}toString(){return`Date${32*(this.unit+1)}<${de[this.unit]}>`}}or[Symbol.toStringTag]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Date"))(or.prototype);class cr extends or{constructor(){super(de.DAY)}}class ur extends or{constructor(){super(de.MILLISECOND)}}class lr extends je{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return le.Time}toString(){return`Time${this.bitWidth}<${fe[this.unit]}>`}}lr[Symbol.toStringTag]=(t=>(t.unit=null,t.bitWidth=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Time"))(lr.prototype);class hr extends je{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return le.Timestamp}toString(){return`Timestamp<${fe[this.unit]}${this.timezone?", "+this.timezone:""}>`}}hr[Symbol.toStringTag]=(t=>(t.unit=null,t.timezone=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Timestamp"))(hr.prototype);class dr extends je{constructor(t){super(),this.unit=t}get typeId(){return le.Interval}toString(){return`Interval<${be[this.unit]}>`}}dr[Symbol.toStringTag]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"))(dr.prototype);class fr extends je{constructor(t){super(),this.children=[t]}get typeId(){return le.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}}fr[Symbol.toStringTag]=(t=>(t.children=null,t[Symbol.toStringTag]="List"))(fr.prototype);class pr extends je{constructor(t){super(),this.children=t}get typeId(){return le.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}pr[Symbol.toStringTag]=(t=>(t.children=null,t[Symbol.toStringTag]="Struct"))(pr.prototype);class yr extends je{constructor(t,e,r){super(),this.mode=t,this.children=r,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((t,e,r)=>(t[e]=r)&&t||t,Object.create(null))}get typeId(){return le.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>""+t.type).join(" | ")}>`}}yr[Symbol.toStringTag]=(t=>(t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"))(yr.prototype);class br extends je{constructor(t){super(),this.byteWidth=t}get typeId(){return le.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}br[Symbol.toStringTag]=(t=>(t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"))(br.prototype);class gr extends je{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return le.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}>`}}gr[Symbol.toStringTag]=(t=>(t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"))(gr.prototype);class _r extends je{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return le.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}_r[Symbol.toStringTag]=(t=>(t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"))(_r.prototype);const mr=(vr=-1,()=>++vr);var vr;class wr extends je{constructor(t,e,r,i){super(),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=null==r?mr():"number"==typeof r?r:r.low}get typeId(){return le.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}>`}}function Ir(t){let e=t;switch(t.typeId){case le.Decimal:return 4;case le.Timestamp:return 2;case le.Date:case le.Interval:return 1+e.unit;case le.Int:case le.Time:return+(e.bitWidth>32)+1;case le.FixedSizeList:return e.listSize;case le.FixedSizeBinary:return e.byteWidth;default:return 1}}wr[Symbol.toStringTag]=(t=>(t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"))(wr.prototype);class Sr{constructor(t,e,r,i,n,s,a){let o;this.type=t,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1)),this.childData=(s||[]).map(t=>t instanceof Sr?t:t.data),n instanceof Sr?(this.stride=n.stride,this.values=n.values,this.typeIds=n.typeIds,this.nullBitmap=n.nullBitmap,this.valueOffsets=n.valueOffsets):(this.stride=Ir(t),n&&((o=n[0])&&(this.valueOffsets=o),(o=n[1])&&(this.values=o),(o=n[2])&&(this.nullBitmap=o),(o=n[3])&&(this.typeIds=o)))}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get byteLength(){let t=0,{valueOffsets:e,values:r,nullBitmap:i,typeIds:n}=this;return e&&(t+=e.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),n&&(t+=n.byteLength),this.childData.reduce((t,e)=>t+e.byteLength,t)}get nullCount(){let t,e=this._nullCount;return e<=-1&&(t=this.nullBitmap)&&(this._nullCount=e=this.length-Be(t,this.offset,this.offset+this.length)),e}clone(t,e=this.offset,r=this.length,i=this._nullCount,n=this,s=this.childData){return new Sr(t,e,r,i,n,s,this.dictionary)}slice(t,e){const{stride:r,typeId:i,childData:n}=this,s=+(0===this._nullCount)-1,a=16===i?r:1,o=this._sliceBuffers(t,e,r,i);return this.clone(this.type,this.offset+t,e,s,o,!n.length||this.valueOffsets?n:this._sliceChildren(n,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===le.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(-8&e))-1,r>0&&i.set(Ie(this.offset,e,this.nullBitmap),0);const n=this.buffers;return n[he.VALIDITY]=i,this.clone(this.type,0,t,r+(t-e),n)}_sliceBuffers(t,e,r,i){let n,{buffers:s}=this;return(n=s[he.TYPE])&&(s[he.TYPE]=n.subarray(t,t+e)),(n=s[he.OFFSET])&&(s[he.OFFSET]=n.subarray(t,t+e+1))||(n=s[he.DATA])&&(s[he.DATA]=6===i?n:n.subarray(r*t,r*(t+e))),s}_sliceChildren(t,e,r){return t.map(t=>t.slice(e,r))}static new(t,e,r,i,n,s,a){switch(n instanceof Sr?n=n.buffers:n||(n=[]),t.typeId){case le.Null:return Sr.Null(t,e,r);case le.Int:return Sr.Int(t,e,r,i||0,n[he.VALIDITY],n[he.DATA]||[]);case le.Dictionary:return Sr.Dictionary(t,e,r,i||0,n[he.VALIDITY],n[he.DATA]||[],a);case le.Float:return Sr.Float(t,e,r,i||0,n[he.VALIDITY],n[he.DATA]||[]);case le.Bool:return Sr.Bool(t,e,r,i||0,n[he.VALIDITY],n[he.DATA]||[]);case le.Decimal:return Sr.Decimal(t,e,r,i||0,n[he.VALIDITY],n[he.DATA]||[]);case le.Date:return Sr.Date(t,e,r,i||0,n[he.VALIDITY],n[he.DATA]||[]);case le.Time:return Sr.Time(t,e,r,i||0,n[he.VALIDITY],n[he.DATA]||[]);case le.Timestamp:return Sr.Timestamp(t,e,r,i||0,n[he.VALIDITY],n[he.DATA]||[]);case le.Interval:return Sr.Interval(t,e,r,i||0,n[he.VALIDITY],n[he.DATA]||[]);case le.FixedSizeBinary:return Sr.FixedSizeBinary(t,e,r,i||0,n[he.VALIDITY],n[he.DATA]||[]);case le.Binary:return Sr.Binary(t,e,r,i||0,n[he.VALIDITY],n[he.OFFSET]||[],n[he.DATA]||[]);case le.Utf8:return Sr.Utf8(t,e,r,i||0,n[he.VALIDITY],n[he.OFFSET]||[],n[he.DATA]||[]);case le.List:return Sr.List(t,e,r,i||0,n[he.VALIDITY],n[he.OFFSET]||[],(s||[])[0]);case le.FixedSizeList:return Sr.FixedSizeList(t,e,r,i||0,n[he.VALIDITY],(s||[])[0]);case le.Struct:return Sr.Struct(t,e,r,i||0,n[he.VALIDITY],s||[]);case le.Map:return Sr.Map(t,e,r,i||0,n[he.VALIDITY],n[he.OFFSET]||[],(s||[])[0]);case le.Union:return Sr.Union(t,e,r,i||0,n[he.VALIDITY],n[he.TYPE]||[],n[he.OFFSET]||s,s)}throw new Error("Unrecognized typeId "+t.typeId)}static Null(t,e,r){return new Sr(t,e,r,0)}static Int(t,e,r,i,n,s){return new Sr(t,e,r,i,[void 0,Wt(t.ArrayType,s),Gt(n)])}static Dictionary(t,e,r,i,n,s,a){return new Sr(t,e,r,i,[void 0,Wt(t.indices.ArrayType,s),Gt(n)],[],a)}static Float(t,e,r,i,n,s){return new Sr(t,e,r,i,[void 0,Wt(t.ArrayType,s),Gt(n)])}static Bool(t,e,r,i,n,s){return new Sr(t,e,r,i,[void 0,Wt(t.ArrayType,s),Gt(n)])}static Decimal(t,e,r,i,n,s){return new Sr(t,e,r,i,[void 0,Wt(t.ArrayType,s),Gt(n)])}static Date(t,e,r,i,n,s){return new Sr(t,e,r,i,[void 0,Wt(t.ArrayType,s),Gt(n)])}static Time(t,e,r,i,n,s){return new Sr(t,e,r,i,[void 0,Wt(t.ArrayType,s),Gt(n)])}static Timestamp(t,e,r,i,n,s){return new Sr(t,e,r,i,[void 0,Wt(t.ArrayType,s),Gt(n)])}static Interval(t,e,r,i,n,s){return new Sr(t,e,r,i,[void 0,Wt(t.ArrayType,s),Gt(n)])}static FixedSizeBinary(t,e,r,i,n,s){return new Sr(t,e,r,i,[void 0,Wt(t.ArrayType,s),Gt(n)])}static Binary(t,e,r,i,n,s,a){return new Sr(t,e,r,i,[Ht(s),Gt(a),Gt(n)])}static Utf8(t,e,r,i,n,s,a){return new Sr(t,e,r,i,[Ht(s),Gt(a),Gt(n)])}static List(t,e,r,i,n,s,a){return new Sr(t,e,r,i,[Ht(s),void 0,Gt(n)],[a])}static FixedSizeList(t,e,r,i,n,s){return new Sr(t,e,r,i,[void 0,void 0,Gt(n)],[s])}static Struct(t,e,r,i,n,s){return new Sr(t,e,r,i,[void 0,void 0,Gt(n)],s)}static Map(t,e,r,i,n,s,a){return new Sr(t,e,r,i,[Ht(s),void 0,Gt(n)],[a])}static Union(t,e,r,i,n,s,a,o){const c=[void 0,void 0,Gt(n),Wt(t.ArrayType,s)];return t.mode===ye.Sparse?new Sr(t,e,r,i,c,a):(c[he.OFFSET]=Ht(a),new Sr(t,e,r,i,c,o))}}Sr.prototype.childData=Object.freeze([]);function Tr(t){if(null===t)return"null";if(void 0===t)return"undefined";switch(typeof t){case"number":case"bigint":return""+t;case"string":return`"${t}"`}return"function"==typeof t[Symbol.toPrimitive]?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?`[${t}]`:JSON.stringify(t)}function Br(t){if(!t||t.length<=0)return function(t){return!0};let e="",r=t.filter(t=>t==t);return r.length>0&&(e=`\n    switch (x) {${r.map(t=>`\n        case ${function(t){if("bigint"!=typeof t)return Tr(t);if(Tt)return Tr(t)+"n";return`"${Tr(t)}"`}(t)}:`).join("")}\n            return false;\n    }`),t.length!==r.length&&(e="if (x !== x) return false;\n"+e),new Function("x",e+"\nreturn true;")}const Ar=(t,e)=>(t*e+63&-64||64)/e;class Dr{constructor(t,e=1){this.buffer=t,this.stride=e,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=t.length/e|0)}get byteLength(){return this.length*this.stride*this.BYTES_PER_ELEMENT|0}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;const e=this.stride,r=this.length*e,i=this.buffer.length;r>=i&&this._resize(Ar(0===i?1*r:2*r,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Ar(t*this.stride,this.BYTES_PER_ELEMENT);const e=((t,e=0)=>t.length>=e?t.subarray(0,e):$t(new t.constructor(e),t,0))(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=$t(new this.ArrayType(t),this.buffer)}}Dr.prototype.offset=0;class xr extends Dr{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}}class Lr extends xr{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){const{buffer:r}=this.reserve(t-this.length+1),i=t>>3,n=t%8,s=r[i]>>n&1;return e?0===s&&(r[i]|=1<<n,++this.numValid):1===s&&(r[i]&=~(1<<n),--this.numValid),this}clear(){return this.numValid=0,super.clear()}}class Or extends xr{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,e){const r=this.length-1,i=this.reserve(t-r+1).buffer;return r<t++&&i.fill(i[r],r,t),i[t]=i[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}}class Fr extends Dr{get ArrayType64(){return this._ArrayType64||(this._ArrayType64=this.buffer instanceof Int32Array?Bt:Dt)}set(t,e){switch(this.reserve(t-this.length+1),typeof e){case"bigint":this.buffer64[t]=e;break;case"number":this.buffer[t*this.stride]=e;break;default:this.buffer.set(e,t*this.stride)}return this}_resize(t){const e=super._resize(t),r=e.byteLength/(this.BYTES_PER_ELEMENT*this.stride);return Tt&&(this.buffer64=new this.ArrayType64(e.buffer,e.byteOffset,r)),e}}class Mr{constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=Ir(t),this._nulls=new Lr,e&&e.length>0&&(this._isValid=Br(e))}static new(t){}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}static throughIterable(t){return function(t){const{queueingStrategy:e="count"}=t,{highWaterMark:r=("bytes"!==e?1e3:16384)}=t,i="bytes"!==e?"length":"byteLength";return function*(e){let n=0,s=Mr.new(t);for(const t of e)s.append(t)[i]>=r&&++n&&(yield s.toVector());(s.finish().length>0||0===n)&&(yield s.toVector())}}(t)}static throughAsyncIterable(t){return function(t){const{queueingStrategy:e="count"}=t,{highWaterMark:r=("bytes"!==e?1e3:16384)}=t,i="bytes"!==e?"length":"byteLength";return async function*(e){let n=0,s=Mr.new(t);for await(const t of e)s.append(t)[i]>=r&&++n&&(yield s.toVector());(s.finish().length>0||0===n)&&(yield s.toVector())}}(t)}toVector(){return oe.new(this.flush())}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),this._typeIds&&(t+=this._typeIds.byteLength),this.children.reduce((t,e)=>t+e.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((t,e)=>t+e.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}setValue(t,e){this._setValue(this,t,e)}setValid(t,e){return this.length=this._nulls.set(t,+e).length,e}addChild(t,e=""+this.numChildren){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){const t=[],e=this._values,r=this._offsets,i=this._typeIds,{length:n,nullCount:s}=this;i?(t[he.TYPE]=i.flush(n),r&&(t[he.OFFSET]=r.flush(n))):r?(e&&(t[he.DATA]=e.flush(r.last())),t[he.OFFSET]=r.flush(n)):e&&(t[he.DATA]=e.flush(n)),s>0&&(t[he.VALIDITY]=this._nulls.flush(n));const a=Sr.new(this.type,0,n,s,t,this.children.map(t=>t.flush()));return this.clear(),a}finish(){return this.finished=!0,this.children.forEach(t=>t.finish()),this}clear(){return this.length=0,this._offsets&&this._offsets.clear(),this._values&&this._values.clear(),this._nulls&&this._nulls.clear(),this._typeIds&&this._typeIds.clear(),this.children.forEach(t=>t.clear()),this}}Mr.prototype.length=1,Mr.prototype.stride=1,Mr.prototype.children=null,Mr.prototype.finished=!1,Mr.prototype.nullValues=null,Mr.prototype._isValid=()=>!0;class Er extends Mr{constructor(t){super(t),this._values=new xr(new this.ArrayType(0),this.stride)}setValue(t,e){const r=this._values;return r.reserve(t-r.length+1),super.setValue(t,e)}}class Ur extends Mr{constructor(t){super(t),this._pendingLength=0,this._offsets=new Or}setValue(t,e){const r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e.length,r.set(t,e)}setValid(t,e){return!!super.setValid(t,e)||((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){const t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}}class Nr extends Mr{constructor(t){super(t),this._values=new Lr}setValue(t,e){this._values.set(t,+e)}}class Vr extends Mr{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}}class Cr extends Er{}class kr extends Cr{}class Rr extends Cr{}class zr extends Er{}class jr extends Mr{constructor({type:t,nullValues:e,dictionaryHashFunction:r}){super({type:new wr(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Mr.new({type:this.type.indices,nullValues:e}),this.dictionary=Mr.new({type:this.type.dictionary,nullValues:null}),"function"==typeof r&&(this.valueToKey=r)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){const r=this.indices;return e=r.setValid(t,e),this.length=r.length,e}setValue(t,e){let r=this._keysToIndices,i=this.valueToKey(e),n=r[i];return void 0===n&&(r[i]=n=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,n)}flush(){const t=this.type,e=this._dictionary,r=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=e?e.concat(r):r,this.finished||(this._dictionaryOffset+=r.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return"string"==typeof t?t:""+t}}class Pr extends Er{}const $r=new Float64Array(1),Yr=new Uint32Array($r.buffer);function Wr(t){let e=(31744&t)>>10,r=(1023&t)/1024,i=(-1)**((32768&t)>>15);switch(e){case 31:return i*(r?NaN:1/0);case 0:return i*(r?6103515625e-14*r:0)}return i*2**(e-15)*(1+r)}function Hr(t){if(t!=t)return 32256;$r[0]=t;let e=(2147483648&Yr[1])>>16&65535,r=2146435072&Yr[1],i=0;return r>=1089470464?Yr[0]>0?r=31744:(r=(2080374784&r)>>16,i=(1048575&Yr[1])>>10):r<=1056964608?(i=1048576+(1048575&Yr[1]),i=1048576+(i<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,i=512+(1048575&Yr[1])>>10),e|r|65535&i}class Kr extends Er{}class Gr extends Kr{setValue(t,e){this._values.set(t,Hr(e))}}class qr extends Kr{setValue(t,e){this._values.set(t,e)}}class Jr extends Kr{setValue(t,e){this._values.set(t,e)}}const Zr=Symbol.for("isArrowBigNum");function Qr(t,...e){return 0===e.length?Object.setPrototypeOf(Wt(this.TypedArray,t),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(t,...e),this.constructor.prototype)}function Xr(...t){return Qr.apply(this,t)}function ti(...t){return Qr.apply(this,t)}function ei(...t){return Qr.apply(this,t)}function ri(t){let e,r,{buffer:i,byteOffset:n,length:s,signed:a}=t,o=new Int32Array(i,n,s),c=0,u=0,l=o.length;for(;u<l;)r=o[u++],e=o[u++],a||(e>>>=0),c+=(r>>>0)+e*u**32;return c}let ii,ni;function si(t){let e="",r=new Uint32Array(2),i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=new Uint32Array((i=new Uint16Array(i).reverse()).buffer),s=-1,a=i.length-1;do{for(r[0]=i[s=0];s<a;)i[s++]=r[1]=r[0]/10,r[0]=(r[0]-10*r[1]<<16)+i[s];i[s]=r[1]=r[0]/10,r[0]=r[0]-10*r[1],e=`${r[0]}${e}`}while(n[0]||n[1]||n[2]||n[3]);return e||"0"}Qr.prototype[Zr]=!0,Qr.prototype.toJSON=function(){return`"${ii(this)}"`},Qr.prototype.valueOf=function(){return ri(this)},Qr.prototype.toString=function(){return ii(this)},Qr.prototype[Symbol.toPrimitive]=function(t="default"){switch(t){case"number":return ri(this);case"string":return ii(this);case"default":return ni(this)}return ii(this)},Object.setPrototypeOf(Xr.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(ti.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(ei.prototype,Object.create(Uint32Array.prototype)),Object.assign(Xr.prototype,Qr.prototype,{constructor:Xr,signed:!0,TypedArray:Int32Array,BigIntArray:Bt}),Object.assign(ti.prototype,Qr.prototype,{constructor:ti,signed:!1,TypedArray:Uint32Array,BigIntArray:Dt}),Object.assign(ei.prototype,Qr.prototype,{constructor:ei,signed:!0,TypedArray:Uint32Array,BigIntArray:Dt}),Tt?(ni=t=>8===t.byteLength?new t.BigIntArray(t.buffer,t.byteOffset,1)[0]:si(t),ii=t=>8===t.byteLength?""+new t.BigIntArray(t.buffer,t.byteOffset,1)[0]:si(t)):(ii=si,ni=ii);class ai{constructor(t,e){return ai.new(t,e)}static new(t,e){switch(e){case!0:return new Xr(t);case!1:return new ti(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case Bt:return new Xr(t)}return 16===t.byteLength?new ei(t):new ti(t)}static signed(t){return new Xr(t)}static unsigned(t){return new ti(t)}static decimal(t){return new ei(t)}}class oi extends Er{setValue(t,e){this._values.set(t,e)}}class ci extends oi{}class ui extends oi{}class li extends oi{}class hi extends oi{constructor(t){t.nullValues&&(t.nullValues=t.nullValues.map(bi)),super(t),this._values=new Fr(new Int32Array(0),2)}get values64(){return this._values.buffer64}isValid(t){return super.isValid(bi(t))}}class di extends oi{}class fi extends oi{}class pi extends oi{}class yi extends oi{constructor(t){t.nullValues&&(t.nullValues=t.nullValues.map(bi)),super(t),this._values=new Fr(new Uint32Array(0),2)}get values64(){return this._values.buffer64}isValid(t){return super.isValid(bi(t))}}const bi=(gi={BigIntArray:Bt},t=>(ArrayBuffer.isView(t)&&(gi.buffer=t.buffer,gi.byteOffset=t.byteOffset,gi.byteLength=t.byteLength,t=ni(gi),gi.buffer=null),t));var gi;class _i extends Er{}class mi extends _i{}class vi extends _i{}class wi extends _i{}class Ii extends _i{}class Si extends Er{}class Ti extends Si{}class Bi extends Si{}class Ai extends Si{}class Di extends Si{}class xi extends Er{}class Li extends xi{}class Oi extends xi{}class Fi extends Ur{constructor(t){super(t),this._values=new Dr(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Gt(e))}_flushPending(t,e){const r=this._offsets,i=this._values.reserve(e).buffer;let n,s=0,a=0,o=0;for([s,n]of t)void 0===n?r.set(s,0):(a=n.length,i.set(n,o),r.set(s,a),o+=a)}}class Mi extends Ur{constructor(t){super(t),this._values=new Dr(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+4*this.length;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,_t(e))}_flushPending(t,e){}}Mi.prototype._flushPending=Fi.prototype._flushPending;class Ei{get length(){return this._values.length}get(t){return this._values[t]}clear(){return this._values=null,this}bind(t){return t instanceof oe?t:(this._values=t,this)}}const Ui=Symbol.for("parent"),Ni=Symbol.for("rowIndex"),Vi=Symbol.for("keyToIdx"),Ci=Symbol.for("idxToVal"),ki=Symbol.for("nodejs.util.inspect.custom");class Ri{constructor(t,e){this[Ui]=t,this.size=e}entries(){return this[Symbol.iterator]()}has(t){return void 0!==this.get(t)}get(t){let e=void 0;if(null!=t){const r=this[Vi]||(this[Vi]=new Map);let i=r.get(t);if(void 0!==i){const t=this[Ci]||(this[Ci]=new Array(this.size));void 0!==(e=t[i])||(t[i]=e=this.getValue(i))}else if((i=this.getIndex(t))>-1){r.set(t,i);const n=this[Ci]||(this[Ci]=new Array(this.size));void 0!==(e=n[i])||(n[i]=e=this.getValue(i))}}return e}set(t,e){if(null!=t){const r=this[Vi]||(this[Vi]=new Map);let i=r.get(t);if(void 0===i&&r.set(t,i=this.getIndex(t)),i>-1){(this[Ci]||(this[Ci]=new Array(this.size)))[i]=this.setValue(i,e)}}return this}clear(){throw new Error(`Clearing ${this[Symbol.toStringTag]} not supported.`)}delete(t){throw new Error(`Deleting ${this[Symbol.toStringTag]} values not supported.`)}*[Symbol.iterator](){const t=this.keys(),e=this.values(),r=this[Vi]||(this[Vi]=new Map),i=this[Ci]||(this[Ci]=new Array(this.size));for(let n,s,a,o,c=0;!(a=t.next()).done&&!(o=e.next()).done;++c)n=a.value,s=o.value,i[c]=s,r.has(n)||r.set(n,c),yield[n,s]}forEach(t,e){const r=this.keys(),i=this.values(),n=void 0===e?t:(r,i,n)=>t.call(e,r,i,n),s=this[Vi]||(this[Vi]=new Map),a=this[Ci]||(this[Ci]=new Array(this.size));for(let t,e,o,c,u=0;!(o=r.next()).done&&!(c=i.next()).done;++u)t=o.value,e=c.value,a[u]=e,s.has(t)||s.set(t,u),n(e,t,this)}toArray(){return[...this.values()]}toJSON(){const t={};return this.forEach((e,r)=>t[r]=e),t}inspect(){return this.toString()}[ki](){return this.toString()}toString(){const t=[];return this.forEach((e,r)=>{r=Tr(r),e=Tr(e),t.push(`${r}: ${e}`)}),`{ ${t.join(", ")} }`}}Ri[Symbol.toStringTag]=(t=>(Object.defineProperties(t,{size:{writable:!0,enumerable:!1,configurable:!1,value:0},[Ui]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ni]:{writable:!0,enumerable:!1,configurable:!1,value:-1}}),t[Symbol.toStringTag]="Row"))(Ri.prototype);class zi extends Ri{constructor(t){return super(t,t.length),$i(this)}keys(){return this[Ui].getChildAt(0)[Symbol.iterator]()}values(){return this[Ui].getChildAt(1)[Symbol.iterator]()}getKey(t){return this[Ui].getChildAt(0).get(t)}getIndex(t){return this[Ui].getChildAt(0).indexOf(t)}getValue(t){return this[Ui].getChildAt(1).get(t)}setValue(t,e){this[Ui].getChildAt(1).set(t,e)}}class ji extends Ri{constructor(t){return super(t,t.type.children.length),Pi(this)}*keys(){for(const t of this[Ui].type.children)yield t.name}*values(){for(const t of this[Ui].type.children)yield this[t.name]}getKey(t){return this[Ui].type.children[t].name}getIndex(t){return this[Ui].type.children.findIndex(e=>e.name===t)}getValue(t){return this[Ui].getChildAt(t).get(this[Ni])}setValue(t,e){return this[Ui].getChildAt(t).set(this[Ni],e)}}Object.setPrototypeOf(Ri.prototype,Map.prototype);const Pi=(()=>{const t={enumerable:!0,configurable:!1,get:null,set:null};return e=>{let r=-1,i=e[Vi]||(e[Vi]=new Map);const n=t=>function(){return this.get(t)},s=t=>function(e){return this.set(t,e)};for(const a of e.keys())i.set(a,++r),t.get=n(a),t.set=s(a),e.hasOwnProperty(a)||(t.enumerable=!0,Object.defineProperty(e,a,t)),e.hasOwnProperty(r)||(t.enumerable=!1,Object.defineProperty(e,r,t));return t.get=t.set=null,e}})(),$i=(()=>{if("undefined"==typeof Proxy)return Pi;const t=Ri.prototype.has,e=Ri.prototype.get,r=Ri.prototype.set,i=Ri.prototype.getKey,n={isExtensible:()=>!1,deleteProperty:()=>!1,preventExtensions:()=>!0,ownKeys:t=>[...t.keys()].map(t=>""+t),has(t,e){switch(e){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case Ui:case Ni:case Ci:case Vi:case ki:return!0}return"number"!=typeof e||t.has(e)||(e=t.getKey(e)),t.has(e)},get(r,n,s){switch(n){case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:case Ui:case Ni:case Ci:case Vi:case ki:return Reflect.get(r,n,s)}return"number"!=typeof n||t.call(s,n)||(n=i.call(s,n)),e.call(s,n)},set(e,n,s,a){switch(n){case Ui:case Ni:case Ci:case Vi:return Reflect.set(e,n,s,a);case"getKey":case"getIndex":case"getValue":case"setValue":case"toArray":case"toJSON":case"inspect":case"constructor":case"isPrototypeOf":case"propertyIsEnumerable":case"toString":case"toLocaleString":case"valueOf":case"size":case"has":case"get":case"set":case"clear":case"delete":case"keys":case"values":case"entries":case"forEach":case"__proto__":case"__defineGetter__":case"__defineSetter__":case"hasOwnProperty":case"__lookupGetter__":case"__lookupSetter__":case Symbol.iterator:case Symbol.toStringTag:return!1}return"number"!=typeof n||t.call(a,n)||(n=i.call(a,n)),!!t.call(a,n)&&!!r.call(a,n,s)}};return t=>new Proxy(t,n)})();let Yi;function Wi(t,e,r,i){let{length:n=0}=t,s="number"!=typeof e?0:e,a="number"!=typeof r?n:r;return s<0&&(s=(s%n+n)%n),a<0&&(a=(a%n+n)%n),a<s&&(Yi=s,s=a,a=Yi),a>n&&(a=n),i?i(t,s,a):[s,a]}const Hi=Tt?St(0):0,Ki=t=>t!=t;function Gi(t){let e=typeof t;if("object"!==e||null===t)return Ki(t)?Ki:"bigint"!==e?e=>e===t:e=>Hi+e===t;if(t instanceof Date){const e=t.valueOf();return t=>t instanceof Date&&t.valueOf()===e}return ArrayBuffer.isView(t)?e=>!!e&&re(t,e):t instanceof Map?function(t){let e=-1;const r=[];return t.forEach(t=>r[++e]=Gi(t)),qi(r)}(t):Array.isArray(t)?function(t){const e=[];for(let r=-1,i=t.length;++r<i;)e[r]=Gi(t[r]);return qi(e)}(t):t instanceof oe?function(t){const e=[];for(let r=-1,i=t.length;++r<i;)e[r]=Gi(t.get(r));return qi(e)}(t):function(t){const e=Object.keys(t);if(0===e.length)return()=>!1;const r=[];for(let i=-1,n=e.length;++i<n;)r[i]=Gi(t[e[i]]);return qi(r,e)}(t)}function qi(t,e){return r=>{if(!r||"object"!=typeof r)return!1;switch(r.constructor){case Array:return function(t,e){const r=t.length;if(e.length!==r)return!1;for(let i=-1;++i<r;)if(!t[i](e[i]))return!1;return!0}(t,r);case Map:case zi:case ji:return Ji(t,r,r.keys());case Object:case void 0:return Ji(t,r,e||Object.keys(r))}return r instanceof oe&&function(t,e){const r=t.length;if(e.length!==r)return!1;for(let i=-1;++i<r;)if(!t[i](e.get(i)))return!1;return!0}(t,r)}}function Ji(t,e,r){const i=r[Symbol.iterator](),n=e instanceof Map?e.keys():Object.keys(e)[Symbol.iterator](),s=e instanceof Map?e.values():Object.values(e)[Symbol.iterator]();let a=0,o=t.length,c=s.next(),u=i.next(),l=n.next();for(;a<o&&!u.done&&!l.done&&!c.done&&(u.value===l.value&&t[a](c.value));++a,u=i.next(),l=n.next(),c=s.next());return!!(a===o&&u.done&&l.done&&c.done)||(i.return&&i.return(),n.return&&n.return(),s.return&&s.return(),!1)}class Zi extends oe{constructor(t,e=[],r=function(t){let e=new Uint32Array((t||[]).length+1),r=e[0]=0,i=e.length;for(let n=0;++n<i;)e[n]=r+=t[n-1].length;return e}(e)){super(),this._nullCount=-1,this._type=t,this._chunks=e,this._chunkOffsets=r,this._length=r[r.length-1],this._numChildren=(this._type.children||[]).length}static flatten(...t){return an(oe,t)}static concat(...t){const e=Zi.flatten(...t);return new Zi(e[0].type,e)}get type(){return this._type}get length(){return this._length}get chunks(){return this._chunks}get typeId(){return this._type.typeId}get VectorName(){return`Chunked<${this._type}>`}get data(){return this._chunks[0]?this._chunks[0].data:null}get ArrayType(){return this._type.ArrayType}get numChildren(){return this._numChildren}get stride(){return this._chunks[0]?this._chunks[0].stride:1}get byteLength(){return this._chunks.reduce((t,e)=>t+e.byteLength,0)}get nullCount(){let t=this._nullCount;return t<0&&(this._nullCount=t=this._chunks.reduce((t,{nullCount:e})=>t+e,0)),t}get indices(){if(je.isDictionary(this._type)){if(!this._indices){const t=this._chunks;this._indices=1===t.length?t[0].indices:Zi.concat(...t.map(t=>t.indices))}return this._indices}return null}get dictionary(){return je.isDictionary(this._type)?this._chunks[this._chunks.length-1].data.dictionary:null}*[Symbol.iterator](){for(const t of this._chunks)yield*t}clone(t=this._chunks){return new Zi(this._type,t)}concat(...t){return this.clone(Zi.flatten(this,...t))}slice(t,e){return Wi(this,t,e,this._sliceInternal)}getChildAt(t){if(t<0||t>=this._numChildren)return null;let e,r,i,n=this._children||(this._children=[]);return(e=n[t])?e:(r=(this._type.children||[])[t])&&(i=this._chunks.map(e=>e.getChildAt(t)).filter(t=>null!=t),i.length>0)?n[t]=new Zi(r.type,i):null}search(t,e){let r=t,i=this._chunkOffsets,n=i.length-1;if(r<0)return null;if(r>=i[n])return null;if(n<=1)return e?e(this,0,r):[0,r];let s=0,a=0,o=0;do{if(s+1===n)return e?e(this,s,r-a):[s,r-a];o=s+(n-s)/2|0,r>=i[o]?s=o:n=o}while(r<i[n]&&r>=(a=i[s]));return null}isValid(t){return!!this.search(t,this.isValidInternal)}get(t){return this.search(t,this.getInternal)}set(t,e){this.search(t,({chunks:t},r,i)=>t[r].set(i,e))}indexOf(t,e){return e&&"number"==typeof e?this.search(e,(e,r,i)=>this.indexOfInternal(e,r,i,t)):this.indexOfInternal(this,0,Math.max(0,e||0),t)}toArray(){const{chunks:t}=this,e=t.length;let r=this._type.ArrayType;if(e<=0)return new r(0);if(e<=1)return t[0].toArray();let i=0,n=new Array(e);for(let r=-1;++r<e;)i+=(n[r]=t[r].toArray()).length;r!==n[0].constructor&&(r=n[0].constructor);let s=new r(i),a=r===Array?Xi:Qi;for(let t=-1,r=0;++t<e;)r=a(n[t],s,r);return s}getInternal({_chunks:t},e,r){return t[e].get(r)}isValidInternal({_chunks:t},e,r){return t[e].isValid(r)}indexOfInternal({_chunks:t},e,r,i){let n=e-1,s=t.length,a=r,o=0,c=-1;for(;++n<s;){if(~(c=t[n].indexOf(i,a)))return o+c;a=0,o+=t[n].length}return-1}_sliceInternal(t,e,r){const i=[],{chunks:n,_chunkOffsets:s}=t;for(let t=-1,a=n.length;++t<a;){const a=n[t],o=a.length,c=s[t];if(c>=r)break;if(e>=c+o)continue;if(c>=e&&c+o<=r){i.push(a);continue}const u=Math.max(0,e-c),l=Math.min(r-c,o);i.push(a.slice(u,l))}return t.clone(i)}}const Qi=(t,e,r)=>(e.set(t,r),r+t.length),Xi=(t,e,r)=>{let i=r;for(let r=-1,n=t.length;++r<n;)e[i++]=t[r];return i};class tn extends Zi{constructor(t,e=[],r){if(e=Zi.flatten(...e),super(t.type,e,r),this._field=t,1===e.length&&!(this instanceof en))return new en(t,e[0],this._chunkOffsets)}static new(t,e,...r){const i=Zi.flatten(Array.isArray(e)?[...e,...r]:e instanceof oe?[e,...r]:[oe.new(e,...r)]);if("string"==typeof t){const e=i[0].data.type;t=new dn(t,e,!0)}else!t.nullable&&i.some(({nullCount:t})=>t>0)&&(t=t.clone({nullable:!0}));return new tn(t,i)}get field(){return this._field}get name(){return this._field.name}get nullable(){return this._field.nullable}get metadata(){return this._field.metadata}clone(t=this._chunks){return new tn(this._field,t)}getChildAt(t){if(t<0||t>=this.numChildren)return null;let e,r,i,n=this._children||(this._children=[]);return(e=n[t])?e:(r=(this.type.children||[])[t])&&(i=this._chunks.map(e=>e.getChildAt(t)).filter(t=>null!=t),i.length>0)?n[t]=new tn(r,i):null}}class en extends tn{constructor(t,e,r){super(t,[e],r),this._chunk=e}search(t,e){return e?e(this,0,t):[0,t]}isValid(t){return this._chunk.isValid(t)}get(t){return this._chunk.get(t)}set(t,e){this._chunk.set(t,e)}indexOf(t,e){return this._chunk.indexOf(t,e)}}const rn=Array.isArray,nn=(t,e)=>cn(t,e,[],0),sn=t=>ln(t,[[],[]]),an=(t,e)=>function t(e,r,i,n){let s,a=n,o=-1,c=r.length;for(;++o<c;)rn(s=r[o])?a=t(e,s,i,a).length:s instanceof Zi?a=t(e,s.chunks,i,a).length:s instanceof e&&(i[a++]=s);return i}(t,e,[],0),on=(t,e)=>function t(e,r,i,n){let s,a=n,o=-1,c=r.length;for(;++o<c;)rn(s=r[o])?a=t(e,s,i,a).length:s instanceof e?a=cn(oe,s.schema.fields.map((t,e)=>s.getChildAt(e)),i,a).length:s instanceof oe&&(i[a++]=s);return i}(t,e,[],0);function cn(t,e,r,i){let n,s=i,a=-1,o=e.length;for(;++a<o;)rn(n=e[a])?s=cn(t,n,r,s).length:n instanceof t&&(r[s++]=n);return r}const un=(t,[e,r],i)=>(t[0][i]=e,t[1][i]=r,t);function ln(t,e){let r,i;switch(i=t.length){case 0:return e;case 1:if(r=e[0],!t[0])return e;if(rn(t[0]))return ln(t[0],e);t[0]instanceof Sr||t[0]instanceof oe||t[0]instanceof je||([r,t]=Object.entries(t[0]).reduce(un,e));break;default:rn(r=t[i-1])?t=rn(t[0])?t[0]:t.slice(0,i-1):(t=rn(t[0])?t[0]:t,r=[])}let n,s,a=-1,o=-1,c=-1,u=t.length,[l,h]=e;for(;++c<u;)s=t[c],s instanceof tn&&(h[++o]=s)?l[++a]=s.field.clone(r[c],s.type,!0):(({[c]:n=c}=r),s instanceof je&&(h[++o]=s)?l[++a]=dn.new(n,s,!0):s&&s.type&&(h[++o]=s)&&(s instanceof Sr&&(h[o]=s=oe.new(s)),l[++a]=dn.new(n,s.type,!0)));return e}class hn{constructor(t=[],e,r){this.fields=t||[],this.metadata=e||new Map,r||(r=pn(t)),this.dictionaries=r}static from(...t){return hn.new(t[0],t[1])}static new(...t){return new hn(sn(t)[0])}get[Symbol.toStringTag](){return"Schema"}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}compareTo(t){return ze.compareSchemas(this,t)}select(...t){const e=t.reduce((t,e)=>(t[e]=!0)&&t,Object.create(null));return new hn(this.fields.filter(t=>e[t.name]),this.metadata)}selectAt(...t){return new hn(t.map(t=>this.fields[t]).filter(Boolean),this.metadata)}assign(...t){const e=t[0]instanceof hn?t[0]:new hn(nn(dn,t)),r=[...this.fields],i=fn(fn(new Map,this.metadata),e.metadata),n=e.fields.filter(t=>{const e=r.findIndex(e=>e.name===t.name);return!~e||(r[e]=t.clone({metadata:fn(fn(new Map,r[e].metadata),t.metadata)}))&&!1}),s=pn(n,new Map);return new hn([...r,...n],i,new Map([...this.dictionaries,...s]))}}class dn{constructor(t,e,r=!1,i){this.name=t,this.type=e,this.nullable=r,this.metadata=i||new Map}static new(...t){let[e,r,i,n]=t;return t[0]&&"object"==typeof t[0]&&(({name:e}=t[0]),void 0===r&&(r=t[0].type),void 0===i&&(i=t[0].nullable),void 0===n&&(n=t[0].metadata)),new dn(""+e,r,i,n)}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}compareTo(t){return ze.compareField(this,t)}clone(...t){let[e,r,i,n]=t;return t[0]&&"object"==typeof t[0]?({name:e=this.name,type:r=this.type,nullable:i=this.nullable,metadata:n=this.metadata}=t[0]):[e=this.name,r=this.type,i=this.nullable,n=this.metadata]=t,dn.new(e,r,i,n)}}function fn(t,e){return new Map([...t||new Map,...e||new Map])}function pn(t,e=new Map){for(let r=-1,i=t.length;++r<i;){const i=t[r].type;if(je.isDictionary(i))if(e.has(i.id)){if(e.get(i.id)!==i.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}else e.set(i.id,i.dictionary);i.children&&i.children.length>0&&pn(i.children,e)}return e}hn.prototype.fields=null,hn.prototype.metadata=null,hn.prototype.dictionaries=null,dn.prototype.type=null,dn.prototype.name=null,dn.prototype.nullable=null,dn.prototype.metadata=null;class yn extends Ur{constructor(t){super(t),this._run=new Ei,this._offsets=new Or}addChild(t,e="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new fr(new dn(e,t.type,!0)),this.numChildren-1}clear(){return this._run.clear(),super.clear()}_flushPending(t){const e=this._run,r=this._offsets,i=this._setValue;let n,s=0;for([s,n]of t)void 0===n?r.set(s,0):(r.set(s,n.length),i(this,s,e.bind(n)))}}class bn extends Mr{constructor(){super(...arguments),this._run=new Ei}setValue(t,e){super.setValue(t,this._run.bind(e))}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");const r=this.children.push(t);return this.type=new gr(this.type.listSize,new dn(e,t.type,!0)),r}clear(){return this._run.clear(),super.clear()}}class gn extends Ur{set(t,e){return super.set(t,e)}setValue(t,e){e=e instanceof Map?e:new Map(Object.entries(e));const r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.size),this._pendingLength+=e.size,r.set(t,e)}addChild(t,e=""+this.numChildren){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new _r(new dn(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){const e=this._offsets,r=this._setValue;t.forEach((t,i)=>{void 0===t?e.set(i,0):(e.set(i,t.size),r(this,i,t))})}}class _n extends Mr{addChild(t,e=""+this.numChildren){const r=this.children.push(t);return this.type=new pr([...this.type.children,new dn(e,t.type,!0)]),r}}class mn extends Mr{constructor(t){super(t),this._typeIds=new xr(new Int8Array(0),1),"function"==typeof t.valueToChildTypeId&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,r){return void 0===r&&(r=this._valueToChildTypeId(this,e,t)),this.setValid(t,this.isValid(e))&&this.setValue(t,e,r),this}setValue(t,e,r){this._typeIds.set(t,r),super.setValue(t,e)}addChild(t,e=""+this.children.length){const r=this.children.push(t),{type:{children:i,mode:n,typeIds:s}}=this,a=[...i,new dn(e,t.type)];return this.type=new yr(n,[...s,r],a),r}_valueToChildTypeId(t,e,r){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}}class vn extends mn{}class wn extends mn{constructor(t){super(t),this._offsets=new xr(new Int32Array(0))}setValue(t,e,r){const i=this.type.typeIdToChildIndex[r];return this._offsets.set(t,this.getChildAt(i).length),super.setValue(t,e,r)}}class In extends xe{}const Sn=(t,e,r)=>{t[e]=r%4294967296|0,t[e+1]=r/4294967296|0},Tn=(t,e,r,i)=>{const{[r]:n,[r+1]:s}=e;null!=n&&null!=s&&t.set(i.subarray(0,s-n),n)},Bn=({values:t},e,r)=>{((t,e,r)=>{t[e]=r/864e5|0})(t,e,r.valueOf())},An=({values:t},e,r)=>{Sn(t,2*e,r.valueOf())},Dn=({stride:t,values:e},r,i)=>{e[t*r]=i},xn=({stride:t,values:e},r,i)=>{e[t*r]=Hr(i)},Ln=(t,e,r)=>{switch(typeof r){case"bigint":t.values64[e]=r;break;case"number":t.values[e*t.stride]=r;break;default:const i=r,{stride:n,ArrayType:s}=t,a=Wt(s,i);t.values.set(a.subarray(0,n),n*e)}},On=({values:t},e,r)=>Sn(t,2*e,r/1e3),Fn=({values:t},e,r)=>Sn(t,2*e,r),Mn=({values:t},e,r)=>((t,e,r)=>{t[e]=1e3*r%4294967296|0,t[e+1]=1e3*r/4294967296|0})(t,2*e,r),En=({values:t},e,r)=>((t,e,r)=>{t[e]=1e6*r%4294967296|0,t[e+1]=1e6*r/4294967296|0})(t,2*e,r),Un=({values:t,stride:e},r,i)=>{t[e*r]=i},Nn=({values:t,stride:e},r,i)=>{t[e*r]=i},Vn=({values:t},e,r)=>{t.set(r.subarray(0,2),2*e)},Cn=({values:t},e,r)=>{t.set(r.subarray(0,2),2*e)},kn=(t,e,r)=>{const i=t.typeIdToChildIndex[t.typeIds[e]],n=t.getChildAt(i);n&&n.set(t.valueOffsets[e],r)},Rn=(t,e,r)=>{const i=t.typeIdToChildIndex[t.typeIds[e]],n=t.getChildAt(i);n&&n.set(e,r)},zn=({values:t},e,r)=>{t.set(r.subarray(0,2),2*e)},jn=({values:t},e,r)=>{t[e]=12*r[0]+r[1]%12};In.prototype.visitBool=({offset:t,values:e},r,i)=>{const n=t+r;i?e[n>>3]|=1<<n%8:e[n>>3]&=~(1<<n%8)},In.prototype.visitInt=(t,e,r)=>{t.type.bitWidth<64?Dn(t,e,r):Ln(t,e,r)},In.prototype.visitInt8=Dn,In.prototype.visitInt16=Dn,In.prototype.visitInt32=Dn,In.prototype.visitInt64=Ln,In.prototype.visitUint8=Dn,In.prototype.visitUint16=Dn,In.prototype.visitUint32=Dn,In.prototype.visitUint64=Ln,In.prototype.visitFloat=(t,e,r)=>{t.type.precision!==pe.HALF?Dn(t,e,r):xn(t,e,r)},In.prototype.visitFloat16=xn,In.prototype.visitFloat32=Dn,In.prototype.visitFloat64=Dn,In.prototype.visitUtf8=({values:t,valueOffsets:e},r,i)=>{Tn(t,e,r,_t(i))},In.prototype.visitBinary=({values:t,valueOffsets:e},r,i)=>Tn(t,e,r,i),In.prototype.visitFixedSizeBinary=({stride:t,values:e},r,i)=>{e.set(i.subarray(0,t),t*r)},In.prototype.visitDate=(t,e,r)=>{t.type.unit===de.DAY?Bn(t,e,r):An(t,e,r)},In.prototype.visitDateDay=Bn,In.prototype.visitDateMillisecond=An,In.prototype.visitTimestamp=(t,e,r)=>{switch(t.type.unit){case fe.SECOND:return On(t,e,r);case fe.MILLISECOND:return Fn(t,e,r);case fe.MICROSECOND:return Mn(t,e,r);case fe.NANOSECOND:return En(t,e,r)}},In.prototype.visitTimestampSecond=On,In.prototype.visitTimestampMillisecond=Fn,In.prototype.visitTimestampMicrosecond=Mn,In.prototype.visitTimestampNanosecond=En,In.prototype.visitTime=(t,e,r)=>{switch(t.type.unit){case fe.SECOND:return Un(t,e,r);case fe.MILLISECOND:return Nn(t,e,r);case fe.MICROSECOND:return Vn(t,e,r);case fe.NANOSECOND:return Cn(t,e,r)}},In.prototype.visitTimeSecond=Un,In.prototype.visitTimeMillisecond=Nn,In.prototype.visitTimeMicrosecond=Vn,In.prototype.visitTimeNanosecond=Cn,In.prototype.visitDecimal=({values:t},e,r)=>{t.set(r.subarray(0,4),4*e)},In.prototype.visitList=(t,e,r)=>{const i=t.getChildAt(0),n=t.valueOffsets;for(let t=-1,s=n[e],a=n[e+1];s<a;)i.set(s++,r.get(++t))},In.prototype.visitStruct=(t,e,r)=>{const i=r instanceof Map?(n=e,s=r,(t,e,r)=>t&&t.set(n,s.get(e.name))):r instanceof oe?((t,e)=>(r,i,n)=>r&&r.set(t,e.get(n)))(e,r):Array.isArray(r)?((t,e)=>(r,i,n)=>r&&r.set(t,e[n]))(e,r):((t,e)=>(r,i,n)=>r&&r.set(t,e[i.name]))(e,r);var n,s;t.type.children.forEach((e,r)=>i(t.getChildAt(r),e,r))},In.prototype.visitUnion=(t,e,r)=>{t.type.mode===ye.Dense?kn(t,e,r):Rn(t,e,r)},In.prototype.visitDenseUnion=kn,In.prototype.visitSparseUnion=Rn,In.prototype.visitDictionary=(t,e,r)=>{const i=t.getKey(e);null!==i&&t.setValue(i,r)},In.prototype.visitInterval=(t,e,r)=>{t.type.unit===be.DAY_TIME?zn(t,e,r):jn(t,e,r)},In.prototype.visitIntervalDayTime=zn,In.prototype.visitIntervalYearMonth=jn,In.prototype.visitFixedSizeList=(t,e,r)=>{const i=t.getChildAt(0),{stride:n}=t;for(let t=-1,s=e*n;++t<n;)i.set(s+t,r.get(t))},In.prototype.visitMap=(t,e,r)=>{const i=t.getChildAt(0),n=t.valueOffsets,s=r instanceof Map?[...r]:Object.entries(r);for(let t=-1,r=n[e],a=n[e+1];r<a;)i.set(r++,s[++t])};const Pn=new In;const $n=new class extends xe{visitNull(){return Vr}visitBool(){return Nr}visitInt(){return oi}visitInt8(){return ci}visitInt16(){return ui}visitInt32(){return li}visitInt64(){return hi}visitUint8(){return di}visitUint16(){return fi}visitUint32(){return pi}visitUint64(){return yi}visitFloat(){return Kr}visitFloat16(){return Gr}visitFloat32(){return qr}visitFloat64(){return Jr}visitUtf8(){return Mi}visitBinary(){return Fi}visitFixedSizeBinary(){return Pr}visitDate(){return Cr}visitDateDay(){return kr}visitDateMillisecond(){return Rr}visitTimestamp(){return Si}visitTimestampSecond(){return Ti}visitTimestampMillisecond(){return Bi}visitTimestampMicrosecond(){return Ai}visitTimestampNanosecond(){return Di}visitTime(){return _i}visitTimeSecond(){return mi}visitTimeMillisecond(){return vi}visitTimeMicrosecond(){return wi}visitTimeNanosecond(){return Ii}visitDecimal(){return zr}visitList(){return yn}visitStruct(){return _n}visitUnion(){return mn}visitDenseUnion(){return wn}visitSparseUnion(){return vn}visitDictionary(){return jr}visitInterval(){return xi}visitIntervalDayTime(){return Li}visitIntervalYearMonth(){return Oi}visitFixedSizeList(){return bn}visitMap(){return gn}};var Yn;Mr.new=function t(e){const r=e.type,i=new($n.getVisitFn(r)())(e);if(r.children&&r.children.length>0){const n=e.children||[],s={nullValues:e.nullValues},a=Array.isArray(n)?(t,e)=>n[e]||s:({name:t})=>n[t]||s;r.children.forEach((e,r)=>{const{type:n}=e,s=a(e,r);i.children.push(t({...s,type:n}))})}return i},Object.keys(le).map(t=>le[t]).filter(t=>"number"==typeof t&&t!==le.NONE).forEach(t=>{$n.visit(t).prototype._setValue=Pn.getVisitFn(t)}),Mi.prototype._setValue=Pn.visitBinary,function(t){var e,r;e=t.apache||(t.apache={}),function(e){class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ce.apache.arrow.flatbuf.MetadataVersion.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new ce.apache.arrow.flatbuf.Schema).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(e,r){let i=this.bb.__offset(this.bb_pos,8);return i?(r||new t.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos+i)+24*e,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(e,r){let i=this.bb.__offset(this.bb_pos,10);return i?(r||new t.apache.arrow.flatbuf.Block).__init(this.bb.__vector(this.bb_pos+i)+24*e,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(4)}static addVersion(t,e){t.addFieldInt16(0,e,ce.apache.arrow.flatbuf.MetadataVersion.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static createFooter(t,e,i,n,s){return r.startFooter(t),r.addVersion(t,e),r.addSchema(t,i),r.addDictionaries(t,n),r.addRecordBatches(t,s),r.endFooter(t)}}e.Footer=r}((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={}))}(Yn||(Yn={})),function(t){var e,r;e=t.apache||(t.apache={}),((r=e.arrow||(e.arrow={})).flatbuf||(r.flatbuf={})).Block=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static createBlock(t,e,r,i){return t.prep(8,24),t.writeInt64(i),t.pad(4),t.writeInt32(r),t.writeInt64(e),t.offset()}}}(Yn||(Yn={}));var Wn=at.Long,Hn=at.Builder,Kn=at.ByteBuffer,Gn=Yn.apache.arrow.flatbuf.Block,qn=Yn.apache.arrow.flatbuf.Footer;class Jn{constructor(t,e=_e.V4,r,i){this.schema=t,this.version=e,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}static decode(t){t=new Kn(Gt(t));const e=qn.getRootAsFooter(t),r=hn.decode(e.schema());return new Zn(r,e)}static encode(t){const e=new Hn,r=hn.encode(e,t.schema);qn.startRecordBatchesVector(e,t.numRecordBatches),[...t.recordBatches()].slice().reverse().forEach(t=>Qn.encode(e,t));const i=e.endVector();qn.startDictionariesVector(e,t.numDictionaries),[...t.dictionaryBatches()].slice().reverse().forEach(t=>Qn.encode(e,t));const n=e.endVector();return qn.startFooter(e),qn.addSchema(e,r),qn.addVersion(e,_e.V4),qn.addRecordBatches(e,i),qn.addDictionaries(e,n),qn.finishFooterBuffer(e,qn.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}*recordBatches(){for(let t,e=-1,r=this.numRecordBatches;++e<r;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,r=this.numDictionaries;++e<r;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}}class Zn extends Jn{constructor(t,e){super(t,e.version()),this._footer=e}get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){const e=this._footer.recordBatches(t);if(e)return Qn.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const e=this._footer.dictionaries(t);if(e)return Qn.decode(e)}return null}}class Qn{static decode(t){return new Qn(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){const{metaDataLength:r}=e,i=new Wn(e.offset,0),n=new Wn(e.bodyLength,0);return Gn.createBlock(t,i,r,n)}constructor(t,e,r){this.metaDataLength=t,this.offset="number"==typeof r?r:r.low,this.bodyLength="number"==typeof e?e:e.low}}class Xn extends It{write(t){if((t=Gt(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?gt(this.toUint8Array(!0)):this.toUint8Array(!1).then(gt)}toUint8Array(t=!1){return t?Yt(this._values)[0]:(async()=>{let t=[],e=0;for await(const r of this)t.push(r),e+=r.byteLength;return Yt(t,e)[0]})()}}class ts{constructor(t){t&&(this.source=new rs(ie.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class es{constructor(t){t instanceof es?this.source=t.source:t instanceof Xn?this.source=new is(ie.fromAsyncIterable(t)):zt(t)?this.source=new is(ie.fromNodeStream(t)):Rt(t)?this.source=new is(ie.fromDOMStream(t)):kt(t)?this.source=new is(ie.fromDOMStream(t.body)):Et(t)?this.source=new is(ie.fromIterable(t)):(Mt(t)||Ut(t))&&(this.source=new is(ie.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class rs{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||mt)}return(t){return Object.create(this.source.return&&this.source.return(t)||mt)}}class is{constructor(t){this.source=t,this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}async cancel(t){await this.return(t)}get closed(){return this._closedPromise}async read(t){return(await this.next(t,"read")).value}async peek(t){return(await this.next(t,"peek")).value}async next(t,e="read"){return await this.source.next({cmd:e,size:t})}async throw(t){const e=this.source.throw&&await this.source.throw(t)||mt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)}async return(t){const e=this.source.return&&await this.source.return(t)||mt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)}}class ns extends ts{constructor(t,e){super(),this.position=0,this.buffer=Gt(t),this.size=void 0===e?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:r}=this.readAt(t,4);return new DataView(e,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){const{buffer:e,size:r,position:i}=this;return e&&i<r?("number"!=typeof t&&(t=1/0),this.position=Math.min(r,i+Math.min(r-i,t)),e.subarray(i,this.position)):null}readAt(t,e){const r=this.buffer,i=Math.min(this.size,t+e);return r?r.subarray(t,i):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}}class ss extends es{constructor(t,e){super(),this.position=0,this._handle=t,"number"==typeof e?this.size=e:this._pending=(async()=>{this.size=(await t.stat()).size,delete this._pending})()}async readInt32(t){const{buffer:e,byteOffset:r}=await this.readAt(t,4);return new DataView(e,r).getInt32(0,!0)}async seek(t){return this._pending&&await this._pending,this.position=Math.min(t,this.size),t<this.size}async read(t){this._pending&&await this._pending;const{_handle:e,size:r,position:i}=this;if(e&&i<r){"number"!=typeof t&&(t=1/0);let n=i,s=0,a=0,o=Math.min(r,n+Math.min(r-n,t)),c=new Uint8Array(Math.max(0,(this.position=o)-n));for(;(n+=a)<o&&(s+=a)<c.byteLength;)({bytesRead:a}=await e.read(c,s,c.byteLength-s,n));return c}return null}async readAt(t,e){this._pending&&await this._pending;const{_handle:r,size:i}=this;if(r&&t+e<i){const n=Math.min(i,t+e),s=new Uint8Array(n-t);return(await r.read(s,0,e,t)).buffer}return new Uint8Array(e)}async close(){const t=this._handle;this._handle=null,t&&await t.close()}async throw(t){return await this.close(),{done:!0,value:t}}async return(t){return await this.close(),{done:!0,value:t}}}function as(t){return t<0&&(t=4294967295+t+1),"0x"+t.toString(16)}const os=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class cs{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const e=new Uint32Array([this.buffer[1]>>>16,65535&this.buffer[1],this.buffer[0]>>>16,65535&this.buffer[0]]),r=new Uint32Array([t.buffer[1]>>>16,65535&t.buffer[1],t.buffer[0]>>>16,65535&t.buffer[0]]);let i=e[3]*r[3];this.buffer[0]=65535&i;let n=i>>>16;return i=e[2]*r[3],n+=i,i=e[3]*r[2]>>>0,n+=i,this.buffer[0]+=n<<16,this.buffer[1]=n>>>0<i?65536:0,this.buffer[1]+=n>>>16,this.buffer[1]+=e[1]*r[3]+e[2]*r[2]+e[3]*r[1],this.buffer[1]+=e[0]*r[3]+e[1]*r[2]+e[2]*r[1]+e[3]*r[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${as(this.buffer[1])} ${as(this.buffer[0])}`}}class us extends cs{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return us.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return us.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const r=t.length;let i=new us(e);for(let e=0;e<r;){const n=8<r-e?8:r-e,s=new us(new Uint32Array([parseInt(t.substr(e,n),10),0])),a=new us(new Uint32Array([os[n],0]));i.times(a),i.plus(s),e+=n}return i}static convertArray(t){const e=new Uint32Array(2*t.length);for(let r=-1,i=t.length;++r<i;)us.from(t[r],new Uint32Array(e.buffer,e.byteOffset+2*r*4,2));return e}static multiply(t,e){return new us(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new us(new Uint32Array(t.buffer)).plus(e)}}class ls extends cs{negate(){return this.buffer[0]=1+~this.buffer[0],this.buffer[1]=~this.buffer[1],0==this.buffer[0]&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){const e=this.buffer[1]<<0,r=t.buffer[1]<<0;return e<r||e===r&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return ls.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return ls.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const r=t.startsWith("-"),i=t.length;let n=new ls(e);for(let e=r?1:0;e<i;){const r=8<i-e?8:i-e,s=new ls(new Uint32Array([parseInt(t.substr(e,r),10),0])),a=new ls(new Uint32Array([os[r],0]));n.times(a),n.plus(s),e+=r}return r?n.negate():n}static convertArray(t){const e=new Uint32Array(2*t.length);for(let r=-1,i=t.length;++r<i;)ls.from(t[r],new Uint32Array(e.buffer,e.byteOffset+2*r*4,2));return e}static multiply(t,e){return new ls(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new ls(new Uint32Array(t.buffer)).plus(e)}}class hs{constructor(t){this.buffer=t}high(){return new ls(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new ls(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=1+~this.buffer[0],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],this}times(t){const e=new us(new Uint32Array([this.buffer[3],0])),r=new us(new Uint32Array([this.buffer[2],0])),i=new us(new Uint32Array([this.buffer[1],0])),n=new us(new Uint32Array([this.buffer[0],0])),s=new us(new Uint32Array([t.buffer[3],0])),a=new us(new Uint32Array([t.buffer[2],0])),o=new us(new Uint32Array([t.buffer[1],0])),c=new us(new Uint32Array([t.buffer[0],0]));let u=us.multiply(n,c);this.buffer[0]=u.low();let l=new us(new Uint32Array([u.high(),0]));return u=us.multiply(i,c),l.plus(u),u=us.multiply(n,o),l.plus(u),this.buffer[1]=l.low(),this.buffer[3]=l.lessThan(u)?1:0,this.buffer[2]=l.high(),new us(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(us.multiply(r,c)).plus(us.multiply(i,o)).plus(us.multiply(n,a)),this.buffer[3]+=us.multiply(e,c).plus(us.multiply(r,o)).plus(us.multiply(i,a)).plus(us.multiply(n,s)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${as(this.buffer[3])} ${as(this.buffer[2])} ${as(this.buffer[1])} ${as(this.buffer[0])}`}static multiply(t,e){return new hs(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new hs(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return hs.fromString("string"==typeof t?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return hs.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const r=t.startsWith("-"),i=t.length;let n=new hs(e);for(let e=r?1:0;e<i;){const r=8<i-e?8:i-e,s=new hs(new Uint32Array([parseInt(t.substr(e,r),10),0,0,0])),a=new hs(new Uint32Array([os[r],0,0,0]));n.times(a),n.plus(s),e+=r}return r?n.negate():n}static convertArray(t){const e=new Uint32Array(4*t.length);for(let r=-1,i=t.length;++r<i;)hs.from(t[r],new Uint32Array(e.buffer,e.byteOffset+16*r,4));return e}}class ds extends xe{constructor(t,e,r,i){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=r,this.dictionaries=i}visit(t){return super.visit(t instanceof dn?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return Sr.Null(t,0,e)}visitBool(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Bool(t,0,e,r,this.readNullBitmap(t,r),this.readData(t))}visitInt(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Int(t,0,e,r,this.readNullBitmap(t,r),this.readData(t))}visitFloat(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Float(t,0,e,r,this.readNullBitmap(t,r),this.readData(t))}visitUtf8(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Utf8(t,0,e,r,this.readNullBitmap(t,r),this.readOffsets(t),this.readData(t))}visitBinary(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Binary(t,0,e,r,this.readNullBitmap(t,r),this.readOffsets(t),this.readData(t))}visitFixedSizeBinary(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.FixedSizeBinary(t,0,e,r,this.readNullBitmap(t,r),this.readData(t))}visitDate(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Date(t,0,e,r,this.readNullBitmap(t,r),this.readData(t))}visitTimestamp(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Timestamp(t,0,e,r,this.readNullBitmap(t,r),this.readData(t))}visitTime(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Time(t,0,e,r,this.readNullBitmap(t,r),this.readData(t))}visitDecimal(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Decimal(t,0,e,r,this.readNullBitmap(t,r),this.readData(t))}visitList(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.List(t,0,e,r,this.readNullBitmap(t,r),this.readOffsets(t),this.visit(t.children[0]))}visitStruct(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Struct(t,0,e,r,this.readNullBitmap(t,r),this.visitMany(t.children))}visitUnion(t){return t.mode===ye.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Union(t,0,e,r,this.readNullBitmap(t,r),this.readTypeIds(t),this.readOffsets(t),this.visitMany(t.children))}visitSparseUnion(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Union(t,0,e,r,this.readNullBitmap(t,r),this.readTypeIds(t),this.visitMany(t.children))}visitDictionary(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Dictionary(t,0,e,r,this.readNullBitmap(t,r),this.readData(t.indices),this.readDictionary(t))}visitInterval(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Interval(t,0,e,r,this.readNullBitmap(t,r),this.readData(t))}visitFixedSizeList(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.FixedSizeList(t,0,e,r,this.readNullBitmap(t,r),this.visit(t.children[0]))}visitMap(t,{length:e,nullCount:r}=this.nextFieldNode()){return Sr.Map(t,0,e,r,this.readNullBitmap(t,r),this.readOffsets(t),this.visit(t.children[0]))}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,r=this.nextBufferRange()){return e>0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class fs extends ds{constructor(t,e,r,i){super(new Uint8Array(0),e,r,i),this.sources=t}readNullBitmap(t,e,{offset:r}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Se(this.sources[r])}readOffsets(t,{offset:e}=this.nextBufferRange()){return Wt(Uint8Array,Wt(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return Wt(Uint8Array,Wt(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:r}=this;return je.isTimestamp(t)||(je.isInt(t)||je.isTime(t))&&64===t.bitWidth||je.isDate(t)&&t.unit===de.MILLISECOND?Wt(Uint8Array,ls.convertArray(r[e])):je.isDecimal(t)?Wt(Uint8Array,hs.convertArray(r[e])):je.isBinary(t)||je.isFixedSizeBinary(t)?function(t){const e=t.join(""),r=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2)r[t>>1]=parseInt(e.substr(t,2),16);return r}(r[e]):je.isBool(t)?Se(r[e]):je.isUtf8(t)?_t(r[e].join("")):Wt(Uint8Array,Wt(t.ArrayType,r[e].map(t=>+t)))}}var ps=at.Long,ys=ce.apache.arrow.flatbuf.Null,bs=ce.apache.arrow.flatbuf.Int,gs=ce.apache.arrow.flatbuf.FloatingPoint,_s=ce.apache.arrow.flatbuf.Binary,ms=ce.apache.arrow.flatbuf.Bool,vs=ce.apache.arrow.flatbuf.Utf8,ws=ce.apache.arrow.flatbuf.Decimal,Is=ce.apache.arrow.flatbuf.Date,Ss=ce.apache.arrow.flatbuf.Time,Ts=ce.apache.arrow.flatbuf.Timestamp,Bs=ce.apache.arrow.flatbuf.Interval,As=ce.apache.arrow.flatbuf.List,Ds=ce.apache.arrow.flatbuf.Struct_,xs=ce.apache.arrow.flatbuf.Union,Ls=ce.apache.arrow.flatbuf.DictionaryEncoding,Os=ce.apache.arrow.flatbuf.FixedSizeBinary,Fs=ce.apache.arrow.flatbuf.FixedSizeList,Ms=ce.apache.arrow.flatbuf.Map;const Es=new class extends xe{visit(t,e){return null==t||null==e?void 0:super.visit(t,e)}visitNull(t,e){return ys.startNull(e),ys.endNull(e)}visitInt(t,e){return bs.startInt(e),bs.addBitWidth(e,t.bitWidth),bs.addIsSigned(e,t.isSigned),bs.endInt(e)}visitFloat(t,e){return gs.startFloatingPoint(e),gs.addPrecision(e,t.precision),gs.endFloatingPoint(e)}visitBinary(t,e){return _s.startBinary(e),_s.endBinary(e)}visitBool(t,e){return ms.startBool(e),ms.endBool(e)}visitUtf8(t,e){return vs.startUtf8(e),vs.endUtf8(e)}visitDecimal(t,e){return ws.startDecimal(e),ws.addScale(e,t.scale),ws.addPrecision(e,t.precision),ws.endDecimal(e)}visitDate(t,e){return Is.startDate(e),Is.addUnit(e,t.unit),Is.endDate(e)}visitTime(t,e){return Ss.startTime(e),Ss.addUnit(e,t.unit),Ss.addBitWidth(e,t.bitWidth),Ss.endTime(e)}visitTimestamp(t,e){const r=t.timezone&&e.createString(t.timezone)||void 0;return Ts.startTimestamp(e),Ts.addUnit(e,t.unit),void 0!==r&&Ts.addTimezone(e,r),Ts.endTimestamp(e)}visitInterval(t,e){return Bs.startInterval(e),Bs.addUnit(e,t.unit),Bs.endInterval(e)}visitList(t,e){return As.startList(e),As.endList(e)}visitStruct(t,e){return Ds.startStruct_(e),Ds.endStruct_(e)}visitUnion(t,e){xs.startTypeIdsVector(e,t.typeIds.length);const r=xs.createTypeIdsVector(e,t.typeIds);return xs.startUnion(e),xs.addMode(e,t.mode),xs.addTypeIds(e,r),xs.endUnion(e)}visitDictionary(t,e){const r=this.visit(t.indices,e);return Ls.startDictionaryEncoding(e),Ls.addId(e,new ps(t.id,0)),Ls.addIsOrdered(e,t.isOrdered),void 0!==r&&Ls.addIndexType(e,r),Ls.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Os.startFixedSizeBinary(e),Os.addByteWidth(e,t.byteWidth),Os.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Fs.startFixedSizeList(e),Fs.addListSize(e,t.listSize),Fs.endFixedSizeList(e)}visitMap(t,e){return Ms.startMap(e),Ms.addKeysSorted(e,t.keysSorted),Ms.endMap(e)}};function Us(t){return new Xs(t.count,function t(e){return(e||[]).reduce((e,r)=>{return[...e,new ra(r.count,(i=r.VALIDITY,(i||[]).reduce((t,e)=>t+ +(0===e),0))),...t(r.children)];var i},[])}(t.columns),function t(e,r=[]){for(let i=-1,n=(e||[]).length;++i<n;){const n=e[i];n.VALIDITY&&r.push(new ea(r.length,n.VALIDITY.length)),n.TYPE&&r.push(new ea(r.length,n.TYPE.length)),n.OFFSET&&r.push(new ea(r.length,n.OFFSET.length)),n.DATA&&r.push(new ea(r.length,n.DATA.length)),r=t(n.children,r)}return r}(t.columns))}function Ns(t,e){return(t.children||[]).filter(Boolean).map(t=>dn.fromJSON(t,e))}function Vs(t){return new Map(Object.entries(t||{}))}function Cs(t){return new Ye(t.isSigned,t.bitWidth)}function ks(t,e){const r=t.type.name;switch(r){case"NONE":case"null":return new $e;case"binary":return new ir;case"utf8":return new nr;case"bool":return new sr;case"list":return new fr((e||[])[0]);case"struct":case"struct_":return new pr(e||[])}switch(r){case"int":{const e=t.type;return new Ye(e.isSigned,e.bitWidth)}case"floatingpoint":{const e=t.type;return new Xe(pe[e.precision])}case"decimal":{const e=t.type;return new ar(e.scale,e.precision)}case"date":{const e=t.type;return new or(de[e.unit])}case"time":{const e=t.type;return new lr(fe[e.unit],e.bitWidth)}case"timestamp":{const e=t.type;return new hr(fe[e.unit],e.timezone)}case"interval":{const e=t.type;return new dr(be[e.unit])}case"union":{const r=t.type;return new yr(ye[r.mode],r.typeIds||[],e||[])}case"fixedsizebinary":{const e=t.type;return new br(e.byteWidth)}case"fixedsizelist":{const r=t.type;return new gr(r.listSize,(e||[])[0])}case"map":{const r=t.type;return new _r((e||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var Rs=at.Long,zs=at.Builder,js=at.ByteBuffer,Ps=ce.apache.arrow.flatbuf.Type,$s=ce.apache.arrow.flatbuf.Field,Ys=ce.apache.arrow.flatbuf.Schema,Ws=ce.apache.arrow.flatbuf.Buffer,Hs=ue.apache.arrow.flatbuf.Message,Ks=ce.apache.arrow.flatbuf.KeyValue,Gs=ue.apache.arrow.flatbuf.FieldNode,qs=ce.apache.arrow.flatbuf.Endianness,Js=ue.apache.arrow.flatbuf.RecordBatch,Zs=ue.apache.arrow.flatbuf.DictionaryBatch;class Qs{constructor(t,e,r,i){this._version=e,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength="number"==typeof t?t:t.low}static fromJSON(t,e){const r=new Qs(0,_e.V4,e);return r._createHeader=function(t,e){return()=>{switch(e){case ge.Schema:return hn.fromJSON(t);case ge.RecordBatch:return Xs.fromJSON(t);case ge.DictionaryBatch:return ta.fromJSON(t)}throw new Error(`Unrecognized Message type: { name: ${ge[e]}, type: ${e} }`)}}(t,e),r}static decode(t){t=new js(Gt(t));const e=Hs.getRootAsMessage(t),r=e.bodyLength(),i=e.version(),n=e.headerType(),s=new Qs(r,i,n);return s._createHeader=function(t,e){return()=>{switch(e){case ge.Schema:return hn.decode(t.header(new Ys));case ge.RecordBatch:return Xs.decode(t.header(new Js),t.version());case ge.DictionaryBatch:return ta.decode(t.header(new Zs),t.version())}throw new Error(`Unrecognized Message type: { name: ${ge[e]}, type: ${e} }`)}}(e,n),s}static encode(t){let e=new zs,r=-1;return t.isSchema()?r=hn.encode(e,t.header()):t.isRecordBatch()?r=Xs.encode(e,t.header()):t.isDictionaryBatch()&&(r=ta.encode(e,t.header())),Hs.startMessage(e),Hs.addVersion(e,_e.V4),Hs.addHeader(e,r),Hs.addHeaderType(e,t.headerType),Hs.addBodyLength(e,new Rs(t.bodyLength,0)),Hs.finishMessageBuffer(e,Hs.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof hn)return new Qs(0,_e.V4,ge.Schema,t);if(t instanceof Xs)return new Qs(e,_e.V4,ge.RecordBatch,t);if(t instanceof ta)return new Qs(e,_e.V4,ge.DictionaryBatch,t);throw new Error("Unrecognized Message header: "+t)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===ge.Schema}isRecordBatch(){return this.headerType===ge.RecordBatch}isDictionaryBatch(){return this.headerType===ge.DictionaryBatch}}class Xs{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,r){this._nodes=e,this._buffers=r,this._length="number"==typeof t?t:t.low}}class ta{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,r=!1){this._data=t,this._isDelta=r,this._id="number"==typeof e?e:e.low}}class ea{constructor(t,e){this.offset="number"==typeof t?t:t.low,this.length="number"==typeof e?e:e.low}}class ra{constructor(t,e){this.length="number"==typeof t?t:t.low,this.nullCount="number"==typeof e?e:e.low}}function ia(t,e){const r=[];for(let i,n=-1,s=-1,a=t.childrenLength();++n<a;)(i=t.children(n))&&(r[++s]=dn.decode(i,e));return r}function na(t){const e=new Map;if(t)for(let r,i,n=-1,s=0|t.customMetadataLength();++n<s;)(r=t.customMetadata(n))&&null!=(i=r.key())&&e.set(i,r.value());return e}function sa(t){return new Ye(t.isSigned(),t.bitWidth())}function aa(t,e){const r=t.typeType();switch(r){case Ps.NONE:case Ps.Null:return new $e;case Ps.Binary:return new ir;case Ps.Utf8:return new nr;case Ps.Bool:return new sr;case Ps.List:return new fr((e||[])[0]);case Ps.Struct_:return new pr(e||[])}switch(r){case Ps.Int:{const e=t.type(new ce.apache.arrow.flatbuf.Int);return new Ye(e.isSigned(),e.bitWidth())}case Ps.FloatingPoint:{const e=t.type(new ce.apache.arrow.flatbuf.FloatingPoint);return new Xe(e.precision())}case Ps.Decimal:{const e=t.type(new ce.apache.arrow.flatbuf.Decimal);return new ar(e.scale(),e.precision())}case Ps.Date:{const e=t.type(new ce.apache.arrow.flatbuf.Date);return new or(e.unit())}case Ps.Time:{const e=t.type(new ce.apache.arrow.flatbuf.Time);return new lr(e.unit(),e.bitWidth())}case Ps.Timestamp:{const e=t.type(new ce.apache.arrow.flatbuf.Timestamp);return new hr(e.unit(),e.timezone())}case Ps.Interval:{const e=t.type(new ce.apache.arrow.flatbuf.Interval);return new dr(e.unit())}case Ps.Union:{const r=t.type(new ce.apache.arrow.flatbuf.Union);return new yr(r.mode(),r.typeIdsArray()||[],e||[])}case Ps.FixedSizeBinary:{const e=t.type(new ce.apache.arrow.flatbuf.FixedSizeBinary);return new br(e.byteWidth())}case Ps.FixedSizeList:{const r=t.type(new ce.apache.arrow.flatbuf.FixedSizeList);return new gr(r.listSize(),(e||[])[0])}case Ps.Map:{const r=t.type(new ce.apache.arrow.flatbuf.Map);return new _r((e||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${Ps[r]}" (${r})`)}dn.encode=function(t,e){let r=-1,i=-1,n=-1,s=e.type,a=e.typeId;je.isDictionary(s)?(a=s.dictionary.typeId,n=Es.visit(s,t),i=Es.visit(s.dictionary,t)):i=Es.visit(s,t);const o=(s.children||[]).map(e=>dn.encode(t,e)),c=$s.createChildrenVector(t,o),u=e.metadata&&e.metadata.size>0?$s.createCustomMetadataVector(t,[...e.metadata].map(([e,r])=>{const i=t.createString(""+e),n=t.createString(""+r);return Ks.startKeyValue(t),Ks.addKey(t,i),Ks.addValue(t,n),Ks.endKeyValue(t)})):-1;e.name&&(r=t.createString(e.name));$s.startField(t),$s.addType(t,i),$s.addTypeType(t,a),$s.addChildren(t,c),$s.addNullable(t,!!e.nullable),-1!==r&&$s.addName(t,r);-1!==n&&$s.addDictionary(t,n);-1!==u&&$s.addCustomMetadata(t,u);return $s.endField(t)},dn.decode=function(t,e){let r,i,n,s,a,o;e&&(o=t.dictionary())?e.has(r=o.id().low)?(s=(s=o.indexType())?sa(s):new Ke,a=new wr(e.get(r),s,r,o.isOrdered()),i=new dn(t.name(),a,t.nullable(),na(t))):(s=(s=o.indexType())?sa(s):new Ke,e.set(r,n=aa(t,ia(t,e))),a=new wr(n,s,r,o.isOrdered()),i=new dn(t.name(),a,t.nullable(),na(t))):(n=aa(t,ia(t,e)),i=new dn(t.name(),n,t.nullable(),na(t)));return i||null},dn.fromJSON=function(t,e){let r,i,n,s,a,o;return e&&(s=t.dictionary)?e.has(r=s.id)?(i=(i=s.indexType)?Cs(i):new Ke,o=new wr(e.get(r),i,r,s.isOrdered),n=new dn(t.name,o,t.nullable,Vs(t.customMetadata))):(i=(i=s.indexType)?Cs(i):new Ke,e.set(r,a=ks(t,Ns(t,e))),o=new wr(a,i,r,s.isOrdered),n=new dn(t.name,o,t.nullable,Vs(t.customMetadata))):(a=ks(t,Ns(t,e)),n=new dn(t.name,a,t.nullable,Vs(t.customMetadata))),n||null},hn.encode=function(t,e){const r=e.fields.map(e=>dn.encode(t,e));Ys.startFieldsVector(t,r.length);const i=Ys.createFieldsVector(t,r),n=e.metadata&&e.metadata.size>0?Ys.createCustomMetadataVector(t,[...e.metadata].map(([e,r])=>{const i=t.createString(""+e),n=t.createString(""+r);return Ks.startKeyValue(t),Ks.addKey(t,i),Ks.addValue(t,n),Ks.endKeyValue(t)})):-1;Ys.startSchema(t),Ys.addFields(t,i),Ys.addEndianness(t,oa?qs.Little:qs.Big),-1!==n&&Ys.addCustomMetadata(t,n);return Ys.endSchema(t)},hn.decode=function(t,e=new Map){const r=function(t,e){const r=[];for(let i,n=-1,s=-1,a=t.fieldsLength();++n<a;)(i=t.fields(n))&&(r[++s]=dn.decode(i,e));return r}(t,e);return new hn(r,na(t),e)},hn.fromJSON=function(t,e=new Map){return new hn(function(t,e){return(t.fields||[]).filter(Boolean).map(t=>dn.fromJSON(t,e))}(t,e),Vs(t.customMetadata),e)},Xs.encode=function(t,e){const r=e.nodes||[],i=e.buffers||[];Js.startNodesVector(t,r.length),r.slice().reverse().forEach(e=>ra.encode(t,e));const n=t.endVector();Js.startBuffersVector(t,i.length),i.slice().reverse().forEach(e=>ea.encode(t,e));const s=t.endVector();return Js.startRecordBatch(t),Js.addLength(t,new Rs(e.length,0)),Js.addNodes(t,n),Js.addBuffers(t,s),Js.endRecordBatch(t)},Xs.decode=function(t,e=_e.V4){return new Xs(t.length(),function(t){const e=[];for(let r,i=-1,n=-1,s=t.nodesLength();++i<s;)(r=t.nodes(i))&&(e[++n]=ra.decode(r));return e}(t),function(t,e){const r=[];for(let i,n=-1,s=-1,a=t.buffersLength();++n<a;)(i=t.buffers(n))&&(e<_e.V4&&(i.bb_pos+=8*(n+1)),r[++s]=ea.decode(i));return r}(t,e))},Xs.fromJSON=Us,ta.encode=function(t,e){const r=Xs.encode(t,e.data);return Zs.startDictionaryBatch(t),Zs.addId(t,new Rs(e.id,0)),Zs.addIsDelta(t,e.isDelta),Zs.addData(t,r),Zs.endDictionaryBatch(t)},ta.decode=function(t,e=_e.V4){return new ta(Xs.decode(t.data(),e),t.id(),t.isDelta())},ta.fromJSON=function(t){return new ta(Us(t.data),t.id,t.isDelta)},ra.encode=function(t,e){return Gs.createFieldNode(t,new Rs(e.length,0),new Rs(e.nullCount,0))},ra.decode=function(t){return new ra(t.length(),t.nullCount())},ea.encode=function(t,e){return Ws.createBuffer(t,new Rs(e.offset,0),new Rs(e.length,0))},ea.decode=function(t){return new ea(t.offset(),t.length())};const oa=function(){const t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),256===new Int16Array(t)[0]}();var ca=at.ByteBuffer;const ua=t=>`Expected ${ge[t]} Message in stream, but was null or length 0.`,la=t=>`Header pointer of flatbuffer-encoded ${ge[t]} Message is null or length 0.`,ha=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,da=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`;class fa{constructor(t){this.source=t instanceof ts?t:new ts(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||-1===t.value&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?mt:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(ua(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=Gt(this.source.read(t));if(e.byteLength<t)throw new Error(da(t,e.byteLength));return e.byteOffset%8==0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){const e=ge.Schema,r=this.readMessage(e),i=r&&r.header();if(t&&!i)throw new Error(la(e));return i}readMetadataLength(){const t=this.source.read(ba),e=t&&new ca(t),r=e&&e.readInt32(0)||0;return{done:0===r,value:r}}readMetadata(t){const e=this.source.read(t);if(!e)return mt;if(e.byteLength<t)throw new Error(ha(t,e.byteLength));return{done:!1,value:Qs.decode(e)}}}class pa{constructor(t,e){this.source=t instanceof es?t:Ct(t)?new ss(t,e):new es(t)}[Symbol.asyncIterator](){return this}async next(){let t;return(t=await this.readMetadataLength()).done||-1===t.value&&(t=await this.readMetadataLength()).done||(t=await this.readMetadata(t.value)).done?mt:t}async throw(t){return await this.source.throw(t)}async return(t){return await this.source.return(t)}async readMessage(t){let e;if((e=await this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(ua(t));return e.value}async readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=Gt(await this.source.read(t));if(e.byteLength<t)throw new Error(da(t,e.byteLength));return e.byteOffset%8==0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}async readSchema(t=!1){const e=ge.Schema,r=await this.readMessage(e),i=r&&r.header();if(t&&!i)throw new Error(la(e));return i}async readMetadataLength(){const t=await this.source.read(ba),e=t&&new ca(t),r=e&&e.readInt32(0)||0;return{done:0===r,value:r}}async readMetadata(t){const e=await this.source.read(t);if(!e)return mt;if(e.byteLength<t)throw new Error(ha(t,e.byteLength));return{done:!1,value:Qs.decode(e)}}}class ya extends fa{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof vt?t:new vt(t)}next(){const{_json:t}=this;if(!this._schema){this._schema=!0;return{done:!1,value:Qs.fromJSON(t.schema,ge.Schema)}}if(this._dictionaryIndex<t.dictionaries.length){const e=t.dictionaries[this._dictionaryIndex++];this._body=e.data.columns;return{done:!1,value:Qs.fromJSON(e,ge.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const e=t.batches[this._batchIndex++];this._body=e.columns;return{done:!1,value:Qs.fromJSON(e,ge.RecordBatch)}}return this._body=[],mt}readMessageBody(t){return function t(e){return(e||[]).reduce((e,r)=>[...e,...r.VALIDITY&&[r.VALIDITY]||[],...r.TYPE&&[r.TYPE]||[],...r.OFFSET&&[r.OFFSET]||[],...r.DATA&&[r.DATA]||[],...t(r.children)],[])}(this._body)}readMessage(t){let e;if((e=this.next()).done)return null;if(null!=t&&e.value.headerType!==t)throw new Error(ua(t));return e.value}readSchema(){const t=ge.Schema,e=this.readMessage(t),r=e&&e.header();if(!e||!r)throw new Error(la(t));return r}}const ba=4,ga=new Uint8Array("ARROW1".length);for(let t=0;t<"ARROW1".length;t+=1)ga[t]="ARROW1".charCodeAt(t);function _a(t,e=0){for(let r=-1,i=ga.length;++r<i;)if(ga[r]!==t[e+r])return!1;return!0}const ma=ga.length,va=ma+ba,wa=2*ma+ba;class Ia extends xe{constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}static assemble(...t){const e=new Ia,r=on(wc,t),[i=e]=e.visitMany(r);return i}visit(t){if(!je.isDictionary(t.type)){const{data:e,length:r,nullCount:i}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");je.isNull(t.type)||Sa.call(this,i<=0?new Uint8Array(0):Ie(e.offset,r,e.nullBitmap)),this.nodes.push(new ra(r,i))}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.indices)}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function Sa(t){const e=t.byteLength+7&-8;return this.buffers.push(t),this.bufferRegions.push(new ea(this._byteLength,e)),this._byteLength+=e,this}function Ta(t){return Sa.call(this,t.values.subarray(0,t.length*t.stride))}function Ba(t){const{length:e,values:r,valueOffsets:i}=t,n=i[0],s=i[e],a=Math.min(s-n,r.byteLength-n);return Sa.call(this,ee(-i[0],e,i)),Sa.call(this,r.subarray(n,n+a)),this}function Aa(t){const{length:e,valueOffsets:r}=t;return r&&Sa.call(this,ee(r[0],e,r)),this.visit(t.getChildAt(0))}function Da(t){return this.visitMany(t.type.children.map((e,r)=>t.getChildAt(r)).filter(Boolean))[0]}Ia.prototype.visitBool=function(t){let e;return t.nullCount>=t.length?Sa.call(this,new Uint8Array(0)):(e=t.values)instanceof Uint8Array?Sa.call(this,Ie(t.offset,t.length,e)):Sa.call(this,Se(t))},Ia.prototype.visitInt=Ta,Ia.prototype.visitFloat=Ta,Ia.prototype.visitUtf8=Ba,Ia.prototype.visitBinary=Ba,Ia.prototype.visitFixedSizeBinary=Ta,Ia.prototype.visitDate=Ta,Ia.prototype.visitTimestamp=Ta,Ia.prototype.visitTime=Ta,Ia.prototype.visitDecimal=Ta,Ia.prototype.visitList=Aa,Ia.prototype.visitStruct=Da,Ia.prototype.visitUnion=function(t){const{type:e,length:r,typeIds:i,valueOffsets:n}=t;if(Sa.call(this,i),e.mode===ye.Sparse)return Da.call(this,t);if(e.mode===ye.Dense){if(t.offset<=0)return Sa.call(this,n),Da.call(this,t);{const s=i.reduce((t,e)=>Math.max(t,e),i[0]),a=new Int32Array(s+1),o=new Int32Array(s+1).fill(-1),c=new Int32Array(r),u=ee(-n[0],r,n);for(let t,e,n=-1;++n<r;)-1===(e=o[t=i[n]])&&(e=o[t]=u[t]),c[n]=u[n]-e,++a[t];Sa.call(this,c);for(let i,n=-1,s=e.children.length;++n<s;)if(i=t.getChildAt(n)){const t=e.typeIds[n],s=Math.min(r,a[t]);this.visit(i.slice(o[t],s))}}}return this},Ia.prototype.visitInterval=Ta,Ia.prototype.visitFixedSizeList=Aa,Ia.prototype.visitMap=Aa;class xa extends wt{constructor(t){super(),this._position=0,this._started=!1,this._sink=new Xn,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Ft(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy="boolean"!=typeof t.autoDestroy||t.autoDestroy,this._writeLegacyIpcFormat="boolean"==typeof t.writeLegacyIpcFormat&&t.writeLegacyIpcFormat}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Mt(t)?t.then(t=>this.writeAll(t)):Ut(t)?Ma(this,t):Fa(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){var r;return t===this._sink||t instanceof Xn?this._sink=t:(this._sink=new Xn,t&&(Ft(r=t)&&Ot(r.abort)&&Ot(r.getWriter)&&!(r instanceof wt))?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&(t=>Ft(t)&&Ot(t.end)&&Ot(t.write)&&Lt(t.writable)&&!(t instanceof wt))(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,e&&e.compareTo(this._schema)||(null===e?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(!this._sink)throw new Error("RecordBatchWriter is closed");if(null==t)return this.finish()&&void 0;if(t instanceof vc&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof wc&&!(e=t.schema))return this.finish()&&void 0;if(e&&!e.compareTo(this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof wc?t instanceof Ic||this._writeRecordBatch(t):t instanceof vc?this.writeAll(t.chunks):Et(t)&&this.writeAll(t)}_writeMessage(t,e=8){const r=e-1,i=Qs.encode(t),n=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=n+s+r&~r,o=a-n-s;return t.headerType===ge.RecordBatch?this._recordBatchBlocks.push(new Qn(a,t.bodyLength,this._position)):t.headerType===ge.DictionaryBatch&&this._dictionaryBlocks.push(new Qn(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),n>0&&this._write(i),this._writePadding(o)}_write(t){if(this._started){const e=Gt(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(Qs.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ga)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:e,nodes:r,bufferRegions:i,buffers:n}=Ia.assemble(t),s=new Xs(t.length,r,i),a=Qs.from(s,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(n)}_writeDictionaryBatch(t,e,r=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));const{byteLength:i,nodes:n,bufferRegions:s,buffers:a}=Ia.assemble(t),o=new Xs(t.length,n,s),c=new ta(o,e,r),u=Qs.from(c,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,r,i;for(let n=-1,s=t.length;++n<s;)(e=t[n])&&(r=e.byteLength)>0&&(this._write(e),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[e,r]of t.dictionaries){let t=this._dictionaryDeltaOffsets.get(e)||0;if(0===t||(r=r.slice(t)).length>0){const i="chunks"in r?r.chunks:[r];for(const r of i)this._writeDictionaryBatch(r,e,t>0),t+=r.length}}return this}}class La extends xa{static writeAll(t,e){const r=new La(e);return Mt(t)?t.then(t=>r.writeAll(t)):Ut(t)?Ma(r,t):Fa(r,t)}}class Oa extends xa{constructor(){super(),this._autoDestroy=!0}static writeAll(t){const e=new Oa;return Mt(t)?t.then(t=>e.writeAll(t)):Ut(t)?Ma(e,t):Fa(e,t)}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){const e=Jn.encode(new Jn(t,_e.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}function Fa(t,e){let r=e;e instanceof vc&&(r=e.chunks,t.reset(void 0,e.schema));for(const e of r)t.write(e);return t.finish()}async function Ma(t,e){for await(const r of e)t.write(r);return t.finish()}const Ea=new Uint8Array(0),Ua=t=>[Ea,Ea,new Uint8Array(t),Ea];function Na(t,e){return function(t,e){const r=[...t.fields],i=[],n={numBatches:e.reduce((t,e)=>Math.max(t,e.length),0)};let s,a=0,o=0,c=-1,u=e.length,l=[];for(;n.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,c=-1;++c<u;)l[c]=s=e[c].shift(),o=Math.min(o,s?s.length:o);isFinite(o)&&(l=Va(r,o,l,e,n),o>0&&(i[a++]=[o,l.slice()]))}return[t=new hn(r,t.metadata),i.map(e=>new wc(t,...e))]}(t,e.map(t=>t instanceof Zi?t.chunks.map(t=>t.data):[t.data]))}function Va(t,e,r,i,n){let s,a,o=0,c=-1,u=i.length;const l=(e+63&-64)>>3;for(;++c<u;)(s=r[c])&&(o=s.length)>=e?o===e?r[c]=s:(r[c]=s.slice(0,e),s=s.slice(e,o-e),n.numBatches=Math.max(n.numBatches,i[c].unshift(s))):((a=t[c]).nullable||(t[c]=a.clone({nullable:!0})),r[c]=s?s._changeLengthAndBackfillNullBitmap(e):Sr.new(a.type,0,e,e,Ua(l)));return r}class Ca extends oe{constructor(t,e){super(),this._children=e,this.numChildren=t.childData.length,this._bindDataAccessors(this.data=t)}get type(){return this.data.type}get typeId(){return this.data.typeId}get length(){return this.data.length}get offset(){return this.data.offset}get stride(){return this.data.stride}get nullCount(){return this.data.nullCount}get byteLength(){return this.data.byteLength}get VectorName(){return le[this.typeId]+"Vector"}get ArrayType(){return this.type.ArrayType}get values(){return this.data.values}get typeIds(){return this.data.typeIds}get nullBitmap(){return this.data.nullBitmap}get valueOffsets(){return this.data.valueOffsets}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}clone(t,e=this._children){return oe.new(t,e)}concat(...t){return Zi.concat(this,...t)}slice(t,e){return Wi(this,t,e,this._sliceInternal)}isValid(t){if(this.nullCount>0){const e=this.offset+t;return 0!==(this.nullBitmap[e>>3]&1<<e%8)}return!0}getChildAt(t){return t<0||t>=this.numChildren?null:(this._children||(this._children=[]))[t]||(this._children[t]=oe.new(this.data.childData[t]))}toJSON(){return[...this]}_sliceInternal(t,e,r){return t.clone(t.data.slice(e,r-e),null)}_bindDataAccessors(t){}}Ca.prototype[Symbol.isConcatSpreadable]=!0;class ka extends Ca{asUtf8(){return oe.new(this.data.clone(new nr))}}class Ra extends Ca{static from(t){return mc(()=>new sr,t)}}class za extends Ca{static from(...t){return 2===t.length?mc(()=>t[1]===de.DAY?new cr:new ur,t[0]):mc(()=>new ur,t[0])}}class ja extends za{}class Pa extends za{}class $a extends Ca{}class Ya extends Ca{constructor(t){super(t),this.indices=oe.new(t.clone(this.type.indices))}static from(...t){if(3===t.length){const[e,r,i]=t,n=new wr(e.type,r,null,null);return oe.new(Sr.Dictionary(n,0,i.length,0,null,i,e))}return mc(()=>t[0].type,t[0])}get dictionary(){return this.data.dictionary}reverseLookup(t){return this.dictionary.indexOf(t)}getKey(t){return this.indices.get(t)}getValue(t){return this.dictionary.get(t)}setKey(t,e){return this.indices.set(t,e)}setValue(t,e){return this.dictionary.set(t,e)}}Ya.prototype.indices=null;class Wa extends Ca{}class Ha extends Ca{}class Ka extends Ca{static from(t){let e=Xa(this);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){let r=Qa(t.constructor)||e;if(null===e&&(e=r),e&&e===r){let r=new e,i=t.byteLength/r.ArrayType.BYTES_PER_ELEMENT;if(!Za(e,t.constructor))return oe.new(Sr.Float(r,0,i,0,null,t))}}if(e)return mc(()=>new e,t);if(t instanceof DataView||t instanceof ArrayBuffer)throw new TypeError("Cannot infer float type from instance of "+t.constructor.name);throw new TypeError("Unrecognized FloatVector input")}}class Ga extends Ka{toFloat32Array(){return new Float32Array(this)}toFloat64Array(){return new Float64Array(this)}}class qa extends Ka{}class Ja extends Ka{}const Za=(t,e)=>t===tr&&e!==Uint16Array,Qa=t=>{switch(t){case Uint16Array:return tr;case Float32Array:return er;case Float64Array:return rr;default:return null}},Xa=t=>{switch(t){case Ga:return tr;case qa:return er;case Ja:return rr;default:return null}};class to extends Ca{}class eo extends to{}class ro extends to{}class io extends Ca{static from(...t){let[e,r=!1]=t,i=yo(this,r);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)){let t=po(e.constructor,r)||i;if(null===i&&(i=t),i&&i===t){let t=new i,r=e.byteLength/t.ArrayType.BYTES_PER_ELEMENT;return fo(i,e.constructor)&&(r*=.5),oe.new(Sr.Int(t,0,r,0,null,e))}}if(i)return mc(()=>new i,e);if(e instanceof DataView||e instanceof ArrayBuffer)throw new TypeError("Cannot infer integer type from instance of "+e.constructor.name);throw new TypeError("Unrecognized IntVector input")}}class no extends io{}class so extends io{}class ao extends io{}class oo extends io{toBigInt64Array(){return Kt(this.values)}get values64(){return this._values64||(this._values64=this.toBigInt64Array())}}class co extends io{}class uo extends io{}class lo extends io{}class ho extends io{toBigUint64Array(){return qt(this.values)}get values64(){return this._values64||(this._values64=this.toBigUint64Array())}}const fo=(t,e)=>!(t!==Ge&&t!==Qe||e!==Int32Array&&e!==Uint32Array),po=(t,e)=>{switch(t){case Int8Array:return We;case Int16Array:return He;case Int32Array:return e?Ge:Ke;case Bt:return Ge;case Uint8Array:return qe;case Uint16Array:return Je;case Uint32Array:return e?Qe:Ze;case Dt:return Qe;default:return null}},yo=(t,e)=>{switch(t){case no:return We;case so:return He;case ao:return e?Ge:Ke;case oo:return Ge;case co:return qe;case uo:return Je;case lo:return e?Qe:Ze;case ho:return Qe;default:return null}};class bo extends Ca{}class go extends Ca{asList(){const t=this.type.children[0];return oe.new(this.data.clone(new fr(t)))}bind(t){const e=this.getChildAt(0),{[t]:r,[t+1]:i}=this.valueOffsets;return new zi(e.slice(r,i))}}class _o extends Ca{}const mo=Symbol.for("rowIndex");class vo extends Ca{bind(t){const e=this._row||(this._row=new ji(this)),r=Object.create(e);return r[mo]=t,r}}class wo extends Ca{}class Io extends wo{}class So extends wo{}class To extends wo{}class Bo extends wo{}class Ao extends Ca{}class Do extends Ao{}class xo extends Ao{}class Lo extends Ao{}class Oo extends Ao{}class Fo extends Ca{get typeIdToChildIndex(){return this.data.type.typeIdToChildIndex}}class Mo extends Fo{get valueOffsets(){return this.data.valueOffsets}}class Eo extends Fo{}class Uo extends Ca{static from(t){return mc(()=>new nr,t)}asBinary(){return oe.new(this.data.clone(new ir))}}function No(t){return function(){return t(this)}}function Vo(t){return function(e,r){return t(this,e,r)}}class Co extends xe{}const ko=(t,e)=>4294967296*t[e+1]+(t[e]>>>0),Ro=t=>new Date(t),zo=(t,e,r)=>{const{[r]:i,[r+1]:n}=e;return null!=i&&null!=n?t.subarray(i,n):null},jo=({values:t},e)=>((t,e)=>Ro(((t,e)=>864e5*t[e])(t,e)))(t,e),Po=({values:t},e)=>((t,e)=>Ro(ko(t,e)))(t,2*e),$o=({stride:t,values:e},r)=>e[t*r],Yo=({stride:t,values:e},r)=>Wr(e[t*r]),Wo=({stride:t,values:e,type:r},i)=>ai.new(e.subarray(t*i,t*(i+1)),r.isSigned),Ho=({values:t},e)=>1e3*ko(t,2*e),Ko=({values:t},e)=>ko(t,2*e),Go=({values:t},e)=>((t,e)=>t[e+1]/1e3*4294967296+(t[e]>>>0)/1e3)(t,2*e),qo=({values:t},e)=>((t,e)=>t[e+1]/1e6*4294967296+(t[e]>>>0)/1e6)(t,2*e),Jo=({values:t,stride:e},r)=>t[e*r],Zo=({values:t,stride:e},r)=>t[e*r],Qo=({values:t},e)=>ai.signed(t.subarray(2*e,2*(e+1))),Xo=({values:t},e)=>ai.signed(t.subarray(2*e,2*(e+1))),tc=(t,e)=>{const r=t.typeIdToChildIndex[t.typeIds[e]],i=t.getChildAt(r);return i?i.get(t.valueOffsets[e]):null},ec=(t,e)=>{const r=t.typeIdToChildIndex[t.typeIds[e]],i=t.getChildAt(r);return i?i.get(e):null},rc=({values:t},e)=>t.subarray(2*e,2*(e+1)),ic=({values:t},e)=>{const r=t[e],i=new Int32Array(2);return i[0]=r/12|0,i[1]=r%12|0,i};Co.prototype.visitNull=(t,e)=>null,Co.prototype.visitBool=({offset:t,values:e},r)=>{const i=t+r;return 0!=(e[i>>3]&1<<i%8)},Co.prototype.visitInt=(t,e)=>t.type.bitWidth<64?$o(t,e):Wo(t,e),Co.prototype.visitInt8=$o,Co.prototype.visitInt16=$o,Co.prototype.visitInt32=$o,Co.prototype.visitInt64=Wo,Co.prototype.visitUint8=$o,Co.prototype.visitUint16=$o,Co.prototype.visitUint32=$o,Co.prototype.visitUint64=Wo,Co.prototype.visitFloat=(t,e)=>t.type.precision!==pe.HALF?$o(t,e):Yo(t,e),Co.prototype.visitFloat16=Yo,Co.prototype.visitFloat32=$o,Co.prototype.visitFloat64=$o,Co.prototype.visitUtf8=({values:t,valueOffsets:e},r)=>{const i=zo(t,e,r);return null!==i?gt(i):null},Co.prototype.visitBinary=({values:t,valueOffsets:e},r)=>zo(t,e,r),Co.prototype.visitFixedSizeBinary=({stride:t,values:e},r)=>e.subarray(t*r,t*(r+1)),Co.prototype.visitDate=(t,e)=>t.type.unit===de.DAY?jo(t,e):Po(t,e),Co.prototype.visitDateDay=jo,Co.prototype.visitDateMillisecond=Po,Co.prototype.visitTimestamp=(t,e)=>{switch(t.type.unit){case fe.SECOND:return Ho(t,e);case fe.MILLISECOND:return Ko(t,e);case fe.MICROSECOND:return Go(t,e);case fe.NANOSECOND:return qo(t,e)}},Co.prototype.visitTimestampSecond=Ho,Co.prototype.visitTimestampMillisecond=Ko,Co.prototype.visitTimestampMicrosecond=Go,Co.prototype.visitTimestampNanosecond=qo,Co.prototype.visitTime=(t,e)=>{switch(t.type.unit){case fe.SECOND:return Jo(t,e);case fe.MILLISECOND:return Zo(t,e);case fe.MICROSECOND:return Qo(t,e);case fe.NANOSECOND:return Xo(t,e)}},Co.prototype.visitTimeSecond=Jo,Co.prototype.visitTimeMillisecond=Zo,Co.prototype.visitTimeMicrosecond=Qo,Co.prototype.visitTimeNanosecond=Xo,Co.prototype.visitDecimal=({values:t},e)=>ai.decimal(t.subarray(4*e,4*(e+1))),Co.prototype.visitList=(t,e)=>{const r=t.getChildAt(0),{valueOffsets:i,stride:n}=t;return r.slice(i[e*n],i[e*n+1])},Co.prototype.visitStruct=(t,e)=>t.bind(e),Co.prototype.visitUnion=(t,e)=>t.type.mode===ye.Dense?tc(t,e):ec(t,e),Co.prototype.visitDenseUnion=tc,Co.prototype.visitSparseUnion=ec,Co.prototype.visitDictionary=(t,e)=>t.getValue(t.getKey(e)),Co.prototype.visitInterval=(t,e)=>t.type.unit===be.DAY_TIME?rc(t,e):ic(t,e),Co.prototype.visitIntervalDayTime=rc,Co.prototype.visitIntervalYearMonth=ic,Co.prototype.visitFixedSizeList=(t,e)=>{const r=t.getChildAt(0),{stride:i}=t;return r.slice(e*i,(e+1)*i)},Co.prototype.visitMap=(t,e)=>t.bind(e);const nc=new Co;class sc extends xe{}function ac(t,e,r){if(void 0===e)return-1;if(null===e)return function(t,e){const{nullBitmap:r}=t;if(!r||t.nullCount<=0)return-1;let i=0;for(const n of Te(r,t.data.offset+(e||0),t.length,r,me)){if(!n)return i;++i}return-1}(t,r);const i=Gi(e);for(let e=(r||0)-1,n=t.length;++e<n;)if(i(t.get(e)))return e;return-1}function oc(t,e,r){const i=Gi(e);for(let e=(r||0)-1,n=t.length;++e<n;)if(i(t.get(e)))return e;return-1}sc.prototype.visitNull=function(t,e){return null===e&&t.length>0?0:-1},sc.prototype.visitBool=ac,sc.prototype.visitInt=ac,sc.prototype.visitInt8=ac,sc.prototype.visitInt16=ac,sc.prototype.visitInt32=ac,sc.prototype.visitInt64=ac,sc.prototype.visitUint8=ac,sc.prototype.visitUint16=ac,sc.prototype.visitUint32=ac,sc.prototype.visitUint64=ac,sc.prototype.visitFloat=ac,sc.prototype.visitFloat16=ac,sc.prototype.visitFloat32=ac,sc.prototype.visitFloat64=ac,sc.prototype.visitUtf8=ac,sc.prototype.visitBinary=ac,sc.prototype.visitFixedSizeBinary=ac,sc.prototype.visitDate=ac,sc.prototype.visitDateDay=ac,sc.prototype.visitDateMillisecond=ac,sc.prototype.visitTimestamp=ac,sc.prototype.visitTimestampSecond=ac,sc.prototype.visitTimestampMillisecond=ac,sc.prototype.visitTimestampMicrosecond=ac,sc.prototype.visitTimestampNanosecond=ac,sc.prototype.visitTime=ac,sc.prototype.visitTimeSecond=ac,sc.prototype.visitTimeMillisecond=ac,sc.prototype.visitTimeMicrosecond=ac,sc.prototype.visitTimeNanosecond=ac,sc.prototype.visitDecimal=ac,sc.prototype.visitList=ac,sc.prototype.visitStruct=ac,sc.prototype.visitUnion=ac,sc.prototype.visitDenseUnion=oc,sc.prototype.visitSparseUnion=oc,sc.prototype.visitDictionary=ac,sc.prototype.visitInterval=ac,sc.prototype.visitIntervalDayTime=ac,sc.prototype.visitIntervalYearMonth=ac,sc.prototype.visitFixedSizeList=ac,sc.prototype.visitMap=ac;const cc=new sc;class uc extends xe{}function lc(t){if(t.nullCount>0)return function(t){const e=nc.getVisitFn(t);return Te(t.nullBitmap,t.offset,t.length,t,(t,r,i,n)=>0!=(i&1<<n)?e(t,r):null)}(t);const{type:e,typeId:r,length:i}=t;return 1===t.stride&&(r===le.Timestamp||r===le.Int&&64!==e.bitWidth||r===le.Time&&64!==e.bitWidth||r===le.Float&&e.precision>0)?t.values.subarray(0,i)[Symbol.iterator]():function*(e){for(let r=-1;++r<i;)yield e(t,r)}(nc.getVisitFn(t))}uc.prototype.visitNull=lc,uc.prototype.visitBool=lc,uc.prototype.visitInt=lc,uc.prototype.visitInt8=lc,uc.prototype.visitInt16=lc,uc.prototype.visitInt32=lc,uc.prototype.visitInt64=lc,uc.prototype.visitUint8=lc,uc.prototype.visitUint16=lc,uc.prototype.visitUint32=lc,uc.prototype.visitUint64=lc,uc.prototype.visitFloat=lc,uc.prototype.visitFloat16=lc,uc.prototype.visitFloat32=lc,uc.prototype.visitFloat64=lc,uc.prototype.visitUtf8=lc,uc.prototype.visitBinary=lc,uc.prototype.visitFixedSizeBinary=lc,uc.prototype.visitDate=lc,uc.prototype.visitDateDay=lc,uc.prototype.visitDateMillisecond=lc,uc.prototype.visitTimestamp=lc,uc.prototype.visitTimestampSecond=lc,uc.prototype.visitTimestampMillisecond=lc,uc.prototype.visitTimestampMicrosecond=lc,uc.prototype.visitTimestampNanosecond=lc,uc.prototype.visitTime=lc,uc.prototype.visitTimeSecond=lc,uc.prototype.visitTimeMillisecond=lc,uc.prototype.visitTimeMicrosecond=lc,uc.prototype.visitTimeNanosecond=lc,uc.prototype.visitDecimal=lc,uc.prototype.visitList=lc,uc.prototype.visitStruct=lc,uc.prototype.visitUnion=lc,uc.prototype.visitDenseUnion=lc,uc.prototype.visitSparseUnion=lc,uc.prototype.visitDictionary=lc,uc.prototype.visitInterval=lc,uc.prototype.visitIntervalDayTime=lc,uc.prototype.visitIntervalYearMonth=lc,uc.prototype.visitFixedSizeList=lc,uc.prototype.visitMap=lc;const hc=new uc;class dc extends xe{}function fc(t){const{type:e,length:r,stride:i}=t;switch(e.typeId){case le.Int:case le.Float:case le.Decimal:case le.Time:case le.Timestamp:return t.values.subarray(0,r*i)}return[...hc.visit(t)]}dc.prototype.visitNull=fc,dc.prototype.visitBool=fc,dc.prototype.visitInt=fc,dc.prototype.visitInt8=fc,dc.prototype.visitInt16=fc,dc.prototype.visitInt32=fc,dc.prototype.visitInt64=fc,dc.prototype.visitUint8=fc,dc.prototype.visitUint16=fc,dc.prototype.visitUint32=fc,dc.prototype.visitUint64=fc,dc.prototype.visitFloat=fc,dc.prototype.visitFloat16=fc,dc.prototype.visitFloat32=fc,dc.prototype.visitFloat64=fc,dc.prototype.visitUtf8=fc,dc.prototype.visitBinary=fc,dc.prototype.visitFixedSizeBinary=fc,dc.prototype.visitDate=fc,dc.prototype.visitDateDay=fc,dc.prototype.visitDateMillisecond=fc,dc.prototype.visitTimestamp=fc,dc.prototype.visitTimestampSecond=fc,dc.prototype.visitTimestampMillisecond=fc,dc.prototype.visitTimestampMicrosecond=fc,dc.prototype.visitTimestampNanosecond=fc,dc.prototype.visitTime=fc,dc.prototype.visitTimeSecond=fc,dc.prototype.visitTimeMillisecond=fc,dc.prototype.visitTimeMicrosecond=fc,dc.prototype.visitTimeNanosecond=fc,dc.prototype.visitDecimal=fc,dc.prototype.visitList=fc,dc.prototype.visitStruct=fc,dc.prototype.visitUnion=fc,dc.prototype.visitDenseUnion=fc,dc.prototype.visitSparseUnion=fc,dc.prototype.visitDictionary=fc,dc.prototype.visitInterval=fc,dc.prototype.visitIntervalDayTime=fc,dc.prototype.visitIntervalYearMonth=fc,dc.prototype.visitFixedSizeList=fc,dc.prototype.visitMap=fc;const pc=new dc,yc=(t,e)=>t+e,bc=t=>"Cannot compute the byte width of variable-width column "+t;const gc=new class extends xe{visitNull(t){return 0}visitInt(t){return t.bitWidth/8}visitFloat(t){return t.ArrayType.BYTES_PER_ELEMENT}visitBinary(t){throw new Error(bc(t))}visitUtf8(t){throw new Error(bc(t))}visitBool(t){return 1/8}visitDecimal(t){return 16}visitDate(t){return 4*(t.unit+1)}visitTime(t){return t.bitWidth/8}visitTimestamp(t){return t.unit===fe.SECOND?4:8}visitInterval(t){return 4*(t.unit+1)}visitList(t){throw new Error(bc(t))}visitStruct(t){return this.visitFields(t.children).reduce(yc,0)}visitUnion(t){return this.visitFields(t.children).reduce(yc,0)}visitFixedSizeBinary(t){return t.byteWidth}visitFixedSizeList(t){return t.listSize*this.visitFields(t.children).reduce(yc,0)}visitMap(t){return this.visitFields(t.children).reduce(yc,0)}visitDictionary(t){return this.visit(t.indices)}visitFields(t){return(t||[]).map(t=>this.visit(t.type))}visitSchema(t){return this.visitFields(t.fields).reduce(yc,0)}};const _c=new class extends xe{visitNull(){return _o}visitBool(){return Ra}visitInt(){return io}visitInt8(){return no}visitInt16(){return so}visitInt32(){return ao}visitInt64(){return oo}visitUint8(){return co}visitUint16(){return uo}visitUint32(){return lo}visitUint64(){return ho}visitFloat(){return Ka}visitFloat16(){return Ga}visitFloat32(){return qa}visitFloat64(){return Ja}visitUtf8(){return Uo}visitBinary(){return ka}visitFixedSizeBinary(){return Wa}visitDate(){return za}visitDateDay(){return ja}visitDateMillisecond(){return Pa}visitTimestamp(){return wo}visitTimestampSecond(){return Io}visitTimestampMillisecond(){return So}visitTimestampMicrosecond(){return To}visitTimestampNanosecond(){return Bo}visitTime(){return Ao}visitTimeSecond(){return Do}visitTimeMillisecond(){return xo}visitTimeMicrosecond(){return Lo}visitTimeNanosecond(){return Oo}visitDecimal(){return $a}visitList(){return bo}visitStruct(){return vo}visitUnion(){return Fo}visitDenseUnion(){return Mo}visitSparseUnion(){return Eo}visitDictionary(){return Ya}visitInterval(){return to}visitIntervalDayTime(){return eo}visitIntervalYearMonth(){return ro}visitFixedSizeList(){return Ha}visitMap(){return go}};function mc(t,e){if(Et(e))return oe.from({nullValues:[null,void 0],type:t(),values:e});if(Ut(e))return oe.from({nullValues:[null,void 0],type:t(),values:e});const{values:r=[],type:i=t(),nullValues:n=[null,void 0]}={...e};return Et(r),oe.from({nullValues:n,...e,type:i})}oe.new=function(t,...e){return new(_c.getVisitFn(t)())(t,...e)},oe.from=function(t){const{values:e=[],...r}={nullValues:[null,void 0],...t};if(Et(e)){const t=[...Mr.throughIterable(r)(e)];return 1===t.length?t[0]:Zi.concat(t)}return(async t=>{const i=Mr.throughAsyncIterable(r);for await(const r of i(e))t.push(r);return 1===t.length?t[0]:Zi.concat(t)})([])},Ca.prototype.get=function(t){return nc.visit(this,t)},Ca.prototype.set=function(t,e){return Pn.visit(this,t,e)},Ca.prototype.indexOf=function(t,e){return cc.visit(this,t,e)},Ca.prototype.toArray=function(){return pc.visit(this)},Ca.prototype.getByteWidth=function(){return gc.visit(this.type)},Ca.prototype[Symbol.iterator]=function(){return hc.visit(this)},Ca.prototype._bindDataAccessors=function(){const t=this.nullBitmap;t&&t.byteLength>0&&(this.get=(e=this.get,function(t){return this.isValid(t)?e.call(this,t):null}),this.set=function(t){return function(e,r){we(this.nullBitmap,this.offset+e,!(null==r))&&t.call(this,e,r)}}(this.set));var e},Object.keys(le).map(t=>le[t]).filter(t=>"number"==typeof t).filter(t=>t!==le.NONE).forEach(t=>{const e=_c.visit(t);var r;e.prototype.get=(r=nc.getVisitFn(t),function(t){return r(this,t)}),e.prototype.set=Vo(Pn.getVisitFn(t)),e.prototype.indexOf=Vo(cc.getVisitFn(t)),e.prototype.toArray=No(pc.getVisitFn(t)),e.prototype.getByteWidth=function(t){return function(){return t(this.type)}}(gc.getVisitFn(t)),e.prototype[Symbol.iterator]=No(hc.getVisitFn(t))});class vc extends Zi{constructor(...t){let e=null;t[0]instanceof hn&&(e=t.shift());let r=nn(wc,t);if(!e&&!(e=r[0]&&r[0].schema))throw new TypeError("Table must be initialized with a Schema or at least one RecordBatch");r[0]||(r[0]=new Ic(e)),super(new pr(e.fields),r),this._schema=e,this._chunks=r}static empty(t=new hn([])){return new vc(t,[])}static from(t){if(!t)return vc.empty();if("object"==typeof t){let e=Et(t.values)?function(t){const{type:e}=t;if(e instanceof pr)return vc.fromStruct(vo.from(t));return null}(t):Ut(t.values)?function(t){const{type:e}=t;if(e instanceof pr)return vo.from(t).then(t=>vc.fromStruct(t));return null}(t):null;if(null!==e)return e}let e=Tc.from(t);return Mt(e)?(async()=>await vc.from(await e))():e.isSync()&&(e=e.open())?e.schema?new vc(e.schema,[...e]):vc.empty():(async t=>{const e=await t,r=e.schema,i=[];if(r){for await(let t of e)i.push(t);return new vc(r,i)}return vc.empty()})(e.open())}static async fromAsync(t){return await vc.from(t)}static fromStruct(t){return vc.new(t.data.childData,t.type.children)}static new(...t){return new vc(...(e=(t=>{const[e,r]=ln(t,[[],[]]);return r.map((t,r)=>t instanceof tn?tn.new(t.field.clone(e[r]),t):t instanceof oe?tn.new(e[r],t):tn.new(e[r],[]))})(t),Na(new hn(e.map(({field:t})=>t)),e)));var e}get schema(){return this._schema}get length(){return this._length}get chunks(){return this._chunks}get numCols(){return this._numChildren}clone(t=this._chunks){return new vc(this._schema,t)}getColumn(t){return this.getColumnAt(this.getColumnIndex(t))}getColumnAt(t){return this.getChildAt(t)}getColumnIndex(t){return this._schema.fields.findIndex(e=>e.name===t)}getChildAt(t){if(t<0||t>=this.numChildren)return null;let e,r;const i=this._schema.fields,n=this._children||(this._children=[]);if(r=n[t])return r;if(e=i[t]){const r=this._chunks.map(e=>e.getChildAt(t)).filter(t=>null!=t);if(r.length>0)return n[t]=new tn(e,r)}return null}serialize(t="binary",e=!0){return(e?La:Oa).writeAll(this).toUint8Array(!0)}count(){return this._length}select(...t){const e=this._schema.fields.reduce((t,e,r)=>t.set(e.name,r),new Map);return this.selectAt(...t.map(t=>e.get(t)).filter(t=>t>-1))}selectAt(...t){const e=this._schema.selectAt(...t);return new vc(e,this._chunks.map(({length:r,data:{childData:i}})=>new wc(e,r,t.map(t=>i[t]).filter(Boolean))))}assign(t){const e=this._schema.fields,[r,i]=t.schema.fields.reduce((t,r,i)=>{const[n,s]=t,a=e.findIndex(t=>t.name===r.name);return~a?s[a]=i:n.push(i),t},[[],[]]),n=this._schema.assign(t.schema),s=[...e.map((e,r,n,s=i[r])=>void 0===s?this.getColumnAt(r):t.getColumnAt(s)),...r.map(e=>t.getColumnAt(e))].filter(Boolean);return new vc(...Na(n,s))}}class wc extends vo{constructor(...t){let e,r,i=t[0];if(t[1]instanceof Sr)[,e,r]=t;else{const r=i.fields,[,n,s]=t;e=Sr.Struct(new pr(r),0,n,0,null,s)}super(e,r),this._schema=i}static from(t){return Et(t.values),vc.from(t)}static new(...t){const[e,r]=sn(t),i=r.filter(t=>t instanceof oe);return new wc(...function(t,e,r=e.reduce((t,e)=>Math.max(t,e.length),0)){let i,n,s=-1,a=e.length;const o=[...t.fields],c=[],u=(r+63&-64)>>3;for(;++s<a;)(i=e[s])&&i.length===r?c[s]=i:((n=o[s]).nullable||(o[s]=o[s].clone({nullable:!0})),c[s]=i?i._changeLengthAndBackfillNullBitmap(r):Sr.new(n.type,0,r,r,Ua(u)));return[new hn(o),r,c]}(new hn(e),i.map(t=>t.data)))}clone(t,e=this._children){return new wc(this._schema,t,e)}concat(...t){const e=this._schema,r=Zi.flatten(this,...t);return new vc(e,r.map(({data:t})=>new wc(e,t)))}get schema(){return this._schema}get numCols(){return this._schema.fields.length}get dictionaries(){return this._dictionaries||(this._dictionaries=Sc.collect(this))}select(...t){const e=this._schema.fields.reduce((t,e,r)=>t.set(e.name,r),new Map);return this.selectAt(...t.map(t=>e.get(t)).filter(t=>t>-1))}selectAt(...t){const e=this._schema.selectAt(...t),r=t.map(t=>this.data.childData[t]).filter(Boolean);return new wc(e,this.length,r)}}class Ic extends wc{constructor(t){super(t,0,t.fields.map(t=>Sr.new(t.type,0,0,0)))}}class Sc extends xe{constructor(){super(...arguments),this.dictionaries=new Map}static collect(t){return(new Sc).visit(t.data,new pr(t.schema.fields)).dictionaries}visit(t,e){return je.isDictionary(e)?this.visitDictionary(t,e):(t.childData.forEach((t,r)=>this.visit(t,e.children[r].type)),this)}visitDictionary(t,e){const r=t.dictionary;return r&&r.length>0&&this.dictionaries.set(e.id,r),this}}class Tc extends wt{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){const e=this._impl.open(t);return Mt(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return ie.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return ie.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Tc?t:Nt(t)?function(t){return new Bc(new Uc(t))}(t):Ct(t)?async function(t){const{size:e}=await t.stat(),r=new ss(t,e);if(e>=wa&&_a(await r.readAt(0,ma+7&-8)))return new xc(new Ec(r));return new Ac(new Fc(r))}(t):Mt(t)?(async()=>await Tc.from(await t))():kt(t)||Rt(t)||zt(t)||Ut(t)?async function(t){const e=await t.peek(ma+7&-8);return e&&e.byteLength>=4?_a(e)?new Dc(new Mc(await t.read())):new Ac(new Fc(t)):new Ac(new Fc(async function*(){}()))}(new es(t)):function(t){const e=t.peek(ma+7&-8);return e&&e.byteLength>=4?_a(e)?new Dc(new Mc(t.read())):new Bc(new Oc(t)):new Bc(new Oc(function*(){}()))}(new ts(t))}static readAll(t){return t instanceof Tc?t.isSync()?Vc(t):Cc(t):Nt(t)||ArrayBuffer.isView(t)||Et(t)||Vt(t)?Vc(t):Cc(t)}}class Bc extends Tc{constructor(t){super(t),this._impl=t}[Symbol.iterator](){return this._impl[Symbol.iterator]()}async*[Symbol.asyncIterator](){yield*this[Symbol.iterator]()}}class Ac extends Tc{constructor(t){super(t),this._impl=t}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class Dc extends Bc{constructor(t){super(t),this._impl=t}}class xc extends Ac{constructor(t){super(t),this._impl=t}}class Lc{constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){return new wc(this.schema,t.length,this._loadVectors(t,e,this.schema.fields))}_loadDictionaryBatch(t,e){const{id:r,isDelta:i,data:n}=t,{dictionaries:s,schema:a}=this,o=s.get(r);if(i||!o){const t=a.dictionaries.get(r);return o&&i?o.concat(oe.new(this._loadVectors(n,e,[t])[0])):oe.new(this._loadVectors(n,e,[t])[0])}return o}_loadVectors(t,e,r){return new ds(e,t.nodes,t.buffers,this.dictionaries).visitMany(r)}}class Oc extends Lc{constructor(t,e){super(e),this._reader=Nt(t)?new ya(this._handle=t):new fa(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Nc(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):mt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):mt}next(){if(this.closed)return mt;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else{if(t.isRecordBatch()){this._recordBatchIndex++;const r=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}if(t.isDictionaryBatch()){this._dictionaryIndex++;const r=t.header(),i=e.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,n)}}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new Ic(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class Fc extends Lc{constructor(t,e){super(e),this._reader=new pa(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}async cancel(){!this.closed&&(this.closed=!0)&&(await this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}async open(t){return this.closed||(this.autoDestroy=Nc(this,t),this.schema||(this.schema=await this._reader.readSchema())||await this.cancel()),this}async throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?await this.reset()._reader.throw(t):mt}async return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?await this.reset()._reader.return(t):mt}async next(){if(this.closed)return mt;let t,{_reader:e}=this;for(;t=await this._readNextMessageAndValidate();)if(t.isSchema())await this.reset(t.header());else{if(t.isRecordBatch()){this._recordBatchIndex++;const r=t.header(),i=await e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}if(t.isDictionaryBatch()){this._dictionaryIndex++;const r=t.header(),i=await e.readMessageBody(t.bodyLength),n=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,n)}}return this.schema&&0===this._recordBatchIndex?(this._recordBatchIndex++,{done:!1,value:new Ic(this.schema)}):await this.return()}async _readNextMessageAndValidate(t){return await this._reader.readMessage(t)}}class Mc extends Oc{constructor(t,e){super(t instanceof ns?t:new ns(t),e)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){if(this.closed)return null;this._footer||this.open();const e=this._footer&&this._footer.getRecordBatch(t);if(e&&this._handle.seek(e.offset)){const t=this._reader.readMessage(ge.RecordBatch);if(t&&t.isRecordBatch()){const e=t.header(),r=this._reader.readMessageBody(t.bodyLength);return this._loadRecordBatch(e,r)}}return null}_readDictionaryBatch(t){const e=this._footer&&this._footer.getDictionaryBatch(t);if(e&&this._handle.seek(e.offset)){const t=this._reader.readMessage(ge.DictionaryBatch);if(t&&t.isDictionaryBatch()){const e=t.header(),r=this._reader.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(e,r);this.dictionaries.set(e.id,i)}}}_readFooter(){const{_handle:t}=this,e=t.size-va,r=t.readInt32(e),i=t.readAt(e-r,r);return Jn.decode(i)}_readNextMessageAndValidate(t){if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const e=this._footer&&this._footer.getRecordBatch(this._recordBatchIndex);if(e&&this._handle.seek(e.offset))return this._reader.readMessage(t)}return null}}class Ec extends Fc{constructor(t,...e){const r="number"!=typeof e[0]?e.shift():void 0,i=e[0]instanceof Map?e.shift():void 0;super(t instanceof ss?t:new ss(t,r),i)}get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}isFile(){return!0}isAsync(){return!0}async open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=await this._readFooter()).schema;for(const t of this._footer.dictionaryBatches())t&&await this._readDictionaryBatch(this._dictionaryIndex++)}return await super.open(t)}async readRecordBatch(t){if(this.closed)return null;this._footer||await this.open();const e=this._footer&&this._footer.getRecordBatch(t);if(e&&await this._handle.seek(e.offset)){const t=await this._reader.readMessage(ge.RecordBatch);if(t&&t.isRecordBatch()){const e=t.header(),r=await this._reader.readMessageBody(t.bodyLength);return this._loadRecordBatch(e,r)}}return null}async _readDictionaryBatch(t){const e=this._footer&&this._footer.getDictionaryBatch(t);if(e&&await this._handle.seek(e.offset)){const t=await this._reader.readMessage(ge.DictionaryBatch);if(t&&t.isDictionaryBatch()){const e=t.header(),r=await this._reader.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(e,r);this.dictionaries.set(e.id,i)}}}async _readFooter(){const{_handle:t}=this;t._pending&&await t._pending;const e=t.size-va,r=await t.readInt32(e),i=await t.readAt(e-r,r);return Jn.decode(i)}async _readNextMessageAndValidate(t){if(this._footer||await this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&await this._handle.seek(e.offset))return await this._reader.readMessage(t)}return null}}class Uc extends Oc{constructor(t,e){super(t,e)}_loadVectors(t,e,r){return new fs(e,t.nodes,t.buffers,this.dictionaries).visitMany(r)}}function Nc(t,e){return e&&"boolean"==typeof e.autoDestroy?e.autoDestroy:t.autoDestroy}function*Vc(t){const e=Tc.from(t);try{if(!e.open({autoDestroy:!1}).closed)do{yield e}while(!e.reset().open().closed)}finally{e.cancel()}}async function*Cc(t){const e=await Tc.from(t);try{if(!(await e.open({autoDestroy:!1})).closed)do{yield e}while(!(await e.reset().open()).closed)}finally{await e.cancel()}}class kc{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;const{readableStrategy:e,writableStrategy:r,queueingStrategy:i="count",...n}=t;this._controller=null,this._builder=Mr.new(n),this._getSize="bytes"!==i?Rc:zc;const{highWaterMark:s=("bytes"===i?16384:1e3)}={...e},{highWaterMark:a=("bytes"===i?16384:1e3)}={...r};this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:t=>{this._maybeFlush(this._builder,this._controller=t)},start:t=>{this._maybeFlush(this._builder,this._controller=t)}},{highWaterMark:s,size:"bytes"!==i?Rc:zc}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:t=>this._writeValueAndReturnChunkSize(t)})}_writeValueAndReturnChunkSize(t){const e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){null!==e&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||0===this._numChunks)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,null===e?t.close():t.enqueue(e)}}const Rc=t=>t.length,zc=t=>t.byteLength;class jc{eq(t){return t instanceof jc||(t=new Pc(t)),new qc(this,t)}le(t){return t instanceof jc||(t=new Pc(t)),new Jc(this,t)}ge(t){return t instanceof jc||(t=new Pc(t)),new Zc(this,t)}lt(t){return new Qc(this.ge(t))}gt(t){return new Qc(this.le(t))}ne(t){return new Qc(this.eq(t))}}class Pc extends jc{constructor(t){super(),this.v=t}}class $c extends jc{constructor(t){super(),this.name=t}bind(t){if(!this.colidx){this.colidx=-1;const e=t.schema.fields;for(let t=-1;++t<e.length;)if(e[t].name===this.name){this.colidx=t;break}if(this.colidx<0)throw new Error(`Failed to bind Col "${this.name}"`)}const e=this.vector=t.getChildAt(this.colidx);return t=>e.get(t)}}class Yc{and(...t){return new Kc(this,...t)}or(...t){return new Gc(this,...t)}not(){return new Qc(this)}}class Wc extends Yc{constructor(t,e){super(),this.left=t,this.right=e}bind(t){return this.left instanceof Pc?this.right instanceof Pc?this._bindLitLit(t,this.left,this.right):this._bindLitCol(t,this.left,this.right):this.right instanceof Pc?this._bindColLit(t,this.left,this.right):this._bindColCol(t,this.left,this.right)}}class Hc extends Yc{constructor(...t){super(),this.children=t}}Hc.prototype.children=Object.freeze([]);class Kc extends Hc{constructor(...t){t=t.reduce((t,e)=>t.concat(e instanceof Kc?e.children:e),[]),super(...t)}bind(t){const e=this.children.map(e=>e.bind(t));return(t,r)=>e.every(e=>e(t,r))}}class Gc extends Hc{constructor(...t){t=t.reduce((t,e)=>t.concat(e instanceof Gc?e.children:e),[]),super(...t)}bind(t){const e=this.children.map(e=>e.bind(t));return(t,r)=>e.some(e=>e(t,r))}}class qc extends Wc{_bindLitLit(t,e,r){const i=e.v==r.v;return()=>i}_bindColCol(t,e,r){const i=e.bind(t),n=r.bind(t);return(t,e)=>i(t,e)==n(t,e)}_bindColLit(t,e,r){const i=e.bind(t);if(e.vector instanceof Ya){let t;const i=e.vector;return i.dictionary!==this.lastDictionary?(t=i.reverseLookup(r.v),this.lastDictionary=i.dictionary,this.lastKey=t):t=this.lastKey,-1===t?()=>!1:e=>i.getKey(e)===t}return(t,e)=>i(t,e)==r.v}_bindLitCol(t,e,r){return this._bindColLit(t,r,e)}}class Jc extends Wc{_bindLitLit(t,e,r){const i=e.v<=r.v;return()=>i}_bindColCol(t,e,r){const i=e.bind(t),n=r.bind(t);return(t,e)=>i(t,e)<=n(t,e)}_bindColLit(t,e,r){const i=e.bind(t);return(t,e)=>i(t,e)<=r.v}_bindLitCol(t,e,r){const i=r.bind(t);return(t,r)=>e.v<=i(t,r)}}class Zc extends Wc{_bindLitLit(t,e,r){const i=e.v>=r.v;return()=>i}_bindColCol(t,e,r){const i=e.bind(t),n=r.bind(t);return(t,e)=>i(t,e)>=n(t,e)}_bindColLit(t,e,r){const i=e.bind(t);return(t,e)=>i(t,e)>=r.v}_bindLitCol(t,e,r){const i=r.bind(t);return(t,r)=>e.v>=i(t,r)}}class Qc extends Yc{constructor(t){super(),this.child=t}bind(t){const e=this.child.bind(t);return(t,r)=>!e(t,r)}}vc.prototype.countBy=function(t){return new Xc(this.chunks).countBy(t)},vc.prototype.scan=function(t,e){return new Xc(this.chunks).scan(t,e)},vc.prototype.scanReverse=function(t,e){return new Xc(this.chunks).scanReverse(t,e)},vc.prototype.filter=function(t){return new Xc(this.chunks).filter(t)};class Xc extends vc{filter(t){return new eu(this.chunks,t)}scan(t,e){const r=this.chunks,i=r.length;for(let n=-1;++n<i;){const i=r[n];e&&e(i);for(let e=-1,r=i.length;++e<r;)t(e,i)}}scanReverse(t,e){const r=this.chunks;for(let i=r.length;--i>=0;){const n=r[i];e&&e(n);for(let e=n.length;--e>=0;)t(e,n)}}countBy(t){const e=this.chunks,r=e.length,i="string"==typeof t?new $c(t):t;i.bind(e[r-1]);const n=i.vector;if(!je.isDictionary(n.type))throw new Error("countBy currently only supports dictionary-encoded columns");const s=Math.ceil(Math.log(n.length)/Math.log(256)),a=new(4==s?Uint32Array:s>=2?Uint16Array:Uint8Array)(n.dictionary.length);for(let t=-1;++t<r;){const r=e[t];i.bind(r);const n=i.vector.indices;for(let t=-1,e=r.length;++t<e;){let e=n.get(t);null!==e&&a[e]++}}return new tu(n.dictionary,io.from(a))}}class tu extends vc{constructor(t,e){const r=new hn([new dn("values",t.type),new dn("counts",e.type)]);super(new wc(r,e.length,[t,e]))}toJSON(){const t=this.getColumnAt(0),e=this.getColumnAt(1),r={};for(let i=-1;++i<this.length;)r[t.get(i)]=e.get(i);return r}}class eu extends Xc{constructor(t,e){super(t),this._predicate=e}scan(t,e){const r=this._chunks,i=r.length;for(let n=-1;++n<i;){const i=r[n],s=this._predicate.bind(i);let a=!1;for(let r=-1,n=i.length;++r<n;)s(r,i)&&(e&&!a&&(e(i),a=!0),t(r,i))}}scanReverse(t,e){const r=this._chunks;for(let i=r.length;--i>=0;){const n=r[i],s=this._predicate.bind(n);let a=!1;for(let r=n.length;--r>=0;)s(r,n)&&(e&&!a&&(e(n),a=!0),t(r,n))}}count(){let t=0;const e=this._chunks,r=e.length;for(let i=-1;++i<r;){const r=e[i],n=this._predicate.bind(r);for(let e=-1,i=r.length;++e<i;)n(e,r)&&++t}return t}*[Symbol.iterator](){const t=this._chunks,e=t.length;for(let r=-1;++r<e;){const e=t[r],i=this._predicate.bind(e);for(let t=-1,r=e.length;++t<r;)i(t,e)&&(yield e.get(t))}}filter(t){return new eu(this._chunks,this._predicate.and(t))}countBy(t){const e=this._chunks,r=e.length,i="string"==typeof t?new $c(t):t;i.bind(e[r-1]);const n=i.vector;if(!je.isDictionary(n.type))throw new Error("countBy currently only supports dictionary-encoded columns");const s=Math.ceil(Math.log(n.length)/Math.log(256)),a=new(4==s?Uint32Array:s>=2?Uint16Array:Uint8Array)(n.dictionary.length);for(let t=-1;++t<r;){const r=e[t],n=this._predicate.bind(r);i.bind(r);const s=i.vector.indices;for(let t=-1,e=r.length;++t<e;){let e=s.get(t);null!==e&&n(t,r)&&a[e]++}}return new tu(n.dictionary,io.from(a))}}ie.toDOMStream=function(t,e){if(Ut(t))return function(t,e){let r=null;const i=e&&"bytes"===e.type||!1,n=e&&e.highWaterMark||2**24;return new ReadableStream({...e,async start(e){await s(e,r||(r=t[Symbol.asyncIterator]()))},async pull(t){r?await s(t,r):t.close()},async cancel(){r&&r.return&&await r.return(),r=null}},{highWaterMark:i?n:void 0,...e});async function s(t,e){let r,n=null,s=t.desiredSize||null;for(;!(n=await e.next(i?s:null)).done;)if(ArrayBuffer.isView(n.value)&&(r=Gt(n.value))&&(null!=s&&i&&(s=s-r.byteLength+1),n.value=r),t.enqueue(n.value),null!=s&&--s<=0)return;t.close()}}(t,e);if(Et(t))return function(t,e){let r=null;const i=e&&"bytes"===e.type||!1,n=e&&e.highWaterMark||2**24;return new ReadableStream({...e,start(e){s(e,r||(r=t[Symbol.iterator]()))},pull(t){r?s(t,r):t.close()},cancel(){r&&r.return&&r.return(),r=null}},{highWaterMark:i?n:void 0,...e});function s(t,e){let r,n=null,s=t.desiredSize||null;for(;!(n=e.next(i?s:null)).done;)if(ArrayBuffer.isView(n.value)&&(r=Gt(n.value))&&(null!=s&&i&&(s=s-r.byteLength+1),n.value=r),t.enqueue(n.value),null!=s&&--s<=0)return;t.close()}}(t,e);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")},Mr.throughDOM=function(t){return new kc(t)},Tc.throughDOM=function(t,e){const r=new Xn;let i=null;const n=new ReadableStream({async cancel(){await r.close()},async start(t){await s(t,i||(i=await async function(){return await(await Tc.from(r)).open(e)}()))},async pull(t){i?await s(t,i):t.close()}});return{writable:new WritableStream(r,{highWaterMark:16384,...t}),readable:n};async function s(t,e){let r=t.desiredSize,i=null;for(;!(i=await e.next()).done;)if(t.enqueue(i.value),null!=r&&--r<=0)return;t.close()}},xa.throughDOM=function(t,e){const r=new this(t),i=new es(r),n=new ReadableStream({type:"bytes",async cancel(){await i.cancel()},async pull(t){await s(t)},async start(t){await s(t)}},{highWaterMark:16384,...e});return{writable:new WritableStream(r,t),readable:n};async function s(t){let e=null,r=t.desiredSize;for(;e=await i.read(r||null);)if(t.enqueue(e),null!=r&&(r-=e.byteLength)<=0)return;t.close()}};
/**
     * @license
     * Copyright 2018-2019 Streamlit Inc.
     *
     * Licensed 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.
     */
class ru{constructor(t,e,r,i){this.getCell=(t,e)=>{const r=t<this.headerRows&&e<this.headerColumns,i=t>=this.headerRows&&e<this.headerColumns,n=t<this.headerRows&&e>=this.headerColumns;if(r){const r=["blank"];return e>0&&r.push("level"+t),{type:"blank",classNames:r.join(" "),content:""}}if(n){const r=e-this.headerColumns;return{type:"columns",classNames:["col_heading","level"+t,"col"+r].join(" "),content:this.getContent(this.columnsTable,r,t)}}if(i){const r=t-this.headerRows,i=["row_heading","level"+e,"row"+r];return{type:"index",id:`T_${this.uuid}level${e}_row${r}`,classNames:i.join(" "),content:this.getContent(this.indexTable,r,e)}}{const r=t-this.headerRows,i=e-this.headerColumns,n=["data","row"+r,"col"+i],s=this.styler?this.getContent(this.styler.displayValuesTable,r,i):this.getContent(this.dataTable,r,i);return{type:"data",id:`T_${this.uuid}row${r}_col${i}`,classNames:n.join(" "),content:s}}},this.getContent=(t,e,r)=>{const i=t.getColumnAt(r);if(null===i)return"";switch(this.getColumnTypeId(t,r)){case le.Timestamp:return this.nanosToDate(i.get(e));default:return i.get(e)}},this.dataTable=vc.from(t),this.indexTable=vc.from(e),this.columnsTable=vc.from(r),this.styler=i?{caption:i.get("caption"),displayValuesTable:vc.from(i.get("displayValues")),styles:i.get("styles"),uuid:i.get("uuid")}:void 0}get rows(){return this.indexTable.length+this.columnsTable.numCols}get columns(){return this.indexTable.numCols+this.columnsTable.length}get headerRows(){return this.rows-this.dataRows}get headerColumns(){return this.columns-this.dataColumns}get dataRows(){return this.dataTable.length}get dataColumns(){return this.dataTable.numCols}get uuid(){return this.styler&&this.styler.uuid}get caption(){return this.styler&&this.styler.caption}get styles(){return this.styler&&this.styler.styles}get table(){return this.dataTable}get index(){return this.indexTable}get columnTable(){return this.columnsTable}getColumnTypeId(t,e){return t.schema.fields[e].type.typeId}nanosToDate(t){return new Date(t/1e6)}}
/**
     * @license
     * Copyright 2018-2020 Streamlit Inc.
     *
     * Licensed 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.
     */var iu;!function(t){t.COMPONENT_READY="streamlit:componentReady",t.SET_COMPONENT_VALUE="streamlit:setComponentValue",t.SET_FRAME_HEIGHT="streamlit:setFrameHeight"}(iu||(iu={}));class nu{}function su(t){let e,r,i,n;const s=[ou,au],a=[];function o(t,e){return t[1]?0:1}return e=o(t),r=a[e]=s[e](t),{c(){r.c(),i=p()},m(t,r){a[e].m(t,r),h(t,i,r),n=!0},p(t,n){let c=e;e=o(t),e===c?a[e].p(t,n):(U(),C(a[c],1,1,()=>{a[c]=null}),N(),r=a[e],r?r.p(t,n):(r=a[e]=s[e](t),r.c()),V(r,1),r.m(i.parentNode,i))},i(t){n||(V(r),n=!0)},o(t){C(r),n=!1},d(t){a[e].d(t),t&&d(i)}}}function au(t){let e,r,i;var n=t[0];function s(t){return{props:{args:t[3],disabled:t[5],width:t[4]}}}return n&&(e=new n(s(t))),{c(){e&&k(e.$$.fragment),r=p()},m(t,n){e&&R(e,t,n),h(t,r,n),i=!0},p(t,i){const a={};if(8&i&&(a.args=t[3]),32&i&&(a.disabled=t[5]),16&i&&(a.width=t[4]),n!==(n=t[0])){if(e){U();const t=e;C(t.$$.fragment,1,0,()=>{z(t,1)}),N()}n?(e=new n(s(t)),k(e.$$.fragment),V(e.$$.fragment,1),R(e,r.parentNode,r)):e=null}else n&&e.$set(a)},i(t){i||(e&&V(e.$$.fragment,t),i=!0)},o(t){e&&C(e.$$.fragment,t),i=!1},d(t){t&&d(r),e&&z(e,t)}}}function ou(t){let r,i,n;const s=[t[3],{disabled:t[5]},{width:t[4]}];var a=t[0];function o(t){let r={};for(let t=0;t<s.length;t+=1)r=e(r,s[t]);return{props:r}}return a&&(r=new a(o())),{c(){r&&k(r.$$.fragment),i=p()},m(t,e){r&&R(r,t,e),h(t,i,e),n=!0},p(t,e){const n=56&e?function(t,e){const r={},i={},n={$$scope:1};let s=t.length;for(;s--;){const a=t[s],o=e[s];if(o){for(const t in a)t in o||(i[t]=1);for(const t in o)n[t]||(r[t]=o[t],n[t]=1);t[s]=o}else for(const t in a)n[t]=1}for(const t in i)t in r||(r[t]=void 0);return r}(s,[8&e&&(c=t[3],"object"==typeof c&&null!==c?c:{}),32&e&&{disabled:t[5]},16&e&&{width:t[4]}]):{};var c;if(a!==(a=t[0])){if(r){U();const t=r;C(t.$$.fragment,1,0,()=>{z(t,1)}),N()}a?(r=new a(o()),k(r.$$.fragment),V(r.$$.fragment,1),R(r,i.parentNode,i)):r=null}else a&&r.$set(n)},i(t){n||(r&&V(r.$$.fragment,t),n=!0)},o(t){r&&C(r.$$.fragment,t),n=!1},d(t){t&&d(i),r&&z(r,t)}}}function cu(t){let e,r,i,n;D(t[6]);let s=t[2]&&su(t);return{c(){s&&s.c(),e=p()},m(a,o){s&&s.m(a,o),h(a,e,o),r=!0,i||(n=y(window,"resize",t[6]),i=!0)},p(t,[r]){t[2]?s?(s.p(t,r),4&r&&V(s,1)):(s=su(t),s.c(),V(s,1),s.m(e.parentNode,e)):s&&(U(),C(s,1,1,()=>{s=null}),N())},i(t){r||(V(s),r=!0)},o(t){C(s),r=!1},d(t){s&&s.d(t),t&&d(e),i=!1,n()}}}function uu(t,e,r){let i,n,s,a,{component:o}=e,{spreadArgs:c=!0}=e;const u=t=>{r(2,i=t.detail),r(3,n=i.args),r(5,a=i.disabled)};var l;return v(()=>{nu.events.addEventListener(nu.RENDER_EVENT,u),nu.setComponentReady()}),l=()=>{nu.events.removeEventListener(nu.RENDER_EVENT,u)},m().$$.on_destroy.push(l),t.$$set=t=>{"component"in t&&r(0,o=t.component),"spreadArgs"in t&&r(1,c=t.spreadArgs)},[o,c,i,n,s,a,function(){r(4,s=window.innerWidth)}]}nu.API_VERSION=1,nu.RENDER_EVENT="streamlit:render",nu.events=new st,nu.registeredMessageListener=!1,nu.setComponentReady=()=>{nu.registeredMessageListener||(window.addEventListener("message",nu.onMessageEvent),nu.registeredMessageListener=!0),nu.sendBackMsg(iu.COMPONENT_READY,{apiVersion:nu.API_VERSION})},nu.setFrameHeight=t=>{void 0===t&&(t=document.body.scrollHeight),t!==nu.lastFrameHeight&&(nu.lastFrameHeight=t,nu.sendBackMsg(iu.SET_FRAME_HEIGHT,{height:t}))},nu.setComponentValue=t=>{nu.sendBackMsg(iu.SET_COMPONENT_VALUE,{value:t})},nu.onMessageEvent=t=>{switch(t.data.type){case nu.RENDER_EVENT:nu.onRenderMessage(t.data)}},nu.onRenderMessage=t=>{let e=t.args;null==e&&(console.error("Got null args in onRenderMessage. This should never happen"),e={});const r=t.dfs&&t.dfs.length>0?nu.argsDataframeToObject(t.dfs):{};e={...e,...r};const i={disabled:Boolean(t.disabled),args:e},n=new CustomEvent(nu.RENDER_EVENT,{detail:i});nu.events.dispatchEvent(n)},nu.argsDataframeToObject=t=>{const e=t.map(({key:t,value:e})=>[t,nu.toArrowTable(e)]);return Object.fromEntries(e)},nu.toArrowTable=t=>{const{data:e,index:r,columns:i}=t.data;return new ru(e,r,i)},nu.sendBackMsg=(t,e)=>{window.parent.postMessage({isStreamlitMessage:!0,type:t,...e},"*")};const lu=()=>{var t;v(()=>{nu.setFrameHeight()}),t=()=>{nu.setFrameHeight()},m().$$.after_update.push(t)};function hu(t){l(t,"svelte-1q3l3t1",".scroller.svelte-1q3l3t1{min-height:100px;overflow-x:scroll;overflow-y:hidden;white-space:nowrap}img.svelte-1q3l3t1{display:inline-block;padding:1%;border-radius:20px;opacity:0.9;transition:all .2s}img.svelte-1q3l3t1:hover{opacity:1;transform:scale(1.05);cursor:pointer}")}function du(t,e,r){const i=t.slice();return i[4]=e[r],i}function fu(t){let e,r,i,n,s;return{c(){e=f("img"),u(e.src,r=t[4])||b(e,"src",r),b(e,"id",i=t[4]),b(e,"alt",""),g(e,"height",t[1]+"px"),b(e,"class","svelte-1q3l3t1")},m(r,i){h(r,e,i),n||(s=y(e,"click",t[2]),n=!0)},p(t,n){1&n&&!u(e.src,r=t[4])&&b(e,"src",r),1&n&&i!==(i=t[4])&&b(e,"id",i),2&n&&g(e,"height",t[1]+"px")},d(t){t&&d(e),n=!1,s()}}}function pu(e){let r,i=e[0],n=[];for(let t=0;t<i.length;t+=1)n[t]=fu(du(e,i,t));return{c(){r=f("div");for(let t=0;t<n.length;t+=1)n[t].c();b(r,"class","scroller svelte-1q3l3t1")},m(t,e){h(t,r,e);for(let t=0;t<n.length;t+=1)n[t].m(r,null)},p(t,[e]){if(7&e){let s;for(i=t[0],s=0;s<i.length;s+=1){const a=du(t,i,s);n[s]?n[s].p(a,e):(n[s]=fu(a),n[s].c(),n[s].m(r,null))}for(;s<n.length;s+=1)n[s].d(1);n.length=i.length}},i:t,o:t,d(t){t&&d(r),function(t,e){for(let r=0;r<t.length;r+=1)t[r]&&t[r].d(e)}(n,t)}}}function yu(t,e,r){lu();let i,{imageUrls:n}=e,{height:s}=e;return t.$$set=t=>{"imageUrls"in t&&r(0,n=t.imageUrls),"height"in t&&r(1,s=t.height)},[n,s,function(t){i=t.srcElement.currentSrc,nu.setComponentValue(i)}]}class bu extends ${constructor(t){super(),P(this,t,yu,pu,a,{imageUrls:0,height:1},hu)}}return new class extends ${constructor(t){super(),P(this,t,uu,cu,a,{component:0,spreadArgs:1})}}({target:document.body,props:{component:bu,spreadArgs:!0}}),bu}();
//# sourceMappingURL=bundle.js.map